ia64/xen-unstable

changeset 10284:61e2ea81bd65

[HVM] Allow more dynamic use of the qemu serial lines by allowing the Summagraphics port to float.

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@virtualiron.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 01 18:32:04 2006 +0100 (2006-06-01)
parents bcfbbca9cf08
children 2fd7f4fb7d14
files tools/ioemu/hw/pc.c tools/ioemu/vl.c tools/ioemu/vl.h
line diff
     1.1 --- a/tools/ioemu/hw/pc.c	Thu Jun 01 18:30:28 2006 +0100
     1.2 +++ b/tools/ioemu/hw/pc.c	Thu Jun 01 18:32:04 2006 +0100
     1.3 @@ -537,8 +537,11 @@ void pc_init(uint64_t ram_size, int vga_
     1.4      for(i = 0; i < MAX_SERIAL_PORTS; i++) {
     1.5          if (serial_hds[i]) {
     1.6              sp = serial_init(serial_io[i], serial_irq[i], serial_hds[i]);
     1.7 -            if (i == SUMMA_PORT)
     1.8 +            if (i == serial_summa_port) {
     1.9  		summa_init(sp, serial_hds[i]);
    1.10 +		fprintf(stderr, "Serial port %d (COM%d) initialized for Summagraphics\n",
    1.11 +			i, i+1);
    1.12 +	    }
    1.13          }
    1.14      }
    1.15  
     2.1 --- a/tools/ioemu/vl.c	Thu Jun 01 18:30:28 2006 +0100
     2.2 +++ b/tools/ioemu/vl.c	Thu Jun 01 18:32:04 2006 +0100
     2.3 @@ -146,6 +146,7 @@ int full_screen = 0;
     2.4  int repeat_key = 1;
     2.5  TextConsole *vga_console;
     2.6  CharDriverState *serial_hds[MAX_SERIAL_PORTS];
     2.7 +int serial_summa_port = -1;
     2.8  int xc_handle;
     2.9  time_t timeoffset = 0;
    2.10  
    2.11 @@ -2588,8 +2589,8 @@ int main(int argc, char **argv)
    2.12      pstrcpy(monitor_device, sizeof(monitor_device), "vc");
    2.13  
    2.14      pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "vc");
    2.15 -    pstrcpy(serial_devices[1], sizeof(serial_devices[1]), "null");
    2.16 -    for(i = 2; i < MAX_SERIAL_PORTS; i++)
    2.17 +    serial_summa_port = -1;
    2.18 +    for(i = 1; i < MAX_SERIAL_PORTS; i++)
    2.19          serial_devices[i][0] = '\0';
    2.20      serial_device_index = 0;
    2.21  
    2.22 @@ -3173,6 +3174,20 @@ int main(int argc, char **argv)
    2.23      }
    2.24      monitor_init(monitor_hd, !nographic);
    2.25  
    2.26 +    /* Find which port should be the Summagraphics port */
    2.27 +    /* It's the first unspecified serial line. Note that COM1 is set */
    2.28 +    /* by default, so the Summagraphics port would be COM2 or higher */
    2.29 +
    2.30 +    for(i = 0; i < MAX_SERIAL_PORTS; i++) {
    2.31 +      if (serial_devices[i][0] != '\0')
    2.32 +	continue;
    2.33 +      serial_summa_port = i;
    2.34 +      pstrcpy(serial_devices[serial_summa_port], sizeof(serial_devices[0]), "null");
    2.35 +      break;
    2.36 +    }
    2.37 +
    2.38 +    /* Now, open the ports */
    2.39 +
    2.40      for(i = 0; i < MAX_SERIAL_PORTS; i++) {
    2.41          if (serial_devices[i][0] != '\0') {
    2.42              serial_hds[i] = qemu_chr_open(serial_devices[i]);
     3.1 --- a/tools/ioemu/vl.h	Thu Jun 01 18:30:28 2006 +0100
     3.2 +++ b/tools/ioemu/vl.h	Thu Jun 01 18:32:04 2006 +0100
     3.3 @@ -238,9 +238,9 @@ void console_select(unsigned int index);
     3.4  /* serial ports */
     3.5  
     3.6  #define MAX_SERIAL_PORTS 4
     3.7 -#define SUMMA_PORT	1
     3.8  
     3.9  extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
    3.10 +extern int serial_summa_port;
    3.11  
    3.12  /* network redirectors support */
    3.13