Skip to contentSkip to conversation

further early_param fixes

PATCH In review Paul Mackerras 2 participants 2 messages Mar 28, 2004 – Mar 29, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 further early_param fixes

Andrew & Tom,

Tom's patches to add early_param also added some code to read the command line from nvram in setup_arch on PReP boxes. This broke powermacs, though, since init_prep_nvram() calls the ppc_md.nvram_read_val pointer, which is initialized later on powermac. In any case we don't want to call the prep nvram code on powermacs. This patch fixes it, and also eliminates a compile warning about early_adb_sync.

Paul.

arch/ppc/kernel/setup.c +11 -8
diff -urN linux-2.6.5-rc2-mm4.orig/arch/ppc/kernel/setup.c linux-2.6.5-rc2-mm4/arch/ppc/kernel/setup.c
@@ -470,10 +470,11 @@
 
 #ifdef CONFIG_ADB
 /* Allow us to say that ADB probing will be done synchronously. */
-static void __init early_adb_sync(char **ign)
+static int __init early_adb_sync(char *ign)
 {
 	extern int __adb_probe_sync;
 	__adb_probe_sync = 1;
+	return 0;
 }
 __early_param("adb_sync", early_adb_sync);
 #endif /* CONFIG_ADB */
@@ -663,13 +664,15 @@
 
 	/* See if we need to grab the command line params from PPCBUG. */
 #ifdef CONFIG_PPCBUG_NVRAM
-	/* Read in NVRAM data */
-	init_prep_nvram();
-
-	if (cmd_line[0] == '\0') {
-		char *bootargs = prep_nvram_get_var("bootargs");
-		if (bootargs != NULL)
-			strlcpy(cmd_line, bootargs, sizeof(cmd_line));
+	if (_machine == _MACH_prep) {
+		/* Read in NVRAM data */
+		init_prep_nvram();
+
+		if (cmd_line[0] == '\0') {
+			char *bootargs = prep_nvram_get_var("bootargs");
+			if (bootargs != NULL)
+				strlcpy(cmd_line, bootargs, sizeof(cmd_line));
+		}
 	}
 #endif
 
#1 lore raw
Quoted 8 lines · Paul Mackerras

Andrew & Tom,

Tom's patches to add early_param also added some code to read the command line from nvram in setup_arch on PReP boxes. This broke powermacs, though, since init_prep_nvram() calls the ppc_md.nvram_read_val pointer, which is initialized later on powermac. In any case we don't want to call the prep nvram code on powermacs.

But we do want to call it on other configs where _machine == 0. So how about:

arch/ppc/kernel/setup.c +12 -7
diff -urN linux-2.6.5-rc2-mm4.orig/arch/ppc/kernel/setup.c linux-2.6.5-rc2-mm4/arch/ppc/kernel/setup.c
@@ -663,13 +664,18 @@
 
 	/* See if we need to grab the command line params from PPCBUG. */
 #ifdef CONFIG_PPCBUG_NVRAM
-	/* Read in NVRAM data */
-	init_prep_nvram();
-
-	if (cmd_line[0] == '\0') {
-		char *bootargs = prep_nvram_get_var("bootargs");
-		if (bootargs != NULL)
-			strlcpy(cmd_line, bootargs, sizeof(cmd_line));
+#ifdef CONFIG_PPC_PMAC
+	if (_machine == _MACH_prep)
+#endif
+	{
+		/* Read in NVRAM data */
+		init_prep_nvram();
+
+		if (cmd_line[0] == '\0') {
+			char *bootargs = prep_nvram_get_var("bootargs");
+			if (bootargs != NULL)
+				strlcpy(cmd_line, bootargs, sizeof(cmd_line));
+		}
 	}
 #endif
 
Quoted 2 lines

This patch fixes it, and also eliminates a compile warning about early_adb_sync.

Whoops, good catch.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/