WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [xenppc-unstable] [POWERPC] Support console=comX option for Xen

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [POWERPC] Support console=comX option for Xen console.
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Aug 2006 20:20:47 +0000
Delivery-date: Mon, 14 Aug 2006 14:12:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 9563f5c9ab19cd93086ab9b0640c741714d009bc
# Parent  10f1113fd48939fefa3daaabdb0e9890f77a97b0
[POWERPC] Support console=comX option for Xen console.
Let Xen/PPC support the console=comX option that Xen/x86 uses, so one
need simply supply CMDLINE="console=com2" on the make invocation to get
proper use of the physical serial port on a JS21.

We do this by pruning all serial devices from the device tree, and then
initializing both com1 and com2 (like arch/x86/setup.c does).

Note that `setenv direct-serial? true; nvupdate' should in theory help
with this, but it does not work at present, and will only be supported
in some future version of SLOF.  Regardless, it is useful to support the
console=comX option, since there will always be environments where it is
difficult to get access to the firmware console.

Tested on JS20 and JS21 blades.

Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/arch/powerpc/Makefile  |    6 ++++--
 xen/arch/powerpc/boot_of.c |   38 ++++++++++++++++++++++++--------------
 xen/arch/powerpc/setup.c   |    4 ++++
 3 files changed, 32 insertions(+), 16 deletions(-)

diff -r 10f1113fd489 -r 9563f5c9ab19 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Mon Aug 14 15:21:30 2006 -0400
+++ b/xen/arch/powerpc/Makefile Mon Aug 14 15:22:22 2006 -0500
@@ -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 10f1113fd489 -r 9563f5c9ab19 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Mon Aug 14 15:21:30 2006 -0400
+++ b/xen/arch/powerpc/boot_of.c        Mon Aug 14 15:22:22 2006 -0500
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
  */
@@ -759,19 +759,30 @@ 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);
-    }
     
+    /* Prune all serial devices from the device tree, including the
+     * one pointed to by /chosen/stdout, because a guest domain can
+     * initialize them and in so doing corrupt our console output.
+     */
+    for (p = n; p > 0; p = of_getpeer(p)) {
+        char type[32];
+
+        rc = of_package_to_path(p, buf, sizeof(buf));
+        if (rc == OF_FAILURE)
+            of_panic("package-to-path failed\n");
+
+        rc = of_getprop(p, "device_type", type, sizeof (type));
+        if (rc == OF_FAILURE)
+            of_panic("fetching device type failed\n");
+
+        if (strcmp(type, "serial") != 0)
+            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) {
@@ -798,7 +809,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 10f1113fd489 -r 9563f5c9ab19 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Mon Aug 14 15:21:30 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Mon Aug 14 15:22:22 2006 -0500
@@ -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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [POWERPC] Support console=comX option for Xen console., Xen patchbot-xenppc-unstable <=