]> xenbits.xensource.com Git - qemu-xen-3.4-testing.git/commitdiff
CHR_IOCTL_SERIAL_{GET,SET}_TIOCM
authorIan Jackson <iwj@mariner.uk.xensource.com>
Mon, 2 Jun 2008 10:20:34 +0000 (11:20 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 2 Jun 2008 10:20:34 +0000 (11:20 +0100)
Remaining fragments of xen-unstable c/s
16537:bf21e00155b7dd76653c5340099ecedac7a7de08

    [QEMU-DM] Modem control line & msl/mcr register support.

    This patch enables handling of the modem/flow control lines of a
    serial port when the backend for the virtual port is a physical serial
    port. During initialization, it tries to load the msr with the
    detected status from the real port (this is consistent with physical
    uart, which starts with its msr values set according to the status of
    the modem status lines). If the ioctl returns -ENOTSUP, then the code
    assumes the backend is not a real serial port and will disable any
    further attempts to manipulate or read the physical port's line
    status.

    It's tries to be as "correct" as possible in its msr/msl handling,
    with the exception of modem line status change interrupts. A real
    16550 uart apparently have a delay time of 250ns between when a modem
    status line changes and the IRQ line goes high. In this patch, an
    "idle" port is polled for line status changes only if the guest has
    enabled UART_IER_MSI is enabled, and only polled every 10 ms.

Signed-off-by: Trolle Selander <trolle.selander@gmail.com>
qemu-char.h
vl.c

index 29de03df58cff305b53cc63efa6b5b0cae12ab1c..41936bc9f0caa77b4752c0aacaf7a7f765c7f58d 100644 (file)
@@ -28,6 +28,9 @@ typedef struct {
 #define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
 #define CHR_IOCTL_PP_EPP_WRITE       11
 
+#define CHR_IOCTL_SERIAL_SET_TIOCM   12
+#define CHR_IOCTL_SERIAL_GET_TIOCM   13
+
 typedef void IOEventHandler(void *opaque, int event);
 
 struct CharDriverState {
diff --git a/vl.c b/vl.c
index 6e437a4d83496c0b7ada80bba93ad4be8cf5c1e2..2057917cd2dfa0781abda1cc1bdab4f605268645 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2445,6 +2445,16 @@ static int tty_serial_ioctl(CharDriverState *chr, int cmd, void *arg)
                 tcsendbreak(s->fd_in, 1);
         }
         break;
+    case CHR_IOCTL_SERIAL_GET_TIOCM:
+        {
+            ioctl(s->fd_in, TIOCMGET, arg);
+        }
+        break;
+    case CHR_IOCTL_SERIAL_SET_TIOCM:
+        {
+            ioctl(s->fd_in, TIOCMSET, arg);
+        }
+        break;
     default:
         return -ENOTSUP;
     }