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),
return 0;
}
-static ISADeviceInfo isa_cirrus_vga_info = {
- .qdev.name = "isa-cirrus-vga",
- .qdev.size = sizeof(ISACirrusVGAState),
- .qdev.vmsd = &vmstate_cirrus_vga,
- .init = vga_initfn,
+static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data)
+{
+ ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
+
+ k->init = vga_initfn;
+}
+
+static DeviceInfo isa_cirrus_vga_info = {
+ .name = "isa-cirrus-vga",
+ .size = sizeof(ISACirrusVGAState),
+ .vmsd = &vmstate_cirrus_vga,
+ .class_init = isa_cirrus_vga_class_init,
};
static void isa_cirrus_vga_register(void)
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),
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),
}
};
-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),
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),
return 0;
}
-static ISADeviceInfo i82374_isa_info = {
- .qdev.name = "i82374",
- .qdev.size = sizeof(ISAi82374State),
- .qdev.vmsd = &vmstate_isa_i82374,
- .init = i82374_isa_init,
- .qdev.props = (Property[]) {
+static void i82374_class_init(ObjectClass *klass, void *data)
+{
+ ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
+
+ k->init = i82374_isa_init;
+}
+
+static DeviceInfo i82374_isa_info = {
+ .name = "i82374",
+ .size = sizeof(ISAi82374State),
+ .vmsd = &vmstate_isa_i82374,
+ .class_init = i82374_class_init,
+ .props = (Property[]) {
DEFINE_PROP_HEX32("iobase", ISAi82374State, iobase, 0x400),
DEFINE_PROP_END_OF_LIST()
},
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(),
return irq_set;
}
-static PICCommonInfo i8259_info = {
- .isadev.qdev.name = "isa-i8259",
- .isadev.qdev.reset = pic_reset,
- .init = pic_init,
+static void i8259_class_init(ObjectClass *klass, void *data)
+{
+ PICCommonClass *k = PIC_COMMON_CLASS(klass);
+
+ k->init = pic_init;
+}
+
+static DeviceInfo i8259_info = {
+ .name = "isa-i8259",
+ .reset = pic_reset,
+ .class_init = i8259_class_init,
};
static void pic_register(void)
static void pic_dispatch_pre_save(void *opaque)
{
PICCommonState *s = opaque;
- PICCommonInfo *info =
- DO_UPCAST(PICCommonInfo, isadev.qdev, qdev_get_info(&s->dev.qdev));
+ PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
if (info->pre_save) {
info->pre_save(s);
static int pic_dispatch_post_load(void *opaque, int version_id)
{
PICCommonState *s = opaque;
- PICCommonInfo *info =
- DO_UPCAST(PICCommonInfo, isadev.qdev, qdev_get_info(&s->dev.qdev));
+ PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
if (info->post_load) {
info->post_load(s);
static int pic_init_common(ISADevice *dev)
{
PICCommonState *s = DO_UPCAST(PICCommonState, dev, dev);
- PICCommonInfo *info =
- DO_UPCAST(PICCommonInfo, isadev.qdev, qdev_get_info(&dev->qdev));
+ PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
info->init(s);
DEFINE_PROP_END_OF_LIST(),
};
-void pic_qdev_register(PICCommonInfo *info)
+void pic_qdev_register(DeviceInfo *info)
{
- info->isadev.init = pic_init_common;
- info->isadev.qdev.size = sizeof(PICCommonState);
- info->isadev.qdev.vmsd = &vmstate_pic_common;
- info->isadev.qdev.no_user = 1;
- info->isadev.qdev.props = pic_properties_common;
- isa_qdev_register(&info->isadev);
+ info->size = sizeof(PICCommonState);
+ info->vmsd = &vmstate_pic_common;
+ info->no_user = 1;
+ info->props = pic_properties_common;
+ isa_qdev_register_subclass(info, TYPE_PIC_COMMON);
}
+
+static void pic_common_class_init(ObjectClass *klass, void *data)
+{
+ ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+
+ ic->init = pic_init_common;
+}
+
+static TypeInfo pic_common_type = {
+ .name = TYPE_PIC_COMMON,
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(PICCommonState),
+ .class_size = sizeof(PICCommonClass),
+ .class_init = pic_common_class_init,
+ .abstract = true,
+};
+
+static void register_devices(void)
+{
+ type_register_static(&pic_common_type);
+}
+
+device_init(register_devices);
typedef struct PICCommonState PICCommonState;
+#define TYPE_PIC_COMMON "pic-common"
+#define PIC_COMMON(obj) \
+ OBJECT_CHECK(PICCommon, (obj), TYPE_PIC_COMMON)
+#define PIC_COMMON_CLASS(klass) \
+ OBJECT_CLASS_CHECK(PICCommonClass, (klass), TYPE_PIC_COMMON)
+#define PIC_COMMON_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(PICCommonClass, (obj), TYPE_PIC_COMMON)
+
+typedef struct PICCommonClass
+{
+ ISADeviceClass parent_class;
+ void (*init)(PICCommonState *s);
+ void (*pre_save)(PICCommonState *s);
+ void (*post_load)(PICCommonState *s);
+} PICCommonClass;
+
struct PICCommonState {
ISADevice dev;
uint8_t last_irr; /* edge detection */
MemoryRegion elcr_io;
};
-typedef struct PICCommonInfo PICCommonInfo;
-
-struct PICCommonInfo {
- ISADeviceInfo isadev;
- void (*init)(PICCommonState *s);
- void (*pre_save)(PICCommonState *s);
- void (*post_load)(PICCommonState *s);
-};
-
void pic_reset_common(PICCommonState *s);
ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master);
-void pic_qdev_register(PICCommonInfo *info);
+void pic_qdev_register(DeviceInfo *info);
#endif /* !QEMU_I8259_INTERNAL_H */
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),
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_subclass(DeviceInfo *info, const char *parent)
+{
+ info->init = isa_qdev_init;
+ info->bus_info = &isa_bus_info;
+ qdev_register_subclass(info, parent);
}
-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);
+ isa_qdev_register_subclass(info, TYPE_ISA_DEVICE);
}
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)
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)
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, "",
.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)
#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;
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);
+void isa_qdev_register_subclass(DeviceInfo *info, const char *parent);
MemoryRegion *isa_address_space(ISADevice *dev);
ISADevice *isa_create(ISABus *bus, const char *name);
ISADevice *isa_try_create(ISABus *bus, const char *name);
return qemu_allocate_irqs(kvm_pic_set_irq, NULL, ISA_NUM_IRQS);
}
-static PICCommonInfo kvm_i8259_info = {
- .isadev.qdev.name = "kvm-i8259",
- .isadev.qdev.reset = kvm_pic_reset,
- .init = kvm_pic_init,
- .pre_save = kvm_pic_get,
- .post_load = kvm_pic_put,
+static void kvm_i8259_class_init(ObjectClass *klass, void *data)
+{
+ PICCommonClass *k = PIC_COMMON_CLASS(klass);
+
+ k->init = kvm_pic_init;
+ k->pre_save = kvm_pic_get;
+ k->post_load = kvm_pic_put;
+}
+
+static DeviceInfo kvm_i8259_info = {
+ .name = "kvm-i8259",
+ .reset = kvm_pic_reset,
+ .class_init = kvm_i8259_class_init,
};
static void kvm_pic_register(void)
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),
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);
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(),
}
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),
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),
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)
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)
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),
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),
rom_add_vga(SGABIOS_FILENAME);
return 0;
}
+static void sga_class_initfn(ObjectClass *klass, void *data)
+{
+ ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ ic->init = sga_initfn;
+}
-static ISADeviceInfo sga_info = {
- .qdev.name = "sga",
- .qdev.desc = "Serial Graphics Adapter",
- .qdev.size = sizeof(ISASGAState),
- .init = sga_initfn,
+static DeviceInfo sga_info = {
+ .name = "sga",
+ .desc = "Serial Graphics Adapter",
+ .size = sizeof(ISASGAState),
+ .class_init = sga_class_initfn,
};
static void sga_register(void)
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)
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(),
}
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)
.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)