aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/mm/init.c')
-rw-r--r--arch/microblaze/mm/init.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index a57cedf3671..1608e2e1a44 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -23,6 +23,9 @@
23#include <asm/sections.h> 23#include <asm/sections.h>
24#include <asm/tlb.h> 24#include <asm/tlb.h>
25 25
26/* Use for MMU and noMMU because of PCI generic code */
27int mem_init_done;
28
26#ifndef CONFIG_MMU 29#ifndef CONFIG_MMU
27unsigned int __page_offset; 30unsigned int __page_offset;
28EXPORT_SYMBOL(__page_offset); 31EXPORT_SYMBOL(__page_offset);
@@ -30,7 +33,6 @@ EXPORT_SYMBOL(__page_offset);
30#else 33#else
31DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 34DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
32 35
33int mem_init_done;
34static int init_bootmem_done; 36static int init_bootmem_done;
35#endif /* CONFIG_MMU */ 37#endif /* CONFIG_MMU */
36 38
@@ -193,12 +195,6 @@ void free_initmem(void)
193 (unsigned long)(&__init_end)); 195 (unsigned long)(&__init_end));
194} 196}
195 197
196/* FIXME from arch/powerpc/mm/mem.c*/
197void show_mem(void)
198{
199 printk(KERN_NOTICE "%s\n", __func__);
200}
201
202void __init mem_init(void) 198void __init mem_init(void)
203{ 199{
204 high_memory = (void *)__va(memory_end); 200 high_memory = (void *)__va(memory_end);
@@ -208,9 +204,7 @@ void __init mem_init(void)
208 printk(KERN_INFO "Memory: %luk/%luk available\n", 204 printk(KERN_INFO "Memory: %luk/%luk available\n",
209 nr_free_pages() << (PAGE_SHIFT-10), 205 nr_free_pages() << (PAGE_SHIFT-10),
210 num_physpages << (PAGE_SHIFT-10)); 206 num_physpages << (PAGE_SHIFT-10));
211#ifdef CONFIG_MMU
212 mem_init_done = 1; 207 mem_init_done = 1;
213#endif
214} 208}
215 209
216#ifndef CONFIG_MMU 210#ifndef CONFIG_MMU
@@ -222,6 +216,10 @@ int ___range_ok(unsigned long addr, unsigned long size)
222} 216}
223EXPORT_SYMBOL(___range_ok); 217EXPORT_SYMBOL(___range_ok);
224 218
219int page_is_ram(unsigned long pfn)
220{
221 return __range_ok(pfn, 0);
222}
225#else 223#else
226int page_is_ram(unsigned long pfn) 224int page_is_ram(unsigned long pfn)
227{ 225{
@@ -349,4 +347,27 @@ void __init *early_get_page(void)
349 } 347 }
350 return p; 348 return p;
351} 349}
350
352#endif /* CONFIG_MMU */ 351#endif /* CONFIG_MMU */
352
353void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
354{
355 if (mem_init_done)
356 return kmalloc(size, mask);
357 else
358 return alloc_bootmem(size);
359}
360
361void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
362{
363 void *p;
364
365 if (mem_init_done)
366 p = kzalloc(size, mask);
367 else {
368 p = alloc_bootmem(size);
369 if (p)
370 memset(p, 0, size);
371 }
372 return p;
373}