ARM: 6625/1: use memblock memory regions for "System RAM" I/O resources

Do not use memory bank info to request the "system ram" resources as
they do not track holes created by memblock_remove inside
machine's reserve callback. If the removed memory is passed as
platform_device's ioresource, then drivers that call
request_mem_region would fail due to a conflict with the incorrectly
configured system ram resource.

Instead, iterate through the regions of memblock.memory and add
those as "System RAM" resources.

Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Dima Zavin 2011-01-14 23:05:14 +01:00 committed by Russell King
parent 30b99d07b7
commit 11b9369cbb

View File

@ -518,25 +518,21 @@ setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
#endif #endif
} }
static void __init static void __init request_standard_resources(struct machine_desc *mdesc)
request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
{ {
struct memblock_region *region;
struct resource *res; struct resource *res;
int i;
kernel_code.start = virt_to_phys(_text); kernel_code.start = virt_to_phys(_text);
kernel_code.end = virt_to_phys(_etext - 1); kernel_code.end = virt_to_phys(_etext - 1);
kernel_data.start = virt_to_phys(_sdata); kernel_data.start = virt_to_phys(_sdata);
kernel_data.end = virt_to_phys(_end - 1); kernel_data.end = virt_to_phys(_end - 1);
for (i = 0; i < mi->nr_banks; i++) { for_each_memblock(memory, region) {
if (mi->bank[i].size == 0)
continue;
res = alloc_bootmem_low(sizeof(*res)); res = alloc_bootmem_low(sizeof(*res));
res->name = "System RAM"; res->name = "System RAM";
res->start = mi->bank[i].start; res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
res->end = mi->bank[i].start + mi->bank[i].size - 1; res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res); request_resource(&iomem_resource, res);
@ -859,7 +855,7 @@ void __init setup_arch(char **cmdline_p)
arm_memblock_init(&meminfo, mdesc); arm_memblock_init(&meminfo, mdesc);
paging_init(mdesc); paging_init(mdesc);
request_standard_resources(&meminfo, mdesc); request_standard_resources(mdesc);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (is_smp()) if (is_smp())