Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- hw/applesmc.c | 18 ++++++++++++------ hw/cs4231a.c | 20 +++++++++++++------- hw/debugcon.c | 16 +++++++++++----- hw/fdc.c | 24 +++++++++++++++--------- hw/gus.c | 20 +++++++++++++------- hw/i8254.c | 22 ++++++++++++++-------- hw/i8259.c | 22 ++++++++++++++-------- hw/ide/isa.c | 20 +++++++++++++------- hw/isa-bus.c | 33 +++++++++++++++++++++++---------- hw/isa.h | 22 ++++++++++++++-------- hw/m48t59.c | 20 +++++++++++++------- hw/mc146818rtc.c | 22 ++++++++++++++-------- hw/ne2000-isa.c | 16 +++++++++++----- hw/parallel.c | 16 +++++++++++----- hw/pc.c | 20 +++++++++++++------- hw/pckbd.c | 18 ++++++++++++------ hw/sb16.c | 20 +++++++++++++------- hw/serial.c | 18 ++++++++++++------ hw/sga.c | 16 +++++++++++----- hw/vga-isa.c | 18 ++++++++++++------ hw/vmmouse.c | 22 ++++++++++++++-------- hw/vmport.c | 16 +++++++++++----- hw/wdt_ib700.c | 18 ++++++++++++------ 23 files changed, 301 insertions(+), 156 deletions(-)
diff --git a/hw/applesmc.c b/hw/applesmc.c index c47b592..a6e88bc 100644 --- a/hw/applesmc.c +++ b/hw/applesmc.c @@ -220,12 +220,18 @@ static int applesmc_isa_init(ISADevice *dev) return 0; } -static ISADeviceInfo applesmc_isa_info = { - .qdev.name = "isa-applesmc", - .qdev.size = sizeof(struct AppleSMCStatus), - .qdev.reset = qdev_applesmc_isa_reset, - .init = applesmc_isa_init, - .qdev.props = (Property[]) { +static void qdev_applesmc_class_init(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = applesmc_isa_init; +} + +static DeviceInfo applesmc_isa_info = { + .name = "isa-applesmc", + .size = sizeof(struct AppleSMCStatus), + .reset = qdev_applesmc_isa_reset, + .class_init = qdev_applesmc_class_init, + .props = (Property[]) { DEFINE_PROP_HEX32("iobase", struct AppleSMCStatus, iobase, APPLESMC_DEFAULT_IOBASE), DEFINE_PROP_STRING("osk", struct AppleSMCStatus, osk), diff --git a/hw/cs4231a.c b/hw/cs4231a.c index dc77a3a..811c76b 100644 --- a/hw/cs4231a.c +++ b/hw/cs4231a.c @@ -665,13 +665,19 @@ int cs4231a_init (ISABus *bus) return 0; } -static ISADeviceInfo cs4231a_info = { - .qdev.name = "cs4231a", - .qdev.desc = "Crystal Semiconductor CS4231A", - .qdev.size = sizeof (CSState), - .qdev.vmsd = &vmstate_cs4231a, - .init = cs4231a_initfn, - .qdev.props = (Property[]) { +static void cs4231a_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = cs4231a_initfn; +} + +static DeviceInfo cs4231a_info = { + .name = "cs4231a", + .desc = "Crystal Semiconductor CS4231A", + .size = sizeof (CSState), + .vmsd = &vmstate_cs4231a, + .class_init = cs4231a_class_initfn, + .props = (Property[]) { DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534), DEFINE_PROP_UINT32 ("irq", CSState, irq, 9), DEFINE_PROP_UINT32 ("dma", CSState, dma, 3), diff --git a/hw/debugcon.c b/hw/debugcon.c index c9ee6d9..f290122 100644 --- a/hw/debugcon.c +++ b/hw/debugcon.c @@ -87,11 +87,17 @@ static int debugcon_isa_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo debugcon_isa_info = { - .qdev.name = "isa-debugcon", - .qdev.size = sizeof(ISADebugconState), - .init = debugcon_isa_initfn, - .qdev.props = (Property[]) { +static void debugcon_isa_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = debugcon_isa_initfn; +} + +static DeviceInfo debugcon_isa_info = { + .name = "isa-debugcon", + .size = sizeof(ISADebugconState), + .class_init = debugcon_isa_class_initfn, + .props = (Property[]) { DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9), DEFINE_PROP_CHR("chardev", ISADebugconState, state.chr), DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9), diff --git a/hw/fdc.c b/hw/fdc.c index 70aa5c7..f761221 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -1959,15 +1959,21 @@ static const VMStateDescription vmstate_isa_fdc ={ } }; -static ISADeviceInfo isa_fdc_info = { - .init = isabus_fdc_init1, - .qdev.name = "isa-fdc", - .qdev.fw_name = "fdc", - .qdev.size = sizeof(FDCtrlISABus), - .qdev.no_user = 1, - .qdev.vmsd = &vmstate_isa_fdc, - .qdev.reset = fdctrl_external_reset_isa, - .qdev.props = (Property[]) { +static void isabus_fdc_class_init1(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = isabus_fdc_init1; +} + +static DeviceInfo isa_fdc_info = { + .class_init = isabus_fdc_class_init1, + .name = "isa-fdc", + .fw_name = "fdc", + .size = sizeof(FDCtrlISABus), + .no_user = 1, + .vmsd = &vmstate_isa_fdc, + .reset = fdctrl_external_reset_isa, + .props = (Property[]) { DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.drives[0].bs), DEFINE_PROP_DRIVE("driveB", FDCtrlISABus, state.drives[1].bs), DEFINE_PROP_INT32("bootindexA", FDCtrlISABus, bootindexA, -1), diff --git a/hw/gus.c b/hw/gus.c index ab872d8..6603aab 100644 --- a/hw/gus.c +++ b/hw/gus.c @@ -299,13 +299,19 @@ int GUS_init (ISABus *bus) return 0; } -static ISADeviceInfo gus_info = { - .qdev.name = "gus", - .qdev.desc = "Gravis Ultrasound GF1", - .qdev.size = sizeof (GUSState), - .qdev.vmsd = &vmstate_gus, - .init = gus_initfn, - .qdev.props = (Property[]) { +static void gus_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = gus_initfn; +} + +static DeviceInfo gus_info = { + .name = "gus", + .desc = "Gravis Ultrasound GF1", + .size = sizeof (GUSState), + .vmsd = &vmstate_gus, + .class_init = gus_class_initfn, + .props = (Property[]) { DEFINE_PROP_UINT32 ("freq", GUSState, freq, 44100), DEFINE_PROP_HEX32 ("iobase", GUSState, port, 0x240), DEFINE_PROP_UINT32 ("irq", GUSState, emu.gusirq, 7), diff --git a/hw/i8254.c b/hw/i8254.c index cf9ed2f..add1fab 100644 --- a/hw/i8254.c +++ b/hw/i8254.c @@ -535,14 +535,20 @@ static int pit_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo pit_info = { - .qdev.name = "isa-pit", - .qdev.size = sizeof(PITState), - .qdev.vmsd = &vmstate_pit, - .qdev.reset = pit_reset, - .qdev.no_user = 1, - .init = pit_initfn, - .qdev.props = (Property[]) { +static void pit_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = pit_initfn; +} + +static DeviceInfo pit_info = { + .name = "isa-pit", + .size = sizeof(PITState), + .vmsd = &vmstate_pit, + .reset = pit_reset, + .no_user = 1, + .class_init = pit_class_initfn, + .props = (Property[]) { DEFINE_PROP_UINT32("irq", PITState, irq, -1), DEFINE_PROP_HEX32("iobase", PITState, iobase, -1), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/i8259.c b/hw/i8259.c index 7331e0e..6502c48 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -556,14 +556,20 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq) return irq_set; } -static ISADeviceInfo i8259_info = { - .qdev.name = "isa-i8259", - .qdev.size = sizeof(PicState), - .qdev.vmsd = &vmstate_pic, - .qdev.reset = pic_reset, - .qdev.no_user = 1, - .init = pic_initfn, - .qdev.props = (Property[]) { +static void pic_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = pic_initfn; +} + +static DeviceInfo i8259_info = { + .name = "isa-i8259", + .size = sizeof(PicState), + .vmsd = &vmstate_pic, + .reset = pic_reset, + .no_user = 1, + .class_init = pic_class_initfn, + .props = (Property[]) { DEFINE_PROP_HEX32("iobase", PicState, iobase, -1), DEFINE_PROP_HEX32("elcr_addr", PicState, elcr_addr, -1), DEFINE_PROP_HEX8("elcr_mask", PicState, elcr_mask, -1), diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 219f3a4..464473a 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -94,13 +94,19 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, return dev; } -static ISADeviceInfo isa_ide_info = { - .qdev.name = "isa-ide", - .qdev.fw_name = "ide", - .qdev.size = sizeof(ISAIDEState), - .init = isa_ide_initfn, - .qdev.reset = isa_ide_reset, - .qdev.props = (Property[]) { +static void isa_ide_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = isa_ide_initfn; +} + +static DeviceInfo isa_ide_info = { + .name = "isa-ide", + .fw_name = "ide", + .size = sizeof(ISAIDEState), + .class_init = isa_ide_class_initfn, + .reset = isa_ide_reset, + .props = (Property[]) { DEFINE_PROP_HEX32("iobase", ISAIDEState, iobase, 0x1f0), DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6), DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, 14), diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 5af790b..cef6e8f 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -112,20 +112,24 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start, static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base) { - ISADevice *dev = DO_UPCAST(ISADevice, qdev, qdev); - ISADeviceInfo *info = DO_UPCAST(ISADeviceInfo, qdev, base); + ISADevice *dev = ISA_DEVICE(qdev); + ISADeviceClass *klass = ISA_DEVICE_GET_CLASS(dev); dev->isairq[0] = -1; dev->isairq[1] = -1; - return info->init(dev); + if (klass->init) { + return klass->init(dev); + } + + return 0; } -void isa_qdev_register(ISADeviceInfo *info) +void isa_qdev_register(DeviceInfo *info) { - info->qdev.init = isa_qdev_init; - info->qdev.bus_info = &isa_bus_info; - qdev_register(&info->qdev); + info->init = isa_qdev_init; + info->bus_info = &isa_bus_info; + qdev_register_subclass(info, TYPE_ISA_DEVICE); } ISADevice *isa_create(ISABus *bus, const char *name) @@ -137,7 +141,7 @@ ISADevice *isa_create(ISABus *bus, const char *name) name); } dev = qdev_create(&bus->qbus, name); - return DO_UPCAST(ISADevice, qdev, dev); + return ISA_DEVICE(dev); } ISADevice *isa_try_create(ISABus *bus, const char *name) @@ -149,7 +153,7 @@ ISADevice *isa_try_create(ISABus *bus, const char *name) name); } dev = qdev_try_create(&bus->qbus, name); - return DO_UPCAST(ISADevice, qdev, dev); + return ISA_DEVICE(dev); } ISADevice *isa_create_simple(ISABus *bus, const char *name) @@ -163,7 +167,7 @@ ISADevice *isa_create_simple(ISABus *bus, const char *name) static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent) { - ISADevice *d = DO_UPCAST(ISADevice, qdev, dev); + ISADevice *d = ISA_DEVICE(dev); if (d->isairq[1] != -1) { monitor_printf(mon, "%*sisa irqs %d,%d\n", indent, "", @@ -188,9 +192,18 @@ static SysBusDeviceInfo isabus_bridge_info = { .qdev.no_user = 1, }; +static TypeInfo isa_device_type_info = { + .name = TYPE_ISA_DEVICE, + .parent = TYPE_DEVICE, + .instance_size = sizeof(ISADevice), + .abstract = true, + .class_size = sizeof(ISADeviceClass), +}; + static void isabus_register_devices(void) { sysbus_register_withprop(&isabus_bridge_info); + type_register_static(&isa_device_type_info); } static char *isabus_get_fw_dev_path(DeviceState *dev) diff --git a/hw/isa.h b/hw/isa.h index b11a0be..a6e1d7e 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -10,7 +10,19 @@ #define ISA_NUM_IRQS 16 typedef struct ISADevice ISADevice; -typedef struct ISADeviceInfo ISADeviceInfo; + +#define TYPE_ISA_DEVICE "isa-device" +#define ISA_DEVICE(obj) \ + OBJECT_CHECK(ISADevice, (obj), TYPE_ISA_DEVICE) +#define ISA_DEVICE_CLASS(klass) \ + OBJECT_CLASS_CHECK(ISADeviceClass, (klass), TYPE_ISA_DEVICE) +#define ISA_DEVICE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(ISADeviceClass, (obj), TYPE_ISA_DEVICE) + +typedef struct ISADeviceClass { + DeviceClass parent_class; + int (*init)(ISADevice *dev); +} ISADeviceClass; struct ISABus { BusState qbus; @@ -25,17 +37,11 @@ struct ISADevice { int ioport_id; }; -typedef int (*isa_qdev_initfn)(ISADevice *dev); -struct ISADeviceInfo { - DeviceInfo qdev; - isa_qdev_initfn init; -}; - ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io); void isa_bus_irqs(ISABus *bus, qemu_irq *irqs); qemu_irq isa_get_irq(ISADevice *dev, int isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); -void isa_qdev_register(ISADeviceInfo *info); +void isa_qdev_register(DeviceInfo *info); MemoryRegion *isa_address_space(ISADevice *dev); ISADevice *isa_create(ISABus *bus, const char *name); ISADevice *isa_try_create(ISABus *bus, const char *name); diff --git a/hw/m48t59.c b/hw/m48t59.c index c043996..5912cd6 100644 --- a/hw/m48t59.c +++ b/hw/m48t59.c @@ -720,13 +720,19 @@ static int m48t59_init1(SysBusDevice *dev) return 0; } -static ISADeviceInfo m48t59_isa_info = { - .init = m48t59_init_isa1, - .qdev.name = "m48t59_isa", - .qdev.size = sizeof(M48t59ISAState), - .qdev.reset = m48t59_reset_isa, - .qdev.no_user = 1, - .qdev.props = (Property[]) { +static void m48t59_init_class_isa1(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = m48t59_init_isa1; +} + +static DeviceInfo m48t59_isa_info = { + .class_init = m48t59_init_class_isa1, + .name = "m48t59_isa", + .size = sizeof(M48t59ISAState), + .reset = m48t59_reset_isa, + .no_user = 1, + .props = (Property[]) { DEFINE_PROP_UINT32("size", M48t59ISAState, state.size, -1), DEFINE_PROP_UINT32("type", M48t59ISAState, state.type, -1), DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base, 0), diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 9cbd052..1437375 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -624,7 +624,7 @@ static void visit_type_int32(Visitor *v, int *value, const char *name, Error **e static void rtc_get_date(DeviceState *dev, Visitor *v, void *opaque, const char *name, Error **errp) { - ISADevice *isa = DO_UPCAST(ISADevice, qdev, dev); + ISADevice *isa = ISA_DEVICE(dev); RTCState *s = DO_UPCAST(RTCState, dev, isa); visit_start_struct(v, NULL, "struct tm", name, 0, errp); @@ -694,13 +694,19 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) return dev; } -static ISADeviceInfo mc146818rtc_info = { - .qdev.name = "mc146818rtc", - .qdev.size = sizeof(RTCState), - .qdev.no_user = 1, - .qdev.vmsd = &vmstate_rtc, - .init = rtc_initfn, - .qdev.props = (Property[]) { +static void rtc_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = rtc_initfn; +} + +static DeviceInfo mc146818rtc_info = { + .name = "mc146818rtc", + .size = sizeof(RTCState), + .no_user = 1, + .vmsd = &vmstate_rtc, + .class_init = rtc_class_initfn, + .props = (Property[]) { DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980), DEFINE_PROP_END_OF_LIST(), } diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c index 5bc5f2a..25a7a31 100644 --- a/hw/ne2000-isa.c +++ b/hw/ne2000-isa.c @@ -82,11 +82,17 @@ static int isa_ne2000_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo ne2000_isa_info = { - .qdev.name = "ne2k_isa", - .qdev.size = sizeof(ISANE2000State), - .init = isa_ne2000_initfn, - .qdev.props = (Property[]) { +static void isa_ne2000_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = isa_ne2000_initfn; +} + +static DeviceInfo ne2000_isa_info = { + .name = "ne2k_isa", + .size = sizeof(ISANE2000State), + .class_init = isa_ne2000_class_initfn, + .props = (Property[]) { DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300), DEFINE_PROP_UINT32("irq", ISANE2000State, isairq, 9), DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c), diff --git a/hw/parallel.c b/hw/parallel.c index c4c5dbe..cadcffb 100644 --- a/hw/parallel.c +++ b/hw/parallel.c @@ -583,11 +583,17 @@ bool parallel_mm_init(MemoryRegion *address_space, return true; } -static ISADeviceInfo parallel_isa_info = { - .qdev.name = "isa-parallel", - .qdev.size = sizeof(ISAParallelState), - .init = parallel_isa_initfn, - .qdev.props = (Property[]) { +static void parallel_isa_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = parallel_isa_initfn; +} + +static DeviceInfo parallel_isa_info = { + .name = "isa-parallel", + .size = sizeof(ISAParallelState), + .class_init = parallel_isa_class_initfn, + .props = (Property[]) { DEFINE_PROP_UINT32("index", ISAParallelState, index, -1), DEFINE_PROP_HEX32("iobase", ISAParallelState, iobase, -1), DEFINE_PROP_UINT32("irq", ISAParallelState, isairq, 7), diff --git a/hw/pc.c b/hw/pc.c index f51afa8..a9df616 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -496,13 +496,19 @@ static int port92_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo port92_info = { - .qdev.name = "port92", - .qdev.size = sizeof(Port92State), - .qdev.vmsd = &vmstate_port92_isa, - .qdev.no_user = 1, - .qdev.reset = port92_reset, - .init = port92_initfn, +static void port92_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = port92_initfn; +} + +static DeviceInfo port92_info = { + .name = "port92", + .size = sizeof(Port92State), + .vmsd = &vmstate_port92_isa, + .no_user = 1, + .reset = port92_reset, + .class_init = port92_class_initfn, }; static void port92_register(void) diff --git a/hw/pckbd.c b/hw/pckbd.c index 06b40c5..2ebe1c5 100644 --- a/hw/pckbd.c +++ b/hw/pckbd.c @@ -497,12 +497,18 @@ static int i8042_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo i8042_info = { - .qdev.name = "i8042", - .qdev.size = sizeof(ISAKBDState), - .qdev.vmsd = &vmstate_kbd_isa, - .qdev.no_user = 1, - .init = i8042_initfn, +static void i8042_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = i8042_initfn; +} + +static DeviceInfo i8042_info = { + .name = "i8042", + .size = sizeof(ISAKBDState), + .vmsd = &vmstate_kbd_isa, + .no_user = 1, + .class_init = i8042_class_initfn, }; static void i8042_register(void) diff --git a/hw/sb16.c b/hw/sb16.c index 887b32e..67357ce 100644 --- a/hw/sb16.c +++ b/hw/sb16.c @@ -1391,13 +1391,19 @@ int SB16_init (ISABus *bus) return 0; } -static ISADeviceInfo sb16_info = { - .qdev.name = "sb16", - .qdev.desc = "Creative Sound Blaster 16", - .qdev.size = sizeof (SB16State), - .qdev.vmsd = &vmstate_sb16, - .init = sb16_initfn, - .qdev.props = (Property[]) { +static void sb16_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = sb16_initfn; +} + +static DeviceInfo sb16_info = { + .name = "sb16", + .desc = "Creative Sound Blaster 16", + .size = sizeof (SB16State), + .vmsd = &vmstate_sb16, + .class_init = sb16_class_initfn, + .props = (Property[]) { DEFINE_PROP_HEX32 ("version", SB16State, ver, 0x0405), /* 4.5 */ DEFINE_PROP_HEX32 ("iobase", SB16State, port, 0x220), DEFINE_PROP_UINT32 ("irq", SB16State, irq, 5), diff --git a/hw/serial.c b/hw/serial.c index d35c7a9..2644b13 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -879,12 +879,18 @@ SerialState *serial_mm_init(MemoryRegion *address_space, return s; } -static ISADeviceInfo serial_isa_info = { - .qdev.name = "isa-serial", - .qdev.size = sizeof(ISASerialState), - .qdev.vmsd = &vmstate_isa_serial, - .init = serial_isa_initfn, - .qdev.props = (Property[]) { +static void serial_isa_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = serial_isa_initfn; +} + +static DeviceInfo serial_isa_info = { + .name = "isa-serial", + .size = sizeof(ISASerialState), + .vmsd = &vmstate_isa_serial, + .class_init = serial_isa_class_initfn, + .props = (Property[]) { DEFINE_PROP_UINT32("index", ISASerialState, index, -1), DEFINE_PROP_HEX32("iobase", ISASerialState, iobase, -1), DEFINE_PROP_UINT32("irq", ISASerialState, isairq, -1), diff --git a/hw/sga.c b/hw/sga.c index 7ef750a..07ed2d0 100644 --- a/hw/sga.c +++ b/hw/sga.c @@ -41,11 +41,17 @@ static int isa_cirrus_vga_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo sga_info = { - .qdev.name = "sga", - .qdev.desc = "Serial Graphics Adapter", - .qdev.size = sizeof(ISASGAState), - .init = isa_cirrus_vga_initfn, +static void isa_cirrus_vga_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = isa_cirrus_vga_initfn; +} + +static DeviceInfo sga_info = { + .name = "sga", + .desc = "Serial Graphics Adapter", + .size = sizeof(ISASGAState), + .class_init = isa_cirrus_vga_class_initfn, }; static void sga_register(void) diff --git a/hw/vga-isa.c b/hw/vga-isa.c index 4825313..cb6af91 100644 --- a/hw/vga-isa.c +++ b/hw/vga-isa.c @@ -69,12 +69,18 @@ static int vga_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo vga_info = { - .qdev.name = "isa-vga", - .qdev.size = sizeof(ISAVGAState), - .qdev.vmsd = &vmstate_vga_common, - .qdev.reset = vga_reset_isa, - .init = vga_initfn, +static void vga_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = vga_initfn; +} + +static DeviceInfo vga_info = { + .name = "isa-vga", + .size = sizeof(ISAVGAState), + .vmsd = &vmstate_vga_common, + .reset = vga_reset_isa, + .class_init = vga_class_initfn, }; static void vga_register(void) diff --git a/hw/vmmouse.c b/hw/vmmouse.c index 1113f33..da2ea32 100644 --- a/hw/vmmouse.c +++ b/hw/vmmouse.c @@ -269,14 +269,20 @@ static int vmmouse_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo vmmouse_info = { - .init = vmmouse_initfn, - .qdev.name = "vmmouse", - .qdev.size = sizeof(VMMouseState), - .qdev.vmsd = &vmstate_vmmouse, - .qdev.no_user = 1, - .qdev.reset = vmmouse_reset, - .qdev.props = (Property[]) { +static void vmmouse_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = vmmouse_initfn; +} + +static DeviceInfo vmmouse_info = { + .class_init = vmmouse_class_initfn, + .name = "vmmouse", + .size = sizeof(VMMouseState), + .vmsd = &vmstate_vmmouse, + .no_user = 1, + .reset = vmmouse_reset, + .props = (Property[]) { DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse), DEFINE_PROP_END_OF_LIST(), } diff --git a/hw/vmport.c b/hw/vmport.c index 0a3dbc5..c4582d6 100644 --- a/hw/vmport.c +++ b/hw/vmport.c @@ -144,11 +144,17 @@ static int vmport_initfn(ISADevice *dev) return 0; } -static ISADeviceInfo vmport_info = { - .qdev.name = "vmport", - .qdev.size = sizeof(VMPortState), - .qdev.no_user = 1, - .init = vmport_initfn, +static void vmport_class_initfn(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = vmport_initfn; +} + +static DeviceInfo vmport_info = { + .name = "vmport", + .size = sizeof(VMPortState), + .no_user = 1, + .class_init = vmport_class_initfn, }; static void vmport_dev_register(void) diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c index ba1d92d..6deb0de 100644 --- a/hw/wdt_ib700.c +++ b/hw/wdt_ib700.c @@ -120,12 +120,18 @@ static WatchdogTimerModel model = { .wdt_description = "iBASE 700", }; -static ISADeviceInfo wdt_ib700_info = { - .qdev.name = "ib700", - .qdev.size = sizeof(IB700State), - .qdev.vmsd = &vmstate_ib700, - .qdev.reset = wdt_ib700_reset, - .init = wdt_ib700_init, +static void wdt_ib700_class_init(ObjectClass *klass, void *data) +{ + ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); + ic->init = wdt_ib700_init; +} + +static DeviceInfo wdt_ib700_info = { + .name = "ib700", + .size = sizeof(IB700State), + .vmsd = &vmstate_ib700, + .reset = wdt_ib700_reset, + .class_init = wdt_ib700_class_init, }; static void wdt_ib700_register_devices(void) -- 1.7.4.1