aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2012-10-22 23:40:36 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2012-11-14 02:50:56 -0500
commitf50bf88df3ccda3e88e28f81d366dc79266a16c8 (patch)
tree1a930581a64525a92268999527a92874490ab277 /arch/m68k
parentdd1cb3a7c43508c29e17836628090c0735bd3137 (diff)
m68k: move to a single instance of free_initmem()
Currently each sub-architecture has its own implementation if init_freemem(). There is two different cases that the various implementations deal with. They either free the init memory, or they don't. We only need a single instance to cover all cases. The non-MMU version did some page alignment twidling, but this is not neccessary. The current linker script enforces page alignment. It also checked for CONFIG_RAMKERNEL, but this also is not necessary, the linker script always keeps the init sections in RAM. The MMU ColdFire version of free_initmem() was empty. There is no reason it can't carry out the freeing of the init memory. So it is now changed and tested to do this. For the other MMU cases the code is the same. For the general Motorola MMU case we free the init memory. For the SUN3 case we do nothing (though I think it could safely free the init memory as well). Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/mm/init.c22
-rw-r--r--arch/m68k/mm/mcfmmu.c4
-rw-r--r--arch/m68k/mm/motorola.c14
-rw-r--r--arch/m68k/mm/sun3mmu.c4
4 files changed, 8 insertions, 36 deletions
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index b0f201a409f3..f0e05bce92f2 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -103,32 +103,26 @@ void __init paging_init(void)
103 free_area_init(zones_size); 103 free_area_init(zones_size);
104} 104}
105 105
106#endif /* CONFIG_MMU */
107
106void free_initmem(void) 108void free_initmem(void)
107{ 109{
108#ifdef CONFIG_RAMKERNEL 110#ifndef CONFIG_MMU_SUN3
109 unsigned long addr; 111 unsigned long addr;
110 112
111 /* 113 addr = (unsigned long) __init_begin;
112 * The following code should be cool even if these sections 114 for (; addr < ((unsigned long) __init_end); addr += PAGE_SIZE) {
113 * are not page aligned.
114 */
115 addr = PAGE_ALIGN((unsigned long) __init_begin);
116 /* next to check that the page we free is not a partial page */
117 for (; addr + PAGE_SIZE < ((unsigned long) __init_end); addr += PAGE_SIZE) {
118 ClearPageReserved(virt_to_page(addr)); 115 ClearPageReserved(virt_to_page(addr));
119 init_page_count(virt_to_page(addr)); 116 init_page_count(virt_to_page(addr));
120 free_page(addr); 117 free_page(addr);
121 totalram_pages++; 118 totalram_pages++;
122 } 119 }
123 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n", 120 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
124 (addr - PAGE_ALIGN((unsigned long) __init_begin)) >> 10, 121 (addr - (unsigned long) __init_begin) >> 10,
125 (int)(PAGE_ALIGN((unsigned long) __init_begin)), 122 (unsigned int) __init_begin, (unsigned int) __init_end);
126 (int)(addr - PAGE_SIZE)); 123#endif /* CONFIG_MMU_SUN3 */
127#endif
128} 124}
129 125
130#endif /* CONFIG_MMU */
131
132#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) 126#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
133#define VECTORS &vectors[0] 127#define VECTORS &vectors[0]
134#else 128#else
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
index 875b800ef0dd..f58fafe7e4c9 100644
--- a/arch/m68k/mm/mcfmmu.c
+++ b/arch/m68k/mm/mcfmmu.c
@@ -29,10 +29,6 @@ atomic_t nr_free_contexts;
29struct mm_struct *context_mm[LAST_CONTEXT+1]; 29struct mm_struct *context_mm[LAST_CONTEXT+1];
30extern unsigned long num_pages; 30extern unsigned long num_pages;
31 31
32void free_initmem(void)
33{
34}
35
36/* 32/*
37 * ColdFire paging_init derived from sun3. 33 * ColdFire paging_init derived from sun3.
38 */ 34 */
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 0dafa693515b..251c5437787b 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -304,17 +304,3 @@ void __init paging_init(void)
304 } 304 }
305} 305}
306 306
307void free_initmem(void)
308{
309 unsigned long addr;
310
311 addr = (unsigned long)__init_begin;
312 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
313 virt_to_page(addr)->flags &= ~(1 << PG_reserved);
314 init_page_count(virt_to_page(addr));
315 free_page(addr);
316 totalram_pages++;
317 }
318}
319
320
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
index e0804060501e..269f81158a33 100644
--- a/arch/m68k/mm/sun3mmu.c
+++ b/arch/m68k/mm/sun3mmu.c
@@ -30,10 +30,6 @@ const char bad_pmd_string[] = "Bad pmd in pte_alloc: %08lx\n";
30 30
31extern unsigned long num_pages; 31extern unsigned long num_pages;
32 32
33void free_initmem(void)
34{
35}
36
37/* For the sun3 we try to follow the i386 paging_init() more closely */ 33/* For the sun3 we try to follow the i386 paging_init() more closely */
38/* start_mem and end_mem have PAGE_OFFSET added already */ 34/* start_mem and end_mem have PAGE_OFFSET added already */
39/* now sets up tables using sun3 PTEs rather than i386 as before. --m */ 35/* now sets up tables using sun3 PTEs rather than i386 as before. --m */