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

[Xen-changelog] Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk



ChangeSet 1.1301, 2005/04/15 00:31:12+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
        into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



 console.c |   94 ++++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 62 insertions(+), 32 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c 
b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-04-14 
20:02:55 -04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-04-14 
20:02:55 -04:00
@@ -64,15 +64,34 @@
  * warnings from standard distro startup scripts.
  */
 static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
+static int xc_num = -1;
 
 static int __init xencons_setup(char *str)
 {
-    if ( !strcmp(str, "tty") )
-        xc_mode = XC_TTY;
-    else if ( !strcmp(str, "ttyS") )
+    char *q;
+    int n;
+
+    if ( !strncmp(str, "ttyS", 4) )
         xc_mode = XC_SERIAL;
-    else if ( !strcmp(str, "off") )
+    else if ( !strncmp(str, "tty", 3) )
+        xc_mode = XC_TTY;
+    else if ( !strncmp(str, "off", 3) )
         xc_mode = XC_OFF;
+
+    switch ( xc_mode )
+    {
+    case XC_SERIAL:
+        n = simple_strtol( str+4, &q, 10 );
+        if ( q > (str + 4) ) xc_num = n;
+        break;
+    case XC_TTY:
+        n = simple_strtol( str+3, &q, 10 );
+        if ( q > (str + 3) ) xc_num = n;
+        break;
+    default:
+        break;
+    }
+
     return 1;
 }
 __setup("xencons=", xencons_setup);
@@ -141,16 +160,12 @@
 {
     int rc;
 
-    while ( count > 0 )
+    while ( (count > 0) &&
+            ((rc = HYPERVISOR_console_io(
+                CONSOLEIO_write, count, (char *)s)) > 0) )
     {
-        if ( (rc = HYPERVISOR_console_io(CONSOLEIO_write,
-                                         count, (char *)s)) > 0 )
-        {
-            count -= rc;
-            s += rc;
-        }
-       else
-           break;
+        count -= rc;
+        s += rc;
     }
 }
 
@@ -187,8 +202,8 @@
             xc_mode = XC_SERIAL;
         kcons_info.write = kcons_write_dom0;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-       if ( xc_mode == XC_SERIAL )
-           kcons_info.flags |= CON_ENABLED;
+        if ( xc_mode == XC_SERIAL )
+            kcons_info.flags |= CON_ENABLED;
 #endif
     }
     else
@@ -198,17 +213,26 @@
         kcons_info.write = kcons_write;
     }
 
-    if ( xc_mode == XC_OFF )
-        return __RETCODE;
-
-    if ( xc_mode == XC_SERIAL )
+    switch ( xc_mode )
+    {
+    case XC_SERIAL:
         strcpy(kcons_info.name, "ttyS");
-    else
+        if ( xc_num == -1 ) xc_num = 0;
+        break;
+
+    case XC_TTY:
         strcpy(kcons_info.name, "tty");
+        if ( xc_num == -1 ) xc_num = 1;
+        break;
+
+    default:
+        return __RETCODE;
+    }
 
     wbuf = alloc_bootmem(wbuf_size);
 
     register_console(&kcons_info);
+
     return __RETCODE;
 }
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
@@ -247,7 +271,7 @@
      * We use dangerous control-interface functions that require a quiescent
      * system and no interrupts. Try to ensure this with a global cli().
      */
-    local_irq_disable();       /* XXXsmp */
+    local_irq_disable(); /* XXXsmp */
 
     /* Spin until console data is flushed through to the domain controller. */
     while ( (wc != wp) && !ctrl_if_transmitter_empty() )
@@ -488,8 +512,10 @@
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static int xencons_write(struct tty_struct *tty, const unsigned char *buf,
-                        int count)
+static int xencons_write(
+    struct tty_struct *tty,
+    const unsigned char *buf,
+    int count)
 {
     int i;
     unsigned long flags;
@@ -511,8 +537,11 @@
     return i;
 }
 #else
-static int xencons_write(struct tty_struct *tty, int from_user,
-                        const u_char *buf, int count)
+static int xencons_write(
+    struct tty_struct *tty, 
+    int from_user,
+    const u_char *buf, 
+    int count)
 {
     int i;
     unsigned long flags;
@@ -655,7 +684,7 @@
     return 0;
 }
 
-#define DUMMY  (void *)xennullcon_dummy
+#define DUMMY (void *)xennullcon_dummy
 
 /*
  *  The console `switch' structure for the dummy console
@@ -718,14 +747,14 @@
     if ( xc_mode == XC_SERIAL )
     {
         DRV(xencons_driver)->name        = "ttyS";
-        DRV(xencons_driver)->minor_start = 64;
-       DRV(xencons_driver)->name_base   = 0;
+        DRV(xencons_driver)->minor_start = 64 + xc_num;
+        DRV(xencons_driver)->name_base   = 0 + xc_num;
     }
     else
     {
         DRV(xencons_driver)->name        = "tty";
-        DRV(xencons_driver)->minor_start = 1;
-       DRV(xencons_driver)->name_base   = 1;
+        DRV(xencons_driver)->minor_start = xc_num;
+        DRV(xencons_driver)->name_base   = xc_num;
     }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
@@ -772,8 +801,9 @@
         (void)ctrl_if_register_receiver(CMSG_CONSOLE, xencons_rx, 0);
     }
 
-    printk("Xen virtual console successfully installed as %s\n",
-           DRV(xencons_driver)->name);
+    printk("Xen virtual console successfully installed as %s%d\n",
+           DRV(xencons_driver)->name,
+           DRV(xencons_driver)->name_base );
     
     return 0;
 }

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


 


Rackspace

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