aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/init.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
commit67577927e8d7a1f4b09b4992df640eadc6aacb36 (patch)
tree2e9efe6b5745965faf0dcc084d4613d9356263f9 /arch/arm/mm/init.c
parent6fe4c590313133ebd5dadb769031489ff178ece1 (diff)
parent51f00a471ce8f359627dd99aeac322947a0e491b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts: drivers/mtd/mtd_blkdevs.c Merge Grant's device-tree bits so that we can apply the subsequent fixes. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r--arch/arm/mm/init.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 7185b00650fe..7fd9b5eb177f 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -150,6 +150,7 @@ static void __init find_limits(struct meminfo *mi,
150static void __init arm_bootmem_init(struct meminfo *mi, 150static void __init arm_bootmem_init(struct meminfo *mi,
151 unsigned long start_pfn, unsigned long end_pfn) 151 unsigned long start_pfn, unsigned long end_pfn)
152{ 152{
153 struct memblock_region *reg;
153 unsigned int boot_pages; 154 unsigned int boot_pages;
154 phys_addr_t bitmap; 155 phys_addr_t bitmap;
155 pg_data_t *pgdat; 156 pg_data_t *pgdat;
@@ -180,13 +181,13 @@ static void __init arm_bootmem_init(struct meminfo *mi,
180 /* 181 /*
181 * Reserve the memblock reserved regions in bootmem. 182 * Reserve the memblock reserved regions in bootmem.
182 */ 183 */
183 for (i = 0; i < memblock.reserved.cnt; i++) { 184 for_each_memblock(reserved, reg) {
184 phys_addr_t start = memblock_start_pfn(&memblock.reserved, i); 185 phys_addr_t start = memblock_region_reserved_base_pfn(reg);
185 if (start >= start_pfn && 186 phys_addr_t end = memblock_region_reserved_end_pfn(reg);
186 memblock_end_pfn(&memblock.reserved, i) <= end_pfn) 187 if (start >= start_pfn && end <= end_pfn)
187 reserve_bootmem_node(pgdat, __pfn_to_phys(start), 188 reserve_bootmem_node(pgdat, __pfn_to_phys(start),
188 memblock_size_bytes(&memblock.reserved, i), 189 (end - start) << PAGE_SHIFT,
189 BOOTMEM_DEFAULT); 190 BOOTMEM_DEFAULT);
190 } 191 }
191} 192}
192 193
@@ -237,20 +238,7 @@ static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
237#ifndef CONFIG_SPARSEMEM 238#ifndef CONFIG_SPARSEMEM
238int pfn_valid(unsigned long pfn) 239int pfn_valid(unsigned long pfn)
239{ 240{
240 struct memblock_region *mem = &memblock.memory; 241 return memblock_is_memory(pfn << PAGE_SHIFT);
241 unsigned int left = 0, right = mem->cnt;
242
243 do {
244 unsigned int mid = (right + left) / 2;
245
246 if (pfn < memblock_start_pfn(mem, mid))
247 right = mid;
248 else if (pfn >= memblock_end_pfn(mem, mid))
249 left = mid + 1;
250 else
251 return 1;
252 } while (left < right);
253 return 0;
254} 242}
255EXPORT_SYMBOL(pfn_valid); 243EXPORT_SYMBOL(pfn_valid);
256 244
@@ -260,10 +248,11 @@ static void arm_memory_present(void)
260#else 248#else
261static void arm_memory_present(void) 249static void arm_memory_present(void)
262{ 250{
263 int i; 251 struct memblock_region *reg;
264 for (i = 0; i < memblock.memory.cnt; i++) 252
265 memory_present(0, memblock_start_pfn(&memblock.memory, i), 253 for_each_memblock(memory, reg)
266 memblock_end_pfn(&memblock.memory, i)); 254 memory_present(0, memblock_region_memory_base_pfn(reg),
255 memblock_region_memory_end_pfn(reg));
267} 256}
268#endif 257#endif
269 258
@@ -277,7 +266,7 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
277 266
278 /* Register the kernel text, kernel data and initrd with memblock. */ 267 /* Register the kernel text, kernel data and initrd with memblock. */
279#ifdef CONFIG_XIP_KERNEL 268#ifdef CONFIG_XIP_KERNEL
280 memblock_reserve(__pa(_data), _end - _data); 269 memblock_reserve(__pa(_sdata), _end - _sdata);
281#else 270#else
282 memblock_reserve(__pa(_stext), _end - _stext); 271 memblock_reserve(__pa(_stext), _end - _stext);
283#endif 272#endif
@@ -545,7 +534,7 @@ void __init mem_init(void)
545 534
546 MLK_ROUNDUP(__init_begin, __init_end), 535 MLK_ROUNDUP(__init_begin, __init_end),
547 MLK_ROUNDUP(_text, _etext), 536 MLK_ROUNDUP(_text, _etext),
548 MLK_ROUNDUP(_data, _edata)); 537 MLK_ROUNDUP(_sdata, _edata));
549 538
550#undef MLK 539#undef MLK
551#undef MLM 540#undef MLM