diff options
author | Franck Bui-Huu <vagabon.xyz@gmail.com> | 2006-10-19 07:20:05 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:42 -0500 |
commit | acd86b8622099c3206e0a1665545ae2318089b9c (patch) | |
tree | f44acdcd2082538902dda48814d393e2c049eda1 | |
parent | a7837b76b6de932c31d0b7c71176ca8d1213a3ce (diff) |
[MIPS] Make free_init_pages() arguments to be physical addresses
It allows caller of this function to not care about CKSEG0/XKPHYS
address mixes. It's now automatically done by free_init_pages().
We can now safely remove hack needed by 64 bit kernels with
CONFIG_BUILD_ELF64=n in free_initmem().
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/mm/init.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 4076963c601e..9e29ba9205f0 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -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 | ||
446 | void free_init_pages(char *what, unsigned long begin, unsigned long end) | 446 | static 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((void *)addr)); | 451 | struct page *page = pfn_to_page(pfn); |
452 | init_page_count(virt_to_page((void *)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,7 +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 |
461 | void free_initrd_mem(unsigned long start, unsigned long end) | 464 | void free_initrd_mem(unsigned long start, unsigned long end) |
462 | { | 465 | { |
463 | free_init_pages("initrd memory", start, end); | 466 | free_init_pages("initrd memory", |
467 | virt_to_phys((void *)start), | ||
468 | virt_to_phys((void *)end)); | ||
464 | } | 469 | } |
465 | #endif | 470 | #endif |
466 | 471 | ||
@@ -468,17 +473,13 @@ extern unsigned long prom_free_prom_memory(void); | |||
468 | 473 | ||
469 | void free_initmem(void) | 474 | void free_initmem(void) |
470 | { | 475 | { |
471 | unsigned long start, end, freed; | 476 | unsigned long freed; |
472 | 477 | ||
473 | freed = prom_free_prom_memory(); | 478 | freed = prom_free_prom_memory(); |
474 | if (freed) | 479 | if (freed) |
475 | printk(KERN_INFO "Freeing firmware memory: %ldk freed\n",freed); | 480 | printk(KERN_INFO "Freeing firmware memory: %ldk freed\n",freed); |
476 | 481 | ||
477 | start = (unsigned long)(&__init_begin); | 482 | free_init_pages("unused kernel memory", |
478 | end = (unsigned long)(&__init_end); | 483 | __pa_symbol(&__init_begin), |
479 | #ifdef CONFIG_64BIT | 484 | __pa_symbol(&__init_end)); |
480 | start = PAGE_OFFSET | CPHYSADDR(start); | ||
481 | end = PAGE_OFFSET | CPHYSADDR(end); | ||
482 | #endif | ||
483 | free_init_pages("unused kernel memory", start, end); | ||
484 | } | 485 | } |