提交 da85ccfb 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

qdev/isa: add qdev support to i8042 (aka ps/2 kbd+mouse).

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
Message-Id: 
上级 f915a115
...@@ -440,3 +440,43 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, ...@@ -440,3 +440,43 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
#endif #endif
qemu_register_reset(kbd_reset, s); 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)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册