good ppc64 kernel source for p615

Olaf Hering olh at suse.de
Wed Jan 14 19:07:49 EST 2004


 On Tue, Jan 13, Mike Kravetz wrote:

>
> On Wed, Jan 14, 2004 at 10:57:45AM +1100, Anton Blanchard wrote:
> >
> > Thats a classic "you havent set your console=" problem. SLES has some
> > magic to look at your console device in OF and make a guess in the
> > kernel as to where we should talk. We should probably merge the patch
> > into 2.6.
> >
>
> You got it!  When I started this, I expected to get to a point
> where the boot would fail due to a configuration problem(initrd).
> However, since I didn't have the console set I didn't see this
> happening (as I expected).
>
> I'll dig the 'AUTOCONSOLE' code out of the SLES kernel and pass it
> along to see if it may be 'acceptable'.

Please apply it soon, and dont forget ppc32 while your are at it.

diff -purNX /home/olaf/kernel/kernel_exclude.txt linux-2.6.0-test11.orig/arch/ppc/kernel/setup.c linux-2.6.0-test11.SuSE/arch/ppc/kernel/setup.c
--- linux-2.6.0-test11.orig/arch/ppc/kernel/setup.c	2003-11-26 20:45:38.000000000 +0000
+++ linux-2.6.0-test11.SuSE/arch/ppc/kernel/setup.c	2003-11-30 19:23:42.000000000 +0000
@@ -452,6 +452,56 @@ platform_init(unsigned long r3, unsigned
 			}
 		}
 	}
