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-devel

[Xen-devel] [PATCH] Allow more dynamic use of serial lines with qemu by

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Allow more dynamic use of serial lines with qemu by floating Summagraphic port
From: Ben Thomas <bthomas@xxxxxxxxxxxxxxx>
Date: Wed, 31 May 2006 10:03:18 -0400
Delivery-date: Wed, 31 May 2006 07:03:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501)
This patch allows more dynamic use of the qemu serial lines by allowing
the Summagraphics port to float.  I've discussed this with
Don Dugger who did the Summagraphics work. This patch has no operational
effect on existing configurations, but allows more serial lines
to be used.

qemu will emulate up to 4 serial lines (COM1 - COM4).  One of these
lines supports a Summagraphics protocol.  This has changed recently,
and it's now always COM2.  This patch allows the user to specify
to qemu which lines should be serial lines, and the code will place
the Summagraphics compatible line at just above the last specified
serial line.  qemu defaults serial line 0 (COM1) to be "vc", resulting
in the Summagraphics support residing on COM2. This is in keeping
with the current behavior.

The results, via qemu command line, are:

<none>                                    COM2
-serial x                                 COM2
-serial x -serial x                       COM3
-serial x -serial x -serial x             COM4
-serial x -serial x -serial x -serial x  <none>

The results are deterministic, and allow the use of up to 4 serial
lines including none with Summagraphics support.  There is no
change from current behavior, unless requested.

Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx)

--
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
bthomas@xxxxxxxxxxxxxxx                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851
diff -r afabaa39be52 tools/ioemu/hw/pc.c
--- a/tools/ioemu/hw/pc.c       Wed May 31 07:20:36 2006 +0100
+++ b/tools/ioemu/hw/pc.c       Wed May 31 09:47:08 2006 -0400
@@ -537,8 +537,11 @@ void pc_init(uint64_t ram_size, int vga_
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         if (serial_hds[i]) {
             sp = serial_init(serial_io[i], serial_irq[i], serial_hds[i]);
-            if (i == SUMMA_PORT)
+            if (i == serial_summa_port) {
                summa_init(sp, serial_hds[i]);
+               fprintf(stderr, "Serial port %d (COM%d) initialized for 
Summagraphics\n",
+                       i, i+1);
+           }
         }
     }
 
diff -r afabaa39be52 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Wed May 31 07:20:36 2006 +0100
+++ b/tools/ioemu/vl.c  Wed May 31 09:47:08 2006 -0400
@@ -146,6 +146,7 @@ int repeat_key = 1;
 int repeat_key = 1;
 TextConsole *vga_console;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
+int serial_summa_port = -1;
 int xc_handle;
 time_t timeoffset = 0;
 
@@ -2588,8 +2589,8 @@ int main(int argc, char **argv)
     pstrcpy(monitor_device, sizeof(monitor_device), "vc");
 
     pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "vc");
-    pstrcpy(serial_devices[1], sizeof(serial_devices[1]), "null");
-    for(i = 2; i < MAX_SERIAL_PORTS; i++)
+    serial_summa_port = -1;
+    for(i = 1; i < MAX_SERIAL_PORTS; i++)
         serial_devices[i][0] = '\0';
     serial_device_index = 0;
 
@@ -3173,6 +3174,20 @@ int main(int argc, char **argv)
     }
     monitor_init(monitor_hd, !nographic);
 
+    /* Find which port should be the Summagraphics port */
+    /* It's the first unspecified serial line. Note that COM1 is set */
+    /* by default, so the Summagraphics port would be COM2 or higher */
+
+    for(i = 0; i < MAX_SERIAL_PORTS; i++) {
+      if (serial_devices[i][0] != '\0')
+       continue;
+      serial_summa_port = i;
+      pstrcpy(serial_devices[serial_summa_port], sizeof(serial_devices[0]), 
"null");
+      break;
+    }
+
+    /* Now, open the ports */
+
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         if (serial_devices[i][0] != '\0') {
             serial_hds[i] = qemu_chr_open(serial_devices[i]);
diff -r afabaa39be52 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Wed May 31 07:20:36 2006 +0100
+++ b/tools/ioemu/vl.h  Wed May 31 09:47:08 2006 -0400
@@ -238,9 +238,9 @@ void console_select(unsigned int index);
 /* serial ports */
 
 #define MAX_SERIAL_PORTS 4
-#define SUMMA_PORT     1
 
 extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
+extern int serial_summa_port;
 
 /* network redirectors support */
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Allow more dynamic use of serial lines with qemu by floating Summagraphic port, Ben Thomas <=