Skip to contentSkip to conversation

Fix builtin command line interaction with firmware

PATCH In review Amos Waterland 2 participants 2 messages Jun 13, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix builtin command line interaction with firmware

It seems that prom_init's early_cmdline_parse is broken on at least Apple 970 xserves and IBM JS20 blades with SLOF. The firmware of these machines returns -1 and 1 respectively when getprop is called for the bootargs property of /chosen, causing Linux to ignore its builtin command line in favor of a null string. This patch makes Linux use its builtin command line if getprop returns an error or a null string.

---

 arch/powerpc/kernel/prom_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

0f0caf0342f39b4437dcb3e9f2f1d62bfb4e3e7d

arch/powerpc/kernel/prom_init.c +1 -1
index f70bd09..2e63a90 100644
@@ -574,7 +574,7 @@ static void __init early_cmdline_parse(v
 	if ((long)_prom->chosen > 0)
 		l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
 #ifdef CONFIG_CMDLINE
-	if (l == 0) /* dbl check */
+	if (l <= 0 || p[0] == '\0') /* dbl check */
 		strlcpy(RELOC(prom_cmd_line),
 			RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line));
 #endif /* CONFIG_CMDLINE */
Signature · 1 line
1.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines

It seems that prom_init's early_cmdline_parse is broken on at least Apple 970 xserves and IBM JS20 blades with SLOF. The firmware of these machines returns -1 and 1 respectively when getprop is called for the bootargs property of /chosen, causing Linux to ignore its builtin command line in favor of a null string. This patch makes Linux use its builtin command line if getprop returns an error or a null string.

If the user gave no boot arguments on the boot command, -1 and 1 are the only two valid return values even, and -1 is only valid if no "boot" or "load" command was used to load the kernel. Makes me wonder what those XServe's do ;-)

(0 isn't valid as the property is encoded with encode-string, which puts a trailing 0 byte on the empty string. Doesn't hurt to check for it anyway of course ;-) ).

Quoted 1 line

Looks good, thanks!

Quoted 27 lines

---

 arch/powerpc/kernel/prom_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

0f0caf0342f39b4437dcb3e9f2f1d62bfb4e3e7d

arch/powerpc/kernel/prom_init.c +1 -1
index f70bd09..2e63a90 100644
@@ -574,7 +574,7 @@ static void __init early_cmdline_parse(v
 	if ((long)_prom->chosen > 0)
 		l = prom_getprop(_prom->chosen, "bootargs", p,  
 COMMAND_LINE_SIZE-1);
 #ifdef CONFIG_CMDLINE
-	if (l == 0) /* dbl check */
+	if (l <= 0 || p[0] == '\0') /* dbl check */
 		strlcpy(RELOC(prom_cmd_line),
 			RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line));

#endif /* CONFIG_CMDLINE */

Signature · 5 lines
1.0.4
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev