aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Amit <namit@vmware.com>2020-07-01 12:30:45 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2020-07-02 05:41:57 -0400
commitc83858a4e0b3b6d9554c866cb5163a27fa5964bf (patch)
tree58de92ac70af1876eb96fd73b8a752d8609d1e71
parenteae10e8f3d7fbb539af8dcfdab4df2a4f70fab05 (diff)
downloadkvm-unit-tests-c83858a4e0b3b6d9554c866cb5163a27fa5964bf.tar.gz
x86: realmode: fix serial_init()
In some setups serial output from the real-mode tests is corrupted. I do not know the serial port initialization code well, but the protected mode initialization code is different than the real-mode code. Using the protected mode serial port initialization fixes the problem. Keeping the tradition of code duplication between real-mode and protected mode, this patch copies the missing initialization into real-mode serial port initialization. Signed-off-by: Nadav Amit <namit@vmware.com> Message-Id: <20200701193045.31247-1-namit@vmware.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--x86/realmode.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/x86/realmode.c b/x86/realmode.c
index 90ecd13..7c2d776 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -77,6 +77,15 @@ static void serial_init(void)
lcr = inb(serial_iobase + 0x03);
lcr &= ~0x80;
outb(lcr, serial_iobase + 0x03);
+
+ /* IER: disable interrupts */
+ outb(0x00, serial_iobase + 0x01);
+ /* LCR: 8 bits, no parity, one stop bit */
+ outb(0x03, serial_iobase + 0x03);
+ /* FCR: disable FIFO queues */
+ outb(0x00, serial_iobase + 0x02);
+ /* MCR: RTS, DTR on */
+ outb(0x03, serial_iobase + 0x04);
}
#endif