]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc64: use early_param
authorAnton Blanchard <anton@samba.org>
Tue, 14 Sep 2004 00:42:41 +0000 (17:42 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 14 Sep 2004 00:42:41 +0000 (17:42 -0700)
Make use of Rusty's early_param code. Its good stuff.

We appear to be the first user :)

Move vpa_init and idle_setup later in boot, we dont have to do them
right up front in setup_system.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc64/kernel/setup.c
arch/ppc64/mm/numa.c

index 21140fb11acfe9a3ca8b6b81242bdd51d733fa62..509bbbc6b202e51ad062b65f8d8988a08c318136 100644 (file)
@@ -244,7 +244,21 @@ static void __init setup_cpu_maps(void)
 
        systemcfg->processorCount = num_present_cpus();
 }
+
 #endif /* !defined(CONFIG_PPC_ISERIES) && defined(CONFIG_SMP) */
+
+#ifdef CONFIG_XMON
+static int __init early_xmon(char *p)
+{
+       /* ensure xmon is enabled */
+       xmon_init();
+       debugger(0);
+
+       return 0;
+}
+early_param("xmon", early_xmon);
+#endif
+
 /*
  * Do some initial setup of the system.  The parameters are those which 
  * were passed in from the bootloader.
@@ -256,10 +270,6 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
        int ret, i;
 #endif
 
-#ifdef CONFIG_XMON_DEFAULT
-       xmon_init();
-#endif
-
 #ifdef CONFIG_PPC_ISERIES
        /* pSeries systems are identified in prom.c via OF. */
        if (itLpNaca.xLparInstalled == 1)
@@ -290,6 +300,9 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
 #endif /* CONFIG_PPC_PMAC */
        }
 
+#ifdef CONFIG_XMON_DEFAULT
+       xmon_init();
+#endif
        /* If we were passed an initrd, set the ROOT_DEV properly if the values
         * look sensible. If not, clear initrd reference.
         */
@@ -330,6 +343,11 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
        iSeries_parse_cmdline();
 #endif
 
+       /* Save unparsed command line copy for /proc/cmdline */
+       strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
+
+       parse_early_param();
+
 #ifdef CONFIG_SMP
 #ifndef CONFIG_PPC_ISERIES
        /*
@@ -351,6 +369,10 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
                                  i);
                }
        }
+
+       if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
+               vpa_init(boot_cpuid);
+
 #endif /* CONFIG_PPC_PSERIES */
 #endif /* CONFIG_SMP */
 
@@ -380,15 +402,6 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
        printk("-----------------------------------------------------\n");
 
        mm_init_ppc64();
-
-#if defined(CONFIG_SMP) && defined(CONFIG_PPC_PSERIES)
-       if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
-               vpa_init(boot_cpuid);
-       }
-#endif
-
-       /* Select the correct idle loop for the platform. */
-       idle_setup();
 }
 
 void machine_restart(char *cmd)
@@ -512,30 +525,20 @@ struct seq_operations cpuinfo_op = {
        .show = show_cpuinfo,
 };
 
-#endif
+#if 0 /* XXX not currently used */
+unsigned long memory_limit;
 
-       /* Look for mem= option on command line */
-       if (strstr(cmd_line, "mem=")) {
-               char *p, *q;
-               unsigned long maxmem = 0;
-               extern unsigned long __max_memory;
-
-               for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
-                       q = p + 4;
-                       if (p > cmd_line && p[-1] != ' ')
-                               continue;
-                       maxmem = simple_strtoul(q, &q, 0);
-                       if (*q == 'k' || *q == 'K') {
-                               maxmem <<= 10;
-                               ++q;
-                       } else if (*q == 'm' || *q == 'M') {
-                               maxmem <<= 20;
-                               ++q;
-                       }
-               }
-               __max_memory = maxmem;
-       }
+static int __init early_parsemem(char *p)
+{
+       if (!p)
+               return 0;
+
+       memory_limit = memparse(p, &p);
+
+       return 0;
 }
+early_param("mem", early_parsemem);
+#endif
 
 #ifdef CONFIG_PPC_PSERIES
 static int __init set_preferred_console(void)
@@ -681,16 +684,10 @@ void __init setup_arch(char **cmdline_p)
        extern int panic_timeout;
        extern void do_init_bootmem(void);
 
-
        ppc64_boot_msg(0x12, "Setup Arch");
 
-#ifdef CONFIG_XMON
-       if (strstr(cmd_line, "xmon")) {
-               /* ensure xmon is enabled */
-               xmon_init();
-               debugger(0);
-       }
-#endif /* CONFIG_XMON */
+       *cmdline_p = cmd_line;
+
 
        /*
         * Set cache line size based on type of cpu as a default.
@@ -711,16 +708,15 @@ void __init setup_arch(char **cmdline_p)
        init_mm.end_data = (unsigned long) _edata;
        init_mm.brk = klimit;
        
-       /* Save unparsed command line copy for /proc/cmdline */
-       strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
-       *cmdline_p = cmd_line;
-
        irqstack_early_init();
        emergency_stack_init();
 
        /* set up the bootmem stuff with available memory */
        do_init_bootmem();
 
+       /* Select the correct idle loop for the platform. */
+       idle_setup();
+
        ppc_md.setup_arch();
 
        paging_init();
index 9ace4f591651249741c7b201b0e1ec1be9a0d98a..977140f78a3788ed14ddf1bff0ba68f6884b8f60 100644 (file)
@@ -18,6 +18,8 @@
 #include <asm/machdep.h>
 #include <asm/abs_addr.h>
 
+static int numa_enabled = 1;
+
 static int numa_debug;
 #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
 
@@ -189,10 +191,7 @@ static int __init parse_numa_properties(void)
        long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT;
        unsigned long i;
 
-       if (strstr(saved_command_line, "numa=debug"))
-               numa_debug = 1;
-
-       if (strstr(saved_command_line, "numa=off")) {
+       if (numa_enabled == 0) {
                printk(KERN_WARNING "NUMA disabled by user\n");
                return -1;
        }
@@ -587,3 +586,18 @@ void __init paging_init(void)
                                                        start_pfn, zholes_size);
        }
 }
+
+static int __init early_numa(char *p)
+{
+       if (!p)
+               return 0;
+
+       if (strstr(p, "off"))
+               numa_enabled = 0;
+
+       if (strstr(p, "debug"))
+               numa_debug = 1;
+
+       return 0;
+}
+early_param("numa", early_numa);