Commit 1ad2588c authored by Russell King's avatar Russell King

[ARM] Move arch_adjust_zones to asm/memory.h

This places arch_adjust_zones along side ISA_DMA_THRESHOLD.  These
two are related, but having them in separate files means its not
obvious that they are.

ISA_DMA_THRESHOLD is a DMA mask which must be defined such that it
matches the memory handed out by GFP_DMA, which in turn is controlled
by arch_adjust_zones.
parent 550c2ef0
...@@ -23,30 +23,4 @@ ...@@ -23,30 +23,4 @@
/* No DMA */ /* No DMA */
#define MAX_DMA_CHANNELS 0 #define MAX_DMA_CHANNELS 0
/*
* Only first 64MB of memory can be accessed via PCI.
* We use GFP_DMA to allocate safe buffers to do map/unmap.
* This is really ugly and we need a better way of specifying
* DMA-capable regions of memory.
*/
static inline void __arch_adjust_zones(int node, unsigned long *zone_size,
unsigned long *zhole_size)
{
unsigned int sz = SZ_64M >> PAGE_SHIFT;
/*
* Only adjust if > 64M on current system
*/
if (node || (zone_size[0] <= sz))
return;
zone_size[1] = zone_size[0] - sz;
zone_size[0] = sz;
zhole_size[1] = zhole_size[0];
zhole_size[0] = 0;
}
#define arch_adjust_zones(node, size, holes) \
__arch_adjust_zones(node, size, holes)
#endif /* _ASM_ARCH_DMA_H */ #endif /* _ASM_ARCH_DMA_H */
...@@ -7,11 +7,45 @@ ...@@ -7,11 +7,45 @@
#ifndef __ASM_ARCH_MEMORY_H #ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H
#include <asm/sizes.h>
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET (0x00000000UL)
#ifndef __ASSEMBLY__
/*
* Only first 64MB of memory can be accessed via PCI.
* We use GFP_DMA to allocate safe buffers to do map/unmap.
* This is really ugly and we need a better way of specifying
* DMA-capable regions of memory.
*/
static inline void __arch_adjust_zones(int node, unsigned long *zone_size,
unsigned long *zhole_size)
{
unsigned int sz = SZ_64M >> PAGE_SHIFT;
/*
* Only adjust if > 64M on current system
*/
if (node || (zone_size[0] <= sz))
return;
zone_size[1] = zone_size[0] - sz;
zone_size[0] = sz;
zhole_size[1] = zhole_size[0];
zhole_size[0] = 0;
}
#define arch_adjust_zones(node, size, holes) \
__arch_adjust_zones(node, size, holes)
#define ISA_DMA_THRESHOLD (SZ_64M - 1)
#endif
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an * virt_to_bus: Used to translate the virtual address to an
......
...@@ -129,21 +129,4 @@ extern void sa1100_reset_dma(dma_regs_t *regs); ...@@ -129,21 +129,4 @@ extern void sa1100_reset_dma(dma_regs_t *regs);
#define sa1100_clear_dma(regs) ((regs)->ClrDCSR = DCSR_IE|DCSR_RUN|DCSR_STRTA|DCSR_STRTB) #define sa1100_clear_dma(regs) ((regs)->ClrDCSR = DCSR_IE|DCSR_RUN|DCSR_STRTA|DCSR_STRTB)
#ifdef CONFIG_SA1111
static inline void
__arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)
{
unsigned int sz = 256;
if (node != 0)
sz = 0;
size[1] = size[0] - sz;
size[0] = sz;
}
#define arch_adjust_zones(node,size,holes) __arch_adjust_zones(node,size,holes)
#endif
#endif /* _ASM_ARCH_DMA_H */ #endif /* _ASM_ARCH_DMA_H */
...@@ -8,12 +8,36 @@ ...@@ -8,12 +8,36 @@
#define __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H
#include <linux/config.h> #include <linux/config.h>
#include <asm/sizes.h>
/* /*
* Physical DRAM offset is 0xc0000000 on the SA1100 * Physical DRAM offset is 0xc0000000 on the SA1100
*/ */
#define PHYS_OFFSET (0xc0000000UL) #define PHYS_OFFSET (0xc0000000UL)
#ifndef __ASSEMBLY__
#ifdef CONFIG_SA1111
static inline void
__arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)
{
unsigned int sz = SZ_1M >> PAGE_SHIFT;
if (node != 0)
sz = 0;
size[1] = size[0] - sz;
size[0] = sz;
}
#define arch_adjust_zones(node, size, holes) \
__arch_adjust_zones(node, size, holes)
#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
#endif
#endif
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an * virt_to_bus: Used to translate the virtual address to an
......
...@@ -14,17 +14,5 @@ ...@@ -14,17 +14,5 @@
#define MAX_DMA_CHANNELS 8 #define MAX_DMA_CHANNELS 8
#define DMA_ISA_CASCADE 4 #define DMA_ISA_CASCADE 4
static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size)
{
if (node != 0) return;
/* Only the first 4 MB (=1024 Pages) are usable for DMA */
zone_size[1] = zone_size[0] - 1024;
zone_size[0] = 1024;
zhole_size[1] = zhole_size[0];
zhole_size[0] = 0;
}
#define arch_adjust_zones(node,size,holes) __arch_adjust_zones(node,size,holes)
#endif /* _ASM_ARCH_DMA_H */ #endif /* _ASM_ARCH_DMA_H */
...@@ -10,11 +10,32 @@ ...@@ -10,11 +10,32 @@
#ifndef __ASM_ARCH_MEMORY_H #ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H
#include <asm/sizes.h>
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x08000000UL) #define PHYS_OFFSET (0x08000000UL)
#ifndef __ASSEMBLY__
static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size)
{
if (node != 0) return;
/* Only the first 4 MB (=1024 Pages) are usable for DMA */
zone_size[1] = zone_size[0] - 1024;
zone_size[0] = 1024;
zhole_size[1] = zhole_size[0];
zhole_size[0] = 0;
}
#define arch_adjust_zones(node, size, holes) \
__arch_adjust_zones(node, size, holes)
#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1)
#endif
#define __virt_to_bus(x) __virt_to_phys(x) #define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x) #define __bus_to_virt(x) __phys_to_virt(x)
......
...@@ -6,7 +6,6 @@ typedef unsigned int dmach_t; ...@@ -6,7 +6,6 @@ typedef unsigned int dmach_t;
#include <linux/config.h> #include <linux/config.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/memory.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include <asm/arch/dma.h> #include <asm/arch/dma.h>
...@@ -133,8 +132,4 @@ extern int isa_dma_bridge_buggy; ...@@ -133,8 +132,4 @@ extern int isa_dma_bridge_buggy;
#define isa_dma_bridge_buggy (0) #define isa_dma_bridge_buggy (0)
#endif #endif
#ifndef arch_adjust_zones
#define arch_adjust_zones(node,size,holes)
#endif
#endif /* _ARM_DMA_H */ #endif /* _ARM_DMA_H */
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#error Top of user space clashes with start of module space #error Top of user space clashes with start of module space
#endif #endif
#ifndef __ASSEMBLY__
/* /*
* The DMA mask corresponding to the maximum bus address allocatable * The DMA mask corresponding to the maximum bus address allocatable
* using GFP_DMA. The default here places no restriction on DMA * using GFP_DMA. The default here places no restriction on DMA
...@@ -67,7 +69,9 @@ ...@@ -67,7 +69,9 @@
#define ISA_DMA_THRESHOLD (0xffffffffULL) #define ISA_DMA_THRESHOLD (0xffffffffULL)
#endif #endif
#ifndef __ASSEMBLY__ #ifndef arch_adjust_zones
#define arch_adjust_zones(node,size,holes) do { } while (0)
#endif
/* /*
* PFNs are used to describe any physical page; this means * PFNs are used to describe any physical page; this means
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment