From 1ad2588cd39a92a6f222e390b54e6ba9648aa8e0 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 29 Jun 2004 18:48:23 +0100 Subject: [PATCH] [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. --- include/asm-arm/arch-ixp4xx/dma.h | 26 --------------------- include/asm-arm/arch-ixp4xx/memory.h | 34 ++++++++++++++++++++++++++++ include/asm-arm/arch-sa1100/dma.h | 17 -------------- include/asm-arm/arch-sa1100/memory.h | 24 ++++++++++++++++++++ include/asm-arm/arch-shark/dma.h | 12 ---------- include/asm-arm/arch-shark/memory.h | 21 +++++++++++++++++ include/asm-arm/dma.h | 5 ---- include/asm-arm/memory.h | 6 ++++- 8 files changed, 84 insertions(+), 61 deletions(-) diff --git a/include/asm-arm/arch-ixp4xx/dma.h b/include/asm-arm/arch-ixp4xx/dma.h index 686eacaf013c4..312065dc0e7ab 100644 --- a/include/asm-arm/arch-ixp4xx/dma.h +++ b/include/asm-arm/arch-ixp4xx/dma.h @@ -23,30 +23,4 @@ /* No DMA */ #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 */ diff --git a/include/asm-arm/arch-ixp4xx/memory.h b/include/asm-arm/arch-ixp4xx/memory.h index 3f6da112712e3..d348548b592b7 100644 --- a/include/asm-arm/arch-ixp4xx/memory.h +++ b/include/asm-arm/arch-ixp4xx/memory.h @@ -7,11 +7,45 @@ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H +#include + /* * Physical DRAM offset. */ #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 * virt_to_bus: Used to translate the virtual address to an diff --git a/include/asm-arm/arch-sa1100/dma.h b/include/asm-arm/arch-sa1100/dma.h index 8927a3d26172b..3d60ed9f8c34b 100644 --- a/include/asm-arm/arch-sa1100/dma.h +++ b/include/asm-arm/arch-sa1100/dma.h @@ -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) - -#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 */ diff --git a/include/asm-arm/arch-sa1100/memory.h b/include/asm-arm/arch-sa1100/memory.h index 38794846b3a3d..32d3d5bde34db 100644 --- a/include/asm-arm/arch-sa1100/memory.h +++ b/include/asm-arm/arch-sa1100/memory.h @@ -8,12 +8,36 @@ #define __ASM_ARCH_MEMORY_H #include +#include /* * Physical DRAM offset is 0xc0000000 on the SA1100 */ #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 * virt_to_bus: Used to translate the virtual address to an diff --git a/include/asm-arm/arch-shark/dma.h b/include/asm-arm/arch-shark/dma.h index 5c1562f145be1..fc985d5e62af8 100644 --- a/include/asm-arm/arch-shark/dma.h +++ b/include/asm-arm/arch-shark/dma.h @@ -14,17 +14,5 @@ #define MAX_DMA_CHANNELS 8 #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 */ diff --git a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h index 7a06f07f64186..8ff956d254633 100644 --- a/include/asm-arm/arch-shark/memory.h +++ b/include/asm-arm/arch-shark/memory.h @@ -10,11 +10,32 @@ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H +#include + /* * Physical DRAM offset. */ #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 __bus_to_virt(x) __phys_to_virt(x) diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h index 0dee33c1aad86..ef41df43a5847 100644 --- a/include/asm-arm/dma.h +++ b/include/asm-arm/dma.h @@ -6,7 +6,6 @@ typedef unsigned int dmach_t; #include #include #include -#include #include #include @@ -133,8 +132,4 @@ extern int isa_dma_bridge_buggy; #define isa_dma_bridge_buggy (0) #endif -#ifndef arch_adjust_zones -#define arch_adjust_zones(node,size,holes) -#endif - #endif /* _ARM_DMA_H */ diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h index aea8854a79a0c..41f117fb5e9f8 100644 --- a/include/asm-arm/memory.h +++ b/include/asm-arm/memory.h @@ -57,6 +57,8 @@ #error Top of user space clashes with start of module space #endif +#ifndef __ASSEMBLY__ + /* * The DMA mask corresponding to the maximum bus address allocatable * using GFP_DMA. The default here places no restriction on DMA @@ -67,7 +69,9 @@ #define ISA_DMA_THRESHOLD (0xffffffffULL) #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 -- 2.53.0