diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-07-31 12:30:15 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-08-10 13:05:28 -0500 |
commit | da85ccfb77d77ac514c3b2d518f3c13bff27ba29 (patch) | |
tree | 97d3df43a0dd6b4e9d335e6f29378d0f8fd460f5 | |
parent | f915a11563a6b4377acbf9ff800bcfbc9225f1d3 (diff) |
qdev/isa: add qdev support to i8042 (aka ps/2 kbd+mouse).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:
-rw-r--r-- | hw/pckbd.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/hw/pckbd.c b/hw/pckbd.c index d50cd6e2dc..bb4cc0e9db 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) |