[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Virtual console driver on /dev/xvc0 (take two)



Use the low-density serial console major and the next free minor
according to the Lanana.  Since it would be awkward to say
'xencons=xvc187', use name_base to allow /dev/xvc0 to be 
major/minor 204/187.

To use, put `xencons=xvc0' in your Linux .config, 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 <apw@xxxxxxxxxx>

---

 drivers/xen/console/console.c |   29 +++++++++++++++++++++++++++--
 include/linux/major.h         |    1 +
 2 files changed, 28 insertions(+), 2 deletions(-)

diff -r 17aa29a18b08 drivers/xen/console/console.c
--- a/drivers/xen/console/console.c     Thu Jul 27 18:57:20 2006 -0400
+++ b/drivers/xen/console/console.c     Fri Aug 04 13:04:06 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;
@@ -192,7 +206,7 @@ static int __init xen_console_init(void)
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_SERIAL;
                kcons_info.write = kcons_write_dom0;
-               if (xc_mode == XC_SERIAL)
+               if (xc_mode == XC_SERIAL || xc_mode == XC_XVC)
                        kcons_info.flags |= CON_ENABLED;
        } else {
                if (xc_mode == XC_DEFAULT)
@@ -201,6 +215,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)
@@ -597,6 +617,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 17aa29a18b08 include/linux/major.h
--- a/include/linux/major.h     Thu Jul 27 18:57:20 2006 -0400
+++ b/include/linux/major.h     Fri Aug 04 13:04:06 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 */
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.