aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-07 21:34:16 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-03 10:41:06 -0600
commit39bffca2030950ef6efe57c2fac8327a45ae1015 (patch)
tree325262f44978e6116c9e43f688c900e08ee83738
parent212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff)
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/9pfs/virtio-9p-device.c16
-rw-r--r--hw/a9mpcore.c40
-rw-r--r--hw/ac97.c18
-rw-r--r--hw/acpi_piix4.c20
-rw-r--r--hw/ads7846.c11
-rw-r--r--hw/alpha_typhoon.c14
-rw-r--r--hw/apb_pci.c41
-rw-r--r--hw/apic.c10
-rw-r--r--hw/apic_common.c15
-rw-r--r--hw/apic_internal.h1
-rw-r--r--hw/applesmc.c28
-rw-r--r--hw/arm11mpcore.c28
-rw-r--r--hw/arm_l2x0.c24
-rw-r--r--hw/arm_mptimer.c28
-rw-r--r--hw/arm_sysctl.c18
-rw-r--r--hw/arm_timer.c35
-rw-r--r--hw/armv7m.c14
-rw-r--r--hw/armv7m_nvic.c32
-rw-r--r--hw/bitbang_i2c.c14
-rw-r--r--hw/bonito.c32
-rw-r--r--hw/ccid-card-emulated.c35
-rw-r--r--hw/ccid-card-passthru.c28
-rw-r--r--hw/ccid.h1
-rw-r--r--hw/cirrus_vga.c30
-rw-r--r--hw/container.c14
-rw-r--r--hw/cs4231.c18
-rw-r--r--hw/cs4231a.c30
-rw-r--r--hw/debugcon.c26
-rw-r--r--hw/dec_pci.c40
-rw-r--r--hw/ds1225y.c16
-rw-r--r--hw/ds1338.c11
-rw-r--r--hw/e1000.c20
-rw-r--r--hw/eccmemctl.c18
-rw-r--r--hw/eepro100.c83
-rw-r--r--hw/empty_slot.c11
-rw-r--r--hw/es1370.c16
-rw-r--r--hw/escc.c18
-rw-r--r--hw/esp.c18
-rw-r--r--hw/etraxfs_eth.c14
-rw-r--r--hw/etraxfs_pic.c14
-rw-r--r--hw/etraxfs_ser.c14
-rw-r--r--hw/etraxfs_timer.c11
-rw-r--r--hw/fdc.c76
-rw-r--r--hw/fw_cfg.c20
-rw-r--r--hw/g364fb.c20
-rw-r--r--hw/grackle_pci.c26
-rw-r--r--hw/grlib_apbuart.c14
-rw-r--r--hw/grlib_gptimer.c16
-rw-r--r--hw/grlib_irqmp.c16
-rw-r--r--hw/gt64xxx.c22
-rw-r--r--hw/gus.c32
-rw-r--r--hw/hda-audio.c36
-rw-r--r--hw/highbank.c18
-rw-r--r--hw/hpet.c20
-rw-r--r--hw/i2c.c21
-rw-r--r--hw/i2c.h3
-rw-r--r--hw/i82374.c22
-rw-r--r--hw/i82378.c22
-rw-r--r--hw/i8254.c30
-rw-r--r--hw/i8259.c11
-rw-r--r--hw/i8259_common.c13
-rw-r--r--hw/i8259_internal.h1
-rw-r--r--hw/ide/ahci.c24
-rw-r--r--hw/ide/cmd646.c14
-rw-r--r--hw/ide/ich.c17
-rw-r--r--hw/ide/isa.c30
-rw-r--r--hw/ide/piix.c44
-rw-r--r--hw/ide/qdev.c93
-rw-r--r--hw/ide/via.c14
-rw-r--r--hw/integratorcp.c25
-rw-r--r--hw/intel-hda.c37
-rw-r--r--hw/intel-hda.h1
-rw-r--r--hw/ioapic.c14
-rw-r--r--hw/ioapic_common.c10
-rw-r--r--hw/ioapic_internal.h1
-rw-r--r--hw/ioh3420.c20
-rw-r--r--hw/isa-bus.c36
-rw-r--r--hw/isa.h2
-rw-r--r--hw/ivshmem.c16
-rw-r--r--hw/kvm/apic.c5
-rw-r--r--hw/kvm/clock.c16
-rw-r--r--hw/kvm/i8259.c8
-rw-r--r--hw/kvm/ioapic.c20
-rw-r--r--hw/lan9118.c18
-rw-r--r--hw/lance.c20
-rw-r--r--hw/lm32_juart.c16
-rw-r--r--hw/lm32_pic.c16
-rw-r--r--hw/lm32_sys.c18
-rw-r--r--hw/lm32_timer.c18
-rw-r--r--hw/lm32_uart.c16
-rw-r--r--hw/lm832x.c14
-rw-r--r--hw/lsi53c895a.c19
-rw-r--r--hw/m48t59.c46
-rw-r--r--hw/macio.c11
-rw-r--r--hw/marvell_88w8618_audio.c18
-rw-r--r--hw/max111x.c22
-rw-r--r--hw/max7310.c16
-rw-r--r--hw/mc146818rtc.c30
-rw-r--r--hw/milkymist-ac97.c16
-rw-r--r--hw/milkymist-hpdmc.c16
-rw-r--r--hw/milkymist-memcard.c16
-rw-r--r--hw/milkymist-minimac2.c18
-rw-r--r--hw/milkymist-pfpu.c16
-rw-r--r--hw/milkymist-softusb.c18
-rw-r--r--hw/milkymist-sysctl.c18
-rw-r--r--hw/milkymist-tmu2.c16
-rw-r--r--hw/milkymist-uart.c16
-rw-r--r--hw/milkymist-vgafb.c18
-rw-r--r--hw/mips_malta.c14
-rw-r--r--hw/mipsnet.c20
-rw-r--r--hw/mpc8544_guts.c11
-rw-r--r--hw/mst_fpga.c16
-rw-r--r--hw/musicpal.c117
-rw-r--r--hw/nand.c18
-rw-r--r--hw/ne2000-isa.c26
-rw-r--r--hw/ne2000.c16
-rw-r--r--hw/omap_gpio.c32
-rw-r--r--hw/omap_intc.c32
-rw-r--r--hw/onenand.c16
-rw-r--r--hw/opencores_eth.c18
-rw-r--r--hw/parallel.c28
-rw-r--r--hw/pc.c18
-rw-r--r--hw/pci.c21
-rw-r--r--hw/pci.h2
-rw-r--r--hw/pckbd.c16
-rw-r--r--hw/pcnet-pci.c18
-rw-r--r--hw/piix4.c18
-rw-r--r--hw/piix_pci.c70
-rw-r--r--hw/pl011.c22
-rw-r--r--hw/pl022.c11
-rw-r--r--hw/pl031.c16
-rw-r--r--hw/pl041.c20
-rw-r--r--hw/pl050.c28
-rw-r--r--hw/pl061.c28
-rw-r--r--hw/pl080.c32
-rw-r--r--hw/pl110.c48
-rw-r--r--hw/pl181.c18
-rw-r--r--hw/pl190.c18
-rw-r--r--hw/ppc4xx_pci.c28
-rw-r--r--hw/ppc_prep.c2
-rw-r--r--hw/ppce500_pci.c28
-rw-r--r--hw/ppce500_spin.c11
-rw-r--r--hw/prep_pci.c26
-rw-r--r--hw/pxa2xx.c56
-rw-r--r--hw/pxa2xx_dma.c18
-rw-r--r--hw/pxa2xx_gpio.c16
-rw-r--r--hw/pxa2xx_pic.c16
-rw-r--r--hw/pxa2xx_timer.c36
-rw-r--r--hw/qdev.h1
-rw-r--r--hw/qxl.c40
-rw-r--r--hw/realview.c11
-rw-r--r--hw/realview_gic.c11
-rw-r--r--hw/rtl8139.c18
-rw-r--r--hw/s390-virtio-bus.c138
-rw-r--r--hw/s390-virtio-bus.h19
-rw-r--r--hw/sb16.c34
-rw-r--r--hw/sbi.c16
-rw-r--r--hw/scsi-bus.c19
-rw-r--r--hw/scsi-disk.c116
-rw-r--r--hw/scsi-generic.c28
-rw-r--r--hw/scsi.h1
-rw-r--r--hw/serial.c30
-rw-r--r--hw/sga.c14
-rw-r--r--hw/sh_pci.c22
-rw-r--r--hw/slavio_intctl.c16
-rw-r--r--hw/slavio_misc.c27
-rw-r--r--hw/slavio_timer.c18
-rw-r--r--hw/smbus.c6
-rw-r--r--hw/smbus.h2
-rw-r--r--hw/smbus_eeprom.c22
-rw-r--r--hw/smc91c111.c18
-rw-r--r--hw/spapr_llan.c14
-rw-r--r--hw/spapr_pci.c22
-rw-r--r--hw/spapr_vio.c35
-rw-r--r--hw/spapr_vio.h1
-rw-r--r--hw/spapr_vscsi.c14
-rw-r--r--hw/spapr_vty.c14
-rw-r--r--hw/sparc32_dma.c18
-rw-r--r--hw/spitz.c60
-rw-r--r--hw/ssd0303.c14
-rw-r--r--hw/ssd0323.c11
-rw-r--r--hw/ssi-sd.c11
-rw-r--r--hw/ssi.c24
-rw-r--r--hw/ssi.h2
-rw-r--r--hw/stellaris.c44
-rw-r--r--hw/stellaris_enet.c14
-rw-r--r--hw/strongarm.c98
-rw-r--r--hw/sun4c_intctl.c16
-rw-r--r--hw/sun4m.c50
-rw-r--r--hw/sun4m_iommu.c18
-rw-r--r--hw/sun4u.c39
-rw-r--r--hw/sysbus.c22
-rw-r--r--hw/sysbus.h4
-rw-r--r--hw/tcx.c18
-rw-r--r--hw/tmp105.c14
-rw-r--r--hw/tosa.c24
-rw-r--r--hw/tusb6010.c14
-rw-r--r--hw/twl92230.c14
-rw-r--r--hw/unin_pci.c74
-rw-r--r--hw/usb-audio.c28
-rw-r--r--hw/usb-bt.c14
-rw-r--r--hw/usb-bus.c19
-rw-r--r--hw/usb-ccid.c43
-rw-r--r--hw/usb-ehci.c32
-rw-r--r--hw/usb-hid.c42
-rw-r--r--hw/usb-hub.c18
-rw-r--r--hw/usb-msd.c30
-rw-r--r--hw/usb-net.c26
-rw-r--r--hw/usb-ohci.c42
-rw-r--r--hw/usb-serial.c48
-rw-r--r--hw/usb-uhci.c96
-rw-r--r--hw/usb-wacom.c20
-rw-r--r--hw/usb-xhci.c25
-rw-r--r--hw/usb.h1
-rw-r--r--hw/versatile_pci.c33
-rw-r--r--hw/versatilepb.c16
-rw-r--r--hw/vga-isa.c16
-rw-r--r--hw/vga-pci.c14
-rw-r--r--hw/virtio-console.c28
-rw-r--r--hw/virtio-pci.c76
-rw-r--r--hw/virtio-serial-bus.c19
-rw-r--r--hw/virtio-serial.h6
-rw-r--r--hw/vmmouse.c28
-rw-r--r--hw/vmport.c14
-rw-r--r--hw/vmware_vga.c16
-rw-r--r--hw/vt82c686.c64
-rw-r--r--hw/wdt_i6300esb.c16
-rw-r--r--hw/wdt_ib700.c16
-rw-r--r--hw/wm8750.c14
-rw-r--r--hw/xen_platform.c18
-rw-r--r--hw/xgmac.c25
-rw-r--r--hw/xilinx_axidma.c14
-rw-r--r--hw/xilinx_axienet.c14
-rw-r--r--hw/xilinx_ethlite.c14
-rw-r--r--hw/xilinx_intc.c14
-rw-r--r--hw/xilinx_timer.c14
-rw-r--r--hw/xilinx_uartlite.c11
-rw-r--r--hw/xio3130_downstream.c20
-rw-r--r--hw/xio3130_upstream.c20
-rw-r--r--hw/z2.c28
-rw-r--r--hw/zaurus.c18
-rw-r--r--include/qemu/object.h2
-rw-r--r--usb-linux.c34
243 files changed, 3172 insertions, 2546 deletions
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index aded048e76..3f15540c5f 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -174,6 +174,7 @@ static Property virtio_9p_properties[] = {
static void virtio_9p_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = virtio_9p_init_pci;
@@ -181,19 +182,20 @@ static void virtio_9p_class_init(ObjectClass *klass, void *data)
k->device_id = 0x1009;
k->revision = VIRTIO_PCI_ABI_VERSION;
k->class_id = 0x2;
+ dc->props = virtio_9p_properties;
+ dc->reset = virtio_pci_reset;
}
-static DeviceInfo virtio_9p_info = {
- .name = "virtio-9p-pci",
- .size = sizeof(VirtIOPCIProxy),
- .props = virtio_9p_properties,
- .class_init = virtio_9p_class_init,
- .reset = virtio_pci_reset,
+static TypeInfo virtio_9p_info = {
+ .name = "virtio-9p-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VirtIOPCIProxy),
+ .class_init = virtio_9p_class_init,
};
static void virtio_9p_register_devices(void)
{
- pci_qdev_register(&virtio_9p_info);
+ type_register_static(&virtio_9p_info);
virtio_9p_set_fd_limit();
}
diff --git a/hw/a9mpcore.c b/hw/a9mpcore.c
index b42c475077..19de12b4b4 100644
--- a/hw/a9mpcore.c
+++ b/hw/a9mpcore.c
@@ -208,35 +208,39 @@ static const VMStateDescription vmstate_a9mp_priv = {
}
};
+static Property a9mp_priv_properties[] = {
+ DEFINE_PROP_UINT32("num-cpu", a9mp_priv_state, num_cpu, 1),
+ /* The Cortex-A9MP may have anything from 0 to 224 external interrupt
+ * IRQ lines (with another 32 internal). We default to 64+32, which
+ * is the number provided by the Cortex-A9MP test chip in the
+ * Realview PBX-A9 and Versatile Express A9 development boards.
+ * Other boards may differ and should set this property appropriately.
+ */
+ DEFINE_PROP_UINT32("num-irq", a9mp_priv_state, num_irq, 96),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void a9mp_priv_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = a9mp_priv_init;
+ dc->props = a9mp_priv_properties;
+ dc->vmsd = &vmstate_a9mp_priv;
+ dc->reset = a9mp_priv_reset;
}
-static DeviceInfo a9mp_priv_info = {
- .name = "a9mpcore_priv",
- .size = sizeof(a9mp_priv_state),
- .vmsd = &vmstate_a9mp_priv,
- .reset = a9mp_priv_reset,
- .class_init = a9mp_priv_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("num-cpu", a9mp_priv_state, num_cpu, 1),
- /* The Cortex-A9MP may have anything from 0 to 224 external interrupt
- * IRQ lines (with another 32 internal). We default to 64+32, which
- * is the number provided by the Cortex-A9MP test chip in the
- * Realview PBX-A9 and Versatile Express A9 development boards.
- * Other boards may differ and should set this property appropriately.
- */
- DEFINE_PROP_UINT32("num-irq", a9mp_priv_state, num_irq, 96),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo a9mp_priv_info = {
+ .name = "a9mpcore_priv",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(a9mp_priv_state),
+ .class_init = a9mp_priv_class_init,
};
static void a9mp_register_devices(void)
{
- sysbus_register_withprop(&a9mp_priv_info);
+ type_register_static(&a9mp_priv_info);
}
device_init(a9mp_register_devices)
diff --git a/hw/ac97.c b/hw/ac97.c
index 33b85f5db0..ed2e4cd9ab 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1351,6 +1351,7 @@ static Property ac97_properties[] = {
static void ac97_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = ac97_initfn;
@@ -1359,20 +1360,21 @@ static void ac97_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;
k->revision = 0x01;
k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
+ dc->desc = "Intel 82801AA AC97 Audio";
+ dc->vmsd = &vmstate_ac97;
+ dc->props = ac97_properties;
}
-static DeviceInfo ac97_info = {
- .name = "AC97",
- .desc = "Intel 82801AA AC97 Audio",
- .size = sizeof (AC97LinkState),
- .vmsd = &vmstate_ac97,
- .props = ac97_properties,
- .class_init = ac97_class_init,
+static TypeInfo ac97_info = {
+ .name = "AC97",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof (AC97LinkState),
+ .class_init = ac97_class_init,
};
static void ac97_register (void)
{
- pci_qdev_register (&ac97_info);
+ type_register_static(&ac97_info);
}
device_init (ac97_register);
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 9058a7ce42..21484aec42 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -403,6 +403,7 @@ static Property piix4_pm_properties[] = {
static void piix4_pm_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -412,21 +413,22 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3;
k->revision = 0x03;
k->class_id = PCI_CLASS_BRIDGE_OTHER;
+ dc->desc = "PM";
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_acpi;
+ dc->props = piix4_pm_properties;
}
-static DeviceInfo piix4_pm_info = {
- .name = "PIIX4_PM",
- .desc = "PM",
- .size = sizeof(PIIX4PMState),
- .vmsd = &vmstate_acpi,
- .no_user = 1,
- .props = piix4_pm_properties,
- .class_init = piix4_pm_class_init,
+static TypeInfo piix4_pm_info = {
+ .name = "PIIX4_PM",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PIIX4PMState),
+ .class_init = piix4_pm_class_init,
};
static void piix4_pm_register(void)
{
- pci_qdev_register(&piix4_pm_info);
+ type_register_static(&piix4_pm_info);
}
device_init(piix4_pm_register);
diff --git a/hw/ads7846.c b/hw/ads7846.c
index c1b894e13a..3cfdecbe5c 100644
--- a/hw/ads7846.c
+++ b/hw/ads7846.c
@@ -161,15 +161,16 @@ static void ads7846_class_init(ObjectClass *klass, void *data)
k->transfer = ads7846_transfer;
}
-static DeviceInfo ads7846_info = {
- .name = "ads7846",
- .size = sizeof(ADS7846State),
- .class_init = ads7846_class_init,
+static TypeInfo ads7846_info = {
+ .name = "ads7846",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(ADS7846State),
+ .class_init = ads7846_class_init,
};
static void ads7846_register_devices(void)
{
- ssi_register_slave(&ads7846_info);
+ type_register_static(&ads7846_info);
}
device_init(ads7846_register_devices)
diff --git a/hw/alpha_typhoon.c b/hw/alpha_typhoon.c
index 8a68c7c7e0..736c28a3a9 100644
--- a/hw/alpha_typhoon.c
+++ b/hw/alpha_typhoon.c
@@ -810,20 +810,22 @@ static int typhoon_pcihost_init(SysBusDevice *dev)
static void typhoon_pcihost_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = typhoon_pcihost_init;
+ dc->no_user = 1;
}
-static DeviceInfo typhoon_pcihost_info = {
- .name = "typhoon-pcihost",
- .size = sizeof(TyphoonState),
- .no_user = 1,
- .class_init = typhoon_pcihost_class_init,
+static TypeInfo typhoon_pcihost_info = {
+ .name = "typhoon-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(TyphoonState),
+ .class_init = typhoon_pcihost_class_init,
};
static void typhoon_register(void)
{
- sysbus_register_withprop(&typhoon_pcihost_info);
+ type_register_static(&typhoon_pcihost_info);
}
device_init(typhoon_register);
diff --git a/hw/apb_pci.c b/hw/apb_pci.c
index 1a45420c56..c7aaa72d07 100644
--- a/hw/apb_pci.c
+++ b/hw/apb_pci.c
@@ -447,28 +447,32 @@ static void pbm_pci_host_class_init(ObjectClass *klass, void *data)
k->is_bridge = 1;
}
-static DeviceInfo pbm_pci_host_info = {
- .name = "pbm-pci",
- .size = sizeof(PCIDevice),
- .class_init = pbm_pci_host_class_init,
+static TypeInfo pbm_pci_host_info = {
+ .name = "pbm-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = pbm_pci_host_class_init,
};
static void pbm_host_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pci_pbm_init_device;
+ dc->reset = pci_pbm_reset;
}
-static DeviceInfo pbm_host_info = {
- .name = "pbm",
- .size = sizeof(APBState),
- .reset = pci_pbm_reset,
- .class_init = pbm_host_class_init,
+static TypeInfo pbm_host_info = {
+ .name = "pbm",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(APBState),
+ .class_init = pbm_host_class_init,
};
static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = apb_pci_bridge_initfn;
@@ -478,21 +482,22 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)
k->revision = 0x11;
k->config_write = pci_bridge_write_config;
k->is_bridge = 1;
+ dc->reset = pci_bridge_reset;
+ dc->vmsd = &vmstate_pci_device;
}
-static DeviceInfo pbm_pci_bridge_info = {
- .name = "pbm-bridge",
- .size = sizeof(PCIBridge),
- .vmsd = &vmstate_pci_device,
- .reset = pci_bridge_reset,
- .class_init = pbm_pci_bridge_class_init,
+static TypeInfo pbm_pci_bridge_info = {
+ .name = "pbm-bridge",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIBridge),
+ .class_init = pbm_pci_bridge_class_init,
};
static void pbm_register_devices(void)
{
- sysbus_register_withprop(&pbm_host_info);
- pci_qdev_register(&pbm_pci_host_info);
- pci_qdev_register(&pbm_pci_bridge_info);
+ type_register_static(&pbm_host_info);
+ type_register_static(&pbm_pci_host_info);
+ type_register_static(&pbm_pci_bridge_info);
}
device_init(pbm_register_devices)
diff --git a/hw/apic.c b/hw/apic.c
index 353119d7b0..086c544bf3 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -774,14 +774,16 @@ static void apic_class_init(ObjectClass *klass, void *data)
k->post_load = apic_post_load;
}
-static DeviceInfo apic_info = {
- .name = "apic",
- .class_init = apic_class_init,
+static TypeInfo apic_info = {
+ .name = "apic",
+ .instance_size = sizeof(APICCommonState),
+ .parent = TYPE_APIC_COMMON,
+ .class_init = apic_class_init,
};
static void apic_register_devices(void)
{
- apic_qdev_register(&apic_info);
+ type_register_static(&apic_info);
}
device_init(apic_register_devices)
diff --git a/hw/apic_common.c b/hw/apic_common.c
index 9a3b1c512d..26991b4516 100644
--- a/hw/apic_common.c
+++ b/hw/apic_common.c
@@ -295,7 +295,12 @@ static Property apic_properties_common[] = {
static void apic_common_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->vmsd = &vmstate_apic_common;
+ dc->reset = apic_reset_common;
+ dc->no_user = 1;
+ dc->props = apic_properties_common;
sc->init = apic_init_common;
}
@@ -308,16 +313,6 @@ static TypeInfo apic_common_type = {
.abstract = true,
};
-void apic_qdev_register(DeviceInfo *info)
-{
- info->size = sizeof(APICCommonState),
- info->vmsd = &vmstate_apic_common;
- info->reset = apic_reset_common;
- info->no_user = 1;
- info->props = apic_properties_common;
- sysbus_qdev_register_subclass(info, TYPE_APIC_COMMON);
-}
-
static void register_devices(void)
{
type_register_static(&apic_common_type);
diff --git a/hw/apic_internal.h b/hw/apic_internal.h
index 1c6971cc63..0cab010717 100644
--- a/hw/apic_internal.h
+++ b/hw/apic_internal.h
@@ -117,7 +117,6 @@ struct APICCommonState {
};
void apic_report_irq_delivered(int delivered);
-void apic_qdev_register(DeviceInfo *info);
bool apic_next_timer(APICCommonState *s, int64_t current_time);
#endif /* !QEMU_APIC_INTERNAL_H */
diff --git a/hw/applesmc.c b/hw/applesmc.c
index a6e88bc7b7..b06487f70d 100644
--- a/hw/applesmc.c
+++ b/hw/applesmc.c
@@ -220,28 +220,32 @@ static int applesmc_isa_init(ISADevice *dev)
return 0;
}
+static Property applesmc_isa_properties[] = {
+ DEFINE_PROP_HEX32("iobase", struct AppleSMCStatus, iobase,
+ APPLESMC_DEFAULT_IOBASE),
+ DEFINE_PROP_STRING("osk", struct AppleSMCStatus, osk),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void qdev_applesmc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = applesmc_isa_init;
+ dc->reset = qdev_applesmc_isa_reset;
+ dc->props = applesmc_isa_properties;
}
-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),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo applesmc_isa_info = {
+ .name = "isa-applesmc",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(struct AppleSMCStatus),
+ .class_init = qdev_applesmc_class_init,
};
static void applesmc_register_devices(void)
{
- isa_qdev_register(&applesmc_isa_info);
+ type_register_static(&applesmc_isa_info);
}
device_init(applesmc_register_devices)
diff --git a/hw/arm11mpcore.c b/hw/arm11mpcore.c
index 53c5408d13..3c0839c4b4 100644
--- a/hw/arm11mpcore.c
+++ b/hw/arm11mpcore.c
@@ -217,16 +217,18 @@ static Property mpcore_rirq_properties[] = {
static void mpcore_rirq_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = realview_mpcore_init;
+ dc->props = mpcore_rirq_properties;
}
-static DeviceInfo mpcore_rirq_info = {
- .name = "realview_mpcore",
- .size = sizeof(mpcore_rirq_state),
- .props = mpcore_rirq_properties,
- .class_init = mpcore_rirq_class_init,
+static TypeInfo mpcore_rirq_info = {
+ .name = "realview_mpcore",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mpcore_rirq_state),
+ .class_init = mpcore_rirq_class_init,
};
static Property mpcore_priv_properties[] = {
@@ -236,22 +238,24 @@ static Property mpcore_priv_properties[] = {
static void mpcore_priv_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mpcore_priv_init;
+ dc->props = mpcore_priv_properties;
}
-static DeviceInfo mpcore_priv_info = {
- .name = "arm11mpcore_priv",
- .size = sizeof(mpcore_priv_state),
- .props = mpcore_priv_properties,
- .class_init = mpcore_priv_class_init,
+static TypeInfo mpcore_priv_info = {
+ .name = "arm11mpcore_priv",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mpcore_priv_state),
+ .class_init = mpcore_priv_class_init,
};
static void arm11mpcore_register_devices(void)
{
- sysbus_register_withprop(&mpcore_rirq_info);
- sysbus_register_withprop(&mpcore_priv_info);
+ type_register_static(&mpcore_rirq_info);
+ type_register_static(&mpcore_priv_info);
}
device_init(arm11mpcore_register_devices)
diff --git a/hw/arm_l2x0.c b/hw/arm_l2x0.c
index 7c5fe32fc5..ba26abc6f4 100644
--- a/hw/arm_l2x0.c
+++ b/hw/arm_l2x0.c
@@ -160,29 +160,33 @@ static int l2x0_priv_init(SysBusDevice *dev)
return 0;
}
+static Property l2x0_properties[] = {
+ DEFINE_PROP_UINT32("type", l2x0_state, cache_type, 0x1c100100),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void l2x0_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = l2x0_priv_init;
+ dc->vmsd = &vmstate_l2x0;
+ dc->no_user = 1;
+ dc->props = l2x0_properties;
+ dc->reset = l2x0_priv_reset;
}
-static DeviceInfo l2x0_info = {
+static TypeInfo l2x0_info = {
.name = "l2x0",
- .size = sizeof(l2x0_state),
- .vmsd = &vmstate_l2x0,
- .no_user = 1,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("type", l2x0_state, cache_type, 0x1c100100),
- DEFINE_PROP_END_OF_LIST(),
- },
- .reset = l2x0_priv_reset,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(l2x0_state),
.class_init = l2x0_class_init,
};
static void l2x0_register_device(void)
{
- sysbus_qdev_register(&l2x0_info);
+ type_register_static(&l2x0_info);
}
device_init(l2x0_register_device)
diff --git a/hw/arm_mptimer.c b/hw/arm_mptimer.c
index 06319c2e14..5a02365b6f 100644
--- a/hw/arm_mptimer.c
+++ b/hw/arm_mptimer.c
@@ -311,29 +311,33 @@ static const VMStateDescription vmstate_arm_mptimer = {
}
};
+static Property arm_mptimer_properties[] = {
+ DEFINE_PROP_UINT32("num-cpu", arm_mptimer_state, num_cpu, 0),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static void arm_mptimer_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
sbc->init = arm_mptimer_init;
+ dc->vmsd = &vmstate_arm_mptimer;
+ dc->reset = arm_mptimer_reset;
+ dc->no_user = 1;
+ dc->props = arm_mptimer_properties;
}
-static DeviceInfo arm_mptimer_info = {
- .name = "arm_mptimer",
- .size = sizeof(arm_mptimer_state),
- .vmsd = &vmstate_arm_mptimer,
- .reset = arm_mptimer_reset,
- .no_user = 1,
- .class_init = arm_mptimer_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("num-cpu", arm_mptimer_state, num_cpu, 0),
- DEFINE_PROP_END_OF_LIST()
- }
+static TypeInfo arm_mptimer_info = {
+ .name = "arm_mptimer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(arm_mptimer_state),
+ .class_init = arm_mptimer_class_init,
};
static void arm_mptimer_register_devices(void)
{
- sysbus_register_withprop(&arm_mptimer_info);
+ type_register_static(&arm_mptimer_info);
}
device_init(arm_mptimer_register_devices)
diff --git a/hw/arm_sysctl.c b/hw/arm_sysctl.c
index 08fb4437cb..9d257994c0 100644
--- a/hw/arm_sysctl.c
+++ b/hw/arm_sysctl.c
@@ -409,23 +409,25 @@ static Property arm_sysctl_properties[] = {
static void arm_sysctl_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = arm_sysctl_init1;
+ dc->reset = arm_sysctl_reset;
+ dc->vmsd = &vmstate_arm_sysctl;
+ dc->props = arm_sysctl_properties;
}
-static DeviceInfo arm_sysctl_info = {
- .name = "realview_sysctl",
- .size = sizeof(arm_sysctl_state),
- .vmsd = &vmstate_arm_sysctl,
- .reset = arm_sysctl_reset,
- .props = arm_sysctl_properties,
- .class_init = arm_sysctl_class_init,
+static TypeInfo arm_sysctl_info = {
+ .name = "realview_sysctl",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(arm_sysctl_state),
+ .class_init = arm_sysctl_class_init,
};
static void arm_sysctl_register_devices(void)
{
- sysbus_register_withprop(&arm_sysctl_info);
+ type_register_static(&arm_sysctl_info);
}
device_init(arm_sysctl_register_devices)
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index 15eb37c25d..1019d41b3e 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -354,34 +354,39 @@ static void icp_pit_class_init(ObjectClass *klass, void *data)
sdc->init = icp_pit_init;
}
-static DeviceInfo icp_pit_info = {
- .name = "integrator_pit",
- .size = sizeof(icp_pit_state),
- .class_init = icp_pit_class_init,
+static TypeInfo icp_pit_info = {
+ .name = "integrator_pit",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(icp_pit_state),
+ .class_init = icp_pit_class_init,
+};
+
+static Property sp804_properties[] = {
+ DEFINE_PROP_UINT32("freq0", sp804_state, freq0, 1000000),
+ DEFINE_PROP_UINT32("freq1", sp804_state, freq1, 1000000),
+ DEFINE_PROP_END_OF_LIST(),
};
static void sp804_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *k = DEVICE_CLASS(klass);
sdc->init = sp804_init;
+ k->props = sp804_properties;
}
-static DeviceInfo sp804_info = {
- .name = "sp804",
- .size = sizeof(sp804_state),
- .class_init = sp804_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("freq0", sp804_state, freq0, 1000000),
- DEFINE_PROP_UINT32("freq1", sp804_state, freq1, 1000000),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo sp804_info = {
+ .name = "sp804",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(sp804_state),
+ .class_init = sp804_class_init,
};
static void arm_timer_register_devices(void)
{
- sysbus_qdev_register(&icp_pit_info);
- sysbus_qdev_register(&sp804_info);
+ type_register_static(&icp_pit_info);
+ type_register_static(&sp804_info);
}
device_init(arm_timer_register_devices)
diff --git a/hw/armv7m.c b/hw/armv7m.c
index 884fc90863..de3d7e0828 100644
--- a/hw/armv7m.c
+++ b/hw/armv7m.c
@@ -252,21 +252,23 @@ static Property bitband_properties[] = {
static void bitband_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = bitband_init;
+ dc->props = bitband_properties;
}
-static DeviceInfo bitband_info = {
- .name = "ARM,bitband-memory",
- .size = sizeof(BitBandState),
- .props = bitband_properties,
- .class_init = bitband_class_init,
+static TypeInfo bitband_info = {
+ .name = "ARM,bitband-memory",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(BitBandState),
+ .class_init = bitband_class_init,
};
static void armv7m_register_devices(void)
{
- sysbus_register_withprop(&bitband_info);
+ type_register_static(&bitband_info);
}
device_init(armv7m_register_devices)
diff --git a/hw/armv7m_nvic.c b/hw/armv7m_nvic.c
index 2bb94e87e2..1ed0abc3e7 100644
--- a/hw/armv7m_nvic.c
+++ b/hw/armv7m_nvic.c
@@ -391,31 +391,35 @@ static int armv7m_nvic_init(SysBusDevice *dev)
return 0;
}
+static Property armv7m_nvic_properties[] = {
+ /* The ARM v7m may have anything from 0 to 496 external interrupt
+ * IRQ lines. We default to 64. Other boards may differ and should
+ * set this property appropriately.
+ */
+ DEFINE_PROP_UINT32("num-irq", nvic_state, num_irq, 64),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void armv7m_nvic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
sdc->init = armv7m_nvic_init;
+ dc->vmsd = &vmstate_nvic;
+ dc->props = armv7m_nvic_properties;
}
-static DeviceInfo armv7m_nvic_priv_info = {
- .name = "armv7m_nvic",
- .size = sizeof(nvic_state),
- .vmsd = &vmstate_nvic,
- .class_init = armv7m_nvic_class_init,
- .props = (Property[]) {
- /* The ARM v7m may have anything from 0 to 496 external interrupt
- * IRQ lines. We default to 64. Other boards may differ and should
- * set this property appropriately.
- */
- DEFINE_PROP_UINT32("num-irq", nvic_state, num_irq, 64),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo armv7m_nvic_info = {
+ .name = "armv7m_nvic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(nvic_state),
+ .class_init = armv7m_nvic_class_init,
};
static void armv7m_nvic_register_devices(void)
{
- sysbus_qdev_register(&armv7m_nvic_priv_info);
+ type_register_static(&armv7m_nvic_info);
}
device_init(armv7m_nvic_register_devices)
diff --git a/hw/bitbang_i2c.c b/hw/bitbang_i2c.c
index da9e5cf3d3..c9c11823af 100644
--- a/hw/bitbang_i2c.c
+++ b/hw/bitbang_i2c.c
@@ -223,21 +223,23 @@ static int gpio_i2c_init(SysBusDevice *dev)
static void gpio_i2c_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = gpio_i2c_init;
+ dc->desc = "Virtual GPIO to I2C bridge";
}
-static DeviceInfo gpio_i2c_info = {
- .name = "gpio_i2c",
- .desc = "Virtual GPIO to I2C bridge",
- .size = sizeof(GPIOI2CState),
- .class_init = gpio_i2c_class_init,
+static TypeInfo gpio_i2c_info = {
+ .name = "gpio_i2c",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(GPIOI2CState),
+ .class_init = gpio_i2c_class_init,
};
static void bitbang_i2c_register(void)
{
- sysbus_register_withprop(&gpio_i2c_info);
+ type_register_static(&gpio_i2c_info);
}
device_init(bitbang_i2c_register)
diff --git a/hw/bonito.c b/hw/bonito.c
index 0333a2ed8f..7350a4f9ec 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -768,6 +768,7 @@ PCIBus *bonito_init(qemu_irq *pic)
static void bonito_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = bonito_initfn;
@@ -775,34 +776,37 @@ static void bonito_class_init(ObjectClass *klass, void *data)
k->device_id = 0x00d5;
k->revision = 0x01;
k->class_id = PCI_CLASS_BRIDGE_HOST;
+ dc->desc = "Host bridge";
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_bonito;
}
-static DeviceInfo bonito_info = {
- .name = "Bonito",
- .desc = "Host bridge",
- .size = sizeof(PCIBonitoState),
- .vmsd = &vmstate_bonito,
- .no_user = 1,
- .class_init = bonito_class_init,
+static TypeInfo bonito_info = {
+ .name = "Bonito",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIBonitoState),
+ .class_init = bonito_class_init,
};
static void bonito_pcihost_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = bonito_pcihost_initfn;
+ dc->no_user = 1;
}
-static DeviceInfo bonito_pcihost_info = {
- .name = "Bonito-pcihost",
- .size = sizeof(BonitoState),
- .no_user = 1,
- .class_init = bonito_pcihost_class_init,
+static TypeInfo bonito_pcihost_info = {
+ .name = "Bonito-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(BonitoState),
+ .class_init = bonito_pcihost_class_init,
};
static void bonito_register(void)
{
- sysbus_register_withprop(&bonito_pcihost_info);
- pci_qdev_register(&bonito_info);
+ type_register_static(&bonito_pcihost_info);
+ type_register_static(&bonito_info);
}
device_init(bonito_register);
diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c
index 6dabe7af60..9510ed4d94 100644
--- a/hw/ccid-card-emulated.c
+++ b/hw/ccid-card-emulated.c
@@ -564,36 +564,39 @@ static int emulated_exitfn(CCIDCardState *base)
return 0;
}
+static Property emulated_card_properties[] = {
+ DEFINE_PROP_STRING("backend", EmulatedState, backend_str),
+ DEFINE_PROP_STRING("cert1", EmulatedState, cert1),
+ DEFINE_PROP_STRING("cert2", EmulatedState, cert2),
+ DEFINE_PROP_STRING("cert3", EmulatedState, cert3),
+ DEFINE_PROP_STRING("db", EmulatedState, db),
+ DEFINE_PROP_UINT8("debug", EmulatedState, debug, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void emulated_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
CCIDCardClass *cc = CCID_CARD_CLASS(klass);
cc->initfn = emulated_initfn;
cc->exitfn = emulated_exitfn;
cc->get_atr = emulated_get_atr;
cc->apdu_from_guest = emulated_apdu_from_guest;
+ dc->desc = "emulated smartcard";
+ dc->props = emulated_card_properties;
}
-static DeviceInfo emulated_card_info = {
- .name = EMULATED_DEV_NAME,
- .desc = "emulated smartcard",
- .size = sizeof(EmulatedState),
- .unplug = qdev_simple_unplug_cb,
- .class_init = emulated_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_STRING("backend", EmulatedState, backend_str),
- DEFINE_PROP_STRING("cert1", EmulatedState, cert1),
- DEFINE_PROP_STRING("cert2", EmulatedState, cert2),
- DEFINE_PROP_STRING("cert3", EmulatedState, cert3),
- DEFINE_PROP_STRING("db", EmulatedState, db),
- DEFINE_PROP_UINT8("debug", EmulatedState, debug, 0),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo emulated_card_info = {
+ .name = EMULATED_DEV_NAME,
+ .parent = TYPE_CCID_CARD,
+ .instance_size = sizeof(EmulatedState),
+ .class_init = emulated_class_initfn,
};
static void ccid_card_emulated_register_devices(void)
{
- ccid_card_qdev_register(&emulated_card_info);
+ type_register_static(&emulated_card_info);
}
device_init(ccid_card_emulated_register_devices)
diff --git a/hw/ccid-card-passthru.c b/hw/ccid-card-passthru.c
index f563d97cb4..a7006ca035 100644
--- a/hw/ccid-card-passthru.c
+++ b/hw/ccid-card-passthru.c
@@ -316,32 +316,36 @@ static VMStateDescription passthru_vmstate = {
}
};
+static Property passthru_card_properties[] = {
+ DEFINE_PROP_CHR("chardev", PassthruState, cs),
+ DEFINE_PROP_UINT8("debug", PassthruState, debug, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void passthru_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
CCIDCardClass *cc = CCID_CARD_CLASS(klass);
cc->initfn = passthru_initfn;
cc->exitfn = passthru_exitfn;
cc->get_atr = passthru_get_atr;
cc->apdu_from_guest = passthru_apdu_from_guest;
+ dc->desc = "passthrough smartcard";
+ dc->vmsd = &passthru_vmstate;
+ dc->props = passthru_card_properties;
}
-static DeviceInfo passthru_card_info = {
- .name = PASSTHRU_DEV_NAME,
- .desc = "passthrough smartcard",
- .size = sizeof(PassthruState),
- .vmsd = &passthru_vmstate,
- .class_init = passthru_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_CHR("chardev", PassthruState, cs),
- DEFINE_PROP_UINT8("debug", PassthruState, debug, 0),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo passthru_card_info = {
+ .name = PASSTHRU_DEV_NAME,
+ .parent = TYPE_CCID_CARD,
+ .instance_size = sizeof(PassthruState),
+ .class_init = passthru_class_initfn,
};
static void ccid_card_passthru_register_devices(void)
{
- ccid_card_qdev_register(&passthru_card_info);
+ type_register_static(&passthru_card_info);
}
device_init(ccid_card_passthru_register_devices)
diff --git a/hw/ccid.h b/hw/ccid.h
index 9e4979c60e..6adc745a6d 100644
--- a/hw/ccid.h
+++ b/hw/ccid.h
@@ -54,7 +54,6 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,
void ccid_card_card_removed(CCIDCardState *card);
void ccid_card_card_inserted(CCIDCardState *card);
void ccid_card_card_error(CCIDCardState *card, uint64_t error);
-void ccid_card_qdev_register(DeviceInfo *card);
/*
* support guest visible insertion/removal of ccid devices based on actual
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index c203080ea6..116e2b10c5 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2901,20 +2901,22 @@ static int vga_initfn(ISADevice *dev)
static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data)
{
ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- k->init = vga_initfn;
+ dc->vmsd = &vmstate_cirrus_vga;
+ k->init = vga_initfn;
}
-static DeviceInfo isa_cirrus_vga_info = {
- .name = "isa-cirrus-vga",
- .size = sizeof(ISACirrusVGAState),
- .vmsd = &vmstate_cirrus_vga,
+static TypeInfo isa_cirrus_vga_info = {
+ .name = "isa-cirrus-vga",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISACirrusVGAState),
.class_init = isa_cirrus_vga_class_init,
};
static void isa_cirrus_vga_register(void)
{
- isa_qdev_register(&isa_cirrus_vga_info);
+ type_register_static(&isa_cirrus_vga_info);
}
device_init(isa_cirrus_vga_register)
@@ -2965,6 +2967,7 @@ DeviceState *pci_cirrus_vga_init(PCIBus *bus)
static void cirrus_vga_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -2973,18 +2976,19 @@ static void cirrus_vga_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_CIRRUS;
k->device_id = CIRRUS_ID_CLGD5446;
k->class_id = PCI_CLASS_DISPLAY_VGA;
+ dc->desc = "Cirrus CLGD 54xx VGA";
+ dc->vmsd = &vmstate_pci_cirrus_vga;
}
-static DeviceInfo cirrus_vga_info = {
- .name = "cirrus-vga",
- .desc = "Cirrus CLGD 54xx VGA",
- .size = sizeof(PCICirrusVGAState),
- .vmsd = &vmstate_pci_cirrus_vga,
- .class_init = cirrus_vga_class_init,
+static TypeInfo cirrus_vga_info = {
+ .name = "cirrus-vga",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCICirrusVGAState),
+ .class_init = cirrus_vga_class_init,
};
static void cirrus_vga_register(void)
{
- pci_qdev_register(&cirrus_vga_info);
+ type_register_static(&cirrus_vga_info);
}
device_init(cirrus_vga_register);
diff --git a/hw/container.c b/hw/container.c
index 73f94c5fd6..1e97031d07 100644
--- a/hw/container.c
+++ b/hw/container.c
@@ -7,21 +7,23 @@ static int container_initfn(SysBusDevice *dev)
static void container_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = container_initfn;
+ dc->no_user = 1;
}
-static DeviceInfo container_info = {
- .name = "container",
- .size = sizeof(SysBusDevice),
- .no_user = 1,
- .class_init = container_class_init,
+static TypeInfo container_info = {
+ .name = "container",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusDevice),
+ .class_init = container_class_init,
};
static void container_init(void)
{
- sysbus_register_withprop(&container_info);
+ type_register_static(&container_info);
}
device_init(container_init);
diff --git a/hw/cs4231.c b/hw/cs4231.c
index 87c4eb9490..c0badbff5c 100644
--- a/hw/cs4231.c
+++ b/hw/cs4231.c
@@ -157,23 +157,25 @@ static Property cs4231_properties[] = {
static void cs4231_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = cs4231_init1;
+ dc->reset = cs_reset;
+ dc->vmsd = &vmstate_cs4231;
+ dc->props = cs4231_properties;
}
-static DeviceInfo cs4231_info = {
- .name = "SUNW,CS4231",
- .size = sizeof(CSState),
- .vmsd = &vmstate_cs4231,
- .reset = cs_reset,
- .props = cs4231_properties,
- .class_init = cs4231_class_init,
+static TypeInfo cs4231_info = {
+ .name = "SUNW,CS4231",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(CSState),
+ .class_init = cs4231_class_init,
};
static void cs4231_register_devices(void)
{
- sysbus_register_withprop(&cs4231_info);
+ type_register_static(&cs4231_info);
}
device_init(cs4231_register_devices)
diff --git a/hw/cs4231a.c b/hw/cs4231a.c
index 811c76bbb3..811dda6516 100644
--- a/hw/cs4231a.c
+++ b/hw/cs4231a.c
@@ -665,28 +665,32 @@ int cs4231a_init (ISABus *bus)
return 0;
}
+static Property cs4231a_properties[] = {
+ DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534),
+ DEFINE_PROP_UINT32 ("irq", CSState, irq, 9),
+ DEFINE_PROP_UINT32 ("dma", CSState, dma, 3),
+ DEFINE_PROP_END_OF_LIST (),
+};
+
static void cs4231a_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = cs4231a_initfn;
+ dc->desc = "Crystal Semiconductor CS4231A";
+ dc->vmsd = &vmstate_cs4231a;
+ dc->props = cs4231a_properties;
}
-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),
- DEFINE_PROP_END_OF_LIST (),
- },
+static TypeInfo cs4231a_info = {
+ .name = "cs4231a",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof (CSState),
+ .class_init = cs4231a_class_initfn,
};
static void cs4231a_register (void)
{
- isa_qdev_register (&cs4231a_info);
+ type_register_static(&cs4231a_info);
}
device_init (cs4231a_register)
diff --git a/hw/debugcon.c b/hw/debugcon.c
index f2901229d7..3903b2605d 100644
--- a/hw/debugcon.c
+++ b/hw/debugcon.c
@@ -87,27 +87,31 @@ static int debugcon_isa_initfn(ISADevice *dev)
return 0;
}
+static Property debugcon_isa_properties[] = {
+ DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9),
+ DEFINE_PROP_CHR("chardev", ISADebugconState, state.chr),
+ DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void debugcon_isa_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = debugcon_isa_initfn;
+ dc->props = debugcon_isa_properties;
}
-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),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo debugcon_isa_info = {
+ .name = "isa-debugcon",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISADebugconState),
+ .class_init = debugcon_isa_class_initfn,
};
static void debugcon_register_devices(void)
{
- isa_qdev_register(&debugcon_isa_info);
+ type_register_static(&debugcon_isa_info);
}
device_init(debugcon_register_devices)
diff --git a/hw/dec_pci.c b/hw/dec_pci.c
index 333bad98b4..a40fbcf3e5 100644
--- a/hw/dec_pci.c
+++ b/hw/dec_pci.c
@@ -52,6 +52,7 @@ static int dec_map_irq(PCIDevice *pci_dev, int irq_num)
static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_bridge_initfn;
@@ -60,15 +61,16 @@ static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_DEC_21154;
k->config_write = pci_bridge_write_config;
k->is_bridge = 1;
+ dc->desc = "DEC 21154 PCI-PCI bridge";
+ dc->reset = pci_bridge_reset;
+ dc->vmsd = &vmstate_pci_device;
}
-static DeviceInfo dec_21154_pci_bridge_info = {
- .name = "dec-21154-p2p-bridge",
- .desc = "DEC 21154 PCI-PCI bridge",
- .size = sizeof(PCIBridge),
- .vmsd = &vmstate_pci_device,
- .reset = pci_bridge_reset,
- .class_init = dec_21154_pci_bridge_class_init,
+static TypeInfo dec_21154_pci_bridge_info = {
+ .name = "dec-21154-p2p-bridge",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIBridge),
+ .class_init = dec_21154_pci_bridge_class_init,
};
PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
@@ -117,10 +119,11 @@ static void dec_21154_pci_host_class_init(ObjectClass *klass, void *data)
k->is_bridge = 1;
}
-static DeviceInfo dec_21154_pci_host_info = {
- .name = "dec-21154",
- .size = sizeof(PCIDevice),
- .class_init = dec_21154_pci_host_class_init,
+static TypeInfo dec_21154_pci_host_info = {
+ .name = "dec-21154",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = dec_21154_pci_host_class_init,
};
static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
@@ -130,17 +133,18 @@ static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
sdc->init = pci_dec_21154_device_init;
}
-static DeviceInfo pci_dec_21154_device_info = {
- .name = "dec-21154-sysbus",
- .size = sizeof(DECState),
- .class_init = pci_dec_21154_device_class_init,
+static TypeInfo pci_dec_21154_device_info = {
+ .name = "dec-21154-sysbus",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(DECState),
+ .class_init = pci_dec_21154_device_class_init,
};
static void dec_register_devices(void)
{
- sysbus_qdev_register(&pci_dec_21154_device_info);
- pci_qdev_register(&dec_21154_pci_host_info);
- pci_qdev_register(&dec_21154_pci_bridge_info);
+ type_register_static(&pci_dec_21154_device_info);
+ type_register_static(&dec_21154_pci_host_info);
+ type_register_static(&dec_21154_pci_bridge_info);
}
device_init(dec_register_devices)
diff --git a/hw/ds1225y.c b/hw/ds1225y.c
index 5890b16f1d..539bcebae0 100644
--- a/hw/ds1225y.c
+++ b/hw/ds1225y.c
@@ -142,22 +142,24 @@ static Property nvram_sysbus_properties[] = {
static void nvram_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = nvram_sysbus_initfn;
+ dc->vmsd = &vmstate_nvram;
+ dc->props = nvram_sysbus_properties;
}
-static DeviceInfo nvram_sysbus_info = {
- .name = "ds1225y",
- .size = sizeof(SysBusNvRamState),
- .vmsd = &vmstate_nvram,
- .props = nvram_sysbus_properties,
- .class_init = nvram_sysbus_class_init,
+static TypeInfo nvram_sysbus_info = {
+ .name = "ds1225y",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusNvRamState),
+ .class_init = nvram_sysbus_class_init,
};
static void nvram_register(void)
{
- sysbus_register_withprop(&nvram_sysbus_info);
+ type_register_static(&nvram_sysbus_info);
}
device_init(nvram_register)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 4e09efe123..b137e13379 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -128,15 +128,16 @@ static void ds1338_class_init(ObjectClass *klass, void *data)
k->send = ds1338_send;
}
-static DeviceInfo ds1338_info = {
- .name = "ds1338",
- .size = sizeof(DS1338State),
- .class_init = ds1338_class_init,
+static TypeInfo ds1338_info = {
+ .name = "ds1338",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(DS1338State),
+ .class_init = ds1338_class_init,
};
static void ds1338_register_devices(void)
{
- i2c_register_slave(&ds1338_info);
+ type_register_static(&ds1338_info);
}
device_init(ds1338_register_devices)
diff --git a/hw/e1000.c b/hw/e1000.c
index 200eed69f3..751f79d5ff 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1204,6 +1204,7 @@ static Property e1000_properties[] = {
static void e1000_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_e1000_init;
@@ -1213,21 +1214,22 @@ static void e1000_class_init(ObjectClass *klass, void *data)
k->device_id = E1000_DEVID;
k->revision = 0x03;
k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+ dc->desc = "Intel Gigabit Ethernet";
+ dc->reset = qdev_e1000_reset;
+ dc->vmsd = &vmstate_e1000;
+ dc->props = e1000_properties;
}
-static DeviceInfo e1000_info = {
- .name = "e1000",
- .desc = "Intel Gigabit Ethernet",
- .size = sizeof(E1000State),
- .reset = qdev_e1000_reset,
- .vmsd = &vmstate_e1000,
- .props = e1000_properties,
- .class_init = e1000_class_init,
+static TypeInfo e1000_info = {
+ .name = "e1000",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(E1000State),
+ .class_init = e1000_class_init,
};
static void e1000_register_devices(void)
{
- pci_qdev_register(&e1000_info);
+ type_register_static(&e1000_info);
}
device_init(e1000_register_devices)
diff --git a/hw/eccmemctl.c b/hw/eccmemctl.c
index 2d82c48f2b..1cf2090c1f 100644
--- a/hw/eccmemctl.c
+++ b/hw/eccmemctl.c
@@ -315,24 +315,26 @@ static Property ecc_properties[] = {
static void ecc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = ecc_init1;
+ dc->reset = ecc_reset;
+ dc->vmsd = &vmstate_ecc;
+ dc->props = ecc_properties;
}
-static DeviceInfo ecc_info = {
- .name = "eccmemctl",
- .size = sizeof(ECCState),
- .vmsd = &vmstate_ecc,
- .reset = ecc_reset,
- .props = ecc_properties,
- .class_init = ecc_class_init,
+static TypeInfo ecc_info = {
+ .name = "eccmemctl",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(ECCState),
+ .class_init = ecc_class_init,
};
static void ecc_register_devices(void)
{
- sysbus_register_withprop(&ecc_info);
+ type_register_static(&ecc_info);
}
device_init(ecc_register_devices)
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 9f6d3336f0..843610c933 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -128,8 +128,8 @@
#define DRVR_INT 0x0200 /* Driver generated interrupt. */
typedef struct {
- DeviceInfo qdev;
-
+ const char *name;
+ const char *desc;
uint16_t device_id;
uint8_t revision;
uint16_t subsystem_vendor_id;
@@ -1905,8 +1905,8 @@ static int e100_nic_init(PCIDevice *pci_dev)
static E100PCIDeviceInfo e100_devices[] = {
{
- .qdev.name = "i82550",
- .qdev.desc = "Intel i82550 Ethernet",
+ .name = "i82550",
+ .desc = "Intel i82550 Ethernet",
.device = i82550,
/* TODO: check device id. */
.device_id = PCI_DEVICE_ID_INTEL_82551IT,
@@ -1918,8 +1918,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82551",
- .qdev.desc = "Intel i82551 Ethernet",
+ .name = "i82551",
+ .desc = "Intel i82551 Ethernet",
.device = i82551,
.device_id = PCI_DEVICE_ID_INTEL_82551IT,
/* Revision ID: 0x0f, 0x10. */
@@ -1929,29 +1929,29 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82557a",
- .qdev.desc = "Intel i82557A Ethernet",
+ .name = "i82557a",
+ .desc = "Intel i82557A Ethernet",
.device = i82557A,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x01,
.power_management = false,
},{
- .qdev.name = "i82557b",
- .qdev.desc = "Intel i82557B Ethernet",
+ .name = "i82557b",
+ .desc = "Intel i82557B Ethernet",
.device = i82557B,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x02,
.power_management = false,
},{
- .qdev.name = "i82557c",
- .qdev.desc = "Intel i82557C Ethernet",
+ .name = "i82557c",
+ .desc = "Intel i82557C Ethernet",
.device = i82557C,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x03,
.power_management = false,
},{
- .qdev.name = "i82558a",
- .qdev.desc = "Intel i82558A Ethernet",
+ .name = "i82558a",
+ .desc = "Intel i82558A Ethernet",
.device = i82558A,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x04,
@@ -1959,8 +1959,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82558b",
- .qdev.desc = "Intel i82558B Ethernet",
+ .name = "i82558b",
+ .desc = "Intel i82558B Ethernet",
.device = i82558B,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x05,
@@ -1968,8 +1968,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82559a",
- .qdev.desc = "Intel i82559A Ethernet",
+ .name = "i82559a",
+ .desc = "Intel i82559A Ethernet",
.device = i82559A,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x06,
@@ -1977,8 +1977,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82559b",
- .qdev.desc = "Intel i82559B Ethernet",
+ .name = "i82559b",
+ .desc = "Intel i82559B Ethernet",
.device = i82559B,
.device_id = PCI_DEVICE_ID_INTEL_82557,
.revision = 0x07,
@@ -1986,8 +1986,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82559c",
- .qdev.desc = "Intel i82559C Ethernet",
+ .name = "i82559c",
+ .desc = "Intel i82559C Ethernet",
.device = i82559C,
.device_id = PCI_DEVICE_ID_INTEL_82557,
#if 0
@@ -2003,8 +2003,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82559er",
- .qdev.desc = "Intel i82559ER Ethernet",
+ .name = "i82559er",
+ .desc = "Intel i82559ER Ethernet",
.device = i82559ER,
.device_id = PCI_DEVICE_ID_INTEL_82551IT,
.revision = 0x09,
@@ -2012,8 +2012,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.has_extended_tcb_support = true,
.power_management = true,
},{
- .qdev.name = "i82562",
- .qdev.desc = "Intel i82562 Ethernet",
+ .name = "i82562",
+ .desc = "Intel i82562 Ethernet",
.device = i82562,
/* TODO: check device id. */
.device_id = PCI_DEVICE_ID_INTEL_82551IT,
@@ -2024,8 +2024,8 @@ static E100PCIDeviceInfo e100_devices[] = {
.power_management = true,
},{
/* Toshiba Tecra 8200. */
- .qdev.name = "i82801",
- .qdev.desc = "Intel i82801 Ethernet",
+ .name = "i82801",
+ .desc = "Intel i82801 Ethernet",
.device = i82801,
.device_id = 0x2449,
.revision = 0x03,
@@ -2048,7 +2048,7 @@ static E100PCIDeviceInfo *eepro100_get_class_by_name(const char *typename)
* do this in a much more elegant fashion.
*/
for (i = 0; i < ARRAY_SIZE(e100_devices); i++) {
- if (strcmp(e100_devices[i].qdev.name, typename) == 0) {
+ if (strcmp(e100_devices[i].name, typename) == 0) {
info = &e100_devices[i];
break;
}
@@ -2063,13 +2063,21 @@ static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s)
return eepro100_get_class_by_name(object_get_typename(OBJECT(s)));
}
+static Property e100_properties[] = {
+ DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void eepro100_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
E100PCIDeviceInfo *info;
info = eepro100_get_class_by_name(object_class_get_name(klass));
+ dc->props = e100_properties;
+ dc->desc = info->desc;
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->class_id = PCI_CLASS_NETWORK_ETHERNET;
k->romfile = "pxe-eepro100.rom";
@@ -2081,22 +2089,19 @@ static void eepro100_class_init(ObjectClass *klass, void *data)
k->subsystem_id = info->subsystem_id;
}
-static Property e100_properties[] = {
- DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void eepro100_register_devices(void)
{
size_t i;
for (i = 0; i < ARRAY_SIZE(e100_devices); i++) {
- DeviceInfo *info = &e100_devices[i].qdev;
+ TypeInfo type_info = {};
+ E100PCIDeviceInfo *info = &e100_devices[i];
- info->class_init = eepro100_class_init;
- info->size = sizeof(EEPRO100State);
- info->props = e100_properties;
+ type_info.name = info->name;
+ type_info.parent = TYPE_PCI_DEVICE;
+ type_info.class_init = eepro100_class_init;
+ type_info.instance_size = sizeof(EEPRO100State);
- pci_qdev_register(info);
+ type_register(&type_info);
}
}
diff --git a/hw/empty_slot.c b/hw/empty_slot.c
index 70e45d0c29..1bc181555f 100644
--- a/hw/empty_slot.c
+++ b/hw/empty_slot.c
@@ -83,15 +83,16 @@ static void empty_slot_class_init(ObjectClass *klass, void *data)
k->init = empty_slot_init1;
}
-static DeviceInfo empty_slot_info = {
- .name = "empty_slot",
- .size = sizeof(EmptySlot),
- .class_init = empty_slot_class_init,
+static TypeInfo empty_slot_info = {
+ .name = "empty_slot",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(EmptySlot),
+ .class_init = empty_slot_class_init,
};
static void empty_slot_register_devices(void)
{
- sysbus_register_withprop(&empty_slot_info);
+ type_register_static(&empty_slot_info);
}
device_init(empty_slot_register_devices);
diff --git a/hw/es1370.c b/hw/es1370.c
index 205bed7046..95e88b96ed 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1033,6 +1033,7 @@ int es1370_init (PCIBus *bus)
static void es1370_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = es1370_initfn;
@@ -1042,19 +1043,20 @@ static void es1370_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
k->subsystem_vendor_id = 0x4942;
k->subsystem_id = 0x4c4c;
+ dc->desc = "ENSONIQ AudioPCI ES1370";
+ dc->vmsd = &vmstate_es1370;
}
-static DeviceInfo es1370_info = {
- .name = "ES1370",
- .desc = "ENSONIQ AudioPCI ES1370",
- .size = sizeof (ES1370State),
- .vmsd = &vmstate_es1370,
- .class_init = es1370_class_init,
+static TypeInfo es1370_info = {
+ .name = "ES1370",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof (ES1370State),
+ .class_init = es1370_class_init,
};
static void es1370_register (void)
{
- pci_qdev_register (&es1370_info);
+ type_register_static(&es1370_info);
}
device_init (es1370_register);
diff --git a/hw/escc.c b/hw/escc.c
index d905d96978..9fe282f7b8 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -915,23 +915,25 @@ static Property escc_properties[] = {
static void escc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = escc_init1;
+ dc->reset = escc_reset;
+ dc->vmsd = &vmstate_escc;
+ dc->props = escc_properties;
}
-static DeviceInfo escc_info = {
- .name = "escc",
- .size = sizeof(SerialState),
- .vmsd = &vmstate_escc,
- .reset = escc_reset,
- .props = escc_properties,
- .class_init = escc_class_init,
+static TypeInfo escc_info = {
+ .name = "escc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SerialState),
+ .class_init = escc_class_init,
};
static void escc_register_devices(void)
{
- sysbus_register_withprop(&escc_info);
+ type_register_static(&escc_info);
}
device_init(escc_register_devices)
diff --git a/hw/esp.c b/hw/esp.c
index 71d3e70eaf..2f44386233 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -759,23 +759,25 @@ static Property esp_properties[] = {
static void esp_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = esp_init1;
+ dc->reset = esp_hard_reset;
+ dc->vmsd = &vmstate_esp;
+ dc->props = esp_properties;
}
-static DeviceInfo esp_info = {
- .name = "esp",
- .size = sizeof(ESPState),
- .vmsd = &vmstate_esp,
- .reset = esp_hard_reset,
- .props = esp_properties,
- .class_init = esp_class_init,
+static TypeInfo esp_info = {
+ .name = "esp",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(ESPState),
+ .class_init = esp_class_init,
};
static void esp_register_devices(void)
{
- sysbus_register_withprop(&esp_info);
+ type_register_static(&esp_info);
}
device_init(esp_register_devices)
diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c
index 92c822bcd9..aefd5778ab 100644
--- a/hw/etraxfs_eth.c
+++ b/hw/etraxfs_eth.c
@@ -623,21 +623,23 @@ static Property etraxfs_eth_properties[] = {
static void etraxfs_eth_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = fs_eth_init;
+ dc->props = etraxfs_eth_properties;
}
-static DeviceInfo etraxfs_eth_info = {
- .name = "etraxfs-eth",
- .size = sizeof(struct fs_eth),
- .props = etraxfs_eth_properties,
- .class_init = etraxfs_eth_class_init,
+static TypeInfo etraxfs_eth_info = {
+ .name = "etraxfs-eth",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct fs_eth),
+ .class_init = etraxfs_eth_class_init,
};
static void etraxfs_eth_register(void)
{
- sysbus_register_withprop(&etraxfs_eth_info);
+ type_register_static(&etraxfs_eth_info);
}
device_init(etraxfs_eth_register)
diff --git a/hw/etraxfs_pic.c b/hw/etraxfs_pic.c
index 8acf01e009..33541fcc61 100644
--- a/hw/etraxfs_pic.c
+++ b/hw/etraxfs_pic.c
@@ -158,21 +158,23 @@ static Property etraxfs_pic_properties[] = {
static void etraxfs_pic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = etraxfs_pic_init;
+ dc->props = etraxfs_pic_properties;
}
-static DeviceInfo etraxfs_pic_info = {
- .name = "etraxfs,pic",
- .size = sizeof(struct etrax_pic),
- .props = etraxfs_pic_properties,
- .class_init = etraxfs_pic_class_init,
+static TypeInfo etraxfs_pic_info = {
+ .name = "etraxfs,pic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct etrax_pic),
+ .class_init = etraxfs_pic_class_init,
};
static void etraxfs_pic_register(void)
{
- sysbus_register_withprop(&etraxfs_pic_info);
+ type_register_static(&etraxfs_pic_info);
}
device_init(etraxfs_pic_register)
diff --git a/hw/etraxfs_ser.c b/hw/etraxfs_ser.c
index a487805947..b8acd4370b 100644
--- a/hw/etraxfs_ser.c
+++ b/hw/etraxfs_ser.c
@@ -226,21 +226,23 @@ static int etraxfs_ser_init(SysBusDevice *dev)
static void etraxfs_ser_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = etraxfs_ser_init;
+ dc->reset = etraxfs_ser_reset;
}
-static DeviceInfo etraxfs_ser_info = {
- .name = "etraxfs,serial",
- .size = sizeof(struct etrax_serial),
- .reset = etraxfs_ser_reset,
- .class_init = etraxfs_ser_class_init,
+static TypeInfo etraxfs_ser_info = {
+ .name = "etraxfs,serial",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct etrax_serial),
+ .class_init = etraxfs_ser_class_init,
};
static void etraxfs_serial_register(void)
{
- sysbus_register_withprop(&etraxfs_ser_info);
+ type_register_static(&etraxfs_ser_info);
}
device_init(etraxfs_serial_register)
diff --git a/hw/etraxfs_timer.c b/hw/etraxfs_timer.c
index c33058c7fd..b71c5ee9d5 100644
--- a/hw/etraxfs_timer.c
+++ b/hw/etraxfs_timer.c
@@ -336,15 +336,16 @@ static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
sdc->init = etraxfs_timer_init;
}
-static DeviceInfo etraxfs_timer_info = {
- .name = "etraxfs,timer",
- .size = sizeof (struct etrax_timer),
- .class_init = etraxfs_timer_class_init,
+static TypeInfo etraxfs_timer_info = {
+ .name = "etraxfs,timer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof (struct etrax_timer),
+ .class_init = etraxfs_timer_class_init,
};
static void etraxfs_timer_register(void)
{
- sysbus_qdev_register(&etraxfs_timer_info);
+ type_register_static(&etraxfs_timer_info);
}
device_init(etraxfs_timer_register)
diff --git a/hw/fdc.c b/hw/fdc.c
index 85622845e9..f575a2c9f5 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1959,27 +1959,31 @@ static const VMStateDescription vmstate_isa_fdc ={
}
};
+static Property isa_fdc_properties[] = {
+ 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),
+ DEFINE_PROP_INT32("bootindexB", FDCtrlISABus, bootindexB, -1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void isabus_fdc_class_init1(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
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),
- DEFINE_PROP_INT32("bootindexB", FDCtrlISABus, bootindexB, -1),
- DEFINE_PROP_END_OF_LIST(),
- },
+ dc->fw_name = "fdc";
+ dc->no_user = 1;
+ dc->reset = fdctrl_external_reset_isa;
+ dc->vmsd = &vmstate_isa_fdc;
+ dc->props = isa_fdc_properties;
+}
+
+static TypeInfo isa_fdc_info = {
+ .name = "isa-fdc",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(FDCtrlISABus),
+ .class_init = isabus_fdc_class_init1,
};
static const VMStateDescription vmstate_sysbus_fdc ={
@@ -2000,18 +2004,20 @@ static Property sysbus_fdc_properties[] = {
static void sysbus_fdc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sysbus_fdc_init1;
+ dc->reset = fdctrl_external_reset_sysbus;
+ dc->vmsd = &vmstate_sysbus_fdc;
+ dc->props = sysbus_fdc_properties;
}
-static DeviceInfo sysbus_fdc_info = {
- .name = "sysbus-fdc",
- .size = sizeof(FDCtrlSysBus),
- .vmsd = &vmstate_sysbus_fdc,
- .reset = fdctrl_external_reset_sysbus,
- .props = sysbus_fdc_properties,
- .class_init = sysbus_fdc_class_init,
+static TypeInfo sysbus_fdc_info = {
+ .name = "sysbus-fdc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(FDCtrlSysBus),
+ .class_init = sysbus_fdc_class_init,
};
static Property sun4m_fdc_properties[] = {
@@ -2021,25 +2027,27 @@ static Property sun4m_fdc_properties[] = {
static void sun4m_fdc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sun4m_fdc_init1;
+ dc->reset = fdctrl_external_reset_sysbus;
+ dc->vmsd = &vmstate_sysbus_fdc;
+ dc->props = sun4m_fdc_properties;
}
-static DeviceInfo sun4m_fdc_info = {
- .name = "SUNW,fdtwo",
- .size = sizeof(FDCtrlSysBus),
- .vmsd = &vmstate_sysbus_fdc,
- .reset = fdctrl_external_reset_sysbus,
- .props = sun4m_fdc_properties,
- .class_init = sun4m_fdc_class_init,
+static TypeInfo sun4m_fdc_info = {
+ .name = "SUNW,fdtwo",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(FDCtrlSysBus),
+ .class_init = sun4m_fdc_class_init,
};
static void fdc_register_devices(void)
{
- isa_qdev_register(&isa_fdc_info);
- sysbus_register_withprop(&sysbus_fdc_info);
- sysbus_register_withprop(&sun4m_fdc_info);
+ type_register_static(&isa_fdc_info);
+ type_register_static(&sysbus_fdc_info);
+ type_register_static(&sun4m_fdc_info);
}
device_init(fdc_register_devices)
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index e669ed4bf2..6b2f7d1986 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -539,24 +539,26 @@ static Property fw_cfg_properties[] = {
static void fw_cfg_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = fw_cfg_init1;
+ dc->no_user = 1;
+ dc->reset = fw_cfg_reset;
+ dc->vmsd = &vmstate_fw_cfg;
+ dc->props = fw_cfg_properties;
}
-static DeviceInfo fw_cfg_info = {
- .name = "fw_cfg",
- .size = sizeof(FWCfgState),
- .vmsd = &vmstate_fw_cfg,
- .reset = fw_cfg_reset,
- .no_user = 1,
- .props = fw_cfg_properties,
- .class_init = fw_cfg_class_init,
+static TypeInfo fw_cfg_info = {
+ .name = "fw_cfg",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(FWCfgState),
+ .class_init = fw_cfg_class_init,
};
static void fw_cfg_register_devices(void)
{
- sysbus_register_withprop(&fw_cfg_info);
+ type_register_static(&fw_cfg_info);
}
device_init(fw_cfg_register_devices)
diff --git a/hw/g364fb.c b/hw/g364fb.c
index 82b31f782a..f47acc51c2 100644
--- a/hw/g364fb.c
+++ b/hw/g364fb.c
@@ -556,24 +556,26 @@ static Property g364fb_sysbus_properties[] = {
static void g364fb_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = g364fb_sysbus_init;
+ dc->desc = "G364 framebuffer";
+ dc->reset = g364fb_sysbus_reset;
+ dc->vmsd = &vmstate_g364fb;
+ dc->props = g364fb_sysbus_properties;
}
-static DeviceInfo g364fb_sysbus_info = {
- .name = "sysbus-g364",
- .desc = "G364 framebuffer",
- .size = sizeof(G364SysBusState),
- .vmsd = &vmstate_g364fb,
- .reset = g364fb_sysbus_reset,
- .props = g364fb_sysbus_properties,
- .class_init = g364fb_sysbus_class_init,
+static TypeInfo g364fb_sysbus_info = {
+ .name = "sysbus-g364",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(G364SysBusState),
+ .class_init = g364fb_sysbus_class_init,
};
static void g364fb_register(void)
{
- sysbus_register_withprop(&g364fb_sysbus_info);
+ type_register_static(&g364fb_sysbus_info);
}
device_init(g364fb_register);
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index 549859ddcd..8122baf482 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -124,39 +124,43 @@ static int grackle_pci_host_init(PCIDevice *d)
static void grackle_pci_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = grackle_pci_host_init;
k->vendor_id = PCI_VENDOR_ID_MOTOROLA;
k->device_id = PCI_DEVICE_ID_MOTOROLA_MPC106;
k->revision = 0x00;
k->class_id = PCI_CLASS_BRIDGE_HOST;
+ dc->no_user = 1;
}
-static DeviceInfo grackle_pci_info = {
- .name = "grackle",
- .size = sizeof(PCIDevice),
- .no_user = 1,
+static TypeInfo grackle_pci_info = {
+ .name = "grackle",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
.class_init = grackle_pci_class_init,
};
static void pci_grackle_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = pci_grackle_init_device;
+ dc->no_user = 1;
}
-static DeviceInfo grackle_pci_host_info = {
- .name = "grackle-pcihost",
- .size = sizeof(GrackleState),
- .no_user = 1,
- .class_init = pci_grackle_class_init,
+static TypeInfo grackle_pci_host_info = {
+ .name = "grackle-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(GrackleState),
+ .class_init = pci_grackle_class_init,
};
static void grackle_register_devices(void)
{
- sysbus_qdev_register(&grackle_pci_host_info);
- pci_qdev_register(&grackle_pci_info);
+ type_register_static(&grackle_pci_info);
+ type_register_static(&grackle_pci_host_info);
}
device_init(grackle_register_devices)
diff --git a/hw/grlib_apbuart.c b/hw/grlib_apbuart.c
index f7755b0b3b..89de2d85ae 100644
--- a/hw/grlib_apbuart.c
+++ b/hw/grlib_apbuart.c
@@ -249,21 +249,23 @@ static Property grlib_gptimer_properties[] = {
static void grlib_gptimer_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = grlib_apbuart_init;
+ dc->props = grlib_gptimer_properties;
}
-static DeviceInfo grlib_gptimer_info = {
- .name = "grlib,apbuart",
- .size = sizeof(UART),
- .props = grlib_gptimer_properties,
- .class_init = grlib_gptimer_class_init,
+static TypeInfo grlib_gptimer_info = {
+ .name = "grlib,apbuart",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(UART),
+ .class_init = grlib_gptimer_class_init,
};
static void grlib_gptimer_register(void)
{
- sysbus_register_withprop(&grlib_gptimer_info);
+ type_register_static(&grlib_gptimer_info);
}
device_init(grlib_gptimer_register)
diff --git a/hw/grlib_gptimer.c b/hw/grlib_gptimer.c
index 219009ed92..fb0b236746 100644
--- a/hw/grlib_gptimer.c
+++ b/hw/grlib_gptimer.c
@@ -381,22 +381,24 @@ static Property grlib_gptimer_properties[] = {
static void grlib_gptimer_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = grlib_gptimer_init;
+ dc->reset = grlib_gptimer_reset;
+ dc->props = grlib_gptimer_properties;
}
-static DeviceInfo grlib_gptimer_info = {
- .name = "grlib,gptimer",
- .reset = grlib_gptimer_reset,
- .size = sizeof(GPTimerUnit),
- .props = grlib_gptimer_properties,
- .class_init = grlib_gptimer_class_init,
+static TypeInfo grlib_gptimer_info = {
+ .name = "grlib,gptimer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(GPTimerUnit),
+ .class_init = grlib_gptimer_class_init,
};
static void grlib_gptimer_register(void)
{
- sysbus_register_withprop(&grlib_gptimer_info);
+ type_register_static(&grlib_gptimer_info);
}
device_init(grlib_gptimer_register)
diff --git a/hw/grlib_irqmp.c b/hw/grlib_irqmp.c
index 1ccddfbd85..1e5ad826f5 100644
--- a/hw/grlib_irqmp.c
+++ b/hw/grlib_irqmp.c
@@ -362,22 +362,24 @@ static Property grlib_irqmp_properties[] = {
static void grlib_irqmp_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = grlib_irqmp_init;
+ dc->reset = grlib_irqmp_reset;
+ dc->props = grlib_irqmp_properties;
}
-static DeviceInfo grlib_irqmp_info = {
- .name = "grlib,irqmp",
- .reset = grlib_irqmp_reset,
- .size = sizeof(IRQMP),
- .props = grlib_irqmp_properties,
- .class_init = grlib_irqmp_class_init,
+static TypeInfo grlib_irqmp_info = {
+ .name = "grlib,irqmp",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(IRQMP),
+ .class_init = grlib_irqmp_class_init,
};
static void grlib_irqmp_register(void)
{
- sysbus_register_withprop(&grlib_irqmp_info);
+ type_register_static(&grlib_irqmp_info);
}
device_init(grlib_irqmp_register)
diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
index 79d2dfbb2f..e8cd59c3a4 100644
--- a/hw/gt64xxx.c
+++ b/hw/gt64xxx.c
@@ -1147,10 +1147,11 @@ static void gt64120_pci_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_HOST;
}
-static DeviceInfo gt64120_pci_info = {
- .name = "gt64120_pci",
- .size = sizeof(PCIDevice),
- .class_init = gt64120_pci_class_init,
+static TypeInfo gt64120_pci_info = {
+ .name = "gt64120_pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = gt64120_pci_class_init,
};
static void gt64120_class_init(ObjectClass *klass, void *data)
@@ -1160,16 +1161,17 @@ static void gt64120_class_init(ObjectClass *klass, void *data)
sdc->init = gt64120_init;
}
-static DeviceInfo gt64120_info = {
- .name = "gt64120",
- .size = sizeof(GT64120State),
- .class_init = gt64120_class_init,
+static TypeInfo gt64120_info = {
+ .name = "gt64120",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(GT64120State),
+ .class_init = gt64120_class_init,
};
static void gt64120_pci_register_devices(void)
{
- sysbus_qdev_register(&gt64120_info);
- pci_qdev_register(&gt64120_pci_info);
+ type_register_static(&gt64120_info);
+ type_register_static(&gt64120_pci_info);
}
device_init(gt64120_pci_register_devices)
diff --git a/hw/gus.c b/hw/gus.c
index 6603aab199..49e5dbfbbb 100644
--- a/hw/gus.c
+++ b/hw/gus.c
@@ -299,29 +299,33 @@ int GUS_init (ISABus *bus)
return 0;
}
+static Property gus_properties[] = {
+ DEFINE_PROP_UINT32 ("freq", GUSState, freq, 44100),
+ DEFINE_PROP_HEX32 ("iobase", GUSState, port, 0x240),
+ DEFINE_PROP_UINT32 ("irq", GUSState, emu.gusirq, 7),
+ DEFINE_PROP_UINT32 ("dma", GUSState, emu.gusdma, 3),
+ DEFINE_PROP_END_OF_LIST (),
+};
+
static void gus_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = gus_initfn;
+ dc->desc = "Gravis Ultrasound GF1";
+ dc->vmsd = &vmstate_gus;
+ dc->props = gus_properties;
}
-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),
- DEFINE_PROP_UINT32 ("dma", GUSState, emu.gusdma, 3),
- DEFINE_PROP_END_OF_LIST (),
- },
+static TypeInfo gus_info = {
+ .name = "gus",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof (GUSState),
+ .class_init = gus_class_initfn,
};
static void gus_register (void)
{
- isa_qdev_register (&gus_info);
+ type_register_static(&gus_info);
}
device_init (gus_register)
diff --git a/hw/hda-audio.c b/hw/hda-audio.c
index 2b3ce2f504..152f8e6f13 100644
--- a/hw/hda-audio.c
+++ b/hw/hda-audio.c
@@ -908,45 +908,49 @@ static int hda_audio_init_duplex(HDACodecDevice *hda)
static void hda_audio_output_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
HDACodecDeviceClass *k = HDA_CODEC_DEVICE_CLASS(klass);
k->init = hda_audio_init_output;
k->exit = hda_audio_exit;
k->command = hda_audio_command;
k->stream = hda_audio_stream;
+ dc->desc = "HDA Audio Codec, output-only";
+ dc->vmsd = &vmstate_hda_audio;
+ dc->props = hda_audio_properties;
}
-static DeviceInfo hda_audio_output_info = {
- .name = "hda-output",
- .desc = "HDA Audio Codec, output-only",
- .size = sizeof(HDAAudioState),
- .vmsd = &vmstate_hda_audio,
- .props = hda_audio_properties,
- .class_init = hda_audio_output_class_init,
+static TypeInfo hda_audio_output_info = {
+ .name = "hda-output",
+ .parent = TYPE_HDA_CODEC_DEVICE,
+ .instance_size = sizeof(HDAAudioState),
+ .class_init = hda_audio_output_class_init,
};
static void hda_audio_duplex_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
HDACodecDeviceClass *k = HDA_CODEC_DEVICE_CLASS(klass);
k->init = hda_audio_init_duplex;
k->exit = hda_audio_exit;
k->command = hda_audio_command;
k->stream = hda_audio_stream;
+ dc->desc = "HDA Audio Codec, duplex";
+ dc->vmsd = &vmstate_hda_audio;
+ dc->props = hda_audio_properties;
}
-static DeviceInfo hda_audio_duplex_info = {
- .name = "hda-duplex",
- .desc = "HDA Audio Codec, duplex",
- .size = sizeof(HDAAudioState),
- .vmsd = &vmstate_hda_audio,
- .props = hda_audio_properties,
- .class_init = hda_audio_duplex_class_init,
+static TypeInfo hda_audio_duplex_info = {
+ .name = "hda-duplex",
+ .parent = TYPE_HDA_CODEC_DEVICE,
+ .instance_size = sizeof(HDAAudioState),
+ .class_init = hda_audio_duplex_class_init,
};
static void hda_audio_register(void)
{
- hda_codec_register(&hda_audio_output_info);
- hda_codec_register(&hda_audio_duplex_info);
+ type_register_static(&hda_audio_output_info);
+ type_register_static(&hda_audio_duplex_info);
}
device_init(hda_audio_register);
diff --git a/hw/highbank.c b/hw/highbank.c
index 9f767160db..684178ee3e 100644
--- a/hw/highbank.c
+++ b/hw/highbank.c
@@ -162,22 +162,24 @@ static int highbank_regs_init(SysBusDevice *dev)
static void highbank_regs_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
sbc->init = highbank_regs_init;
+ dc->desc = "Calxeda Highbank registers";
+ dc->vmsd = &vmstate_highbank_regs;
+ dc->reset = highbank_regs_reset;
}
-static DeviceInfo highbank_regs_info = {
- .name = "highbank-regs",
- .desc = "Calxeda Highbank registers",
- .size = sizeof(HighbankRegsState),
- .vmsd = &vmstate_highbank_regs,
- .class_init = highbank_regs_class_init,
- .reset = highbank_regs_reset,
+static TypeInfo highbank_regs_info = {
+ .name = "highbank-regs",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(HighbankRegsState),
+ .class_init = highbank_regs_class_init,
};
static void highbank_regs_register_device(void)
{
- sysbus_qdev_register(&highbank_regs_info);
+ type_register_static(&highbank_regs_info);
}
device_init(highbank_regs_register_device)
diff --git a/hw/hpet.c b/hw/hpet.c
index aba9ea942f..b6ace4e696 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -703,24 +703,26 @@ static Property hpet_device_properties[] = {
static void hpet_device_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = hpet_init;
+ dc->no_user = 1;
+ dc->reset = hpet_reset;
+ dc->vmsd = &vmstate_hpet;
+ dc->props = hpet_device_properties;
}
-static DeviceInfo hpet_device_info = {
- .name = "hpet",
- .size = sizeof(HPETState),
- .no_user = 1,
- .vmsd = &vmstate_hpet,
- .reset = hpet_reset,
- .props = hpet_device_properties,
- .class_init = hpet_device_class_init,
+static TypeInfo hpet_device_info = {
+ .name = "hpet",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(HPETState),
+ .class_init = hpet_device_class_init,
};
static void hpet_register_device(void)
{
- sysbus_register_withprop(&hpet_device_info);
+ type_register_static(&hpet_device_info);
}
device_init(hpet_register_device)
diff --git a/hw/i2c.c b/hw/i2c.c
index 9e5d3dfb1a..e21a666aff 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -204,19 +204,6 @@ static int i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base)
return sc->init(s);
}
-void i2c_register_slave_subclass(DeviceInfo *info, const char *parent)
-{
- assert(info->size >= sizeof(I2CSlave));
- info->init = i2c_slave_qdev_init;
- info->bus_info = &i2c_bus_info;
- qdev_register_subclass(info, parent);
-}
-
-void i2c_register_slave(DeviceInfo *info)
-{
- i2c_register_slave_subclass(info, TYPE_I2C_SLAVE);
-}
-
DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
{
DeviceState *dev;
@@ -227,12 +214,20 @@ DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
return dev;
}
+static void i2c_slave_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = i2c_slave_qdev_init;
+ k->bus_info = &i2c_bus_info;
+}
+
static TypeInfo i2c_slave_type_info = {
.name = TYPE_I2C_SLAVE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(I2CSlave),
.abstract = true,
.class_size = sizeof(I2CSlaveClass),
+ .class_init = i2c_slave_class_init,
};
static void i2c_slave_register_devices(void)
diff --git a/hw/i2c.h b/hw/i2c.h
index 31fd59c82c..0f5682b4b0 100644
--- a/hw/i2c.h
+++ b/hw/i2c.h
@@ -62,9 +62,6 @@ int i2c_recv(i2c_bus *bus);
#define I2C_SLAVE_FROM_QDEV(dev) DO_UPCAST(I2CSlave, qdev, dev)
#define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
-void i2c_register_slave(DeviceInfo *type);
-void i2c_register_slave_subclass(DeviceInfo *info, const char *parent);
-
DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr);
/* wm8750.c */
diff --git a/hw/i82374.c b/hw/i82374.c
index 2814379237..220e8cccb6 100644
--- a/hw/i82374.c
+++ b/hw/i82374.c
@@ -135,27 +135,31 @@ static int i82374_isa_init(ISADevice *dev)
return 0;
}
+static Property i82374_properties[] = {
+ DEFINE_PROP_HEX32("iobase", ISAi82374State, iobase, 0x400),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static void i82374_class_init(ObjectClass *klass, void *data)
{
ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- k->init = i82374_isa_init;
+ k->init = i82374_isa_init;
+ dc->vmsd = &vmstate_isa_i82374;
+ dc->props = i82374_properties;
}
-static DeviceInfo i82374_isa_info = {
+static TypeInfo i82374_isa_info = {
.name = "i82374",
- .size = sizeof(ISAi82374State),
- .vmsd = &vmstate_isa_i82374,
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAi82374State),
.class_init = i82374_class_init,
- .props = (Property[]) {
- DEFINE_PROP_HEX32("iobase", ISAi82374State, iobase, 0x400),
- DEFINE_PROP_END_OF_LIST()
- },
};
static void i82374_register_devices(void)
{
- isa_qdev_register(&i82374_isa_info);
+ type_register_static(&i82374_isa_info);
}
device_init(i82374_register_devices)
diff --git a/hw/i82378.c b/hw/i82378.c
index 99b453abdc..9c3efe8b95 100644
--- a/hw/i82378.c
+++ b/hw/i82378.c
@@ -238,9 +238,16 @@ static int pci_i82378_init(PCIDevice *dev)
return 0;
}
+static Property i82378_properties[] = {
+ DEFINE_PROP_HEX32("iobase", PCIi82378State, isa_io_base, 0x80000000),
+ DEFINE_PROP_HEX32("membase", PCIi82378State, isa_mem_base, 0xc0000000),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static void pci_i82378_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = pci_i82378_init;
k->vendor_id = PCI_VENDOR_ID_INTEL;
@@ -249,23 +256,20 @@ static void pci_i82378_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_ISA;
k->subsystem_vendor_id = 0x0;
k->subsystem_id = 0x0;
+ dc->vmsd = &vmstate_pci_i82378;
+ dc->props = i82378_properties;
}
-static DeviceInfo pci_i82378_info = {
+static TypeInfo pci_i82378_info = {
.name = "i82378",
- .size = sizeof(PCIi82378State),
- .vmsd = &vmstate_pci_i82378,
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIi82378State),
.class_init = pci_i82378_class_init,
- .props = (Property[]) {
- DEFINE_PROP_HEX32("iobase", PCIi82378State, isa_io_base, 0x80000000),
- DEFINE_PROP_HEX32("membase", PCIi82378State, isa_mem_base, 0xc0000000),
- DEFINE_PROP_END_OF_LIST()
- },
};
static void i82378_register_devices(void)
{
- pci_qdev_register(&pci_i82378_info);
+ type_register_static(&pci_i82378_info);
}
device_init(i82378_register_devices)
diff --git a/hw/i8254.c b/hw/i8254.c
index add1fabefe..522fed8809 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -535,28 +535,32 @@ static int pit_initfn(ISADevice *dev)
return 0;
}
+static Property pit_properties[] = {
+ DEFINE_PROP_UINT32("irq", PITState, irq, -1),
+ DEFINE_PROP_HEX32("iobase", PITState, iobase, -1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void pit_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = pit_initfn;
+ dc->no_user = 1;
+ dc->reset = pit_reset;
+ dc->vmsd = &vmstate_pit;
+ dc->props = pit_properties;
}
-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(),
- },
+static TypeInfo pit_info = {
+ .name = "isa-pit",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(PITState),
+ .class_init = pit_class_initfn,
};
static void pit_register(void)
{
- isa_qdev_register(&pit_info);
+ type_register_static(&pit_info);
}
device_init(pit_register)
diff --git a/hw/i8259.c b/hw/i8259.c
index e083bb6bdc..7ae53805d7 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -475,19 +475,22 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
static void i8259_class_init(ObjectClass *klass, void *data)
{
PICCommonClass *k = PIC_COMMON_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = pic_init;
+ dc->reset = pic_reset;
}
-static DeviceInfo i8259_info = {
- .name = "isa-i8259",
- .reset = pic_reset,
+static TypeInfo i8259_info = {
+ .name = "isa-i8259",
+ .instance_size = sizeof(PICCommonState),
+ .parent = TYPE_PIC_COMMON,
.class_init = i8259_class_init,
};
static void pic_register(void)
{
- pic_qdev_register(&i8259_info);
+ type_register_static(&i8259_info);
}
device_init(pic_register)
diff --git a/hw/i8259_common.c b/hw/i8259_common.c
index 24b1076afd..9f150bc6d0 100644
--- a/hw/i8259_common.c
+++ b/hw/i8259_common.c
@@ -133,19 +133,14 @@ static Property pic_properties_common[] = {
DEFINE_PROP_END_OF_LIST(),
};
-void pic_qdev_register(DeviceInfo *info)
-{
- 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);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->vmsd = &vmstate_pic_common;
+ dc->no_user = 1;
+ dc->props = pic_properties_common;
ic->init = pic_init_common;
}
diff --git a/hw/i8259_internal.h b/hw/i8259_internal.h
index e9d1732759..4137b61703 100644
--- a/hw/i8259_internal.h
+++ b/hw/i8259_internal.h
@@ -78,6 +78,5 @@ void pic_reset_common(PICCommonState *s);
ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master);
-void pic_qdev_register(DeviceInfo *info);
#endif /* !QEMU_I8259_INTERNAL_H */
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8869fd6b42..c87a6ca515 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1239,27 +1239,31 @@ static int sysbus_ahci_init(SysBusDevice *dev)
return 0;
}
+static Property sysbus_ahci_properties[] = {
+ DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void sysbus_ahci_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
sbc->init = sysbus_ahci_init;
+ dc->vmsd = &vmstate_sysbus_ahci;
+ dc->props = sysbus_ahci_properties;
}
-static DeviceInfo sysbus_ahci_info = {
- .name = "sysbus-ahci",
- .size = sizeof(SysbusAHCIState),
- .vmsd = &vmstate_sysbus_ahci,
- .class_init = sysbus_ahci_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo sysbus_ahci_info = {
+ .name = "sysbus-ahci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysbusAHCIState),
+ .class_init = sysbus_ahci_class_init,
};
static void sysbus_ahci_register(void)
{
- sysbus_qdev_register(&sysbus_ahci_info);
+ type_register_static(&sysbus_ahci_info);
}
device_init(sysbus_ahci_register);
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 9c673bb12b..a119500f40 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -332,6 +332,7 @@ static Property cmd646_ide_properties[] = {
static void cmd646_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_cmd646_ide_initfn;
@@ -340,17 +341,18 @@ static void cmd646_ide_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_CMD_646;
k->revision = 0x07;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->props = cmd646_ide_properties;
}
-static DeviceInfo cmd646_ide_info = {
- .name = "cmd646-ide",
- .size = sizeof(PCIIDEState),
- .props = cmd646_ide_properties,
- .class_init = cmd646_ide_class_init,
+static TypeInfo cmd646_ide_info = {
+ .name = "cmd646-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = cmd646_ide_class_init,
};
static void cmd646_ide_register(void)
{
- pci_qdev_register(&cmd646_ide_info);
+ type_register_static(&cmd646_ide_info);
}
device_init(cmd646_ide_register);
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 1cae9f17b1..0e819f6bd1 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -148,6 +148,7 @@ static void pci_ich9_write_config(PCIDevice *pci, uint32_t addr,
static void ich_ahci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_ich9_ahci_init;
@@ -157,18 +158,20 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801IR;
k->revision = 0x02;
k->class_id = PCI_CLASS_STORAGE_SATA;
+ dc->alias = "ahci";
+ dc->vmsd = &vmstate_ahci;
}
-static DeviceInfo ich_ahci_info = {
- .name = "ich9-ahci",
- .alias = "ahci",
- .size = sizeof(AHCIPCIState),
- .vmsd = &vmstate_ahci,
- .class_init = ich_ahci_class_init,
+static TypeInfo ich_ahci_info = {
+ .name = "ich9-ahci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(AHCIPCIState),
+ .class_init = ich_ahci_class_init,
};
static void ich_ahci_register(void)
{
- pci_qdev_register(&ich_ahci_info);
+ type_register_static(&ich_ahci_info);
+ type_register_static_alias(&ich_ahci_info, "ahci");
}
device_init(ich_ahci_register);
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 464473adb0..a0bcb43eba 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -94,29 +94,33 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
return dev;
}
+static Property isa_ide_properties[] = {
+ DEFINE_PROP_HEX32("iobase", ISAIDEState, iobase, 0x1f0),
+ DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6),
+ DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, 14),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void isa_ide_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = isa_ide_initfn;
+ dc->fw_name = "ide";
+ dc->reset = isa_ide_reset;
+ dc->props = isa_ide_properties;
}
-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),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo isa_ide_info = {
+ .name = "isa-ide",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAIDEState),
+ .class_init = isa_ide_class_initfn,
};
static void isa_ide_register_devices(void)
{
- isa_qdev_register(&isa_ide_info);
+ type_register_static(&isa_ide_info);
}
device_init(isa_ide_register_devices)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 832a507a4f..bf4465bb49 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -239,6 +239,7 @@ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
static void piix3_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -247,35 +248,39 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
}
-static DeviceInfo piix3_ide_info = {
- .name = "piix3-ide",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = piix3_ide_class_init,
+static TypeInfo piix3_ide_info = {
+ .name = "piix3-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = piix3_ide_class_init,
};
static void piix3_ide_xen_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_piix_ide_initfn;
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
+ dc->unplug = pci_piix3_xen_ide_unplug;
}
-static DeviceInfo piix3_ide_xen_info = {
- .name = "piix3-ide-xen",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = piix3_ide_xen_class_init,
- .unplug = pci_piix3_xen_ide_unplug,
+static TypeInfo piix3_ide_xen_info = {
+ .name = "piix3-ide-xen",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = piix3_ide_xen_class_init,
};
static void piix4_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -284,19 +289,20 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
}
-static DeviceInfo piix4_ide_info = {
- .name = "piix4-ide",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = piix4_ide_class_init,
+static TypeInfo piix4_ide_info = {
+ .name = "piix4-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = piix4_ide_class_init,
};
static void piix_ide_register(void)
{
- pci_qdev_register(&piix3_ide_info);
- pci_qdev_register(&piix3_ide_xen_info);
- pci_qdev_register(&piix4_ide_info);
+ type_register_static(&piix3_ide_info);
+ type_register_static(&piix3_ide_xen_info);
+ type_register_static(&piix4_ide_info);
}
device_init(piix_ide_register);
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index b507e3481e..1335615d17 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -91,13 +91,6 @@ err:
return -1;
}
-static void ide_qdev_register(DeviceInfo *info)
-{
- info->init = ide_qdev_init;
- info->bus_info = &ide_bus_info;
- qdev_register_subclass(info, TYPE_IDE_DEVICE);
-}
-
IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
{
DeviceState *dev;
@@ -182,73 +175,93 @@ static int ide_drive_initfn(IDEDevice *dev)
DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \
DEFINE_PROP_STRING("serial", IDEDrive, dev.serial)
+static Property ide_hd_properties[] = {
+ DEFINE_IDE_DEV_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void ide_hd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->init = ide_hd_initfn;
+ dc->fw_name = "drive";
+ dc->desc = "virtual IDE disk";
+ dc->props = ide_hd_properties;
}
-static DeviceInfo ide_hd_info = {
- .name = "ide-hd",
- .fw_name = "drive",
- .desc = "virtual IDE disk",
- .size = sizeof(IDEDrive),
- .class_init = ide_hd_class_init,
- .props = (Property[]) {
- DEFINE_IDE_DEV_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ide_hd_info = {
+ .name = "ide-hd",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_hd_class_init,
+};
+
+static Property ide_cd_properties[] = {
+ DEFINE_IDE_DEV_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
};
static void ide_cd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->init = ide_cd_initfn;
+ dc->fw_name = "drive";
+ dc->desc = "virtual IDE CD-ROM";
+ dc->props = ide_cd_properties;
}
-static DeviceInfo ide_cd_info = {
- .name = "ide-cd",
- .fw_name = "drive",
- .desc = "virtual IDE CD-ROM",
- .size = sizeof(IDEDrive),
- .class_init = ide_cd_class_init,
- .props = (Property[]) {
- DEFINE_IDE_DEV_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ide_cd_info = {
+ .name = "ide-cd",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_cd_class_init,
+};
+
+static Property ide_drive_properties[] = {
+ DEFINE_IDE_DEV_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
};
static void ide_drive_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->init = ide_drive_initfn;
+ dc->fw_name = "drive";
+ dc->desc = "virtual IDE disk or CD-ROM (legacy)";
+ dc->props = ide_drive_properties;
}
-static DeviceInfo ide_drive_info = {
- .name = "ide-drive", /* legacy -device ide-drive */
- .fw_name = "drive",
- .desc = "virtual IDE disk or CD-ROM (legacy)",
- .size = sizeof(IDEDrive),
- .class_init = ide_drive_class_init,
- .props = (Property[]) {
- DEFINE_IDE_DEV_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ide_drive_info = {
+ .name = "ide-drive",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_drive_class_init,
};
+static void ide_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = ide_qdev_init;
+ k->bus_info = &ide_bus_info;
+}
+
static TypeInfo ide_device_type_info = {
.name = TYPE_IDE_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(IDEDevice),
.abstract = true,
.class_size = sizeof(IDEDeviceClass),
+ .class_init = ide_device_class_init,
};
static void ide_dev_register(void)
{
- ide_qdev_register(&ide_hd_info);
- ide_qdev_register(&ide_cd_info);
- ide_qdev_register(&ide_drive_info);
+ type_register_static(&ide_hd_info);
+ type_register_static(&ide_cd_info);
+ type_register_static(&ide_drive_info);
type_register_static(&ide_device_type_info);
}
device_init(ide_dev_register);
diff --git a/hw/ide/via.c b/hw/ide/via.c
index ef70864465..b4ca6f27b3 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -215,6 +215,7 @@ void vt82c686b_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
static void via_ide_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = vt82c686b_ide_initfn;
@@ -223,17 +224,18 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_IDE;
k->revision = 0x06;
k->class_id = PCI_CLASS_STORAGE_IDE;
+ dc->no_user = 1;
}
-static DeviceInfo via_ide_info = {
- .name = "via-ide",
- .size = sizeof(PCIIDEState),
- .no_user = 1,
- .class_init = via_ide_class_init,
+static TypeInfo via_ide_info = {
+ .name = "via-ide",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIIDEState),
+ .class_init = via_ide_class_init,
};
static void via_ide_register(void)
{
- pci_qdev_register(&via_ide_info);
+ type_register_static(&via_ide_info);
}
device_init(via_ide_register);
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 130accf908..6dbd649908 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -525,16 +525,18 @@ static Property core_properties[] = {
static void core_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = integratorcm_init;
+ dc->props = core_properties;
}
-static DeviceInfo core_info = {
- .name = "integrator_core",
- .size = sizeof(integratorcm_state),
- .props = core_properties,
- .class_init = core_class_init,
+static TypeInfo core_info = {
+ .name = "integrator_core",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(integratorcm_state),
+ .class_init = core_class_init,
};
static void icp_pic_class_init(ObjectClass *klass, void *data)
@@ -544,16 +546,17 @@ static void icp_pic_class_init(ObjectClass *klass, void *data)
sdc->init = icp_pic_init;
}
-static DeviceInfo icp_pic_info = {
- .name = "integrator_pic",
- .size = sizeof(icp_pic_state),
- .class_init = icp_pic_class_init,
+static TypeInfo icp_pic_info = {
+ .name = "integrator_pic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(icp_pic_state),
+ .class_init = icp_pic_class_init,
};
static void integratorcp_register_devices(void)
{
- sysbus_qdev_register(&icp_pic_info);
- sysbus_register_withprop(&core_info);
+ type_register_static(&icp_pic_info);
+ type_register_static(&core_info);
}
device_init(integratorcp_register_devices)
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index f06213393e..9e4a31f62d 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -74,14 +74,6 @@ static int hda_codec_dev_exit(DeviceState *qdev)
return 0;
}
-void hda_codec_register(DeviceInfo *info)
-{
- info->init = hda_codec_dev_init;
- info->exit = hda_codec_dev_exit;
- info->bus_info = &hda_codec_bus_info;
- qdev_register_subclass(info, TYPE_HDA_CODEC_DEVICE);
-}
-
HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad)
{
DeviceState *qdev;
@@ -1255,6 +1247,7 @@ static Property intel_hda_properties[] = {
static void intel_hda_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = intel_hda_init;
@@ -1264,29 +1257,39 @@ static void intel_hda_class_init(ObjectClass *klass, void *data)
k->device_id = 0x2668;
k->revision = 1;
k->class_id = PCI_CLASS_MULTIMEDIA_HD_AUDIO;
+ dc->desc = "Intel HD Audio Controller";
+ dc->reset = intel_hda_reset;
+ dc->vmsd = &vmstate_intel_hda;
+ dc->props = intel_hda_properties;
}
-static DeviceInfo intel_hda_info = {
- .name = "intel-hda",
- .desc = "Intel HD Audio Controller",
- .size = sizeof(IntelHDAState),
- .vmsd = &vmstate_intel_hda,
- .reset = intel_hda_reset,
- .props = intel_hda_properties,
- .class_init = intel_hda_class_init,
+static TypeInfo intel_hda_info = {
+ .name = "intel-hda",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(IntelHDAState),
+ .class_init = intel_hda_class_init,
};
+static void hda_codec_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = hda_codec_dev_init;
+ k->exit = hda_codec_dev_exit;
+ k->bus_info = &hda_codec_bus_info;
+}
+
static TypeInfo hda_codec_device_type_info = {
.name = TYPE_HDA_CODEC_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(HDACodecDevice),
.abstract = true,
.class_size = sizeof(HDACodecDeviceClass),
+ .class_init = hda_codec_device_class_init,
};
static void intel_hda_register(void)
{
- pci_qdev_register(&intel_hda_info);
+ type_register_static(&intel_hda_info);
type_register_static(&hda_codec_device_type_info);
}
device_init(intel_hda_register);
diff --git a/hw/intel-hda.h b/hw/intel-hda.h
index f52358709b..a1cca5b1bb 100644
--- a/hw/intel-hda.h
+++ b/hw/intel-hda.h
@@ -48,7 +48,6 @@ struct HDACodecDevice {
void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
hda_codec_response_func response,
hda_codec_xfer_func xfer);
-void hda_codec_register(DeviceInfo *info);
HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad);
void hda_codec_response(HDACodecDevice *dev, bool solicited, uint32_t response);
diff --git a/hw/ioapic.c b/hw/ioapic.c
index 0939009637..79549f8ed1 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -238,20 +238,22 @@ static void ioapic_init(IOAPICCommonState *s, int instance_no)
static void ioapic_class_init(ObjectClass *klass, void *data)
{
IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = ioapic_init;
+ dc->reset = ioapic_reset_common;
}
-static DeviceInfo ioapic_info = {
- .name = "ioapic",
- .size = sizeof(IOAPICCommonState),
- .reset = ioapic_reset_common,
- .class_init = ioapic_class_init,
+static TypeInfo ioapic_info = {
+ .name = "ioapic",
+ .parent = TYPE_IOAPIC_COMMON,
+ .instance_size = sizeof(IOAPICCommonState),
+ .class_init = ioapic_class_init,
};
static void ioapic_register_devices(void)
{
- ioapic_qdev_register(&ioapic_info);
+ type_register_static(&ioapic_info);
}
device_init(ioapic_register_devices)
diff --git a/hw/ioapic_common.c b/hw/ioapic_common.c
index 4bb7ea9b1f..f932700d12 100644
--- a/hw/ioapic_common.c
+++ b/hw/ioapic_common.c
@@ -96,8 +96,11 @@ static const VMStateDescription vmstate_ioapic_common = {
static void ioapic_common_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
sc->init = ioapic_init_common;
+ dc->vmsd = &vmstate_ioapic_common;
+ dc->no_user = 1;
}
static TypeInfo ioapic_common_type = {
@@ -109,13 +112,6 @@ static TypeInfo ioapic_common_type = {
.abstract = true,
};
-void ioapic_qdev_register(DeviceInfo *info)
-{
- info->vmsd = &vmstate_ioapic_common;
- info->no_user = 1;
- sysbus_qdev_register_subclass(info, TYPE_IOAPIC_COMMON);
-}
-
static void register_devices(void)
{
type_register_static(&ioapic_common_type);
diff --git a/hw/ioapic_internal.h b/hw/ioapic_internal.h
index 9dff1a72c6..e04c9f3c12 100644
--- a/hw/ioapic_internal.h
+++ b/hw/ioapic_internal.h
@@ -97,7 +97,6 @@ struct IOAPICCommonState {
uint64_t ioredtbl[IOAPIC_NUM_PINS];
};
-void ioapic_qdev_register(DeviceInfo *info);
void ioapic_reset_common(DeviceState *dev);
#endif /* !QEMU_IOAPIC_INTERNAL_H */
diff --git a/hw/ioh3420.c b/hw/ioh3420.c
index 6cfafb3289..1c60123d43 100644
--- a/hw/ioh3420.c
+++ b/hw/ioh3420.c
@@ -213,6 +213,7 @@ static Property ioh3420_properties[] = {
static void ioh3420_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->is_express = 1;
@@ -223,21 +224,22 @@ static void ioh3420_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_IOH_EPORT;
k->revision = PCI_DEVICE_ID_IOH_REV;
+ dc->desc = "Intel IOH device id 3420 PCIE Root Port";
+ dc->reset = ioh3420_reset;
+ dc->vmsd = &vmstate_ioh3420;
+ dc->props = ioh3420_properties;
}
-static DeviceInfo ioh3420_info = {
- .name = "ioh3420",
- .desc = "Intel IOH device id 3420 PCIE Root Port",
- .size = sizeof(PCIESlot),
- .reset = ioh3420_reset,
- .vmsd = &vmstate_ioh3420,
- .props = ioh3420_properties,
- .class_init = ioh3420_class_init,
+static TypeInfo ioh3420_info = {
+ .name = "ioh3420",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIESlot),
+ .class_init = ioh3420_class_init,
};
static void ioh3420_register(void)
{
- pci_qdev_register(&ioh3420_info);
+ type_register_static(&ioh3420_info);
}
device_init(ioh3420_register);
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 92d8882b34..a22c5c6efe 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -125,18 +125,6 @@ static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base)
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(DeviceInfo *info)
-{
- isa_qdev_register_subclass(info, TYPE_ISA_DEVICE);
-}
-
ISADevice *isa_create(ISABus *bus, const char *name)
{
DeviceState *dev;
@@ -191,30 +179,40 @@ static int isabus_bridge_init(SysBusDevice *dev)
static void isabus_bridge_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = isabus_bridge_init;
+ dc->fw_name = "isa";
+ dc->no_user = 1;
}
-static DeviceInfo isabus_bridge_info = {
- .name = "isabus-bridge",
- .fw_name = "isa",
- .size = sizeof(SysBusDevice),
- .no_user = 1,
- .class_init = isabus_bridge_class_init,
+static TypeInfo isabus_bridge_info = {
+ .name = "isabus-bridge",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusDevice),
+ .class_init = isabus_bridge_class_init,
};
+static void isa_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = isa_qdev_init;
+ k->bus_info = &isa_bus_info;
+}
+
static TypeInfo isa_device_type_info = {
.name = TYPE_ISA_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(ISADevice),
.abstract = true,
.class_size = sizeof(ISADeviceClass),
+ .class_init = isa_device_class_init,
};
static void isabus_register_devices(void)
{
- sysbus_register_withprop(&isabus_bridge_info);
+ type_register_static(&isabus_bridge_info);
type_register_static(&isa_device_type_info);
}
diff --git a/hw/isa.h b/hw/isa.h
index 9f5d1588b5..40373fb107 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -41,8 +41,6 @@ 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(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);
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index e2880be41a..6f017d474c 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -779,6 +779,7 @@ static Property ivshmem_properties[] = {
static void ivshmem_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_ivshmem_init;
@@ -786,19 +787,20 @@ static void ivshmem_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
k->device_id = 0x1110;
k->class_id = PCI_CLASS_MEMORY_RAM;
+ dc->reset = ivshmem_reset;
+ dc->props = ivshmem_properties;
}
-static DeviceInfo ivshmem_info = {
- .name = "ivshmem",
- .size = sizeof(IVShmemState),
- .reset = ivshmem_reset,
- .props = ivshmem_properties,
- .class_init = ivshmem_class_init,
+static TypeInfo ivshmem_info = {
+ .name = "ivshmem",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(IVShmemState),
+ .class_init = ivshmem_class_init,
};
static void ivshmem_register_devices(void)
{
- pci_qdev_register(&ivshmem_info);
+ type_register_static(&ivshmem_info);
}
device_init(ivshmem_register_devices)
diff --git a/hw/kvm/apic.c b/hw/kvm/apic.c
index bc80ae4ede..89e33b0ac8 100644
--- a/hw/kvm/apic.c
+++ b/hw/kvm/apic.c
@@ -132,14 +132,15 @@ static void kvm_apic_class_init(ObjectClass *klass, void *data)
k->external_nmi = kvm_apic_external_nmi;
}
-static DeviceInfo kvm_apic_info = {
+static TypeInfo kvm_apic_info = {
.name = "kvm-apic",
+ .parent = TYPE_APIC_COMMON,
.class_init = kvm_apic_class_init,
};
static void kvm_apic_register_device(void)
{
- apic_qdev_register(&kvm_apic_info);
+ type_register_static(&kvm_apic_info);
}
device_init(kvm_apic_register_device)
diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c
index b997d2a388..d5a53869b3 100644
--- a/hw/kvm/clock.c
+++ b/hw/kvm/clock.c
@@ -94,17 +94,19 @@ static const VMStateDescription kvmclock_vmsd = {
static void kvmclock_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = kvmclock_init;
+ dc->no_user = 1;
+ dc->vmsd = &kvmclock_vmsd;
}
-static DeviceInfo kvmclock_info = {
- .name = "kvmclock",
- .size = sizeof(KVMClockState),
- .vmsd = &kvmclock_vmsd,
- .no_user = 1,
- .class_init = kvmclock_class_init,
+static TypeInfo kvmclock_info = {
+ .name = "kvmclock",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(KVMClockState),
+ .class_init = kvmclock_class_init,
};
/* Note: Must be called after VCPU initialization. */
@@ -120,7 +122,7 @@ void kvmclock_create(void)
static void kvmclock_register_device(void)
{
if (kvm_enabled()) {
- sysbus_register_withprop(&kvmclock_info);
+ type_register_static(&kvmclock_info);
}
}
diff --git a/hw/kvm/i8259.c b/hw/kvm/i8259.c
index b34901c063..297d64e11f 100644
--- a/hw/kvm/i8259.c
+++ b/hw/kvm/i8259.c
@@ -115,21 +115,23 @@ qemu_irq *kvm_i8259_init(ISABus *bus)
static void kvm_i8259_class_init(ObjectClass *klass, void *data)
{
PICCommonClass *k = PIC_COMMON_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->reset = kvm_pic_reset;
k->init = kvm_pic_init;
k->pre_save = kvm_pic_get;
k->post_load = kvm_pic_put;
}
-static DeviceInfo kvm_i8259_info = {
+static TypeInfo kvm_i8259_info = {
.name = "kvm-i8259",
- .reset = kvm_pic_reset,
+ .parent = TYPE_PIC_COMMON,
.class_init = kvm_i8259_class_init,
};
static void kvm_pic_register(void)
{
- pic_qdev_register(&kvm_i8259_info);
+ type_register_static(&kvm_i8259_info);
}
device_init(kvm_pic_register)
diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c
index f8ea0cc31a..b316933a96 100644
--- a/hw/kvm/ioapic.c
+++ b/hw/kvm/ioapic.c
@@ -93,29 +93,33 @@ static void kvm_ioapic_init(IOAPICCommonState *s, int instance_no)
qdev_init_gpio_in(&s->busdev.qdev, kvm_ioapic_set_irq, IOAPIC_NUM_PINS);
}
+static Property kvm_ioapic_properties[] = {
+ DEFINE_PROP_UINT32("gsi_base", KVMIOAPICState, kvm_gsi_base, 0),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static void kvm_ioapic_class_init(ObjectClass *klass, void *data)
{
IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = kvm_ioapic_init;
k->pre_save = kvm_ioapic_get;
k->post_load = kvm_ioapic_put;
+ dc->reset = kvm_ioapic_reset;
+ dc->props = kvm_ioapic_properties;
}
-static DeviceInfo kvm_ioapic_info = {
+static TypeInfo kvm_ioapic_info = {
.name = "kvm-ioapic",
- .size = sizeof(KVMIOAPICState),
- .reset = kvm_ioapic_reset,
+ .parent = TYPE_IOAPIC_COMMON,
+ .instance_size = sizeof(KVMIOAPICState),
.class_init = kvm_ioapic_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("gsi_base", KVMIOAPICState, kvm_gsi_base, 0),
- DEFINE_PROP_END_OF_LIST()
- },
};
static void kvm_ioapic_register_device(void)
{
- ioapic_qdev_register(&kvm_ioapic_info);
+ type_register_static(&kvm_ioapic_info);
}
device_init(kvm_ioapic_register_device)
diff --git a/hw/lan9118.c b/hw/lan9118.c
index 3925b0469f..78777c7336 100644
--- a/hw/lan9118.c
+++ b/hw/lan9118.c
@@ -1245,23 +1245,25 @@ static Property lan9118_properties[] = {
static void lan9118_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lan9118_init1;
+ dc->reset = lan9118_reset;
+ dc->props = lan9118_properties;
+ dc->vmsd = &vmstate_lan9118;
}
-static DeviceInfo lan9118_info = {
- .name = "lan9118",
- .size = sizeof(lan9118_state),
- .reset = lan9118_reset,
- .vmsd = &vmstate_lan9118,
- .props = lan9118_properties,
- .class_init = lan9118_class_init,
+static TypeInfo lan9118_info = {
+ .name = "lan9118",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(lan9118_state),
+ .class_init = lan9118_class_init,
};
static void lan9118_register_devices(void)
{
- sysbus_register_withprop(&lan9118_info);
+ type_register_static(&lan9118_info);
}
/* Legacy helper function. Should go away when machine config files are
diff --git a/hw/lance.c b/hw/lance.c
index 969d766ae4..519720bd9c 100644
--- a/hw/lance.c
+++ b/hw/lance.c
@@ -145,23 +145,25 @@ static Property lance_properties[] = {
static void lance_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lance_init;
+ dc->fw_name = "ethernet";
+ dc->reset = lance_reset;
+ dc->vmsd = &vmstate_lance;
+ dc->props = lance_properties;
}
-static DeviceInfo lance_info = {
- .name = "lance",
- .fw_name = "ethernet",
- .size = sizeof(SysBusPCNetState),
- .reset = lance_reset,
- .vmsd = &vmstate_lance,
- .props = lance_properties,
- .class_init = lance_class_init,
+static TypeInfo lance_info = {
+ .name = "lance",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusPCNetState),
+ .class_init = lance_class_init,
};
static void lance_register_devices(void)
{
- sysbus_register_withprop(&lance_info);
+ type_register_static(&lance_info);
}
device_init(lance_register_devices)
diff --git a/hw/lm32_juart.c b/hw/lm32_juart.c
index e25a409fc7..023c644fef 100644
--- a/hw/lm32_juart.c
+++ b/hw/lm32_juart.c
@@ -136,22 +136,24 @@ static const VMStateDescription vmstate_lm32_juart = {
static void lm32_juart_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lm32_juart_init;
+ dc->reset = juart_reset;
+ dc->vmsd = &vmstate_lm32_juart;
}
-static DeviceInfo lm32_juart_info = {
- .name = "lm32-juart",
- .size = sizeof(LM32JuartState),
- .vmsd = &vmstate_lm32_juart,
- .reset = juart_reset,
- .class_init = lm32_juart_class_init,
+static TypeInfo lm32_juart_info = {
+ .name = "lm32-juart",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(LM32JuartState),
+ .class_init = lm32_juart_class_init,
};
static void lm32_juart_register(void)
{
- sysbus_register_withprop(&lm32_juart_info);
+ type_register_static(&lm32_juart_info);
}
device_init(lm32_juart_register)
diff --git a/hw/lm32_pic.c b/hw/lm32_pic.c
index b7b1886820..7be6d0d68e 100644
--- a/hw/lm32_pic.c
+++ b/hw/lm32_pic.c
@@ -176,22 +176,24 @@ static const VMStateDescription vmstate_lm32_pic = {
static void lm32_pic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lm32_pic_init;
+ dc->reset = pic_reset;
+ dc->vmsd = &vmstate_lm32_pic;
}
-static DeviceInfo lm32_pic_info = {
- .name = "lm32-pic",
- .size = sizeof(LM32PicState),
- .vmsd = &vmstate_lm32_pic,
- .reset = pic_reset,
- .class_init = lm32_pic_class_init,
+static TypeInfo lm32_pic_info = {
+ .name = "lm32-pic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(LM32PicState),
+ .class_init = lm32_pic_class_init,
};
static void lm32_pic_register(void)
{
- sysbus_register_withprop(&lm32_pic_info);
+ type_register_static(&lm32_pic_info);
}
device_init(lm32_pic_register)
diff --git a/hw/lm32_sys.c b/hw/lm32_sys.c
index c83809effd..ba6f4acbaa 100644
--- a/hw/lm32_sys.c
+++ b/hw/lm32_sys.c
@@ -148,23 +148,25 @@ static Property lm32_sys_properties[] = {
static void lm32_sys_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lm32_sys_init;
+ dc->reset = sys_reset;
+ dc->vmsd = &vmstate_lm32_sys;
+ dc->props = lm32_sys_properties;
}
-static DeviceInfo lm32_sys_info = {
- .name = "lm32-sys",
- .size = sizeof(LM32SysState),
- .vmsd = &vmstate_lm32_sys,
- .reset = sys_reset,
- .props = lm32_sys_properties,
- .class_init = lm32_sys_class_init,
+static TypeInfo lm32_sys_info = {
+ .name = "lm32-sys",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(LM32SysState),
+ .class_init = lm32_sys_class_init,
};
static void lm32_sys_register(void)
{
- sysbus_register_withprop(&lm32_sys_info);
+ type_register_static(&lm32_sys_info);
}
device_init(lm32_sys_register)
diff --git a/hw/lm32_timer.c b/hw/lm32_timer.c
index 932c1f0669..3cb4e0a4f3 100644
--- a/hw/lm32_timer.c
+++ b/hw/lm32_timer.c
@@ -206,23 +206,25 @@ static Property lm32_timer_properties[] = {
static void lm32_timer_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lm32_timer_init;
+ dc->reset = timer_reset;
+ dc->vmsd = &vmstate_lm32_timer;
+ dc->props = lm32_timer_properties;
}
-static DeviceInfo lm32_timer_info = {
- .name = "lm32-timer",
- .size = sizeof(LM32TimerState),
- .vmsd = &vmstate_lm32_timer,
- .reset = timer_reset,
- .props = lm32_timer_properties,
- .class_init = lm32_timer_class_init,
+static TypeInfo lm32_timer_info = {
+ .name = "lm32-timer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(LM32TimerState),
+ .class_init = lm32_timer_class_init,
};
static void lm32_timer_register(void)
{
- sysbus_register_withprop(&lm32_timer_info);
+ type_register_static(&lm32_timer_info);
}
device_init(lm32_timer_register)
diff --git a/hw/lm32_uart.c b/hw/lm32_uart.c
index ea7d00edef..fc70490e32 100644
--- a/hw/lm32_uart.c
+++ b/hw/lm32_uart.c
@@ -273,22 +273,24 @@ static const VMStateDescription vmstate_lm32_uart = {
static void lm32_uart_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = lm32_uart_init;
+ dc->reset = uart_reset;
+ dc->vmsd = &vmstate_lm32_uart;
}
-static DeviceInfo lm32_uart_info = {
- .name = "lm32-uart",
- .size = sizeof(LM32UartState),
- .vmsd = &vmstate_lm32_uart,
- .reset = uart_reset,
- .class_init = lm32_uart_class_init,
+static TypeInfo lm32_uart_info = {
+ .name = "lm32-uart",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(LM32UartState),
+ .class_init = lm32_uart_class_init,
};
static void lm32_uart_register(void)
{
- sysbus_register_withprop(&lm32_uart_info);
+ type_register_static(&lm32_uart_info);
}
device_init(lm32_uart_register)
diff --git a/hw/lm832x.c b/hw/lm832x.c
index 84f81fe132..895d306635 100644
--- a/hw/lm832x.c
+++ b/hw/lm832x.c
@@ -496,24 +496,26 @@ void lm832x_key_event(DeviceState *dev, int key, int state)
static void lm8323_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
k->init = lm8323_init;
k->event = lm_i2c_event;
k->recv = lm_i2c_rx;
k->send = lm_i2c_tx;
+ dc->vmsd = &vmstate_lm_kbd;
}
-static DeviceInfo lm8323_info = {
- .name = "lm8323",
- .size = sizeof(LM823KbdState),
- .vmsd = &vmstate_lm_kbd,
- .class_init = lm8323_class_init,
+static TypeInfo lm8323_info = {
+ .name = "lm8323",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(LM823KbdState),
+ .class_init = lm8323_class_init,
};
static void lm832x_register_devices(void)
{
- i2c_register_slave(&lm8323_info);
+ type_register_static(&lm8323_info);
}
device_init(lm832x_register_devices)
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 3571588b12..638332e188 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2122,6 +2122,7 @@ static int lsi_scsi_init(PCIDevice *dev)
static void lsi_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = lsi_scsi_init;
@@ -2130,20 +2131,22 @@ static void lsi_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_LSI_53C895A;
k->class_id = PCI_CLASS_STORAGE_SCSI;
k->subsystem_id = 0x1000;
+ dc->alias = "lsi";
+ dc->reset = lsi_scsi_reset;
+ dc->vmsd = &vmstate_lsi_scsi;
}
-static DeviceInfo lsi_info = {
- .name = "lsi53c895a",
- .alias = "lsi",
- .size = sizeof(LSIState),
- .reset = lsi_scsi_reset,
- .vmsd = &vmstate_lsi_scsi,
- .class_init = lsi_class_init,
+static TypeInfo lsi_info = {
+ .name = "lsi53c895a",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(LSIState),
+ .class_init = lsi_class_init,
};
static void lsi53c895a_register_devices(void)
{
- pci_qdev_register(&lsi_info);
+ type_register_static(&lsi_info);
+ type_register_static_alias(&lsi_info, "lsi");
}
device_init(lsi53c895a_register_devices);
diff --git a/hw/m48t59.c b/hw/m48t59.c
index bd610f00ae..c35867d0a1 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -720,24 +720,28 @@ static int m48t59_init1(SysBusDevice *dev)
return 0;
}
+static Property m48t59_isa_properties[] = {
+ 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),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void m48t59_init_class_isa1(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = m48t59_init_isa1;
+ dc->no_user = 1;
+ dc->reset = m48t59_reset_isa;
+ dc->props = m48t59_isa_properties;
}
-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),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo m48t59_isa_info = {
+ .name = "m48t59_isa",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(M48t59ISAState),
+ .class_init = m48t59_init_class_isa1,
};
static Property m48t59_properties[] = {
@@ -749,23 +753,25 @@ static Property m48t59_properties[] = {
static void m48t59_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = m48t59_init1;
+ dc->reset = m48t59_reset_sysbus;
+ dc->props = m48t59_properties;
}
-static DeviceInfo m48t59_info = {
- .name = "m48t59",
- .size = sizeof(M48t59SysBusState),
- .reset = m48t59_reset_sysbus,
- .props = m48t59_properties,
- .class_init = m48t59_class_init,
+static TypeInfo m48t59_info = {
+ .name = "m48t59",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(M48t59SysBusState),
+ .class_init = m48t59_class_init,
};
static void m48t59_register_devices(void)
{
- sysbus_register_withprop(&m48t59_info);
- isa_qdev_register(&m48t59_isa_info);
+ type_register_static(&m48t59_info);
+ type_register_static(&m48t59_isa_info);
}
device_init(m48t59_register_devices)
diff --git a/hw/macio.c b/hw/macio.c
index ae9db08cbd..3d648e934b 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -90,15 +90,16 @@ static void macio_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_OTHERS << 8;
}
-static DeviceInfo macio_info = {
- .name = "macio",
- .size = sizeof(MacIOState),
- .class_init = macio_class_init,
+static TypeInfo macio_info = {
+ .name = "macio",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(MacIOState),
+ .class_init = macio_class_init,
};
static void macio_register(void)
{
- pci_qdev_register(&macio_info);
+ type_register_static(&macio_info);
}
device_init(macio_register);
diff --git a/hw/marvell_88w8618_audio.c b/hw/marvell_88w8618_audio.c
index 355e492054..b628f1718d 100644
--- a/hw/marvell_88w8618_audio.c
+++ b/hw/marvell_88w8618_audio.c
@@ -279,23 +279,25 @@ static Property mv88w8618_audio_properties[] = {
static void mv88w8618_audio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mv88w8618_audio_init;
+ dc->reset = mv88w8618_audio_reset;
+ dc->vmsd = &mv88w8618_audio_vmsd;
+ dc->props = mv88w8618_audio_properties;
}
-static DeviceInfo mv88w8618_audio_info = {
- .name = "mv88w8618_audio",
- .size = sizeof(mv88w8618_audio_state),
- .reset = mv88w8618_audio_reset,
- .vmsd = &mv88w8618_audio_vmsd,
- .props = mv88w8618_audio_properties,
- .class_init = mv88w8618_audio_class_init,
+static TypeInfo mv88w8618_audio_info = {
+ .name = "mv88w8618_audio",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mv88w8618_audio_state),
+ .class_init = mv88w8618_audio_class_init,
};
static void mv88w8618_register_devices(void)
{
- sysbus_register_withprop(&mv88w8618_audio_info);
+ type_register_static(&mv88w8618_audio_info);
}
device_init(mv88w8618_register_devices)
diff --git a/hw/max111x.c b/hw/max111x.c
index db17842e14..9d61aa98db 100644
--- a/hw/max111x.c
+++ b/hw/max111x.c
@@ -161,10 +161,11 @@ static void max1110_class_init(ObjectClass *klass, void *data)
k->transfer = max111x_transfer;
}
-static DeviceInfo max1110_info = {
- .name = "max1110",
- .size = sizeof(MAX111xState),
- .class_init = max1110_class_init,
+static TypeInfo max1110_info = {
+ .name = "max1110",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(MAX111xState),
+ .class_init = max1110_class_init,
};
static void max1111_class_init(ObjectClass *klass, void *data)
@@ -175,16 +176,17 @@ static void max1111_class_init(ObjectClass *klass, void *data)
k->transfer = max111x_transfer;
}
-static DeviceInfo max1111_info = {
- .name = "max1111",
- .size = sizeof(MAX111xState),
- .class_init = max1111_class_init,
+static TypeInfo max1111_info = {
+ .name = "max1111",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(MAX111xState),
+ .class_init = max1111_class_init,
};
static void max111x_register_devices(void)
{
- ssi_register_slave(&max1110_info);
- ssi_register_slave(&max1111_info);
+ type_register_static(&max1110_info);
+ type_register_static(&max1111_info);
}
device_init(max111x_register_devices)
diff --git a/hw/max7310.c b/hw/max7310.c
index 0cc3219e80..3a6bb961ef 100644
--- a/hw/max7310.c
+++ b/hw/max7310.c
@@ -187,25 +187,27 @@ static int max7310_init(I2CSlave *i2c)
static void max7310_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
k->init = max7310_init;
k->event = max7310_event;
k->recv = max7310_rx;
k->send = max7310_tx;
+ dc->reset = max7310_reset;
+ dc->vmsd = &vmstate_max7310;
}
-static DeviceInfo max7310_info = {
- .name = "max7310",
- .size = sizeof(MAX7310State),
- .vmsd = &vmstate_max7310,
- .reset = max7310_reset,
- .class_init = max7310_class_init,
+static TypeInfo max7310_info = {
+ .name = "max7310",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(MAX7310State),
+ .class_init = max7310_class_init,
};
static void max7310_register_devices(void)
{
- i2c_register_slave(&max7310_info);
+ type_register_static(&max7310_info);
}
device_init(max7310_register_devices)
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index e6e4cb7d5d..cbbf1f06e0 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -709,28 +709,32 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
return dev;
}
+static Property mc146818rtc_properties[] = {
+ DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
+ DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
+ lost_tick_policy, LOST_TICK_DISCARD),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void rtc_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = rtc_initfn;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_rtc;
+ dc->props = mc146818rtc_properties;
}
-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_LOSTTICKPOLICY("lost_tick_policy", RTCState,
- lost_tick_policy, LOST_TICK_DISCARD),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo mc146818rtc_info = {
+ .name = "mc146818rtc",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(RTCState),
+ .class_init = rtc_class_initfn,
};
static void mc146818rtc_register(void)
{
- isa_qdev_register(&mc146818rtc_info);
+ type_register_static(&mc146818rtc_info);
}
device_init(mc146818rtc_register)
diff --git a/hw/milkymist-ac97.c b/hw/milkymist-ac97.c
index 7dce5bcf5d..0881643a4c 100644
--- a/hw/milkymist-ac97.c
+++ b/hw/milkymist-ac97.c
@@ -321,22 +321,24 @@ static const VMStateDescription vmstate_milkymist_ac97 = {
static void milkymist_ac97_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_ac97_init;
+ dc->reset = milkymist_ac97_reset;
+ dc->vmsd = &vmstate_milkymist_ac97;
}
-static DeviceInfo milkymist_ac97_info = {
- .name = "milkymist-ac97",
- .size = sizeof(MilkymistAC97State),
- .vmsd = &vmstate_milkymist_ac97,
- .reset = milkymist_ac97_reset,
- .class_init = milkymist_ac97_class_init,
+static TypeInfo milkymist_ac97_info = {
+ .name = "milkymist-ac97",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistAC97State),
+ .class_init = milkymist_ac97_class_init,
};
static void milkymist_ac97_register(void)
{
- sysbus_register_withprop(&milkymist_ac97_info);
+ type_register_static(&milkymist_ac97_info);
}
device_init(milkymist_ac97_register)
diff --git a/hw/milkymist-hpdmc.c b/hw/milkymist-hpdmc.c
index 46e8ae6493..b5122afd57 100644
--- a/hw/milkymist-hpdmc.c
+++ b/hw/milkymist-hpdmc.c
@@ -147,22 +147,24 @@ static const VMStateDescription vmstate_milkymist_hpdmc = {
static void milkymist_hpdmc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_hpdmc_init;
+ dc->reset = milkymist_hpdmc_reset;
+ dc->vmsd = &vmstate_milkymist_hpdmc;
}
-static DeviceInfo milkymist_hpdmc_info = {
- .name = "milkymist-hpdmc",
- .size = sizeof(MilkymistHpdmcState),
- .vmsd = &vmstate_milkymist_hpdmc,
- .reset = milkymist_hpdmc_reset,
- .class_init = milkymist_hpdmc_class_init,
+static TypeInfo milkymist_hpdmc_info = {
+ .name = "milkymist-hpdmc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistHpdmcState),
+ .class_init = milkymist_hpdmc_class_init,
};
static void milkymist_hpdmc_register(void)
{
- sysbus_register_withprop(&milkymist_hpdmc_info);
+ type_register_static(&milkymist_hpdmc_info);
}
device_init(milkymist_hpdmc_register)
diff --git a/hw/milkymist-memcard.c b/hw/milkymist-memcard.c
index 97eb7938c4..3c1c68a2e7 100644
--- a/hw/milkymist-memcard.c
+++ b/hw/milkymist-memcard.c
@@ -280,22 +280,24 @@ static const VMStateDescription vmstate_milkymist_memcard = {
static void milkymist_memcard_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_memcard_init;
+ dc->reset = milkymist_memcard_reset;
+ dc->vmsd = &vmstate_milkymist_memcard;
}
-static DeviceInfo milkymist_memcard_info = {
- .name = "milkymist-memcard",
- .size = sizeof(MilkymistMemcardState),
- .vmsd = &vmstate_milkymist_memcard,
- .reset = milkymist_memcard_reset,
- .class_init = milkymist_memcard_class_init,
+static TypeInfo milkymist_memcard_info = {
+ .name = "milkymist-memcard",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistMemcardState),
+ .class_init = milkymist_memcard_class_init,
};
static void milkymist_memcard_register(void)
{
- sysbus_register_withprop(&milkymist_memcard_info);
+ type_register_static(&milkymist_memcard_info);
}
device_init(milkymist_memcard_register)
diff --git a/hw/milkymist-minimac2.c b/hw/milkymist-minimac2.c
index 1ac6c6a70a..b9b553fc95 100644
--- a/hw/milkymist-minimac2.c
+++ b/hw/milkymist-minimac2.c
@@ -526,23 +526,25 @@ static Property milkymist_minimac2_properties[] = {
static void milkymist_minimac2_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_minimac2_init;
+ dc->reset = milkymist_minimac2_reset;
+ dc->vmsd = &vmstate_milkymist_minimac2;
+ dc->props = milkymist_minimac2_properties;
}
-static DeviceInfo milkymist_minimac2_info = {
- .name = "milkymist-minimac2",
- .size = sizeof(MilkymistMinimac2State),
- .vmsd = &vmstate_milkymist_minimac2,
- .reset = milkymist_minimac2_reset,
- .props = milkymist_minimac2_properties,
- .class_init = milkymist_minimac2_class_init,
+static TypeInfo milkymist_minimac2_info = {
+ .name = "milkymist-minimac2",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistMinimac2State),
+ .class_init = milkymist_minimac2_class_init,
};
static void milkymist_minimac2_register(void)
{
- sysbus_register_withprop(&milkymist_minimac2_info);
+ type_register_static(&milkymist_minimac2_info);
}
device_init(milkymist_minimac2_register)
diff --git a/hw/milkymist-pfpu.c b/hw/milkymist-pfpu.c
index b6ade5a67e..1b73a4686b 100644
--- a/hw/milkymist-pfpu.c
+++ b/hw/milkymist-pfpu.c
@@ -521,22 +521,24 @@ static const VMStateDescription vmstate_milkymist_pfpu = {
static void milkymist_pfpu_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_pfpu_init;
+ dc->reset = milkymist_pfpu_reset;
+ dc->vmsd = &vmstate_milkymist_pfpu;
}
-static DeviceInfo milkymist_pfpu_info = {
- .name = "milkymist-pfpu",
- .size = sizeof(MilkymistPFPUState),
- .vmsd = &vmstate_milkymist_pfpu,
- .reset = milkymist_pfpu_reset,
- .class_init = milkymist_pfpu_class_init,
+static TypeInfo milkymist_pfpu_info = {
+ .name = "milkymist-pfpu",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistPFPUState),
+ .class_init = milkymist_pfpu_class_init,
};
static void milkymist_pfpu_register(void)
{
- sysbus_register_withprop(&milkymist_pfpu_info);
+ type_register_static(&milkymist_pfpu_info);
}
device_init(milkymist_pfpu_register)
diff --git a/hw/milkymist-softusb.c b/hw/milkymist-softusb.c
index f4d2dad714..5d496cbdb0 100644
--- a/hw/milkymist-softusb.c
+++ b/hw/milkymist-softusb.c
@@ -307,23 +307,25 @@ static Property milkymist_softusb_properties[] = {
static void milkymist_softusb_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_softusb_init;
+ dc->reset = milkymist_softusb_reset;
+ dc->vmsd = &vmstate_milkymist_softusb;
+ dc->props = milkymist_softusb_properties;
}
-static DeviceInfo milkymist_softusb_info = {
- .name = "milkymist-softusb",
- .size = sizeof(MilkymistSoftUsbState),
- .vmsd = &vmstate_milkymist_softusb,
- .reset = milkymist_softusb_reset,
- .props = milkymist_softusb_properties,
- .class_init = milkymist_softusb_class_init,
+static TypeInfo milkymist_softusb_info = {
+ .name = "milkymist-softusb",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistSoftUsbState),
+ .class_init = milkymist_softusb_class_init,
};
static void milkymist_softusb_register(void)
{
- sysbus_register_withprop(&milkymist_softusb_info);
+ type_register_static(&milkymist_softusb_info);
}
device_init(milkymist_softusb_register)
diff --git a/hw/milkymist-sysctl.c b/hw/milkymist-sysctl.c
index 4b017fad0a..18171f6165 100644
--- a/hw/milkymist-sysctl.c
+++ b/hw/milkymist-sysctl.c
@@ -306,23 +306,25 @@ static Property milkymist_sysctl_properties[] = {
static void milkymist_sysctl_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_sysctl_init;
+ dc->reset = milkymist_sysctl_reset;
+ dc->vmsd = &vmstate_milkymist_sysctl;
+ dc->props = milkymist_sysctl_properties;
}
-static DeviceInfo milkymist_sysctl_info = {
- .name = "milkymist-sysctl",
- .size = sizeof(MilkymistSysctlState),
- .vmsd = &vmstate_milkymist_sysctl,
- .reset = milkymist_sysctl_reset,
- .props = milkymist_sysctl_properties,
- .class_init = milkymist_sysctl_class_init,
+static TypeInfo milkymist_sysctl_info = {
+ .name = "milkymist-sysctl",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistSysctlState),
+ .class_init = milkymist_sysctl_class_init,
};
static void milkymist_sysctl_register(void)
{
- sysbus_register_withprop(&milkymist_sysctl_info);
+ type_register_static(&milkymist_sysctl_info);
}
device_init(milkymist_sysctl_register)
diff --git a/hw/milkymist-tmu2.c b/hw/milkymist-tmu2.c
index 4004a126d1..474eae0a4a 100644
--- a/hw/milkymist-tmu2.c
+++ b/hw/milkymist-tmu2.c
@@ -467,22 +467,24 @@ static const VMStateDescription vmstate_milkymist_tmu2 = {
static void milkymist_tmu2_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_tmu2_init;
+ dc->reset = milkymist_tmu2_reset;
+ dc->vmsd = &vmstate_milkymist_tmu2;
}
-static DeviceInfo milkymist_tmu2_info = {
- .name = "milkymist-tmu2",
- .size = sizeof(MilkymistTMU2State),
- .vmsd = &vmstate_milkymist_tmu2,
- .reset = milkymist_tmu2_reset,
- .class_init = milkymist_tmu2_class_init,
+static TypeInfo milkymist_tmu2_info = {
+ .name = "milkymist-tmu2",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistTMU2State),
+ .class_init = milkymist_tmu2_class_init,
};
static void milkymist_tmu2_register(void)
{
- sysbus_register_withprop(&milkymist_tmu2_info);
+ type_register_static(&milkymist_tmu2_info);
}
device_init(milkymist_tmu2_register)
diff --git a/hw/milkymist-uart.c b/hw/milkymist-uart.c
index 312976dfe5..2999b79633 100644
--- a/hw/milkymist-uart.c
+++ b/hw/milkymist-uart.c
@@ -220,22 +220,24 @@ static const VMStateDescription vmstate_milkymist_uart = {
static void milkymist_uart_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_uart_init;
+ dc->reset = milkymist_uart_reset;
+ dc->vmsd = &vmstate_milkymist_uart;
}
-static DeviceInfo milkymist_uart_info = {
- .name = "milkymist-uart",
- .size = sizeof(MilkymistUartState),
- .vmsd = &vmstate_milkymist_uart,
- .reset = milkymist_uart_reset,
- .class_init = milkymist_uart_class_init,
+static TypeInfo milkymist_uart_info = {
+ .name = "milkymist-uart",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistUartState),
+ .class_init = milkymist_uart_class_init,
};
static void milkymist_uart_register(void)
{
- sysbus_register_withprop(&milkymist_uart_info);
+ type_register_static(&milkymist_uart_info);
}
device_init(milkymist_uart_register)
diff --git a/hw/milkymist-vgafb.c b/hw/milkymist-vgafb.c
index 81d31fa10e..92ad02f9e2 100644
--- a/hw/milkymist-vgafb.c
+++ b/hw/milkymist-vgafb.c
@@ -307,23 +307,25 @@ static Property milkymist_vgafb_properties[] = {
static void milkymist_vgafb_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = milkymist_vgafb_init;
+ dc->reset = milkymist_vgafb_reset;
+ dc->vmsd = &vmstate_milkymist_vgafb;
+ dc->props = milkymist_vgafb_properties;
}
-static DeviceInfo milkymist_vgafb_info = {
- .name = "milkymist-vgafb",
- .size = sizeof(MilkymistVgafbState),
- .vmsd = &vmstate_milkymist_vgafb,
- .reset = milkymist_vgafb_reset,
- .props = milkymist_vgafb_properties,
- .class_init = milkymist_vgafb_class_init,
+static TypeInfo milkymist_vgafb_info = {
+ .name = "milkymist-vgafb",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MilkymistVgafbState),
+ .class_init = milkymist_vgafb_class_init,
};
static void milkymist_vgafb_register(void)
{
- sysbus_register_withprop(&milkymist_vgafb_info);
+ type_register_static(&milkymist_vgafb_info);
}
device_init(milkymist_vgafb_register)
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 64603ce2ca..d232630e66 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -1014,13 +1014,11 @@ static void mips_malta_class_init(ObjectClass *klass, void *data)
k->init = mips_malta_sysbus_device_init;
}
-static DeviceInfo mips_malta_device = {
- .name = "mips-malta",
- .size = sizeof(MaltaState),
- .class_init = mips_malta_class_init,
- .props = (Property[]) {
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo mips_malta_device = {
+ .name = "mips-malta",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MaltaState),
+ .class_init = mips_malta_class_init,
};
static QEMUMachine mips_malta_machine = {
@@ -1033,7 +1031,7 @@ static QEMUMachine mips_malta_machine = {
static void mips_malta_device_init(void)
{
- sysbus_qdev_register(&mips_malta_device);
+ type_register_static(&mips_malta_device);
}
static void mips_malta_machine_init(void)
diff --git a/hw/mipsnet.c b/hw/mipsnet.c
index 8cf9161a06..a0e6c9fa1e 100644
--- a/hw/mipsnet.c
+++ b/hw/mipsnet.c
@@ -259,24 +259,26 @@ static Property mipsnet_properties[] = {
static void mipsnet_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mipsnet_sysbus_init;
+ dc->desc = "MIPS Simulator network device";
+ dc->reset = mipsnet_sysbus_reset;
+ dc->vmsd = &vmstate_mipsnet;
+ dc->props = mipsnet_properties;
}
-static DeviceInfo mipsnet_info = {
- .name = "mipsnet",
- .desc = "MIPS Simulator network device",
- .size = sizeof(MIPSnetState),
- .vmsd = &vmstate_mipsnet,
- .reset = mipsnet_sysbus_reset,
- .props = mipsnet_properties,
- .class_init = mipsnet_class_init,
+static TypeInfo mipsnet_info = {
+ .name = "mipsnet",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MIPSnetState),
+ .class_init = mipsnet_class_init,
};
static void mipsnet_register_devices(void)
{
- sysbus_register_withprop(&mipsnet_info);
+ type_register_static(&mipsnet_info);
}
device_init(mipsnet_register_devices)
diff --git a/hw/mpc8544_guts.c b/hw/mpc8544_guts.c
index ec6bb4f317..28cd60d89c 100644
--- a/hw/mpc8544_guts.c
+++ b/hw/mpc8544_guts.c
@@ -128,14 +128,15 @@ static void mpc8544_guts_class_init(ObjectClass *klass, void *data)
k->init = mpc8544_guts_initfn;
}
-static DeviceInfo mpc8544_guts_info = {
- .name = "mpc8544-guts",
- .size = sizeof(GutsState),
- .class_init = mpc8544_guts_class_init,
+static TypeInfo mpc8544_guts_info = {
+ .name = "mpc8544-guts",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(GutsState),
+ .class_init = mpc8544_guts_class_init,
};
static void mpc8544_guts_register(void)
{
- sysbus_register_withprop(&mpc8544_guts_info);
+ type_register_static(&mpc8544_guts_info);
}
device_init(mpc8544_guts_register);
diff --git a/hw/mst_fpga.c b/hw/mst_fpga.c
index 513bfa63d9..1729db01a4 100644
--- a/hw/mst_fpga.c
+++ b/hw/mst_fpga.c
@@ -240,21 +240,23 @@ static VMStateDescription vmstate_mst_fpga_regs = {
static void mst_fpga_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mst_fpga_init;
+ dc->desc = "Mainstone II FPGA";
+ dc->vmsd = &vmstate_mst_fpga_regs;
}
-static DeviceInfo mst_fpga_info = {
- .name = "mainstone-fpga",
- .desc = "Mainstone II FPGA",
- .size = sizeof(mst_irq_state),
- .vmsd = &vmstate_mst_fpga_regs,
- .class_init = mst_fpga_class_init,
+static TypeInfo mst_fpga_info = {
+ .name = "mainstone-fpga",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mst_irq_state),
+ .class_init = mst_fpga_class_init,
};
static void mst_fpga_register(void)
{
- sysbus_register_withprop(&mst_fpga_info);
+ type_register_static(&mst_fpga_info);
}
device_init(mst_fpga_register);
diff --git a/hw/musicpal.c b/hw/musicpal.c
index a2fc4bb5e6..ac909248d4 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -419,17 +419,19 @@ static Property mv88w8618_eth_properties[] = {
static void mv88w8618_eth_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mv88w8618_eth_init;
+ dc->vmsd = &mv88w8618_eth_vmsd;
+ dc->props = mv88w8618_eth_properties;
}
-static DeviceInfo mv88w8618_eth_info = {
- .name = "mv88w8618_eth",
- .size = sizeof(mv88w8618_eth_state),
- .vmsd = &mv88w8618_eth_vmsd,
- .props = mv88w8618_eth_properties,
- .class_init = mv88w8618_eth_class_init,
+static TypeInfo mv88w8618_eth_info = {
+ .name = "mv88w8618_eth",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mv88w8618_eth_state),
+ .class_init = mv88w8618_eth_class_init,
};
/* LCD register offsets */
@@ -635,16 +637,18 @@ static const VMStateDescription musicpal_lcd_vmsd = {
static void musicpal_lcd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = musicpal_lcd_init;
+ dc->vmsd = &musicpal_lcd_vmsd;
}
-static DeviceInfo musicpal_lcd_info = {
- .name = "musicpal_lcd",
- .size = sizeof(musicpal_lcd_state),
- .vmsd = &musicpal_lcd_vmsd,
- .class_init = musicpal_lcd_class_init,
+static TypeInfo musicpal_lcd_info = {
+ .name = "musicpal_lcd",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(musicpal_lcd_state),
+ .class_init = musicpal_lcd_class_init,
};
/* PIC register offsets */
@@ -751,17 +755,19 @@ static const VMStateDescription mv88w8618_pic_vmsd = {
static void mv88w8618_pic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mv88w8618_pic_init;
+ dc->reset = mv88w8618_pic_reset;
+ dc->vmsd = &mv88w8618_pic_vmsd;
}
-static DeviceInfo mv88w8618_pic_info = {
- .name = "mv88w8618_pic",
- .size = sizeof(mv88w8618_pic_state),
- .reset = mv88w8618_pic_reset,
- .vmsd = &mv88w8618_pic_vmsd,
- .class_init = mv88w8618_pic_class_init,
+static TypeInfo mv88w8618_pic_info = {
+ .name = "mv88w8618_pic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mv88w8618_pic_state),
+ .class_init = mv88w8618_pic_class_init,
};
/* PIT register offsets */
@@ -926,17 +932,19 @@ static const VMStateDescription mv88w8618_pit_vmsd = {
static void mv88w8618_pit_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mv88w8618_pit_init;
+ dc->reset = mv88w8618_pit_reset;
+ dc->vmsd = &mv88w8618_pit_vmsd;
}
-static DeviceInfo mv88w8618_pit_info = {
- .name = "mv88w8618_pit",
- .size = sizeof(mv88w8618_pit_state),
- .reset = mv88w8618_pit_reset,
- .vmsd = &mv88w8618_pit_vmsd,
- .class_init = mv88w8618_pit_class_init,
+static TypeInfo mv88w8618_pit_info = {
+ .name = "mv88w8618_pit",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mv88w8618_pit_state),
+ .class_init = mv88w8618_pit_class_init,
};
/* Flash config register offsets */
@@ -1005,16 +1013,18 @@ static const VMStateDescription mv88w8618_flashcfg_vmsd = {
static void mv88w8618_flashcfg_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = mv88w8618_flashcfg_init;
+ dc->vmsd = &mv88w8618_flashcfg_vmsd;
}
-static DeviceInfo mv88w8618_flashcfg_info = {
- .name = "mv88w8618_flashcfg",
- .size = sizeof(mv88w8618_flashcfg_state),
- .vmsd = &mv88w8618_flashcfg_vmsd,
- .class_init = mv88w8618_flashcfg_class_init,
+static TypeInfo mv88w8618_flashcfg_info = {
+ .name = "mv88w8618_flashcfg",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(mv88w8618_flashcfg_state),
+ .class_init = mv88w8618_flashcfg_class_init,
};
/* Misc register offsets */
@@ -1324,17 +1334,19 @@ static const VMStateDescription musicpal_gpio_vmsd = {
static void musicpal_gpio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = musicpal_gpio_init;
+ dc->reset = musicpal_gpio_reset;
+ dc->vmsd = &musicpal_gpio_vmsd;
}
-static DeviceInfo musicpal_gpio_info = {
- .name = "musicpal_gpio",
- .size = sizeof(musicpal_gpio_state),
- .reset = musicpal_gpio_reset,
- .vmsd = &musicpal_gpio_vmsd,
- .class_init = musicpal_gpio_class_init,
+static TypeInfo musicpal_gpio_info = {
+ .name = "musicpal_gpio",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(musicpal_gpio_state),
+ .class_init = musicpal_gpio_class_init,
};
/* Keyboard codes & masks */
@@ -1477,16 +1489,18 @@ static const VMStateDescription musicpal_key_vmsd = {
static void musicpal_key_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = musicpal_key_init;
+ dc->vmsd = &musicpal_key_vmsd;
}
-static DeviceInfo musicpal_key_info = {
- .name = "musicpal_key",
- .size = sizeof(musicpal_key_state),
- .vmsd = &musicpal_key_vmsd,
- .class_init = musicpal_key_class_init,
+static TypeInfo musicpal_key_info = {
+ .name = "musicpal_key",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(musicpal_key_state),
+ .class_init = musicpal_key_class_init,
};
static struct arm_boot_info musicpal_binfo = {
@@ -1660,22 +1674,23 @@ static void mv88w8618_wlan_class_init(ObjectClass *klass, void *data)
sdc->init = mv88w8618_wlan_init;
}
-static DeviceInfo mv88w8618_wlan_info = {
- .name = "mv88w8618_wlan",
- .size = sizeof(SysBusDevice),
- .class_init = mv88w8618_wlan_class_init,
+static TypeInfo mv88w8618_wlan_info = {
+ .name = "mv88w8618_wlan",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusDevice),
+ .class_init = mv88w8618_wlan_class_init,
};
static void musicpal_register_devices(void)
{
- sysbus_register_withprop(&mv88w8618_pic_info);
- sysbus_register_withprop(&mv88w8618_pit_info);
- sysbus_register_withprop(&mv88w8618_flashcfg_info);
- sysbus_register_withprop(&mv88w8618_eth_info);
- sysbus_qdev_register(&mv88w8618_wlan_info);
- sysbus_register_withprop(&musicpal_lcd_info);
- sysbus_register_withprop(&musicpal_gpio_info);
- sysbus_register_withprop(&musicpal_key_info);
+ type_register_static(&mv88w8618_pic_info);
+ type_register_static(&mv88w8618_pit_info);
+ type_register_static(&mv88w8618_flashcfg_info);
+ type_register_static(&mv88w8618_eth_info);
+ type_register_static(&mv88w8618_wlan_info);
+ type_register_static(&musicpal_lcd_info);
+ type_register_static(&musicpal_gpio_info);
+ type_register_static(&musicpal_key_info);
}
device_init(musicpal_register_devices)
diff --git a/hw/nand.c b/hw/nand.c
index 62487311ff..5d947b1ced 100644
--- a/hw/nand.c
+++ b/hw/nand.c
@@ -426,23 +426,25 @@ static Property nand_properties[] = {
static void nand_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = nand_device_init;
+ dc->reset = nand_reset;
+ dc->vmsd = &vmstate_nand;
+ dc->props = nand_properties;
}
-static DeviceInfo nand_info = {
- .name = "nand",
- .size = sizeof(NANDFlashState),
- .reset = nand_reset,
- .vmsd = &vmstate_nand,
- .props = nand_properties,
- .class_init = nand_class_init,
+static TypeInfo nand_info = {
+ .name = "nand",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(NANDFlashState),
+ .class_init = nand_class_init,
};
static void nand_create_device(void)
{
- sysbus_register_withprop(&nand_info);
+ type_register_static(&nand_info);
}
/*
diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 25a7a31d25..1352282152 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -82,27 +82,31 @@ static int isa_ne2000_initfn(ISADevice *dev)
return 0;
}
+static Property ne2000_isa_properties[] = {
+ DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
+ DEFINE_PROP_UINT32("irq", ISANE2000State, isairq, 9),
+ DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = isa_ne2000_initfn;
+ dc->props = ne2000_isa_properties;
}
-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),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo ne2000_isa_info = {
+ .name = "ne2k_isa",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISANE2000State),
+ .class_init = isa_ne2000_class_initfn,
};
static void ne2000_isa_register_devices(void)
{
- isa_qdev_register(&ne2000_isa_info);
+ type_register_static(&ne2000_isa_info);
}
device_init(ne2000_isa_register_devices)
diff --git a/hw/ne2000.c b/hw/ne2000.c
index 138479a564..080811ec4d 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -793,6 +793,7 @@ static Property ne2000_properties[] = {
static void ne2000_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_ne2000_init;
@@ -800,19 +801,20 @@ static void ne2000_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_REALTEK;
k->device_id = PCI_DEVICE_ID_REALTEK_8029;
k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+ dc->vmsd = &vmstate_pci_ne2000;
+ dc->props = ne2000_properties;
}
-static DeviceInfo ne2000_info = {
- .name = "ne2k_pci",
- .size = sizeof(PCINE2000State),
- .vmsd = &vmstate_pci_ne2000,
- .props = ne2000_properties,
- .class_init = ne2000_class_init,
+static TypeInfo ne2000_info = {
+ .name = "ne2k_pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCINE2000State),
+ .class_init = ne2000_class_init,
};
static void ne2000_register_devices(void)
{
- pci_qdev_register(&ne2000_info);
+ type_register_static(&ne2000_info);
}
device_init(ne2000_register_devices)
diff --git a/hw/omap_gpio.c b/hw/omap_gpio.c
index 97d2d9397e..9a9a8e183f 100644
--- a/hw/omap_gpio.c
+++ b/hw/omap_gpio.c
@@ -739,17 +739,19 @@ static Property omap_gpio_properties[] = {
static void omap_gpio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = omap_gpio_init;
+ dc->reset = omap_gpif_reset;
+ dc->props = omap_gpio_properties;
}
-static DeviceInfo omap_gpio_info = {
- .name = "omap-gpio",
- .size = sizeof(struct omap_gpif_s),
- .reset = omap_gpif_reset,
- .props = omap_gpio_properties,
- .class_init = omap_gpio_class_init,
+static TypeInfo omap_gpio_info = {
+ .name = "omap-gpio",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct omap_gpif_s),
+ .class_init = omap_gpio_class_init,
};
static Property omap2_gpio_properties[] = {
@@ -766,23 +768,25 @@ static Property omap2_gpio_properties[] = {
static void omap2_gpio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = omap2_gpio_init;
+ dc->reset = omap2_gpif_reset;
+ dc->props = omap2_gpio_properties;
}
-static DeviceInfo omap2_gpio_info = {
- .name = "omap2-gpio",
- .size = sizeof(struct omap2_gpif_s),
- .reset = omap2_gpif_reset,
- .props = omap2_gpio_properties,
- .class_init = omap2_gpio_class_init,
+static TypeInfo omap2_gpio_info = {
+ .name = "omap2-gpio",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct omap2_gpif_s),
+ .class_init = omap2_gpio_class_init,
};
static void omap_gpio_register_device(void)
{
- sysbus_register_withprop(&omap_gpio_info);
- sysbus_register_withprop(&omap2_gpio_info);
+ type_register_static(&omap_gpio_info);
+ type_register_static(&omap2_gpio_info);
}
device_init(omap_gpio_register_device)
diff --git a/hw/omap_intc.c b/hw/omap_intc.c
index 310fe2daae..5aa98a8fdb 100644
--- a/hw/omap_intc.c
+++ b/hw/omap_intc.c
@@ -381,17 +381,19 @@ static Property omap_intc_properties[] = {
static void omap_intc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = omap_intc_init;
+ dc->reset = omap_inth_reset;
+ dc->props = omap_intc_properties;
}
-static DeviceInfo omap_intc_info = {
- .name = "omap-intc",
- .size = sizeof(struct omap_intr_handler_s),
- .reset = omap_inth_reset,
- .props = omap_intc_properties,
- .class_init = omap_intc_class_init,
+static TypeInfo omap_intc_info = {
+ .name = "omap-intc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct omap_intr_handler_s),
+ .class_init = omap_intc_class_init,
};
static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
@@ -623,23 +625,25 @@ static Property omap2_intc_properties[] = {
static void omap2_intc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = omap2_intc_init;
+ dc->reset = omap_inth_reset;
+ dc->props = omap2_intc_properties;
}
-static DeviceInfo omap2_intc_info = {
- .name = "omap2-intc",
- .size = sizeof(struct omap_intr_handler_s),
- .reset = omap_inth_reset,
- .props = omap2_intc_properties,
- .class_init = omap2_intc_class_init,
+static TypeInfo omap2_intc_info = {
+ .name = "omap2-intc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct omap_intr_handler_s),
+ .class_init = omap2_intc_class_init,
};
static void omap_intc_register_device(void)
{
- sysbus_register_withprop(&omap_intc_info);
- sysbus_register_withprop(&omap2_intc_info);
+ type_register_static(&omap_intc_info);
+ type_register_static(&omap2_intc_info);
}
device_init(omap_intc_register_device)
diff --git a/hw/onenand.c b/hw/onenand.c
index e20d4d98cb..8744b04db3 100644
--- a/hw/onenand.c
+++ b/hw/onenand.c
@@ -813,22 +813,24 @@ static Property onenand_properties[] = {
static void onenand_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = onenand_initfn;
+ dc->reset = onenand_system_reset;
+ dc->props = onenand_properties;
}
-static DeviceInfo onenand_info = {
- .name = "onenand",
- .size = sizeof(OneNANDState),
- .reset = onenand_system_reset,
- .props = onenand_properties,
- .class_init = onenand_class_init,
+static TypeInfo onenand_info = {
+ .name = "onenand",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(OneNANDState),
+ .class_init = onenand_class_init,
};
static void onenand_register_device(void)
{
- sysbus_register_withprop(&onenand_info);
+ type_register_static(&onenand_info);
}
void *onenand_raw_otp(DeviceState *onenand_device)
diff --git a/hw/opencores_eth.c b/hw/opencores_eth.c
index 1f45506100..09f2757df3 100644
--- a/hw/opencores_eth.c
+++ b/hw/opencores_eth.c
@@ -734,23 +734,25 @@ static Property open_eth_properties[] = {
static void open_eth_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sysbus_open_eth_init;
+ dc->desc = "Opencores 10/100 Mbit Ethernet";
+ dc->reset = qdev_open_eth_reset;
+ dc->props = open_eth_properties;
}
-static DeviceInfo open_eth_info = {
- .name = "open_eth",
- .desc = "Opencores 10/100 Mbit Ethernet",
- .size = sizeof(OpenEthState),
- .reset = qdev_open_eth_reset,
- .props = open_eth_properties,
- .class_init = open_eth_class_init,
+static TypeInfo open_eth_info = {
+ .name = "open_eth",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(OpenEthState),
+ .class_init = open_eth_class_init,
};
static void open_eth_register_devices(void)
{
- sysbus_register_withprop(&open_eth_info);
+ type_register_static(&open_eth_info);
}
device_init(open_eth_register_devices)
diff --git a/hw/parallel.c b/hw/parallel.c
index cadcffbd86..484d727927 100644
--- a/hw/parallel.c
+++ b/hw/parallel.c
@@ -583,28 +583,32 @@ bool parallel_mm_init(MemoryRegion *address_space,
return true;
}
+static Property parallel_isa_properties[] = {
+ DEFINE_PROP_UINT32("index", ISAParallelState, index, -1),
+ DEFINE_PROP_HEX32("iobase", ISAParallelState, iobase, -1),
+ DEFINE_PROP_UINT32("irq", ISAParallelState, isairq, 7),
+ DEFINE_PROP_CHR("chardev", ISAParallelState, state.chr),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void parallel_isa_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = parallel_isa_initfn;
+ dc->props = parallel_isa_properties;
}
-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),
- DEFINE_PROP_CHR("chardev", ISAParallelState, state.chr),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo parallel_isa_info = {
+ .name = "isa-parallel",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAParallelState),
+ .class_init = parallel_isa_class_initfn,
};
static void parallel_register_devices(void)
{
- isa_qdev_register(&parallel_isa_info);
+ type_register_static(&parallel_isa_info);
}
device_init(parallel_register_devices)
diff --git a/hw/pc.c b/hw/pc.c
index 31608d3d52..7f3aa65d20 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -499,22 +499,24 @@ static int port92_initfn(ISADevice *dev)
static void port92_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = port92_initfn;
+ dc->no_user = 1;
+ dc->reset = port92_reset;
+ dc->vmsd = &vmstate_port92_isa;
}
-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 TypeInfo port92_info = {
+ .name = "port92",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(Port92State),
+ .class_init = port92_class_initfn,
};
static void port92_register(void)
{
- isa_qdev_register(&port92_info);
+ type_register_static(&port92_info);
}
device_init(port92_register)
diff --git a/hw/pci.c b/hw/pci.c
index 43dc1fb3f8..8fd450c9e9 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1521,17 +1521,6 @@ static int pci_unplug_device(DeviceState *qdev)
PCI_HOTPLUG_DISABLED);
}
-void pci_qdev_register(DeviceInfo *info)
-{
- info->init = pci_qdev_init;
- if (!info->unplug) {
- info->unplug = pci_unplug_device;
- }
- info->exit = pci_unregister_device;
- info->bus_info = &pci_bus_info;
- qdev_register_subclass(info, TYPE_PCI_DEVICE);
-}
-
PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
const char *name)
{
@@ -1995,12 +1984,22 @@ MemoryRegion *pci_address_space_io(PCIDevice *dev)
return dev->bus->address_space_io;
}
+static void pci_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = pci_qdev_init;
+ k->unplug = pci_unplug_device;
+ k->exit = pci_unregister_device;
+ k->bus_info = &pci_bus_info;
+}
+
static TypeInfo pci_device_type_info = {
.name = TYPE_PCI_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(PCIDevice),
.abstract = true,
.class_size = sizeof(PCIDeviceClass),
+ .class_init = pci_device_class_init,
};
static void pci_register_devices(void)
diff --git a/hw/pci.h b/hw/pci.h
index 09b232453b..33b0b184ea 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -464,8 +464,6 @@ pci_quad_test_and_set_mask(uint8_t *config, uint64_t mask)
return val & mask;
}
-void pci_qdev_register(DeviceInfo *info);
-
PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
const char *name);
PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
diff --git a/hw/pckbd.c b/hw/pckbd.c
index 2ebe1c534c..b4c53bed6c 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -499,20 +499,22 @@ static int i8042_initfn(ISADevice *dev)
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->no_user = 1;
+ dc->vmsd = &vmstate_kbd_isa;
}
-static DeviceInfo i8042_info = {
- .name = "i8042",
- .size = sizeof(ISAKBDState),
- .vmsd = &vmstate_kbd_isa,
- .no_user = 1,
- .class_init = i8042_class_initfn,
+static TypeInfo i8042_info = {
+ .name = "i8042",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAKBDState),
+ .class_init = i8042_class_initfn,
};
static void i8042_register(void)
{
- isa_qdev_register(&i8042_info);
+ type_register_static(&i8042_info);
}
device_init(i8042_register)
diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
index be3bd79ae8..439f32caae 100644
--- a/hw/pcnet-pci.c
+++ b/hw/pcnet-pci.c
@@ -355,6 +355,7 @@ static Property pcnet_properties[] = {
static void pcnet_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_pcnet_init;
@@ -363,20 +364,21 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_AMD_LANCE;
k->revision = 0x10;
k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+ dc->reset = pci_reset;
+ dc->vmsd = &vmstate_pci_pcnet;
+ dc->props = pcnet_properties;
}
-static DeviceInfo pcnet_info = {
- .name = "pcnet",
- .size = sizeof(PCIPCNetState),
- .reset = pci_reset,
- .vmsd = &vmstate_pci_pcnet,
- .props = pcnet_properties,
- .class_init = pcnet_class_init,
+static TypeInfo pcnet_info = {
+ .name = "pcnet",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIPCNetState),
+ .class_init = pcnet_class_init,
};
static void pci_pcnet_register_devices(void)
{
- pci_qdev_register(&pcnet_info);
+ type_register_static(&pcnet_info);
}
device_init(pci_pcnet_register_devices)
diff --git a/hw/piix4.c b/hw/piix4.c
index 88be53587c..4e7a2370cd 100644
--- a/hw/piix4.c
+++ b/hw/piix4.c
@@ -104,6 +104,7 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
static void piix4_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -111,19 +112,20 @@ static void piix4_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
k->class_id = PCI_CLASS_BRIDGE_ISA;
+ dc->desc = "ISA bridge";
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_piix4;
}
-static DeviceInfo piix4_info = {
- .name = "PIIX4",
- .desc = "ISA bridge",
- .size = sizeof(PIIX4State),
- .vmsd = &vmstate_piix4,
- .no_user = 1,
- .class_init = piix4_class_init,
+static TypeInfo piix4_info = {
+ .name = "PIIX4",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PIIX4State),
+ .class_init = piix4_class_init,
};
static void piix4_register(void)
{
- pci_qdev_register(&piix4_info);
+ type_register_static(&piix4_info);
}
device_init(piix4_register);
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 8b01782d0f..2bbfa4af00 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -504,8 +504,12 @@ static int piix3_initfn(PCIDevice *dev)
static void piix3_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ dc->desc = "ISA bridge";
+ dc->vmsd = &vmstate_piix3;
+ dc->no_user = 1,
k->no_hotplug = 1;
k->init = piix3_initfn;
k->config_write = piix3_write_config;
@@ -514,19 +518,21 @@ static void piix3_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_ISA;
}
-static DeviceInfo piix3_info = {
- .name = "PIIX3",
- .desc = "ISA bridge",
- .size = sizeof(PIIX3State),
- .vmsd = &vmstate_piix3,
- .no_user = 1,
- .class_init = piix3_class_init,
+static TypeInfo piix3_info = {
+ .name = "PIIX3",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PIIX3State),
+ .class_init = piix3_class_init,
};
static void piix3_xen_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ dc->desc = "ISA bridge";
+ dc->vmsd = &vmstate_piix3;
+ dc->no_user = 1;
k->no_hotplug = 1;
k->init = piix3_initfn;
k->config_write = piix3_write_config_xen;
@@ -535,17 +541,16 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_ISA;
};
-static DeviceInfo piix3_xen_info = {
- .name = "PIIX3-xen",
- .desc = "ISA bridge",
- .size = sizeof(PIIX3State),
- .vmsd = &vmstate_piix3,
- .no_user = 1,
- .class_init = piix3_xen_class_init,
+static TypeInfo piix3_xen_info = {
+ .name = "PIIX3-xen",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PIIX3State),
+ .class_init = piix3_xen_class_init,
};
static void i440fx_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -555,37 +560,40 @@ static void i440fx_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82441;
k->revision = 0x02;
k->class_id = PCI_CLASS_BRIDGE_HOST;
+ dc->desc = "Host bridge";
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_i440fx;
}
-static DeviceInfo i440fx_info = {
- .name = "i440FX",
- .desc = "Host bridge",
- .size = sizeof(PCII440FXState),
- .vmsd = &vmstate_i440fx,
- .no_user = 1,
- .class_init = i440fx_class_init,
+static TypeInfo i440fx_info = {
+ .name = "i440FX",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCII440FXState),
+ .class_init = i440fx_class_init,
};
static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = i440fx_pcihost_initfn;
+ dc->fw_name = "pci";
+ dc->no_user = 1;
}
-static DeviceInfo i440fx_pcihost_info = {
- .name = "i440FX-pcihost",
- .fw_name = "pci",
- .size = sizeof(I440FXState),
- .no_user = 1,
- .class_init = i440fx_pcihost_class_init,
+static TypeInfo i440fx_pcihost_info = {
+ .name = "i440FX-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(I440FXState),
+ .class_init = i440fx_pcihost_class_init,
};
static void i440fx_register(void)
{
- pci_qdev_register(&i440fx_info);
- pci_qdev_register(&piix3_info);
- pci_qdev_register(&piix3_xen_info);
- sysbus_register_withprop(&i440fx_pcihost_info);
+ type_register_static(&i440fx_info);
+ type_register_static(&piix3_info);
+ type_register_static(&piix3_xen_info);
+ type_register_static(&i440fx_pcihost_info);
}
device_init(i440fx_register);
diff --git a/hw/pl011.c b/hw/pl011.c
index 088aa44a3b..8db2248563 100644
--- a/hw/pl011.c
+++ b/hw/pl011.c
@@ -295,10 +295,11 @@ static void pl011_arm_class_init(ObjectClass *klass, void *data)
sdc->init = pl011_arm_init;
}
-static DeviceInfo pl011_arm_info = {
- .name = "pl011",
- .size = sizeof(pl011_state),
- .class_init = pl011_arm_class_init,
+static TypeInfo pl011_arm_info = {
+ .name = "pl011",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl011_state),
+ .class_init = pl011_arm_class_init,
};
static void pl011_luminary_class_init(ObjectClass *klass, void *data)
@@ -308,16 +309,17 @@ static void pl011_luminary_class_init(ObjectClass *klass, void *data)
sdc->init = pl011_luminary_init;
}
-static DeviceInfo pl011_luminary_info = {
- .name = "pl011_luminary",
- .size = sizeof(pl011_state),
- .class_init = pl011_luminary_class_init,
+static TypeInfo pl011_luminary_info = {
+ .name = "pl011_luminary",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl011_state),
+ .class_init = pl011_luminary_class_init,
};
static void pl011_register_devices(void)
{
- sysbus_qdev_register(&pl011_arm_info);
- sysbus_qdev_register(&pl011_luminary_info);
+ type_register_static(&pl011_arm_info);
+ type_register_static(&pl011_luminary_info);
}
device_init(pl011_register_devices)
diff --git a/hw/pl022.c b/hw/pl022.c
index 4f627126fa..30bd3442bb 100644
--- a/hw/pl022.c
+++ b/hw/pl022.c
@@ -292,15 +292,16 @@ static void pl022_class_init(ObjectClass *klass, void *data)
sdc->init = pl022_init;
}
-static DeviceInfo pl022_info = {
- .name = "pl022",
- .size = sizeof(pl022_state),
- .class_init = pl022_class_init,
+static TypeInfo pl022_info = {
+ .name = "pl022",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl022_state),
+ .class_init = pl022_class_init,
};
static void pl022_register_devices(void)
{
- sysbus_qdev_register(&pl022_info);
+ type_register_static(&pl022_info);
}
device_init(pl022_register_devices)
diff --git a/hw/pl031.c b/hw/pl031.c
index 4cb8528aee..8416a609ef 100644
--- a/hw/pl031.c
+++ b/hw/pl031.c
@@ -215,22 +215,24 @@ static int pl031_init(SysBusDevice *dev)
static void pl031_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl031_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_pl031;
}
-static DeviceInfo pl031_info = {
- .name = "pl031",
- .size = sizeof(pl031_state),
- .vmsd = &vmstate_pl031,
- .no_user = 1,
- .class_init = pl031_class_init,
+static TypeInfo pl031_info = {
+ .name = "pl031",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl031_state),
+ .class_init = pl031_class_init,
};
static void pl031_register_devices(void)
{
- sysbus_register_withprop(&pl031_info);
+ type_register_static(&pl031_info);
}
device_init(pl031_register_devices)
diff --git a/hw/pl041.c b/hw/pl041.c
index 04828516c4..6d99c9cbbc 100644
--- a/hw/pl041.c
+++ b/hw/pl041.c
@@ -621,24 +621,26 @@ static Property pl041_device_properties[] = {
static void pl041_device_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl041_init;
+ dc->no_user = 1;
+ dc->reset = pl041_device_reset;
+ dc->vmsd = &vmstate_pl041;
+ dc->props = pl041_device_properties;
}
-static DeviceInfo pl041_device_info = {
- .name = "pl041",
- .size = sizeof(pl041_state),
- .vmsd = &vmstate_pl041,
- .reset = pl041_device_reset,
- .no_user = 1,
- .props = pl041_device_properties,
- .class_init = pl041_device_class_init,
+static TypeInfo pl041_device_info = {
+ .name = "pl041",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl041_state),
+ .class_init = pl041_device_class_init,
};
static void pl041_register_device(void)
{
- sysbus_register_withprop(&pl041_device_info);
+ type_register_static(&pl041_device_info);
}
device_init(pl041_register_device)
diff --git a/hw/pl050.c b/hw/pl050.c
index 5f605083ee..b0094ac9b3 100644
--- a/hw/pl050.c
+++ b/hw/pl050.c
@@ -159,36 +159,40 @@ static int pl050_init_mouse(SysBusDevice *dev)
static void pl050_kbd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl050_init_keyboard;
+ dc->vmsd = &vmstate_pl050;
}
-static DeviceInfo pl050_kbd_info = {
- .name = "pl050_keyboard",
- .size = sizeof(pl050_state),
- .vmsd = &vmstate_pl050,
- .class_init = pl050_kbd_class_init,
+static TypeInfo pl050_kbd_info = {
+ .name = "pl050_keyboard",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl050_state),
+ .class_init = pl050_kbd_class_init,
};
static void pl050_mouse_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl050_init_mouse;
+ dc->vmsd = &vmstate_pl050;
}
-static DeviceInfo pl050_mouse_info = {
- .name = "pl050_mouse",
- .size = sizeof(pl050_state),
- .vmsd = &vmstate_pl050,
- .class_init = pl050_mouse_class_init,
+static TypeInfo pl050_mouse_info = {
+ .name = "pl050_mouse",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl050_state),
+ .class_init = pl050_mouse_class_init,
};
static void pl050_register_devices(void)
{
- sysbus_register_withprop(&pl050_kbd_info);
- sysbus_register_withprop(&pl050_mouse_info);
+ type_register_static(&pl050_kbd_info);
+ type_register_static(&pl050_mouse_info);
}
device_init(pl050_register_devices)
diff --git a/hw/pl061.c b/hw/pl061.c
index 9dc9406c28..3136c99423 100644
--- a/hw/pl061.c
+++ b/hw/pl061.c
@@ -295,36 +295,40 @@ static int pl061_init_arm(SysBusDevice *dev)
static void pl061_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl061_init_arm;
+ dc->vmsd = &vmstate_pl061;
}
-static DeviceInfo pl061_info = {
- .name = "pl061",
- .size = sizeof(pl061_state),
- .vmsd = &vmstate_pl061,
- .class_init = pl061_class_init,
+static TypeInfo pl061_info = {
+ .name = "pl061",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl061_state),
+ .class_init = pl061_class_init,
};
static void pl061_luminary_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl061_init_luminary;
+ dc->vmsd = &vmstate_pl061;
}
-static DeviceInfo pl061_luminary_info = {
- .name = "pl061_luminary",
- .size = sizeof(pl061_state),
- .vmsd = &vmstate_pl061,
- .class_init = pl061_luminary_class_init,
+static TypeInfo pl061_luminary_info = {
+ .name = "pl061_luminary",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl061_state),
+ .class_init = pl061_luminary_class_init,
};
static void pl061_register_devices(void)
{
- sysbus_register_withprop(&pl061_info);
- sysbus_register_withprop(&pl061_luminary_info);
+ type_register_static(&pl061_info);
+ type_register_static(&pl061_luminary_info);
}
device_init(pl061_register_devices)
diff --git a/hw/pl080.c b/hw/pl080.c
index 727bfa13d0..4405d1823b 100644
--- a/hw/pl080.c
+++ b/hw/pl080.c
@@ -375,40 +375,44 @@ static int pl081_init(SysBusDevice *dev)
static void pl080_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl080_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_pl080;
}
-static DeviceInfo pl080_info = {
- .name = "pl080",
- .size = sizeof(pl080_state),
- .vmsd = &vmstate_pl080,
- .no_user = 1,
- .class_init = pl080_class_init,
+static TypeInfo pl080_info = {
+ .name = "pl080",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl080_state),
+ .class_init = pl080_class_init,
};
static void pl081_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl081_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_pl080;
}
-static DeviceInfo pl081_info = {
- .name = "pl081",
- .size = sizeof(pl080_state),
- .vmsd = &vmstate_pl080,
- .no_user = 1,
- .class_init = pl081_class_init,
+static TypeInfo pl081_info = {
+ .name = "pl081",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl080_state),
+ .class_init = pl081_class_init,
};
/* The PL080 and PL081 are the same except for the number of channels
they implement (8 and 2 respectively). */
static void pl080_register_devices(void)
{
- sysbus_register_withprop(&pl080_info);
- sysbus_register_withprop(&pl081_info);
+ type_register_static(&pl080_info);
+ type_register_static(&pl081_info);
}
device_init(pl080_register_devices)
diff --git a/hw/pl110.c b/hw/pl110.c
index 58fb9d3597..86e95a3ffd 100644
--- a/hw/pl110.c
+++ b/hw/pl110.c
@@ -471,54 +471,60 @@ static int pl111_init(SysBusDevice *dev)
static void pl110_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl110_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_pl110;
}
-static DeviceInfo pl110_info = {
- .name = "pl110",
- .size = sizeof(pl110_state),
- .vmsd = &vmstate_pl110,
- .no_user = 1,
- .class_init = pl110_class_init,
+static TypeInfo pl110_info = {
+ .name = "pl110",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl110_state),
+ .class_init = pl110_class_init,
};
static void pl110_versatile_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl110_versatile_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_pl110;
}
-static DeviceInfo pl110_versatile_info = {
- .name = "pl110_versatile",
- .size = sizeof(pl110_state),
- .vmsd = &vmstate_pl110,
- .no_user = 1,
- .class_init = pl110_versatile_class_init,
+static TypeInfo pl110_versatile_info = {
+ .name = "pl110_versatile",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl110_state),
+ .class_init = pl110_versatile_class_init,
};
static void pl111_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl111_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_pl110;
}
-static DeviceInfo pl111_info = {
- .name = "pl111",
- .size = sizeof(pl110_state),
- .vmsd = &vmstate_pl110,
- .no_user = 1,
- .class_init = pl111_class_init,
+static TypeInfo pl111_info = {
+ .name = "pl111",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl110_state),
+ .class_init = pl111_class_init,
};
static void pl110_register_devices(void)
{
- sysbus_register_withprop(&pl110_info);
- sysbus_register_withprop(&pl110_versatile_info);
- sysbus_register_withprop(&pl111_info);
+ type_register_static(&pl110_info);
+ type_register_static(&pl110_versatile_info);
+ type_register_static(&pl111_info);
}
device_init(pl110_register_devices)
diff --git a/hw/pl181.c b/hw/pl181.c
index 973d3fcf0e..ae636e220e 100644
--- a/hw/pl181.c
+++ b/hw/pl181.c
@@ -490,22 +490,24 @@ static int pl181_init(SysBusDevice *dev)
static void pl181_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *k = DEVICE_CLASS(klass);
sdc->init = pl181_init;
+ k->vmsd = &vmstate_pl181;
+ k->reset = pl181_reset;
+ k->no_user = 1;
}
-static DeviceInfo pl181_info = {
- .name = "pl181",
- .size = sizeof(pl181_state),
- .class_init = pl181_class_init,
- .vmsd = &vmstate_pl181,
- .reset = pl181_reset,
- .no_user = 1,
+static TypeInfo pl181_info = {
+ .name = "pl181",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl181_state),
+ .class_init = pl181_class_init,
};
static void pl181_register_devices(void)
{
- sysbus_qdev_register(&pl181_info);
+ type_register_static(&pl181_info);
}
device_init(pl181_register_devices)
diff --git a/hw/pl190.c b/hw/pl190.c
index 79322aafbf..956ab21c6a 100644
--- a/hw/pl190.c
+++ b/hw/pl190.c
@@ -257,23 +257,25 @@ static const VMStateDescription vmstate_pl190 = {
static void pl190_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pl190_init;
+ dc->no_user = 1;
+ dc->reset = pl190_reset;
+ dc->vmsd = &vmstate_pl190;
}
-static DeviceInfo pl190_info = {
- .name = "pl190",
- .size = sizeof(pl190_state),
- .vmsd = &vmstate_pl190,
- .reset = pl190_reset,
- .no_user = 1,
- .class_init = pl190_class_init,
+static TypeInfo pl190_info = {
+ .name = "pl190",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(pl190_state),
+ .class_init = pl190_class_init,
};
static void pl190_register_devices(void)
{
- sysbus_register_withprop(&pl190_info);
+ type_register_static(&pl190_info);
}
device_init(pl190_register_devices)
diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c
index 36fb9f970f..d11f120d32 100644
--- a/hw/ppc4xx_pci.c
+++ b/hw/ppc4xx_pci.c
@@ -369,36 +369,40 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev)
static void ppc4xx_host_bridge_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->desc = "Host bridge";
k->vendor_id = PCI_VENDOR_ID_IBM;
k->device_id = PCI_DEVICE_ID_IBM_440GX;
k->class_id = PCI_CLASS_BRIDGE_OTHER;
}
-static DeviceInfo ppc4xx_host_bridge_info = {
- .name = "ppc4xx-host-bridge",
- .desc = "Host bridge",
- .size = sizeof(PCIDevice),
- .class_init = ppc4xx_host_bridge_class_init,
+static TypeInfo ppc4xx_host_bridge_info = {
+ .name = "ppc4xx-host-bridge",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = ppc4xx_host_bridge_class_init,
};
static void ppc4xx_pcihost_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = ppc4xx_pcihost_initfn;
+ dc->vmsd = &vmstate_ppc4xx_pci;
}
-static DeviceInfo ppc4xx_pcihost_info = {
- .name = "ppc4xx-pcihost",
- .size = sizeof(PPC4xxPCIState),
- .vmsd = &vmstate_ppc4xx_pci,
- .class_init = ppc4xx_pcihost_class_init,
+static TypeInfo ppc4xx_pcihost_info = {
+ .name = "ppc4xx-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PPC4xxPCIState),
+ .class_init = ppc4xx_pcihost_class_init,
};
static void ppc4xx_pci_register(void)
{
- sysbus_register_withprop(&ppc4xx_pcihost_info);
- pci_qdev_register(&ppc4xx_host_bridge_info);
+ type_register_static(&ppc4xx_pcihost_info);
+ type_register_static(&ppc4xx_host_bridge_info);
}
device_init(ppc4xx_pci_register);
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 438a75df80..ff9594e8fe 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -610,7 +610,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
pcihost = DO_UPCAST(PCIHostState, busdev, sys);
pcihost->address_space = get_system_memory();
qdev_init_nofail(dev);
- qdev_property_add_child(qdev_get_root(), "raven", dev, NULL);
+ qdev_property_add_child(qdev_get_root(), "raven", DEVICE(dev), NULL);
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (pci_bus == NULL) {
fprintf(stderr, "Couldn't create PCI host controller.\n");
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index f8c4f118cf..d5bce71429 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -341,37 +341,41 @@ static int e500_pcihost_initfn(SysBusDevice *dev)
static void e500_host_bridge_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->vendor_id = PCI_VENDOR_ID_FREESCALE;
k->device_id = PCI_DEVICE_ID_MPC8533E;
k->class_id = PCI_CLASS_PROCESSOR_POWERPC;
+ dc->desc = "Host bridge";
}
-static DeviceInfo e500_host_bridge_info = {
- .name = "e500-host-bridge",
- .desc = "Host bridge",
- .size = sizeof(PCIDevice),
- .class_init = e500_host_bridge_class_init,
+static TypeInfo e500_host_bridge_info = {
+ .name = "e500-host-bridge",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = e500_host_bridge_class_init,
};
static void e500_pcihost_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = e500_pcihost_initfn;
+ dc->vmsd = &vmstate_ppce500_pci;
}
-static DeviceInfo e500_pcihost_info = {
- .name = "e500-pcihost",
- .size = sizeof(PPCE500PCIState),
- .vmsd = &vmstate_ppce500_pci,
- .class_init = e500_pcihost_class_init,
+static TypeInfo e500_pcihost_info = {
+ .name = "e500-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PPCE500PCIState),
+ .class_init = e500_pcihost_class_init,
};
static void e500_pci_register(void)
{
- sysbus_register_withprop(&e500_pcihost_info);
- pci_qdev_register(&e500_host_bridge_info);
+ type_register_static(&e500_pcihost_info);
+ type_register_static(&e500_host_bridge_info);
}
device_init(e500_pci_register);
diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index cb5bc97d0a..9d648ec90a 100644
--- a/hw/ppce500_spin.c
+++ b/hw/ppce500_spin.c
@@ -210,14 +210,15 @@ static void ppce500_spin_class_init(ObjectClass *klass, void *data)
k->init = ppce500_spin_initfn;
}
-static DeviceInfo ppce500_spin_info = {
- .name = "e500-spin",
- .size = sizeof(SpinState),
- .class_init = ppce500_spin_class_init,
+static TypeInfo ppce500_spin_info = {
+ .name = "e500-spin",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SpinState),
+ .class_init = ppce500_spin_class_init,
};
static void ppce500_spin_register(void)
{
- sysbus_register_withprop(&ppce500_spin_info);
+ type_register_static(&ppce500_spin_info);
}
device_init(ppce500_spin_register);
diff --git a/hw/prep_pci.c b/hw/prep_pci.c
index b3b85b7ca2..40b8bb0edd 100644
--- a/hw/prep_pci.c
+++ b/hw/prep_pci.c
@@ -137,42 +137,46 @@ static const VMStateDescription vmstate_raven = {
static void raven_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = raven_init;
k->vendor_id = PCI_VENDOR_ID_MOTOROLA;
k->device_id = PCI_DEVICE_ID_MOTOROLA_RAVEN;
k->revision = 0x00;
k->class_id = PCI_CLASS_BRIDGE_HOST;
+ dc->desc = "PReP Host Bridge - Motorola Raven";
+ dc->vmsd = &vmstate_raven;
+ dc->no_user = 1;
}
-static DeviceInfo raven_info = {
+static TypeInfo raven_info = {
.name = "raven",
- .desc = "PReP Host Bridge - Motorola Raven",
- .size = sizeof(RavenPCIState),
- .vmsd = &vmstate_raven,
- .no_user = 1,
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(RavenPCIState),
.class_init = raven_class_init,
};
static void raven_pcihost_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->init = raven_pcihost_init;
+ dc->fw_name = "pci";
+ dc->no_user = 1;
}
-static DeviceInfo raven_pcihost_info = {
+static TypeInfo raven_pcihost_info = {
.name = "raven-pcihost",
- .fw_name = "pci",
- .size = sizeof(PREPPCIState),
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PREPPCIState),
.class_init = raven_pcihost_class_init,
- .no_user = 1,
};
static void raven_register_devices(void)
{
- sysbus_register_withprop(&raven_pcihost_info);
- pci_qdev_register(&raven_info);
+ type_register_static(&raven_pcihost_info);
+ type_register_static(&raven_info);
}
device_init(raven_register_devices)
diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index fbc397f73e..244c614510 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -1235,17 +1235,19 @@ static const VMStateDescription vmstate_pxa2xx_rtc_regs = {
static void pxa2xx_rtc_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_rtc_init;
+ dc->desc = "PXA2xx RTC Controller";
+ dc->vmsd = &vmstate_pxa2xx_rtc_regs;
}
-static DeviceInfo pxa2xx_rtc_sysbus_info = {
- .name = "pxa2xx_rtc",
- .desc = "PXA2xx RTC Controller",
- .size = sizeof(PXA2xxRTCState),
- .vmsd = &vmstate_pxa2xx_rtc_regs,
- .class_init = pxa2xx_rtc_sysbus_class_init,
+static TypeInfo pxa2xx_rtc_sysbus_info = {
+ .name = "pxa2xx_rtc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxRTCState),
+ .class_init = pxa2xx_rtc_sysbus_class_init,
};
/* I2C Interface */
@@ -1489,10 +1491,11 @@ static void pxa2xx_i2c_slave_class_init(ObjectClass *klass, void *data)
k->send = pxa2xx_i2c_tx;
}
-static DeviceInfo pxa2xx_i2c_slave_info = {
- .name = "pxa2xx-i2c-slave",
- .size = sizeof(PXA2xxI2CSlaveState),
- .class_init = pxa2xx_i2c_slave_class_init,
+static TypeInfo pxa2xx_i2c_slave_info = {
+ .name = "pxa2xx-i2c-slave",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(PXA2xxI2CSlaveState),
+ .class_init = pxa2xx_i2c_slave_class_init,
};
PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base,
@@ -1548,18 +1551,20 @@ static Property pxa2xx_i2c_properties[] = {
static void pxa2xx_i2c_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_i2c_initfn;
+ dc->desc = "PXA2xx I2C Bus Controller";
+ dc->vmsd = &vmstate_pxa2xx_i2c;
+ dc->props = pxa2xx_i2c_properties;
}
-static DeviceInfo pxa2xx_i2c_info = {
- .name = "pxa2xx_i2c",
- .desc = "PXA2xx I2C Bus Controller",
- .size = sizeof(PXA2xxI2CState),
- .vmsd = &vmstate_pxa2xx_i2c,
- .props = pxa2xx_i2c_properties,
- .class_init = pxa2xx_i2c_class_init,
+static TypeInfo pxa2xx_i2c_info = {
+ .name = "pxa2xx_i2c",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxI2CState),
+ .class_init = pxa2xx_i2c_class_init,
};
/* PXA Inter-IC Sound Controller */
@@ -2318,18 +2323,19 @@ static void pxa2xx_ssp_class_init(ObjectClass *klass, void *data)
sdc->init = pxa2xx_ssp_init;
}
-static DeviceInfo pxa2xx_ssp_info = {
- .name = "pxa2xx-ssp",
- .size = sizeof(PXA2xxSSPState),
- .class_init = pxa2xx_ssp_class_init,
+static TypeInfo pxa2xx_ssp_info = {
+ .name = "pxa2xx-ssp",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxSSPState),
+ .class_init = pxa2xx_ssp_class_init,
};
static void pxa2xx_register_devices(void)
{
- i2c_register_slave(&pxa2xx_i2c_slave_info);
- sysbus_qdev_register(&pxa2xx_ssp_info);
- sysbus_register_withprop(&pxa2xx_i2c_info);
- sysbus_register_withprop(&pxa2xx_rtc_sysbus_info);
+ type_register_static(&pxa2xx_i2c_slave_info);
+ type_register_static(&pxa2xx_ssp_info);
+ type_register_static(&pxa2xx_i2c_info);
+ type_register_static(&pxa2xx_rtc_sysbus_info);
}
device_init(pxa2xx_register_devices)
diff --git a/hw/pxa2xx_dma.c b/hw/pxa2xx_dma.c
index 9ecec33580..2d61565f1d 100644
--- a/hw/pxa2xx_dma.c
+++ b/hw/pxa2xx_dma.c
@@ -550,22 +550,24 @@ static Property pxa2xx_dma_properties[] = {
static void pxa2xx_dma_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_dma_init;
+ dc->desc = "PXA2xx DMA controller";
+ dc->vmsd = &vmstate_pxa2xx_dma;
+ dc->props = pxa2xx_dma_properties;
}
-static DeviceInfo pxa2xx_dma_info = {
- .name = "pxa2xx-dma",
- .desc = "PXA2xx DMA controller",
- .size = sizeof(PXA2xxDMAState),
- .vmsd = &vmstate_pxa2xx_dma,
- .props = pxa2xx_dma_properties,
- .class_init = pxa2xx_dma_class_init,
+static TypeInfo pxa2xx_dma_info = {
+ .name = "pxa2xx-dma",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxDMAState),
+ .class_init = pxa2xx_dma_class_init,
};
static void pxa2xx_dma_register(void)
{
- sysbus_register_withprop(&pxa2xx_dma_info);
+ type_register_static(&pxa2xx_dma_info);
}
device_init(pxa2xx_dma_register);
diff --git a/hw/pxa2xx_gpio.c b/hw/pxa2xx_gpio.c
index 7a1333fe5f..67fd17c4ca 100644
--- a/hw/pxa2xx_gpio.c
+++ b/hw/pxa2xx_gpio.c
@@ -325,21 +325,23 @@ static Property pxa2xx_gpio_properties[] = {
static void pxa2xx_gpio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_gpio_initfn;
+ dc->desc = "PXA2xx GPIO controller";
+ dc->props = pxa2xx_gpio_properties;
}
-static DeviceInfo pxa2xx_gpio_info = {
- .name = "pxa2xx-gpio",
- .desc = "PXA2xx GPIO controller",
- .size = sizeof(PXA2xxGPIOInfo),
- .props = pxa2xx_gpio_properties,
- .class_init = pxa2xx_gpio_class_init,
+static TypeInfo pxa2xx_gpio_info = {
+ .name = "pxa2xx-gpio",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxGPIOInfo),
+ .class_init = pxa2xx_gpio_class_init,
};
static void pxa2xx_gpio_register(void)
{
- sysbus_register_withprop(&pxa2xx_gpio_info);
+ type_register_static(&pxa2xx_gpio_info);
}
device_init(pxa2xx_gpio_register);
diff --git a/hw/pxa2xx_pic.c b/hw/pxa2xx_pic.c
index d318e8314b..ca85743aea 100644
--- a/hw/pxa2xx_pic.c
+++ b/hw/pxa2xx_pic.c
@@ -298,21 +298,23 @@ static int pxa2xx_pic_initfn(SysBusDevice *dev)
static void pxa2xx_pic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_pic_initfn;
+ dc->desc = "PXA2xx PIC";
+ dc->vmsd = &vmstate_pxa2xx_pic_regs;
}
-static DeviceInfo pxa2xx_pic_info = {
- .name = "pxa2xx_pic",
- .desc = "PXA2xx PIC",
- .size = sizeof(PXA2xxPICState),
- .vmsd = &vmstate_pxa2xx_pic_regs,
- .class_init = pxa2xx_pic_class_init,
+static TypeInfo pxa2xx_pic_info = {
+ .name = "pxa2xx_pic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxPICState),
+ .class_init = pxa2xx_pic_class_init,
};
static void pxa2xx_pic_register(void)
{
- sysbus_register_withprop(&pxa2xx_pic_info);
+ type_register_static(&pxa2xx_pic_info);
}
device_init(pxa2xx_pic_register);
diff --git a/hw/pxa2xx_timer.c b/hw/pxa2xx_timer.c
index cd78d41ab4..90800751b1 100644
--- a/hw/pxa2xx_timer.c
+++ b/hw/pxa2xx_timer.c
@@ -486,18 +486,20 @@ static Property pxa25x_timer_dev_properties[] = {
static void pxa25x_timer_dev_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_timer_init;
+ dc->desc = "PXA25x timer";
+ dc->vmsd = &vmstate_pxa2xx_timer_regs;
+ dc->props = pxa25x_timer_dev_properties;
}
-static DeviceInfo pxa25x_timer_dev_info = {
- .name = "pxa25x-timer",
- .desc = "PXA25x timer",
- .size = sizeof(PXA2xxTimerInfo),
- .vmsd = &vmstate_pxa2xx_timer_regs,
- .props = pxa25x_timer_dev_properties,
- .class_init = pxa25x_timer_dev_class_init,
+static TypeInfo pxa25x_timer_dev_info = {
+ .name = "pxa25x-timer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxTimerInfo),
+ .class_init = pxa25x_timer_dev_class_init,
};
static Property pxa27x_timer_dev_properties[] = {
@@ -509,23 +511,25 @@ static Property pxa27x_timer_dev_properties[] = {
static void pxa27x_timer_dev_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = pxa2xx_timer_init;
+ dc->desc = "PXA27x timer";
+ dc->vmsd = &vmstate_pxa2xx_timer_regs;
+ dc->props = pxa27x_timer_dev_properties;
}
-static DeviceInfo pxa27x_timer_dev_info = {
- .name = "pxa27x-timer",
- .desc = "PXA27x timer",
- .size = sizeof(PXA2xxTimerInfo),
- .vmsd = &vmstate_pxa2xx_timer_regs,
- .props = pxa27x_timer_dev_properties,
- .class_init = pxa27x_timer_dev_class_init,
+static TypeInfo pxa27x_timer_dev_info = {
+ .name = "pxa27x-timer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxTimerInfo),
+ .class_init = pxa27x_timer_dev_class_init,
};
static void pxa2xx_timer_register(void)
{
- sysbus_register_withprop(&pxa25x_timer_dev_info);
- sysbus_register_withprop(&pxa27x_timer_dev_info);
+ type_register_static(&pxa25x_timer_dev_info);
+ type_register_static(&pxa27x_timer_dev_info);
};
device_init(pxa2xx_timer_register);
diff --git a/hw/qdev.h b/hw/qdev.h
index af167bef2d..ce76625352 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -260,7 +260,6 @@ struct DeviceInfo {
BusInfo *bus_info;
};
-void qdev_register(DeviceInfo *info);
void qdev_register_subclass(DeviceInfo *info, const char *parent);
/* Register device properties. */
diff --git a/hw/qxl.c b/hw/qxl.c
index 2f9470f1bd..bc03c1dc77 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1826,6 +1826,7 @@ static Property qxl_properties[] = {
static void qxl_primary_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -1834,42 +1835,45 @@ static void qxl_primary_class_init(ObjectClass *klass, void *data)
k->vendor_id = REDHAT_PCI_VENDOR_ID;
k->device_id = QXL_DEVICE_ID_STABLE;
k->class_id = PCI_CLASS_DISPLAY_VGA;
+ dc->desc = "Spice QXL GPU (primary, vga compatible)";
+ dc->reset = qxl_reset_handler;
+ dc->vmsd = &qxl_vmstate;
+ dc->props = qxl_properties;
}
-static DeviceInfo qxl_primary_info = {
- .name = "qxl-vga",
- .desc = "Spice QXL GPU (primary, vga compatible)",
- .size = sizeof(PCIQXLDevice),
- .reset = qxl_reset_handler,
- .vmsd = &qxl_vmstate,
- .props = qxl_properties,
- .class_init = qxl_primary_class_init,
+static TypeInfo qxl_primary_info = {
+ .name = "qxl-vga",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIQXLDevice),
+ .class_init = qxl_primary_class_init,
};
static void qxl_secondary_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = qxl_init_secondary;
k->vendor_id = REDHAT_PCI_VENDOR_ID;
k->device_id = QXL_DEVICE_ID_STABLE;
k->class_id = PCI_CLASS_DISPLAY_OTHER;
+ dc->desc = "Spice QXL GPU (secondary)";
+ dc->reset = qxl_reset_handler;
+ dc->vmsd = &qxl_vmstate;
+ dc->props = qxl_properties;
}
-static DeviceInfo qxl_secondary_info = {
- .name = "qxl",
- .desc = "Spice QXL GPU (secondary)",
- .size = sizeof(PCIQXLDevice),
- .reset = qxl_reset_handler,
- .vmsd = &qxl_vmstate,
- .props = qxl_properties,
- .class_init = qxl_secondary_class_init,
+static TypeInfo qxl_secondary_info = {
+ .name = "qxl",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIQXLDevice),
+ .class_init = qxl_secondary_class_init,
};
static void qxl_register(void)
{
- pci_qdev_register(&qxl_primary_info);
- pci_qdev_register(&qxl_secondary_info);
+ type_register_static(&qxl_primary_info);
+ type_register_static(&qxl_secondary_info);
}
device_init(qxl_register);
diff --git a/hw/realview.c b/hw/realview.c
index 42a0f209b7..821e627560 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -89,15 +89,16 @@ static void realview_i2c_class_init(ObjectClass *klass, void *data)
k->init = realview_i2c_init;
}
-static DeviceInfo realview_i2c_info = {
- .name = "realview_i2c",
- .size = sizeof(RealViewI2CState),
- .class_init = realview_i2c_class_init,
+static TypeInfo realview_i2c_info = {
+ .name = "realview_i2c",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(RealViewI2CState),
+ .class_init = realview_i2c_class_init,
};
static void realview_register_devices(void)
{
- sysbus_register_withprop(&realview_i2c_info);
+ type_register_static(&realview_i2c_info);
}
/* Board init. */
diff --git a/hw/realview_gic.c b/hw/realview_gic.c
index 0ccf21a23a..4121502c7b 100644
--- a/hw/realview_gic.c
+++ b/hw/realview_gic.c
@@ -53,15 +53,16 @@ static void realview_gic_class_init(ObjectClass *klass, void *data)
sdc->init = realview_gic_init;
}
-static DeviceInfo realview_gic_info = {
- .name = "realview_gic",
- .size = sizeof(RealViewGICState),
- .class_init = realview_gic_class_init,
+static TypeInfo realview_gic_info = {
+ .name = "realview_gic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(RealViewGICState),
+ .class_init = realview_gic_class_init,
};
static void realview_gic_register_devices(void)
{
- sysbus_qdev_register(&realview_gic_info);
+ type_register_static(&realview_gic_info);
}
device_init(realview_gic_register_devices)
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index 15dec9bfec..1668390e1f 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3501,6 +3501,7 @@ static Property rtl8139_properties[] = {
static void rtl8139_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = pci_rtl8139_init;
@@ -3510,20 +3511,21 @@ static void rtl8139_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_REALTEK_8139;
k->revision = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */
k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+ dc->reset = rtl8139_reset;
+ dc->vmsd = &vmstate_rtl8139;
+ dc->props = rtl8139_properties;
}
-static DeviceInfo rtl8139_info = {
- .name = "rtl8139",
- .size = sizeof(RTL8139State),
- .reset = rtl8139_reset,
- .vmsd = &vmstate_rtl8139,
- .props = rtl8139_properties,
- .class_init = rtl8139_class_init,
+static TypeInfo rtl8139_info = {
+ .name = "rtl8139",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(RTL8139State),
+ .class_init = rtl8139_class_init,
};
static void rtl8139_register_devices(void)
{
- pci_qdev_register(&rtl8139_info);
+ type_register_static(&rtl8139_info);
}
device_init(rtl8139_register_devices)
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index 565941a1b4..a0c610ab71 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -50,20 +50,6 @@ struct BusInfo s390_virtio_bus_info = {
.size = sizeof(VirtIOS390Bus),
};
-typedef struct VirtIOS390DeviceClass
-{
- DeviceClass parent_class;
- int (*init)(VirtIOS390Device *dev);
-} VirtIOS390DeviceClass;
-
-#define TYPE_VIRTIO_S390_DEVICE "virtio-s390-device"
-#define VIRTIO_S390_DEVICE(obj) \
- OBJECT_CHECK(VirtIOS390Device, (obj), TYPE_VIRTIO_S390_DEVICE)
-#define VIRTIO_S390_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtIOS390DeviceClass, (klass), TYPE_VIRTIO_S390_DEVICE)
-#define VIRTIO_S390_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOS390DeviceClass, (obj), TYPE_VIRTIO_S390_DEVICE)
-
static const VirtIOBindings virtio_s390_bindings;
static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev);
@@ -351,65 +337,77 @@ static const VirtIOBindings virtio_s390_bindings = {
.get_features = virtio_s390_get_features,
};
+static Property s390_virtio_net_properties[] = {
+ DEFINE_NIC_PROPERTIES(VirtIOS390Device, nic),
+ DEFINE_PROP_UINT32("x-txtimer", VirtIOS390Device,
+ net.txtimer, TX_TIMER_INTERVAL),
+ DEFINE_PROP_INT32("x-txburst", VirtIOS390Device,
+ net.txburst, TX_BURST),
+ DEFINE_PROP_STRING("tx", VirtIOS390Device, net.tx),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void s390_virtio_net_class_init(ObjectClass *klass, void *data)
{
- VirtIOS390DeviceClass *dc = VIRTIO_S390_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
- dc->init = s390_virtio_net_init;
+ k->init = s390_virtio_net_init;
+ dc->props = s390_virtio_net_properties;
+ dc->alias = "virtio-net";
}
-static DeviceInfo s390_virtio_net = {
- .name = "virtio-net-s390",
- .alias = "virtio-net",
- .size = sizeof(VirtIOS390Device),
- .class_init = s390_virtio_net_class_init,
- .props = (Property[]) {
- DEFINE_NIC_PROPERTIES(VirtIOS390Device, nic),
- DEFINE_PROP_UINT32("x-txtimer", VirtIOS390Device,
- net.txtimer, TX_TIMER_INTERVAL),
- DEFINE_PROP_INT32("x-txburst", VirtIOS390Device,
- net.txburst, TX_BURST),
- DEFINE_PROP_STRING("tx", VirtIOS390Device, net.tx),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo s390_virtio_net = {
+ .name = "virtio-net-s390",
+ .parent = TYPE_VIRTIO_S390_DEVICE,
+ .instance_size = sizeof(VirtIOS390Device),
+ .class_init = s390_virtio_net_class_init,
+};
+
+static Property s390_virtio_blk_properties[] = {
+ DEFINE_BLOCK_PROPERTIES(VirtIOS390Device, block),
+ DEFINE_PROP_STRING("serial", VirtIOS390Device, block_serial),
+ DEFINE_PROP_END_OF_LIST(),
};
static void s390_virtio_blk_class_init(ObjectClass *klass, void *data)
{
- VirtIOS390DeviceClass *dc = VIRTIO_S390_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
- dc->init = s390_virtio_blk_init;
+ k->init = s390_virtio_blk_init;
+ dc->props = s390_virtio_blk_properties;
+ dc->alias = "virtio-blk";
}
-static DeviceInfo s390_virtio_blk = {
- .name = "virtio-blk-s390",
- .alias = "virtio-blk",
- .size = sizeof(VirtIOS390Device),
- .class_init = s390_virtio_blk_class_init,
- .props = (Property[]) {
- DEFINE_BLOCK_PROPERTIES(VirtIOS390Device, block),
- DEFINE_PROP_STRING("serial", VirtIOS390Device, block_serial),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo s390_virtio_blk = {
+ .name = "virtio-blk-s390",
+ .parent = TYPE_VIRTIO_S390_DEVICE,
+ .instance_size = sizeof(VirtIOS390Device),
+ .class_init = s390_virtio_blk_class_init,
+};
+
+static Property s390_virtio_serial_properties[] = {
+ DEFINE_PROP_UINT32("max_ports", VirtIOS390Device,
+ serial.max_virtserial_ports, 31),
+ DEFINE_PROP_END_OF_LIST(),
};
static void s390_virtio_serial_class_init(ObjectClass *klass, void *data)
{
- VirtIOS390DeviceClass *dc = VIRTIO_S390_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
- dc->init = s390_virtio_serial_init;
+ k->init = s390_virtio_serial_init;
+ dc->props = s390_virtio_serial_properties;
+ dc->alias = "virtio-serial";
}
-static DeviceInfo s390_virtio_serial = {
- .name = "virtio-serial-s390",
- .alias = "virtio-serial",
- .size = sizeof(VirtIOS390Device),
- .class_init = s390_virtio_serial_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("max_ports", VirtIOS390Device,
- serial.max_virtserial_ports, 31),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo s390_virtio_serial = {
+ .name = "virtio-serial-s390",
+ .parent = TYPE_VIRTIO_S390_DEVICE,
+ .instance_size = sizeof(VirtIOS390Device),
+ .class_init = s390_virtio_serial_class_init,
};
static int s390_virtio_busdev_init(DeviceState *dev, DeviceInfo *info)
@@ -420,29 +418,29 @@ static int s390_virtio_busdev_init(DeviceState *dev, DeviceInfo *info)
return _info->init(_dev);
}
-static void s390_virtio_bus_register_withprop(DeviceInfo *info)
+static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
{
- info->init = s390_virtio_busdev_init;
- info->bus_info = &s390_virtio_bus_info;
- info->unplug = qdev_simple_unplug_cb;
+ DeviceClass *dc = DEVICE_CLASS(klass);
- assert(info->size >= sizeof(VirtIOS390Device));
- qdev_register_subclass(info, TYPE_VIRTIO_S390_DEVICE);
+ dc->init = s390_virtio_busdev_init;
+ dc->bus_info = &s390_virtio_bus_info;
+ dc->unplug = qdev_simple_unplug_cb;
}
static TypeInfo virtio_s390_device_info = {
.name = TYPE_VIRTIO_S390_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VirtIOS390Device),
+ .class_init = virtio_s390_device_class_init,
.abstract = true,
};
static void s390_virtio_register(void)
{
type_register_static(&virtio_s390_device_info);
- s390_virtio_bus_register_withprop(&s390_virtio_serial);
- s390_virtio_bus_register_withprop(&s390_virtio_blk);
- s390_virtio_bus_register_withprop(&s390_virtio_net);
+ type_register_static(&s390_virtio_serial);
+ type_register_static(&s390_virtio_blk);
+ type_register_static(&s390_virtio_net);
}
device_init(s390_virtio_register);
@@ -458,21 +456,23 @@ static int s390_virtio_bridge_init(SysBusDevice *dev)
static void s390_virtio_bridge_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = s390_virtio_bridge_init;
+ dc->no_user = 1;
}
-static DeviceInfo s390_virtio_bridge_info = {
- .name = "s390-virtio-bridge",
- .size = sizeof(SysBusDevice),
- .no_user = 1,
- .class_init = s390_virtio_bridge_class_init,
+static TypeInfo s390_virtio_bridge_info = {
+ .name = "s390-virtio-bridge",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusDevice),
+ .class_init = s390_virtio_bridge_class_init,
};
static void s390_virtio_register_devices(void)
{
- sysbus_register_withprop(&s390_virtio_bridge_info);
+ type_register_static(&s390_virtio_bridge_info);
}
device_init(s390_virtio_register_devices)
diff --git a/hw/s390-virtio-bus.h b/hw/s390-virtio-bus.h
index d02a90709d..b5e59b7d4b 100644
--- a/hw/s390-virtio-bus.h
+++ b/hw/s390-virtio-bus.h
@@ -40,7 +40,22 @@
#define VIRTIO_PARAM_CONFIG_CHANGED 0x1
#define VIRTIO_PARAM_DEV_ADD 0x2
-typedef struct VirtIOS390Device {
+#define TYPE_VIRTIO_S390_DEVICE "virtio-s390-device"
+#define VIRTIO_S390_DEVICE(obj) \
+ OBJECT_CHECK(VirtIOS390Device, (obj), TYPE_VIRTIO_S390_DEVICE)
+#define VIRTIO_S390_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VirtIOS390DeviceClass, (klass), TYPE_VIRTIO_S390_DEVICE)
+#define VIRTIO_S390_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VirtIOS390DeviceClass, (obj), TYPE_VIRTIO_S390_DEVICE)
+
+typedef struct VirtIOS390Device VirtIOS390Device;
+
+typedef struct VirtIOS390DeviceClass {
+ DeviceClass qdev;
+ int (*init)(VirtIOS390Device *dev);
+} VirtIOS390DeviceClass;
+
+struct VirtIOS390Device {
DeviceState qdev;
ram_addr_t dev_offs;
ram_addr_t feat_offs;
@@ -52,7 +67,7 @@ typedef struct VirtIOS390Device {
uint32_t host_features;
virtio_serial_conf serial;
virtio_net_conf net;
-} VirtIOS390Device;
+};
typedef struct VirtIOS390Bus {
BusState bus;
diff --git a/hw/sb16.c b/hw/sb16.c
index 67357ce546..ae2545068a 100644
--- a/hw/sb16.c
+++ b/hw/sb16.c
@@ -1391,30 +1391,34 @@ int SB16_init (ISABus *bus)
return 0;
}
+static Property sb16_properties[] = {
+ DEFINE_PROP_HEX32 ("version", SB16State, ver, 0x0405), /* 4.5 */
+ DEFINE_PROP_HEX32 ("iobase", SB16State, port, 0x220),
+ DEFINE_PROP_UINT32 ("irq", SB16State, irq, 5),
+ DEFINE_PROP_UINT32 ("dma", SB16State, dma, 1),
+ DEFINE_PROP_UINT32 ("dma16", SB16State, hdma, 5),
+ DEFINE_PROP_END_OF_LIST (),
+};
+
static void sb16_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = sb16_initfn;
+ dc->desc = "Creative Sound Blaster 16";
+ dc->vmsd = &vmstate_sb16;
+ dc->props = sb16_properties;
}
-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),
- DEFINE_PROP_UINT32 ("dma", SB16State, dma, 1),
- DEFINE_PROP_UINT32 ("dma16", SB16State, hdma, 5),
- DEFINE_PROP_END_OF_LIST (),
- },
+static TypeInfo sb16_info = {
+ .name = "sb16",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof (SB16State),
+ .class_init = sb16_class_initfn,
};
static void sb16_register (void)
{
- isa_qdev_register (&sb16_info);
+ type_register_static(&sb16_info);
}
device_init (sb16_register)
diff --git a/hw/sbi.c b/hw/sbi.c
index 0a062fca8f..847a4dde84 100644
--- a/hw/sbi.c
+++ b/hw/sbi.c
@@ -133,22 +133,24 @@ static int sbi_init1(SysBusDevice *dev)
static void sbi_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sbi_init1;
+ dc->reset = sbi_reset;
+ dc->vmsd = &vmstate_sbi;
}
-static DeviceInfo sbi_info = {
- .name = "sbi",
- .size = sizeof(SBIState),
- .vmsd = &vmstate_sbi,
- .reset = sbi_reset,
- .class_init = sbi_class_init,
+static TypeInfo sbi_info = {
+ .name = "sbi",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SBIState),
+ .class_init = sbi_class_init,
};
static void sbi_register_devices(void)
{
- sysbus_register_withprop(&sbi_info);
+ type_register_static(&sbi_info);
}
device_init(sbi_register_devices)
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index d017ece775..b75044f93b 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -183,15 +183,6 @@ static int scsi_qdev_exit(DeviceState *qdev)
return 0;
}
-void scsi_qdev_register(DeviceInfo *info)
-{
- info->bus_info = &scsi_bus_info;
- info->init = scsi_qdev_init;
- info->unplug = qdev_simple_unplug_cb;
- info->exit = scsi_qdev_exit;
- qdev_register_subclass(info, TYPE_SCSI_DEVICE);
-}
-
/* handle legacy '-drive if=scsi,...' cmd line args */
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv,
int unit, bool removable, int bootindex)
@@ -1422,12 +1413,22 @@ SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun)
return target_dev;
}
+static void scsi_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->bus_info = &scsi_bus_info;
+ k->init = scsi_qdev_init;
+ k->unplug = qdev_simple_unplug_cb;
+ k->exit = scsi_qdev_exit;
+}
+
static TypeInfo scsi_device_type_info = {
.name = TYPE_SCSI_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(SCSIDevice),
.abstract = true,
.class_size = sizeof(SCSIDeviceClass),
+ .class_init = scsi_device_class_init,
};
static void scsi_register_devices(void)
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 2be6b67e69..399e51e494 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1712,108 +1712,124 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag,
DEFINE_PROP_STRING("ver", SCSIDiskState, version), \
DEFINE_PROP_STRING("serial", SCSIDiskState, serial)
+static Property scsi_hd_properties[] = {
+ DEFINE_SCSI_DISK_PROPERTIES(),
+ DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void scsi_hd_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->init = scsi_hd_initfn;
sc->destroy = scsi_destroy;
sc->alloc_req = scsi_new_request;
sc->unit_attention_reported = scsi_disk_unit_attention_reported;
+ dc->fw_name = "disk";
+ dc->desc = "virtual SCSI disk";
+ dc->reset = scsi_disk_reset;
+ dc->props = scsi_hd_properties;
}
-static DeviceInfo scsi_hd_info = {
- .name = "scsi-hd",
- .fw_name = "disk",
- .desc = "virtual SCSI disk",
- .size = sizeof(SCSIDiskState),
- .reset = scsi_disk_reset,
- .class_init = scsi_hd_class_initfn,
- .props = (Property[]) {
- DEFINE_SCSI_DISK_PROPERTIES(),
- DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo scsi_hd_info = {
+ .name = "scsi-hd",
+ .parent = TYPE_SCSI_DEVICE,
+ .instance_size = sizeof(SCSIDiskState),
+ .class_init = scsi_hd_class_initfn,
+};
+
+static Property scsi_cd_properties[] = {
+ DEFINE_SCSI_DISK_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
};
static void scsi_cd_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->init = scsi_cd_initfn;
sc->destroy = scsi_destroy;
sc->alloc_req = scsi_new_request;
sc->unit_attention_reported = scsi_disk_unit_attention_reported;
+ dc->fw_name = "disk";
+ dc->desc = "virtual SCSI CD-ROM";
+ dc->reset = scsi_disk_reset;
+ dc->props = scsi_cd_properties;
}
-static DeviceInfo scsi_cd_info = {
- .name = "scsi-cd",
- .fw_name = "disk",
- .desc = "virtual SCSI CD-ROM",
- .size = sizeof(SCSIDiskState),
- .reset = scsi_disk_reset,
- .class_init = scsi_cd_class_initfn,
- .props = (Property[]) {
- DEFINE_SCSI_DISK_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo scsi_cd_info = {
+ .name = "scsi-cd",
+ .parent = TYPE_SCSI_DEVICE,
+ .instance_size = sizeof(SCSIDiskState),
+ .class_init = scsi_cd_class_initfn,
};
#ifdef __linux__
+static Property scsi_block_properties[] = {
+ DEFINE_SCSI_DISK_PROPERTIES(),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void scsi_block_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->init = scsi_block_initfn;
sc->destroy = scsi_destroy;
sc->alloc_req = scsi_block_new_request;
+ dc->fw_name = "disk";
+ dc->desc = "SCSI block device passthrough";
+ dc->reset = scsi_disk_reset;
+ dc->props = scsi_block_properties;
}
-static DeviceInfo scsi_block_info = {
- .name = "scsi-block",
- .fw_name = "disk",
- .desc = "SCSI block device passthrough",
- .size = sizeof(SCSIDiskState),
- .reset = scsi_disk_reset,
- .class_init = scsi_block_class_initfn,
- .props = (Property[]) {
- DEFINE_SCSI_DISK_PROPERTIES(),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo scsi_block_info = {
+ .name = "scsi-block",
+ .parent = TYPE_SCSI_DEVICE,
+ .instance_size = sizeof(SCSIDiskState),
+ .class_init = scsi_block_class_initfn,
};
#endif
+static Property scsi_disk_properties[] = {
+ DEFINE_SCSI_DISK_PROPERTIES(),
+ DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void scsi_disk_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->init = scsi_disk_initfn;
sc->destroy = scsi_destroy;
sc->alloc_req = scsi_new_request;
sc->unit_attention_reported = scsi_disk_unit_attention_reported;
+ dc->fw_name = "disk";
+ dc->desc = "virtual SCSI disk or CD-ROM (legacy)";
+ dc->reset = scsi_disk_reset;
+ dc->props = scsi_disk_properties;
}
-static DeviceInfo scsi_disk_info = {
- .name = "scsi-disk", /* legacy -device scsi-disk */
- .fw_name = "disk",
- .desc = "virtual SCSI disk or CD-ROM (legacy)",
- .size = sizeof(SCSIDiskState),
- .reset = scsi_disk_reset,
- .class_init = scsi_disk_class_initfn,
- .props = (Property[]) {
- DEFINE_SCSI_DISK_PROPERTIES(),
- DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo scsi_disk_info = {
+ .name = "scsi-disk",
+ .parent = TYPE_SCSI_DEVICE,
+ .instance_size = sizeof(SCSIDiskState),
+ .class_init = scsi_disk_class_initfn,
};
static void scsi_disk_register_devices(void)
{
- scsi_qdev_register(&scsi_hd_info);
- scsi_qdev_register(&scsi_cd_info);
+ type_register_static(&scsi_hd_info);
+ type_register_static(&scsi_cd_info);
#ifdef __linux__
- scsi_qdev_register(&scsi_block_info);
+ type_register_static(&scsi_block_info);
#endif
- scsi_qdev_register(&scsi_disk_info);
+ type_register_static(&scsi_disk_info);
}
device_init(scsi_disk_register_devices)
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 5cf40051eb..4859212734 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -457,31 +457,35 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
return req;
}
+static Property scsi_generic_properties[] = {
+ DEFINE_BLOCK_PROPERTIES(SCSIDevice, conf),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void scsi_generic_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->init = scsi_generic_initfn;
sc->destroy = scsi_destroy;
sc->alloc_req = scsi_new_request;
+ dc->fw_name = "disk";
+ dc->desc = "pass through generic scsi device (/dev/sg*)";
+ dc->reset = scsi_generic_reset;
+ dc->props = scsi_generic_properties;
}
-static DeviceInfo scsi_generic_info = {
- .name = "scsi-generic",
- .fw_name = "disk",
- .desc = "pass through generic scsi device (/dev/sg*)",
- .size = sizeof(SCSIDevice),
- .reset = scsi_generic_reset,
- .class_init = scsi_generic_class_initfn,
- .props = (Property[]) {
- DEFINE_BLOCK_PROPERTIES(SCSIDevice, conf),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo scsi_generic_info = {
+ .name = "scsi-generic",
+ .parent = TYPE_SCSI_DEVICE,
+ .instance_size = sizeof(SCSIDevice),
+ .class_init = scsi_generic_class_initfn,
};
static void scsi_generic_register_devices(void)
{
- scsi_qdev_register(&scsi_generic_info);
+ type_register_static(&scsi_generic_info);
}
device_init(scsi_generic_register_devices)
diff --git a/hw/scsi.h b/hw/scsi.h
index 4290b20df5..dc72b6fc1e 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -125,7 +125,6 @@ struct SCSIBus {
};
void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info);
-void scsi_qdev_register(DeviceInfo *info);
static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
{
diff --git a/hw/serial.c b/hw/serial.c
index 2644b13a02..82917e24d7 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -879,29 +879,33 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
return s;
}
+static Property serial_isa_properties[] = {
+ DEFINE_PROP_UINT32("index", ISASerialState, index, -1),
+ DEFINE_PROP_HEX32("iobase", ISASerialState, iobase, -1),
+ DEFINE_PROP_UINT32("irq", ISASerialState, isairq, -1),
+ DEFINE_PROP_CHR("chardev", ISASerialState, state.chr),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void serial_isa_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = serial_isa_initfn;
+ dc->vmsd = &vmstate_isa_serial;
+ dc->props = serial_isa_properties;
}
-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),
- DEFINE_PROP_CHR("chardev", ISASerialState, state.chr),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo serial_isa_info = {
+ .name = "isa-serial",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISASerialState),
+ .class_init = serial_isa_class_initfn,
};
static void serial_register_devices(void)
{
- isa_qdev_register(&serial_isa_info);
+ type_register_static(&serial_isa_info);
}
device_init(serial_register_devices)
diff --git a/hw/sga.c b/hw/sga.c
index d612cb694e..b08e3c5aea 100644
--- a/hw/sga.c
+++ b/hw/sga.c
@@ -42,20 +42,22 @@ static int sga_initfn(ISADevice *dev)
}
static void sga_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = sga_initfn;
+ dc->desc = "Serial Graphics Adapter";
}
-static DeviceInfo sga_info = {
- .name = "sga",
- .desc = "Serial Graphics Adapter",
- .size = sizeof(ISASGAState),
- .class_init = sga_class_initfn,
+static TypeInfo sga_info = {
+ .name = "sga",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISASGAState),
+ .class_init = sga_class_initfn,
};
static void sga_register(void)
{
- isa_qdev_register(&sga_info);
+ type_register_static(&sga_info);
}
device_init(sga_register);
diff --git a/hw/sh_pci.c b/hw/sh_pci.c
index a849176afd..4234d935e7 100644
--- a/hw/sh_pci.c
+++ b/hw/sh_pci.c
@@ -156,10 +156,11 @@ static void sh_pci_host_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_HITACHI_SH7751R;
}
-static DeviceInfo sh_pci_host_info = {
- .name = "sh_pci_host",
- .size = sizeof(PCIDevice),
- .class_init = sh_pci_host_class_init,
+static TypeInfo sh_pci_host_info = {
+ .name = "sh_pci_host",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = sh_pci_host_class_init,
};
static void sh_pci_device_class_init(ObjectClass *klass, void *data)
@@ -169,16 +170,17 @@ static void sh_pci_device_class_init(ObjectClass *klass, void *data)
sdc->init = sh_pci_device_init;
}
-static DeviceInfo sh_pci_device_info = {
- .name = "sh_pci",
- .size = sizeof(SHPCIState),
- .class_init = sh_pci_device_class_init,
+static TypeInfo sh_pci_device_info = {
+ .name = "sh_pci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SHPCIState),
+ .class_init = sh_pci_device_class_init,
};
static void sh_pci_register_devices(void)
{
- sysbus_qdev_register(&sh_pci_device_info);
- pci_qdev_register(&sh_pci_host_info);
+ type_register_static(&sh_pci_device_info);
+ type_register_static(&sh_pci_host_info);
}
device_init(sh_pci_register_devices)
diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c
index 12ce342dc3..e3701c75d2 100644
--- a/hw/slavio_intctl.c
+++ b/hw/slavio_intctl.c
@@ -448,22 +448,24 @@ static int slavio_intctl_init1(SysBusDevice *dev)
static void slavio_intctl_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = slavio_intctl_init1;
+ dc->reset = slavio_intctl_reset;
+ dc->vmsd = &vmstate_intctl;
}
-static DeviceInfo slavio_intctl_info = {
- .name = "slavio_intctl",
- .size = sizeof(SLAVIO_INTCTLState),
- .vmsd = &vmstate_intctl,
- .reset = slavio_intctl_reset,
- .class_init = slavio_intctl_class_init,
+static TypeInfo slavio_intctl_info = {
+ .name = "slavio_intctl",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SLAVIO_INTCTLState),
+ .class_init = slavio_intctl_class_init,
};
static void slavio_intctl_register_devices(void)
{
- sysbus_register_withprop(&slavio_intctl_info);
+ type_register_static(&slavio_intctl_info);
}
device_init(slavio_intctl_register_devices)
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c
index 39a5269c8e..5a025186af 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -470,17 +470,19 @@ static int slavio_misc_init1(SysBusDevice *dev)
static void slavio_misc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = slavio_misc_init1;
+ dc->reset = slavio_misc_reset;
+ dc->vmsd = &vmstate_misc;
}
-static DeviceInfo slavio_misc_info = {
- .name = "slavio_misc",
- .size = sizeof(MiscState),
- .vmsd = &vmstate_misc,
- .reset = slavio_misc_reset,
- .class_init = slavio_misc_class_init,
+static TypeInfo slavio_misc_info = {
+ .name = "slavio_misc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MiscState),
+ .class_init = slavio_misc_class_init,
};
static void apc_class_init(ObjectClass *klass, void *data)
@@ -490,16 +492,17 @@ static void apc_class_init(ObjectClass *klass, void *data)
k->init = apc_init1;
}
-static DeviceInfo apc_info = {
- .name = "apc",
- .size = sizeof(MiscState),
- .class_init = apc_class_init,
+static TypeInfo apc_info = {
+ .name = "apc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(MiscState),
+ .class_init = apc_class_init,
};
static void slavio_misc_register_devices(void)
{
- sysbus_register_withprop(&slavio_misc_info);
- sysbus_register_withprop(&apc_info);
+ type_register_static(&slavio_misc_info);
+ type_register_static(&apc_info);
}
device_init(slavio_misc_register_devices)
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index a3bebcd3cf..3878f6fa5e 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -411,23 +411,25 @@ static Property slavio_timer_properties[] = {
static void slavio_timer_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = slavio_timer_init1;
+ dc->reset = slavio_timer_reset;
+ dc->vmsd = &vmstate_slavio_timer;
+ dc->props = slavio_timer_properties;
}
-static DeviceInfo slavio_timer_info = {
- .name = "slavio_timer",
- .size = sizeof(SLAVIO_TIMERState),
- .vmsd = &vmstate_slavio_timer,
- .reset = slavio_timer_reset,
- .props = slavio_timer_properties,
- .class_init = slavio_timer_class_init,
+static TypeInfo slavio_timer_info = {
+ .name = "slavio_timer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SLAVIO_TIMERState),
+ .class_init = slavio_timer_class_init,
};
static void slavio_timer_register_devices(void)
{
- sysbus_register_withprop(&slavio_timer_info);
+ type_register_static(&slavio_timer_info);
}
device_init(slavio_timer_register_devices)
diff --git a/hw/smbus.c b/hw/smbus.c
index ed31a5961b..77626f3645 100644
--- a/hw/smbus.c
+++ b/hw/smbus.c
@@ -207,12 +207,6 @@ static int smbus_device_init(I2CSlave *i2c)
return sc->init(dev);
}
-void smbus_register_device(DeviceInfo *info)
-{
- assert(info->size >= sizeof(SMBusDevice));
- i2c_register_slave_subclass(info, TYPE_SMBUS_DEVICE);
-}
-
/* Master device commands. */
void smbus_quick_command(i2c_bus *bus, uint8_t addr, int read)
{
diff --git a/hw/smbus.h b/hw/smbus.h
index 90fadee56e..6ed45bd03d 100644
--- a/hw/smbus.h
+++ b/hw/smbus.h
@@ -65,8 +65,6 @@ struct SMBusDevice {
uint8_t command;
};
-void smbus_register_device(DeviceInfo *info);
-
/* Master device commands. */
void smbus_quick_command(i2c_bus *bus, uint8_t addr, int read);
uint8_t smbus_receive_byte(i2c_bus *bus, uint8_t addr);
diff --git a/hw/smbus_eeprom.c b/hw/smbus_eeprom.c
index 401dff5c27..9d96cbe41a 100644
--- a/hw/smbus_eeprom.c
+++ b/hw/smbus_eeprom.c
@@ -104,8 +104,14 @@ static int smbus_eeprom_initfn(SMBusDevice *dev)
return 0;
}
+static Property smbus_eeprom_properties[] = {
+ DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SMBusDeviceClass *sc = SMBUS_DEVICE_CLASS(klass);
sc->init = smbus_eeprom_initfn;
@@ -114,21 +120,19 @@ static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data)
sc->receive_byte = eeprom_receive_byte;
sc->write_data = eeprom_write_data;
sc->read_data = eeprom_read_data;
+ dc->props = smbus_eeprom_properties;
}
-static DeviceInfo smbus_eeprom_info = {
- .name = "smbus-eeprom",
- .size = sizeof(SMBusEEPROMDevice),
- .class_init = smbus_eeprom_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo smbus_eeprom_info = {
+ .name = "smbus-eeprom",
+ .parent = TYPE_SMBUS_DEVICE,
+ .instance_size = sizeof(SMBusEEPROMDevice),
+ .class_init = smbus_eeprom_class_initfn,
};
static void smbus_eeprom_register_devices(void)
{
- smbus_register_device(&smbus_eeprom_info);
+ type_register_static(&smbus_eeprom_info);
}
device_init(smbus_eeprom_register_devices)
diff --git a/hw/smc91c111.c b/hw/smc91c111.c
index 4220880a0a..1bf2901d1a 100644
--- a/hw/smc91c111.c
+++ b/hw/smc91c111.c
@@ -765,23 +765,25 @@ static Property smc91c111_properties[] = {
static void smc91c111_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = smc91c111_init1;
+ dc->reset = smc91c111_reset;
+ dc->vmsd = &vmstate_smc91c111;
+ dc->props = smc91c111_properties;
}
-static DeviceInfo smc91c111_info = {
- .name = "smc91c111",
- .size = sizeof(smc91c111_state),
- .vmsd = &vmstate_smc91c111,
- .reset = smc91c111_reset,
- .props = smc91c111_properties,
- .class_init = smc91c111_class_init,
+static TypeInfo smc91c111_info = {
+ .name = "smc91c111",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(smc91c111_state),
+ .class_init = smc91c111_class_init,
};
static void smc91c111_register_devices(void)
{
- sysbus_register_withprop(&smc91c111_info);
+ type_register_static(&smc91c111_info);
}
/* Legacy helper function. Should go away when machine config files are
diff --git a/hw/spapr_llan.c b/hw/spapr_llan.c
index 0fb176abad..79b394132b 100644
--- a/hw/spapr_llan.c
+++ b/hw/spapr_llan.c
@@ -482,6 +482,7 @@ static Property spapr_vlan_properties[] = {
static void spapr_vlan_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass);
k->init = spapr_vlan_init;
@@ -490,13 +491,14 @@ static void spapr_vlan_class_init(ObjectClass *klass, void *data)
k->dt_type = "network";
k->dt_compatible = "IBM,l-lan";
k->signal_mask = 0x1;
+ dc->props = spapr_vlan_properties;
}
-static DeviceInfo spapr_vlan_info = {
- .name = "spapr-vlan",
- .size = sizeof(VIOsPAPRVLANDevice),
- .props = spapr_vlan_properties,
- .class_init = spapr_vlan_class_init,
+static TypeInfo spapr_vlan_info = {
+ .name = "spapr-vlan",
+ .parent = TYPE_VIO_SPAPR_DEVICE,
+ .instance_size = sizeof(VIOsPAPRVLANDevice),
+ .class_init = spapr_vlan_class_init,
};
static void spapr_vlan_register(void)
@@ -507,6 +509,6 @@ static void spapr_vlan_register(void)
spapr_register_hypercall(H_ADD_LOGICAL_LAN_BUFFER,
h_add_logical_lan_buffer);
spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl);
- spapr_vio_bus_register_withprop(&spapr_vlan_info);
+ type_register_static(&spapr_vlan_info);
}
device_init(spapr_vlan_register);
diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index 2a82eae462..ed2e4b33e7 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -221,10 +221,11 @@ static void spapr_main_pci_host_class_init(ObjectClass *klass, void *data)
k->init = spapr_main_pci_host_init;
}
-static DeviceInfo spapr_main_pci_host_info = {
- .name = "spapr-pci-host-bridge-pci",
- .size = sizeof(PCIDevice),
- .class_init = spapr_main_pci_host_class_init,
+static TypeInfo spapr_main_pci_host_info = {
+ .name = "spapr-pci-host-bridge-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = spapr_main_pci_host_class_init,
};
static void spapr_phb_class_init(ObjectClass *klass, void *data)
@@ -234,16 +235,17 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data)
sdc->init = spapr_phb_init;
}
-static DeviceInfo spapr_phb_info = {
- .name = "spapr-pci-host-bridge",
- .size = sizeof(sPAPRPHBState),
- .class_init = spapr_phb_class_init,
+static TypeInfo spapr_phb_info = {
+ .name = "spapr-pci-host-bridge",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(sPAPRPHBState),
+ .class_init = spapr_phb_class_init,
};
static void spapr_register_devices(void)
{
- sysbus_qdev_register(&spapr_phb_info);
- pci_qdev_register(&spapr_main_pci_host_info);
+ type_register_static(&spapr_phb_info);
+ type_register_static(&spapr_main_pci_host_info);
}
device_init(spapr_register_devices)
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index dc2e9c910a..d39a47b11a 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -680,15 +680,6 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
return pc->init(dev);
}
-void spapr_vio_bus_register_withprop(DeviceInfo *info)
-{
- info->init = spapr_vio_busdev_init;
- info->bus_info = &spapr_vio_bus_info;
-
- assert(info->size >= sizeof(VIOsPAPRDevice));
- qdev_register_subclass(info, TYPE_VIO_SPAPR_DEVICE);
-}
-
static target_ulong h_vio_signal(CPUState *env, sPAPREnvironment *spapr,
target_ulong opcode,
target_ulong *args)
@@ -757,29 +748,39 @@ static int spapr_vio_bridge_init(SysBusDevice *dev)
static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- sbc->init = spapr_vio_bridge_init;
+ k->init = spapr_vio_bridge_init;
+ dc->no_user = 1;
}
-static DeviceInfo spapr_vio_bridge_info = {
- .name = "spapr-vio-bridge",
- .size = sizeof(SysBusDevice),
- .no_user = 1,
- .class_init = spapr_vio_bridge_class_init,
+static TypeInfo spapr_vio_bridge_info = {
+ .name = "spapr-vio-bridge",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusDevice),
+ .class_init = spapr_vio_bridge_class_init,
};
+static void vio_spapr_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = spapr_vio_busdev_init;
+ k->bus_info = &spapr_vio_bus_info;
+}
+
static TypeInfo spapr_vio_type_info = {
.name = TYPE_VIO_SPAPR_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VIOsPAPRDevice),
.abstract = true,
.class_size = sizeof(VIOsPAPRDeviceClass),
+ .class_init = vio_spapr_device_class_init,
};
static void spapr_vio_register_devices(void)
{
- sysbus_register_withprop(&spapr_vio_bridge_info);
+ type_register_static(&spapr_vio_bridge_info);
type_register_static(&spapr_vio_type_info);
}
diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h
index 7d1155a060..d8527bed90 100644
--- a/hw/spapr_vio.h
+++ b/hw/spapr_vio.h
@@ -97,7 +97,6 @@ struct VIOsPAPRBus {
extern VIOsPAPRBus *spapr_vio_bus_init(void);
extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
-extern void spapr_vio_bus_register_withprop(DeviceInfo *info);
extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);
extern int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus);
diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index b83bb7f341..9cfce19a73 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -954,6 +954,7 @@ static Property spapr_vscsi_properties[] = {
static void spapr_vscsi_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass);
k->init = spapr_vscsi_init;
@@ -962,17 +963,18 @@ static void spapr_vscsi_class_init(ObjectClass *klass, void *data)
k->dt_type = "vscsi";
k->dt_compatible = "IBM,v-scsi";
k->signal_mask = 0x00000001;
+ dc->props = spapr_vscsi_properties;
}
-static DeviceInfo spapr_vscsi_info = {
- .name = "spapr-vscsi",
- .size = sizeof(VSCSIState),
- .props = spapr_vscsi_properties,
- .class_init = spapr_vscsi_class_init,
+static TypeInfo spapr_vscsi_info = {
+ .name = "spapr-vscsi",
+ .parent = TYPE_VIO_SPAPR_DEVICE,
+ .instance_size = sizeof(VSCSIState),
+ .class_init = spapr_vscsi_class_init,
};
static void spapr_vscsi_register(void)
{
- spapr_vio_bus_register_withprop(&spapr_vscsi_info);
+ type_register_static(&spapr_vscsi_info);
}
device_init(spapr_vscsi_register);
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index 1780ffea32..a954e7d29b 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -143,19 +143,21 @@ static Property spapr_vty_properties[] = {
static void spapr_vty_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass);
k->init = spapr_vty_init;
k->dt_name = "vty";
k->dt_type = "serial";
k->dt_compatible = "hvterm1";
+ dc->props = spapr_vty_properties;
}
-static DeviceInfo spapr_vty_info = {
- .name = "spapr-vty",
- .size = sizeof(VIOsPAPRVTYDevice),
- .props = spapr_vty_properties,
- .class_init = spapr_vty_class_init,
+static TypeInfo spapr_vty_info = {
+ .name = "spapr-vty",
+ .parent = TYPE_VIO_SPAPR_DEVICE,
+ .instance_size = sizeof(VIOsPAPRVTYDevice),
+ .class_init = spapr_vty_class_init,
};
VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
@@ -214,6 +216,6 @@ static void spapr_vty_register(void)
{
spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char);
spapr_register_hypercall(H_GET_TERM_CHAR, h_get_term_char);
- spapr_vio_bus_register_withprop(&spapr_vty_info);
+ type_register_static(&spapr_vty_info);
}
device_init(spapr_vty_register);
diff --git a/hw/sparc32_dma.c b/hw/sparc32_dma.c
index 582f2f0b1c..f07cc6fdf0 100644
--- a/hw/sparc32_dma.c
+++ b/hw/sparc32_dma.c
@@ -291,23 +291,25 @@ static Property sparc32_dma_properties[] = {
static void sparc32_dma_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sparc32_dma_init1;
+ dc->reset = dma_reset;
+ dc->vmsd = &vmstate_dma;
+ dc->props = sparc32_dma_properties;
}
-static DeviceInfo sparc32_dma_info = {
- .name = "sparc32_dma",
- .size = sizeof(DMAState),
- .vmsd = &vmstate_dma,
- .reset = dma_reset,
- .props = sparc32_dma_properties,
- .class_init = sparc32_dma_class_init,
+static TypeInfo sparc32_dma_info = {
+ .name = "sparc32_dma",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(DMAState),
+ .class_init = sparc32_dma_class_init,
};
static void sparc32_dma_register_devices(void)
{
- sysbus_register_withprop(&sparc32_dma_info);
+ type_register_static(&sparc32_dma_info);
}
device_init(sparc32_dma_register_devices)
diff --git a/hw/spitz.c b/hw/spitz.c
index 046efad637..4e6540d976 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -1031,17 +1031,19 @@ static Property sl_nand_properties[] = {
static void sl_nand_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sl_nand_init;
+ dc->vmsd = &vmstate_sl_nand_info;
+ dc->props = sl_nand_properties;
}
-static DeviceInfo sl_nand_info = {
- .name = "sl-nand",
- .size = sizeof(SLNANDState),
- .vmsd = &vmstate_sl_nand_info,
- .props = sl_nand_properties,
- .class_init = sl_nand_class_init,
+static TypeInfo sl_nand_info = {
+ .name = "sl-nand",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SLNANDState),
+ .class_init = sl_nand_class_init,
};
static VMStateDescription vmstate_spitz_kbd = {
@@ -1064,17 +1066,19 @@ static Property spitz_keyboard_properties[] = {
static void spitz_keyboard_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = spitz_keyboard_init;
+ dc->vmsd = &vmstate_spitz_kbd;
+ dc->props = spitz_keyboard_properties;
}
-static DeviceInfo spitz_keyboard_info = {
- .name = "spitz-keyboard",
- .size = sizeof(SpitzKeyboardState),
- .vmsd = &vmstate_spitz_kbd,
- .props = spitz_keyboard_properties,
- .class_init = spitz_keyboard_class_init,
+static TypeInfo spitz_keyboard_info = {
+ .name = "spitz-keyboard",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SpitzKeyboardState),
+ .class_init = spitz_keyboard_class_init,
};
static const VMStateDescription vmstate_corgi_ssp_regs = {
@@ -1090,17 +1094,19 @@ static const VMStateDescription vmstate_corgi_ssp_regs = {
static void corgi_ssp_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
k->init = corgi_ssp_init;
k->transfer = corgi_ssp_transfer;
+ dc->vmsd = &vmstate_corgi_ssp_regs;
}
-static DeviceInfo corgi_ssp_info = {
- .name = "corgi-ssp",
- .size = sizeof(CorgiSSPState),
- .vmsd = &vmstate_corgi_ssp_regs,
- .class_init = corgi_ssp_class_init,
+static TypeInfo corgi_ssp_info = {
+ .name = "corgi-ssp",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(CorgiSSPState),
+ .class_init = corgi_ssp_class_init,
};
static const VMStateDescription vmstate_spitz_lcdtg_regs = {
@@ -1117,25 +1123,27 @@ static const VMStateDescription vmstate_spitz_lcdtg_regs = {
static void spitz_lcdtg_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
k->init = spitz_lcdtg_init;
k->transfer = spitz_lcdtg_transfer;
+ dc->vmsd = &vmstate_spitz_lcdtg_regs;
}
-static DeviceInfo spitz_lcdtg_info = {
- .name = "spitz-lcdtg",
- .size = sizeof(SpitzLCDTG),
- .vmsd = &vmstate_spitz_lcdtg_regs,
- .class_init = spitz_lcdtg_class_init,
+static TypeInfo spitz_lcdtg_info = {
+ .name = "spitz-lcdtg",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(SpitzLCDTG),
+ .class_init = spitz_lcdtg_class_init,
};
static void spitz_register_devices(void)
{
- ssi_register_slave(&corgi_ssp_info);
- ssi_register_slave(&spitz_lcdtg_info);
- sysbus_register_withprop(&spitz_keyboard_info);
- sysbus_register_withprop(&sl_nand_info);
+ type_register_static(&corgi_ssp_info);
+ type_register_static(&spitz_lcdtg_info);
+ type_register_static(&spitz_keyboard_info);
+ type_register_static(&sl_nand_info);
}
device_init(spitz_register_devices)
diff --git a/hw/ssd0303.c b/hw/ssd0303.c
index acf027fa43..685602a584 100644
--- a/hw/ssd0303.c
+++ b/hw/ssd0303.c
@@ -296,24 +296,26 @@ static int ssd0303_init(I2CSlave *i2c)
static void ssd0303_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
k->init = ssd0303_init;
k->event = ssd0303_event;
k->recv = ssd0303_recv;
k->send = ssd0303_send;
+ dc->vmsd = &vmstate_ssd0303;
}
-static DeviceInfo ssd0303_info = {
- .name = "ssd0303",
- .size = sizeof(ssd0303_state),
- .vmsd = &vmstate_ssd0303,
- .class_init = ssd0303_class_init,
+static TypeInfo ssd0303_info = {
+ .name = "ssd0303",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(ssd0303_state),
+ .class_init = ssd0303_class_init,
};
static void ssd0303_register_devices(void)
{
- i2c_register_slave(&ssd0303_info);
+ type_register_static(&ssd0303_info);
}
device_init(ssd0303_register_devices)
diff --git a/hw/ssd0323.c b/hw/ssd0323.c
index 8e2fac87aa..3c43738ae1 100644
--- a/hw/ssd0323.c
+++ b/hw/ssd0323.c
@@ -348,15 +348,16 @@ static void ssd0323_class_init(ObjectClass *klass, void *data)
k->transfer = ssd0323_transfer;
}
-static DeviceInfo ssd0323_info = {
- .name = "ssd0323",
- .size = sizeof(ssd0323_state),
- .class_init = ssd0323_class_init,
+static TypeInfo ssd0323_info = {
+ .name = "ssd0323",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(ssd0323_state),
+ .class_init = ssd0323_class_init,
};
static void ssd03232_register_devices(void)
{
- ssi_register_slave(&ssd0323_info);
+ type_register_static(&ssd0323_info);
}
device_init(ssd03232_register_devices)
diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c
index 2738cf9d77..f2e6cecb71 100644
--- a/hw/ssi-sd.c
+++ b/hw/ssi-sd.c
@@ -252,15 +252,16 @@ static void ssi_sd_class_init(ObjectClass *klass, void *data)
k->transfer = ssi_sd_transfer;
}
-static DeviceInfo ssi_sd_info = {
- .name = "ssi-sd",
- .size = sizeof(ssi_sd_state),
- .class_init = ssi_sd_class_init,
+static TypeInfo ssi_sd_info = {
+ .name = "ssi-sd",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(ssi_sd_state),
+ .class_init = ssi_sd_class_init,
};
static void ssi_sd_register_devices(void)
{
- ssi_register_slave(&ssi_sd_info);
+ type_register_static(&ssi_sd_info);
}
device_init(ssi_sd_register_devices)
diff --git a/hw/ssi.c b/hw/ssi.c
index 994c92241f..4282b8b920 100644
--- a/hw/ssi.c
+++ b/hw/ssi.c
@@ -36,14 +36,21 @@ static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info)
return ssc->init(s);
}
-void ssi_register_slave(DeviceInfo *info)
+static void ssi_slave_class_init(ObjectClass *klass, void *data)
{
- assert(info->size >= sizeof(SSISlave));
- info->init = ssi_slave_init;
- info->bus_info = &ssi_bus_info;
- qdev_register_subclass(info, TYPE_SSI_SLAVE);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->init = ssi_slave_init;
+ dc->bus_info = &ssi_bus_info;
}
+static TypeInfo ssi_slave_info = {
+ .name = TYPE_SSI_SLAVE,
+ .parent = TYPE_DEVICE,
+ .class_init = ssi_slave_class_init,
+ .class_size = sizeof(SSISlaveClass),
+ .abstract = true,
+};
+
DeviceState *ssi_create_slave(SSIBus *bus, const char *name)
{
DeviceState *dev;
@@ -72,3 +79,10 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
ssc = SSI_SLAVE_GET_CLASS(slave);
return ssc->transfer(slave, val);
}
+
+static void register_ssi_slave(void)
+{
+ type_register_static(&ssi_slave_info);
+}
+
+device_init(register_ssi_slave);
diff --git a/hw/ssi.h b/hw/ssi.h
index 97aefa73c0..06657d7c16 100644
--- a/hw/ssi.h
+++ b/hw/ssi.h
@@ -38,8 +38,6 @@ struct SSISlave {
#define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
-void ssi_register_slave(DeviceInfo *info);
-
DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
/* Master interface. */
diff --git a/hw/stellaris.c b/hw/stellaris.c
index b91139e179..31a65cfb77 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1402,10 +1402,11 @@ static void stellaris_ssi_bus_class_init(ObjectClass *klass, void *data)
k->transfer = stellaris_ssi_bus_transfer;
}
-static DeviceInfo stellaris_ssi_bus_info = {
- .name = "evb6965-ssi",
- .size = sizeof(stellaris_ssi_bus_state),
- .class_init = stellaris_ssi_bus_class_init,
+static TypeInfo stellaris_ssi_bus_info = {
+ .name = "evb6965-ssi",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(stellaris_ssi_bus_state),
+ .class_init = stellaris_ssi_bus_class_init,
};
static void stellaris_i2c_class_init(ObjectClass *klass, void *data)
@@ -1415,10 +1416,11 @@ static void stellaris_i2c_class_init(ObjectClass *klass, void *data)
sdc->init = stellaris_i2c_init;
}
-static DeviceInfo stellaris_i2c_info = {
- .name = "stellaris-i2c",
- .size = sizeof(stellaris_i2c_state),
- .class_init = stellaris_i2c_class_init,
+static TypeInfo stellaris_i2c_info = {
+ .name = "stellaris-i2c",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(stellaris_i2c_state),
+ .class_init = stellaris_i2c_class_init,
};
static void stellaris_gptm_class_init(ObjectClass *klass, void *data)
@@ -1428,10 +1430,11 @@ static void stellaris_gptm_class_init(ObjectClass *klass, void *data)
sdc->init = stellaris_gptm_init;
}
-static DeviceInfo stellaris_gptm_info = {
- .name = "stellaris-gptm",
- .size = sizeof(gptm_state),
- .class_init = stellaris_gptm_class_init,
+static TypeInfo stellaris_gptm_info = {
+ .name = "stellaris-gptm",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(gptm_state),
+ .class_init = stellaris_gptm_class_init,
};
static void stellaris_adc_class_init(ObjectClass *klass, void *data)
@@ -1441,18 +1444,19 @@ static void stellaris_adc_class_init(ObjectClass *klass, void *data)
sdc->init = stellaris_adc_init;
}
-static DeviceInfo stellaris_adc_info = {
- .name = "stellaris-adc",
- .size = sizeof(stellaris_adc_state),
- .class_init = stellaris_adc_class_init,
+static TypeInfo stellaris_adc_info = {
+ .name = "stellaris-adc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(stellaris_adc_state),
+ .class_init = stellaris_adc_class_init,
};
static void stellaris_register_devices(void)
{
- sysbus_qdev_register(&stellaris_i2c_info);
- sysbus_qdev_register(&stellaris_gptm_info);
- sysbus_qdev_register(&stellaris_adc_info);
- ssi_register_slave(&stellaris_ssi_bus_info);
+ type_register_static(&stellaris_i2c_info);
+ type_register_static(&stellaris_gptm_info);
+ type_register_static(&stellaris_adc_info);
+ type_register_static(&stellaris_ssi_bus_info);
}
device_init(stellaris_register_devices)
diff --git a/hw/stellaris_enet.c b/hw/stellaris_enet.c
index 3d3ef66e5c..9b1be8dadc 100644
--- a/hw/stellaris_enet.c
+++ b/hw/stellaris_enet.c
@@ -427,21 +427,23 @@ static Property stellaris_enet_properties[] = {
static void stellaris_enet_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = stellaris_enet_init;
+ dc->props = stellaris_enet_properties;
}
-static DeviceInfo stellaris_enet_info = {
- .name = "stellaris_enet",
- .size = sizeof(stellaris_enet_state),
- .props = stellaris_enet_properties,
- .class_init = stellaris_enet_class_init,
+static TypeInfo stellaris_enet_info = {
+ .name = "stellaris_enet",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(stellaris_enet_state),
+ .class_init = stellaris_enet_class_init,
};
static void stellaris_enet_register_devices(void)
{
- sysbus_register_withprop(&stellaris_enet_info);
+ type_register_static(&stellaris_enet_info);
}
device_init(stellaris_enet_register_devices)
diff --git a/hw/strongarm.c b/hw/strongarm.c
index 15828bf1dd..8d2e7eb6fe 100644
--- a/hw/strongarm.c
+++ b/hw/strongarm.c
@@ -203,17 +203,19 @@ static VMStateDescription vmstate_strongarm_pic_regs = {
static void strongarm_pic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = strongarm_pic_initfn;
+ dc->desc = "StrongARM PIC";
+ dc->vmsd = &vmstate_strongarm_pic_regs;
}
-static DeviceInfo strongarm_pic_info = {
- .name = "strongarm_pic",
- .desc = "StrongARM PIC",
- .size = sizeof(StrongARMPICState),
- .vmsd = &vmstate_strongarm_pic_regs,
- .class_init = strongarm_pic_class_init,
+static TypeInfo strongarm_pic_info = {
+ .name = "strongarm_pic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(StrongARMPICState),
+ .class_init = strongarm_pic_class_init,
};
/* Real-Time Clock */
@@ -422,17 +424,19 @@ static const VMStateDescription vmstate_strongarm_rtc_regs = {
static void strongarm_rtc_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = strongarm_rtc_init;
+ dc->desc = "StrongARM RTC Controller";
+ dc->vmsd = &vmstate_strongarm_rtc_regs;
}
-static DeviceInfo strongarm_rtc_sysbus_info = {
- .name = "strongarm-rtc",
- .desc = "StrongARM RTC Controller",
- .size = sizeof(StrongARMRTCState),
- .vmsd = &vmstate_strongarm_rtc_regs,
- .class_init = strongarm_rtc_sysbus_class_init,
+static TypeInfo strongarm_rtc_sysbus_info = {
+ .name = "strongarm-rtc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(StrongARMRTCState),
+ .class_init = strongarm_rtc_sysbus_class_init,
};
/* GPIO */
@@ -662,16 +666,18 @@ static const VMStateDescription vmstate_strongarm_gpio_regs = {
static void strongarm_gpio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = strongarm_gpio_initfn;
+ dc->desc = "StrongARM GPIO controller";
}
-static DeviceInfo strongarm_gpio_info = {
- .name = "strongarm-gpio",
- .desc = "StrongARM GPIO controller",
- .size = sizeof(StrongARMGPIOInfo),
- .class_init = strongarm_gpio_class_init,
+static TypeInfo strongarm_gpio_info = {
+ .name = "strongarm-gpio",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(StrongARMGPIOInfo),
+ .class_init = strongarm_gpio_class_init,
};
/* Peripheral Pin Controller */
@@ -826,16 +832,18 @@ static const VMStateDescription vmstate_strongarm_ppc_regs = {
static void strongarm_ppc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = strongarm_ppc_init;
+ dc->desc = "StrongARM PPC controller";
}
-static DeviceInfo strongarm_ppc_info = {
- .name = "strongarm-ppc",
- .desc = "StrongARM PPC controller",
- .size = sizeof(StrongARMPPCInfo),
- .class_init = strongarm_ppc_class_init,
+static TypeInfo strongarm_ppc_info = {
+ .name = "strongarm-ppc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(StrongARMPPCInfo),
+ .class_init = strongarm_ppc_class_init,
};
/* UART Ports */
@@ -1280,19 +1288,21 @@ static Property strongarm_uart_properties[] = {
static void strongarm_uart_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = strongarm_uart_init;
+ dc->desc = "StrongARM UART controller";
+ dc->reset = strongarm_uart_reset;
+ dc->vmsd = &vmstate_strongarm_uart_regs;
+ dc->props = strongarm_uart_properties;
}
-static DeviceInfo strongarm_uart_info = {
- .name = "strongarm-uart",
- .desc = "StrongARM UART controller",
- .size = sizeof(StrongARMUARTState),
- .reset = strongarm_uart_reset,
- .vmsd = &vmstate_strongarm_uart_regs,
- .props = strongarm_uart_properties,
- .class_init = strongarm_uart_class_init,
+static TypeInfo strongarm_uart_info = {
+ .name = "strongarm-uart",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(StrongARMUARTState),
+ .class_init = strongarm_uart_class_init,
};
/* Synchronous Serial Ports */
@@ -1518,18 +1528,20 @@ static const VMStateDescription vmstate_strongarm_ssp_regs = {
static void strongarm_ssp_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = strongarm_ssp_init;
+ dc->desc = "StrongARM SSP controller";
+ dc->reset = strongarm_ssp_reset;
+ dc->vmsd = &vmstate_strongarm_ssp_regs;
}
-static DeviceInfo strongarm_ssp_info = {
- .name = "strongarm-ssp",
- .desc = "StrongARM SSP controller",
- .size = sizeof(StrongARMSSPState),
- .reset = strongarm_ssp_reset,
- .vmsd = &vmstate_strongarm_ssp_regs,
- .class_init = strongarm_ssp_class_init,
+static TypeInfo strongarm_ssp_info = {
+ .name = "strongarm-ssp",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(StrongARMSSPState),
+ .class_init = strongarm_ssp_class_init,
};
/* Main CPU functions */
@@ -1599,11 +1611,11 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,
static void strongarm_register_devices(void)
{
- sysbus_register_withprop(&strongarm_pic_info);
- sysbus_register_withprop(&strongarm_rtc_sysbus_info);
- sysbus_register_withprop(&strongarm_gpio_info);
- sysbus_register_withprop(&strongarm_ppc_info);
- sysbus_register_withprop(&strongarm_uart_info);
- sysbus_register_withprop(&strongarm_ssp_info);
+ type_register_static(&strongarm_pic_info);
+ type_register_static(&strongarm_rtc_sysbus_info);
+ type_register_static(&strongarm_gpio_info);
+ type_register_static(&strongarm_ppc_info);
+ type_register_static(&strongarm_uart_info);
+ type_register_static(&strongarm_ssp_info);
}
device_init(strongarm_register_devices)
diff --git a/hw/sun4c_intctl.c b/hw/sun4c_intctl.c
index 111d31b149..081d6cc8bd 100644
--- a/hw/sun4c_intctl.c
+++ b/hw/sun4c_intctl.c
@@ -208,22 +208,24 @@ static int sun4c_intctl_init1(SysBusDevice *dev)
static void sun4c_intctl_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = sun4c_intctl_init1;
+ dc->reset = sun4c_intctl_reset;
+ dc->vmsd = &vmstate_sun4c_intctl;
}
-static DeviceInfo sun4c_intctl_info = {
- .name = "sun4c_intctl",
- .size = sizeof(Sun4c_INTCTLState),
- .vmsd = &vmstate_sun4c_intctl,
- .reset = sun4c_intctl_reset,
- .class_init = sun4c_intctl_class_init,
+static TypeInfo sun4c_intctl_info = {
+ .name = "sun4c_intctl",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(Sun4c_INTCTLState),
+ .class_init = sun4c_intctl_class_init,
};
static void sun4c_intctl_register_devices(void)
{
- sysbus_register_withprop(&sun4c_intctl_info);
+ type_register_static(&sun4c_intctl_info);
}
device_init(sun4c_intctl_register_devices)
diff --git a/hw/sun4m.c b/hw/sun4m.c
index f2ff0bda9c..b79d14c35a 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -616,15 +616,16 @@ static void idreg_class_init(ObjectClass *klass, void *data)
k->init = idreg_init1;
}
-static DeviceInfo idreg_info = {
- .name = "macio_idreg",
- .size = sizeof(IDRegState),
- .class_init = idreg_class_init,
+static TypeInfo idreg_info = {
+ .name = "macio_idreg",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(IDRegState),
+ .class_init = idreg_class_init,
};
static void idreg_register_devices(void)
{
- sysbus_register_withprop(&idreg_info);
+ type_register_static(&idreg_info);
}
device_init(idreg_register_devices);
@@ -664,15 +665,16 @@ static void afx_class_init(ObjectClass *klass, void *data)
k->init = afx_init1;
}
-static DeviceInfo afx_info = {
- .name = "tcx_afx",
- .size = sizeof(AFXState),
- .class_init = afx_class_init,
+static TypeInfo afx_info = {
+ .name = "tcx_afx",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(AFXState),
+ .class_init = afx_class_init,
};
static void afx_register_devices(void)
{
- sysbus_register_withprop(&afx_info);
+ type_register_static(&afx_info);
}
device_init(afx_register_devices);
@@ -740,21 +742,23 @@ static Property prom_properties[] = {
static void prom_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = prom_init1;
+ dc->props = prom_properties;
}
-static DeviceInfo prom_info = {
- .name = "openprom",
- .size = sizeof(PROMState),
- .props = prom_properties,
- .class_init = prom_class_init,
+static TypeInfo prom_info = {
+ .name = "openprom",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PROMState),
+ .class_init = prom_class_init,
};
static void prom_register_devices(void)
{
- sysbus_register_withprop(&prom_info);
+ type_register_static(&prom_info);
}
device_init(prom_register_devices);
@@ -809,21 +813,23 @@ static Property ram_properties[] = {
static void ram_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = ram_init1;
+ dc->props = ram_properties;
}
-static DeviceInfo ram_info = {
- .name = "memory",
- .size = sizeof(RamDevice),
- .props = ram_properties,
- .class_init = ram_class_init,
+static TypeInfo ram_info = {
+ .name = "memory",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(RamDevice),
+ .class_init = ram_class_init,
};
static void ram_register_devices(void)
{
- sysbus_register_withprop(&ram_info);
+ type_register_static(&ram_info);
}
device_init(ram_register_devices);
diff --git a/hw/sun4m_iommu.c b/hw/sun4m_iommu.c
index 823bfaca1b..727532cb09 100644
--- a/hw/sun4m_iommu.c
+++ b/hw/sun4m_iommu.c
@@ -364,23 +364,25 @@ static Property iommu_properties[] = {
static void iommu_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = iommu_init1;
+ dc->reset = iommu_reset;
+ dc->vmsd = &vmstate_iommu;
+ dc->props = iommu_properties;
}
-static DeviceInfo iommu_info = {
- .name = "iommu",
- .size = sizeof(IOMMUState),
- .vmsd = &vmstate_iommu,
- .reset = iommu_reset,
- .props = iommu_properties,
- .class_init = iommu_class_init,
+static TypeInfo iommu_info = {
+ .name = "iommu",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(IOMMUState),
+ .class_init = iommu_class_init,
};
static void iommu_register_devices(void)
{
- sysbus_register_withprop(&iommu_info);
+ type_register_static(&iommu_info);
}
device_init(iommu_register_devices)
diff --git a/hw/sun4u.c b/hw/sun4u.c
index f3bb226880..79bbd495eb 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -573,15 +573,16 @@ static void ebus_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_OTHER;
}
-static DeviceInfo ebus_info = {
- .name = "ebus",
- .size = sizeof(EbusState),
- .class_init = ebus_class_init,
+static TypeInfo ebus_info = {
+ .name = "ebus",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(EbusState),
+ .class_init = ebus_class_init,
};
static void pci_ebus_register(void)
{
- pci_qdev_register(&ebus_info);
+ type_register_static(&ebus_info);
}
device_init(pci_ebus_register);
@@ -649,21 +650,23 @@ static Property prom_properties[] = {
static void prom_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = prom_init1;
+ dc->props = prom_properties;
}
-static DeviceInfo prom_info = {
- .name = "openprom",
- .size = sizeof(PROMState),
- .props = prom_properties,
- .class_init = prom_class_init,
+static TypeInfo prom_info = {
+ .name = "openprom",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PROMState),
+ .class_init = prom_class_init,
};
static void prom_register_devices(void)
{
- sysbus_register_withprop(&prom_info);
+ type_register_static(&prom_info);
}
device_init(prom_register_devices);
@@ -711,21 +714,23 @@ static Property ram_properties[] = {
static void ram_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = ram_init1;
+ dc->props = ram_properties;
}
-static DeviceInfo ram_info = {
- .name = "memory",
- .size = sizeof(RamDevice),
- .props = ram_properties,
- .class_init = ram_class_init,
+static TypeInfo ram_info = {
+ .name = "memory",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(RamDevice),
+ .class_init = ram_class_init,
};
static void ram_register_devices(void)
{
- sysbus_register_withprop(&ram_info);
+ type_register_static(&ram_info);
}
device_init(ram_register_devices);
diff --git a/hw/sysbus.c b/hw/sysbus.c
index 7d122f9eb5..4870dbfbf3 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -113,20 +113,6 @@ static int sysbus_device_init(DeviceState *dev, DeviceInfo *base)
return sbc->init(sd);
}
-void sysbus_qdev_register_subclass(DeviceInfo *info, const char *parent)
-{
- info->init = sysbus_device_init;
- info->bus_info = &system_bus_info;
-
- assert(info->size >= sizeof(SysBusDevice));
- qdev_register_subclass(info, parent);
-}
-
-void sysbus_qdev_register(DeviceInfo *info)
-{
- sysbus_qdev_register_subclass(info, TYPE_SYS_BUS_DEVICE);
-}
-
DeviceState *sysbus_create_varargs(const char *name,
target_phys_addr_t addr, ...)
{
@@ -254,12 +240,20 @@ MemoryRegion *sysbus_address_space(SysBusDevice *dev)
return get_system_memory();
}
+static void sysbus_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = sysbus_device_init;
+ k->bus_info = &system_bus_info;
+}
+
static TypeInfo sysbus_device_type_info = {
.name = TYPE_SYS_BUS_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(SysBusDevice),
.abstract = true,
.class_size = sizeof(SysBusDeviceClass),
+ .class_init = sysbus_device_class_init,
};
static void sysbus_register(void)
diff --git a/hw/sysbus.h b/hw/sysbus.h
index a406077a66..22555cd443 100644
--- a/hw/sysbus.h
+++ b/hw/sysbus.h
@@ -44,10 +44,6 @@ struct SysBusDevice {
#define sysbus_from_qdev(dev) ((SysBusDevice *)(dev))
#define FROM_SYSBUS(type, dev) DO_UPCAST(type, busdev, dev)
-#define sysbus_register_withprop(info) sysbus_qdev_register(info)
-void sysbus_qdev_register(DeviceInfo *info);
-void sysbus_qdev_register_subclass(DeviceInfo *info, const char *parent);
-
void *sysbus_new(void);
void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
diff --git a/hw/tcx.c b/hw/tcx.c
index 7743c05f2f..f400f92307 100644
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -649,23 +649,25 @@ static Property tcx_properties[] = {
static void tcx_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = tcx_init1;
+ dc->reset = tcx_reset;
+ dc->vmsd = &vmstate_tcx;
+ dc->props = tcx_properties;
}
-static DeviceInfo tcx_info = {
- .name = "SUNW,tcx",
- .size = sizeof(TCXState),
- .reset = tcx_reset,
- .vmsd = &vmstate_tcx,
- .props = tcx_properties,
- .class_init = tcx_class_init,
+static TypeInfo tcx_info = {
+ .name = "SUNW,tcx",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(TCXState),
+ .class_init = tcx_class_init,
};
static void tcx_register_devices(void)
{
- sysbus_register_withprop(&tcx_info);
+ type_register_static(&tcx_info);
}
device_init(tcx_register_devices)
diff --git a/hw/tmp105.c b/hw/tmp105.c
index 12fe60d019..a3bdd91d40 100644
--- a/hw/tmp105.c
+++ b/hw/tmp105.c
@@ -228,24 +228,26 @@ static int tmp105_init(I2CSlave *i2c)
static void tmp105_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
k->init = tmp105_init;
k->event = tmp105_event;
k->recv = tmp105_rx;
k->send = tmp105_tx;
+ dc->vmsd = &vmstate_tmp105;
}
-static DeviceInfo tmp105_info = {
- .name = "tmp105",
- .size = sizeof(TMP105State),
- .vmsd = &vmstate_tmp105,
- .class_init = tmp105_class_init,
+static TypeInfo tmp105_info = {
+ .name = "tmp105",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(TMP105State),
+ .class_init = tmp105_class_init,
};
static void tmp105_register_devices(void)
{
- i2c_register_slave(&tmp105_info);
+ type_register_static(&tmp105_info);
}
device_init(tmp105_register_devices)
diff --git a/hw/tosa.c b/hw/tosa.c
index 9f112b1349..c0d401759e 100644
--- a/hw/tosa.c
+++ b/hw/tosa.c
@@ -269,11 +269,12 @@ static void tosa_dac_class_init(ObjectClass *klass, void *data)
k->send = tosa_dac_send;
}
-static DeviceInfo tosa_dac_info = {
- .name = "tosa_dac",
- .size = sizeof(TosaDACState),
- .class_init = tosa_dac_class_init,
- };
+static TypeInfo tosa_dac_info = {
+ .name = "tosa_dac",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(TosaDACState),
+ .class_init = tosa_dac_class_init,
+};
static void tosa_ssp_class_init(ObjectClass *klass, void *data)
{
@@ -283,16 +284,17 @@ static void tosa_ssp_class_init(ObjectClass *klass, void *data)
k->transfer = tosa_ssp_tansfer;
}
-static DeviceInfo tosa_ssp_info = {
- .name = "tosa-ssp",
- .size = sizeof(SSISlave),
- .class_init = tosa_ssp_class_init,
+static TypeInfo tosa_ssp_info = {
+ .name = "tosa-ssp",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(SSISlave),
+ .class_init = tosa_ssp_class_init,
};
static void tosa_register_devices(void)
{
- i2c_register_slave(&tosa_dac_info);
- ssi_register_slave(&tosa_ssp_info);
+ type_register_static(&tosa_dac_info);
+ type_register_static(&tosa_ssp_info);
}
device_init(tosa_register_devices)
diff --git a/hw/tusb6010.c b/hw/tusb6010.c
index 8e11c545be..0ade670906 100644
--- a/hw/tusb6010.c
+++ b/hw/tusb6010.c
@@ -791,21 +791,23 @@ static int tusb6010_init(SysBusDevice *dev)
static void tusb6010_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = tusb6010_init;
+ dc->reset = tusb6010_reset;
}
-static DeviceInfo tusb6010_info = {
- .name = "tusb6010",
- .size = sizeof(TUSBState),
- .reset = tusb6010_reset,
- .class_init = tusb6010_class_init,
+static TypeInfo tusb6010_info = {
+ .name = "tusb6010",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(TUSBState),
+ .class_init = tusb6010_class_init,
};
static void tusb6010_register_device(void)
{
- sysbus_register_withprop(&tusb6010_info);
+ type_register_static(&tusb6010_info);
}
device_init(tusb6010_register_device)
diff --git a/hw/twl92230.c b/hw/twl92230.c
index ba4f8aae75..03fdccc8ce 100644
--- a/hw/twl92230.c
+++ b/hw/twl92230.c
@@ -859,24 +859,26 @@ static int twl92230_init(I2CSlave *i2c)
static void twl92230_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass);
sc->init = twl92230_init;
sc->event = menelaus_event;
sc->recv = menelaus_rx;
sc->send = menelaus_tx;
+ dc->vmsd = &vmstate_menelaus;
}
-static DeviceInfo twl92230_info = {
- .name ="twl92230",
- .size = sizeof(MenelausState),
- .vmsd = &vmstate_menelaus,
- .class_init = twl92230_class_init,
+static TypeInfo twl92230_info = {
+ .name = "twl92230",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(MenelausState),
+ .class_init = twl92230_class_init,
};
static void twl92230_register_devices(void)
{
- i2c_register_slave(&twl92230_info);
+ type_register_static(&twl92230_info);
}
device_init(twl92230_register_devices)
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index 9822353420..17d86aac68 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -350,9 +350,10 @@ static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_HOST;
}
-static DeviceInfo unin_main_pci_host_info = {
+static TypeInfo unin_main_pci_host_info = {
.name = "uni-north-pci",
- .size = sizeof(PCIDevice),
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
.class_init = unin_main_pci_host_class_init,
};
@@ -367,9 +368,10 @@ static void u3_agp_pci_host_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_HOST;
}
-static DeviceInfo u3_agp_pci_host_info = {
+static TypeInfo u3_agp_pci_host_info = {
.name = "u3-agp",
- .size = sizeof(PCIDevice),
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
.class_init = u3_agp_pci_host_class_init,
};
@@ -384,9 +386,10 @@ static void unin_agp_pci_host_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_HOST;
}
-static DeviceInfo unin_agp_pci_host_info = {
+static TypeInfo unin_agp_pci_host_info = {
.name = "uni-north-agp",
- .size = sizeof(PCIDevice),
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
.class_init = unin_agp_pci_host_class_init,
};
@@ -401,9 +404,10 @@ static void unin_internal_pci_host_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_HOST;
}
-static DeviceInfo unin_internal_pci_host_info = {
+static TypeInfo unin_internal_pci_host_info = {
.name = "uni-north-internal-pci",
- .size = sizeof(PCIDevice),
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
.class_init = unin_internal_pci_host_class_init,
};
@@ -414,10 +418,11 @@ static void pci_unin_main_class_init(ObjectClass *klass, void *data)
sbc->init = pci_unin_main_init_device;
}
-static DeviceInfo pci_unin_main_info = {
- .name = "uni-north-pci-pcihost",
- .size = sizeof(UNINState),
- .class_init = pci_unin_main_class_init,
+static TypeInfo pci_unin_main_info = {
+ .name = "uni-north-pci-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(UNINState),
+ .class_init = pci_unin_main_class_init,
};
static void pci_u3_agp_class_init(ObjectClass *klass, void *data)
@@ -427,10 +432,11 @@ static void pci_u3_agp_class_init(ObjectClass *klass, void *data)
sbc->init = pci_u3_agp_init_device;
}
-static DeviceInfo pci_u3_agp_info = {
- .name = "u3-agp-pcihost",
- .size = sizeof(UNINState),
- .class_init = pci_u3_agp_class_init,
+static TypeInfo pci_u3_agp_info = {
+ .name = "u3-agp-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(UNINState),
+ .class_init = pci_u3_agp_class_init,
};
static void pci_unin_agp_class_init(ObjectClass *klass, void *data)
@@ -440,10 +446,11 @@ static void pci_unin_agp_class_init(ObjectClass *klass, void *data)
sbc->init = pci_unin_agp_init_device;
}
-static DeviceInfo pci_unin_agp_info = {
- .name = "uni-north-agp-pcihost",
- .size = sizeof(UNINState),
- .class_init = pci_unin_agp_class_init,
+static TypeInfo pci_unin_agp_info = {
+ .name = "uni-north-agp-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(UNINState),
+ .class_init = pci_unin_agp_class_init,
};
static void pci_unin_internal_class_init(ObjectClass *klass, void *data)
@@ -453,23 +460,24 @@ static void pci_unin_internal_class_init(ObjectClass *klass, void *data)
sbc->init = pci_unin_internal_init_device;
}
-static DeviceInfo pci_unin_internal_info = {
- .name = "uni-north-internal-pci-pcihost",
- .size = sizeof(UNINState),
- .class_init = pci_unin_internal_class_init,
+static TypeInfo pci_unin_internal_info = {
+ .name = "uni-north-internal-pci-pcihost",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(UNINState),
+ .class_init = pci_unin_internal_class_init,
};
static void unin_register_devices(void)
{
- pci_qdev_register(&unin_main_pci_host_info);
- pci_qdev_register(&u3_agp_pci_host_info);
- pci_qdev_register(&unin_agp_pci_host_info);
- pci_qdev_register(&unin_internal_pci_host_info);
-
- sysbus_register_withprop(&pci_unin_main_info);
- sysbus_register_withprop(&pci_u3_agp_info);
- sysbus_register_withprop(&pci_unin_agp_info);
- sysbus_register_withprop(&pci_unin_internal_info);
+ type_register_static(&unin_main_pci_host_info);
+ type_register_static(&u3_agp_pci_host_info);
+ type_register_static(&unin_agp_pci_host_info);
+ type_register_static(&unin_internal_pci_host_info);
+
+ type_register_static(&pci_unin_main_info);
+ type_register_static(&pci_u3_agp_info);
+ type_register_static(&pci_unin_agp_info);
+ type_register_static(&pci_unin_internal_info);
}
device_init(unin_register_devices)
diff --git a/hw/usb-audio.c b/hw/usb-audio.c
index 459f162041..cd589b718a 100644
--- a/hw/usb-audio.c
+++ b/hw/usb-audio.c
@@ -674,10 +674,20 @@ static const VMStateDescription vmstate_usb_audio = {
.unmigratable = 1,
};
+static Property usb_audio_properties[] = {
+ DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0),
+ DEFINE_PROP_UINT32("buffer", USBAudioState, buffer,
+ 8 * USBAUDIO_PACKET_SIZE),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_audio_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *k = USB_DEVICE_CLASS(klass);
+ dc->vmsd = &vmstate_usb_audio;
+ dc->props = usb_audio_properties;
k->product_desc = "QEMU USB Audio Interface";
k->usb_desc = &desc_audio;
k->init = usb_audio_initfn;
@@ -689,22 +699,16 @@ static void usb_audio_class_init(ObjectClass *klass, void *data)
k->set_interface = usb_audio_set_interface;
}
-static struct DeviceInfo usb_audio_info = {
- .name = "usb-audio",
- .size = sizeof(USBAudioState),
- .vmsd = &vmstate_usb_audio,
- .class_init = usb_audio_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0),
- DEFINE_PROP_UINT32("buffer", USBAudioState, buffer,
- 8 * USBAUDIO_PACKET_SIZE),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo usb_audio_info = {
+ .name = "usb-audio",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBAudioState),
+ .class_init = usb_audio_class_init,
};
static void usb_audio_register_devices(void)
{
- usb_qdev_register(&usb_audio_info);
+ type_register_static(&usb_audio_info);
usb_legacy_register("usb-audio", "audio", NULL);
}
diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index f497a446f4..90c3b0e0eb 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -529,6 +529,7 @@ static const VMStateDescription vmstate_usb_bt = {
static void usb_bt_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_bt_initfn;
@@ -539,17 +540,18 @@ static void usb_bt_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_bt_handle_control;
uc->handle_data = usb_bt_handle_data;
uc->handle_destroy = usb_bt_handle_destroy;
+ dc->vmsd = &vmstate_usb_bt;
}
-static struct DeviceInfo bt_info = {
- .name = "usb-bt-dongle",
- .size = sizeof(struct USBBtState),
- .vmsd = &vmstate_usb_bt,
- .class_init= usb_bt_class_initfn,
+static TypeInfo bt_info = {
+ .name = "usb-bt-dongle",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(struct USBBtState),
+ .class_init = usb_bt_class_initfn,
};
static void usb_bt_register_devices(void)
{
- usb_qdev_register(&bt_info);
+ type_register_static(&bt_info);
}
device_init(usb_bt_register_devices)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 6b0adfda19..d07f844657 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -220,15 +220,6 @@ void usb_legacy_register(const char *typename, const char *usbdevice_name,
}
}
-void usb_qdev_register(DeviceInfo *info)
-{
- info->bus_info = &usb_bus_info;
- info->init = usb_qdev_init;
- info->unplug = qdev_simple_unplug_cb;
- info->exit = usb_qdev_exit;
- qdev_register_subclass(info, TYPE_USB_DEVICE);
-}
-
USBDevice *usb_create(USBBus *bus, const char *name)
{
DeviceState *dev;
@@ -577,12 +568,22 @@ USBDevice *usbdevice_create(const char *cmdline)
return f->usbdevice_init(params);
}
+static void usb_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->bus_info = &usb_bus_info;
+ k->init = usb_qdev_init;
+ k->unplug = qdev_simple_unplug_cb;
+ k->exit = usb_qdev_exit;
+}
+
static TypeInfo usb_device_type_info = {
.name = TYPE_USB_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(USBDevice),
.abstract = true,
.class_size = sizeof(USBDeviceClass),
+ .class_init = usb_device_class_init,
};
static void usb_register_devices(void)
diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c
index a261d7d34d..844f873290 100644
--- a/hw/usb-ccid.c
+++ b/hw/usb-ccid.c
@@ -1184,14 +1184,6 @@ static int ccid_card_init(DeviceState *qdev, DeviceInfo *base)
return ret;
}
-void ccid_card_qdev_register(DeviceInfo *info)
-{
- info->bus_info = &ccid_bus_info;
- info->init = ccid_card_init;
- info->exit = ccid_card_exit;
- qdev_register_subclass(info, TYPE_CCID_CARD);
-}
-
static int ccid_initfn(USBDevice *dev)
{
USBCCIDState *s = DO_UPCAST(USBCCIDState, dev, dev);
@@ -1315,8 +1307,14 @@ static VMStateDescription ccid_vmstate = {
}
};
+static Property ccid_properties[] = {
+ DEFINE_PROP_UINT8("debug", USBCCIDState, debug, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void ccid_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = ccid_initfn;
@@ -1327,32 +1325,39 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = ccid_handle_control;
uc->handle_data = ccid_handle_data;
uc->handle_destroy = ccid_handle_destroy;
+ dc->desc = "CCID Rev 1.1 smartcard reader";
+ dc->vmsd = &ccid_vmstate;
+ dc->props = ccid_properties;
}
-static struct DeviceInfo ccid_info = {
- .name = CCID_DEV_NAME,
- .desc = "CCID Rev 1.1 smartcard reader",
- .size = sizeof(USBCCIDState),
- .class_init= ccid_class_initfn,
- .vmsd = &ccid_vmstate,
- .props = (Property[]) {
- DEFINE_PROP_UINT8("debug", USBCCIDState, debug, 0),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo ccid_info = {
+ .name = CCID_DEV_NAME,
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBCCIDState),
+ .class_init = ccid_class_initfn,
};
+static void ccid_card_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->bus_info = &ccid_bus_info;
+ k->init = ccid_card_init;
+ k->exit = ccid_card_exit;
+}
+
static TypeInfo ccid_card_type_info = {
.name = TYPE_CCID_CARD,
.parent = TYPE_DEVICE,
.instance_size = sizeof(CCIDCardState),
.abstract = true,
.class_size = sizeof(CCIDCardClass),
+ .class_init = ccid_card_class_init,
};
static void ccid_register_devices(void)
{
type_register_static(&ccid_card_type_info);
- usb_qdev_register(&ccid_info);
+ type_register_static(&ccid_info);
usb_legacy_register(CCID_DEV_NAME, "ccid", NULL);
}
device_init(ccid_register_devices)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 8baff1ddec..75ef71e69e 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -2265,6 +2265,7 @@ static Property ehci_properties[] = {
static void ehci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ehci_initfn;
@@ -2272,18 +2273,20 @@ static void ehci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801D; /* ich4 */
k->revision = 0x10;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_ehci;
+ dc->props = ehci_properties;
}
-static DeviceInfo ehci_info = {
- .name = "usb-ehci",
- .size = sizeof(EHCIState),
- .vmsd = &vmstate_ehci,
- .props = ehci_properties,
- .class_init = ehci_class_init,
+static TypeInfo ehci_info = {
+ .name = "usb-ehci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(EHCIState),
+ .class_init = ehci_class_init,
};
static void ich9_ehci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ehci_initfn;
@@ -2291,14 +2294,15 @@ static void ich9_ehci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801I_EHCI1;
k->revision = 0x03;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_ehci;
+ dc->props = ehci_properties;
}
-static DeviceInfo ich9_ehci_info = {
- .name = "ich9-usb-ehci1",
- .size = sizeof(EHCIState),
- .vmsd = &vmstate_ehci,
- .props = ehci_properties,
- .class_init = ich9_ehci_class_init,
+static TypeInfo ich9_ehci_info = {
+ .name = "ich9-usb-ehci1",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(EHCIState),
+ .class_init = ich9_ehci_class_init,
};
static int usb_ehci_initfn(PCIDevice *dev)
@@ -2374,8 +2378,8 @@ static int usb_ehci_initfn(PCIDevice *dev)
static void ehci_register(void)
{
- pci_qdev_register(&ehci_info);
- pci_qdev_register(&ich9_ehci_info);
+ type_register_static(&ehci_info);
+ type_register_static(&ich9_ehci_info);
}
device_init(ehci_register);
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 669aae4c3c..3c4e45da70 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -566,62 +566,68 @@ static void usb_hid_class_initfn(ObjectClass *klass, void *data)
static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
usb_hid_class_initfn(klass, data);
uc->init = usb_tablet_initfn;
uc->product_desc = "QEMU USB Tablet";
uc->usb_desc = &desc_tablet;
+ dc->vmsd = &vmstate_usb_ptr;
}
-static struct DeviceInfo usb_tablet_info = {
- .name = "usb-tablet",
- .size = sizeof(USBHIDState),
- .vmsd = &vmstate_usb_ptr,
- .class_init= usb_tablet_class_initfn,
+static TypeInfo usb_tablet_info = {
+ .name = "usb-tablet",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBHIDState),
+ .class_init = usb_tablet_class_initfn,
};
static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
usb_hid_class_initfn(klass, data);
uc->init = usb_mouse_initfn;
uc->product_desc = "QEMU USB Mouse";
uc->usb_desc = &desc_mouse;
+ dc->vmsd = &vmstate_usb_ptr;
}
-static struct DeviceInfo usb_mouse_info = {
- .name = "usb-mouse",
- .size = sizeof(USBHIDState),
- .vmsd = &vmstate_usb_ptr,
- .class_init= usb_mouse_class_initfn,
+static TypeInfo usb_mouse_info = {
+ .name = "usb-mouse",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBHIDState),
+ .class_init = usb_mouse_class_initfn,
};
static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
usb_hid_class_initfn(klass, data);
uc->init = usb_keyboard_initfn;
uc->product_desc = "QEMU USB Keyboard";
uc->usb_desc = &desc_keyboard;
+ dc->vmsd = &vmstate_usb_kbd;
}
-static struct DeviceInfo usb_keyboard_info = {
- .name = "usb-kbd",
- .size = sizeof(USBHIDState),
- .vmsd = &vmstate_usb_kbd,
- .class_init= usb_keyboard_class_initfn,
+static TypeInfo usb_keyboard_info = {
+ .name = "usb-kbd",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBHIDState),
+ .class_init = usb_keyboard_class_initfn,
};
static void usb_hid_register_devices(void)
{
- usb_qdev_register(&usb_tablet_info);
+ type_register_static(&usb_tablet_info);
usb_legacy_register("usb-tablet", "tablet", NULL);
- usb_qdev_register(&usb_mouse_info);
+ type_register_static(&usb_mouse_info);
usb_legacy_register("usb-mouse", "mouse", NULL);
- usb_qdev_register(&usb_keyboard_info);
+ type_register_static(&usb_keyboard_info);
usb_legacy_register("usb-kbd", "keyboard", NULL);
}
device_init(usb_hid_register_devices)
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 3e33685fa0..956b020eed 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -533,8 +533,9 @@ static const VMStateDescription vmstate_usb_hub = {
}
};
-static void usb_hub_class_initfn(ObjectClass *klass, void *data)
+static void usb_hub_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_hub_initfn;
@@ -545,18 +546,19 @@ static void usb_hub_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_hub_handle_control;
uc->handle_data = usb_hub_handle_data;
uc->handle_destroy = usb_hub_handle_destroy;
+ dc->fw_name = "hub";
+ dc->vmsd = &vmstate_usb_hub;
}
-static struct DeviceInfo hub_info = {
- .name = "usb-hub",
- .fw_name = "hub",
- .size = sizeof(USBHubState),
- .vmsd = &vmstate_usb_hub,
- .class_init= usb_hub_class_initfn,
+static TypeInfo hub_info = {
+ .name = "usb-hub",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBHubState),
+ .class_init = usb_hub_class_initfn,
};
static void usb_hub_register_devices(void)
{
- usb_qdev_register(&hub_info);
+ type_register_static(&hub_info);
}
device_init(usb_hub_register_devices)
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 19d0d7b8c8..6153376f3f 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -636,8 +636,16 @@ static const VMStateDescription vmstate_usb_msd = {
}
};
+static Property msd_properties[] = {
+ DEFINE_BLOCK_PROPERTIES(MSDState, conf),
+ DEFINE_PROP_STRING("serial", MSDState, serial),
+ DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_msd_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_msd_initfn;
@@ -649,25 +657,21 @@ static void usb_msd_class_initfn(ObjectClass *klass, void *data)
uc->handle_reset = usb_msd_handle_reset;
uc->handle_control = usb_msd_handle_control;
uc->handle_data = usb_msd_handle_data;
+ dc->fw_name = "storage";
+ dc->vmsd = &vmstate_usb_msd;
+ dc->props = msd_properties;
}
-static struct DeviceInfo msd_info = {
- .name = "usb-storage",
- .fw_name = "storage",
- .size = sizeof(MSDState),
- .vmsd = &vmstate_usb_msd,
- .class_init= usb_msd_class_initfn,
- .props = (Property[]) {
- DEFINE_BLOCK_PROPERTIES(MSDState, conf),
- DEFINE_PROP_STRING("serial", MSDState, serial),
- DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo msd_info = {
+ .name = "usb-storage",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(MSDState),
+ .class_init = usb_msd_class_initfn,
};
static void usb_msd_register_devices(void)
{
- usb_qdev_register(&msd_info);
+ type_register_static(&msd_info);
usb_legacy_register("usb-storage", "disk", usb_msd_init);
}
device_init(usb_msd_register_devices)
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 65eee95737..e2111413b4 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1385,8 +1385,14 @@ static const VMStateDescription vmstate_usb_net = {
.unmigratable = 1,
};
+static Property net_properties[] = {
+ DEFINE_NIC_PROPERTIES(USBNetState, conf),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_net_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_net_initfn;
@@ -1397,23 +1403,21 @@ static void usb_net_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_net_handle_control;
uc->handle_data = usb_net_handle_data;
uc->handle_destroy = usb_net_handle_destroy;
+ dc->fw_name = "network";
+ dc->vmsd = &vmstate_usb_net;
+ dc->props = net_properties;
}
-static struct DeviceInfo net_info = {
- .name = "usb-net",
- .fw_name = "network",
- .size = sizeof(USBNetState),
- .vmsd = &vmstate_usb_net,
- .class_init= usb_net_class_initfn,
- .props = (Property[]) {
- DEFINE_NIC_PROPERTIES(USBNetState, conf),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo net_info = {
+ .name = "usb-net",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBNetState),
+ .class_init = usb_net_class_initfn,
};
static void usb_net_register_devices(void)
{
- usb_qdev_register(&net_info);
+ type_register_static(&net_info);
usb_legacy_register("usb-net", "net", usb_net_init);
}
device_init(usb_net_register_devices)
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 3437da1586..425030f141 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1845,44 +1845,50 @@ static Property ohci_pci_properties[] = {
static void ohci_pci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ohci_initfn_pci;
k->vendor_id = PCI_VENDOR_ID_APPLE;
k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->desc = "Apple USB Controller";
+ dc->props = ohci_pci_properties;
}
-static DeviceInfo ohci_pci_info = {
- .name = "pci-ohci",
- .desc = "Apple USB Controller",
- .size = sizeof(OHCIPCIState),
- .props = ohci_pci_properties,
- .class_init = ohci_pci_class_init,
+static TypeInfo ohci_pci_info = {
+ .name = "pci-ohci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(OHCIPCIState),
+ .class_init = ohci_pci_class_init,
+};
+
+static Property ohci_sysbus_properties[] = {
+ DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
+ DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
+ DEFINE_PROP_END_OF_LIST(),
};
static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
sbc->init = ohci_init_pxa;
+ dc->desc = "OHCI USB Controller";
+ dc->props = ohci_sysbus_properties;
}
-static DeviceInfo ohci_sysbus_info = {
- .name = "sysbus-ohci",
- .desc = "OHCI USB Controller",
- .size = sizeof(OHCISysBusState),
- .class_init = ohci_sysbus_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
- DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo ohci_sysbus_info = {
+ .name = "sysbus-ohci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(OHCISysBusState),
+ .class_init = ohci_sysbus_class_init,
};
static void ohci_register(void)
{
- pci_qdev_register(&ohci_pci_info);
- sysbus_register_withprop(&ohci_sysbus_info);
+ type_register_static(&ohci_pci_info);
+ type_register_static(&ohci_sysbus_info);
}
device_init(ohci_register);
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 00b4985fd8..c2cb6d24e8 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -570,8 +570,14 @@ static const VMStateDescription vmstate_usb_serial = {
.unmigratable = 1,
};
+static Property serial_properties[] = {
+ DEFINE_PROP_CHR("chardev", USBSerialState, cs),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_serial_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_serial_initfn;
@@ -582,21 +588,25 @@ static void usb_serial_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_serial_handle_control;
uc->handle_data = usb_serial_handle_data;
uc->handle_destroy = usb_serial_handle_destroy;
+ dc->vmsd = &vmstate_usb_serial;
+ dc->props = serial_properties;
}
-static struct DeviceInfo serial_info = {
- .name = "usb-serial",
- .size = sizeof(USBSerialState),
- .vmsd = &vmstate_usb_serial,
- .class_init= usb_serial_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_CHR("chardev", USBSerialState, cs),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo serial_info = {
+ .name = "usb-serial",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBSerialState),
+ .class_init = usb_serial_class_initfn,
+};
+
+static Property braille_properties[] = {
+ DEFINE_PROP_CHR("chardev", USBSerialState, cs),
+ DEFINE_PROP_END_OF_LIST(),
};
static void usb_braille_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_serial_initfn;
@@ -607,24 +617,22 @@ static void usb_braille_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_serial_handle_control;
uc->handle_data = usb_serial_handle_data;
uc->handle_destroy = usb_serial_handle_destroy;
+ dc->vmsd = &vmstate_usb_serial;
+ dc->props = braille_properties;
}
-static struct DeviceInfo braille_info = {
- .name = "usb-braille",
- .size = sizeof(USBSerialState),
- .vmsd = &vmstate_usb_serial,
- .class_init= usb_braille_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_CHR("chardev", USBSerialState, cs),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo braille_info = {
+ .name = "usb-braille",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBSerialState),
+ .class_init = usb_braille_class_initfn,
};
static void usb_serial_register_devices(void)
{
- usb_qdev_register(&serial_info);
+ type_register_static(&serial_info);
usb_legacy_register("usb-serial", "serial", usb_serial_init);
- usb_qdev_register(&braille_info);
+ type_register_static(&braille_info);
usb_legacy_register("usb-braille", "braille", usb_braille_init);
}
device_init(usb_serial_register_devices)
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index e20d7c4ad5..cddcc8927a 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1194,6 +1194,7 @@ static Property uhci_properties[] = {
static void piix3_uhci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_uhci_common_initfn;
@@ -1202,18 +1203,20 @@ static void piix3_uhci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_2;
k->revision = 0x01;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_uhci;
+ dc->props = uhci_properties;
}
-static DeviceInfo piix3_uhci_info = {
- .name = "piix3-usb-uhci",
- .size = sizeof(UHCIState),
- .vmsd = &vmstate_uhci,
- .props = uhci_properties,
- .class_init = piix3_uhci_class_init,
+static TypeInfo piix3_uhci_info = {
+ .name = "piix3-usb-uhci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(UHCIState),
+ .class_init = piix3_uhci_class_init,
};
static void piix4_uhci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_uhci_common_initfn;
@@ -1222,18 +1225,20 @@ static void piix4_uhci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_2;
k->revision = 0x01;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_uhci;
+ dc->props = uhci_properties;
}
-static DeviceInfo piix4_uhci_info = {
- .name = "piix4-usb-uhci",
- .size = sizeof(UHCIState),
- .vmsd = &vmstate_uhci,
- .props = uhci_properties,
- .class_init = piix4_uhci_class_init,
+static TypeInfo piix4_uhci_info = {
+ .name = "piix4-usb-uhci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(UHCIState),
+ .class_init = piix4_uhci_class_init,
};
static void vt82c686b_uhci_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_uhci_vt82c686b_initfn;
@@ -1242,18 +1247,20 @@ static void vt82c686b_uhci_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_UHCI;
k->revision = 0x01;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_uhci;
+ dc->props = uhci_properties;
}
-static DeviceInfo vt82c686b_uhci_info = {
- .name = "vt82c686b-usb-uhci",
- .size = sizeof(UHCIState),
- .vmsd = &vmstate_uhci,
- .props = uhci_properties,
- .class_init = vt82c686b_uhci_class_init,
+static TypeInfo vt82c686b_uhci_info = {
+ .name = "vt82c686b-usb-uhci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(UHCIState),
+ .class_init = vt82c686b_uhci_class_init,
};
static void ich9_uhci1_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_uhci_common_initfn;
@@ -1261,18 +1268,20 @@ static void ich9_uhci1_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI1;
k->revision = 0x03;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_uhci;
+ dc->props = uhci_properties;
}
-static DeviceInfo ich9_uhci1_info = {
- .name = "ich9-usb-uhci1",
- .size = sizeof(UHCIState),
- .vmsd = &vmstate_uhci,
- .props = uhci_properties,
- .class_init = ich9_uhci1_class_init,
+static TypeInfo ich9_uhci1_info = {
+ .name = "ich9-usb-uhci1",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(UHCIState),
+ .class_init = ich9_uhci1_class_init,
};
static void ich9_uhci2_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_uhci_common_initfn;
@@ -1280,18 +1289,20 @@ static void ich9_uhci2_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI2;
k->revision = 0x03;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_uhci;
+ dc->props = uhci_properties;
}
-static DeviceInfo ich9_uhci2_info = {
- .name = "ich9-usb-uhci2",
- .size = sizeof(UHCIState),
- .vmsd = &vmstate_uhci,
- .props = uhci_properties,
- .class_init = ich9_uhci2_class_init,
+static TypeInfo ich9_uhci2_info = {
+ .name = "ich9-usb-uhci2",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(UHCIState),
+ .class_init = ich9_uhci2_class_init,
};
static void ich9_uhci3_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_uhci_common_initfn;
@@ -1299,24 +1310,25 @@ static void ich9_uhci3_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI3;
k->revision = 0x03;
k->class_id = PCI_CLASS_SERIAL_USB;
+ dc->vmsd = &vmstate_uhci;
+ dc->props = uhci_properties;
}
-static DeviceInfo ich9_uhci3_info = {
- .name = "ich9-usb-uhci3",
- .size = sizeof(UHCIState),
- .vmsd = &vmstate_uhci,
- .props = uhci_properties,
- .class_init = ich9_uhci3_class_init,
+static TypeInfo ich9_uhci3_info = {
+ .name = "ich9-usb-uhci3",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(UHCIState),
+ .class_init = ich9_uhci3_class_init,
};
static void uhci_register(void)
{
- pci_qdev_register(&piix3_uhci_info);
- pci_qdev_register(&piix4_uhci_info);
- pci_qdev_register(&vt82c686b_uhci_info);
- pci_qdev_register(&ich9_uhci1_info);
- pci_qdev_register(&ich9_uhci2_info);
- pci_qdev_register(&ich9_uhci3_info);
+ type_register_static(&piix3_uhci_info);
+ type_register_static(&piix4_uhci_info);
+ type_register_static(&vt82c686b_uhci_info);
+ type_register_static(&ich9_uhci1_info);
+ type_register_static(&ich9_uhci2_info);
+ type_register_static(&ich9_uhci3_info);
}
device_init(uhci_register);
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index 40bb199e88..14de14d5f7 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -349,9 +349,10 @@ static const VMStateDescription vmstate_usb_wacom = {
.unmigratable = 1,
};
-static void usb_wacom_class_init(ObjectClass *class, void *data)
+static void usb_wacom_class_init(ObjectClass *klass, void *data)
{
- USBDeviceClass *uc = USB_DEVICE_CLASS(class);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->product_desc = "QEMU PenPartner Tablet";
uc->usb_desc = &desc_wacom;
@@ -361,19 +362,20 @@ static void usb_wacom_class_init(ObjectClass *class, void *data)
uc->handle_control = usb_wacom_handle_control;
uc->handle_data = usb_wacom_handle_data;
uc->handle_destroy = usb_wacom_handle_destroy;
+ dc->desc = "QEMU PenPartner Tablet";
+ dc->vmsd = &vmstate_usb_wacom;
}
-static struct DeviceInfo wacom_info = {
- .name = "usb-wacom-tablet",
- .desc = "QEMU PenPartner Tablet",
- .size = sizeof(USBWacomState),
- .vmsd = &vmstate_usb_wacom,
- .class_init= usb_wacom_class_init,
+static TypeInfo wacom_info = {
+ .name = "usb-wacom-tablet",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBWacomState),
+ .class_init = usb_wacom_class_init,
};
static void usb_wacom_register_devices(void)
{
- usb_qdev_register(&wacom_info);
+ type_register_static(&wacom_info);
usb_legacy_register("usb-wacom-tablet", "wacom-tablet", NULL);
}
device_init(usb_wacom_register_devices)
diff --git a/hw/usb-xhci.c b/hw/usb-xhci.c
index fba2de322a..37e887c431 100644
--- a/hw/usb-xhci.c
+++ b/hw/usb-xhci.c
@@ -2724,10 +2724,18 @@ static const VMStateDescription vmstate_xhci = {
.unmigratable = 1,
};
+static Property xhci_properties[] = {
+ DEFINE_PROP_UINT32("msi", XHCIState, msi, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void xhci_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->vmsd = &vmstate_xhci;
+ dc->props = xhci_properties;
k->init = usb_xhci_initfn;
k->vendor_id = PCI_VENDOR_ID_NEC;
k->device_id = PCI_DEVICE_ID_NEC_UPD720200;
@@ -2737,20 +2745,15 @@ static void xhci_class_init(ObjectClass *klass, void *data)
k->config_write = xhci_write_config;
}
-static DeviceInfo xhci_info = {
- .name = "nec-usb-xhci",
- .alias = "xhci",
- .size = sizeof(XHCIState),
- .vmsd = &vmstate_xhci,
- .class_init = xhci_class_init,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("msi", XHCIState, msi, 0),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo xhci_info = {
+ .name = "nec-usb-xhci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(XHCIState),
+ .class_init = xhci_class_init,
};
static void xhci_register(void)
{
- pci_qdev_register(&xhci_info);
+ type_register_static(&xhci_info);
}
device_init(xhci_register);
diff --git a/hw/usb.h b/hw/usb.h
index b9b67428a4..13e7c8ea7f 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -418,7 +418,6 @@ struct USBBusOps {
void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host);
USBBus *usb_bus_find(int busnr);
-void usb_qdev_register(DeviceInfo *info);
void usb_legacy_register(const char *typename, const char *usbdevice_name,
USBDevice *(*usbdevice_init)(const char *params));
USBDevice *usb_create(USBBus *bus, const char *name);
diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index c2eb4dda75..c4105e977b 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -119,10 +119,11 @@ static void versatile_pci_host_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_PROCESSOR_CO;
}
-static DeviceInfo versatile_pci_host_info = {
- .name = "versatile_pci_host",
- .size = sizeof(PCIDevice),
- .class_init = versatile_pci_host_class_init,
+static TypeInfo versatile_pci_host_info = {
+ .name = "versatile_pci_host",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIDevice),
+ .class_init = versatile_pci_host_class_init,
};
static void pci_vpb_class_init(ObjectClass *klass, void *data)
@@ -132,10 +133,11 @@ static void pci_vpb_class_init(ObjectClass *klass, void *data)
sdc->init = pci_vpb_init;
}
-static DeviceInfo pci_vpb_info = {
- .name = "versatile_pci",
- .size = sizeof(PCIVPBState),
- .class_init = pci_vpb_class_init,
+static TypeInfo pci_vpb_info = {
+ .name = "versatile_pci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PCIVPBState),
+ .class_init = pci_vpb_class_init,
};
static void pci_realview_class_init(ObjectClass *klass, void *data)
@@ -145,17 +147,18 @@ static void pci_realview_class_init(ObjectClass *klass, void *data)
sdc->init = pci_realview_init;
}
-static DeviceInfo pci_realview_info = {
- .name = "realview_pci",
- .size = sizeof(PCIVPBState),
- .class_init = pci_realview_class_init,
+static TypeInfo pci_realview_info = {
+ .name = "realview_pci",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PCIVPBState),
+ .class_init = pci_realview_class_init,
};
static void versatile_pci_register_devices(void)
{
- sysbus_qdev_register(&pci_vpb_info);
- sysbus_qdev_register(&pci_realview_info);
- pci_qdev_register(&versatile_pci_host_info);
+ type_register_static(&pci_vpb_info);
+ type_register_static(&pci_realview_info);
+ type_register_static(&versatile_pci_host_info);
}
device_init(versatile_pci_register_devices)
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 3f7490c829..6e28e78f44 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -367,22 +367,24 @@ machine_init(versatile_machine_init);
static void vpb_sic_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = vpb_sic_init;
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_vpb_sic;
}
-static DeviceInfo vpb_sic_info = {
- .name = "versatilepb_sic",
- .size = sizeof(vpb_sic_state),
- .vmsd = &vmstate_vpb_sic,
- .no_user = 1,
- .class_init = vpb_sic_class_init,
+static TypeInfo vpb_sic_info = {
+ .name = "versatilepb_sic",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(vpb_sic_state),
+ .class_init = vpb_sic_class_init,
};
static void versatilepb_register_devices(void)
{
- sysbus_register_withprop(&vpb_sic_info);
+ type_register_static(&vpb_sic_info);
}
device_init(versatilepb_register_devices)
diff --git a/hw/vga-isa.c b/hw/vga-isa.c
index cb6af91a7e..8d3ff0d47b 100644
--- a/hw/vga-isa.c
+++ b/hw/vga-isa.c
@@ -71,20 +71,22 @@ static int vga_initfn(ISADevice *dev)
static void vga_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = vga_initfn;
+ dc->reset = vga_reset_isa;
+ dc->vmsd = &vmstate_vga_common;
}
-static DeviceInfo vga_info = {
- .name = "isa-vga",
- .size = sizeof(ISAVGAState),
- .vmsd = &vmstate_vga_common,
- .reset = vga_reset_isa,
- .class_init = vga_class_initfn,
+static TypeInfo vga_info = {
+ .name = "isa-vga",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(ISAVGAState),
+ .class_init = vga_class_initfn,
};
static void vga_register(void)
{
- isa_qdev_register(&vga_info);
+ type_register_static(&vga_info);
}
device_init(vga_register)
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index ef9f8a5a9f..974a7a9d6f 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -77,6 +77,7 @@ DeviceState *pci_vga_init(PCIBus *bus)
static void vga_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -85,17 +86,18 @@ static void vga_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_QEMU;
k->device_id = PCI_DEVICE_ID_QEMU_VGA;
k->class_id = PCI_CLASS_DISPLAY_VGA;
+ dc->vmsd = &vmstate_vga_pci;
}
-static DeviceInfo vga_info = {
- .name = "VGA",
- .size = sizeof(PCIVGAState),
- .vmsd = &vmstate_vga_pci,
- .class_init = vga_class_init,
+static TypeInfo vga_info = {
+ .name = "VGA",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIVGAState),
+ .class_init = vga_class_init,
};
static void vga_register(void)
{
- pci_qdev_register(&vga_info);
+ type_register_static(&vga_info);
}
device_init(vga_register);
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 73c3935edc..4f2c3e4379 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -131,6 +131,7 @@ static Property virtconsole_properties[] = {
static void virtconsole_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
k->is_console = true;
@@ -138,18 +139,19 @@ static void virtconsole_class_init(ObjectClass *klass, void *data)
k->have_data = flush_buf;
k->guest_open = guest_open;
k->guest_close = guest_close;
+ dc->props = virtconsole_properties;
}
-static DeviceInfo virtconsole_info = {
- .name = "virtconsole",
- .size = sizeof(VirtConsole),
- .props = virtconsole_properties,
- .class_init = virtconsole_class_init,
+static TypeInfo virtconsole_info = {
+ .name = "virtconsole",
+ .parent = TYPE_VIRTIO_SERIAL_PORT,
+ .instance_size = sizeof(VirtConsole),
+ .class_init = virtconsole_class_init,
};
static void virtconsole_register(void)
{
- virtio_serial_port_qdev_register(&virtconsole_info);
+ type_register_static(&virtconsole_info);
}
device_init(virtconsole_register)
@@ -160,23 +162,25 @@ static Property virtserialport_properties[] = {
static void virtserialport_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
k->init = virtconsole_initfn;
k->have_data = flush_buf;
k->guest_open = guest_open;
k->guest_close = guest_close;
+ dc->props = virtserialport_properties;
}
-static DeviceInfo virtserialport_info = {
- .name = "virtserialport",
- .size = sizeof(VirtConsole),
- .props = virtserialport_properties,
- .class_init = virtserialport_class_init,
+static TypeInfo virtserialport_info = {
+ .name = "virtserialport",
+ .parent = TYPE_VIRTIO_SERIAL_PORT,
+ .instance_size = sizeof(VirtConsole),
+ .class_init = virtserialport_class_init,
};
static void virtserialport_register(void)
{
- virtio_serial_port_qdev_register(&virtserialport_info);
+ type_register_static(&virtserialport_info);
}
device_init(virtserialport_register)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 126fb087be..bc96552072 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -818,6 +818,7 @@ static Property virtio_blk_properties[] = {
static void virtio_blk_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = virtio_blk_init_pci;
@@ -826,15 +827,16 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
k->revision = VIRTIO_PCI_ABI_VERSION;
k->class_id = PCI_CLASS_STORAGE_SCSI;
+ dc->alias = "virtio-blk";
+ dc->reset = virtio_pci_reset;
+ dc->props = virtio_blk_properties;
}
-static DeviceInfo virtio_blk_info = {
- .name = "virtio-blk-pci",
- .alias = "virtio-blk",
- .size = sizeof(VirtIOPCIProxy),
- .props = virtio_blk_properties,
- .reset = virtio_pci_reset,
- .class_init = virtio_blk_class_init,
+static TypeInfo virtio_blk_info = {
+ .name = "virtio-blk-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VirtIOPCIProxy),
+ .class_init = virtio_blk_class_init,
};
static Property virtio_net_properties[] = {
@@ -850,6 +852,7 @@ static Property virtio_net_properties[] = {
static void virtio_net_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = virtio_net_init_pci;
@@ -859,15 +862,16 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIRTIO_NET;
k->revision = VIRTIO_PCI_ABI_VERSION;
k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+ dc->alias = "virtio-net";
+ dc->reset = virtio_pci_reset;
+ dc->props = virtio_net_properties;
}
-static DeviceInfo virtio_net_info = {
- .name = "virtio-net-pci",
- .alias = "virtio-net",
- .size = sizeof(VirtIOPCIProxy),
- .props = virtio_net_properties,
- .reset = virtio_pci_reset,
- .class_init = virtio_net_class_init,
+static TypeInfo virtio_net_info = {
+ .name = "virtio-net-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VirtIOPCIProxy),
+ .class_init = virtio_net_class_init,
};
static Property virtio_serial_properties[] = {
@@ -881,6 +885,7 @@ static Property virtio_serial_properties[] = {
static void virtio_serial_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = virtio_serial_init_pci;
@@ -889,15 +894,16 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIRTIO_CONSOLE;
k->revision = VIRTIO_PCI_ABI_VERSION;
k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
+ dc->alias = "virtio-serial";
+ dc->reset = virtio_pci_reset;
+ dc->props = virtio_serial_properties;
}
-static DeviceInfo virtio_serial_info = {
- .name = "virtio-serial-pci",
- .alias = "virtio-serial",
- .size = sizeof(VirtIOPCIProxy),
- .props = virtio_serial_properties,
- .reset = virtio_pci_reset,
- .class_init = virtio_serial_class_init,
+static TypeInfo virtio_serial_info = {
+ .name = "virtio-serial-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VirtIOPCIProxy),
+ .class_init = virtio_serial_class_init,
};
static Property virtio_balloon_properties[] = {
@@ -907,6 +913,7 @@ static Property virtio_balloon_properties[] = {
static void virtio_balloon_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = virtio_balloon_init_pci;
@@ -915,23 +922,28 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIRTIO_BALLOON;
k->revision = VIRTIO_PCI_ABI_VERSION;
k->class_id = PCI_CLASS_MEMORY_RAM;
+ dc->alias = "virtio-balloon";
+ dc->reset = virtio_pci_reset;
+ dc->props = virtio_balloon_properties;
}
-static DeviceInfo virtio_balloon_info = {
- .name = "virtio-balloon-pci",
- .alias = "virtio-balloon",
- .size = sizeof(VirtIOPCIProxy),
- .props = virtio_balloon_properties,
- .reset = virtio_pci_reset,
- .class_init = virtio_balloon_class_init,
+static TypeInfo virtio_balloon_info = {
+ .name = "virtio-balloon-pci",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VirtIOPCIProxy),
+ .class_init = virtio_balloon_class_init,
};
static void virtio_pci_register_devices(void)
{
- pci_qdev_register(&virtio_blk_info);
- pci_qdev_register(&virtio_net_info);
- pci_qdev_register(&virtio_serial_info);
- pci_qdev_register(&virtio_balloon_info);
+ type_register_static(&virtio_blk_info);
+ type_register_static_alias(&virtio_blk_info, "virtio-blk");
+ type_register_static(&virtio_net_info);
+ type_register_static_alias(&virtio_net_info, "virtio-net");
+ type_register_static(&virtio_serial_info);
+ type_register_static_alias(&virtio_serial_info, "virtio-serial");
+ type_register_static(&virtio_balloon_info);
+ type_register_static_alias(&virtio_balloon_info, "virtio-balloon");
}
device_init(virtio_pci_register_devices)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 70f5d48706..50a6d7fc16 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -837,15 +837,6 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
return 0;
}
-void virtio_serial_port_qdev_register(DeviceInfo *info)
-{
- info->init = virtser_port_qdev_init;
- info->bus_info = &virtser_bus_info;
- info->exit = virtser_port_qdev_exit;
- info->unplug = qdev_simple_unplug_cb;
- qdev_register_subclass(info, TYPE_VIRTIO_SERIAL_PORT);
-}
-
VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
{
VirtIOSerial *vser;
@@ -940,12 +931,22 @@ void virtio_serial_exit(VirtIODevice *vdev)
virtio_cleanup(vdev);
}
+static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = virtser_port_qdev_init;
+ k->bus_info = &virtser_bus_info;
+ k->exit = virtser_port_qdev_exit;
+ k->unplug = qdev_simple_unplug_cb;
+}
+
static TypeInfo virtio_serial_port_type_info = {
.name = TYPE_VIRTIO_SERIAL_PORT,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VirtIOSerialPort),
.abstract = true,
.class_size = sizeof(VirtIOSerialPortClass),
+ .class_init = virtio_serial_port_class_init,
};
static void virtio_serial_register_devices(void)
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 6207c8904a..16e39820a2 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -176,12 +176,6 @@ struct VirtIOSerialPort {
/* Interface to the virtio-serial bus */
/*
- * Individual ports/apps should call this function to register the port
- * with the virtio-serial bus
- */
-void virtio_serial_port_qdev_register(DeviceInfo *info);
-
-/*
* Open a connection to the port
* Returns 0 on success (always).
*/
diff --git a/hw/vmmouse.c b/hw/vmmouse.c
index 5c80bc4f73..fda4f89a76 100644
--- a/hw/vmmouse.c
+++ b/hw/vmmouse.c
@@ -271,27 +271,31 @@ static int vmmouse_initfn(ISADevice *dev)
return 0;
}
+static Property vmmouse_properties[] = {
+ DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
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->no_user = 1;
+ dc->reset = vmmouse_reset;
+ dc->vmsd = &vmstate_vmmouse;
+ dc->props = vmmouse_properties;
}
-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(),
- }
+static TypeInfo vmmouse_info = {
+ .name = "vmmouse",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(VMMouseState),
+ .class_init = vmmouse_class_initfn,
};
static void vmmouse_dev_register(void)
{
- isa_qdev_register(&vmmouse_info);
+ type_register_static(&vmmouse_info);
}
device_init(vmmouse_dev_register)
diff --git a/hw/vmport.c b/hw/vmport.c
index c4582d6a00..a2c45e1950 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -146,19 +146,21 @@ static int vmport_initfn(ISADevice *dev)
static void vmport_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = vmport_initfn;
+ dc->no_user = 1;
}
-static DeviceInfo vmport_info = {
- .name = "vmport",
- .size = sizeof(VMPortState),
- .no_user = 1,
- .class_init = vmport_class_initfn,
+static TypeInfo vmport_info = {
+ .name = "vmport",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(VMPortState),
+ .class_init = vmport_class_initfn,
};
static void vmport_dev_register(void)
{
- isa_qdev_register(&vmport_info);
+ type_register_static(&vmport_info);
}
device_init(vmport_dev_register)
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index e7bbf7c7f4..3f3eb21d02 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1201,6 +1201,7 @@ static int pci_vmsvga_initfn(PCIDevice *dev)
static void vmsvga_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
@@ -1211,18 +1212,19 @@ static void vmsvga_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_DISPLAY_VGA;
k->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE;
k->subsystem_id = SVGA_PCI_DEVICE_ID;
+ dc->reset = vmsvga_reset;
+ dc->vmsd = &vmstate_vmware_vga;
}
-static DeviceInfo vmsvga_info = {
- .name = "vmware-svga",
- .size = sizeof(struct pci_vmsvga_state_s),
- .vmsd = &vmstate_vmware_vga,
- .reset = vmsvga_reset,
- .class_init = vmsvga_class_init,
+static TypeInfo vmsvga_info = {
+ .name = "vmware-svga",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(struct pci_vmsvga_state_s),
+ .class_init = vmsvga_class_init,
};
static void vmsvga_register(void)
{
- pci_qdev_register(&vmsvga_info);
+ type_register_static(&vmsvga_info);
}
device_init(vmsvga_register);
diff --git a/hw/vt82c686.c b/hw/vt82c686.c
index 72be4fd5b9..aa0954f487 100644
--- a/hw/vt82c686.c
+++ b/hw/vt82c686.c
@@ -348,6 +348,7 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn)
static void via_ac97_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = vt82c686b_ac97_initfn;
@@ -355,18 +356,19 @@ static void via_ac97_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_AC97;
k->revision = 0x50;
k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
+ dc->desc = "AC97";
}
-static DeviceInfo via_ac97_info = {
- .name = "VT82C686B_AC97",
- .desc = "AC97",
- .size = sizeof(VT686AC97State),
- .class_init = via_ac97_class_init,
+static TypeInfo via_ac97_info = {
+ .name = "VT82C686B_AC97",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VT686AC97State),
+ .class_init = via_ac97_class_init,
};
static void vt82c686b_ac97_register(void)
{
- pci_qdev_register(&via_ac97_info);
+ type_register_static(&via_ac97_info);
}
device_init(vt82c686b_ac97_register);
@@ -394,6 +396,7 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn)
static void via_mc97_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = vt82c686b_mc97_initfn;
@@ -401,18 +404,19 @@ static void via_mc97_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_MC97;
k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
k->revision = 0x30;
+ dc->desc = "MC97";
}
-static DeviceInfo via_mc97_info = {
- .name = "VT82C686B_MC97",
- .desc = "MC97",
- .size = sizeof(VT686MC97State),
- .class_init = via_mc97_class_init,
+static TypeInfo via_mc97_info = {
+ .name = "VT82C686B_MC97",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VT686MC97State),
+ .class_init = via_mc97_class_init,
};
static void vt82c686b_mc97_register(void)
{
- pci_qdev_register(&via_mc97_info);
+ type_register_static(&via_mc97_info);
}
device_init(vt82c686b_mc97_register);
@@ -472,6 +476,7 @@ static Property via_pm_properties[] = {
static void via_pm_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = vt82c686b_pm_initfn;
@@ -480,20 +485,21 @@ static void via_pm_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_ACPI;
k->class_id = PCI_CLASS_BRIDGE_OTHER;
k->revision = 0x40;
+ dc->desc = "PM";
+ dc->vmsd = &vmstate_acpi;
+ dc->props = via_pm_properties;
}
-static DeviceInfo via_pm_info = {
- .name = "VT82C686B_PM",
- .desc = "PM",
- .size = sizeof(VT686PMState),
- .vmsd = &vmstate_acpi,
- .props = via_pm_properties,
- .class_init = via_pm_class_init,
+static TypeInfo via_pm_info = {
+ .name = "VT82C686B_PM",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VT686PMState),
+ .class_init = via_pm_class_init,
};
static void vt82c686b_pm_register(void)
{
- pci_qdev_register(&via_pm_info);
+ type_register_static(&via_pm_info);
}
device_init(vt82c686b_pm_register);
@@ -544,6 +550,7 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn)
static void via_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = vt82c686b_initfn;
@@ -552,19 +559,20 @@ static void via_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_VIA_ISA_BRIDGE;
k->class_id = PCI_CLASS_BRIDGE_ISA;
k->revision = 0x40;
+ dc->desc = "ISA bridge";
+ dc->no_user = 1;
+ dc->vmsd = &vmstate_via;
}
-static DeviceInfo via_info = {
- .name = "VT82C686B",
- .desc = "ISA bridge",
- .size = sizeof(VT82C686BState),
- .vmsd = &vmstate_via,
- .no_user = 1,
- .class_init = via_class_init,
+static TypeInfo via_info = {
+ .name = "VT82C686B",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(VT82C686BState),
+ .class_init = via_class_init,
};
static void vt82c686b_register(void)
{
- pci_qdev_register(&via_info);
+ type_register_static(&via_info);
}
device_init(vt82c686b_register);
diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index a6ceff8eba..41325f0955 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -427,6 +427,7 @@ static WatchdogTimerModel model = {
static void i6300esb_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->config_read = i6300esb_config_read;
@@ -436,20 +437,21 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_ESB_9;
k->class_id = PCI_CLASS_SYSTEM_OTHER;
+ dc->reset = i6300esb_reset;
+ dc->vmsd = &vmstate_i6300esb;
}
-static DeviceInfo i6300esb_info = {
- .name = "i6300esb",
- .size = sizeof(I6300State),
- .vmsd = &vmstate_i6300esb,
- .reset = i6300esb_reset,
- .class_init = i6300esb_class_init,
+static TypeInfo i6300esb_info = {
+ .name = "i6300esb",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(I6300State),
+ .class_init = i6300esb_class_init,
};
static void i6300esb_register_devices(void)
{
watchdog_add_model(&model);
- pci_qdev_register(&i6300esb_info);
+ type_register_static(&i6300esb_info);
}
device_init(i6300esb_register_devices);
diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c
index 6deb0de6cd..8faa2316c9 100644
--- a/hw/wdt_ib700.c
+++ b/hw/wdt_ib700.c
@@ -122,22 +122,24 @@ static WatchdogTimerModel model = {
static void wdt_ib700_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
ic->init = wdt_ib700_init;
+ dc->reset = wdt_ib700_reset;
+ dc->vmsd = &vmstate_ib700;
}
-static DeviceInfo wdt_ib700_info = {
- .name = "ib700",
- .size = sizeof(IB700State),
- .vmsd = &vmstate_ib700,
- .reset = wdt_ib700_reset,
- .class_init = wdt_ib700_class_init,
+static TypeInfo wdt_ib700_info = {
+ .name = "ib700",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof(IB700State),
+ .class_init = wdt_ib700_class_init,
};
static void wdt_ib700_register_devices(void)
{
watchdog_add_model(&model);
- isa_qdev_register(&wdt_ib700_info);
+ type_register_static(&wdt_ib700_info);
}
device_init(wdt_ib700_register_devices);
diff --git a/hw/wm8750.c b/hw/wm8750.c
index 33bce0d48a..18afa4c1ac 100644
--- a/hw/wm8750.c
+++ b/hw/wm8750.c
@@ -691,24 +691,26 @@ void wm8750_set_bclk_in(void *opaque, int new_hz)
static void wm8750_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass);
sc->init = wm8750_init;
sc->event = wm8750_event;
sc->recv = wm8750_rx;
sc->send = wm8750_tx;
+ dc->vmsd = &vmstate_wm8750;
}
-static DeviceInfo wm8750_info = {
- .name = "wm8750",
- .size = sizeof(WM8750State),
- .vmsd = &vmstate_wm8750,
- .class_init = wm8750_class_init,
+static TypeInfo wm8750_info = {
+ .name = "wm8750",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(WM8750State),
+ .class_init = wm8750_class_init,
};
static void wm8750_register_devices(void)
{
- i2c_register_slave(&wm8750_info);
+ type_register_static(&wm8750_info);
}
device_init(wm8750_register_devices)
diff --git a/hw/xen_platform.c b/hw/xen_platform.c
index 40687fb996..e7571022e4 100644
--- a/hw/xen_platform.c
+++ b/hw/xen_platform.c
@@ -374,6 +374,7 @@ static void platform_reset(DeviceState *dev)
static void xen_platform_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = xen_platform_initfn;
@@ -383,20 +384,21 @@ static void xen_platform_class_init(ObjectClass *klass, void *data)
k->subsystem_vendor_id = PCI_VENDOR_ID_XEN;
k->subsystem_id = PCI_DEVICE_ID_XEN_PLATFORM;
k->revision = 1;
+ dc->desc = "XEN platform pci device";
+ dc->reset = platform_reset;
+ dc->vmsd = &vmstate_xen_platform;
}
-static DeviceInfo xen_platform_info = {
- .name = "xen-platform",
- .desc = "XEN platform pci device",
- .size = sizeof(PCIXenPlatformState),
- .vmsd = &vmstate_xen_platform,
- .reset = platform_reset,
- .class_init = xen_platform_class_init,
+static TypeInfo xen_platform_info = {
+ .name = "xen-platform",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIXenPlatformState),
+ .class_init = xen_platform_class_init,
};
static void xen_platform_register(void)
{
- pci_qdev_register(&xen_platform_info);
+ type_register_static(&xen_platform_info);
}
device_init(xen_platform_register);
diff --git a/hw/xgmac.c b/hw/xgmac.c
index 73840c9272..d395b1cc2d 100644
--- a/hw/xgmac.c
+++ b/hw/xgmac.c
@@ -403,26 +403,31 @@ static int xgmac_enet_init(SysBusDevice *dev)
return 0;
}
+static Property xgmac_properties[] = {
+ DEFINE_NIC_PROPERTIES(struct XgmacState, conf),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void xgmac_enet_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
sbc->init = xgmac_enet_init;
+ dc->vmsd = &vmstate_xgmac;
+ dc->props = xgmac_properties;
}
-static DeviceInfo xgmac_enet_info = {
- .name = "xgmac",
- .size = sizeof(struct XgmacState),
- .vmsd = &vmstate_xgmac,
- .class_init = xgmac_enet_class_init,
- .props = (Property[]) {
- DEFINE_NIC_PROPERTIES(struct XgmacState, conf),
- DEFINE_PROP_END_OF_LIST(),
- }
+static TypeInfo xgmac_enet_info = {
+ .name = "xgmac",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct XgmacState),
+ .class_init = xgmac_enet_class_init,
};
+
static void xgmac_enet_register(void)
{
- sysbus_register_withprop(&xgmac_enet_info);
+ type_register_static(&xgmac_enet_info);
}
device_init(xgmac_enet_register)
diff --git a/hw/xilinx_axidma.c b/hw/xilinx_axidma.c
index 0fbe415d4b..e8a53123f9 100644
--- a/hw/xilinx_axidma.c
+++ b/hw/xilinx_axidma.c
@@ -494,21 +494,23 @@ static Property axidma_properties[] = {
static void axidma_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = xilinx_axidma_init;
+ dc->props = axidma_properties;
}
-static DeviceInfo axidma_info = {
- .name = "xilinx,axidma",
- .size = sizeof(struct XilinxAXIDMA),
- .props = axidma_properties,
- .class_init = axidma_class_init,
+static TypeInfo axidma_info = {
+ .name = "xilinx,axidma",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct XilinxAXIDMA),
+ .class_init = axidma_class_init,
};
static void xilinx_axidma_register(void)
{
- sysbus_register_withprop(&axidma_info);
+ type_register_static(&axidma_info);
}
device_init(xilinx_axidma_register)
diff --git a/hw/xilinx_axienet.c b/hw/xilinx_axienet.c
index c7dbe00d21..1ce2db4510 100644
--- a/hw/xilinx_axienet.c
+++ b/hw/xilinx_axienet.c
@@ -881,20 +881,22 @@ static Property xilinx_enet_properties[] = {
static void xilinx_enet_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = xilinx_enet_init;
+ dc->props = xilinx_enet_properties;
}
-static DeviceInfo xilinx_enet_info = {
- .name = "xilinx,axienet",
- .size = sizeof(struct XilinxAXIEnet),
- .props = xilinx_enet_properties,
- .class_init = xilinx_enet_class_init,
+static TypeInfo xilinx_enet_info = {
+ .name = "xilinx,axienet",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct XilinxAXIEnet),
+ .class_init = xilinx_enet_class_init,
};
static void xilinx_enet_register(void)
{
- sysbus_register_withprop(&xilinx_enet_info);
+ type_register_static(&xilinx_enet_info);
}
device_init(xilinx_enet_register)
diff --git a/hw/xilinx_ethlite.c b/hw/xilinx_ethlite.c
index dc7c0c814e..499feef488 100644
--- a/hw/xilinx_ethlite.c
+++ b/hw/xilinx_ethlite.c
@@ -235,21 +235,23 @@ static Property xilinx_ethlite_properties[] = {
static void xilinx_ethlite_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = xilinx_ethlite_init;
+ dc->props = xilinx_ethlite_properties;
}
-static DeviceInfo xilinx_ethlite_info = {
- .name = "xilinx,ethlite",
- .size = sizeof(struct xlx_ethlite),
- .props = xilinx_ethlite_properties,
- .class_init = xilinx_ethlite_class_init,
+static TypeInfo xilinx_ethlite_info = {
+ .name = "xilinx,ethlite",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct xlx_ethlite),
+ .class_init = xilinx_ethlite_class_init,
};
static void xilinx_ethlite_register(void)
{
- sysbus_register_withprop(&xilinx_ethlite_info);
+ type_register_static(&xilinx_ethlite_info);
}
device_init(xilinx_ethlite_register)
diff --git a/hw/xilinx_intc.c b/hw/xilinx_intc.c
index c26b4eaa6c..73eed6dc5f 100644
--- a/hw/xilinx_intc.c
+++ b/hw/xilinx_intc.c
@@ -168,21 +168,23 @@ static Property xilinx_intc_properties[] = {
static void xilinx_intc_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = xilinx_intc_init;
+ dc->props = xilinx_intc_properties;
}
-static DeviceInfo xilinx_intc_info = {
- .name = "xilinx,intc",
- .size = sizeof(struct xlx_pic),
- .props = xilinx_intc_properties,
- .class_init = xilinx_intc_class_init,
+static TypeInfo xilinx_intc_info = {
+ .name = "xilinx,intc",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct xlx_pic),
+ .class_init = xilinx_intc_class_init,
};
static void xilinx_intc_register(void)
{
- sysbus_register_withprop(&xilinx_intc_info);
+ type_register_static(&xilinx_intc_info);
}
device_init(xilinx_intc_register)
diff --git a/hw/xilinx_timer.c b/hw/xilinx_timer.c
index 0755e1b1ad..c8236d2e2a 100644
--- a/hw/xilinx_timer.c
+++ b/hw/xilinx_timer.c
@@ -227,21 +227,23 @@ static Property xilinx_timer_properties[] = {
static void xilinx_timer_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = xilinx_timer_init;
+ dc->props = xilinx_timer_properties;
}
-static DeviceInfo xilinx_timer_info = {
- .name = "xilinx,timer",
- .size = sizeof(struct timerblock),
- .props = xilinx_timer_properties,
- .class_init = xilinx_timer_class_init,
+static TypeInfo xilinx_timer_info = {
+ .name = "xilinx,timer",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(struct timerblock),
+ .class_init = xilinx_timer_class_init,
};
static void xilinx_timer_register(void)
{
- sysbus_register_withprop(&xilinx_timer_info);
+ type_register_static(&xilinx_timer_info);
}
device_init(xilinx_timer_register)
diff --git a/hw/xilinx_uartlite.c b/hw/xilinx_uartlite.c
index 8baabc72bb..1491bbaeaa 100644
--- a/hw/xilinx_uartlite.c
+++ b/hw/xilinx_uartlite.c
@@ -218,15 +218,16 @@ static void xilinx_uartlite_class_init(ObjectClass *klass, void *data)
sdc->init = xilinx_uartlite_init;
}
-static DeviceInfo xilinx_uartlite_info = {
- .name = "xilinx,uartlite",
- .size = sizeof (struct xlx_uartlite),
- .class_init = xilinx_uartlite_class_init,
+static TypeInfo xilinx_uartlite_info = {
+ .name = "xilinx,uartlite",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof (struct xlx_uartlite),
+ .class_init = xilinx_uartlite_class_init,
};
static void xilinx_uart_register(void)
{
- sysbus_qdev_register(&xilinx_uartlite_info);
+ type_register_static(&xilinx_uartlite_info);
}
device_init(xilinx_uart_register)
diff --git a/hw/xio3130_downstream.c b/hw/xio3130_downstream.c
index 6d625cb5d6..07e4fc1018 100644
--- a/hw/xio3130_downstream.c
+++ b/hw/xio3130_downstream.c
@@ -179,6 +179,7 @@ static Property xio3130_downstream_properties[] = {
static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->is_express = 1;
@@ -189,21 +190,22 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_TI;
k->device_id = PCI_DEVICE_ID_TI_XIO3130D;
k->revision = XIO3130_REVISION;
+ dc->desc = "TI X3130 Downstream Port of PCI Express Switch";
+ dc->reset = xio3130_downstream_reset;
+ dc->vmsd = &vmstate_xio3130_downstream;
+ dc->props = xio3130_downstream_properties;
}
-static DeviceInfo xio3130_downstream_info = {
- .name = "xio3130-downstream",
- .desc = "TI X3130 Downstream Port of PCI Express Switch",
- .size = sizeof(PCIESlot),
- .reset = xio3130_downstream_reset,
- .vmsd = &vmstate_xio3130_downstream,
- .props = xio3130_downstream_properties,
- .class_init = xio3130_downstream_class_init,
+static TypeInfo xio3130_downstream_info = {
+ .name = "xio3130-downstream",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIESlot),
+ .class_init = xio3130_downstream_class_init,
};
static void xio3130_downstream_register(void)
{
- pci_qdev_register(&xio3130_downstream_info);
+ type_register_static(&xio3130_downstream_info);
}
device_init(xio3130_downstream_register);
diff --git a/hw/xio3130_upstream.c b/hw/xio3130_upstream.c
index ec4c5e351c..7887c92fcc 100644
--- a/hw/xio3130_upstream.c
+++ b/hw/xio3130_upstream.c
@@ -153,6 +153,7 @@ static Property xio3130_upstream_properties[] = {
static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->is_express = 1;
@@ -163,21 +164,22 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
k->vendor_id = PCI_VENDOR_ID_TI;
k->device_id = PCI_DEVICE_ID_TI_XIO3130U;
k->revision = XIO3130_REVISION;
+ dc->desc = "TI X3130 Upstream Port of PCI Express Switch";
+ dc->reset = xio3130_upstream_reset;
+ dc->vmsd = &vmstate_xio3130_upstream;
+ dc->props = xio3130_upstream_properties;
}
-static DeviceInfo xio3130_upstream_info = {
- .name = "x3130-upstream",
- .desc = "TI X3130 Upstream Port of PCI Express Switch",
- .size = sizeof(PCIEPort),
- .reset = xio3130_upstream_reset,
- .vmsd = &vmstate_xio3130_upstream,
- .props = xio3130_upstream_properties,
- .class_init = xio3130_upstream_class_init,
+static TypeInfo xio3130_upstream_info = {
+ .name = "x3130-upstream",
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCIEPort),
+ .class_init = xio3130_upstream_class_init,
};
static void xio3130_upstream_register(void)
{
- pci_qdev_register(&xio3130_upstream_info);
+ type_register_static(&xio3130_upstream_info);
}
device_init(xio3130_upstream_register);
diff --git a/hw/z2.c b/hw/z2.c
index b12f974720..654ac55f5c 100644
--- a/hw/z2.c
+++ b/hw/z2.c
@@ -176,17 +176,19 @@ static VMStateDescription vmstate_zipit_lcd_state = {
static void zipit_lcd_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
k->init = zipit_lcd_init;
k->transfer = zipit_lcd_transfer;
+ dc->vmsd = &vmstate_zipit_lcd_state;
}
-static DeviceInfo zipit_lcd_info = {
- .name = "zipit-lcd",
- .size = sizeof(ZipitLCD),
- .vmsd = &vmstate_zipit_lcd_state,
- .class_init = zipit_lcd_class_init,
+static TypeInfo zipit_lcd_info = {
+ .name = "zipit-lcd",
+ .parent = TYPE_SSI_SLAVE,
+ .instance_size = sizeof(ZipitLCD),
+ .class_init = zipit_lcd_class_init,
};
typedef struct {
@@ -275,19 +277,21 @@ static VMStateDescription vmstate_aer915_state = {
static void aer915_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
k->init = aer915_init;
k->event = aer915_event;
k->recv = aer915_recv;
k->send = aer915_send;
+ dc->vmsd = &vmstate_aer915_state;
}
-static DeviceInfo aer915_info = {
- .name = "aer915",
- .size = sizeof(AER915State),
- .vmsd = &vmstate_aer915_state,
- .class_init = aer915_class_init,
+static TypeInfo aer915_info = {
+ .name = "aer915",
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(AER915State),
+ .class_init = aer915_class_init,
};
static void z2_init(ram_addr_t ram_size,
@@ -340,8 +344,8 @@ static void z2_init(ram_addr_t ram_size,
NULL,
qdev_get_gpio_in(cpu->gpio, Z2_GPIO_SD_DETECT));
- ssi_register_slave(&zipit_lcd_info);
- i2c_register_slave(&aer915_info);
+ type_register_static(&zipit_lcd_info);
+ type_register_static(&aer915_info);
z2_lcd = ssi_create_slave(cpu->ssp[1], "zipit-lcd");
bus = pxa2xx_i2c_bus(cpu->i2c[0]);
i2c_create_slave(bus, "aer915", 0x55);
diff --git a/hw/zaurus.c b/hw/zaurus.c
index b14240c9c6..055df9b4e2 100644
--- a/hw/zaurus.c
+++ b/hw/zaurus.c
@@ -227,23 +227,25 @@ static Property scoop_sysbus_properties[] = {
static void scoop_sysbus_class_init(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = scoop_init;
+ dc->desc = "Scoop2 Sharp custom ASIC";
+ dc->vmsd = &vmstate_scoop_regs;
+ dc->props = scoop_sysbus_properties;
}
-static DeviceInfo scoop_sysbus_info = {
- .name = "scoop",
- .desc = "Scoop2 Sharp custom ASIC",
- .size = sizeof(ScoopInfo),
- .vmsd = &vmstate_scoop_regs,
- .props = scoop_sysbus_properties,
- .class_init = scoop_sysbus_class_init,
+static TypeInfo scoop_sysbus_info = {
+ .name = "scoop",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(ScoopInfo),
+ .class_init = scoop_sysbus_class_init,
};
static void scoop_register(void)
{
- sysbus_register_withprop(&scoop_sysbus_info);
+ type_register_static(&scoop_sysbus_info);
}
device_init(scoop_register);
diff --git a/include/qemu/object.h b/include/qemu/object.h
index adbcfb1c1a..a20271f700 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -396,6 +396,8 @@ const char *object_get_typename(Object *obj);
*/
Type type_register_static(const TypeInfo *info);
+#define type_register_static_alias(info, name) do { } while (0)
+
/**
* type_register:
* @info: The #TypeInfo of the new type
diff --git a/usb-linux.c b/usb-linux.c
index a337db5296..e7fc9ecd5c 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1402,8 +1402,19 @@ static const VMStateDescription vmstate_usb_host = {
.unmigratable = 1,
};
+static Property usb_host_dev_properties[] = {
+ DEFINE_PROP_UINT32("hostbus", USBHostDevice, match.bus_num, 0),
+ DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr, 0),
+ DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),
+ DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
+ DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
+ DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_host_class_initfn(ObjectClass *klass, void *data)
{
+ DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
uc->init = usb_host_initfn;
@@ -1414,27 +1425,20 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
uc->handle_control = usb_host_handle_control;
uc->handle_reset = usb_host_handle_reset;
uc->handle_destroy = usb_host_handle_destroy;
+ dc->vmsd = &vmstate_usb_host;
+ dc->props = usb_host_dev_properties;
}
-static struct DeviceInfo usb_host_dev_info = {
- .name = "usb-host",
- .size = sizeof(USBHostDevice),
- .vmsd = &vmstate_usb_host,
- .class_init= usb_host_class_initfn,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("hostbus", USBHostDevice, match.bus_num, 0),
- DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr, 0),
- DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),
- DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
- DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
- DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
- DEFINE_PROP_END_OF_LIST(),
- },
+static TypeInfo usb_host_dev_info = {
+ .name = "usb-host",
+ .parent = TYPE_USB_DEVICE,
+ .instance_size = sizeof(USBHostDevice),
+ .class_init = usb_host_class_initfn,
};
static void usb_host_register_devices(void)
{
- usb_qdev_register(&usb_host_dev_info);
+ type_register_static(&usb_host_dev_info);
usb_legacy_register("usb-host", "host", usb_host_device_open);
}
device_init(usb_host_register_devices)