[POWERPC] Fix mem= handling when the memory limit is > RMO size
[safe/jmp/linux-2.6] / arch / powerpc / mm / init_32.c
index bf13c14..0e53ca8 100644 (file)
@@ -18,7 +18,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -43,7 +42,6 @@
 #include <asm/machdep.h>
 #include <asm/btext.h>
 #include <asm/tlb.h>
-#include <asm/bootinfo.h>
 #include <asm/prom.h>
 #include <asm/lmb.h>
 #include <asm/sections.h>
@@ -69,6 +67,7 @@ unsigned long ppc_memoffset = PAGE_OFFSET;
 int boot_mapsize;
 #ifdef CONFIG_PPC_PMAC
 unsigned long agp_special_page;
+EXPORT_SYMBOL(agp_special_page);
 #endif
 
 #ifdef CONFIG_HIGHMEM
@@ -84,9 +83,6 @@ void MMU_init(void);
 /* XXX should be in current.h  -- paulus */
 extern struct task_struct *current_set[NR_CPUS];
 
-char *klimit = _end;
-struct device_node *memory_node;
-
 extern int init_bootmem_done;
 
 /*
@@ -153,10 +149,13 @@ void __init MMU_init(void)
         * in the fixed entries */
        adjust_total_lowmem();
 #endif /* CONFIG_FSL_BOOKE */
+
        if (total_lowmem > __max_low_memory) {
                total_lowmem = __max_low_memory;
 #ifndef CONFIG_HIGHMEM
                total_memory = total_lowmem;
+               lmb_enforce_memory_limit(total_lowmem);
+               lmb_analyze();
 #endif /* CONFIG_HIGHMEM */
        }
 
@@ -189,11 +188,9 @@ void __init MMU_init(void)
        if (ppc_md.progress)
                ppc_md.progress("MMU:exit", 0x211);
 
+       /* From now on, btext is no longer BAT mapped if it was at all */
 #ifdef CONFIG_BOOTX_TEXT
-       /* By default, we are no longer mapped */
-               boot_text_mapped = 0;
-       /* Must be done last, or ppc_md.progress will die. */
-       map_boot_text();
+       btext_unmap();
 #endif
 }
 
@@ -218,7 +215,7 @@ static void free_sec(unsigned long start, unsigned long end, const char *name)
 
        while (start < end) {
                ClearPageReserved(virt_to_page(start));
-               set_page_count(virt_to_page(start), 1);
+               init_page_count(virt_to_page(start));
                free_page(start);
                cnt++;
                start += PAGE_SIZE;
@@ -250,7 +247,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
                printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
        for (; start < end; start += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(start));
-               set_page_count(virt_to_page(start), 1);
+               init_page_count(virt_to_page(start));
                free_page(start);
                totalram_pages++;
        }