+
+#ifdef CONFIG_SERIAL_CORE_CONSOLE
+	/* Hack -- add console=ttySn if necessary */
+	if(strstr(cmd_line, "console=") == NULL) {
+		extern char *of_stdout_device;
+		struct device_node *prom_stdout;
+
+		prom_stdout = find_path_device(of_stdout_device);
+		if (prom_stdout) {
+			unsigned char *name;
+			printk(KERN_INFO "of_stdout_device %s\n", of_stdout_device);
+			name = get_property(prom_stdout, "name", NULL);
+			if (name) {
+				int i;
+#if 1
+				printk(KERN_INFO "name %s\n", name);
+#endif
+				i = -1;
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+				if (strcmp(name, "serial") == 0) {
+					u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
+					if (i > 8) {
+						switch (reg[1]) {
+							case 0x3f8: i = 0; break;
+							case 0x2f8: i = 1; break;
+							case 0x898: i = 2; break;
+							case 0x890: i = 3; break;
+						}
+					}
+				}
+#endif
+#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
+				if (strcmp(name, "ch-a") == 0)
+					i = 0;
+				if (strcmp(name, "ch-b") == 0)
+					i = 1;
+#endif
+				if (i >= 0) {
+					char tmp_cmd_line[512];
+					snprintf(tmp_cmd_line, 512,
+							"AUTOCONSOLE console=ttyS%d %s",
+							i, cmd_line);
+					memcpy(cmd_line, tmp_cmd_line, 512);
+					printk("console= not found, add console=ttyS%d\n", i);
+				}
+			}
+		}
+	}
+#endif
+
 #ifdef CONFIG_ADB
 	if (strstr(cmd_line, "adb_sync")) {
 		extern int __adb_probe_sync;
diff -purNX /home/olaf/kernel/kernel_exclude.txt linux-2.6.0-test11.orig/arch/ppc/syslib/prom_init.c linux-2.6.0-test11.SuSE/arch/ppc/syslib/prom_init.c
--- linux-2.6.0-test11.orig/arch/ppc/syslib/prom_init.c	2003-11-26 20:45:52.000000000 +0000
+++ linux-2.6.0-test11.SuSE/arch/ppc/syslib/prom_init.c	2003-11-30 19:24:01.000000000 +0000
@@ -118,7 +118,7 @@ ihandle prom_stdout __initdata = 0;
 char *prom_display_paths[FB_MAX] __initdata = { 0, };
 phandle prom_display_nodes[FB_MAX] __initdata;
 unsigned int prom_num_displays __initdata = 0;
-static char *of_stdout_device __initdata = 0;
+char *of_stdout_device __initdata = 0;
 static ihandle prom_disp_node __initdata = 0;

 unsigned int rtas_data;   /* physical pointer */
@@ -861,6 +861,11 @@ prom_init(int r3, int r4, prom_entry pp)
 	for (i = 0; i < prom_num_displays; ++i)
 		prom_display_paths[i] = PTRUNRELOC(prom_display_paths[i]);

+#ifdef CONFIG_SERIAL_CORE_CONSOLE
+	/* Relocate the of stdout for console autodetection */
+	of_stdout_device = PTRUNRELOC(of_stdout_device);
+#endif
+
 	prom_print("returning 0x");
 	prom_print_hex(phys);
 	prom_print("from prom_init\n");
diff -p -purNX kernel_exclude.txt x/linux-2.6.0-test10/arch/ppc64/kernel/setup.c linux-2.6.0-test10/arch/ppc64/kernel/setup.c
--- x/linux-2.6.0-test10/arch/ppc64/kernel/setup.c	2003-11-25 20:51:52.000000000 +0100
+++ linux-2.6.0-test10/arch/ppc64/kernel/setup.c	2003-11-26 12:29:26.000000000 +0100
@@ -399,6 +399,44 @@ void parse_cmd_line(unsigned long r3, un
 	}
 #endif

+#ifdef CONFIG_PPC_PSERIES
+	/* Hack -- add console=ttySn,9600 if necessary */
+	if(strstr(cmd_line, "console=") == NULL) {
+		struct device_node *prom_stdout = find_path_device(of_stdout_device);
+		u32 *reg;
+		int i;
+		char *name, *val = NULL;
+		printk("of_stdout_device %s\n", of_stdout_device);
+		if (prom_stdout) {
+			name = (char *)get_property(prom_stdout, "name", NULL);
+			if (name) {
+				if (strcmp(name, "serial") == 0) {
+					reg = (u32 *)get_property(prom_stdout, "reg", &i);
+					if (i > 8) {
+						switch (reg[1]) {
+							case 0x3f8: val = "ttyS0,9600"; break;
+							case 0x2f8: val = "ttyS1,9600"; break;
+							case 0x898: val = "ttyS2,9600"; break;
+							case 0x890: val = "ttyS3,9600"; break;
+						}
+					}
+				} else if (strcmp(name, "vty") == 0) {
+					/* pSeries LPAR virtual console */
+					val = "hvc0";
+				}
+				if (val) {
+					char tmp_cmd_line[CMD_LINE_SIZE];
+					snprintf(tmp_cmd_line, CMD_LINE_SIZE,
+							"AUTOCONSOLE console=%s %s",
+							val, cmd_line);
+					memcpy(cmd_line, tmp_cmd_line, CMD_LINE_SIZE);
+					printk("console= not found, add console=%s\n", val);
+				}
+			}
+		}
+	}
+#endif
+
 	/* Look for mem= option on command line */
 	if (strstr(cmd_line, "mem=")) {
 		char *p, *q;
diff -p -purNX kernel_exclude.txt x/linux-2.6.0-test10/include/asm-ppc64/bootinfo.h linux-2.6.0-test10/include/asm-ppc64/bootinfo.h
--- x/linux-2.6.0-test10/include/asm-ppc64/bootinfo.h	2003-11-24 02:32:06.000000000 +0100
+++ linux-2.6.0-test10/include/asm-ppc64/bootinfo.h	2003-11-26 12:30:17.000000000 +0100
@@ -17,6 +17,8 @@

 #include <asm/types.h>

+#define CMD_LINE_SIZE 512
+
 /* We use a u32 for the type of the fields since they're written by
  * the bootloader which is a 32-bit process and read by the kernel
  * which is a 64-bit process.  This way they can both agree on the
--
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list