aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/pckbd.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/hw/pckbd.c b/hw/pckbd.c
index d50cd6e..bb4cc0e 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -440,3 +440,43 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
#endif
qemu_register_reset(kbd_reset, s);
}
+
+typedef struct ISAKBDState {
+ ISADevice dev;
+ KBDState kbd;
+} ISAKBDState;
+
+static void i8042_initfn(ISADevice *dev)
+{
+ KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd);
+
+ isa_init_irq(dev, &s->irq_kbd);
+ isa_init_irq(dev, &s->irq_mouse);
+
+ kbd_reset(s);
+ register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
+ register_ioport_read(dev->iobase[0], 1, 1, kbd_read_data, s);
+ register_ioport_write(dev->iobase[0], 1, 1, kbd_write_data, s);
+ register_ioport_read(dev->iobase[1], 1, 1, kbd_read_status, s);
+ register_ioport_write(dev->iobase[1], 1, 1, kbd_write_command, s);
+
+ s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
+ s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
+#ifdef TARGET_I386
+ vmmouse_init(s->mouse);
+#endif
+ qemu_register_reset(kbd_reset, s);
+}
+
+static ISADeviceInfo i8042_info = {
+ .qdev.name = "i8042",
+ .qdev.size = sizeof(ISAKBDState),
+ .qdev.no_user = 1,
+ .init = i8042_initfn,
+};
+
+static void i8042_register(void)
+{
+ isa_qdev_register(&i8042_info);
+}
+device_init(i8042_register)