aboutsummaryrefslogtreecommitdiff
path: root/hw/input/pckbd.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2013-06-15 10:53:44 +0000
committerBlue Swirl <blauwirbel@gmail.com>2013-06-15 10:53:44 +0000
commit371a775dc18ece3ff7d77328d1ee28cb2d473706 (patch)
tree328c5e856f25c5f0176d9361b641e8061e093ae2 /hw/input/pckbd.c
parent22bfa16ed3d4c9d534dcfe6f2381a654f32296b9 (diff)
parentfef7fbc92496f5f6d2b7395263830bce15ebf410 (diff)
downloadqemu-371a775dc18ece3ff7d77328d1ee28cb2d473706.zip
qemu-371a775dc18ece3ff7d77328d1ee28cb2d473706.tar.gz
qemu-371a775dc18ece3ff7d77328d1ee28cb2d473706.tar.bz2
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
* 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu: qdev: Drop FROM_QBUS() macro isa: QOM'ify ISADevice isa: QOM'ify ISABus i8259: Convert PICCommonState to use QOM realizefn kvm/i8259: QOM'ify some more i8259: QOM'ify some more i8254: Convert PITCommonState to QOM realizefn kvm/i8254: QOM'ify some more i8254: QOM'ify some more isa: Use realizefn for ISADevice cs4231a: QOM'ify some more gus: QOM'ify some more
Diffstat (limited to 'hw/input/pckbd.c')
-rw-r--r--hw/input/pckbd.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 17a5614..fff0a4d 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,
};