diff options
Diffstat (limited to 'hw/input')
-rw-r--r-- | hw/input/pckbd.c | 29 | ||||
-rw-r--r-- | hw/input/vmmouse.c | 8 |
2 files changed, 21 insertions, 16 deletions
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 17a56140de..fff0a4d1f8 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -489,31 +489,37 @@ static const MemoryRegionOps i8042_cmd_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static int i8042_initfn(ISADevice *dev) +static void i8042_initfn(Object *obj) { - ISAKBDState *isa_s = I8042(dev); + ISAKBDState *isa_s = I8042(obj); KBDState *s = &isa_s->kbd; - isa_init_irq(dev, &s->irq_kbd, 1); - isa_init_irq(dev, &s->irq_mouse, 12); - memory_region_init_io(isa_s->io + 0, &i8042_data_ops, s, "i8042-data", 1); - isa_register_ioport(dev, isa_s->io + 0, 0x60); - memory_region_init_io(isa_s->io + 1, &i8042_cmd_ops, s, "i8042-cmd", 1); - isa_register_ioport(dev, isa_s->io + 1, 0x64); +} + +static void i8042_realizefn(DeviceState *dev, Error **errp) +{ + ISADevice *isadev = ISA_DEVICE(dev); + ISAKBDState *isa_s = I8042(dev); + KBDState *s = &isa_s->kbd; + + isa_init_irq(isadev, &s->irq_kbd, 1); + isa_init_irq(isadev, &s->irq_mouse, 12); + + isa_register_ioport(isadev, isa_s->io + 0, 0x60); + isa_register_ioport(isadev, isa_s->io + 1, 0x64); s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); qemu_register_reset(kbd_reset, s); - return 0; } static void i8042_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); - ic->init = i8042_initfn; + + dc->realize = i8042_realizefn; dc->no_user = 1; dc->vmsd = &vmstate_kbd_isa; } @@ -522,6 +528,7 @@ static const TypeInfo i8042_info = { .name = TYPE_I8042, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof(ISAKBDState), + .instance_init = i8042_initfn, .class_init = i8042_class_initfn, }; diff --git a/hw/input/vmmouse.c b/hw/input/vmmouse.c index a610738374..abd032b794 100644 --- a/hw/input/vmmouse.c +++ b/hw/input/vmmouse.c @@ -261,7 +261,7 @@ static void vmmouse_reset(DeviceState *d) vmmouse_disable(s); } -static int vmmouse_initfn(ISADevice *dev) +static void vmmouse_realizefn(DeviceState *dev, Error **errp) { VMMouseState *s = VMMOUSE(dev); @@ -270,8 +270,6 @@ static int vmmouse_initfn(ISADevice *dev) vmport_register(VMMOUSE_STATUS, vmmouse_ioport_read, s); vmport_register(VMMOUSE_COMMAND, vmmouse_ioport_read, s); vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s); - - return 0; } static Property vmmouse_properties[] = { @@ -282,8 +280,8 @@ static Property vmmouse_properties[] = { static void vmmouse_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); - ic->init = vmmouse_initfn; + + dc->realize = vmmouse_realizefn; dc->no_user = 1; dc->reset = vmmouse_reset; dc->vmsd = &vmstate_vmmouse; |