]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm,8250: Fix device initial state
authorPekka Enberg <penberg@kernel.org>
Sun, 23 Jan 2011 09:49:39 +0000 (11:49 +0200)
committerPekka Enberg <penberg@kernel.org>
Sun, 23 Jan 2011 09:49:39 +0000 (11:49 +0200)
This patch fixes 8250 device initial state for registers and IRQ based on what
Qemu does.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/8250-serial.c
tools/kvm/include/kvm/8250-serial.h
tools/kvm/main.c

index 44dfd7f9c062f990f159ce048e07419d3a7a736f..7aea383378f02c12a98bc36a764defd161ce65a5 100644 (file)
@@ -32,8 +32,10 @@ static struct serial8250_device devices[] = {
                .iobase                 = 0x3f8,
                .irq                    = 4,
 
-               .lsr                    = UART_LSR_TEMT | UART_LSR_THRE,
                .iir                    = UART_IIR_NO_INT,
+               .lsr                    = UART_LSR_TEMT | UART_LSR_THRE,
+               .msr                    = UART_MSR_DCD | UART_MSR_DSR | UART_MSR_CTS,
+               .mcr                    = UART_MCR_OUT2,
        },
        /* ttyS1 */
        [1]     = {
@@ -282,13 +284,19 @@ static struct ioport_operations serial8250_ops = {
        .io_out         = serial8250_out,
 };
 
-void serial8250__init(void)
+static void serial8250__device_init(struct kvm *kvm, struct serial8250_device *dev)
+{
+       ioport__register(dev->iobase, &serial8250_ops, 8);
+       kvm__irq_line(kvm, dev->irq, 0);
+}
+
+void serial8250__init(struct kvm *kvm)
 {
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(devices); i++) {
                struct serial8250_device *dev = &devices[i];
 
-               ioport__register(dev->iobase, &serial8250_ops, 8);
+               serial8250__device_init(kvm, dev);
        }
 }
index d899f4fe83bd7371193ea7a6bd27b6e3408bb7d2..05ee0964d844456d9bd04ce39038c21f1390de26 100644 (file)
@@ -3,7 +3,7 @@
 
 struct kvm;
 
-void serial8250__init(void);
-void serial8250__interrupt(struct kvm *self);
+void serial8250__init(struct kvm *kvm);
+void serial8250__interrupt(struct kvm *kvm);
 
 #endif /* KVM__8250_SERIAL_H */
index 643f6bde050584c5cafcefe0dc1c7b21a172b60b..cac8d307858dc2719a48a8a7036ea7ead94ccb2b 100644 (file)
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
        if (single_step)
                kvm__enable_singlestep(kvm);
 
-       serial8250__init();
+       serial8250__init(kvm);
        pci__init();
 
        blk_virtio__init(kvm);