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:
This commit is contained in:
Gerd Hoffmann 2009-07-31 12:30:15 +02:00 committed by Anthony Liguori
parent f915a11563
commit da85ccfb77

View File

@ -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)