aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/init.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-05-11 10:39:00 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-05-12 03:36:53 -0400
commitbe20902ba67de70b38c995903321f4152dee57b7 (patch)
tree86f27d4d90b7408d421ce246527431e58a836bf3 /arch/arm/mm/init.c
parent2fb3ec5c9503ba8874e24170de2b40e8f1a58370 (diff)
ARM: use ARM_DMA_ZONE_SIZE to adjust the zone sizes
Rather than each platform providing its own function to adjust the zone sizes, use the new ARM_DMA_ZONE_SIZE definition to perform this adjustment. This ensures that the actual DMA zone size and the ISA_DMA_THRESHOLD/MAX_DMA_ADDRESS definitions are consistent with each other, and moves this complexity out of the platform code. Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r--arch/arm/mm/init.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index e5f6fc428348..49eaad9136a7 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -201,6 +201,20 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
201 } 201 }
202} 202}
203 203
204#ifdef CONFIG_ZONE_DMA
205static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
206 unsigned long dma_size)
207{
208 if (size[0] <= dma_size)
209 return;
210
211 size[ZONE_NORMAL] = size[0] - dma_size;
212 size[ZONE_DMA] = dma_size;
213 hole[ZONE_NORMAL] = hole[0];
214 hole[ZONE_DMA] = 0;
215}
216#endif
217
204static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, 218static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
205 unsigned long max_high) 219 unsigned long max_high)
206{ 220{
@@ -243,11 +257,18 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
243#endif 257#endif
244 } 258 }
245 259
260#ifdef ARM_DMA_ZONE_SIZE
261#ifndef CONFIG_ZONE_DMA
262#error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations
263#endif
264
246 /* 265 /*
247 * Adjust the sizes according to any special requirements for 266 * Adjust the sizes according to any special requirements for
248 * this machine type. 267 * this machine type.
249 */ 268 */
250 arch_adjust_zones(zone_size, zhole_size); 269 arm_adjust_dma_zone(zone_size, zhole_size,
270 ARM_DMA_ZONE_SIZE >> PAGE_SHIFT);
271#endif
251 272
252 free_area_init_node(0, zone_size, min, zhole_size); 273 free_area_init_node(0, zone_size, min, zhole_size);
253} 274}