direct-io.hg

changeset 11105:653588bfc0f9

[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@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Mon Aug 14 15:22:22 2006 -0500 (2006-08-14)
parents c841daf98bb0
children 0112511542d8
files xen/arch/powerpc/Makefile xen/arch/powerpc/boot_of.c xen/arch/powerpc/setup.c
line diff
     1.1 --- a/xen/arch/powerpc/Makefile	Mon Aug 14 09:53:46 2006 -0400
     1.2 +++ b/xen/arch/powerpc/Makefile	Mon Aug 14 15:22:22 2006 -0500
     1.3 @@ -83,8 +83,10 @@ physdev.o: ../x86/physdev.c
     1.4  
     1.5  HDRS += $(wildcard *.h)
     1.6  
     1.7 -CMDLINE = "xen"
     1.8 -boot_of.o: CFLAGS += -DCMDLINE="\"$(CMDLINE)\""
     1.9 +# The first token in the arguments will be silently dropped.
    1.10 +IMAGENAME = xen
    1.11 +CMDLINE = ""
    1.12 +boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
    1.13  
    1.14  start.o: boot/start.S
    1.15  	$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
     2.1 --- a/xen/arch/powerpc/boot_of.c	Mon Aug 14 09:53:46 2006 -0400
     2.2 +++ b/xen/arch/powerpc/boot_of.c	Mon Aug 14 15:22:22 2006 -0500
     2.3 @@ -13,7 +13,7 @@
     2.4   * along with this program; if not, write to the Free Software
     2.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     2.6   *
     2.7 - * Copyright (C) IBM Corp. 2005
     2.8 + * Copyright (C) IBM Corp. 2005, 2006
     2.9   *
    2.10   * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    2.11   */
    2.12 @@ -759,19 +759,30 @@ static int __init boot_of_serial(void *o
    2.13      if (n == OF_FAILURE) {
    2.14          of_panic("instance-to-package of /chosen/stdout: failed\n");
    2.15      }
    2.16 +    
    2.17 +    /* Prune all serial devices from the device tree, including the
    2.18 +     * one pointed to by /chosen/stdout, because a guest domain can
    2.19 +     * initialize them and in so doing corrupt our console output.
    2.20 +     */
    2.21 +    for (p = n; p > 0; p = of_getpeer(p)) {
    2.22 +        char type[32];
    2.23  
    2.24 -    /* prune this from the oftree */
    2.25 -    rc = of_package_to_path(n, buf, sizeof(buf));
    2.26 -    if (rc == OF_FAILURE) {
    2.27 -        of_panic("package-to-path of /chosen/stdout: failed\n");
    2.28 +        rc = of_package_to_path(p, buf, sizeof(buf));
    2.29 +        if (rc == OF_FAILURE)
    2.30 +            of_panic("package-to-path failed\n");
    2.31 +
    2.32 +        rc = of_getprop(p, "device_type", type, sizeof (type));
    2.33 +        if (rc == OF_FAILURE)
    2.34 +            of_panic("fetching device type failed\n");
    2.35 +
    2.36 +        if (strcmp(type, "serial") != 0)
    2.37 +            continue;
    2.38 +
    2.39 +        of_printf("pruning `%s' from devtree\n", buf);
    2.40 +        rc = ofd_prune_path(oftree, buf);
    2.41 +        if (rc < 0)
    2.42 +            of_panic("prune of `%s' failed\n", buf);
    2.43      }
    2.44 -    of_printf("Pruning from devtree: %s\n"
    2.45 -              "  since Xen will be using it for console\n", buf);
    2.46 -    rc = ofd_prune_path(oftree, buf);
    2.47 -    if (rc < 0) {
    2.48 -        of_panic("prune path \"%s\" failed\n", buf);
    2.49 -    }
    2.50 -    
    2.51  
    2.52      p = of_getparent(n);
    2.53      if (p == OF_FAILURE) {
    2.54 @@ -798,7 +809,6 @@ static int __init boot_of_serial(void *o
    2.55      if (rc == OF_FAILURE) {
    2.56          of_panic("%s: no location for serial port\n", __func__);
    2.57      }
    2.58 -    ns16550.io_base = val[1];
    2.59  
    2.60      ns16550.baud = BAUD_AUTO;
    2.61      ns16550.data_bits = 8;
     3.1 --- a/xen/arch/powerpc/setup.c	Mon Aug 14 09:53:46 2006 -0400
     3.2 +++ b/xen/arch/powerpc/setup.c	Mon Aug 14 15:22:22 2006 -0500
     3.3 @@ -214,7 +214,11 @@ static void __init __start_xen(multiboot
     3.4      if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
     3.5          cmdline_parse(__va((ulong)mbi->cmdline));
     3.6  
     3.7 +    /* We initialise the serial devices very early so we can get debugging. */
     3.8 +    ns16550.io_base = 0x3f8;
     3.9      ns16550_init(0, &ns16550);
    3.10 +    ns16550.io_base = 0x2f8;
    3.11 +    ns16550_init(1, &ns16550);
    3.12      serial_init_preirq();
    3.13  
    3.14      init_console();