[kvm-unit-tests PATCH 1/2] x86: io: fix 8250 serial controller initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These changes make serial controller working at real hardware and BOCHS:
- Disable interrupts
- Set up LCR, FCR, MCR properly

Signed-off-by: Eugene Korenevsky <ekorenevsky@xxxxxxxxx>
---
 lib/x86/io.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/x86/io.c b/lib/x86/io.c
index 7e1c16d..f697161 100644
--- a/lib/x86/io.c
+++ b/lib/x86/io.c
@@ -39,6 +39,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);
 }
 
 static void print_serial(const char *buf)
-- 
2.18.0




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux