This patch allows Linux compiled with xen_maple_defconfig to boot on
both bare hardware and as a dom0.  I had to respin it to keep up with changes.

Note that this depends on a xen_start_info patch soon to be posted by Jimi.

To use, put `xencons=xvc0' in your Linux bootargs, and run 
`mknod /dev/xvc0 c 204 187' in your rootfs.  Built and booted up to
nfsroot on a JS21 ppc64 blade both on bare hardware and as a dom0.

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

---

 arch/powerpc/configs/xen_maple_defconfig |   12 ++++++++++--
 drivers/xen/console/console.c            |   27 ++++++++++++++++++++++++++-
 include/linux/major.h                    |    1 +
 3 files changed, 37 insertions(+), 3 deletions(-)

diff -r 968ced1469e8 drivers/xen/console/console.c
--- a/drivers/xen/console/console.c     Tue Oct 17 17:03:31 2006 -0400
+++ b/drivers/xen/console/console.c     Mon Oct 23 22:12:03 2006 -0400
@@ -63,13 +63,20 @@
  *  'xencons=off'  [XC_OFF]:     Console is disabled.
  *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
  *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
+ *  'xencons=xvc'  [XC_XVC]:     Console attached to '/dev/xvc[0-9]+'.
  *                 [XC_DEFAULT]: DOM0 -> XC_SERIAL ; all others -> XC_TTY.
  * 
  * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
  * warnings from standard distro startup scripts.
  */
-static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
+static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL, XC_XVC } 
+    xc_mode = XC_DEFAULT;
 static int xc_num = -1;
+
+/* If we are in XC_XVC mode (a virtual console at /dev/xvcX), we need to
+ * comply with Lanana and use a minor under the low density serial major.
+ */
+#define XEN_XVC_MINOR 187
 
 #ifdef CONFIG_MAGIC_SYSRQ
 static unsigned long sysrq_requested;
@@ -85,6 +92,8 @@ static int __init xencons_setup(char *st
                xc_mode = XC_SERIAL;
        else if (!strncmp(str, "tty", 3))
                xc_mode = XC_TTY;
+       else if (!strncmp(str, "xvc", 3))
+               xc_mode = XC_XVC;
        else if (!strncmp(str, "off", 3))
                xc_mode = XC_OFF;
 
@@ -95,6 +104,11 @@ static int __init xencons_setup(char *st
                        xc_num = n;
                break;
        case XC_TTY:
+               n = simple_strtol(str+3, &q, 10);
+               if (q > (str + 3))
+                       xc_num = n;
+               break;
+       case XC_XVC:
                n = simple_strtol(str+3, &q, 10);
                if (q > (str + 3))
                        xc_num = n;
@@ -199,6 +213,12 @@ static int __init xen_console_init(void)
        }
 
        switch (xc_mode) {
+       case XC_XVC:
+               strcpy(kcons_info.name, "xvc");
+               if (xc_num == -1)
+                       xc_num = 0;
+               break;
+
        case XC_SERIAL:
                strcpy(kcons_info.name, "ttyS");
                if (xc_num == -1)
@@ -595,6 +615,11 @@ static int __init xencons_init(void)
                DRV(xencons_driver)->name        = "ttyS";
                DRV(xencons_driver)->minor_start = 64 + xc_num;
                DRV(xencons_driver)->name_base   = 0 + xc_num;
+       } else if (xc_mode == XC_XVC) {
+               DRV(xencons_driver)->name        = "xvc";
+               DRV(xencons_driver)->major       = LOW_DENS_SERIAL_MAJOR;
+               DRV(xencons_driver)->minor_start = XEN_XVC_MINOR;
+               DRV(xencons_driver)->name_base   = xc_num;
        } else {
                DRV(xencons_driver)->name        = "tty";
                DRV(xencons_driver)->minor_start = xc_num;
diff -r 968ced1469e8 include/linux/major.h
--- a/include/linux/major.h     Tue Oct 17 17:03:31 2006 -0400
+++ b/include/linux/major.h     Mon Oct 23 22:12:03 2006 -0400
@@ -158,6 +158,7 @@
 
 #define MSR_MAJOR              202
 #define CPUID_MAJOR            203
+#define LOW_DENS_SERIAL_MAJOR  204
 
 #define OSST_MAJOR             206     /* OnStream-SCx0 SCSI tape */
 
diff -r 968ced1469e8 arch/powerpc/configs/xen_maple_defconfig
--- a/arch/powerpc/configs/xen_maple_defconfig  Tue Oct 17 17:03:31 2006 -0400
+++ b/arch/powerpc/configs/xen_maple_defconfig  Tue Oct 24 10:55:38 2006 -0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.17
-# Sat Oct  7 08:37:53 2006
+# Tue Oct 24 10:51:54 2006
 #
 CONFIG_PPC64=y
 CONFIG_64BIT=y
@@ -711,10 +711,18 @@ CONFIG_HW_CONSOLE=y
 #
 # Serial drivers
 #
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+# CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
 # Non-8250 serial port support
 #
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_ICOM is not set
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
@@ -1168,7 +1176,7 @@ CONFIG_XEN_BLKDEV_FRONTEND=y
 CONFIG_XEN_BLKDEV_FRONTEND=y
 CONFIG_XEN_NETDEV_FRONTEND=y
 CONFIG_XEN_SCRUB_PAGES=y
-CONFIG_XEN_DISABLE_SERIAL=y
+# CONFIG_XEN_DISABLE_SERIAL is not set
 CONFIG_XEN_SYSFS=y
 # CONFIG_XEN_COMPAT_030002_AND_LATER is not set
 CONFIG_XEN_COMPAT_LATEST_ONLY=y

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

Reply via email to