diff options
Diffstat (limited to 'arch/powerpc/mm/mem.c')
-rw-r--r-- | arch/powerpc/mm/mem.c | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index eebd8b83a6b0..16fe027bbc12 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -256,20 +256,22 @@ void __init do_init_bootmem(void) | |||
256 | 256 | ||
257 | boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages); | 257 | boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages); |
258 | 258 | ||
259 | /* Add active regions with valid PFNs */ | ||
260 | for (i = 0; i < lmb.memory.cnt; i++) { | ||
261 | unsigned long start_pfn, end_pfn; | ||
262 | start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; | ||
263 | end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); | ||
264 | add_active_range(0, start_pfn, end_pfn); | ||
265 | } | ||
266 | |||
259 | /* Add all physical memory to the bootmem map, mark each area | 267 | /* Add all physical memory to the bootmem map, mark each area |
260 | * present. | 268 | * present. |
261 | */ | 269 | */ |
262 | for (i = 0; i < lmb.memory.cnt; i++) { | ||
263 | unsigned long base = lmb.memory.region[i].base; | ||
264 | unsigned long size = lmb_size_bytes(&lmb.memory, i); | ||
265 | #ifdef CONFIG_HIGHMEM | 270 | #ifdef CONFIG_HIGHMEM |
266 | if (base >= total_lowmem) | 271 | free_bootmem_with_active_regions(0, total_lowmem >> PAGE_SHIFT); |
267 | continue; | 272 | #else |
268 | if (base + size > total_lowmem) | 273 | free_bootmem_with_active_regions(0, max_pfn); |
269 | size = total_lowmem - base; | ||
270 | #endif | 274 | #endif |
271 | free_bootmem(base, size); | ||
272 | } | ||
273 | 275 | ||
274 | /* reserve the sections we're already using */ | 276 | /* reserve the sections we're already using */ |
275 | for (i = 0; i < lmb.reserved.cnt; i++) | 277 | for (i = 0; i < lmb.reserved.cnt; i++) |
@@ -277,9 +279,8 @@ void __init do_init_bootmem(void) | |||
277 | lmb_size_bytes(&lmb.reserved, i)); | 279 | lmb_size_bytes(&lmb.reserved, i)); |
278 | 280 | ||
279 | /* XXX need to clip this if using highmem? */ | 281 | /* XXX need to clip this if using highmem? */ |
280 | for (i = 0; i < lmb.memory.cnt; i++) | 282 | sparse_memory_present_with_active_regions(0); |
281 | memory_present(0, lmb_start_pfn(&lmb.memory, i), | 283 | |
282 | lmb_end_pfn(&lmb.memory, i)); | ||
283 | init_bootmem_done = 1; | 284 | init_bootmem_done = 1; |
284 | } | 285 | } |
285 | 286 | ||
@@ -288,10 +289,9 @@ void __init do_init_bootmem(void) | |||
288 | */ | 289 | */ |
289 | void __init paging_init(void) | 290 | void __init paging_init(void) |
290 | { | 291 | { |
291 | unsigned long zones_size[MAX_NR_ZONES]; | ||
292 | unsigned long zholes_size[MAX_NR_ZONES]; | ||
293 | unsigned long total_ram = lmb_phys_mem_size(); | 292 | unsigned long total_ram = lmb_phys_mem_size(); |
294 | unsigned long top_of_ram = lmb_end_of_DRAM(); | 293 | unsigned long top_of_ram = lmb_end_of_DRAM(); |
294 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
295 | 295 | ||
296 | #ifdef CONFIG_HIGHMEM | 296 | #ifdef CONFIG_HIGHMEM |
297 | map_page(PKMAP_BASE, 0, 0); /* XXX gross */ | 297 | map_page(PKMAP_BASE, 0, 0); /* XXX gross */ |
@@ -307,26 +307,13 @@ void __init paging_init(void) | |||
307 | top_of_ram, total_ram); | 307 | top_of_ram, total_ram); |
308 | printk(KERN_DEBUG "Memory hole size: %ldMB\n", | 308 | printk(KERN_DEBUG "Memory hole size: %ldMB\n", |
309 | (top_of_ram - total_ram) >> 20); | 309 | (top_of_ram - total_ram) >> 20); |
310 | /* | ||
311 | * All pages are DMA-able so we put them all in the DMA zone. | ||
312 | */ | ||
313 | memset(zones_size, 0, sizeof(zones_size)); | ||
314 | memset(zholes_size, 0, sizeof(zholes_size)); | ||
315 | |||
316 | zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT; | ||
317 | zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT; | ||
318 | |||
319 | #ifdef CONFIG_HIGHMEM | 310 | #ifdef CONFIG_HIGHMEM |
320 | zones_size[ZONE_DMA] = total_lowmem >> PAGE_SHIFT; | 311 | max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT; |
321 | zones_size[ZONE_HIGHMEM] = (total_memory - total_lowmem) >> PAGE_SHIFT; | 312 | max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT; |
322 | zholes_size[ZONE_HIGHMEM] = (top_of_ram - total_ram) >> PAGE_SHIFT; | ||
323 | #else | 313 | #else |
324 | zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT; | 314 | max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT; |
325 | zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT; | 315 | #endif |
326 | #endif /* CONFIG_HIGHMEM */ | 316 | free_area_init_nodes(max_zone_pfns); |
327 | |||
328 | free_area_init_node(0, NODE_DATA(0), zones_size, | ||
329 | __pa(PAGE_OFFSET) >> PAGE_SHIFT, zholes_size); | ||
330 | } | 317 | } |
331 | #endif /* ! CONFIG_NEED_MULTIPLE_NODES */ | 318 | #endif /* ! CONFIG_NEED_MULTIPLE_NODES */ |
332 | 319 | ||