[PATCH] [ppc64] Use early_param

Anton Blanchard anton at samba.org
Fri Sep 10 22:23:37 EST 2004


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 at samba.org>

diff --exclude-from=/home/anton/dontdiff -urN foobar2/arch/ppc64/kernel/setup.c foobar3/arch/ppc64/kernel/setup.c
--- foobar2/arch/ppc64/kernel/setup.c	2004-09-10 19:52:08.296273933 +1000
+++ foobar3/arch/ppc64/kernel/setup.c	2004-09-10 19:50:06.856308336 +1000
@@ -244,7 +244,21 @@
 
 	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 @@
 	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 @@
 #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 @@
 	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 @@
 				  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 @@
 	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 @@
 	.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 @@
 	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 @@
 	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 --exclude-from=/home/anton/dontdiff -urN foobar2/arch/ppc64/mm/numa.c foobar3/arch/ppc64/mm/numa.c
--- foobar2/arch/ppc64/mm/numa.c	2004-09-10 19:52:05.108989721 +1000
+++ foobar3/arch/ppc64/mm/numa.c	2004-09-10 19:46:40.576232848 +1000
@@ -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 @@
 	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 @@
 							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);



More information about the Linuxppc64-dev mailing list