From 94b55c01a690ec6a20bef8439c7c3107641dc6ba Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sat, 31 Jul 2010 15:18:43 +0300 Subject: [PATCH] kvm: Add some more ioport emulation This patch adds some more ioport emulation code so that I can boot a Linux kernel cleanly with "--ioport-debug" command line option enabled. Signed-off-by: Pekka Enberg --- tools/kvm/early_printk.c | 10 ++++++++-- tools/kvm/ioport.c | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/tools/kvm/early_printk.c b/tools/kvm/early_printk.c index 90e2fac53e48..118407c86e04 100644 --- a/tools/kvm/early_printk.c +++ b/tools/kvm/early_printk.c @@ -25,8 +25,14 @@ static bool early_serial_txr_out(struct kvm *self, uint16_t port, void *data, in return true; } -static struct ioport_operations early_serial_txr_ops = { +static bool early_serial_rxr_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count) +{ + return true; +} + +static struct ioport_operations early_serial_txr_rxr_ops = { .io_out = early_serial_txr_out, + .io_in = early_serial_rxr_in, }; static bool early_serial_lsr_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count) @@ -44,6 +50,6 @@ static struct ioport_operations early_serial_lsr_ops = { void early_printk__init(void) { - ioport__register(early_serial_base + TXR, &early_serial_txr_ops); + ioport__register(early_serial_base + TXR, &early_serial_txr_rxr_ops); ioport__register(early_serial_base + LSR, &early_serial_lsr_ops); } diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c index a06bcb4edea3..7fc28dcbf2b1 100644 --- a/tools/kvm/ioport.c +++ b/tools/kvm/ioport.c @@ -74,6 +74,7 @@ static struct ioport_operations *ioport_ops[USHRT_MAX] = { /* PORT 0060-006F - KEYBOARD CONTROLLER 804x (8041, 8042) (or PPI (8255) on PC,XT) */ [0x0060] = &dummy_read_write_ioport_ops, [0x0061] = &dummy_read_write_ioport_ops, + [0x0064] = &dummy_read_write_ioport_ops, /* PORT 0070-007F - CMOS RAM/RTC (REAL TIME CLOCK) */ [0x0070] = &cmos_ram_rtc_ops, @@ -94,15 +95,41 @@ static struct ioport_operations *ioport_ops[USHRT_MAX] = { [0x00F0] = &dummy_write_only_ioport_ops, [0x00F1] = &dummy_write_only_ioport_ops, + /* PORT 02E8-02EF - serial port, same as 02F8, 03E8 and 03F8 (COM4) */ + [0x02E8] = &dummy_read_write_ioport_ops, + [0x02E9] = &dummy_read_write_ioport_ops, + [0x02EA] = &dummy_read_write_ioport_ops, + [0x02EB] = &dummy_read_write_ioport_ops, + [0x02EC] = &dummy_read_write_ioport_ops, + [0x02EE] = &dummy_read_write_ioport_ops, + [0x02EF] = &dummy_read_write_ioport_ops, + + /* PORT 02F8-02FF - serial port, same as 02E8, 03E8 and 03F8 (COM2) */ + [0x02F8] = &dummy_read_write_ioport_ops, + [0x02F9] = &dummy_read_write_ioport_ops, + [0x02FA] = &dummy_read_write_ioport_ops, + [0x02FB] = &dummy_read_write_ioport_ops, + [0x02FC] = &dummy_read_write_ioport_ops, + [0x02FF] = &dummy_read_write_ioport_ops, + /* PORT 03D4-03D5 - COLOR VIDEO - CRT CONTROL REGISTERS */ [0x03D4] = &dummy_read_write_ioport_ops, [0x03D5] = &dummy_write_only_ioport_ops, + /* PORT 03E8-03EF - serial port, same as 02E8, 02F8 and 03F8 (COM3) */ + [0x03E8] = &dummy_read_write_ioport_ops, + [0x03E9] = &dummy_read_write_ioport_ops, + [0x03EA] = &dummy_read_write_ioport_ops, + [0x03EB] = &dummy_read_write_ioport_ops, + [0x03EC] = &dummy_read_write_ioport_ops, + [0x03EF] = &dummy_read_write_ioport_ops, + /* PORT 03F8-03FF - Serial port (8250,8250A,8251,16450,16550,16550A,etc.) COM1 */ [0x03F9] = &dummy_read_write_ioport_ops, [0x03FA] = &dummy_read_write_ioport_ops, [0x03FB] = &dummy_read_write_ioport_ops, [0x03FC] = &dummy_read_write_ioport_ops, + [0x03FF] = &dummy_read_write_ioport_ops, /* PORT 0CF8-0CFF - PCI Configuration Mechanism 1 - Configuration Registers */ [0x0CF8] = &dummy_write_only_ioport_ops, -- 2.39.5