]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fast A20 gate emulation
authorPekka Enberg <penberg@kernel.org>
Fri, 24 Feb 2012 18:20:16 +0000 (20:20 +0200)
committerPekka Enberg <penberg@kernel.org>
Mon, 5 Nov 2012 07:39:23 +0000 (09:39 +0200)
Add simple "fast A20 gate" PS/2 system control port emulation for
SeaBIOS that probes the port.  As A20 gate is always enabled under KVM,
ignore writes to the port and report back that the gate is enabled.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/x86/ioport.c

index e35d0ee93186bab0786bae497f8f89c4a0c30bfb..824ef257cdb556965291a273a5b86338dad1eef9 100644 (file)
@@ -46,6 +46,25 @@ static struct ioport_operations dummy_write_only_ioport_ops = {
        .io_out         = dummy_io_out,
 };
 
+/*
+ * The "fast A20 gate"
+ */
+
+static bool ps2_control_a_io_in(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size)
+{
+       /*
+        * A20 is always enabled.
+        */
+       ioport__write8(data, 0x02);
+
+       return true;
+}
+
+static struct ioport_operations ps2_control_a_ops = {
+       .io_in          = ps2_control_a_io_in,
+       .io_out         = dummy_io_out,
+};
+
 void ioport__setup_arch(struct kvm *kvm)
 {
        /* Legacy ioport setup */
@@ -56,6 +75,9 @@ void ioport__setup_arch(struct kvm *kvm)
        /* PORT 0040-005F - PIT - PROGRAMMABLE INTERVAL TIMER (8253, 8254) */
        ioport__register(kvm, 0x0040, &dummy_read_write_ioport_ops, 4, NULL);
 
+       /* 0092 - PS/2 system control port A */
+       ioport__register(kvm, 0x0092, &ps2_control_a_ops, 1, NULL);
+
        /* 0x00A0 - 0x00AF - 8259A PIC 2 */
        ioport__register(kvm, 0x00A0, &dummy_read_write_ioport_ops, 2, NULL);