diff options
author | Nicolas Pitre <nico@fluxnic.net> | 2011-07-18 15:05:10 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-07-18 15:29:41 -0400 |
commit | 650320181a08b64d4421c65c639cf47ad8cc2cd6 (patch) | |
tree | 5458b989faf4dd0a1216e07da3a76d9d30885c03 | |
parent | 022ae537b23cb14a391565e9ad9e9945f4b17138 (diff) | |
download | blackbird-obmc-linux-650320181a08b64d4421c65c639cf47ad8cc2cd6.tar.gz blackbird-obmc-linux-650320181a08b64d4421c65c639cf47ad8cc2cd6.zip |
ARM: change ARM_DMA_ZONE_SIZE into a variable
Having this value defined at compile time prevents multiple machines with
conflicting definitions to coexist. Move it to a variable in preparation
for having a per machine value selected at run time. This is relevant
only when CONFIG_ZONE_DMA is selected.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r-- | arch/arm/include/asm/dma.h | 9 | ||||
-rw-r--r-- | arch/arm/mm/init.c | 25 |
2 files changed, 22 insertions, 12 deletions
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h index 42005542932b..fcf15de8cadb 100644 --- a/arch/arm/include/asm/dma.h +++ b/arch/arm/include/asm/dma.h @@ -6,10 +6,13 @@ /* * This is the maximum virtual address which can be DMA'd from. */ -#ifndef ARM_DMA_ZONE_SIZE -#define MAX_DMA_ADDRESS 0xffffffff +#ifndef CONFIG_ZONE_DMA +#define MAX_DMA_ADDRESS 0xffffffffUL #else -#define MAX_DMA_ADDRESS (PAGE_OFFSET + ARM_DMA_ZONE_SIZE) +#define MAX_DMA_ADDRESS ({ \ + extern unsigned long arm_dma_zone_size; \ + arm_dma_zone_size ? \ + (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; }) #endif #ifdef CONFIG_ISA_DMA_API diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 17d6cd0c57ed..4a8a01e0c3ab 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -28,6 +28,7 @@ #include <asm/sizes.h> #include <asm/tlb.h> #include <asm/fixmap.h> +#include <asm/memory.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> @@ -212,6 +213,14 @@ static void __init arm_bootmem_init(unsigned long start_pfn, } #ifdef CONFIG_ZONE_DMA + +#ifdef ARM_DMA_ZONE_SIZE +unsigned long arm_dma_zone_size = ARM_DMA_ZONE_SIZE; +#else +unsigned long arm_dma_zone_size __read_mostly; +#endif +EXPORT_SYMBOL(arm_dma_zone_size); + /* * The DMA mask corresponding to the maximum bus address allocatable * using GFP_DMA. The default here places no restriction on DMA @@ -275,19 +284,17 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, #endif } -#ifdef ARM_DMA_ZONE_SIZE -#ifndef CONFIG_ZONE_DMA -#error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations -#endif - +#ifdef CONFIG_ZONE_DMA /* * Adjust the sizes according to any special requirements for * this machine type. */ - arm_adjust_dma_zone(zone_size, zhole_size, - ARM_DMA_ZONE_SIZE >> PAGE_SHIFT); - - arm_dma_limit = PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1; + if (arm_dma_zone_size) { + arm_adjust_dma_zone(zone_size, zhole_size, + arm_dma_zone_size >> PAGE_SHIFT); + arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1; + } else + arm_dma_limit = 0xffffffff; #endif free_area_init_node(0, zone_size, min, zhole_size); |