aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2011-07-18 15:05:10 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-07-18 15:29:41 -0400
commit650320181a08b64d4421c65c639cf47ad8cc2cd6 (patch)
tree5458b989faf4dd0a1216e07da3a76d9d30885c03 /arch
parent022ae537b23cb14a391565e9ad9e9945f4b17138 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/dma.h9
-rw-r--r--arch/arm/mm/init.c25
2 files changed, 22 insertions, 12 deletions
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 42005542932..fcf15de8cad 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -6,10 +6,13 @@
6/* 6/*
7 * This is the maximum virtual address which can be DMA'd from. 7 * This is the maximum virtual address which can be DMA'd from.
8 */ 8 */
9#ifndef ARM_DMA_ZONE_SIZE 9#ifndef CONFIG_ZONE_DMA
10#define MAX_DMA_ADDRESS 0xffffffff 10#define MAX_DMA_ADDRESS 0xffffffffUL
11#else 11#else
12#define MAX_DMA_ADDRESS (PAGE_OFFSET + ARM_DMA_ZONE_SIZE) 12#define MAX_DMA_ADDRESS ({ \
13 extern unsigned long arm_dma_zone_size; \
14 arm_dma_zone_size ? \
15 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
13#endif 16#endif
14 17
15#ifdef CONFIG_ISA_DMA_API 18#ifdef CONFIG_ISA_DMA_API
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 17d6cd0c57e..4a8a01e0c3a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -28,6 +28,7 @@
28#include <asm/sizes.h> 28#include <asm/sizes.h>
29#include <asm/tlb.h> 29#include <asm/tlb.h>
30#include <asm/fixmap.h> 30#include <asm/fixmap.h>
31#include <asm/memory.h>
31 32
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
@@ -212,6 +213,14 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
212} 213}
213 214
214#ifdef CONFIG_ZONE_DMA 215#ifdef CONFIG_ZONE_DMA
216
217#ifdef ARM_DMA_ZONE_SIZE
218unsigned long arm_dma_zone_size = ARM_DMA_ZONE_SIZE;
219#else
220unsigned long arm_dma_zone_size __read_mostly;
221#endif
222EXPORT_SYMBOL(arm_dma_zone_size);
223
215/* 224/*
216 * The DMA mask corresponding to the maximum bus address allocatable 225 * The DMA mask corresponding to the maximum bus address allocatable
217 * using GFP_DMA. The default here places no restriction on DMA 226 * 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,
275#endif 284#endif
276 } 285 }
277 286
278#ifdef ARM_DMA_ZONE_SIZE 287#ifdef CONFIG_ZONE_DMA
279#ifndef CONFIG_ZONE_DMA
280#error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations
281#endif
282
283 /* 288 /*
284 * Adjust the sizes according to any special requirements for 289 * Adjust the sizes according to any special requirements for
285 * this machine type. 290 * this machine type.
286 */ 291 */
287 arm_adjust_dma_zone(zone_size, zhole_size, 292 if (arm_dma_zone_size) {
288 ARM_DMA_ZONE_SIZE >> PAGE_SHIFT); 293 arm_adjust_dma_zone(zone_size, zhole_size,
289 294 arm_dma_zone_size >> PAGE_SHIFT);
290 arm_dma_limit = PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1; 295 arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
296 } else
297 arm_dma_limit = 0xffffffff;
291#endif 298#endif
292 299
293 free_area_init_node(0, zone_size, min, zhole_size); 300 free_area_init_node(0, zone_size, min, zhole_size);