Commit c44e8d5e authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

[MIPS] prom_free_prom_memory cleanup

Current prom_free_prom_memory() implementations are almost same as
free_init_pages(), or no-op.  Make free_init_pages() extern (again)
and make prom_free_prom_memory() use it.
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 2fa7937b
...@@ -141,30 +141,20 @@ void __init prom_meminit(void) ...@@ -141,30 +141,20 @@ void __init prom_meminit(void)
} }
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
unsigned long freed = 0;
unsigned long addr; unsigned long addr;
int i; int i;
if (prom_flags & PROM_FLAG_DONT_FREE_TEMP) if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
return 0; return;
for (i = 0; i < boot_mem_map.nr_map; i++) { for (i = 0; i < boot_mem_map.nr_map; i++) {
if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
continue; continue;
addr = boot_mem_map.map[i].addr; addr = boot_mem_map.map[i].addr;
while (addr < boot_mem_map.map[i].addr free_init_pages("prom memory",
+ boot_mem_map.map[i].size) { addr, addr + boot_mem_map.map[i].size);
ClearPageReserved(virt_to_page(__va(addr)));
init_page_count(virt_to_page(__va(addr)));
free_page((unsigned long)__va(addr));
addr += PAGE_SIZE;
freed += PAGE_SIZE;
}
} }
printk(KERN_INFO "Freeing prom memory: %ldkb freed\n", freed >> 10);
return freed;
} }
...@@ -149,9 +149,8 @@ int get_ethernet_addr(char *ethernet_addr) ...@@ -149,9 +149,8 @@ int get_ethernet_addr(char *ethernet_addr)
return 0; return 0;
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
EXPORT_SYMBOL(prom_getcmdline); EXPORT_SYMBOL(prom_getcmdline);
......
...@@ -204,8 +204,7 @@ void __init prom_init(void) ...@@ -204,8 +204,7 @@ void __init prom_init(void)
add_memory_region(0x0, memsz, BOOT_MEM_RAM); add_memory_region(0x0, memsz, BOOT_MEM_RAM);
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
/* Nothing to do! */ /* Nothing to do! */
return 0;
} }
...@@ -59,9 +59,8 @@ void __init prom_init(void) ...@@ -59,9 +59,8 @@ void __init prom_init(void)
#endif #endif
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
#if defined(CONFIG_DDB5477) #if defined(CONFIG_DDB5477)
......
...@@ -92,9 +92,9 @@ void __init prom_meminit(u32 magic) ...@@ -92,9 +92,9 @@ void __init prom_meminit(u32 magic)
rex_setup_memory_region(); rex_setup_memory_region();
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
unsigned long addr, end; unsigned long end;
/* /*
* Free everything below the kernel itself but leave * Free everything below the kernel itself but leave
...@@ -114,16 +114,5 @@ unsigned long __init prom_free_prom_memory(void) ...@@ -114,16 +114,5 @@ unsigned long __init prom_free_prom_memory(void)
#endif #endif
end = __pa(&_text); end = __pa(&_text);
addr = PAGE_SIZE; free_init_pages("unused PROM memory", PAGE_SIZE, end);
while (addr < end) {
ClearPageReserved(virt_to_page(__va(addr)));
init_page_count(virt_to_page(__va(addr)));
free_page((unsigned long)__va(addr));
addr += PAGE_SIZE;
}
printk("Freeing unused PROM memory: %ldkb freed\n",
(end - PAGE_SIZE) >> 10);
return end - PAGE_SIZE;
} }
...@@ -59,9 +59,8 @@ extern void galileo_machine_power_off(void); ...@@ -59,9 +59,8 @@ extern void galileo_machine_power_off(void);
*/ */
extern struct pci_ops galileo_pci_ops; extern struct pci_ops galileo_pci_ops;
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
/* /*
......
...@@ -67,7 +67,6 @@ void __init prom_init(void) ...@@ -67,7 +67,6 @@ void __init prom_init(void)
add_memory_region(0, 64 << 20, BOOT_MEM_RAM); add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
...@@ -93,9 +93,8 @@ void __init wrppmc_early_printk(const char *fmt, ...) ...@@ -93,9 +93,8 @@ void __init wrppmc_early_printk(const char *fmt, ...)
} }
#endif /* WRPPMC_EARLY_DEBUG */ #endif /* WRPPMC_EARLY_DEBUG */
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
#ifdef CONFIG_SERIAL_8250 #ifdef CONFIG_SERIAL_8250
......
...@@ -75,7 +75,6 @@ void __init prom_init_cmdline(void) ...@@ -75,7 +75,6 @@ void __init prom_init_cmdline(void)
*cp = '\0'; *cp = '\0';
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
...@@ -132,9 +132,8 @@ void __init prom_init(void) ...@@ -132,9 +132,8 @@ void __init prom_init(void)
add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM); add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM);
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
const char *get_system_type(void) const char *get_system_type(void)
......
...@@ -166,9 +166,8 @@ void __init prom_meminit(void) ...@@ -166,9 +166,8 @@ void __init prom_meminit(void)
} }
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
unsigned long freed = 0;
unsigned long addr; unsigned long addr;
int i; int i;
...@@ -176,17 +175,8 @@ unsigned long __init prom_free_prom_memory(void) ...@@ -176,17 +175,8 @@ unsigned long __init prom_free_prom_memory(void)
if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
continue; continue;
addr = PAGE_ALIGN(boot_mem_map.map[i].addr); addr = boot_mem_map.map[i].addr;
while (addr < boot_mem_map.map[i].addr free_init_pages("prom memory",
+ boot_mem_map.map[i].size) { addr, addr + boot_mem_map.map[i].size);
ClearPageReserved(virt_to_page(__va(addr)));
init_page_count(virt_to_page(__va(addr)));
free_page((unsigned long)__va(addr));
addr += PAGE_SIZE;
freed += PAGE_SIZE;
}
} }
printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
return freed;
} }
...@@ -99,10 +99,9 @@ void __init prom_meminit(void) ...@@ -99,10 +99,9 @@ void __init prom_meminit(void)
} }
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
int i; int i;
unsigned long freed = 0;
unsigned long addr; unsigned long addr;
for (i = 0; i < boot_mem_map.nr_map; i++) { for (i = 0; i < boot_mem_map.nr_map; i++) {
...@@ -110,16 +109,7 @@ unsigned long __init prom_free_prom_memory(void) ...@@ -110,16 +109,7 @@ unsigned long __init prom_free_prom_memory(void)
continue; continue;
addr = boot_mem_map.map[i].addr; addr = boot_mem_map.map[i].addr;
while (addr < boot_mem_map.map[i].addr free_init_pages("prom memory",
+ boot_mem_map.map[i].size) { addr, addr + boot_mem_map.map[i].size);
ClearPageReserved(virt_to_page(__va(addr)));
init_page_count(virt_to_page(__va(addr)));
free_page((unsigned long)__va(addr));
addr += PAGE_SIZE;
freed += PAGE_SIZE;
}
} }
printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
return freed;
} }
...@@ -467,7 +467,7 @@ void __init mem_init(void) ...@@ -467,7 +467,7 @@ void __init mem_init(void)
} }
#endif /* !CONFIG_NEED_MULTIPLE_NODES */ #endif /* !CONFIG_NEED_MULTIPLE_NODES */
static void free_init_pages(char *what, unsigned long begin, unsigned long end) void free_init_pages(const char *what, unsigned long begin, unsigned long end)
{ {
unsigned long pfn; unsigned long pfn;
...@@ -493,17 +493,9 @@ void free_initrd_mem(unsigned long start, unsigned long end) ...@@ -493,17 +493,9 @@ void free_initrd_mem(unsigned long start, unsigned long end)
} }
#endif #endif
extern unsigned long prom_free_prom_memory(void);
void free_initmem(void) void free_initmem(void)
{ {
unsigned long freed; prom_free_prom_memory();
freed = prom_free_prom_memory();
if (freed)
printk(KERN_INFO "Freeing firmware memory: %ldkb freed\n",
freed >> 10);
free_init_pages("unused kernel memory", free_init_pages("unused kernel memory",
__pa_symbol(&__init_begin), __pa_symbol(&__init_begin),
__pa_symbol(&__init_end)); __pa_symbol(&__init_end));
......
...@@ -235,9 +235,8 @@ void __init prom_init(void) ...@@ -235,9 +235,8 @@ void __init prom_init(void)
#endif #endif
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
void __init prom_fixup_mem_map(unsigned long start, unsigned long end) void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
......
...@@ -180,9 +180,8 @@ void __init prom_init(void) ...@@ -180,9 +180,8 @@ void __init prom_init(void)
#endif #endif
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
void __init prom_fixup_mem_map(unsigned long start, unsigned long end) void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
......
...@@ -178,7 +178,6 @@ void __init prom_init(void) ...@@ -178,7 +178,6 @@ void __init prom_init(void)
#endif #endif
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
...@@ -79,7 +79,6 @@ void __init prom_init(void) ...@@ -79,7 +79,6 @@ void __init prom_init(void)
} }
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
...@@ -106,9 +106,8 @@ int get_ethernet_addr(char *ethernet_addr) ...@@ -106,9 +106,8 @@ int get_ethernet_addr(char *ethernet_addr)
return 0; return 0;
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
extern int pnx8550_console_port; extern int pnx8550_console_port;
......
...@@ -132,9 +132,8 @@ void __init prom_init(void) ...@@ -132,9 +132,8 @@ void __init prom_init(void)
prom_grab_secondary(); prom_grab_secondary();
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
void __init prom_fixup_mem_map(unsigned long start, unsigned long end) void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
......
#include <linux/init.h> #include <linux/init.h>
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0UL;
} }
...@@ -202,7 +202,6 @@ void __init sgimc_init(void) ...@@ -202,7 +202,6 @@ void __init sgimc_init(void)
} }
void __init prom_meminit(void) {} void __init prom_meminit(void) {}
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
...@@ -498,10 +498,9 @@ void __init prom_meminit(void) ...@@ -498,10 +498,9 @@ void __init prom_meminit(void)
} }
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
/* We got nothing to free here ... */ /* We got nothing to free here ... */
return 0;
} }
extern void pagetable_init(void); extern void pagetable_init(void);
......
...@@ -43,7 +43,6 @@ void __init prom_meminit (void) ...@@ -43,7 +43,6 @@ void __init prom_meminit (void)
} }
unsigned long __init prom_free_prom_memory (void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
...@@ -343,10 +343,9 @@ void __init prom_init(void) ...@@ -343,10 +343,9 @@ void __init prom_init(void)
prom_meminit(); prom_meminit();
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
/* Not sure what I'm supposed to do here. Nothing, I think */ /* Not sure what I'm supposed to do here. Nothing, I think */
return 0;
} }
void prom_putchar(char c) void prom_putchar(char c)
......
...@@ -87,10 +87,9 @@ void __init prom_init(void) ...@@ -87,10 +87,9 @@ void __init prom_init(void)
prom_meminit(); prom_meminit();
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
/* Not sure what I'm supposed to do here. Nothing, I think */ /* Not sure what I'm supposed to do here. Nothing, I think */
return 0;
} }
void prom_putchar(char c) void prom_putchar(char c)
......
...@@ -67,9 +67,8 @@ void prom_printf(char *fmt, ...) ...@@ -67,9 +67,8 @@ void prom_printf(char *fmt, ...)
va_end(args); va_end(args);
} }
unsigned long prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
/* /*
......
...@@ -80,9 +80,8 @@ void __init prom_init(void) ...@@ -80,9 +80,8 @@ void __init prom_init(void)
add_memory_region(0, msize << 20, BOOT_MEM_RAM); add_memory_region(0, msize << 20, BOOT_MEM_RAM);
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
const char *get_system_type(void) const char *get_system_type(void)
......
...@@ -56,9 +56,8 @@ void __init prom_init(void) ...@@ -56,9 +56,8 @@ void __init prom_init(void)
return; return;
} }
unsigned long __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
return 0;
} }
void __init prom_fixup_mem_map(unsigned long start, unsigned long end) void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
......
...@@ -81,7 +81,6 @@ void __init prom_init(void) ...@@ -81,7 +81,6 @@ void __init prom_init(void)
} }
} }
unsigned long __init prom_free_prom_memory (void) void __init prom_free_prom_memory(void)
{ {
return 0UL;
} }
...@@ -243,6 +243,10 @@ extern struct boot_mem_map boot_mem_map; ...@@ -243,6 +243,10 @@ extern struct boot_mem_map boot_mem_map;
extern void add_memory_region(phys_t start, phys_t size, long type); extern void add_memory_region(phys_t start, phys_t size, long type);
extern void prom_init(void); extern void prom_init(void);
extern void prom_free_prom_memory(void);
extern void free_init_pages(const char *what,
unsigned long begin, unsigned long end);
/* /*
* Initial kernel command line, usually setup by prom_init() * Initial kernel command line, usually setup by prom_init()
......
...@@ -33,7 +33,6 @@ extern void prom_printf(char *fmt, ...); ...@@ -33,7 +33,6 @@ extern void prom_printf(char *fmt, ...);
extern void prom_init_cmdline(void); extern void prom_init_cmdline(void);
extern void prom_meminit(void); extern void prom_meminit(void);
extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem); extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
extern unsigned long prom_free_prom_memory (void);
extern void mips_display_message(const char *str); extern void mips_display_message(const char *str);
extern void mips_display_word(unsigned int num); extern void mips_display_word(unsigned int num);
extern int get_ethernet_addr(char *ethernet_addr); extern int get_ethernet_addr(char *ethernet_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment