aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/include/asm/setup.h1
-rw-r--r--arch/microblaze/kernel/early_printk.c26
-rw-r--r--arch/microblaze/mm/init.c34
3 files changed, 7 insertions, 54 deletions
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index 0e0b0a5ec756..f05df5630c84 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -46,7 +46,6 @@ void machine_shutdown(void);
46void machine_halt(void); 46void machine_halt(void);
47void machine_power_off(void); 47void machine_power_off(void);
48 48
49void free_init_pages(char *what, unsigned long begin, unsigned long end);
50extern void *alloc_maybe_bootmem(size_t size, gfp_t mask); 49extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
51extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 50extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
52 51
diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
index 60dcacc68038..365f2d53f1b2 100644
--- a/arch/microblaze/kernel/early_printk.c
+++ b/arch/microblaze/kernel/early_printk.c
@@ -21,7 +21,6 @@
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/prom.h> 22#include <asm/prom.h>
23 23
24static u32 early_console_initialized;
25static u32 base_addr; 24static u32 base_addr;
26 25
27#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE 26#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
@@ -109,27 +108,11 @@ static struct console early_serial_uart16550_console = {
109}; 108};
110#endif /* CONFIG_SERIAL_8250_CONSOLE */ 109#endif /* CONFIG_SERIAL_8250_CONSOLE */
111 110
112static struct console *early_console;
113
114void early_printk(const char *fmt, ...)
115{
116 char buf[512];
117 int n;
118 va_list ap;
119
120 if (early_console_initialized) {
121 va_start(ap, fmt);
122 n = vscnprintf(buf, 512, fmt, ap);
123 early_console->write(early_console, buf, n);
124 va_end(ap);
125 }
126}
127
128int __init setup_early_printk(char *opt) 111int __init setup_early_printk(char *opt)
129{ 112{
130 int version = 0; 113 int version = 0;
131 114
132 if (early_console_initialized) 115 if (early_console)
133 return 1; 116 return 1;
134 117
135 base_addr = of_early_console(&version); 118 base_addr = of_early_console(&version);
@@ -159,7 +142,6 @@ int __init setup_early_printk(char *opt)
159 } 142 }
160 143
161 register_console(early_console); 144 register_console(early_console);
162 early_console_initialized = 1;
163 return 0; 145 return 0;
164 } 146 }
165 return 1; 147 return 1;
@@ -169,7 +151,7 @@ int __init setup_early_printk(char *opt)
169 * only for early console because of performance degression */ 151 * only for early console because of performance degression */
170void __init remap_early_printk(void) 152void __init remap_early_printk(void)
171{ 153{
172 if (!early_console_initialized || !early_console) 154 if (!early_console)
173 return; 155 return;
174 pr_info("early_printk_console remapping from 0x%x to ", base_addr); 156 pr_info("early_printk_console remapping from 0x%x to ", base_addr);
175 base_addr = (u32) ioremap(base_addr, PAGE_SIZE); 157 base_addr = (u32) ioremap(base_addr, PAGE_SIZE);
@@ -194,9 +176,9 @@ void __init remap_early_printk(void)
194 176
195void __init disable_early_printk(void) 177void __init disable_early_printk(void)
196{ 178{
197 if (!early_console_initialized || !early_console) 179 if (!early_console)
198 return; 180 return;
199 pr_warn("disabling early console\n"); 181 pr_warn("disabling early console\n");
200 unregister_console(early_console); 182 unregister_console(early_console);
201 early_console_initialized = 0; 183 early_console = NULL;
202} 184}
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 8f8b367c079e..4ec137d13ad7 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -82,13 +82,9 @@ static unsigned long highmem_setup(void)
82 /* FIXME not sure about */ 82 /* FIXME not sure about */
83 if (memblock_is_reserved(pfn << PAGE_SHIFT)) 83 if (memblock_is_reserved(pfn << PAGE_SHIFT))
84 continue; 84 continue;
85 ClearPageReserved(page); 85 free_highmem_page(page);
86 init_page_count(page);
87 __free_page(page);
88 totalhigh_pages++;
89 reservedpages++; 86 reservedpages++;
90 } 87 }
91 totalram_pages += totalhigh_pages;
92 pr_info("High memory: %luk\n", 88 pr_info("High memory: %luk\n",
93 totalhigh_pages << (PAGE_SHIFT-10)); 89 totalhigh_pages << (PAGE_SHIFT-10));
94 90
@@ -236,40 +232,16 @@ void __init setup_memory(void)
236 paging_init(); 232 paging_init();
237} 233}
238 234
239void free_init_pages(char *what, unsigned long begin, unsigned long end)
240{
241 unsigned long addr;
242
243 for (addr = begin; addr < end; addr += PAGE_SIZE) {
244 ClearPageReserved(virt_to_page(addr));
245 init_page_count(virt_to_page(addr));
246 free_page(addr);
247 totalram_pages++;
248 }
249 pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
250}
251
252#ifdef CONFIG_BLK_DEV_INITRD 235#ifdef CONFIG_BLK_DEV_INITRD
253void free_initrd_mem(unsigned long start, unsigned long end) 236void free_initrd_mem(unsigned long start, unsigned long end)
254{ 237{
255 int pages = 0; 238 free_reserved_area(start, end, 0, "initrd");
256 for (; start < end; start += PAGE_SIZE) {
257 ClearPageReserved(virt_to_page(start));
258 init_page_count(virt_to_page(start));
259 free_page(start);
260 totalram_pages++;
261 pages++;
262 }
263 pr_notice("Freeing initrd memory: %dk freed\n",
264 (int)(pages * (PAGE_SIZE / 1024)));
265} 239}
266#endif 240#endif
267 241
268void free_initmem(void) 242void free_initmem(void)
269{ 243{
270 free_init_pages("unused kernel memory", 244 free_initmem_default(0);
271 (unsigned long)(&__init_begin),
272 (unsigned long)(&__init_end));
273} 245}
274 246
275void __init mem_init(void) 247void __init mem_init(void)