Allow the user to specify serial=X as a Xen command line argument.  I
spent some time working on a more general solution, but I think it's
best for now to submit this version which properly handles the JS21
blades that I have access to, and let people with Maple-D and other
hardware add their handlers as needed.

This patch assumes the existence of the "add support for builtin command
line (take two)" patch posted earlier.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>

---

 boot_of.c |   37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff -r 12da2c3245bb -r 2276cf35e886 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Thu Jul 27 20:07:02 2006 -0400
+++ b/xen/arch/powerpc/boot_of.c        Thu Aug 03 19:27:39 2006 -0400
@@ -744,7 +744,7 @@ static void __init boot_of_fix_maple(voi
     }
 }
     
-static int __init boot_of_serial(void *oftree)
+static int __init boot_of_serial(void *oftree, ulong serial)
 {
     int n;
     int p;
@@ -762,13 +762,24 @@ static int __init boot_of_serial(void *o
     if (rc == OF_FAILURE) {
         of_panic("package-to-path of /chosen/stdout: failed\n");
     }
-    of_printf("Pruning from devtree: %s\n"
-              "  since Xen will be using it for console\n", buf);
+    of_printf("pruning `%s' from device tree\n", buf);
     rc = ofd_prune_path(oftree, buf);
     if (rc < 0) {
         of_panic("prune path \"%s\" failed\n", buf);
     }
-    
+
+    if (serial) {
+        int len = strlen(buf);
+        char *str = buf + len - sizeof("3f8") + 1;
+
+        if (serial == 0x2f8 && !strcmp(str, "3f8")) {
+            str[0] = '2';
+            of_printf("pruning `%s' from device tree\n", buf);
+            rc = ofd_prune_path(oftree, buf);
+            if (rc < 0)
+                of_panic("pruning path of `%s' failed\n", buf);
+        }
+    }
 
     p = of_getparent(n);
     if (p == OF_FAILURE) {
@@ -795,7 +806,12 @@ static int __init boot_of_serial(void *o
     if (rc == OF_FAILURE) {
         of_panic("%s: no location for serial port\n", __func__);
     }
-    ns16550.io_base = val[1];
+
+    if (serial == 0x2f8 && val[1] == 0x3f8)  {
+        ns16550.io_base = 0x2f8;
+    } else {
+        ns16550.io_base = val[1];
+    }
 
     ns16550.baud = BAUD_AUTO;
     ns16550.data_bits = 8;
@@ -824,6 +840,7 @@ static void boot_of_module(ulong r3, ulo
     char *mod0_start;
     ulong mod0_size;
     ulong mod0;
+    ulong serial = 0;
     static const char sepr[] = " -- ";
     extern char dom0_start[] __attribute__ ((weak));
     extern char dom0_size[] __attribute__ ((weak));
@@ -918,7 +935,15 @@ static void boot_of_module(ulong r3, ulo
     mbi->mods_count = 2;
     mbi->mods_addr = (u32)mods;
 
-    boot_of_serial(oftree);
+    /* Check if the user wants a specific serial device.  */
+    p = strstr((char *)(ulong)mbi->cmdline, "serial=");
+    if (p != NULL) {
+        p += sizeof("serial=") - 1;
+        serial = simple_strtoul(p, NULL, 16);
+        of_printf("using serial device @ %lx\n", serial);
+    }
+
+    boot_of_serial(oftree, serial);
 }
 
 static int __init boot_of_cpus(void)

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to