aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm/init.c')
-rw-r--r--arch/mips/mm/init.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 2de4d3c367a2..9e29ba9205f0 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -90,9 +90,9 @@ unsigned long setup_zero_pages(void)
90 if (!empty_zero_page) 90 if (!empty_zero_page)
91 panic("Oh boy, that early out of memory?"); 91 panic("Oh boy, that early out of memory?");
92 92
93 page = virt_to_page(empty_zero_page); 93 page = virt_to_page((void *)empty_zero_page);
94 split_page(page, order); 94 split_page(page, order);
95 while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) { 95 while (page < virt_to_page((void *)(empty_zero_page + (PAGE_SIZE << order)))) {
96 SetPageReserved(page); 96 SetPageReserved(page);
97 page++; 97 page++;
98 } 98 }
@@ -443,15 +443,18 @@ void __init mem_init(void)
443} 443}
444#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 444#endif /* !CONFIG_NEED_MULTIPLE_NODES */
445 445
446void free_init_pages(char *what, unsigned long begin, unsigned long end) 446static void free_init_pages(char *what, unsigned long begin, unsigned long end)
447{ 447{
448 unsigned long addr; 448 unsigned long pfn;
449 449
450 for (addr = begin; addr < end; addr += PAGE_SIZE) { 450 for (pfn = PFN_UP(begin); pfn < PFN_DOWN(end); pfn++) {
451 ClearPageReserved(virt_to_page(addr)); 451 struct page *page = pfn_to_page(pfn);
452 init_page_count(virt_to_page(addr)); 452 void *addr = phys_to_virt(PFN_PHYS(pfn));
453 memset((void *)addr, 0xcc, PAGE_SIZE); 453
454 free_page(addr); 454 ClearPageReserved(page);
455 init_page_count(page);
456 memset(addr, POISON_FREE_INITMEM, PAGE_SIZE);
457 __free_page(page);
455 totalram_pages++; 458 totalram_pages++;
456 } 459 }
457 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); 460 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
@@ -460,12 +463,9 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
460#ifdef CONFIG_BLK_DEV_INITRD 463#ifdef CONFIG_BLK_DEV_INITRD
461void free_initrd_mem(unsigned long start, unsigned long end) 464void free_initrd_mem(unsigned long start, unsigned long end)
462{ 465{
463#ifdef CONFIG_64BIT 466 free_init_pages("initrd memory",
464 /* Switch from KSEG0 to XKPHYS addresses */ 467 virt_to_phys((void *)start),
465 start = (unsigned long)phys_to_virt(CPHYSADDR(start)); 468 virt_to_phys((void *)end));
466 end = (unsigned long)phys_to_virt(CPHYSADDR(end));
467#endif
468 free_init_pages("initrd memory", start, end);
469} 469}
470#endif 470#endif
471 471
@@ -473,17 +473,13 @@ extern unsigned long prom_free_prom_memory(void);
473 473
474void free_initmem(void) 474void free_initmem(void)
475{ 475{
476 unsigned long start, end, freed; 476 unsigned long freed;
477 477
478 freed = prom_free_prom_memory(); 478 freed = prom_free_prom_memory();
479 if (freed) 479 if (freed)
480 printk(KERN_INFO "Freeing firmware memory: %ldk freed\n",freed); 480 printk(KERN_INFO "Freeing firmware memory: %ldk freed\n",freed);
481 481
482 start = (unsigned long)(&__init_begin); 482 free_init_pages("unused kernel memory",
483 end = (unsigned long)(&__init_end); 483 __pa_symbol(&__init_begin),
484#ifdef CONFIG_64BIT 484 __pa_symbol(&__init_end));
485 start = PAGE_OFFSET | CPHYSADDR(start);
486 end = PAGE_OFFSET | CPHYSADDR(end);
487#endif
488 free_init_pages("unused kernel memory", start, end);
489} 485}