On Wed, Aug 09, 2006 at 07:37:14PM -0400, Amos Waterland wrote:
> The below patch allows Xen/PPC to support the console=comX option 
> that Xen/x86 uses.  With this patch applied, one need simply 
> supply CMDLINE="console=com2" on the make invocation to get proper use
> of the physical serial port on a JS21.
> 
> I will soon split out the pieces for submission, but I am posting this
> for now for review of the basic approach.  I'd also like to ask that
> someone with a Maple-D apply this patch, undefine BROKEN_SLOF, and tell
> me whether they see a panic because we try to prune a path we have just
> pruned. 

I had an error in my logic that was caching the package-to-path
conversion.  Also, the exit condition from the loop walking the peer
list should be zero or negative.  Thanks to Jimi for pointing this out.
SLOF is not broken :)

Here is a corrected version of the patch.  Tested on JS20 and JS21 blades.

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

---

 Makefile  |    6 ++++--
 boot_of.c |   45 ++++++++++++++++++++++++++++++++-------------
 setup.c   |    4 ++++
 3 files changed, 40 insertions(+), 15 deletions(-)

diff -r 058f2e27476d xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Mon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/Makefile Wed Aug 09 22:07:18 2006 -0400
@@ -83,8 +83,10 @@ physdev.o: ../x86/physdev.c
 
 HDRS += $(wildcard *.h)
 
-CMDLINE = "xen"
-boot_of.o: CFLAGS += -DCMDLINE="\"$(CMDLINE)\""
+# The first token in the arguments will be silently dropped.
+IMAGENAME = xen
+CMDLINE = ""
+boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
 
 start.o: boot/start.S
        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
diff -r 058f2e27476d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Mon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/boot_of.c        Wed Aug 09 22:16:51 2006 -0400
@@ -760,19 +760,15 @@ static int __init boot_of_serial(void *o
     if (n == OF_FAILURE) {
         of_panic("instance-to-package of /chosen/stdout: failed\n");
     }
-
-    /* prune this from the oftree */
-    rc = of_package_to_path(n, buf, sizeof(buf));
-    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);
-    rc = ofd_prune_path(oftree, buf);
-    if (rc < 0) {
-        of_panic("prune path \"%s\" failed\n", buf);
-    }
     
+    for (p = n; p > 0; p = of_getpeer(p)) {
+        rc = of_package_to_path(p, buf, sizeof(buf));
+        if (rc == OF_FAILURE) of_panic("package-to-path failed\n");
+        if (strstr(buf, "serial@") == NULL) continue;
+        of_printf("pruning `%s' from devtree\n", buf);
+        rc = ofd_prune_path(oftree, buf);
+        if (rc < 0) of_panic("prune of `%s' failed\n", buf);
+    }
 
     p = of_getparent(n);
     if (p == OF_FAILURE) {
@@ -799,7 +795,6 @@ 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];
 
     ns16550.baud = BAUD_AUTO;
     ns16550.data_bits = 8;
diff -r 058f2e27476d xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Mon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/setup.c  Wed Aug 09 22:07:18 2006 -0400
@@ -214,7 +214,11 @@ static void __init __start_xen(multiboot
     if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
         cmdline_parse(__va((ulong)mbi->cmdline));
 
+    /* We initialise the serial devices very early so we can get debugging. */
+    ns16550.io_base = 0x3f8;
     ns16550_init(0, &ns16550);
+    ns16550.io_base = 0x2f8;
+    ns16550_init(1, &ns16550);
     serial_init_preirq();
 
     init_console();

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

Reply via email to