From: Anton Blanchard 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 Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/kernel/setup.c | 90 ++++++++++++++++++-------------------- 25-akpm/arch/ppc64/mm/numa.c | 22 +++++++-- 2 files changed, 61 insertions(+), 51 deletions(-) diff -puN arch/ppc64/kernel/setup.c~ppc64-use-early_param arch/ppc64/kernel/setup.c --- 25/arch/ppc64/kernel/setup.c~ppc64-use-early_param 2004-09-11 16:29:51.753685968 -0700 +++ 25-akpm/arch/ppc64/kernel/setup.c 2004-09-11 16:29:51.760684904 -0700 @@ -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, unsi 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, unsi #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, unsi 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, unsi 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, unsi 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(); diff -puN arch/ppc64/mm/numa.c~ppc64-use-early_param arch/ppc64/mm/numa.c --- 25/arch/ppc64/mm/numa.c~ppc64-use-early_param 2004-09-11 16:29:51.755685664 -0700 +++ 25-akpm/arch/ppc64/mm/numa.c 2004-09-11 16:29:51.761684752 -0700 @@ -18,6 +18,8 @@ #include #include +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( 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); _