diff options
Diffstat (limited to 'arch/powerpc/mm/mem.c')
-rw-r--r-- | arch/powerpc/mm/mem.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 29d4dde65c45..c781bbcf7338 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -249,7 +249,7 @@ static int __init mark_nonram_nosave(void) | |||
249 | */ | 249 | */ |
250 | void __init paging_init(void) | 250 | void __init paging_init(void) |
251 | { | 251 | { |
252 | unsigned long total_ram = memblock_phys_mem_size(); | 252 | unsigned long long total_ram = memblock_phys_mem_size(); |
253 | phys_addr_t top_of_ram = memblock_end_of_DRAM(); | 253 | phys_addr_t top_of_ram = memblock_end_of_DRAM(); |
254 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 254 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
255 | 255 | ||
@@ -269,7 +269,7 @@ void __init paging_init(void) | |||
269 | kmap_prot = PAGE_KERNEL; | 269 | kmap_prot = PAGE_KERNEL; |
270 | #endif /* CONFIG_HIGHMEM */ | 270 | #endif /* CONFIG_HIGHMEM */ |
271 | 271 | ||
272 | printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n", | 272 | printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%llx\n", |
273 | (unsigned long long)top_of_ram, total_ram); | 273 | (unsigned long long)top_of_ram, total_ram); |
274 | printk(KERN_DEBUG "Memory hole size: %ldMB\n", | 274 | printk(KERN_DEBUG "Memory hole size: %ldMB\n", |
275 | (long int)((top_of_ram - total_ram) >> 20)); | 275 | (long int)((top_of_ram - total_ram) >> 20)); |
@@ -337,8 +337,9 @@ void __init mem_init(void) | |||
337 | 337 | ||
338 | highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT; | 338 | highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT; |
339 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { | 339 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { |
340 | phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT; | ||
340 | struct page *page = pfn_to_page(pfn); | 341 | struct page *page = pfn_to_page(pfn); |
341 | if (memblock_is_reserved(pfn << PAGE_SHIFT)) | 342 | if (memblock_is_reserved(paddr)) |
342 | continue; | 343 | continue; |
343 | ClearPageReserved(page); | 344 | ClearPageReserved(page); |
344 | init_page_count(page); | 345 | init_page_count(page); |
@@ -352,6 +353,15 @@ void __init mem_init(void) | |||
352 | } | 353 | } |
353 | #endif /* CONFIG_HIGHMEM */ | 354 | #endif /* CONFIG_HIGHMEM */ |
354 | 355 | ||
356 | #if defined(CONFIG_PPC_FSL_BOOK3E) && !defined(CONFIG_SMP) | ||
357 | /* | ||
358 | * If smp is enabled, next_tlbcam_idx is initialized in the cpu up | ||
359 | * functions.... do it here for the non-smp case. | ||
360 | */ | ||
361 | per_cpu(next_tlbcam_idx, smp_processor_id()) = | ||
362 | (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1; | ||
363 | #endif | ||
364 | |||
355 | printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, " | 365 | printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, " |
356 | "%luk reserved, %luk data, %luk bss, %luk init)\n", | 366 | "%luk reserved, %luk data, %luk bss, %luk init)\n", |
357 | nr_free_pages() << (PAGE_SHIFT-10), | 367 | nr_free_pages() << (PAGE_SHIFT-10), |
@@ -382,6 +392,25 @@ void __init mem_init(void) | |||
382 | mem_init_done = 1; | 392 | mem_init_done = 1; |
383 | } | 393 | } |
384 | 394 | ||
395 | void free_initmem(void) | ||
396 | { | ||
397 | unsigned long addr; | ||
398 | |||
399 | ppc_md.progress = ppc_printk_progress; | ||
400 | |||
401 | addr = (unsigned long)__init_begin; | ||
402 | for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) { | ||
403 | memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); | ||
404 | ClearPageReserved(virt_to_page(addr)); | ||
405 | init_page_count(virt_to_page(addr)); | ||
406 | free_page(addr); | ||
407 | totalram_pages++; | ||
408 | } | ||
409 | pr_info("Freeing unused kernel memory: %luk freed\n", | ||
410 | ((unsigned long)__init_end - | ||
411 | (unsigned long)__init_begin) >> 10); | ||
412 | } | ||
413 | |||
385 | #ifdef CONFIG_BLK_DEV_INITRD | 414 | #ifdef CONFIG_BLK_DEV_INITRD |
386 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 415 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
387 | { | 416 | { |