Commit 65032018 authored by Nicolas Pitre's avatar Nicolas Pitre

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: default avatarNicolas Pitre <nicolas.pitre@linaro.org>
parent 022ae537
...@@ -6,10 +6,13 @@ ...@@ -6,10 +6,13 @@
/* /*
* This is the maximum virtual address which can be DMA'd from. * This is the maximum virtual address which can be DMA'd from.
*/ */
#ifndef ARM_DMA_ZONE_SIZE #ifndef CONFIG_ZONE_DMA
#define MAX_DMA_ADDRESS 0xffffffff #define MAX_DMA_ADDRESS 0xffffffffUL
#else #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 #endif
#ifdef CONFIG_ISA_DMA_API #ifdef CONFIG_ISA_DMA_API
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <asm/sizes.h> #include <asm/sizes.h>
#include <asm/tlb.h> #include <asm/tlb.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
#include <asm/memory.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -212,6 +213,14 @@ static void __init arm_bootmem_init(unsigned long start_pfn, ...@@ -212,6 +213,14 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
} }
#ifdef CONFIG_ZONE_DMA #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 * 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
...@@ -275,19 +284,17 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, ...@@ -275,19 +284,17 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
#endif #endif
} }
#ifdef ARM_DMA_ZONE_SIZE #ifdef CONFIG_ZONE_DMA
#ifndef CONFIG_ZONE_DMA
#error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations
#endif
/* /*
* Adjust the sizes according to any special requirements for * Adjust the sizes according to any special requirements for
* this machine type. * this machine type.
*/ */
if (arm_dma_zone_size) {
arm_adjust_dma_zone(zone_size, zhole_size, arm_adjust_dma_zone(zone_size, zhole_size,
ARM_DMA_ZONE_SIZE >> PAGE_SHIFT); arm_dma_zone_size >> PAGE_SHIFT);
arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
arm_dma_limit = PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1; } else
arm_dma_limit = 0xffffffff;
#endif #endif
free_area_init_node(0, zone_size, min, zhole_size); free_area_init_node(0, zone_size, min, zhole_size);
......
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