aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/9pfs/9p-synth.c2
-rw-r--r--hw/9pfs/9p.c9
-rw-r--r--hw/9pfs/virtio-9p.h4
-rw-r--r--hw/acpi/generic_event_device.c52
-rw-r--r--hw/acpi/piix4.c4
-rw-r--r--hw/alpha/typhoon.c4
-rw-r--r--hw/arm/aspeed.c45
-rw-r--r--hw/arm/aspeed_ast2600.c8
-rw-r--r--hw/arm/aspeed_soc.c8
-rw-r--r--hw/arm/collie.c4
-rw-r--r--hw/arm/highbank.c4
-rw-r--r--hw/arm/integratorcp.c12
-rw-r--r--hw/arm/microbit.c4
-rw-r--r--hw/arm/mps2-tz.c5
-rw-r--r--hw/arm/mps2.c5
-rw-r--r--hw/arm/musca.c5
-rw-r--r--hw/arm/musicpal.c32
-rw-r--r--hw/arm/palm.c4
-rw-r--r--hw/arm/pxa2xx.c12
-rw-r--r--hw/arm/pxa2xx_gpio.c4
-rw-r--r--hw/arm/pxa2xx_pic.c4
-rw-r--r--hw/arm/sbsa-ref.c4
-rw-r--r--hw/arm/spitz.c25
-rw-r--r--hw/arm/stellaris.c8
-rw-r--r--hw/arm/strongarm.c24
-rw-r--r--hw/arm/tosa.c8
-rw-r--r--hw/arm/versatilepb.c4
-rw-r--r--hw/arm/vexpress.c5
-rw-r--r--hw/arm/virt-acpi-build.c8
-rw-r--r--hw/arm/xilinx_zynq.c4
-rw-r--r--hw/arm/xlnx-versal-virt.c4
-rw-r--r--hw/arm/xlnx-zcu102.c4
-rw-r--r--hw/arm/z2.c8
-rw-r--r--hw/audio/ac97.c4
-rw-r--r--hw/audio/adlib.c4
-rw-r--r--hw/audio/es1370.c3
-rw-r--r--hw/audio/gus.c4
-rw-r--r--hw/audio/hda-codec.c3
-rw-r--r--hw/audio/intel-hda.h6
-rw-r--r--hw/audio/marvell_88w8618.c4
-rw-r--r--hw/audio/milkymist-ac97.c4
-rw-r--r--hw/audio/pcspk.c4
-rw-r--r--hw/audio/pl041.c4
-rw-r--r--hw/audio/sb16.c4
-rw-r--r--hw/audio/wm8750.c4
-rw-r--r--hw/block/fdc.c16
-rw-r--r--hw/block/m25p80.c5
-rw-r--r--hw/block/nand.c3
-rw-r--r--hw/block/onenand.c4
-rw-r--r--hw/char/debugcon.c4
-rw-r--r--hw/char/exynos4210_uart.c4
-rw-r--r--hw/char/grlib_apbuart.c4
-rw-r--r--hw/char/ipoctal232.c3
-rw-r--r--hw/char/lm32_juart.c4
-rw-r--r--hw/char/lm32_uart.c4
-rw-r--r--hw/char/mcf_uart.c4
-rw-r--r--hw/char/milkymist-uart.c4
-rw-r--r--hw/char/parallel.c4
-rw-r--r--hw/char/serial-isa.c4
-rw-r--r--hw/char/serial-pci.c4
-rw-r--r--hw/char/spapr_vty.c4
-rw-r--r--hw/char/xilinx_uartlite.c4
-rw-r--r--hw/cpu/realview_mpcore.c4
-rw-r--r--hw/display/ads7846.c4
-rw-r--r--hw/display/artist.c4
-rw-r--r--hw/display/ati_int.h4
-rw-r--r--hw/display/bochs-display.c4
-rw-r--r--hw/display/cg3.c4
-rw-r--r--hw/display/cirrus_vga.c4
-rw-r--r--hw/display/cirrus_vga_isa.c4
-rw-r--r--hw/display/exynos4210_fimd.c4
-rw-r--r--hw/display/g364fb.c4
-rw-r--r--hw/display/jazz_led.c4
-rw-r--r--hw/display/milkymist-tmu2.c4
-rw-r--r--hw/display/milkymist-vgafb.c4
-rw-r--r--hw/display/next-fb.c4
-rw-r--r--hw/display/pl110.c4
-rw-r--r--hw/display/qxl.h4
-rw-r--r--hw/display/sii9022.c4
-rw-r--r--hw/display/sm501.c8
-rw-r--r--hw/display/ssd0303.c4
-rw-r--r--hw/display/ssd0323.c4
-rw-r--r--hw/display/tcx.c4
-rw-r--r--hw/display/vga-isa.c4
-rw-r--r--hw/display/vga-pci.c4
-rw-r--r--hw/display/virtio-vga.h2
-rw-r--r--hw/dma/i82374.c4
-rw-r--r--hw/dma/pl330.c3
-rw-r--r--hw/dma/puv3_dma.c4
-rw-r--r--hw/dma/pxa2xx_dma.c4
-rw-r--r--hw/dma/rc4030.c4
-rw-r--r--hw/dma/xilinx_axidma.c4
-rw-r--r--hw/gpio/gpio_key.c4
-rw-r--r--hw/gpio/max7310.c4
-rw-r--r--hw/gpio/mpc8xxx.c4
-rw-r--r--hw/gpio/pl061.c4
-rw-r--r--hw/gpio/puv3_gpio.c4
-rw-r--r--hw/gpio/zaurus.c4
-rw-r--r--hw/hppa/dino.c4
-rw-r--r--hw/hppa/lasi.c4
-rw-r--r--hw/hyperv/hyperv.c4
-rw-r--r--hw/hyperv/hyperv_testdev.c4
-rw-r--r--hw/i2c/bitbang_i2c.c4
-rw-r--r--hw/i2c/exynos4210_i2c.c4
-rw-r--r--hw/i2c/mpc_i2c.c4
-rw-r--r--hw/i2c/smbus_eeprom.c4
-rw-r--r--hw/i2c/smbus_ich9.c4
-rw-r--r--hw/i386/Kconfig1
-rw-r--r--hw/i386/acpi-build.c2
-rw-r--r--hw/i386/acpi-microvm.c240
-rw-r--r--hw/i386/acpi-microvm.h8
-rw-r--r--hw/i386/amd_iommu.h4
-rw-r--r--hw/i386/generic_event_device_x86.c36
-rw-r--r--hw/i386/kvm/clock.c4
-rw-r--r--hw/i386/kvmvapic.c4
-rw-r--r--hw/i386/meson.build3
-rw-r--r--hw/i386/microvm.c108
-rw-r--r--hw/i386/pc.c297
-rw-r--r--hw/i386/pc_piix.c2
-rw-r--r--hw/i386/pc_q35.c2
-rw-r--r--hw/i386/port92.c4
-rw-r--r--hw/i386/vmmouse.c4
-rw-r--r--hw/i386/vmport.c4
-rw-r--r--hw/i386/x86.c275
-rw-r--r--hw/i386/xen/xen_platform.c4
-rw-r--r--hw/i386/xen/xen_pvdevice.c4
-rw-r--r--hw/ide/isa.c4
-rw-r--r--hw/ide/microdrive.c4
-rw-r--r--hw/ide/sii3112.c4
-rw-r--r--hw/input/adb-kbd.c5
-rw-r--r--hw/input/adb-mouse.c5
-rw-r--r--hw/input/lm832x.c4
-rw-r--r--hw/input/milkymist-softusb.c4
-rw-r--r--hw/input/pl050.c4
-rw-r--r--hw/intc/arm_gicv2m.c4
-rw-r--r--hw/intc/exynos4210_combiner.c4
-rw-r--r--hw/intc/exynos4210_gic.c8
-rw-r--r--hw/intc/grlib_irqmp.c4
-rw-r--r--hw/intc/lm32_pic.c4
-rw-r--r--hw/intc/nios2_iic.c4
-rw-r--r--hw/intc/ompic.c4
-rw-r--r--hw/intc/openpic_kvm.c4
-rw-r--r--hw/intc/pl190.c4
-rw-r--r--hw/intc/puv3_intc.c4
-rw-r--r--hw/intc/sifive_plic.h10
-rw-r--r--hw/intc/slavio_intctl.c4
-rw-r--r--hw/ipack/tpci200.c4
-rw-r--r--hw/ipmi/ipmi_bmc_extern.c4
-rw-r--r--hw/ipmi/isa_ipmi_bt.c4
-rw-r--r--hw/ipmi/isa_ipmi_kcs.c4
-rw-r--r--hw/ipmi/pci_ipmi_bt.c4
-rw-r--r--hw/ipmi/pci_ipmi_kcs.c4
-rw-r--r--hw/ipmi/smbus_ipmi.c4
-rw-r--r--hw/isa/i82378.c4
-rw-r--r--hw/isa/piix4.c4
-rw-r--r--hw/isa/vt82c686.c16
-rw-r--r--hw/m68k/mcf_intc.c4
-rw-r--r--hw/m68k/next-cube.c4
-rw-r--r--hw/m68k/next-kbd.c4
-rw-r--r--hw/microblaze/xlnx-zynqmp-pmu.c4
-rw-r--r--hw/mips/gt64xxx_pci.c4
-rw-r--r--hw/mips/malta.c4
-rw-r--r--hw/misc/applesmc.c4
-rw-r--r--hw/misc/arm_integrator_debug.c4
-rw-r--r--hw/misc/arm_l2x0.c4
-rw-r--r--hw/misc/arm_sysctl.c4
-rw-r--r--hw/misc/aspeed_scu.c7
-rw-r--r--hw/misc/debugexit.c4
-rw-r--r--hw/misc/eccmemctl.c4
-rw-r--r--hw/misc/empty_slot.c4
-rw-r--r--hw/misc/exynos4210_clk.c4
-rw-r--r--hw/misc/exynos4210_pmu.c4
-rw-r--r--hw/misc/exynos4210_rng.c4
-rw-r--r--hw/misc/milkymist-hpdmc.c4
-rw-r--r--hw/misc/milkymist-pfpu.c4
-rw-r--r--hw/misc/mst_fpga.c4
-rw-r--r--hw/misc/pc-testdev.c4
-rw-r--r--hw/misc/pci-testdev.c4
-rw-r--r--hw/misc/puv3_pm.c4
-rw-r--r--hw/misc/sga.c4
-rw-r--r--hw/misc/slavio_misc.c4
-rw-r--r--hw/misc/tmp105.h4
-rw-r--r--hw/misc/tmp421.c5
-rw-r--r--hw/misc/zynq_slcr.c4
-rw-r--r--hw/net/dp8393x.c4
-rw-r--r--hw/net/e1000e.c4
-rw-r--r--hw/net/etraxfs_eth.c4
-rw-r--r--hw/net/fsl_etsec/etsec.h3
-rw-r--r--hw/net/lan9118.c4
-rw-r--r--hw/net/milkymist-minimac2.c4
-rw-r--r--hw/net/mipsnet.c4
-rw-r--r--hw/net/ne2000-isa.c4
-rw-r--r--hw/net/opencores_eth.c4
-rw-r--r--hw/net/pcnet-pci.c4
-rw-r--r--hw/net/rtl8139.c4
-rw-r--r--hw/net/smc91c111.c4
-rw-r--r--hw/net/spapr_llan.c4
-rw-r--r--hw/net/stellaris_enet.c4
-rw-r--r--hw/net/sungem.c4
-rw-r--r--hw/net/sunhme.c4
-rw-r--r--hw/net/tulip.h4
-rw-r--r--hw/net/xgmac.c4
-rw-r--r--hw/net/xilinx_axienet.c4
-rw-r--r--hw/nvram/ds1225y.c4
-rw-r--r--hw/nvram/fw_cfg.c2
-rw-r--r--hw/nvram/spapr_nvram.c4
-rw-r--r--hw/pci-bridge/dec.c4
-rw-r--r--hw/pci-bridge/gen_pcie_root_port.c4
-rw-r--r--hw/pci-bridge/pci_bridge_dev.c4
-rw-r--r--hw/pci-bridge/pcie_pci_bridge.c4
-rw-r--r--hw/pci-host/bonito.c6
-rw-r--r--hw/pci-host/grackle.c4
-rw-r--r--hw/pci-host/i440fx.c4
-rw-r--r--hw/pci-host/ppce500.c8
-rw-r--r--hw/pci-host/prep.c4
-rw-r--r--hw/ppc/e500-ccsr.h4
-rw-r--r--hw/ppc/e500.h5
-rw-r--r--hw/ppc/mac.h4
-rw-r--r--hw/ppc/mpc8544_guts.c4
-rw-r--r--hw/ppc/ppc440_pcix.c4
-rw-r--r--hw/ppc/ppc440_uc.c4
-rw-r--r--hw/ppc/ppc4xx_pci.c4
-rw-r--r--hw/ppc/ppce500_spin.c4
-rw-r--r--hw/ppc/prep_systemio.c4
-rw-r--r--hw/ppc/rs6000_mc.c4
-rw-r--r--hw/ppc/spapr_rng.c4
-rw-r--r--hw/riscv/sifive_e.c82
-rw-r--r--hw/riscv/sifive_u.c156
-rw-r--r--hw/rtc/ds1338.c4
-rw-r--r--hw/rtc/exynos4210_rtc.c4
-rw-r--r--hw/rtc/m41t80.c4
-rw-r--r--hw/rtc/sun4v-rtc.c4
-rw-r--r--hw/rtc/twl92230.c4
-rw-r--r--hw/s390x/ccw-device.h4
-rw-r--r--hw/s390x/ipl.h4
-rw-r--r--hw/s390x/s390-pci-bus.h16
-rw-r--r--hw/s390x/s390-skeys.c2
-rw-r--r--hw/s390x/virtio-ccw.h57
-rw-r--r--hw/scsi/lsi53c895a.c4
-rw-r--r--hw/scsi/scsi-disk.c5
-rw-r--r--hw/scsi/spapr_vscsi.c4
-rw-r--r--hw/scsi/vmw_pvscsi.c5
-rw-r--r--hw/sd/milkymist-memcard.c4
-rw-r--r--hw/sd/pl181.c4
-rw-r--r--hw/sd/ssi-sd.c4
-rw-r--r--hw/sh4/sh_pci.c4
-rw-r--r--hw/sparc/sun4m.c8
-rw-r--r--hw/sparc64/sun4u.c8
-rw-r--r--hw/ssi/ssi.c3
-rw-r--r--hw/ssi/xilinx_spi.c4
-rw-r--r--hw/timer/altera_timer.c4
-rw-r--r--hw/timer/arm_timer.c8
-rw-r--r--hw/timer/cadence_ttc.c4
-rw-r--r--hw/timer/exynos4210_mct.c4
-rw-r--r--hw/timer/exynos4210_pwm.c4
-rw-r--r--hw/timer/grlib_gptimer.c4
-rw-r--r--hw/timer/hpet.c4
-rw-r--r--hw/timer/lm32_timer.c4
-rw-r--r--hw/timer/milkymist-sysctl.c4
-rw-r--r--hw/timer/puv3_ost.c4
-rw-r--r--hw/timer/pxa2xx_timer.c4
-rw-r--r--hw/timer/slavio_timer.c4
-rw-r--r--hw/tpm/tpm_tis_isa.c4
-rw-r--r--hw/tpm/tpm_tis_sysbus.c4
-rw-r--r--hw/usb/ccid.h5
-rw-r--r--hw/usb/dev-audio.c4
-rw-r--r--hw/usb/dev-hid.c4
-rw-r--r--hw/usb/dev-hub.c4
-rw-r--r--hw/usb/dev-mtp.c3
-rw-r--r--hw/usb/dev-network.c4
-rw-r--r--hw/usb/dev-serial.c4
-rw-r--r--hw/usb/dev-smartcard-reader.c7
-rw-r--r--hw/usb/dev-uas.c3
-rw-r--r--hw/usb/dev-wacom.c4
-rw-r--r--hw/usb/hcd-dwc2.h3
-rw-r--r--hw/usb/hcd-ehci.h13
-rw-r--r--hw/usb/hcd-ohci-pci.c4
-rw-r--r--hw/usb/hcd-ohci.h4
-rw-r--r--hw/usb/hcd-xhci.h4
-rw-r--r--hw/usb/host-libusb.c6
-rw-r--r--hw/usb/tusb6010.c4
-rw-r--r--hw/usb/u2f-passthru.c4
-rw-r--r--hw/vfio/ap.c4
-rw-r--r--hw/vfio/common.c4
-rw-r--r--hw/vfio/pci.h4
-rw-r--r--hw/virtio/virtio-input-pci.c8
-rw-r--r--hw/virtio/virtio-pci.h5
-rw-r--r--hw/watchdog/wdt_i6300esb.c4
-rw-r--r--hw/xen/xen_pt.h4
289 files changed, 1250 insertions, 1408 deletions
diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
index 7eb210ffa8..cec8c0eefc 100644
--- a/hw/9pfs/9p-synth.c
+++ b/hw/9pfs/9p-synth.c
@@ -541,6 +541,8 @@ static int synth_init(FsContext *ctx, Error **errp)
QLIST_INIT(&synth_root.child);
qemu_mutex_init(&synth_mutex);
+ ctx->export_flags |= V9FS_NO_PERF_WARN;
+
/* Add "." and ".." entries for root */
v9fs_add_dir_node(&synth_root, synth_root.attr->mode,
"..", synth_root.attr, synth_root.attr->inode);
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 7bb994bbf2..741d222c3f 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1353,6 +1353,15 @@ static void coroutine_fn v9fs_version(void *opaque)
goto out;
}
+ /* 8192 is the default msize of Linux clients */
+ if (s->msize <= 8192 && !(s->ctx.export_flags & V9FS_NO_PERF_WARN)) {
+ warn_report_once(
+ "9p: degraded performance: a reasonable high msize should be "
+ "chosen on client/guest side (chosen msize is <= 8192). See "
+ "https://wiki.qemu.org/Documentation/9psetup#msize for details."
+ );
+ }
+
marshal:
err = pdu_marshal(pdu, offset, "ds", s->msize, &version);
if (err < 0) {
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index ff70c5a971..20fa118f3a 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -13,10 +13,8 @@ struct V9fsVirtioState {
VirtQueueElement *elems[MAX_REQ];
V9fsState state;
};
-typedef struct V9fsVirtioState V9fsVirtioState;
#define TYPE_VIRTIO_9P "virtio-9p-device"
-DECLARE_INSTANCE_CHECKER(V9fsVirtioState, VIRTIO_9P,
- TYPE_VIRTIO_9P)
+OBJECT_DECLARE_SIMPLE_TYPE(V9fsVirtioState, VIRTIO_9P)
#endif
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index b8abdefa1c..6df400e1ee 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -20,6 +20,7 @@
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "qemu/error-report.h"
+#include "sysemu/runstate.h"
static const uint32_t ged_supported_events[] = {
ACPI_GED_MEM_HOTPLUG_EVT,
@@ -141,6 +142,14 @@ void build_ged_aml(Aml *table, const char *name, HotplugHandler *hotplug_dev,
aml_append(table, dev);
}
+void acpi_dsdt_add_power_button(Aml *scope)
+{
+ Aml *dev = aml_device(ACPI_POWER_BUTTON_DEVICE);
+ aml_append(dev, aml_name_decl("_HID", aml_string("PNP0C0C")));
+ aml_append(dev, aml_name_decl("_UID", aml_int(0)));
+ aml_append(scope, dev);
+}
+
/* Memory read by the GED _EVT AML dynamic method */
static uint64_t ged_evt_read(void *opaque, hwaddr addr, unsigned size)
{
@@ -176,6 +185,45 @@ static const MemoryRegionOps ged_evt_ops = {
},
};
+static uint64_t ged_regs_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0;
+}
+
+static void ged_regs_write(void *opaque, hwaddr addr, uint64_t data,
+ unsigned int size)
+{
+ bool slp_en;
+ int slp_typ;
+
+ switch (addr) {
+ case ACPI_GED_REG_SLEEP_CTL:
+ slp_typ = (data >> 2) & 0x07;
+ slp_en = (data >> 5) & 0x01;
+ if (slp_en && slp_typ == 5) {
+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+ }
+ return;
+ case ACPI_GED_REG_SLEEP_STS:
+ return;
+ case ACPI_GED_REG_RESET:
+ if (data == ACPI_GED_RESET_VALUE) {
+ qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+ }
+ return;
+ }
+}
+
+static const MemoryRegionOps ged_regs_ops = {
+ .read = ged_regs_read,
+ .write = ged_regs_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .valid = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
static void acpi_ged_device_plug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
@@ -332,6 +380,10 @@ static void acpi_ged_initfn(Object *obj)
sysbus_init_mmio(sbd, &s->container_memhp);
acpi_memory_hotplug_init(&s->container_memhp, OBJECT(dev),
&s->memhp_state, 0);
+
+ memory_region_init_io(&ged_st->regs, obj, &ged_regs_ops, ged_st,
+ TYPE_ACPI_GED "-regs", ACPI_GED_REG_COUNT);
+ sysbus_init_mmio(sbd, &ged_st->regs);
}
static void acpi_ged_class_init(ObjectClass *class, void *data)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 1574f7db3e..832f8fba82 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -91,10 +91,8 @@ struct PIIX4PMState {
MemHotplugState acpi_memory_hotplug;
};
-typedef struct PIIX4PMState PIIX4PMState;
-DECLARE_INSTANCE_CHECKER(PIIX4PMState, PIIX4_PM,
- TYPE_PIIX4_PM)
+OBJECT_DECLARE_SIMPLE_TYPE(PIIX4PMState, PIIX4_PM)
static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
PCIBus *bus, PIIX4PMState *s);
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index d02b14d89f..a42b319812 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -50,9 +50,7 @@ typedef struct TyphoonPchip {
TyphoonWindow win[4];
} TyphoonPchip;
-typedef struct TyphoonState TyphoonState;
-DECLARE_INSTANCE_CHECKER(TyphoonState, TYPHOON_PCI_HOST_BRIDGE,
- TYPE_TYPHOON_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(TyphoonState, TYPHOON_PCI_HOST_BRIDGE)
struct TyphoonState {
PCIHostState parent_obj;
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 8bfb1c79dd..bdb981d2f8 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -41,6 +41,8 @@ struct AspeedMachineState {
MemoryRegion ram_container;
MemoryRegion max_ram;
bool mmio_exec;
+ char *fmc_model;
+ char *spi_model;
};
/* Palmetto hardware value: 0x120CE416 */
@@ -332,8 +334,10 @@ static void aspeed_machine_init(MachineState *machine)
"max_ram", max_ram_size - ram_size);
memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_ram);
- aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model);
- aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model);
+ aspeed_board_init_flashes(&bmc->soc.fmc, bmc->fmc_model ?
+ bmc->fmc_model : amc->fmc_model);
+ aspeed_board_init_flashes(&bmc->soc.spi[0], bmc->spi_model ?
+ bmc->spi_model : amc->spi_model);
/* Install first FMC flash content as a boot rom. */
if (drive0) {
@@ -570,6 +574,34 @@ static void aspeed_machine_instance_init(Object *obj)
ASPEED_MACHINE(obj)->mmio_exec = false;
}
+static char *aspeed_get_fmc_model(Object *obj, Error **errp)
+{
+ AspeedMachineState *bmc = ASPEED_MACHINE(obj);
+ return g_strdup(bmc->fmc_model);
+}
+
+static void aspeed_set_fmc_model(Object *obj, const char *value, Error **errp)
+{
+ AspeedMachineState *bmc = ASPEED_MACHINE(obj);
+
+ g_free(bmc->fmc_model);
+ bmc->fmc_model = g_strdup(value);
+}
+
+static char *aspeed_get_spi_model(Object *obj, Error **errp)
+{
+ AspeedMachineState *bmc = ASPEED_MACHINE(obj);
+ return g_strdup(bmc->spi_model);
+}
+
+static void aspeed_set_spi_model(Object *obj, const char *value, Error **errp)
+{
+ AspeedMachineState *bmc = ASPEED_MACHINE(obj);
+
+ g_free(bmc->spi_model);
+ bmc->spi_model = g_strdup(value);
+}
+
static void aspeed_machine_class_props_init(ObjectClass *oc)
{
object_class_property_add_bool(oc, "execute-in-place",
@@ -577,6 +609,15 @@ static void aspeed_machine_class_props_init(ObjectClass *oc)
aspeed_set_mmio_exec);
object_class_property_set_description(oc, "execute-in-place",
"boot directly from CE0 flash device");
+
+ object_class_property_add_str(oc, "fmc-model", aspeed_get_fmc_model,
+ aspeed_set_fmc_model);
+ object_class_property_set_description(oc, "fmc-model",
+ "Change the FMC Flash model");
+ object_class_property_add_str(oc, "spi-model", aspeed_get_spi_model,
+ aspeed_set_spi_model);
+ object_class_property_set_description(oc, "spi-model",
+ "Change the SPI Flash model");
}
static int aspeed_soc_num_cpus(const char *soc_name)
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index 9d95e42143..1450bde7cf 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -325,11 +325,9 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
}
/* UART - attach an 8250 to the IO space as our UART5 */
- if (serial_hd(0)) {
- qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_DEV_UART5);
- serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2,
- uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
- }
+ serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2,
+ aspeed_soc_get_irq(s, ASPEED_DEV_UART5),
+ 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
/* I2C */
object_property_set_link(OBJECT(&s->i2c), "dram", OBJECT(s->dram_mr),
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index 35be126db6..7eefd54ac0 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -283,11 +283,9 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
}
/* UART - attach an 8250 to the IO space as our UART5 */
- if (serial_hd(0)) {
- qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_DEV_UART5);
- serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2,
- uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
- }
+ serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2,
+ aspeed_soc_get_irq(s, ASPEED_DEV_UART5), 38400,
+ serial_hd(0), DEVICE_LITTLE_ENDIAN);
/* I2C */
object_property_set_link(OBJECT(&s->i2c), "dram", OBJECT(s->dram_mr),
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index a49f4a1c7c..8df31e2793 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -25,11 +25,9 @@ struct CollieMachineState {
StrongARMState *sa1110;
};
-typedef struct CollieMachineState CollieMachineState;
#define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie")
-DECLARE_INSTANCE_CHECKER(CollieMachineState, COLLIE_MACHINE,
- TYPE_COLLIE_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(CollieMachineState, COLLIE_MACHINE)
static struct arm_boot_info collie_binfo = {
.loader_start = SA_SDCS0,
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index e2ace803ef..7da984171b 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -156,9 +156,7 @@ static const MemoryRegionOps hb_mem_ops = {
};
#define TYPE_HIGHBANK_REGISTERS "highbank-regs"
-typedef struct HighbankRegsState HighbankRegsState;
-DECLARE_INSTANCE_CHECKER(HighbankRegsState, HIGHBANK_REGISTERS,
- TYPE_HIGHBANK_REGISTERS)
+OBJECT_DECLARE_SIMPLE_TYPE(HighbankRegsState, HIGHBANK_REGISTERS)
struct HighbankRegsState {
/*< private >*/
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index 19989b61b9..de670b08a9 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -29,9 +29,7 @@
#include "qom/object.h"
#define TYPE_INTEGRATOR_CM "integrator_core"
-typedef struct IntegratorCMState IntegratorCMState;
-DECLARE_INSTANCE_CHECKER(IntegratorCMState, INTEGRATOR_CM,
- TYPE_INTEGRATOR_CM)
+OBJECT_DECLARE_SIMPLE_TYPE(IntegratorCMState, INTEGRATOR_CM)
struct IntegratorCMState {
/*< private >*/
@@ -328,9 +326,7 @@ static void integratorcm_realize(DeviceState *d, Error **errp)
/* Primary interrupt controller. */
#define TYPE_INTEGRATOR_PIC "integrator_pic"
-typedef struct icp_pic_state icp_pic_state;
-DECLARE_INSTANCE_CHECKER(icp_pic_state, INTEGRATOR_PIC,
- TYPE_INTEGRATOR_PIC)
+OBJECT_DECLARE_SIMPLE_TYPE(icp_pic_state, INTEGRATOR_PIC)
struct icp_pic_state {
/*< private >*/
@@ -468,9 +464,7 @@ static void icp_pic_init(Object *obj)
/* CP control registers. */
#define TYPE_ICP_CONTROL_REGS "icp-ctrl-regs"
-typedef struct ICPCtrlRegsState ICPCtrlRegsState;
-DECLARE_INSTANCE_CHECKER(ICPCtrlRegsState, ICP_CONTROL_REGS,
- TYPE_ICP_CONTROL_REGS)
+OBJECT_DECLARE_SIMPLE_TYPE(ICPCtrlRegsState, ICP_CONTROL_REGS)
struct ICPCtrlRegsState {
/*< private >*/
diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c
index 9a4a3d357a..0947491cb9 100644
--- a/hw/arm/microbit.c
+++ b/hw/arm/microbit.c
@@ -26,12 +26,10 @@ struct MicrobitMachineState {
NRF51State nrf51;
MicrobitI2CState i2c;
};
-typedef struct MicrobitMachineState MicrobitMachineState;
#define TYPE_MICROBIT_MACHINE MACHINE_TYPE_NAME("microbit")
-DECLARE_INSTANCE_CHECKER(MicrobitMachineState, MICROBIT_MACHINE,
- TYPE_MICROBIT_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(MicrobitMachineState, MICROBIT_MACHINE)
static void microbit_init(MachineState *machine)
{
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index dbf7d63dc8..3707876d6d 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -77,7 +77,6 @@ struct MPS2TZMachineClass {
uint32_t scc_id;
const char *armsse_type;
};
-typedef struct MPS2TZMachineClass MPS2TZMachineClass;
struct MPS2TZMachineState {
MachineState parent;
@@ -102,14 +101,12 @@ struct MPS2TZMachineState {
DeviceState *lan9118;
SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ];
};
-typedef struct MPS2TZMachineState MPS2TZMachineState;
#define TYPE_MPS2TZ_MACHINE "mps2tz"
#define TYPE_MPS2TZ_AN505_MACHINE MACHINE_TYPE_NAME("mps2-an505")
#define TYPE_MPS2TZ_AN521_MACHINE MACHINE_TYPE_NAME("mps2-an521")
-DECLARE_OBJ_CHECKERS(MPS2TZMachineState, MPS2TZMachineClass,
- MPS2TZ_MACHINE, TYPE_MPS2TZ_MACHINE)
+OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineClass, MPS2TZ_MACHINE)
/* Main SYSCLK frequency in Hz */
#define SYSCLK_FRQ 20000000
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
index 5d47160850..9a8b23c64c 100644
--- a/hw/arm/mps2.c
+++ b/hw/arm/mps2.c
@@ -63,7 +63,6 @@ struct MPS2MachineClass {
hwaddr ethernet_base;
hwaddr psram_base;
};
-typedef struct MPS2MachineClass MPS2MachineClass;
struct MPS2MachineState {
MachineState parent;
@@ -85,7 +84,6 @@ struct MPS2MachineState {
CMSDKAPBDualTimer dualtimer;
CMSDKAPBWatchdog watchdog;
};
-typedef struct MPS2MachineState MPS2MachineState;
#define TYPE_MPS2_MACHINE "mps2"
#define TYPE_MPS2_AN385_MACHINE MACHINE_TYPE_NAME("mps2-an385")
@@ -93,8 +91,7 @@ typedef struct MPS2MachineState MPS2MachineState;
#define TYPE_MPS2_AN500_MACHINE MACHINE_TYPE_NAME("mps2-an500")
#define TYPE_MPS2_AN511_MACHINE MACHINE_TYPE_NAME("mps2-an511")
-DECLARE_OBJ_CHECKERS(MPS2MachineState, MPS2MachineClass,
- MPS2_MACHINE, TYPE_MPS2_MACHINE)
+OBJECT_DECLARE_TYPE(MPS2MachineState, MPS2MachineClass, MPS2_MACHINE)
/* Main SYSCLK frequency in Hz */
#define SYSCLK_FRQ 25000000
diff --git a/hw/arm/musca.c b/hw/arm/musca.c
index 16015255c8..b50157f63a 100644
--- a/hw/arm/musca.c
+++ b/hw/arm/musca.c
@@ -55,7 +55,6 @@ struct MuscaMachineClass {
const MPCInfo *mpc_info;
int num_mpcs;
};
-typedef struct MuscaMachineClass MuscaMachineClass;
struct MuscaMachineState {
MachineState parent;
@@ -84,14 +83,12 @@ struct MuscaMachineState {
UnimplementedDeviceState gpio;
UnimplementedDeviceState cryptoisland;
};
-typedef struct MuscaMachineState MuscaMachineState;
#define TYPE_MUSCA_MACHINE "musca"
#define TYPE_MUSCA_A_MACHINE MACHINE_TYPE_NAME("musca-a")
#define TYPE_MUSCA_B1_MACHINE MACHINE_TYPE_NAME("musca-b1")
-DECLARE_OBJ_CHECKERS(MuscaMachineState, MuscaMachineClass,
- MUSCA_MACHINE, TYPE_MUSCA_MACHINE)
+OBJECT_DECLARE_TYPE(MuscaMachineState, MuscaMachineClass, MUSCA_MACHINE)
/*
* Main SYSCLK frequency in Hz
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 2117a04171..5eb3f969fb 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -155,9 +155,7 @@ typedef struct mv88w8618_rx_desc {
} mv88w8618_rx_desc;
#define TYPE_MV88W8618_ETH "mv88w8618_eth"
-typedef struct mv88w8618_eth_state mv88w8618_eth_state;
-DECLARE_INSTANCE_CHECKER(mv88w8618_eth_state, MV88W8618_ETH,
- TYPE_MV88W8618_ETH)
+OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_eth_state, MV88W8618_ETH)
struct mv88w8618_eth_state {
/*< private >*/
@@ -485,9 +483,7 @@ static const TypeInfo mv88w8618_eth_info = {
#define MP_LCD_TEXTCOLOR 0xe0e0ff /* RRGGBB */
#define TYPE_MUSICPAL_LCD "musicpal_lcd"
-typedef struct musicpal_lcd_state musicpal_lcd_state;
-DECLARE_INSTANCE_CHECKER(musicpal_lcd_state, MUSICPAL_LCD,
- TYPE_MUSICPAL_LCD)
+OBJECT_DECLARE_SIMPLE_TYPE(musicpal_lcd_state, MUSICPAL_LCD)
struct musicpal_lcd_state {
/*< private >*/
@@ -703,9 +699,7 @@ static const TypeInfo musicpal_lcd_info = {
#define MP_PIC_ENABLE_CLR 0x0C
#define TYPE_MV88W8618_PIC "mv88w8618_pic"
-typedef struct mv88w8618_pic_state mv88w8618_pic_state;
-DECLARE_INSTANCE_CHECKER(mv88w8618_pic_state, MV88W8618_PIC,
- TYPE_MV88W8618_PIC)
+OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_pic_state, MV88W8618_PIC)
struct mv88w8618_pic_state {
/*< private >*/
@@ -841,9 +835,7 @@ typedef struct mv88w8618_timer_state {
} mv88w8618_timer_state;
#define TYPE_MV88W8618_PIT "mv88w8618_pit"
-typedef struct mv88w8618_pit_state mv88w8618_pit_state;
-DECLARE_INSTANCE_CHECKER(mv88w8618_pit_state, MV88W8618_PIT,
- TYPE_MV88W8618_PIT)
+OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_pit_state, MV88W8618_PIT)
struct mv88w8618_pit_state {
/*< private >*/
@@ -1009,9 +1001,7 @@ static const TypeInfo mv88w8618_pit_info = {
#define MP_FLASHCFG_CFGR0 0x04
#define TYPE_MV88W8618_FLASHCFG "mv88w8618_flashcfg"
-typedef struct mv88w8618_flashcfg_state mv88w8618_flashcfg_state;
-DECLARE_INSTANCE_CHECKER(mv88w8618_flashcfg_state, MV88W8618_FLASHCFG,
- TYPE_MV88W8618_FLASHCFG)
+OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_flashcfg_state, MV88W8618_FLASHCFG)
struct mv88w8618_flashcfg_state {
/*< private >*/
@@ -1100,11 +1090,9 @@ struct MusicPalMiscState {
SysBusDevice parent_obj;
MemoryRegion iomem;
};
-typedef struct MusicPalMiscState MusicPalMiscState;
#define TYPE_MUSICPAL_MISC "musicpal-misc"
-DECLARE_INSTANCE_CHECKER(MusicPalMiscState, MUSICPAL_MISC,
- TYPE_MUSICPAL_MISC)
+OBJECT_DECLARE_SIMPLE_TYPE(MusicPalMiscState, MUSICPAL_MISC)
static uint64_t musicpal_misc_read(void *opaque, hwaddr offset,
unsigned size)
@@ -1209,9 +1197,7 @@ static void mv88w8618_wlan_realize(DeviceState *dev, Error **errp)
#define MP_OE_LCD_BRIGHTNESS 0x0007
#define TYPE_MUSICPAL_GPIO "musicpal_gpio"
-typedef struct musicpal_gpio_state musicpal_gpio_state;
-DECLARE_INSTANCE_CHECKER(musicpal_gpio_state, MUSICPAL_GPIO,
- TYPE_MUSICPAL_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(musicpal_gpio_state, MUSICPAL_GPIO)
struct musicpal_gpio_state {
/*< private >*/
@@ -1460,9 +1446,7 @@ static const TypeInfo musicpal_gpio_info = {
#define MP_KEY_BTN_NAVIGATION (1 << 7)
#define TYPE_MUSICPAL_KEY "musicpal_key"
-typedef struct musicpal_key_state musicpal_key_state;
-DECLARE_INSTANCE_CHECKER(musicpal_key_state, MUSICPAL_KEY,
- TYPE_MUSICPAL_KEY)
+OBJECT_DECLARE_SIMPLE_TYPE(musicpal_key_state, MUSICPAL_KEY)
struct musicpal_key_state {
/*< private >*/
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index abc6495489..4e3dc5fbbf 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -133,9 +133,7 @@ static void palmte_button_event(void *opaque, int keycode)
*/
#define TYPE_PALM_MISC_GPIO "palm-misc-gpio"
-typedef struct PalmMiscGPIOState PalmMiscGPIOState;
-DECLARE_INSTANCE_CHECKER(PalmMiscGPIOState, PALM_MISC_GPIO,
- TYPE_PALM_MISC_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(PalmMiscGPIOState, PALM_MISC_GPIO)
struct PalmMiscGPIOState {
SysBusDevice parent_obj;
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 33074dbf82..591776ba88 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -470,9 +470,7 @@ static const VMStateDescription vmstate_pxa2xx_mm = {
};
#define TYPE_PXA2XX_SSP "pxa2xx-ssp"
-typedef struct PXA2xxSSPState PXA2xxSSPState;
-DECLARE_INSTANCE_CHECKER(PXA2xxSSPState, PXA2XX_SSP,
- TYPE_PXA2XX_SSP)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxSSPState, PXA2XX_SSP)
/* Synchronous Serial Ports */
struct PXA2xxSSPState {
@@ -811,9 +809,7 @@ static void pxa2xx_ssp_init(Object *obj)
#define PIAR 0x38 /* RTC Periodic Interrupt Alarm register */
#define TYPE_PXA2XX_RTC "pxa2xx_rtc"
-typedef struct PXA2xxRTCState PXA2xxRTCState;
-DECLARE_INSTANCE_CHECKER(PXA2xxRTCState, PXA2XX_RTC,
- TYPE_PXA2XX_RTC)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxRTCState, PXA2XX_RTC)
struct PXA2xxRTCState {
/*< private >*/
@@ -1245,9 +1241,7 @@ static const TypeInfo pxa2xx_rtc_sysbus_info = {
/* I2C Interface */
#define TYPE_PXA2XX_I2C_SLAVE "pxa2xx-i2c-slave"
-typedef struct PXA2xxI2CSlaveState PXA2xxI2CSlaveState;
-DECLARE_INSTANCE_CHECKER(PXA2xxI2CSlaveState, PXA2XX_I2C_SLAVE,
- TYPE_PXA2XX_I2C_SLAVE)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxI2CSlaveState, PXA2XX_I2C_SLAVE)
struct PXA2xxI2CSlaveState {
I2CSlave parent_obj;
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
index 16bbe4fb70..e7c3d99224 100644
--- a/hw/arm/pxa2xx_gpio.c
+++ b/hw/arm/pxa2xx_gpio.c
@@ -22,9 +22,7 @@
#define PXA2XX_GPIO_BANKS 4
#define TYPE_PXA2XX_GPIO "pxa2xx-gpio"
-typedef struct PXA2xxGPIOInfo PXA2xxGPIOInfo;
-DECLARE_INSTANCE_CHECKER(PXA2xxGPIOInfo, PXA2XX_GPIO,
- TYPE_PXA2XX_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxGPIOInfo, PXA2XX_GPIO)
struct PXA2xxGPIOInfo {
/*< private >*/
diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c
index cb52a9dff3..cf6cb2a373 100644
--- a/hw/arm/pxa2xx_pic.c
+++ b/hw/arm/pxa2xx_pic.c
@@ -38,9 +38,7 @@
#define PXA2XX_PIC_SRCS 40
#define TYPE_PXA2XX_PIC "pxa2xx_pic"
-typedef struct PXA2xxPICState PXA2xxPICState;
-DECLARE_INSTANCE_CHECKER(PXA2xxPICState, PXA2XX_PIC,
- TYPE_PXA2XX_PIC)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxPICState, PXA2XX_PIC)
struct PXA2xxPICState {
/*< private >*/
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index ac68b4640d..bcb2cb4761 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -95,11 +95,9 @@ struct SBSAMachineState {
DeviceState *gic;
PFlashCFI01 *flash[2];
};
-typedef struct SBSAMachineState SBSAMachineState;
#define TYPE_SBSA_MACHINE MACHINE_TYPE_NAME("sbsa-ref")
-DECLARE_INSTANCE_CHECKER(SBSAMachineState, SBSA_MACHINE,
- TYPE_SBSA_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(SBSAMachineState, SBSA_MACHINE)
static const MemMapEntry sbsa_ref_memmap[] = {
/* 512M boot ROM */
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index a7ad667f06..32bdeacfd3 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -43,7 +43,6 @@ struct SpitzMachineClass {
enum spitz_model_e model;
int arm_id;
};
-typedef struct SpitzMachineClass SpitzMachineClass;
struct SpitzMachineState {
MachineState parent;
@@ -56,11 +55,9 @@ struct SpitzMachineState {
DeviceState *scp1;
DeviceState *misc_gpio;
};
-typedef struct SpitzMachineState SpitzMachineState;
#define TYPE_SPITZ_MACHINE "spitz-common"
-DECLARE_OBJ_CHECKERS(SpitzMachineState, SpitzMachineClass,
- SPITZ_MACHINE, TYPE_SPITZ_MACHINE)
+OBJECT_DECLARE_TYPE(SpitzMachineState, SpitzMachineClass, SPITZ_MACHINE)
#define zaurus_printf(format, ...) \
fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__)
@@ -84,9 +81,7 @@ DECLARE_OBJ_CHECKERS(SpitzMachineState, SpitzMachineClass,
#define FLASHCTL_NCE (FLASHCTL_CE0 | FLASHCTL_CE1)
#define TYPE_SL_NAND "sl-nand"
-typedef struct SLNANDState SLNANDState;
-DECLARE_INSTANCE_CHECKER(SLNANDState, SL_NAND,
- TYPE_SL_NAND)
+OBJECT_DECLARE_SIMPLE_TYPE(SLNANDState, SL_NAND)
struct SLNANDState {
SysBusDevice parent_obj;
@@ -262,9 +257,7 @@ static const int spitz_gpiomap[5] = {
};
#define TYPE_SPITZ_KEYBOARD "spitz-keyboard"
-typedef struct SpitzKeyboardState SpitzKeyboardState;
-DECLARE_INSTANCE_CHECKER(SpitzKeyboardState, SPITZ_KEYBOARD,
- TYPE_SPITZ_KEYBOARD)
+OBJECT_DECLARE_SIMPLE_TYPE(SpitzKeyboardState, SPITZ_KEYBOARD)
struct SpitzKeyboardState {
SysBusDevice parent_obj;
@@ -582,9 +575,7 @@ static void spitz_keyboard_realize(DeviceState *dev, Error **errp)
#define LCDTG_POLCTRL 0x07
#define TYPE_SPITZ_LCDTG "spitz-lcdtg"
-typedef struct SpitzLCDTG SpitzLCDTG;
-DECLARE_INSTANCE_CHECKER(SpitzLCDTG, SPITZ_LCDTG,
- TYPE_SPITZ_LCDTG)
+OBJECT_DECLARE_SIMPLE_TYPE(SpitzLCDTG, SPITZ_LCDTG)
struct SpitzLCDTG {
SSISlave ssidev;
@@ -672,9 +663,7 @@ static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp)
#define SPITZ_GPIO_TP_INT 11
#define TYPE_CORGI_SSP "corgi-ssp"
-typedef struct CorgiSSPState CorgiSSPState;
-DECLARE_INSTANCE_CHECKER(CorgiSSPState, CORGI_SSP,
- TYPE_CORGI_SSP)
+OBJECT_DECLARE_SIMPLE_TYPE(CorgiSSPState, CORGI_SSP)
/* "Demux" the signal based on current chipselect */
struct CorgiSSPState {
@@ -825,9 +814,7 @@ static void spitz_akita_i2c_setup(PXA2xxState *cpu)
* + named GPIO output "adc-temp": the ADC value, to be wired up to the max111x
*/
#define TYPE_SPITZ_MISC_GPIO "spitz-misc-gpio"
-typedef struct SpitzMiscGPIOState SpitzMiscGPIOState;
-DECLARE_INSTANCE_CHECKER(SpitzMiscGPIOState, SPITZ_MISC_GPIO,
- TYPE_SPITZ_MISC_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(SpitzMiscGPIOState, SPITZ_MISC_GPIO)
struct SpitzMiscGPIOState {
SysBusDevice parent_obj;
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index d6fc4a4681..1237f5af02 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -58,9 +58,7 @@ typedef const struct {
/* General purpose timer module. */
#define TYPE_STELLARIS_GPTM "stellaris-gptm"
-typedef struct gptm_state gptm_state;
-DECLARE_INSTANCE_CHECKER(gptm_state, STELLARIS_GPTM,
- TYPE_STELLARIS_GPTM)
+OBJECT_DECLARE_SIMPLE_TYPE(gptm_state, STELLARIS_GPTM)
struct gptm_state {
SysBusDevice parent_obj;
@@ -721,9 +719,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq,
/* I2C controller. */
#define TYPE_STELLARIS_I2C "stellaris-i2c"
-typedef struct stellaris_i2c_state stellaris_i2c_state;
-DECLARE_INSTANCE_CHECKER(stellaris_i2c_state, STELLARIS_I2C,
- TYPE_STELLARIS_I2C)
+OBJECT_DECLARE_SIMPLE_TYPE(stellaris_i2c_state, STELLARIS_I2C)
struct stellaris_i2c_state {
SysBusDevice parent_obj;
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 0fe829b868..d7133eea6f 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -85,9 +85,7 @@ static struct {
/* Interrupt Controller */
#define TYPE_STRONGARM_PIC "strongarm_pic"
-typedef struct StrongARMPICState StrongARMPICState;
-DECLARE_INSTANCE_CHECKER(StrongARMPICState, STRONGARM_PIC,
- TYPE_STRONGARM_PIC)
+OBJECT_DECLARE_SIMPLE_TYPE(StrongARMPICState, STRONGARM_PIC)
struct StrongARMPICState {
SysBusDevice parent_obj;
@@ -254,9 +252,7 @@ static const TypeInfo strongarm_pic_info = {
* f = 32 768 / (RTTR_trim + 1) */
#define TYPE_STRONGARM_RTC "strongarm-rtc"
-typedef struct StrongARMRTCState StrongARMRTCState;
-DECLARE_INSTANCE_CHECKER(StrongARMRTCState, STRONGARM_RTC,
- TYPE_STRONGARM_RTC)
+OBJECT_DECLARE_SIMPLE_TYPE(StrongARMRTCState, STRONGARM_RTC)
struct StrongARMRTCState {
SysBusDevice parent_obj;
@@ -481,9 +477,7 @@ static const TypeInfo strongarm_rtc_sysbus_info = {
#define GAFR 0x1c
#define TYPE_STRONGARM_GPIO "strongarm-gpio"
-typedef struct StrongARMGPIOInfo StrongARMGPIOInfo;
-DECLARE_INSTANCE_CHECKER(StrongARMGPIOInfo, STRONGARM_GPIO,
- TYPE_STRONGARM_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(StrongARMGPIOInfo, STRONGARM_GPIO)
struct StrongARMGPIOInfo {
SysBusDevice busdev;
@@ -720,9 +714,7 @@ static const TypeInfo strongarm_gpio_info = {
#define PPFR 0x10
#define TYPE_STRONGARM_PPC "strongarm-ppc"
-typedef struct StrongARMPPCInfo StrongARMPPCInfo;
-DECLARE_INSTANCE_CHECKER(StrongARMPPCInfo, STRONGARM_PPC,
- TYPE_STRONGARM_PPC)
+OBJECT_DECLARE_SIMPLE_TYPE(StrongARMPPCInfo, STRONGARM_PPC)
struct StrongARMPPCInfo {
SysBusDevice parent_obj;
@@ -921,9 +913,7 @@ static const TypeInfo strongarm_ppc_info = {
#define RX_FIFO_ROR (1 << 10)
#define TYPE_STRONGARM_UART "strongarm-uart"
-typedef struct StrongARMUARTState StrongARMUARTState;
-DECLARE_INSTANCE_CHECKER(StrongARMUARTState, STRONGARM_UART,
- TYPE_STRONGARM_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(StrongARMUARTState, STRONGARM_UART)
struct StrongARMUARTState {
SysBusDevice parent_obj;
@@ -1353,9 +1343,7 @@ static const TypeInfo strongarm_uart_info = {
/* Synchronous Serial Ports */
#define TYPE_STRONGARM_SSP "strongarm-ssp"
-typedef struct StrongARMSSPState StrongARMSSPState;
-DECLARE_INSTANCE_CHECKER(StrongARMSSPState, STRONGARM_SSP,
- TYPE_STRONGARM_SSP)
+OBJECT_DECLARE_SIMPLE_TYPE(StrongARMSSPState, STRONGARM_SSP)
struct StrongARMSSPState {
SysBusDevice parent_obj;
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index 2ef6c7b288..c196f0d2f8 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -75,9 +75,7 @@ static void tosa_microdrive_attach(PXA2xxState *cpu)
*/
#define TYPE_TOSA_MISC_GPIO "tosa-misc-gpio"
-typedef struct TosaMiscGPIOState TosaMiscGPIOState;
-DECLARE_INSTANCE_CHECKER(TosaMiscGPIOState, TOSA_MISC_GPIO,
- TYPE_TOSA_MISC_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(TosaMiscGPIOState, TOSA_MISC_GPIO)
struct TosaMiscGPIOState {
SysBusDevice parent_obj;
@@ -172,9 +170,7 @@ static void tosa_ssp_realize(SSISlave *dev, Error **errp)
}
#define TYPE_TOSA_DAC "tosa_dac"
-typedef struct TosaDACState TosaDACState;
-DECLARE_INSTANCE_CHECKER(TosaDACState, TOSA_DAC,
- TYPE_TOSA_DAC)
+OBJECT_DECLARE_SIMPLE_TYPE(TosaDACState, TOSA_DAC)
struct TosaDACState {
I2CSlave parent_obj;
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 2ba69f24b7..84d4677abb 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -35,9 +35,7 @@
/* Primary interrupt controller. */
#define TYPE_VERSATILE_PB_SIC "versatilepb_sic"
-typedef struct vpb_sic_state vpb_sic_state;
-DECLARE_INSTANCE_CHECKER(vpb_sic_state, VERSATILE_PB_SIC,
- TYPE_VERSATILE_PB_SIC)
+OBJECT_DECLARE_SIMPLE_TYPE(vpb_sic_state, VERSATILE_PB_SIC)
struct vpb_sic_state {
SysBusDevice parent_obj;
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 01bb4bba1e..94ff094ab3 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -171,20 +171,17 @@ struct VexpressMachineClass {
MachineClass parent;
VEDBoardInfo *daughterboard;
};
-typedef struct VexpressMachineClass VexpressMachineClass;
struct VexpressMachineState {
MachineState parent;
bool secure;
bool virt;
};
-typedef struct VexpressMachineState VexpressMachineState;
#define TYPE_VEXPRESS_MACHINE "vexpress"
#define TYPE_VEXPRESS_A9_MACHINE MACHINE_TYPE_NAME("vexpress-a9")
#define TYPE_VEXPRESS_A15_MACHINE MACHINE_TYPE_NAME("vexpress-a15")
-DECLARE_OBJ_CHECKERS(VexpressMachineState, VexpressMachineClass,
- VEXPRESS_MACHINE, TYPE_VEXPRESS_MACHINE)
+OBJECT_DECLARE_TYPE(VexpressMachineState, VexpressMachineClass, VEXPRESS_MACHINE)
typedef void DBoardInitFn(const VexpressMachineState *machine,
ram_addr_t ram_size,
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 9efd7a3881..6bff5e3738 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -357,14 +357,6 @@ static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap,
aml_append(scope, dev);
}
-static void acpi_dsdt_add_power_button(Aml *scope)
-{
- Aml *dev = aml_device(ACPI_POWER_BUTTON_DEVICE);
- aml_append(dev, aml_name_decl("_HID", aml_string("PNP0C0C")));
- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
- aml_append(scope, dev);
-}
-
static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
{
PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index f45e71e89b..2c0bff4fa6 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -40,9 +40,7 @@
#include "qom/object.h"
#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9")
-typedef struct ZynqMachineState ZynqMachineState;
-DECLARE_INSTANCE_CHECKER(ZynqMachineState, ZYNQ_MACHINE,
- TYPE_ZYNQ_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)
/* board base frequency: 33.333333 MHz */
#define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3)
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 1f9409eb32..03e23201b1 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -25,9 +25,7 @@
#include "qom/object.h"
#define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
-typedef struct VersalVirt VersalVirt;
-DECLARE_INSTANCE_CHECKER(VersalVirt, XLNX_VERSAL_VIRT_MACHINE,
- TYPE_XLNX_VERSAL_VIRT_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(VersalVirt, XLNX_VERSAL_VIRT_MACHINE)
struct VersalVirt {
MachineState parent_obj;
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
index 19d5a4d4e0..066571a972 100644
--- a/hw/arm/xlnx-zcu102.c
+++ b/hw/arm/xlnx-zcu102.c
@@ -36,11 +36,9 @@ struct XlnxZCU102 {
struct arm_boot_info binfo;
};
-typedef struct XlnxZCU102 XlnxZCU102;
#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")
-DECLARE_INSTANCE_CHECKER(XlnxZCU102, ZCU102_MACHINE,
- TYPE_ZCU102_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(XlnxZCU102, ZCU102_MACHINE)
static bool zcu102_get_secure(Object *obj, Error **errp)
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 72ecb6df29..4fc5699dae 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -111,11 +111,9 @@ struct ZipitLCD {
uint32_t cur_reg;
int pos;
};
-typedef struct ZipitLCD ZipitLCD;
#define TYPE_ZIPIT_LCD "zipit-lcd"
-DECLARE_INSTANCE_CHECKER(ZipitLCD, ZIPIT_LCD,
- TYPE_ZIPIT_LCD)
+OBJECT_DECLARE_SIMPLE_TYPE(ZipitLCD, ZIPIT_LCD)
static uint32_t zipit_lcd_transfer(SSISlave *dev, uint32_t value)
{
@@ -198,9 +196,7 @@ static const TypeInfo zipit_lcd_info = {
};
#define TYPE_AER915 "aer915"
-typedef struct AER915State AER915State;
-DECLARE_INSTANCE_CHECKER(AER915State, AER915,
- TYPE_AER915)
+OBJECT_DECLARE_SIMPLE_TYPE(AER915State, AER915)
struct AER915State {
I2CSlave parent_obj;
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index eb8a7f032d..3cb8131060 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -127,9 +127,7 @@ enum {
#define MUTE_SHIFT 15
#define TYPE_AC97 "AC97"
-typedef struct AC97LinkState AC97LinkState;
-DECLARE_INSTANCE_CHECKER(AC97LinkState, AC97,
- TYPE_AC97)
+OBJECT_DECLARE_SIMPLE_TYPE(AC97LinkState, AC97)
#define REC_MASK 7
enum {
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 870116e324..42d50d2fdc 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -52,9 +52,7 @@
#define SHIFT 1
#define TYPE_ADLIB "adlib"
-typedef struct AdlibState AdlibState;
-DECLARE_INSTANCE_CHECKER(AdlibState, ADLIB,
- TYPE_ADLIB)
+OBJECT_DECLARE_SIMPLE_TYPE(AdlibState, ADLIB)
struct AdlibState {
ISADevice parent_obj;
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index a824f8949e..6904589814 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -293,8 +293,7 @@ struct chan_bits {
};
#define TYPE_ES1370 "ES1370"
-DECLARE_INSTANCE_CHECKER(ES1370State, ES1370,
- TYPE_ES1370)
+OBJECT_DECLARE_SIMPLE_TYPE(ES1370State, ES1370)
static void es1370_dac1_calc_freq (ES1370State *s, uint32_t ctl,
uint32_t *old_freq, uint32_t *new_freq);
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 307fd48315..e8719ee117 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -43,9 +43,7 @@
#endif
#define TYPE_GUS "gus"
-typedef struct GUSState GUSState;
-DECLARE_INSTANCE_CHECKER(GUSState, GUS,
- TYPE_GUS)
+OBJECT_DECLARE_SIMPLE_TYPE(GUSState, GUS)
struct GUSState {
ISADevice dev;
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 77d31b91a4..feb8f9e2bb 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -172,8 +172,7 @@ struct HDAAudioStream {
};
#define TYPE_HDA_AUDIO "hda-audio"
-DECLARE_INSTANCE_CHECKER(HDAAudioState, HDA_AUDIO,
- TYPE_HDA_AUDIO)
+OBJECT_DECLARE_SIMPLE_TYPE(HDAAudioState, HDA_AUDIO)
struct HDAAudioState {
HDACodecDevice hda;
diff --git a/hw/audio/intel-hda.h b/hw/audio/intel-hda.h
index f5cce18fa3..f78c1833e3 100644
--- a/hw/audio/intel-hda.h
+++ b/hw/audio/intel-hda.h
@@ -9,12 +9,10 @@
#define TYPE_HDA_CODEC_DEVICE "hda-codec"
OBJECT_DECLARE_TYPE(HDACodecDevice, HDACodecDeviceClass,
- hda_codec_device, HDA_CODEC_DEVICE)
+ HDA_CODEC_DEVICE)
#define TYPE_HDA_BUS "HDA"
-typedef struct HDACodecBus HDACodecBus;
-DECLARE_INSTANCE_CHECKER(HDACodecBus, HDA_BUS,
- TYPE_HDA_BUS)
+OBJECT_DECLARE_SIMPLE_TYPE(HDACodecBus, HDA_BUS)
typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c
index c8641562cc..e6c09bdb8e 100644
--- a/hw/audio/marvell_88w8618.c
+++ b/hw/audio/marvell_88w8618.c
@@ -43,9 +43,7 @@
#define MP_AUDIO_CLOCK_24MHZ (1 << 9)
#define MP_AUDIO_MONO (1 << 14)
-typedef struct mv88w8618_audio_state mv88w8618_audio_state;
-DECLARE_INSTANCE_CHECKER(mv88w8618_audio_state, MV88W8618_AUDIO,
- TYPE_MV88W8618_AUDIO)
+OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_audio_state, MV88W8618_AUDIO)
struct mv88w8618_audio_state {
SysBusDevice parent_obj;
diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c
index 7893539019..04b39f8345 100644
--- a/hw/audio/milkymist-ac97.c
+++ b/hw/audio/milkymist-ac97.c
@@ -56,9 +56,7 @@ enum {
};
#define TYPE_MILKYMIST_AC97 "milkymist-ac97"
-typedef struct MilkymistAC97State MilkymistAC97State;
-DECLARE_INSTANCE_CHECKER(MilkymistAC97State, MILKYMIST_AC97,
- TYPE_MILKYMIST_AC97)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistAC97State, MILKYMIST_AC97)
struct MilkymistAC97State {
SysBusDevice parent_obj;
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index cbee8855fb..b056c05387 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -40,9 +40,7 @@
#define PCSPK_MAX_FREQ (PCSPK_SAMPLE_RATE >> 1)
#define PCSPK_MIN_COUNT DIV_ROUND_UP(PIT_FREQ, PCSPK_MAX_FREQ)
-typedef struct PCSpkState PCSpkState;
-DECLARE_INSTANCE_CHECKER(PCSpkState, PC_SPEAKER,
- TYPE_PC_SPEAKER)
+OBJECT_DECLARE_SIMPLE_TYPE(PCSpkState, PC_SPEAKER)
struct PCSpkState {
ISADevice parent_obj;
diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
index 570a234b72..03acd4fe34 100644
--- a/hw/audio/pl041.c
+++ b/hw/audio/pl041.c
@@ -78,9 +78,7 @@ typedef struct {
} pl041_channel;
#define TYPE_PL041 "pl041"
-typedef struct PL041State PL041State;
-DECLARE_INSTANCE_CHECKER(PL041State, PL041,
- TYPE_PL041)
+OBJECT_DECLARE_SIMPLE_TYPE(PL041State, PL041)
struct PL041State {
SysBusDevice parent_obj;
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index 6aa2c0fb93..8b20700410 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -50,9 +50,7 @@
static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
#define TYPE_SB16 "sb16"
-typedef struct SB16State SB16State;
-DECLARE_INSTANCE_CHECKER(SB16State, SB16,
- TYPE_SB16)
+OBJECT_DECLARE_SIMPLE_TYPE(SB16State, SB16)
struct SB16State {
ISADevice parent_obj;
diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
index 7d6fcfec03..b5722b37c3 100644
--- a/hw/audio/wm8750.c
+++ b/hw/audio/wm8750.c
@@ -27,9 +27,7 @@ typedef struct {
int dac_hz;
} WMRate;
-typedef struct WM8750State WM8750State;
-DECLARE_INSTANCE_CHECKER(WM8750State, WM8750,
- TYPE_WM8750)
+OBJECT_DECLARE_SIMPLE_TYPE(WM8750State, WM8750)
struct WM8750State {
I2CSlave parent_obj;
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 224bac504f..4c2c35e223 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -65,9 +65,7 @@
/* qdev floppy bus */
#define TYPE_FLOPPY_BUS "floppy-bus"
-typedef struct FloppyBus FloppyBus;
-DECLARE_INSTANCE_CHECKER(FloppyBus, FLOPPY_BUS,
- TYPE_FLOPPY_BUS)
+OBJECT_DECLARE_SIMPLE_TYPE(FloppyBus, FLOPPY_BUS)
typedef struct FDCtrl FDCtrl;
typedef struct FDrive FDrive;
@@ -497,9 +495,7 @@ static const BlockDevOps fd_block_ops = {
#define TYPE_FLOPPY_DRIVE "floppy"
-typedef struct FloppyDrive FloppyDrive;
-DECLARE_INSTANCE_CHECKER(FloppyDrive, FLOPPY_DRIVE,
- TYPE_FLOPPY_DRIVE)
+OBJECT_DECLARE_SIMPLE_TYPE(FloppyDrive, FLOPPY_DRIVE)
struct FloppyDrive {
DeviceState qdev;
@@ -890,9 +886,7 @@ static FloppyDriveType get_fallback_drive_type(FDrive *drv)
}
#define TYPE_SYSBUS_FDC "base-sysbus-fdc"
-typedef struct FDCtrlSysBus FDCtrlSysBus;
-DECLARE_INSTANCE_CHECKER(FDCtrlSysBus, SYSBUS_FDC,
- TYPE_SYSBUS_FDC)
+OBJECT_DECLARE_SIMPLE_TYPE(FDCtrlSysBus, SYSBUS_FDC)
struct FDCtrlSysBus {
/*< private >*/
@@ -902,9 +896,7 @@ struct FDCtrlSysBus {
struct FDCtrl state;
};
-typedef struct FDCtrlISABus FDCtrlISABus;
-DECLARE_INSTANCE_CHECKER(FDCtrlISABus, ISA_FDC,
- TYPE_ISA_FDC)
+OBJECT_DECLARE_SIMPLE_TYPE(FDCtrlISABus, ISA_FDC)
struct FDCtrlISABus {
ISADevice parent_obj;
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 8dae779c76..483925f57a 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -456,17 +456,14 @@ struct Flash {
const FlashPartInfo *pi;
};
-typedef struct Flash Flash;
struct M25P80Class {
SSISlaveClass parent_class;
FlashPartInfo *pi;
};
-typedef struct M25P80Class M25P80Class;
#define TYPE_M25P80 "m25p80-generic"
-DECLARE_OBJ_CHECKERS(Flash, M25P80Class,
- M25P80, TYPE_M25P80)
+OBJECT_DECLARE_TYPE(Flash, M25P80Class, M25P80)
static inline Manufacturer get_man(Flash *s)
{
diff --git a/hw/block/nand.c b/hw/block/nand.c
index 5c8112ed5a..bcceb64ebb 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -90,8 +90,7 @@ struct NANDFlashState {
#define TYPE_NAND "nand"
-DECLARE_INSTANCE_CHECKER(NANDFlashState, NAND,
- TYPE_NAND)
+OBJECT_DECLARE_SIMPLE_TYPE(NANDFlashState, NAND)
static void mem_and(uint8_t *dest, const uint8_t *src, size_t n)
{
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 19f55aba66..5ff7be86bb 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -40,9 +40,7 @@
#define BLOCK_SHIFT (PAGE_SHIFT + 6)
#define TYPE_ONE_NAND "onenand"
-typedef struct OneNANDState OneNANDState;
-DECLARE_INSTANCE_CHECKER(OneNANDState, ONE_NAND,
- TYPE_ONE_NAND)
+OBJECT_DECLARE_SIMPLE_TYPE(OneNANDState, ONE_NAND)
struct OneNANDState {
SysBusDevice parent_obj;
diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
index daaaca0f39..2a063ad72c 100644
--- a/hw/char/debugcon.c
+++ b/hw/char/debugcon.c
@@ -33,9 +33,7 @@
#include "qom/object.h"
#define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon"
-typedef struct ISADebugconState ISADebugconState;
-DECLARE_INSTANCE_CHECKER(ISADebugconState, ISA_DEBUGCON_DEVICE,
- TYPE_ISA_DEBUGCON_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(ISADebugconState, ISA_DEBUGCON_DEVICE)
//#define DEBUG_DEBUGCON
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index b8ea34edbd..96afe3580f 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -139,9 +139,7 @@ typedef struct {
} Exynos4210UartFIFO;
#define TYPE_EXYNOS4210_UART "exynos4210.uart"
-typedef struct Exynos4210UartState Exynos4210UartState;
-DECLARE_INSTANCE_CHECKER(Exynos4210UartState, EXYNOS4210_UART,
- TYPE_EXYNOS4210_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210UartState, EXYNOS4210_UART)
struct Exynos4210UartState {
SysBusDevice parent_obj;
diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index 6fd88d83ad..3f80f6824e 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -73,9 +73,7 @@
#define FIFO_LENGTH 1024
-typedef struct UART UART;
-DECLARE_INSTANCE_CHECKER(UART, GRLIB_APB_UART,
- TYPE_GRLIB_APB_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(UART, GRLIB_APB_UART)
struct UART {
SysBusDevice parent_obj;
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 2c987df8ad..ad000a39b9 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -123,8 +123,7 @@ struct IPOctalState {
#define TYPE_IPOCTAL "ipoctal232"
-DECLARE_INSTANCE_CHECKER(IPOctalState, IPOCTAL,
- TYPE_IPOCTAL)
+OBJECT_DECLARE_SIMPLE_TYPE(IPOctalState, IPOCTAL)
static const VMStateDescription vmstate_scc2698_channel = {
.name = "scc2698_channel",
diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c
index 5723f2e189..b97aacba91 100644
--- a/hw/char/lm32_juart.c
+++ b/hw/char/lm32_juart.c
@@ -42,9 +42,7 @@ enum {
JRX_FULL = (1<<8),
};
-typedef struct LM32JuartState LM32JuartState;
-DECLARE_INSTANCE_CHECKER(LM32JuartState, LM32_JUART,
- TYPE_LM32_JUART)
+OBJECT_DECLARE_SIMPLE_TYPE(LM32JuartState, LM32_JUART)
struct LM32JuartState {
SysBusDevice parent_obj;
diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c
index 624bc83c5f..0e8b4e46a3 100644
--- a/hw/char/lm32_uart.c
+++ b/hw/char/lm32_uart.c
@@ -95,9 +95,7 @@ enum {
};
#define TYPE_LM32_UART "lm32-uart"
-typedef struct LM32UartState LM32UartState;
-DECLARE_INSTANCE_CHECKER(LM32UartState, LM32_UART,
- TYPE_LM32_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(LM32UartState, LM32_UART)
struct LM32UartState {
SysBusDevice parent_obj;
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index f6baa3ce77..e6814faffb 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -35,11 +35,9 @@ struct mcf_uart_state {
qemu_irq irq;
CharBackend chr;
};
-typedef struct mcf_uart_state mcf_uart_state;
#define TYPE_MCF_UART "mcf-uart"
-DECLARE_INSTANCE_CHECKER(mcf_uart_state, MCF_UART,
- TYPE_MCF_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(mcf_uart_state, MCF_UART)
/* UART Status Register bits. */
#define MCF_UART_RxRDY 0x01
diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index 41204a0e28..1e83dbcafa 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -58,9 +58,7 @@ enum {
};
#define TYPE_MILKYMIST_UART "milkymist-uart"
-typedef struct MilkymistUartState MilkymistUartState;
-DECLARE_INSTANCE_CHECKER(MilkymistUartState, MILKYMIST_UART,
- TYPE_MILKYMIST_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistUartState, MILKYMIST_UART)
struct MilkymistUartState {
SysBusDevice parent_obj;
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index ddb14f3197..8b418abf71 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -93,9 +93,7 @@ typedef struct ParallelState {
} ParallelState;
#define TYPE_ISA_PARALLEL "isa-parallel"
-typedef struct ISAParallelState ISAParallelState;
-DECLARE_INSTANCE_CHECKER(ISAParallelState, ISA_PARALLEL,
- TYPE_ISA_PARALLEL)
+OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)
struct ISAParallelState {
ISADevice parent_obj;
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index d4aad81a85..32c2fc0ebe 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -34,9 +34,7 @@
#include "migration/vmstate.h"
#include "qom/object.h"
-typedef struct ISASerialState ISASerialState;
-DECLARE_INSTANCE_CHECKER(ISASerialState, ISA_SERIAL,
- TYPE_ISA_SERIAL)
+OBJECT_DECLARE_SIMPLE_TYPE(ISASerialState, ISA_SERIAL)
struct ISASerialState {
ISADevice parent_obj;
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index f68948154e..b0520a5a09 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -40,11 +40,9 @@ struct PCISerialState {
SerialState state;
uint8_t prog_if;
};
-typedef struct PCISerialState PCISerialState;
#define TYPE_PCI_SERIAL "pci-serial"
-DECLARE_INSTANCE_CHECKER(PCISerialState, PCI_SERIAL,
- TYPE_PCI_SERIAL)
+OBJECT_DECLARE_SIMPLE_TYPE(PCISerialState, PCI_SERIAL)
static void serial_pci_realize(PCIDevice *dev, Error **errp)
{
diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c
index dd6dd2d8c3..e726d4d915 100644
--- a/hw/char/spapr_vty.c
+++ b/hw/char/spapr_vty.c
@@ -18,11 +18,9 @@ struct SpaprVioVty {
uint32_t in, out;
uint8_t buf[VTERM_BUFSIZE];
};
-typedef struct SpaprVioVty SpaprVioVty;
#define TYPE_VIO_SPAPR_VTY_DEVICE "spapr-vty"
-DECLARE_INSTANCE_CHECKER(SpaprVioVty, VIO_SPAPR_VTY_DEVICE,
- TYPE_VIO_SPAPR_VTY_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(SpaprVioVty, VIO_SPAPR_VTY_DEVICE)
static int vty_can_receive(void *opaque)
{
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
index 8e9f9cd9ec..2e773ec4c4 100644
--- a/hw/char/xilinx_uartlite.c
+++ b/hw/char/xilinx_uartlite.c
@@ -53,9 +53,7 @@
#define CONTROL_IE 0x10
#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
-typedef struct XilinxUARTLite XilinxUARTLite;
-DECLARE_INSTANCE_CHECKER(XilinxUARTLite, XILINX_UARTLITE,
- TYPE_XILINX_UARTLITE)
+OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
struct XilinxUARTLite {
SysBusDevice parent_obj;
diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c
index fb547aceef..72c792eef1 100644
--- a/hw/cpu/realview_mpcore.c
+++ b/hw/cpu/realview_mpcore.c
@@ -18,9 +18,7 @@
#include "qom/object.h"
#define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore"
-typedef struct mpcore_rirq_state mpcore_rirq_state;
-DECLARE_INSTANCE_CHECKER(mpcore_rirq_state, REALVIEW_MPCORE_RIRQ,
- TYPE_REALVIEW_MPCORE_RIRQ)
+OBJECT_DECLARE_SIMPLE_TYPE(mpcore_rirq_state, REALVIEW_MPCORE_RIRQ)
/* Dummy PIC to route IRQ lines. The baseboard has 4 independent IRQ
controllers. The output of these, plus some of the raw input lines
diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c
index 4b87ee7135..023165b2a3 100644
--- a/hw/display/ads7846.c
+++ b/hw/display/ads7846.c
@@ -29,11 +29,9 @@ struct ADS7846State {
int cycle;
int output;
};
-typedef struct ADS7846State ADS7846State;
#define TYPE_ADS7846 "ads7846"
-DECLARE_INSTANCE_CHECKER(ADS7846State, ADS7846,
- TYPE_ADS7846)
+OBJECT_DECLARE_SIMPLE_TYPE(ADS7846State, ADS7846)
/* Control-byte bitfields */
#define CB_PD0 (1 << 0)
diff --git a/hw/display/artist.c b/hw/display/artist.c
index 80cd66e41d..ed0e637f25 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -25,9 +25,7 @@
#include "qom/object.h"
#define TYPE_ARTIST "artist"
-typedef struct ARTISTState ARTISTState;
-DECLARE_INSTANCE_CHECKER(ARTISTState, ARTIST,
- TYPE_ARTIST)
+OBJECT_DECLARE_SIMPLE_TYPE(ARTISTState, ARTIST)
#ifdef HOST_WORDS_BIGENDIAN
#define ROP8OFF(_i) (3 - (_i))
diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h
index 714005447d..8acb9c7466 100644
--- a/hw/display/ati_int.h
+++ b/hw/display/ati_int.h
@@ -30,9 +30,7 @@
#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
#define TYPE_ATI_VGA "ati-vga"
-typedef struct ATIVGAState ATIVGAState;
-DECLARE_INSTANCE_CHECKER(ATIVGAState, ATI_VGA,
- TYPE_ATI_VGA)
+OBJECT_DECLARE_SIMPLE_TYPE(ATIVGAState, ATI_VGA)
typedef struct ATIVGARegs {
uint32_t mm_index;
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index 41587388c4..8ed734b195 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -55,11 +55,9 @@ struct BochsDisplayState {
/* device state */
BochsDisplayMode mode;
};
-typedef struct BochsDisplayState BochsDisplayState;
#define TYPE_BOCHS_DISPLAY "bochs-display"
-DECLARE_INSTANCE_CHECKER(BochsDisplayState, BOCHS_DISPLAY,
- TYPE_BOCHS_DISPLAY)
+OBJECT_DECLARE_SIMPLE_TYPE(BochsDisplayState, BOCHS_DISPLAY)
static const VMStateDescription vmstate_bochs_display = {
.name = "bochs-display",
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index d66ba9ad6a..42fcf40010 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -66,9 +66,7 @@
#define CG3_VRAM_OFFSET 0x800000
#define TYPE_CG3 "cgthree"
-typedef struct CG3State CG3State;
-DECLARE_INSTANCE_CHECKER(CG3State, CG3,
- TYPE_CG3)
+OBJECT_DECLARE_SIMPLE_TYPE(CG3State, CG3)
struct CG3State {
SysBusDevice parent_obj;
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index c088f38cf8..722b9e7004 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -183,11 +183,9 @@ struct PCICirrusVGAState {
PCIDevice dev;
CirrusVGAState cirrus_vga;
};
-typedef struct PCICirrusVGAState PCICirrusVGAState;
#define TYPE_PCI_CIRRUS_VGA "cirrus-vga"
-DECLARE_INSTANCE_CHECKER(PCICirrusVGAState, PCI_CIRRUS_VGA,
- TYPE_PCI_CIRRUS_VGA)
+OBJECT_DECLARE_SIMPLE_TYPE(PCICirrusVGAState, PCI_CIRRUS_VGA)
static uint8_t rop_to_index[256];
diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c
index e6adee1df4..4f6fb1af3b 100644
--- a/hw/display/cirrus_vga_isa.c
+++ b/hw/display/cirrus_vga_isa.c
@@ -33,9 +33,7 @@
#include "qom/object.h"
#define TYPE_ISA_CIRRUS_VGA "isa-cirrus-vga"
-typedef struct ISACirrusVGAState ISACirrusVGAState;
-DECLARE_INSTANCE_CHECKER(ISACirrusVGAState, ISA_CIRRUS_VGA,
- TYPE_ISA_CIRRUS_VGA)
+OBJECT_DECLARE_SIMPLE_TYPE(ISACirrusVGAState, ISA_CIRRUS_VGA)
struct ISACirrusVGAState {
ISADevice parent_obj;
diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
index 3ef8698eb7..4c16e1f5a0 100644
--- a/hw/display/exynos4210_fimd.c
+++ b/hw/display/exynos4210_fimd.c
@@ -294,9 +294,7 @@ struct Exynos4210fimdWindow {
};
#define TYPE_EXYNOS4210_FIMD "exynos4210.fimd"
-typedef struct Exynos4210fimdState Exynos4210fimdState;
-DECLARE_INSTANCE_CHECKER(Exynos4210fimdState, EXYNOS4210_FIMD,
- TYPE_EXYNOS4210_FIMD)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210fimdState, EXYNOS4210_FIMD)
struct Exynos4210fimdState {
SysBusDevice parent_obj;
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 4a32fe4c94..8f1725432c 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -487,9 +487,7 @@ static void g364fb_init(DeviceState *dev, G364State *s)
}
#define TYPE_G364 "sysbus-g364"
-typedef struct G364SysBusState G364SysBusState;
-DECLARE_INSTANCE_CHECKER(G364SysBusState, G364,
- TYPE_G364)
+OBJECT_DECLARE_SIMPLE_TYPE(G364SysBusState, G364)
struct G364SysBusState {
SysBusDevice parent_obj;
diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c
index 647d05f602..dd5f4696c4 100644
--- a/hw/display/jazz_led.c
+++ b/hw/display/jazz_led.c
@@ -36,9 +36,7 @@ typedef enum {
} screen_state_t;
#define TYPE_JAZZ_LED "jazz-led"
-typedef struct LedState LedState;
-DECLARE_INSTANCE_CHECKER(LedState, JAZZ_LED,
- TYPE_JAZZ_LED)
+OBJECT_DECLARE_SIMPLE_TYPE(LedState, JAZZ_LED)
struct LedState {
SysBusDevice parent_obj;
diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c
index 8a9e7c23fb..64636db86f 100644
--- a/hw/display/milkymist-tmu2.c
+++ b/hw/display/milkymist-tmu2.c
@@ -83,9 +83,7 @@ struct vertex {
} QEMU_PACKED;
#define TYPE_MILKYMIST_TMU2 "milkymist-tmu2"
-typedef struct MilkymistTMU2State MilkymistTMU2State;
-DECLARE_INSTANCE_CHECKER(MilkymistTMU2State, MILKYMIST_TMU2,
- TYPE_MILKYMIST_TMU2)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistTMU2State, MILKYMIST_TMU2)
struct MilkymistTMU2State {
SysBusDevice parent_obj;
diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c
index 2c879129fb..6f2b11d6c9 100644
--- a/hw/display/milkymist-vgafb.c
+++ b/hw/display/milkymist-vgafb.c
@@ -69,9 +69,7 @@ enum {
};
#define TYPE_MILKYMIST_VGAFB "milkymist-vgafb"
-typedef struct MilkymistVgafbState MilkymistVgafbState;
-DECLARE_INSTANCE_CHECKER(MilkymistVgafbState, MILKYMIST_VGAFB,
- TYPE_MILKYMIST_VGAFB)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistVgafbState, MILKYMIST_VGAFB)
struct MilkymistVgafbState {
SysBusDevice parent_obj;
diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c
index 94db0202a3..e2d895109d 100644
--- a/hw/display/next-fb.c
+++ b/hw/display/next-fb.c
@@ -32,9 +32,7 @@
#include "hw/m68k/next-cube.h"
#include "qom/object.h"
-typedef struct NeXTFbState NeXTFbState;
-DECLARE_INSTANCE_CHECKER(NeXTFbState, NEXTFB,
- TYPE_NEXTFB)
+OBJECT_DECLARE_SIMPLE_TYPE(NeXTFbState, NEXTFB)
struct NeXTFbState {
SysBusDevice parent_obj;
diff --git a/hw/display/pl110.c b/hw/display/pl110.c
index af51a2b9e7..02b0d45f06 100644
--- a/hw/display/pl110.c
+++ b/hw/display/pl110.c
@@ -49,9 +49,7 @@ enum pl110_version
};
#define TYPE_PL110 "pl110"
-typedef struct PL110State PL110State;
-DECLARE_INSTANCE_CHECKER(PL110State, PL110,
- TYPE_PL110)
+OBJECT_DECLARE_SIMPLE_TYPE(PL110State, PL110)
struct PL110State {
SysBusDevice parent_obj;
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 714cd01b63..379d3304ab 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -128,11 +128,9 @@ struct PCIQXLDevice {
QXLRect dirty[QXL_NUM_DIRTY_RECTS];
QEMUBH *update_area_bh;
};
-typedef struct PCIQXLDevice PCIQXLDevice;
#define TYPE_PCI_QXL "pci-qxl"
-DECLARE_INSTANCE_CHECKER(PCIQXLDevice, PCI_QXL,
- TYPE_PCI_QXL)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIQXLDevice, PCI_QXL)
#define PANIC_ON(x) if ((x)) { \
printf("%s: PANIC %s failed\n", __func__, #x); \
diff --git a/hw/display/sii9022.c b/hw/display/sii9022.c
index d88166f449..b591a58789 100644
--- a/hw/display/sii9022.c
+++ b/hw/display/sii9022.c
@@ -36,9 +36,7 @@
#define SII9022_INT_STATUS_PLUGGED 0x04;
#define TYPE_SII9022 "sii9022"
-typedef struct sii9022_state sii9022_state;
-DECLARE_INSTANCE_CHECKER(sii9022_state, SII9022,
- TYPE_SII9022)
+OBJECT_DECLARE_SIMPLE_TYPE(sii9022_state, SII9022)
struct sii9022_state {
I2CSlave parent_obj;
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 51120c6c3e..8966b69bc7 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1932,9 +1932,7 @@ static const VMStateDescription vmstate_sm501_state = {
};
#define TYPE_SYSBUS_SM501 "sysbus-sm501"
-typedef struct SM501SysBusState SM501SysBusState;
-DECLARE_INSTANCE_CHECKER(SM501SysBusState, SYSBUS_SM501,
- TYPE_SYSBUS_SM501)
+OBJECT_DECLARE_SIMPLE_TYPE(SM501SysBusState, SYSBUS_SM501)
struct SM501SysBusState {
/*< private >*/
@@ -2036,9 +2034,7 @@ static const TypeInfo sm501_sysbus_info = {
};
#define TYPE_PCI_SM501 "sm501"
-typedef struct SM501PCIState SM501PCIState;
-DECLARE_INSTANCE_CHECKER(SM501PCIState, PCI_SM501,
- TYPE_PCI_SM501)
+OBJECT_DECLARE_SIMPLE_TYPE(SM501PCIState, PCI_SM501)
struct SM501PCIState {
/*< private >*/
diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c
index 0378573a42..aeae22da9c 100644
--- a/hw/display/ssd0303.c
+++ b/hw/display/ssd0303.c
@@ -47,9 +47,7 @@ enum ssd0303_cmd {
};
#define TYPE_SSD0303 "ssd0303"
-typedef struct ssd0303_state ssd0303_state;
-DECLARE_INSTANCE_CHECKER(ssd0303_state, SSD0303,
- TYPE_SSD0303)
+OBJECT_DECLARE_SIMPLE_TYPE(ssd0303_state, SSD0303)
struct ssd0303_state {
I2CSlave parent_obj;
diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c
index 037da81127..17d4b32ae3 100644
--- a/hw/display/ssd0323.c
+++ b/hw/display/ssd0323.c
@@ -66,11 +66,9 @@ struct ssd0323_state {
uint32_t mode;
uint8_t framebuffer[128 * 80 / 2];
};
-typedef struct ssd0323_state ssd0323_state;
#define TYPE_SSD0323 "ssd0323"
-DECLARE_INSTANCE_CHECKER(ssd0323_state, SSD0323,
- TYPE_SSD0323)
+OBJECT_DECLARE_SIMPLE_TYPE(ssd0323_state, SSD0323)
static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data)
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 69e901a800..c9d5e45cd1 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -56,9 +56,7 @@
#define TCX_THC_CURSBITS 0x980
#define TYPE_TCX "SUNW,tcx"
-typedef struct TCXState TCXState;
-DECLARE_INSTANCE_CHECKER(TCXState, TCX,
- TYPE_TCX)
+OBJECT_DECLARE_SIMPLE_TYPE(TCXState, TCX)
struct TCXState {
SysBusDevice parent_obj;
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
index 0ebfcca9d1..90851e730b 100644
--- a/hw/display/vga-isa.c
+++ b/hw/display/vga-isa.c
@@ -35,9 +35,7 @@
#include "qom/object.h"
#define TYPE_ISA_VGA "isa-vga"
-typedef struct ISAVGAState ISAVGAState;
-DECLARE_INSTANCE_CHECKER(ISAVGAState, ISA_VGA,
- TYPE_ISA_VGA)
+OBJECT_DECLARE_SIMPLE_TYPE(ISAVGAState, ISA_VGA)
struct ISAVGAState {
ISADevice parent_obj;
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 3b45fa3bad..e5d9af5868 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -51,11 +51,9 @@ struct PCIVGAState {
MemoryRegion mrs[4];
uint8_t edid[256];
};
-typedef struct PCIVGAState PCIVGAState;
#define TYPE_PCI_VGA "pci-vga"
-DECLARE_INSTANCE_CHECKER(PCIVGAState, PCI_VGA,
- TYPE_PCI_VGA)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIVGAState, PCI_VGA)
static const VMStateDescription vmstate_vga_pci = {
.name = "vga",
diff --git a/hw/display/virtio-vga.h b/hw/display/virtio-vga.h
index 5c5671c9c1..977ad5edc2 100644
--- a/hw/display/virtio-vga.h
+++ b/hw/display/virtio-vga.h
@@ -10,7 +10,7 @@
*/
#define TYPE_VIRTIO_VGA_BASE "virtio-vga-base"
OBJECT_DECLARE_TYPE(VirtIOVGABase, VirtIOVGABaseClass,
- virtio_vga_base, VIRTIO_VGA_BASE)
+ VIRTIO_VGA_BASE)
struct VirtIOVGABase {
VirtIOPCIProxy parent_obj;
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 5b7ff635f7..34c3aaf7d3 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -32,9 +32,7 @@
#include "qom/object.h"
#define TYPE_I82374 "i82374"
-typedef struct I82374State I82374State;
-DECLARE_INSTANCE_CHECKER(I82374State, I82374,
- TYPE_I82374)
+OBJECT_DECLARE_SIMPLE_TYPE(I82374State, I82374)
//#define DEBUG_I82374
diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
index 859586fd2f..944ba296b0 100644
--- a/hw/dma/pl330.c
+++ b/hw/dma/pl330.c
@@ -272,8 +272,7 @@ struct PL330State {
};
#define TYPE_PL330 "pl330"
-DECLARE_INSTANCE_CHECKER(PL330State, PL330,
- TYPE_PL330)
+OBJECT_DECLARE_SIMPLE_TYPE(PL330State, PL330)
static const VMStateDescription vmstate_pl330 = {
.name = "pl330",
diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c
index 825e3dc0ac..cca1e9ec21 100644
--- a/hw/dma/puv3_dma.c
+++ b/hw/dma/puv3_dma.c
@@ -23,9 +23,7 @@
#define PUV3_DMA_CH(offset) ((offset) >> 8)
#define TYPE_PUV3_DMA "puv3_dma"
-typedef struct PUV3DMAState PUV3DMAState;
-DECLARE_INSTANCE_CHECKER(PUV3DMAState, PUV3_DMA,
- TYPE_PUV3_DMA)
+OBJECT_DECLARE_SIMPLE_TYPE(PUV3DMAState, PUV3_DMA)
struct PUV3DMAState {
SysBusDevice parent_obj;
diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c
index 4f6c0e5e5e..b3707ff3de 100644
--- a/hw/dma/pxa2xx_dma.c
+++ b/hw/dma/pxa2xx_dma.c
@@ -35,9 +35,7 @@ typedef struct {
} PXA2xxDMAChannel;
#define TYPE_PXA2XX_DMA "pxa2xx-dma"
-typedef struct PXA2xxDMAState PXA2xxDMAState;
-DECLARE_INSTANCE_CHECKER(PXA2xxDMAState, PXA2XX_DMA,
- TYPE_PXA2XX_DMA)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxDMAState, PXA2XX_DMA)
struct PXA2xxDMAState {
SysBusDevice parent_obj;
diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
index c584815d06..e4d2f1725b 100644
--- a/hw/dma/rc4030.c
+++ b/hw/dma/rc4030.c
@@ -56,9 +56,7 @@ typedef struct dma_pagetable_entry {
#define DMA_FLAG_ADDR_INTR 0x0400
#define TYPE_RC4030 "rc4030"
-typedef struct rc4030State rc4030State;
-DECLARE_INSTANCE_CHECKER(rc4030State, RC4030,
- TYPE_RC4030)
+OBJECT_DECLARE_SIMPLE_TYPE(rc4030State, RC4030)
#define TYPE_RC4030_IOMMU_MEMORY_REGION "rc4030-iommu-memory-region"
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index 498fc17d8a..0a7f5acb4b 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -43,9 +43,7 @@
#define TYPE_XILINX_AXI_DMA_DATA_STREAM "xilinx-axi-dma-data-stream"
#define TYPE_XILINX_AXI_DMA_CONTROL_STREAM "xilinx-axi-dma-control-stream"
-typedef struct XilinxAXIDMA XilinxAXIDMA;
-DECLARE_INSTANCE_CHECKER(XilinxAXIDMA, XILINX_AXI_DMA,
- TYPE_XILINX_AXI_DMA)
+OBJECT_DECLARE_SIMPLE_TYPE(XilinxAXIDMA, XILINX_AXI_DMA)
typedef struct XilinxAXIDMAStreamSlave XilinxAXIDMAStreamSlave;
DECLARE_INSTANCE_CHECKER(XilinxAXIDMAStreamSlave, XILINX_AXI_DMA_DATA_STREAM,
diff --git a/hw/gpio/gpio_key.c b/hw/gpio/gpio_key.c
index 86aa78aae4..74f6138356 100644
--- a/hw/gpio/gpio_key.c
+++ b/hw/gpio/gpio_key.c
@@ -31,9 +31,7 @@
#include "qom/object.h"
#define TYPE_GPIOKEY "gpio-key"
-typedef struct GPIOKEYState GPIOKEYState;
-DECLARE_INSTANCE_CHECKER(GPIOKEYState, GPIOKEY,
- TYPE_GPIOKEY)
+OBJECT_DECLARE_SIMPLE_TYPE(GPIOKEYState, GPIOKEY)
#define GPIO_KEY_LATENCY 100 /* 100ms */
struct GPIOKEYState {
diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index de375892ef..db6b5e3d76 100644
--- a/hw/gpio/max7310.c
+++ b/hw/gpio/max7310.c
@@ -16,9 +16,7 @@
#include "qom/object.h"
#define TYPE_MAX7310 "max7310"
-typedef struct MAX7310State MAX7310State;
-DECLARE_INSTANCE_CHECKER(MAX7310State, MAX7310,
- TYPE_MAX7310)
+OBJECT_DECLARE_SIMPLE_TYPE(MAX7310State, MAX7310)
struct MAX7310State {
I2CSlave parent_obj;
diff --git a/hw/gpio/mpc8xxx.c b/hw/gpio/mpc8xxx.c
index dac8b1be38..e60c919a13 100644
--- a/hw/gpio/mpc8xxx.c
+++ b/hw/gpio/mpc8xxx.c
@@ -27,9 +27,7 @@
#include "qom/object.h"
#define TYPE_MPC8XXX_GPIO "mpc8xxx_gpio"
-typedef struct MPC8XXXGPIOState MPC8XXXGPIOState;
-DECLARE_INSTANCE_CHECKER(MPC8XXXGPIOState, MPC8XXX_GPIO,
- TYPE_MPC8XXX_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(MPC8XXXGPIOState, MPC8XXX_GPIO)
struct MPC8XXXGPIOState {
SysBusDevice parent_obj;
diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
index 3420df0d1f..e72e77572a 100644
--- a/hw/gpio/pl061.c
+++ b/hw/gpio/pl061.c
@@ -35,9 +35,7 @@ static const uint8_t pl061_id_luminary[12] =
{ 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x18, 0x01, 0x0d, 0xf0, 0x05, 0xb1 };
#define TYPE_PL061 "pl061"
-typedef struct PL061State PL061State;
-DECLARE_INSTANCE_CHECKER(PL061State, PL061,
- TYPE_PL061)
+OBJECT_DECLARE_SIMPLE_TYPE(PL061State, PL061)
#define N_GPIOS 8
diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
index 98ea2b4c2e..e003ae505c 100644
--- a/hw/gpio/puv3_gpio.c
+++ b/hw/gpio/puv3_gpio.c
@@ -19,9 +19,7 @@
#include "qemu/log.h"
#define TYPE_PUV3_GPIO "puv3_gpio"
-typedef struct PUV3GPIOState PUV3GPIOState;
-DECLARE_INSTANCE_CHECKER(PUV3GPIOState, PUV3_GPIO,
- TYPE_PUV3_GPIO)
+OBJECT_DECLARE_SIMPLE_TYPE(PUV3GPIOState, PUV3_GPIO)
struct PUV3GPIOState {
SysBusDevice parent_obj;
diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c
index 3d25c55d06..7cf52a5041 100644
--- a/hw/gpio/zaurus.c
+++ b/hw/gpio/zaurus.c
@@ -28,9 +28,7 @@
/* SCOOP devices */
#define TYPE_SCOOP "scoop"
-typedef struct ScoopInfo ScoopInfo;
-DECLARE_INSTANCE_CHECKER(ScoopInfo, SCOOP,
- TYPE_SCOOP)
+OBJECT_DECLARE_SIMPLE_TYPE(ScoopInfo, SCOOP)
struct ScoopInfo {
SysBusDevice parent_obj;
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
index c0c9b8a2b8..81053b5fb6 100644
--- a/hw/hppa/dino.c
+++ b/hw/hppa/dino.c
@@ -81,9 +81,7 @@
#define DINO_MEM_CHUNK_SIZE (8 * MiB)
-typedef struct DinoState DinoState;
-DECLARE_INSTANCE_CHECKER(DinoState, DINO_PCI_HOST_BRIDGE,
- TYPE_DINO_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(DinoState, DINO_PCI_HOST_BRIDGE)
#define DINO800_REGS (1 + (DINO_TLTIM - DINO_GMASK) / 4)
static const uint32_t reg800_keep_bits[DINO800_REGS] = {
diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c
index c0b970f55c..1a85657948 100644
--- a/hw/hppa/lasi.c
+++ b/hw/hppa/lasi.c
@@ -53,9 +53,7 @@
#define ICR_BUS_ERROR_BIT LASI_BIT(8) /* bit 8 in ICR */
#define ICR_TOC_BIT LASI_BIT(1) /* bit 1 in ICR */
-typedef struct LasiState LasiState;
-DECLARE_INSTANCE_CHECKER(LasiState, LASI_CHIP,
- TYPE_LASI_CHIP)
+OBJECT_DECLARE_SIMPLE_TYPE(LasiState, LASI_CHIP)
struct LasiState {
PCIHostState parent_obj;
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
index aa5a2a9bd8..4b26db1365 100644
--- a/hw/hyperv/hyperv.c
+++ b/hw/hyperv/hyperv.c
@@ -35,11 +35,9 @@ struct SynICState {
struct hyperv_message_page *msg_page;
struct hyperv_event_flags_page *event_page;
};
-typedef struct SynICState SynICState;
#define TYPE_SYNIC "hyperv-synic"
-DECLARE_INSTANCE_CHECKER(SynICState, SYNIC,
- TYPE_SYNIC)
+OBJECT_DECLARE_SIMPLE_TYPE(SynICState, SYNIC)
static bool synic_enabled;
diff --git a/hw/hyperv/hyperv_testdev.c b/hw/hyperv/hyperv_testdev.c
index f6ee98e00c..9a56ddf83f 100644
--- a/hw/hyperv/hyperv_testdev.c
+++ b/hw/hyperv/hyperv_testdev.c
@@ -47,11 +47,9 @@ struct HypervTestDev {
QLIST_HEAD(, TestMsgConn) msg_conns;
QLIST_HEAD(, TestEvtConn) evt_conns;
};
-typedef struct HypervTestDev HypervTestDev;
#define TYPE_HYPERV_TEST_DEV "hyperv-testdev"
-DECLARE_INSTANCE_CHECKER(HypervTestDev, HYPERV_TEST_DEV,
- TYPE_HYPERV_TEST_DEV)
+OBJECT_DECLARE_SIMPLE_TYPE(HypervTestDev, HYPERV_TEST_DEV)
enum {
HV_TEST_DEV_SINT_ROUTE_CREATE = 1,
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index c1b9f298d9..e9a0612a04 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -163,9 +163,7 @@ void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus *bus)
/* GPIO interface. */
#define TYPE_GPIO_I2C "gpio_i2c"
-typedef struct GPIOI2CState GPIOI2CState;
-DECLARE_INSTANCE_CHECKER(GPIOI2CState, GPIO_I2C,
- TYPE_GPIO_I2C)
+OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C)
struct GPIOI2CState {
SysBusDevice parent_obj;
diff --git a/hw/i2c/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c
index ff82226e9f..b65a7d0222 100644
--- a/hw/i2c/exynos4210_i2c.c
+++ b/hw/i2c/exynos4210_i2c.c
@@ -34,9 +34,7 @@
#endif
#define TYPE_EXYNOS4_I2C "exynos4210.i2c"
-typedef struct Exynos4210I2CState Exynos4210I2CState;
-DECLARE_INSTANCE_CHECKER(Exynos4210I2CState, EXYNOS4_I2C,
- TYPE_EXYNOS4_I2C)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210I2CState, EXYNOS4_I2C)
/* Exynos4210 I2C memory map */
#define EXYNOS4_I2C_MEM_SIZE 0x14
diff --git a/hw/i2c/mpc_i2c.c b/hw/i2c/mpc_i2c.c
index 156a25a8e9..720d2331e9 100644
--- a/hw/i2c/mpc_i2c.c
+++ b/hw/i2c/mpc_i2c.c
@@ -37,9 +37,7 @@
#endif
#define TYPE_MPC_I2C "mpc-i2c"
-typedef struct MPCI2CState MPCI2CState;
-DECLARE_INSTANCE_CHECKER(MPCI2CState, MPC_I2C,
- TYPE_MPC_I2C)
+OBJECT_DECLARE_SIMPLE_TYPE(MPCI2CState, MPC_I2C)
#define MPC_I2C_ADR 0x00
#define MPC_I2C_FDR 0x04
diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c
index c6777844cf..4d2bf99207 100644
--- a/hw/i2c/smbus_eeprom.c
+++ b/hw/i2c/smbus_eeprom.c
@@ -37,9 +37,7 @@
#define TYPE_SMBUS_EEPROM "smbus-eeprom"
-typedef struct SMBusEEPROMDevice SMBusEEPROMDevice;
-DECLARE_INSTANCE_CHECKER(SMBusEEPROMDevice, SMBUS_EEPROM,
- TYPE_SMBUS_EEPROM)
+OBJECT_DECLARE_SIMPLE_TYPE(SMBusEEPROMDevice, SMBUS_EEPROM)
#define SMBUS_EEPROM_SIZE 256
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index 2d4578511d..44dd5653b7 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -30,9 +30,7 @@
#include "hw/i386/ich9.h"
#include "qom/object.h"
-typedef struct ICH9SMBState ICH9SMBState;
-DECLARE_INSTANCE_CHECKER(ICH9SMBState, ICH9_SMB_DEVICE,
- TYPE_ICH9_SMB_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(ICH9SMBState, ICH9_SMB_DEVICE)
struct ICH9SMBState {
PCIDevice dev;
diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index 03e347b207..d0bd8b537d 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -103,6 +103,7 @@ config MICROVM
select I8259
select MC146818RTC
select VIRTIO_MMIO
+ select ACPI_HW_REDUCED
config X86_IOMMU
bool
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 7a5a8b3521..0e0535d2e3 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2431,7 +2431,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
acpi_add_table(table_offsets, tables_blob);
acpi_build_madt(tables_blob, tables->linker, x86ms,
- ACPI_DEVICE_IF(pcms->acpi_dev), true);
+ ACPI_DEVICE_IF(x86ms->acpi_dev), true);
vmgenid_dev = find_vmgenid_dev();
if (vmgenid_dev) {
diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
new file mode 100644
index 0000000000..df39c5d3bd
--- /dev/null
+++ b/hw/i386/acpi-microvm.c
@@ -0,0 +1,240 @@
+/* Support for generating ACPI tables and passing them to Guests
+ *
+ * Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
+ * Copyright (C) 2006 Fabrice Bellard
+ * Copyright (C) 2013 Red Hat Inc
+ *
+ * Author: Michael S. Tsirkin <mst@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/cutils.h"
+#include "qapi/error.h"
+
+#include "exec/memory.h"
+#include "hw/acpi/acpi.h"
+#include "hw/acpi/aml-build.h"
+#include "hw/acpi/bios-linker-loader.h"
+#include "hw/acpi/generic_event_device.h"
+#include "hw/acpi/utils.h"
+#include "hw/boards.h"
+#include "hw/i386/fw_cfg.h"
+#include "hw/i386/microvm.h"
+#include "hw/virtio/virtio-mmio.h"
+
+#include "acpi-common.h"
+#include "acpi-microvm.h"
+
+static void acpi_dsdt_add_virtio(Aml *scope,
+ MicrovmMachineState *mms)
+{
+ gchar *separator;
+ long int index;
+ BusState *bus;
+ BusChild *kid;
+
+ bus = sysbus_get_default();
+ QTAILQ_FOREACH(kid, &bus->children, sibling) {
+ DeviceState *dev = kid->child;
+ Object *obj = object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MMIO);
+
+ if (obj) {
+ VirtIOMMIOProxy *mmio = VIRTIO_MMIO(obj);
+ VirtioBusState *mmio_virtio_bus = &mmio->bus;
+ BusState *mmio_bus = &mmio_virtio_bus->parent_obj;
+
+ if (QTAILQ_EMPTY(&mmio_bus->children)) {
+ continue;
+ }
+ separator = g_strrstr(mmio_bus->name, ".");
+ if (!separator) {
+ continue;
+ }
+ if (qemu_strtol(separator + 1, NULL, 10, &index) != 0) {
+ continue;
+ }
+
+ uint32_t irq = mms->virtio_irq_base + index;
+ hwaddr base = VIRTIO_MMIO_BASE + index * 512;
+ hwaddr size = 512;
+
+ Aml *dev = aml_device("VR%02u", (unsigned)index);
+ aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005")));
+ aml_append(dev, aml_name_decl("_UID", aml_int(index)));
+ aml_append(dev, aml_name_decl("_CCA", aml_int(1)));
+
+ Aml *crs = aml_resource_template();
+ aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
+ aml_append(crs,
+ aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
+ AML_EXCLUSIVE, &irq, 1));
+ aml_append(dev, aml_name_decl("_CRS", crs));
+ aml_append(scope, dev);
+ }
+ }
+}
+
+static void
+build_dsdt_microvm(GArray *table_data, BIOSLinker *linker,
+ MicrovmMachineState *mms)
+{
+ X86MachineState *x86ms = X86_MACHINE(mms);
+ Aml *dsdt, *sb_scope, *scope, *pkg;
+ bool ambiguous;
+ Object *isabus;
+
+ isabus = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous);
+ assert(isabus);
+ assert(!ambiguous);
+
+ dsdt = init_aml_allocator();
+
+ /* Reserve space for header */
+ acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
+
+ sb_scope = aml_scope("_SB");
+ fw_cfg_add_acpi_dsdt(sb_scope, x86ms->fw_cfg);
+ isa_build_aml(ISA_BUS(isabus), sb_scope);
+ build_ged_aml(sb_scope, GED_DEVICE, x86ms->acpi_dev,
+ GED_MMIO_IRQ, AML_SYSTEM_MEMORY, GED_MMIO_BASE);
+ acpi_dsdt_add_power_button(sb_scope);
+ acpi_dsdt_add_virtio(sb_scope, mms);
+ aml_append(dsdt, sb_scope);
+
+ /* ACPI 5.0: Table 7-209 System State Package */
+ scope = aml_scope("\\");
+ pkg = aml_package(4);
+ aml_append(pkg, aml_int(ACPI_GED_SLP_TYP_S5));
+ aml_append(pkg, aml_int(0)); /* ignored */
+ aml_append(pkg, aml_int(0)); /* reserved */
+ aml_append(pkg, aml_int(0)); /* reserved */
+ aml_append(scope, aml_name_decl("_S5", pkg));
+ aml_append(dsdt, scope);
+
+ /* copy AML table into ACPI tables blob and patch header there */
+ g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
+ build_header(linker, table_data,
+ (void *)(table_data->data + table_data->len - dsdt->buf->len),
+ "DSDT", dsdt->buf->len, 2, NULL, NULL);
+ free_aml_allocator();
+}
+
+static void acpi_build_microvm(AcpiBuildTables *tables,
+ MicrovmMachineState *mms)
+{
+ MachineState *machine = MACHINE(mms);
+ X86MachineState *x86ms = X86_MACHINE(mms);
+ GArray *table_offsets;
+ GArray *tables_blob = tables->table_data;
+ unsigned dsdt, xsdt;
+ AcpiFadtData pmfadt = {
+ /* ACPI 5.0: 4.1 Hardware-Reduced ACPI */
+ .rev = 5,
+ .flags = ((1 << ACPI_FADT_F_HW_REDUCED_ACPI) |
+ (1 << ACPI_FADT_F_RESET_REG_SUP)),
+
+ /* ACPI 5.0: 4.8.3.7 Sleep Control and Status Registers */
+ .sleep_ctl = {
+ .space_id = AML_AS_SYSTEM_MEMORY,
+ .bit_width = 8,
+ .address = GED_MMIO_BASE_REGS + ACPI_GED_REG_SLEEP_CTL,
+ },
+ .sleep_sts = {
+ .space_id = AML_AS_SYSTEM_MEMORY,
+ .bit_width = 8,
+ .address = GED_MMIO_BASE_REGS + ACPI_GED_REG_SLEEP_STS,
+ },
+
+ /* ACPI 5.0: 4.8.3.6 Reset Register */
+ .reset_reg = {
+ .space_id = AML_AS_SYSTEM_MEMORY,
+ .bit_width = 8,
+ .address = GED_MMIO_BASE_REGS + ACPI_GED_REG_RESET,
+ },
+ .reset_val = ACPI_GED_RESET_VALUE,
+ };
+
+ table_offsets = g_array_new(false, true /* clear */,
+ sizeof(uint32_t));
+ bios_linker_loader_alloc(tables->linker,
+ ACPI_BUILD_TABLE_FILE, tables_blob,
+ 64 /* Ensure FACS is aligned */,
+ false /* high memory */);
+
+ dsdt = tables_blob->len;
+ build_dsdt_microvm(tables_blob, tables->linker, mms);
+
+ pmfadt.dsdt_tbl_offset = &dsdt;
+ pmfadt.xdsdt_tbl_offset = &dsdt;
+ acpi_add_table(table_offsets, tables_blob);
+ build_fadt(tables_blob, tables->linker, &pmfadt, NULL, NULL);
+
+ acpi_add_table(table_offsets, tables_blob);
+ acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
+ ACPI_DEVICE_IF(x86ms->acpi_dev), false);
+
+ xsdt = tables_blob->len;
+ build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL);
+
+ /* RSDP is in FSEG memory, so allocate it separately */
+ {
+ AcpiRsdpData rsdp_data = {
+ /* ACPI 2.0: 5.2.4.3 RSDP Structure */
+ .revision = 2, /* xsdt needs v2 */
+ .oem_id = ACPI_BUILD_APPNAME6,
+ .xsdt_tbl_offset = &xsdt,
+ .rsdt_tbl_offset = NULL,
+ };
+ build_rsdp(tables->rsdp, tables->linker, &rsdp_data);
+ }
+
+ /* Cleanup memory that's no longer used. */
+ g_array_free(table_offsets, true);
+}
+
+static void acpi_build_no_update(void *build_opaque)
+{
+ /* nothing, microvm tables don't change at runtime */
+}
+
+void acpi_setup_microvm(MicrovmMachineState *mms)
+{
+ X86MachineState *x86ms = X86_MACHINE(mms);
+ AcpiBuildTables tables;
+
+ assert(x86ms->fw_cfg);
+
+ if (!x86_machine_is_acpi_enabled(x86ms)) {
+ return;
+ }
+
+ acpi_build_tables_init(&tables);
+ acpi_build_microvm(&tables, mms);
+
+ /* Now expose it all to Guest */
+ acpi_add_rom_blob(acpi_build_no_update, NULL,
+ tables.table_data,
+ ACPI_BUILD_TABLE_FILE,
+ ACPI_BUILD_TABLE_MAX_SIZE);
+ acpi_add_rom_blob(acpi_build_no_update, NULL,
+ tables.linker->cmd_blob,
+ "etc/table-loader", 0);
+ acpi_add_rom_blob(acpi_build_no_update, NULL,
+ tables.rsdp,
+ ACPI_BUILD_RSDP_FILE, 0);
+
+ acpi_build_tables_cleanup(&tables, false);
+}
diff --git a/hw/i386/acpi-microvm.h b/hw/i386/acpi-microvm.h
new file mode 100644
index 0000000000..dfe853690e
--- /dev/null
+++ b/hw/i386/acpi-microvm.h
@@ -0,0 +1,8 @@
+#ifndef HW_I386_ACPI_MICROVM_H
+#define HW_I386_ACPI_MICROVM_H
+
+#include "hw/i386/microvm.h"
+
+void acpi_setup_microvm(MicrovmMachineState *mms);
+
+#endif
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index fa5feb183c..79d38a3e41 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -297,9 +297,7 @@ struct irte_ga {
};
#define TYPE_AMD_IOMMU_DEVICE "amd-iommu"
-typedef struct AMDVIState AMDVIState;
-DECLARE_INSTANCE_CHECKER(AMDVIState, AMD_IOMMU_DEVICE,
- TYPE_AMD_IOMMU_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(AMDVIState, AMD_IOMMU_DEVICE)
#define TYPE_AMD_IOMMU_PCI "AMDVI-PCI"
diff --git a/hw/i386/generic_event_device_x86.c b/hw/i386/generic_event_device_x86.c
new file mode 100644
index 0000000000..e26fb02a2e
--- /dev/null
+++ b/hw/i386/generic_event_device_x86.c
@@ -0,0 +1,36 @@
+/*
+ * x86 variant of the generic event device for hw reduced acpi
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2 or later, as published by the Free Software Foundation.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/acpi/generic_event_device.h"
+#include "hw/i386/pc.h"
+
+static void acpi_ged_x86_class_init(ObjectClass *class, void *data)
+{
+ AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(class);
+
+ adevc->madt_cpu = pc_madt_cpu_entry;
+}
+
+static const TypeInfo acpi_ged_x86_info = {
+ .name = TYPE_ACPI_GED_X86,
+ .parent = TYPE_ACPI_GED,
+ .class_init = acpi_ged_x86_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { TYPE_ACPI_DEVICE_IF },
+ { }
+ }
+};
+
+static void acpi_ged_x86_register_types(void)
+{
+ type_register_static(&acpi_ged_x86_info);
+}
+
+type_init(acpi_ged_x86_register_types)
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 37f47540e5..7b296ae192 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -32,9 +32,7 @@
#include "qom/object.h"
#define TYPE_KVM_CLOCK "kvmclock"
-typedef struct KVMClockState KVMClockState;
-DECLARE_INSTANCE_CHECKER(KVMClockState, KVM_CLOCK,
- TYPE_KVM_CLOCK)
+OBJECT_DECLARE_SIMPLE_TYPE(KVMClockState, KVM_CLOCK)
struct KVMClockState {
/*< private >*/
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index a4e05f086e..077c3f4866 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -71,11 +71,9 @@ struct VAPICROMState {
bool rom_mapped_writable;
VMChangeStateEntry *vmsentry;
};
-typedef struct VAPICROMState VAPICROMState;
#define TYPE_VAPIC "kvmvapic"
-DECLARE_INSTANCE_CHECKER(VAPICROMState, VAPIC,
- TYPE_VAPIC)
+OBJECT_DECLARE_SIMPLE_TYPE(VAPICROMState, VAPIC)
#define TPR_INSTR_ABS_MODRM 0x1
#define TPR_INSTR_MATCH_MODRM_REG 0x2
diff --git a/hw/i386/meson.build b/hw/i386/meson.build
index 63918fbe22..e5d109f5c6 100644
--- a/hw/i386/meson.build
+++ b/hw/i386/meson.build
@@ -11,13 +11,14 @@ i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'),
if_false: files('x86-iommu-stub.c'))
i386_ss.add(when: 'CONFIG_AMD_IOMMU', if_true: files('amd_iommu.c'))
i386_ss.add(when: 'CONFIG_I440FX', if_true: files('pc_piix.c'))
-i386_ss.add(when: 'CONFIG_MICROVM', if_true: files('microvm.c'))
+i386_ss.add(when: 'CONFIG_MICROVM', if_true: files('microvm.c', 'acpi-microvm.c'))
i386_ss.add(when: 'CONFIG_Q35', if_true: files('pc_q35.c'))
i386_ss.add(when: 'CONFIG_VMMOUSE', if_true: files('vmmouse.c'))
i386_ss.add(when: 'CONFIG_VMPORT', if_true: files('vmport.c'))
i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iommu.c'))
i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c'))
+i386_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device_x86.c'))
i386_ss.add(when: 'CONFIG_PC', if_true: files(
'pc.c',
'pc_sysfw.c',
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 81d0888930..60d3272230 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -26,6 +26,8 @@
#include "sysemu/cpus.h"
#include "sysemu/numa.h"
#include "sysemu/reset.h"
+#include "sysemu/runstate.h"
+#include "acpi-microvm.h"
#include "hw/loader.h"
#include "hw/irq.h"
@@ -37,17 +39,21 @@
#include "hw/timer/i8254.h"
#include "hw/rtc/mc146818rtc.h"
#include "hw/char/serial.h"
+#include "hw/display/ramfb.h"
#include "hw/i386/topology.h"
#include "hw/i386/e820_memory_layout.h"
#include "hw/i386/fw_cfg.h"
#include "hw/virtio/virtio-mmio.h"
+#include "hw/acpi/acpi.h"
+#include "hw/acpi/generic_event_device.h"
#include "cpu.h"
#include "elf.h"
#include "kvm_i386.h"
#include "hw/xen/start_info.h"
-#define MICROVM_BIOS_FILENAME "bios-microvm.bin"
+#define MICROVM_QBOOT_FILENAME "qboot.rom"
+#define MICROVM_BIOS_FILENAME "bios-microvm.bin"
static void microvm_set_rtc(MicrovmMachineState *mms, ISADevice *s)
{
@@ -121,13 +127,25 @@ static void microvm_devices_init(MicrovmMachineState *mms)
kvmclock_create();
+ mms->virtio_irq_base = x86_machine_is_acpi_enabled(x86ms) ? 16 : 5;
for (i = 0; i < VIRTIO_NUM_TRANSPORTS; i++) {
sysbus_create_simple("virtio-mmio",
VIRTIO_MMIO_BASE + i * 512,
- x86ms->gsi[VIRTIO_IRQ_BASE + i]);
+ x86ms->gsi[mms->virtio_irq_base + i]);
}
/* Optional and legacy devices */
+ if (x86_machine_is_acpi_enabled(x86ms)) {
+ DeviceState *dev = qdev_new(TYPE_ACPI_GED_X86);
+ qdev_prop_set_uint32(dev, "ged-event", ACPI_GED_PWR_DOWN_EVT);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, GED_MMIO_BASE);
+ /* sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, GED_MMIO_BASE_MEMHP); */
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, GED_MMIO_BASE_REGS);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
+ x86ms->gsi[GED_MMIO_IRQ]);
+ sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
+ x86ms->acpi_dev = HOTPLUG_HANDLER(dev);
+ }
if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
qemu_irq *i8259;
@@ -158,7 +176,9 @@ static void microvm_devices_init(MicrovmMachineState *mms)
}
if (bios_name == NULL) {
- bios_name = MICROVM_BIOS_FILENAME;
+ bios_name = x86_machine_is_acpi_enabled(x86ms)
+ ? MICROVM_BIOS_FILENAME
+ : MICROVM_QBOOT_FILENAME;
}
x86_bios_rom_init(get_system_memory(), true);
}
@@ -227,7 +247,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)
x86ms->ioapic_as = &address_space_memory;
}
-static gchar *microvm_get_mmio_cmdline(gchar *name)
+static gchar *microvm_get_mmio_cmdline(gchar *name, uint32_t virtio_irq_base)
{
gchar *cmdline;
gchar *separator;
@@ -247,7 +267,7 @@ static gchar *microvm_get_mmio_cmdline(gchar *name)
ret = g_snprintf(cmdline, VIRTIO_CMDLINE_MAXLEN,
" virtio_mmio.device=512@0x%lx:%ld",
VIRTIO_MMIO_BASE + index * 512,
- VIRTIO_IRQ_BASE + index);
+ virtio_irq_base + index);
if (ret < 0 || ret >= VIRTIO_CMDLINE_MAXLEN) {
g_free(cmdline);
return NULL;
@@ -259,6 +279,7 @@ static gchar *microvm_get_mmio_cmdline(gchar *name)
static void microvm_fix_kernel_cmdline(MachineState *machine)
{
X86MachineState *x86ms = X86_MACHINE(machine);
+ MicrovmMachineState *mms = MICROVM_MACHINE(machine);
BusState *bus;
BusChild *kid;
char *cmdline;
@@ -282,7 +303,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
BusState *mmio_bus = &mmio_virtio_bus->parent_obj;
if (!QTAILQ_EMPTY(&mmio_bus->children)) {
- gchar *mmio_cmdline = microvm_get_mmio_cmdline(mmio_bus->name);
+ gchar *mmio_cmdline = microvm_get_mmio_cmdline
+ (mmio_bus->name, mms->virtio_irq_base);
if (mmio_cmdline) {
char *newcmd = g_strjoin(NULL, cmdline, mmio_cmdline, NULL);
g_free(mmio_cmdline);
@@ -299,6 +321,39 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
g_free(cmdline);
}
+static void microvm_device_pre_plug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ x86_cpu_pre_plug(hotplug_dev, dev, errp);
+}
+
+static void microvm_device_plug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ x86_cpu_plug(hotplug_dev, dev, errp);
+}
+
+static void microvm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ error_setg(errp, "unplug not supported by microvm");
+}
+
+static void microvm_device_unplug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ error_setg(errp, "unplug not supported by microvm");
+}
+
+static HotplugHandler *microvm_get_hotplug_handler(MachineState *machine,
+ DeviceState *dev)
+{
+ if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+ return HOTPLUG_HANDLER(machine);
+ }
+ return NULL;
+}
+
static void microvm_machine_state_init(MachineState *machine)
{
MicrovmMachineState *mms = MICROVM_MACHINE(machine);
@@ -322,7 +377,8 @@ static void microvm_machine_reset(MachineState *machine)
CPUState *cs;
X86CPU *cpu;
- if (machine->kernel_filename != NULL &&
+ if (!x86_machine_is_acpi_enabled(X86_MACHINE(machine)) &&
+ machine->kernel_filename != NULL &&
mms->auto_kernel_cmdline && !mms->kernel_cmdline_fixed) {
microvm_fix_kernel_cmdline(machine);
mms->kernel_cmdline_fixed = true;
@@ -435,6 +491,28 @@ static void microvm_machine_set_auto_kernel_cmdline(Object *obj, bool value,
mms->auto_kernel_cmdline = value;
}
+static void microvm_machine_done(Notifier *notifier, void *data)
+{
+ MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState,
+ machine_done);
+
+ acpi_setup_microvm(mms);
+}
+
+static void microvm_powerdown_req(Notifier *notifier, void *data)
+{
+ MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState,
+ powerdown_req);
+ X86MachineState *x86ms = X86_MACHINE(mms);
+
+ if (x86ms->acpi_dev) {
+ Object *obj = OBJECT(x86ms->acpi_dev);
+ AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
+ adevc->send_event(ACPI_DEVICE_IF(x86ms->acpi_dev),
+ ACPI_POWER_DOWN_STATUS);
+ }
+}
+
static void microvm_machine_initfn(Object *obj)
{
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
@@ -449,11 +527,17 @@ static void microvm_machine_initfn(Object *obj)
/* State */
mms->kernel_cmdline_fixed = false;
+
+ mms->machine_done.notify = microvm_machine_done;
+ qemu_add_machine_init_done_notifier(&mms->machine_done);
+ mms->powerdown_req.notify = microvm_powerdown_req;
+ qemu_register_powerdown_notifier(&mms->powerdown_req);
}
static void microvm_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
mc->init = microvm_machine_state_init;
@@ -475,6 +559,13 @@ static void microvm_class_init(ObjectClass *oc, void *data)
/* Machine class handlers */
mc->reset = microvm_machine_reset;
+ /* hotplug (for cpu coldplug) */
+ mc->get_hotplug_handler = microvm_get_hotplug_handler;
+ hc->pre_plug = microvm_device_pre_plug_cb;
+ hc->plug = microvm_device_plug_cb;
+ hc->unplug_request = microvm_device_unplug_request_cb;
+ hc->unplug = microvm_device_unplug_cb;
+
object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto",
microvm_machine_get_pic,
microvm_machine_set_pic,
@@ -514,6 +605,8 @@ static void microvm_class_init(ObjectClass *oc, void *data)
object_class_property_set_description(oc,
MICROVM_MACHINE_AUTO_KERNEL_CMDLINE,
"Set off to disable adding virtio-mmio devices to the kernel cmdline");
+
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
}
static const TypeInfo microvm_machine_info = {
@@ -524,6 +617,7 @@ static const TypeInfo microvm_machine_info = {
.class_size = sizeof(MicrovmMachineClass),
.class_init = microvm_class_init,
.interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
{ }
},
};
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index d11daacc23..b55369357e 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -803,19 +803,6 @@ void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp)
}
}
-static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count)
-{
- if (cpus_count > 0xff) {
- /* If the number of CPUs can't be represented in 8 bits, the
- * BIOS must use "FW_CFG_NB_CPUS". Set RTC field to 0 just
- * to make old BIOSes fail more predictably.
- */
- rtc_set_memory(rtc, 0x5f, 0);
- } else {
- rtc_set_memory(rtc, 0x5f, cpus_count - 1);
- }
-}
-
static
void pc_machine_done(Notifier *notifier, void *data)
{
@@ -825,7 +812,7 @@ void pc_machine_done(Notifier *notifier, void *data)
PCIBus *bus = pcms->bus;
/* set the number of CPUs */
- rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
+ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
if (bus) {
int extra_hosts = 0;
@@ -1274,6 +1261,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
const PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ const X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
const PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
const MachineState *ms = MACHINE(hotplug_dev);
const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
@@ -1285,7 +1273,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
* but pcms->acpi_dev is still created. Check !acpi_enabled in
* addition to cover this case.
*/
- if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
+ if (!x86ms->acpi_dev || !x86_machine_is_acpi_enabled(x86ms)) {
error_setg(errp,
"memory hotplug is not enabled: missing acpi device or acpi disabled");
return;
@@ -1296,7 +1284,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
return;
}
- hotplug_handler_pre_plug(pcms->acpi_dev, dev, &local_err);
+ hotplug_handler_pre_plug(x86ms->acpi_dev, dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
@@ -1311,6 +1299,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_dev,
{
Error *local_err = NULL;
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
MachineState *ms = MACHINE(hotplug_dev);
bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
@@ -1323,7 +1312,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_dev,
nvdimm_plug(ms->nvdimms_state);
}
- hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort);
+ hotplug_handler_plug(x86ms->acpi_dev, dev, &error_abort);
out:
error_propagate(errp, local_err);
}
@@ -1331,14 +1320,14 @@ out:
static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
- PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
/*
* When -no-acpi is used with Q35 machine type, no ACPI is built,
* but pcms->acpi_dev is still created. Check !acpi_enabled in
* addition to cover this case.
*/
- if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
+ if (!x86ms->acpi_dev || !x86_machine_is_acpi_enabled(x86ms)) {
error_setg(errp,
"memory hotplug is not enabled: missing acpi device or acpi disabled");
return;
@@ -1349,7 +1338,7 @@ static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
return;
}
- hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
+ hotplug_handler_unplug_request(x86ms->acpi_dev, dev,
errp);
}
@@ -1357,9 +1346,10 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
Error *local_err = NULL;
- hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+ hotplug_handler_unplug(x86ms->acpi_dev, dev, &local_err);
if (local_err) {
goto out;
}
@@ -1370,263 +1360,6 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
error_propagate(errp, local_err);
}
-static int pc_apic_cmp(const void *a, const void *b)
-{
- CPUArchId *apic_a = (CPUArchId *)a;
- CPUArchId *apic_b = (CPUArchId *)b;
-
- return apic_a->arch_id - apic_b->arch_id;
-}
-
-/* returns pointer to CPUArchId descriptor that matches CPU's apic_id
- * in ms->possible_cpus->cpus, if ms->possible_cpus->cpus has no
- * entry corresponding to CPU's apic_id returns NULL.
- */
-static CPUArchId *pc_find_cpu_slot(MachineState *ms, uint32_t id, int *idx)
-{
- CPUArchId apic_id, *found_cpu;
-
- apic_id.arch_id = id;
- found_cpu = bsearch(&apic_id, ms->possible_cpus->cpus,
- ms->possible_cpus->len, sizeof(*ms->possible_cpus->cpus),
- pc_apic_cmp);
- if (found_cpu && idx) {
- *idx = found_cpu - ms->possible_cpus->cpus;
- }
- return found_cpu;
-}
-
-static void pc_cpu_plug(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
-{
- CPUArchId *found_cpu;
- Error *local_err = NULL;
- X86CPU *cpu = X86_CPU(dev);
- PCMachineState *pcms = PC_MACHINE(hotplug_dev);
- X86MachineState *x86ms = X86_MACHINE(pcms);
-
- if (pcms->acpi_dev) {
- hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
- if (local_err) {
- goto out;
- }
- }
-
- /* increment the number of CPUs */
- x86ms->boot_cpus++;
- if (x86ms->rtc) {
- rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
- }
- if (x86ms->fw_cfg) {
- fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
- }
-
- found_cpu = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, NULL);
- found_cpu->cpu = OBJECT(dev);
-out:
- error_propagate(errp, local_err);
-}
-static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
-{
- int idx = -1;
- X86CPU *cpu = X86_CPU(dev);
- PCMachineState *pcms = PC_MACHINE(hotplug_dev);
-
- if (!pcms->acpi_dev) {
- error_setg(errp, "CPU hot unplug not supported without ACPI");
- return;
- }
-
- pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx);
- assert(idx != -1);
- if (idx == 0) {
- error_setg(errp, "Boot CPU is unpluggable");
- return;
- }
-
- hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
- errp);
-}
-
-static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
-{
- CPUArchId *found_cpu;
- Error *local_err = NULL;
- X86CPU *cpu = X86_CPU(dev);
- PCMachineState *pcms = PC_MACHINE(hotplug_dev);
- X86MachineState *x86ms = X86_MACHINE(pcms);
-
- hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
- if (local_err) {
- goto out;
- }
-
- found_cpu = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, NULL);
- found_cpu->cpu = NULL;
- qdev_unrealize(dev);
-
- /* decrement the number of CPUs */
- x86ms->boot_cpus--;
- /* Update the number of CPUs in CMOS */
- rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
- fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
- out:
- error_propagate(errp, local_err);
-}
-
-static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
-{
- int idx;
- CPUState *cs;
- CPUArchId *cpu_slot;
- X86CPUTopoIDs topo_ids;
- X86CPU *cpu = X86_CPU(dev);
- CPUX86State *env = &cpu->env;
- MachineState *ms = MACHINE(hotplug_dev);
- PCMachineState *pcms = PC_MACHINE(hotplug_dev);
- X86MachineState *x86ms = X86_MACHINE(pcms);
- unsigned int smp_cores = ms->smp.cores;
- unsigned int smp_threads = ms->smp.threads;
- X86CPUTopoInfo topo_info;
-
- if(!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
- error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
- ms->cpu_type);
- return;
- }
-
- init_topo_info(&topo_info, x86ms);
-
- env->nr_dies = x86ms->smp_dies;
-
- /*
- * If APIC ID is not set,
- * set it based on socket/die/core/thread properties.
- */
- if (cpu->apic_id == UNASSIGNED_APIC_ID) {
- int max_socket = (ms->smp.max_cpus - 1) /
- smp_threads / smp_cores / x86ms->smp_dies;
-
- /*
- * die-id was optional in QEMU 4.0 and older, so keep it optional
- * if there's only one die per socket.
- */
- if (cpu->die_id < 0 && x86ms->smp_dies == 1) {
- cpu->die_id = 0;
- }
-
- if (cpu->socket_id < 0) {
- error_setg(errp, "CPU socket-id is not set");
- return;
- } else if (cpu->socket_id > max_socket) {
- error_setg(errp, "Invalid CPU socket-id: %u must be in range 0:%u",
- cpu->socket_id, max_socket);
- return;
- }
- if (cpu->die_id < 0) {
- error_setg(errp, "CPU die-id is not set");
- return;
- } else if (cpu->die_id > x86ms->smp_dies - 1) {
- error_setg(errp, "Invalid CPU die-id: %u must be in range 0:%u",
- cpu->die_id, x86ms->smp_dies - 1);
- return;
- }
- if (cpu->core_id < 0) {
- error_setg(errp, "CPU core-id is not set");
- return;
- } else if (cpu->core_id > (smp_cores - 1)) {
- error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u",
- cpu->core_id, smp_cores - 1);
- return;
- }
- if (cpu->thread_id < 0) {
- error_setg(errp, "CPU thread-id is not set");
- return;
- } else if (cpu->thread_id > (smp_threads - 1)) {
- error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u",
- cpu->thread_id, smp_threads - 1);
- return;
- }
-
- topo_ids.pkg_id = cpu->socket_id;
- topo_ids.die_id = cpu->die_id;
- topo_ids.core_id = cpu->core_id;
- topo_ids.smt_id = cpu->thread_id;
- cpu->apic_id = x86_apicid_from_topo_ids(&topo_info, &topo_ids);
- }
-
- cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx);
- if (!cpu_slot) {
- MachineState *ms = MACHINE(pcms);
-
- x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids);
- error_setg(errp,
- "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"
- " APIC ID %" PRIu32 ", valid index range 0:%d",
- topo_ids.pkg_id, topo_ids.die_id, topo_ids.core_id, topo_ids.smt_id,
- cpu->apic_id, ms->possible_cpus->len - 1);
- return;
- }
-
- if (cpu_slot->cpu) {
- error_setg(errp, "CPU[%d] with APIC ID %" PRIu32 " exists",
- idx, cpu->apic_id);
- return;
- }
-
- /* if 'address' properties socket-id/core-id/thread-id are not set, set them
- * so that machine_query_hotpluggable_cpus would show correct values
- */
- /* TODO: move socket_id/core_id/thread_id checks into x86_cpu_realizefn()
- * once -smp refactoring is complete and there will be CPU private
- * CPUState::nr_cores and CPUState::nr_threads fields instead of globals */
- x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids);
- if (cpu->socket_id != -1 && cpu->socket_id != topo_ids.pkg_id) {
- error_setg(errp, "property socket-id: %u doesn't match set apic-id:"
- " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id,
- topo_ids.pkg_id);
- return;
- }
- cpu->socket_id = topo_ids.pkg_id;
-
- if (cpu->die_id != -1 && cpu->die_id != topo_ids.die_id) {
- error_setg(errp, "property die-id: %u doesn't match set apic-id:"
- " 0x%x (die-id: %u)", cpu->die_id, cpu->apic_id, topo_ids.die_id);
- return;
- }
- cpu->die_id = topo_ids.die_id;
-
- if (cpu->core_id != -1 && cpu->core_id != topo_ids.core_id) {
- error_setg(errp, "property core-id: %u doesn't match set apic-id:"
- " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id,
- topo_ids.core_id);
- return;
- }
- cpu->core_id = topo_ids.core_id;
-
- if (cpu->thread_id != -1 && cpu->thread_id != topo_ids.smt_id) {
- error_setg(errp, "property thread-id: %u doesn't match set apic-id:"
- " 0x%x (thread-id: %u)", cpu->thread_id, cpu->apic_id,
- topo_ids.smt_id);
- return;
- }
- cpu->thread_id = topo_ids.smt_id;
-
- if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) &&
- !kvm_hv_vpindex_settable()) {
- error_setg(errp, "kernel doesn't allow setting HyperV VP_INDEX");
- return;
- }
-
- cs = CPU(cpu);
- cs->cpu_index = idx;
-
- numa_cpu_pre_plug(cpu_slot, dev, errp);
-}
-
static void pc_virtio_md_pci_pre_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
@@ -1695,7 +1428,7 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_memory_pre_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
- pc_cpu_pre_plug(hotplug_dev, dev, errp);
+ x86_cpu_pre_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
pc_virtio_md_pci_pre_plug(hotplug_dev, dev, errp);
@@ -1708,7 +1441,7 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_memory_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
- pc_cpu_plug(hotplug_dev, dev, errp);
+ x86_cpu_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
pc_virtio_md_pci_plug(hotplug_dev, dev, errp);
@@ -1721,7 +1454,7 @@ static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_memory_unplug_request(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
- pc_cpu_unplug_request_cb(hotplug_dev, dev, errp);
+ x86_cpu_unplug_request_cb(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
pc_virtio_md_pci_unplug_request(hotplug_dev, dev, errp);
@@ -1737,7 +1470,7 @@ static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev,
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_memory_unplug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
- pc_cpu_unplug_cb(hotplug_dev, dev, errp);
+ x86_cpu_unplug_cb(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
pc_virtio_md_pci_unplug(hotplug_dev, dev, errp);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 33fa035fb7..6f3e78bb60 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -293,7 +293,7 @@ static void pc_init1(MachineState *machine,
object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
TYPE_HOTPLUG_HANDLER,
- (Object **)&pcms->acpi_dev,
+ (Object **)&x86ms->acpi_dev,
object_property_allow_set_link,
OBJ_PROP_LINK_STRONG);
object_property_set_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 0cb9c18cd4..622d039717 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -240,7 +240,7 @@ static void pc_q35_init(MachineState *machine)
object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
TYPE_HOTPLUG_HANDLER,
- (Object **)&pcms->acpi_dev,
+ (Object **)&x86ms->acpi_dev,
object_property_allow_set_link,
OBJ_PROP_LINK_STRONG);
object_property_set_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
diff --git a/hw/i386/port92.c b/hw/i386/port92.c
index c00dcb261b..e1379a4f98 100644
--- a/hw/i386/port92.c
+++ b/hw/i386/port92.c
@@ -14,9 +14,7 @@
#include "trace.h"
#include "qom/object.h"
-typedef struct Port92State Port92State;
-DECLARE_INSTANCE_CHECKER(Port92State, PORT92,
- TYPE_PORT92)
+OBJECT_DECLARE_SIMPLE_TYPE(Port92State, PORT92)
struct Port92State {
ISADevice parent_obj;
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index ae4cbc7add..a3556438f0 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -51,9 +51,7 @@
#endif
#define TYPE_VMMOUSE "vmmouse"
-typedef struct VMMouseState VMMouseState;
-DECLARE_INSTANCE_CHECKER(VMMouseState, VMMOUSE,
- TYPE_VMMOUSE)
+OBJECT_DECLARE_SIMPLE_TYPE(VMMouseState, VMMOUSE)
struct VMMouseState {
ISADevice parent_obj;
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index df52b6f903..20d605506b 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -63,9 +63,7 @@
#define VCPU_INFO_LEGACY_X2APIC_BIT 3
#define VCPU_INFO_RESERVED_BIT 31
-typedef struct VMPortState VMPortState;
-DECLARE_INSTANCE_CHECKER(VMPortState, VMPORT,
- TYPE_VMPORT)
+OBJECT_DECLARE_SIMPLE_TYPE(VMPortState, VMPORT)
struct VMPortState {
ISADevice parent_obj;
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index c1954db152..c2ea989579 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -41,6 +41,7 @@
#include "hw/i386/topology.h"
#include "hw/i386/fw_cfg.h"
#include "hw/intc/i8259.h"
+#include "hw/rtc/mc146818rtc.h"
#include "hw/acpi/cpu_hotplug.h"
#include "hw/irq.h"
@@ -137,6 +138,276 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version)
}
}
+void x86_rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count)
+{
+ if (cpus_count > 0xff) {
+ /*
+ * If the number of CPUs can't be represented in 8 bits, the
+ * BIOS must use "FW_CFG_NB_CPUS". Set RTC field to 0 just
+ * to make old BIOSes fail more predictably.
+ */
+ rtc_set_memory(rtc, 0x5f, 0);
+ } else {
+ rtc_set_memory(rtc, 0x5f, cpus_count - 1);
+ }
+}
+
+static int x86_apic_cmp(const void *a, const void *b)
+{
+ CPUArchId *apic_a = (CPUArchId *)a;
+ CPUArchId *apic_b = (CPUArchId *)b;
+
+ return apic_a->arch_id - apic_b->arch_id;
+}
+
+/*
+ * returns pointer to CPUArchId descriptor that matches CPU's apic_id
+ * in ms->possible_cpus->cpus, if ms->possible_cpus->cpus has no
+ * entry corresponding to CPU's apic_id returns NULL.
+ */
+CPUArchId *x86_find_cpu_slot(MachineState *ms, uint32_t id, int *idx)
+{
+ CPUArchId apic_id, *found_cpu;
+
+ apic_id.arch_id = id;
+ found_cpu = bsearch(&apic_id, ms->possible_cpus->cpus,
+ ms->possible_cpus->len, sizeof(*ms->possible_cpus->cpus),
+ x86_apic_cmp);
+ if (found_cpu && idx) {
+ *idx = found_cpu - ms->possible_cpus->cpus;
+ }
+ return found_cpu;
+}
+
+void x86_cpu_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ CPUArchId *found_cpu;
+ Error *local_err = NULL;
+ X86CPU *cpu = X86_CPU(dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
+
+ if (x86ms->acpi_dev) {
+ hotplug_handler_plug(x86ms->acpi_dev, dev, &local_err);
+ if (local_err) {
+ goto out;
+ }
+ }
+
+ /* increment the number of CPUs */
+ x86ms->boot_cpus++;
+ if (x86ms->rtc) {
+ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
+ }
+ if (x86ms->fw_cfg) {
+ fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
+ }
+
+ found_cpu = x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, NULL);
+ found_cpu->cpu = OBJECT(dev);
+out:
+ error_propagate(errp, local_err);
+}
+
+void x86_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ int idx = -1;
+ X86CPU *cpu = X86_CPU(dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
+
+ if (!x86ms->acpi_dev) {
+ error_setg(errp, "CPU hot unplug not supported without ACPI");
+ return;
+ }
+
+ x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, &idx);
+ assert(idx != -1);
+ if (idx == 0) {
+ error_setg(errp, "Boot CPU is unpluggable");
+ return;
+ }
+
+ hotplug_handler_unplug_request(x86ms->acpi_dev, dev,
+ errp);
+}
+
+void x86_cpu_unplug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ CPUArchId *found_cpu;
+ Error *local_err = NULL;
+ X86CPU *cpu = X86_CPU(dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
+
+ hotplug_handler_unplug(x86ms->acpi_dev, dev, &local_err);
+ if (local_err) {
+ goto out;
+ }
+
+ found_cpu = x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, NULL);
+ found_cpu->cpu = NULL;
+ qdev_unrealize(dev);
+
+ /* decrement the number of CPUs */
+ x86ms->boot_cpus--;
+ /* Update the number of CPUs in CMOS */
+ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
+ fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
+ out:
+ error_propagate(errp, local_err);
+}
+
+void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ int idx;
+ CPUState *cs;
+ CPUArchId *cpu_slot;
+ X86CPUTopoIDs topo_ids;
+ X86CPU *cpu = X86_CPU(dev);
+ CPUX86State *env = &cpu->env;
+ MachineState *ms = MACHINE(hotplug_dev);
+ X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
+ unsigned int smp_cores = ms->smp.cores;
+ unsigned int smp_threads = ms->smp.threads;
+ X86CPUTopoInfo topo_info;
+
+ if (!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
+ error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
+ ms->cpu_type);
+ return;
+ }
+
+ init_topo_info(&topo_info, x86ms);
+
+ env->nr_dies = x86ms->smp_dies;
+
+ /*
+ * If APIC ID is not set,
+ * set it based on socket/die/core/thread properties.
+ */
+ if (cpu->apic_id == UNASSIGNED_APIC_ID) {
+ int max_socket = (ms->smp.max_cpus - 1) /
+ smp_threads / smp_cores / x86ms->smp_dies;
+
+ /*
+ * die-id was optional in QEMU 4.0 and older, so keep it optional
+ * if there's only one die per socket.
+ */
+ if (cpu->die_id < 0 && x86ms->smp_dies == 1) {
+ cpu->die_id = 0;
+ }
+
+ if (cpu->socket_id < 0) {
+ error_setg(errp, "CPU socket-id is not set");
+ return;
+ } else if (cpu->socket_id > max_socket) {
+ error_setg(errp, "Invalid CPU socket-id: %u must be in range 0:%u",
+ cpu->socket_id, max_socket);
+ return;
+ }
+ if (cpu->die_id < 0) {
+ error_setg(errp, "CPU die-id is not set");
+ return;
+ } else if (cpu->die_id > x86ms->smp_dies - 1) {
+ error_setg(errp, "Invalid CPU die-id: %u must be in range 0:%u",
+ cpu->die_id, x86ms->smp_dies - 1);
+ return;
+ }
+ if (cpu->core_id < 0) {
+ error_setg(errp, "CPU core-id is not set");
+ return;
+ } else if (cpu->core_id > (smp_cores - 1)) {
+ error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u",
+ cpu->core_id, smp_cores - 1);
+ return;
+ }
+ if (cpu->thread_id < 0) {
+ error_setg(errp, "CPU thread-id is not set");
+ return;
+ } else if (cpu->thread_id > (smp_threads - 1)) {
+ error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u",
+ cpu->thread_id, smp_threads - 1);
+ return;
+ }
+
+ topo_ids.pkg_id = cpu->socket_id;
+ topo_ids.die_id = cpu->die_id;
+ topo_ids.core_id = cpu->core_id;
+ topo_ids.smt_id = cpu->thread_id;
+ cpu->apic_id = x86_apicid_from_topo_ids(&topo_info, &topo_ids);
+ }
+
+ cpu_slot = x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, &idx);
+ if (!cpu_slot) {
+ MachineState *ms = MACHINE(x86ms);
+
+ x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids);
+ error_setg(errp,
+ "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"
+ " APIC ID %" PRIu32 ", valid index range 0:%d",
+ topo_ids.pkg_id, topo_ids.die_id, topo_ids.core_id, topo_ids.smt_id,
+ cpu->apic_id, ms->possible_cpus->len - 1);
+ return;
+ }
+
+ if (cpu_slot->cpu) {
+ error_setg(errp, "CPU[%d] with APIC ID %" PRIu32 " exists",
+ idx, cpu->apic_id);
+ return;
+ }
+
+ /* if 'address' properties socket-id/core-id/thread-id are not set, set them
+ * so that machine_query_hotpluggable_cpus would show correct values
+ */
+ /* TODO: move socket_id/core_id/thread_id checks into x86_cpu_realizefn()
+ * once -smp refactoring is complete and there will be CPU private
+ * CPUState::nr_cores and CPUState::nr_threads fields instead of globals */
+ x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids);
+ if (cpu->socket_id != -1 && cpu->socket_id != topo_ids.pkg_id) {
+ error_setg(errp, "property socket-id: %u doesn't match set apic-id:"
+ " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id,
+ topo_ids.pkg_id);
+ return;
+ }
+ cpu->socket_id = topo_ids.pkg_id;
+
+ if (cpu->die_id != -1 && cpu->die_id != topo_ids.die_id) {
+ error_setg(errp, "property die-id: %u doesn't match set apic-id:"
+ " 0x%x (die-id: %u)", cpu->die_id, cpu->apic_id, topo_ids.die_id);
+ return;
+ }
+ cpu->die_id = topo_ids.die_id;
+
+ if (cpu->core_id != -1 && cpu->core_id != topo_ids.core_id) {
+ error_setg(errp, "property core-id: %u doesn't match set apic-id:"
+ " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id,
+ topo_ids.core_id);
+ return;
+ }
+ cpu->core_id = topo_ids.core_id;
+
+ if (cpu->thread_id != -1 && cpu->thread_id != topo_ids.smt_id) {
+ error_setg(errp, "property thread-id: %u doesn't match set apic-id:"
+ " 0x%x (thread-id: %u)", cpu->thread_id, cpu->apic_id,
+ topo_ids.smt_id);
+ return;
+ }
+ cpu->thread_id = topo_ids.smt_id;
+
+ if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) &&
+ !kvm_hv_vpindex_settable()) {
+ error_setg(errp, "kernel doesn't allow setting HyperV VP_INDEX");
+ return;
+ }
+
+ cs = CPU(cpu);
+ cs->cpu_index = idx;
+
+ numa_cpu_pre_plug(cpu_slot, dev, errp);
+}
+
CpuInstanceProperties
x86_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
{
@@ -821,7 +1092,7 @@ void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
bios);
}
-bool x86_machine_is_smm_enabled(X86MachineState *x86ms)
+bool x86_machine_is_smm_enabled(const X86MachineState *x86ms)
{
bool smm_available = false;
@@ -863,7 +1134,7 @@ static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name,
visit_type_OnOffAuto(v, name, &x86ms->smm, errp);
}
-bool x86_machine_is_acpi_enabled(X86MachineState *x86ms)
+bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms)
{
if (x86ms->acpi == ON_OFF_AUTO_OFF) {
return false;
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index a8bbe8c833..e9601031bf 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -69,11 +69,9 @@ struct PCIXenPlatformState {
char log_buffer[4096];
int log_buffer_off;
};
-typedef struct PCIXenPlatformState PCIXenPlatformState;
#define TYPE_XEN_PLATFORM "xen-platform"
-DECLARE_INSTANCE_CHECKER(PCIXenPlatformState, XEN_PLATFORM,
- TYPE_XEN_PLATFORM)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIXenPlatformState, XEN_PLATFORM)
#define XEN_PLATFORM_IOPORT 0x10
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index 67f83616d3..1ea95fa601 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -40,9 +40,7 @@
#define TYPE_XEN_PV_DEVICE "xen-pvdevice"
-typedef struct XenPVDevice XenPVDevice;
-DECLARE_INSTANCE_CHECKER(XenPVDevice, XEN_PV_DEVICE,
- TYPE_XEN_PV_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(XenPVDevice, XEN_PV_DEVICE)
struct XenPVDevice {
/*< private >*/
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 9a3489691b..6bc19de226 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -38,9 +38,7 @@
/* ISA IDE definitions */
#define TYPE_ISA_IDE "isa-ide"
-typedef struct ISAIDEState ISAIDEState;
-DECLARE_INSTANCE_CHECKER(ISAIDEState, ISA_IDE,
- TYPE_ISA_IDE)
+OBJECT_DECLARE_SIMPLE_TYPE(ISAIDEState, ISA_IDE)
struct ISAIDEState {
ISADevice parent_obj;
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 6e7f5df901..58a14fea36 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -34,9 +34,7 @@
#include "qom/object.h"
#define TYPE_MICRODRIVE "microdrive"
-typedef struct MicroDriveState MicroDriveState;
-DECLARE_INSTANCE_CHECKER(MicroDriveState, MICRODRIVE,
- TYPE_MICRODRIVE)
+OBJECT_DECLARE_SIMPLE_TYPE(MicroDriveState, MICRODRIVE)
/***********************************************************/
/* CF-ATA Microdrive */
diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index 968c239ab8..34c347b9c2 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -19,9 +19,7 @@
#include "qom/object.h"
#define TYPE_SII3112_PCI "sii3112"
-typedef struct SiI3112PCIState SiI3112PCIState;
-DECLARE_INSTANCE_CHECKER(SiI3112PCIState, SII3112_PCI,
- TYPE_SII3112_PCI)
+OBJECT_DECLARE_SIMPLE_TYPE(SiI3112PCIState, SII3112_PCI)
typedef struct SiI3112Regs {
uint32_t confstat;
diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c
index fe0c363d64..a9088c910c 100644
--- a/hw/input/adb-kbd.c
+++ b/hw/input/adb-kbd.c
@@ -32,10 +32,7 @@
#include "trace.h"
#include "qom/object.h"
-typedef struct ADBKeyboardClass ADBKeyboardClass;
-typedef struct KBDState KBDState;
-DECLARE_OBJ_CHECKERS(KBDState, ADBKeyboardClass,
- ADB_KEYBOARD, TYPE_ADB_KEYBOARD)
+OBJECT_DECLARE_TYPE(KBDState, ADBKeyboardClass, ADB_KEYBOARD)
struct KBDState {
/*< private >*/
diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c
index f5750909b4..e6b341f028 100644
--- a/hw/input/adb-mouse.c
+++ b/hw/input/adb-mouse.c
@@ -31,10 +31,7 @@
#include "trace.h"
#include "qom/object.h"
-typedef struct ADBMouseClass ADBMouseClass;
-typedef struct MouseState MouseState;
-DECLARE_OBJ_CHECKERS(MouseState, ADBMouseClass,
- ADB_MOUSE, TYPE_ADB_MOUSE)
+OBJECT_DECLARE_TYPE(MouseState, ADBMouseClass, ADB_MOUSE)
struct MouseState {
/*< public >*/
diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c
index 70245fd817..4cb1e9de01 100644
--- a/hw/input/lm832x.c
+++ b/hw/input/lm832x.c
@@ -28,9 +28,7 @@
#include "qom/object.h"
#define TYPE_LM8323 "lm8323"
-typedef struct LM823KbdState LM823KbdState;
-DECLARE_INSTANCE_CHECKER(LM823KbdState, LM8323,
- TYPE_LM8323)
+OBJECT_DECLARE_SIMPLE_TYPE(LM823KbdState, LM8323)
struct LM823KbdState {
I2CSlave parent_obj;
diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c
index eaaf8adde4..5acd7a6f7d 100644
--- a/hw/input/milkymist-softusb.c
+++ b/hw/input/milkymist-softusb.c
@@ -51,9 +51,7 @@ enum {
#define COMLOC_KEVT_BASE 0x1143
#define TYPE_MILKYMIST_SOFTUSB "milkymist-softusb"
-typedef struct MilkymistSoftUsbState MilkymistSoftUsbState;
-DECLARE_INSTANCE_CHECKER(MilkymistSoftUsbState, MILKYMIST_SOFTUSB,
- TYPE_MILKYMIST_SOFTUSB)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistSoftUsbState, MILKYMIST_SOFTUSB)
struct MilkymistSoftUsbState {
SysBusDevice parent_obj;
diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 7c53ae97da..d279b6c148 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -17,9 +17,7 @@
#include "qom/object.h"
#define TYPE_PL050 "pl050"
-typedef struct PL050State PL050State;
-DECLARE_INSTANCE_CHECKER(PL050State, PL050,
- TYPE_PL050)
+OBJECT_DECLARE_SIMPLE_TYPE(PL050State, PL050)
struct PL050State {
SysBusDevice parent_obj;
diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c
index 04d7a6d68b..596fa66648 100644
--- a/hw/intc/arm_gicv2m.c
+++ b/hw/intc/arm_gicv2m.c
@@ -37,9 +37,7 @@
#include "qom/object.h"
#define TYPE_ARM_GICV2M "arm-gicv2m"
-typedef struct ARMGICv2mState ARMGICv2mState;
-DECLARE_INSTANCE_CHECKER(ARMGICv2mState, ARM_GICV2M,
- TYPE_ARM_GICV2M)
+OBJECT_DECLARE_SIMPLE_TYPE(ARMGICv2mState, ARM_GICV2M)
#define GICV2M_NUM_SPI_MAX 128
diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
index 7b01481ab8..4534ee248d 100644
--- a/hw/intc/exynos4210_combiner.c
+++ b/hw/intc/exynos4210_combiner.c
@@ -64,9 +64,7 @@ typedef struct CombinerGroupState {
} CombinerGroupState;
#define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner"
-typedef struct Exynos4210CombinerState Exynos4210CombinerState;
-DECLARE_INSTANCE_CHECKER(Exynos4210CombinerState, EXYNOS4210_COMBINER,
- TYPE_EXYNOS4210_COMBINER)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210CombinerState, EXYNOS4210_COMBINER)
struct Exynos4210CombinerState {
SysBusDevice parent_obj;
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
index f9487673fc..bc73d1f115 100644
--- a/hw/intc/exynos4210_gic.c
+++ b/hw/intc/exynos4210_gic.c
@@ -265,9 +265,7 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit)
/********* GIC part *********/
#define TYPE_EXYNOS4210_GIC "exynos4210.gic"
-typedef struct Exynos4210GicState Exynos4210GicState;
-DECLARE_INSTANCE_CHECKER(Exynos4210GicState, EXYNOS4210_GIC,
- TYPE_EXYNOS4210_GIC)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC)
struct Exynos4210GicState {
SysBusDevice parent_obj;
@@ -384,9 +382,7 @@ type_init(exynos4210_gic_register_types)
*/
#define TYPE_EXYNOS4210_IRQ_GATE "exynos4210.irq_gate"
-typedef struct Exynos4210IRQGateState Exynos4210IRQGateState;
-DECLARE_INSTANCE_CHECKER(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE,
- TYPE_EXYNOS4210_IRQ_GATE)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE)
struct Exynos4210IRQGateState {
SysBusDevice parent_obj;
diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c
index 9b34a8ae03..ffec4a07ee 100644
--- a/hw/intc/grlib_irqmp.c
+++ b/hw/intc/grlib_irqmp.c
@@ -51,9 +51,7 @@
#define FORCE_OFFSET 0x80
#define EXTENDED_OFFSET 0xC0
-typedef struct IRQMP IRQMP;
-DECLARE_INSTANCE_CHECKER(IRQMP, GRLIB_IRQMP,
- TYPE_GRLIB_IRQMP)
+OBJECT_DECLARE_SIMPLE_TYPE(IRQMP, GRLIB_IRQMP)
typedef struct IRQMPState IRQMPState;
diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c
index e8b4015efd..0c48a9cd85 100644
--- a/hw/intc/lm32_pic.c
+++ b/hw/intc/lm32_pic.c
@@ -30,9 +30,7 @@
#include "qom/object.h"
#define TYPE_LM32_PIC "lm32-pic"
-typedef struct LM32PicState LM32PicState;
-DECLARE_INSTANCE_CHECKER(LM32PicState, LM32_PIC,
- TYPE_LM32_PIC)
+OBJECT_DECLARE_SIMPLE_TYPE(LM32PicState, LM32_PIC)
struct LM32PicState {
SysBusDevice parent_obj;
diff --git a/hw/intc/nios2_iic.c b/hw/intc/nios2_iic.c
index aa26f059a1..216db67059 100644
--- a/hw/intc/nios2_iic.c
+++ b/hw/intc/nios2_iic.c
@@ -28,9 +28,7 @@
#include "qom/object.h"
#define TYPE_ALTERA_IIC "altera,iic"
-typedef struct AlteraIIC AlteraIIC;
-DECLARE_INSTANCE_CHECKER(AlteraIIC, ALTERA_IIC,
- TYPE_ALTERA_IIC)
+OBJECT_DECLARE_SIMPLE_TYPE(AlteraIIC, ALTERA_IIC)
struct AlteraIIC {
SysBusDevice parent_obj;
diff --git a/hw/intc/ompic.c b/hw/intc/ompic.c
index a8ea621d9e..1731a10683 100644
--- a/hw/intc/ompic.c
+++ b/hw/intc/ompic.c
@@ -18,9 +18,7 @@
#include "qom/object.h"
#define TYPE_OR1K_OMPIC "or1k-ompic"
-typedef struct OR1KOMPICState OR1KOMPICState;
-DECLARE_INSTANCE_CHECKER(OR1KOMPICState, OR1K_OMPIC,
- TYPE_OR1K_OMPIC)
+OBJECT_DECLARE_SIMPLE_TYPE(OR1KOMPICState, OR1K_OMPIC)
#define OMPIC_CTRL_IRQ_ACK (1 << 31)
#define OMPIC_CTRL_IRQ_GEN (1 << 30)
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index 8c8fbeddfe..e1a39e33cb 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -39,9 +39,7 @@
#define GCR_RESET 0x80000000
-typedef struct KVMOpenPICState KVMOpenPICState;
-DECLARE_INSTANCE_CHECKER(KVMOpenPICState, KVM_OPENPIC,
- TYPE_KVM_OPENPIC)
+OBJECT_DECLARE_SIMPLE_TYPE(KVMOpenPICState, KVM_OPENPIC)
struct KVMOpenPICState {
/*< private >*/
diff --git a/hw/intc/pl190.c b/hw/intc/pl190.c
index ee3206132f..cd88443601 100644
--- a/hw/intc/pl190.c
+++ b/hw/intc/pl190.c
@@ -22,9 +22,7 @@
#define PL190_NUM_PRIO 17
#define TYPE_PL190 "pl190"
-typedef struct PL190State PL190State;
-DECLARE_INSTANCE_CHECKER(PL190State, PL190,
- TYPE_PL190)
+OBJECT_DECLARE_SIMPLE_TYPE(PL190State, PL190)
struct PL190State {
SysBusDevice parent_obj;
diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c
index 8bceede256..65226f5e7c 100644
--- a/hw/intc/puv3_intc.c
+++ b/hw/intc/puv3_intc.c
@@ -20,9 +20,7 @@
#include "qemu/log.h"
#define TYPE_PUV3_INTC "puv3_intc"
-typedef struct PUV3INTCState PUV3INTCState;
-DECLARE_INSTANCE_CHECKER(PUV3INTCState, PUV3_INTC,
- TYPE_PUV3_INTC)
+OBJECT_DECLARE_SIMPLE_TYPE(PUV3INTCState, PUV3_INTC)
struct PUV3INTCState {
SysBusDevice parent_obj;
diff --git a/hw/intc/sifive_plic.h b/hw/intc/sifive_plic.h
index ace76d0f1b..b75b1f145d 100644
--- a/hw/intc/sifive_plic.h
+++ b/hw/intc/sifive_plic.h
@@ -22,11 +22,13 @@
#define HW_SIFIVE_PLIC_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_SIFIVE_PLIC "riscv.sifive.plic"
-#define SIFIVE_PLIC(obj) \
- OBJECT_CHECK(SiFivePLICState, (obj), TYPE_SIFIVE_PLIC)
+typedef struct SiFivePLICState SiFivePLICState;
+DECLARE_INSTANCE_CHECKER(SiFivePLICState, SIFIVE_PLIC,
+ TYPE_SIFIVE_PLIC)
typedef enum PLICMode {
PLICMode_U,
@@ -41,7 +43,7 @@ typedef struct PLICAddr {
PLICMode mode;
} PLICAddr;
-typedef struct SiFivePLICState {
+struct SiFivePLICState {
/*< private >*/
SysBusDevice parent_obj;
@@ -69,7 +71,7 @@ typedef struct SiFivePLICState {
uint32_t context_base;
uint32_t context_stride;
uint32_t aperture_size;
-} SiFivePLICState;
+};
DeviceState *sifive_plic_create(hwaddr addr, char *hart_config,
uint32_t hartid_base, uint32_t num_sources,
diff --git a/hw/intc/slavio_intctl.c b/hw/intc/slavio_intctl.c
index 4a72ef5d0d..f7e59ba643 100644
--- a/hw/intc/slavio_intctl.c
+++ b/hw/intc/slavio_intctl.c
@@ -59,9 +59,7 @@ typedef struct SLAVIO_CPUINTCTLState {
} SLAVIO_CPUINTCTLState;
#define TYPE_SLAVIO_INTCTL "slavio_intctl"
-typedef struct SLAVIO_INTCTLState SLAVIO_INTCTLState;
-DECLARE_INSTANCE_CHECKER(SLAVIO_INTCTLState, SLAVIO_INTCTL,
- TYPE_SLAVIO_INTCTL)
+OBJECT_DECLARE_SIMPLE_TYPE(SLAVIO_INTCTLState, SLAVIO_INTCTL)
struct SLAVIO_INTCTLState {
SysBusDevice parent_obj;
diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c
index b35e1d2ac4..d107e134c4 100644
--- a/hw/ipack/tpci200.c
+++ b/hw/ipack/tpci200.c
@@ -69,12 +69,10 @@ struct TPCI200State {
uint16_t status;
uint8_t int_set;
};
-typedef struct TPCI200State TPCI200State;
#define TYPE_TPCI200 "tpci200"
-DECLARE_INSTANCE_CHECKER(TPCI200State, TPCI200,
- TYPE_TPCI200)
+OBJECT_DECLARE_SIMPLE_TYPE(TPCI200State, TPCI200)
static const uint8_t local_config_regs[] = {
0x00, 0xFF, 0xFF, 0x0F, 0x00, 0xFC, 0xFF, 0x0F, 0x00, 0x00, 0x00,
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 159831cbc5..c3f3306e66 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -62,9 +62,7 @@
#define VM_CMD_GRACEFUL_SHUTDOWN 0x09
#define TYPE_IPMI_BMC_EXTERN "ipmi-bmc-extern"
-typedef struct IPMIBmcExtern IPMIBmcExtern;
-DECLARE_INSTANCE_CHECKER(IPMIBmcExtern, IPMI_BMC_EXTERN,
- TYPE_IPMI_BMC_EXTERN)
+OBJECT_DECLARE_SIMPLE_TYPE(IPMIBmcExtern, IPMI_BMC_EXTERN)
struct IPMIBmcExtern {
IPMIBmc parent;
diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c
index 0b69acc2e9..b7c2ad557b 100644
--- a/hw/ipmi/isa_ipmi_bt.c
+++ b/hw/ipmi/isa_ipmi_bt.c
@@ -34,9 +34,7 @@
#include "qom/object.h"
#define TYPE_ISA_IPMI_BT "isa-ipmi-bt"
-typedef struct ISAIPMIBTDevice ISAIPMIBTDevice;
-DECLARE_INSTANCE_CHECKER(ISAIPMIBTDevice, ISA_IPMI_BT,
- TYPE_ISA_IPMI_BT)
+OBJECT_DECLARE_SIMPLE_TYPE(ISAIPMIBTDevice, ISA_IPMI_BT)
struct ISAIPMIBTDevice {
ISADevice dev;
diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c
index af69e9a008..7dd6bf0040 100644
--- a/hw/ipmi/isa_ipmi_kcs.c
+++ b/hw/ipmi/isa_ipmi_kcs.c
@@ -34,9 +34,7 @@
#include "qom/object.h"
#define TYPE_ISA_IPMI_KCS "isa-ipmi-kcs"
-typedef struct ISAIPMIKCSDevice ISAIPMIKCSDevice;
-DECLARE_INSTANCE_CHECKER(ISAIPMIKCSDevice, ISA_IPMI_KCS,
- TYPE_ISA_IPMI_KCS)
+OBJECT_DECLARE_SIMPLE_TYPE(ISAIPMIKCSDevice, ISA_IPMI_KCS)
struct ISAIPMIKCSDevice {
ISADevice dev;
diff --git a/hw/ipmi/pci_ipmi_bt.c b/hw/ipmi/pci_ipmi_bt.c
index 7e5ecea6cc..b6e52730d3 100644
--- a/hw/ipmi/pci_ipmi_bt.c
+++ b/hw/ipmi/pci_ipmi_bt.c
@@ -29,9 +29,7 @@
#include "qom/object.h"
#define TYPE_PCI_IPMI_BT "pci-ipmi-bt"
-typedef struct PCIIPMIBTDevice PCIIPMIBTDevice;
-DECLARE_INSTANCE_CHECKER(PCIIPMIBTDevice, PCI_IPMI_BT,
- TYPE_PCI_IPMI_BT)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIIPMIBTDevice, PCI_IPMI_BT)
struct PCIIPMIBTDevice {
PCIDevice dev;
diff --git a/hw/ipmi/pci_ipmi_kcs.c b/hw/ipmi/pci_ipmi_kcs.c
index c2a283a982..de13418862 100644
--- a/hw/ipmi/pci_ipmi_kcs.c
+++ b/hw/ipmi/pci_ipmi_kcs.c
@@ -29,9 +29,7 @@
#include "qom/object.h"
#define TYPE_PCI_IPMI_KCS "pci-ipmi-kcs"
-typedef struct PCIIPMIKCSDevice PCIIPMIKCSDevice;
-DECLARE_INSTANCE_CHECKER(PCIIPMIKCSDevice, PCI_IPMI_KCS,
- TYPE_PCI_IPMI_KCS)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIIPMIKCSDevice, PCI_IPMI_KCS)
struct PCIIPMIKCSDevice {
PCIDevice dev;
diff --git a/hw/ipmi/smbus_ipmi.c b/hw/ipmi/smbus_ipmi.c
index cd4c05dd1b..1fdf0a66b6 100644
--- a/hw/ipmi/smbus_ipmi.c
+++ b/hw/ipmi/smbus_ipmi.c
@@ -30,9 +30,7 @@
#include "qom/object.h"
#define TYPE_SMBUS_IPMI "smbus-ipmi"
-typedef struct SMBusIPMIDevice SMBusIPMIDevice;
-DECLARE_INSTANCE_CHECKER(SMBusIPMIDevice, SMBUS_IPMI,
- TYPE_SMBUS_IPMI)
+OBJECT_DECLARE_SIMPLE_TYPE(SMBusIPMIDevice, SMBUS_IPMI)
#define SSIF_IPMI_REQUEST 2
#define SSIF_IPMI_MULTI_PART_REQUEST_START 6
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 1dcf525f3f..8285b06e1d 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -27,9 +27,7 @@
#include "qom/object.h"
#define TYPE_I82378 "i82378"
-typedef struct I82378State I82378State;
-DECLARE_INSTANCE_CHECKER(I82378State, I82378,
- TYPE_I82378)
+OBJECT_DECLARE_SIMPLE_TYPE(I82378State, I82378)
struct I82378State {
PCIDevice parent_obj;
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 8e3ac845b8..a50d97834c 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -52,10 +52,8 @@ struct PIIX4State {
MemoryRegion rcr_mem;
uint8_t rcr;
};
-typedef struct PIIX4State PIIX4State;
-DECLARE_INSTANCE_CHECKER(PIIX4State, PIIX4_PCI_DEVICE,
- TYPE_PIIX4_PCI_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE)
static void piix4_isa_reset(DeviceState *dev)
{
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 1e6b48b2a2..b3170c70c3 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -48,11 +48,9 @@ struct VT82C686BState {
MemoryRegion superio;
SuperIOConfig superio_conf;
};
-typedef struct VT82C686BState VT82C686BState;
#define TYPE_VT82C686B_DEVICE "VT82C686B"
-DECLARE_INSTANCE_CHECKER(VT82C686BState, VT82C686B_DEVICE,
- TYPE_VT82C686B_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BState, VT82C686B_DEVICE)
static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
unsigned size)
@@ -169,29 +167,23 @@ struct VT686PMState {
PMSMBus smb;
uint32_t smb_io_base;
};
-typedef struct VT686PMState VT686PMState;
struct VT686AC97State {
PCIDevice dev;
};
-typedef struct VT686AC97State VT686AC97State;
struct VT686MC97State {
PCIDevice dev;
};
-typedef struct VT686MC97State VT686MC97State;
#define TYPE_VT82C686B_PM_DEVICE "VT82C686B_PM"
-DECLARE_INSTANCE_CHECKER(VT686PMState, VT82C686B_PM_DEVICE,
- TYPE_VT82C686B_PM_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM_DEVICE)
#define TYPE_VT82C686B_MC97_DEVICE "VT82C686B_MC97"
-DECLARE_INSTANCE_CHECKER(VT686MC97State, VT82C686B_MC97_DEVICE,
- TYPE_VT82C686B_MC97_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(VT686MC97State, VT82C686B_MC97_DEVICE)
#define TYPE_VT82C686B_AC97_DEVICE "VT82C686B_AC97"
-DECLARE_INSTANCE_CHECKER(VT686AC97State, VT82C686B_AC97_DEVICE,
- TYPE_VT82C686B_AC97_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(VT686AC97State, VT82C686B_AC97_DEVICE)
static void pm_update_sci(VT686PMState *s)
{
diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c
index 7ee447240b..cf02f57a71 100644
--- a/hw/m68k/mcf_intc.c
+++ b/hw/m68k/mcf_intc.c
@@ -18,9 +18,7 @@
#include "qom/object.h"
#define TYPE_MCF_INTC "mcf-intc"
-typedef struct mcf_intc_state mcf_intc_state;
-DECLARE_INSTANCE_CHECKER(mcf_intc_state, MCF_INTC,
- TYPE_MCF_INTC)
+OBJECT_DECLARE_SIMPLE_TYPE(mcf_intc_state, MCF_INTC)
struct mcf_intc_state {
SysBusDevice parent_obj;
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index cbd913b0a2..e7045980b7 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -38,9 +38,7 @@
#endif
#define TYPE_NEXT_MACHINE MACHINE_TYPE_NAME("next-cube")
-typedef struct NeXTState NeXTState;
-DECLARE_INSTANCE_CHECKER(NeXTState, NEXT_MACHINE,
- TYPE_NEXT_MACHINE)
+OBJECT_DECLARE_SIMPLE_TYPE(NeXTState, NEXT_MACHINE)
#define ENTRY 0x0100001e
#define RAM_SIZE 0x4000000
diff --git a/hw/m68k/next-kbd.c b/hw/m68k/next-kbd.c
index c7ca3fbbc9..c11b5281f1 100644
--- a/hw/m68k/next-kbd.c
+++ b/hw/m68k/next-kbd.c
@@ -38,9 +38,7 @@
#include "migration/vmstate.h"
#include "qom/object.h"
-typedef struct NextKBDState NextKBDState;
-DECLARE_INSTANCE_CHECKER(NextKBDState, NEXTKBD,
- TYPE_NEXTKBD)
+OBJECT_DECLARE_SIMPLE_TYPE(NextKBDState, NEXTKBD)
/* following defintions from next68k netbsd */
#define CSR_INT 0x00800000
diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c
index ab9924bf20..1d1b4b5c19 100644
--- a/hw/microblaze/xlnx-zynqmp-pmu.c
+++ b/hw/microblaze/xlnx-zynqmp-pmu.c
@@ -29,9 +29,7 @@
/* Define the PMU device */
#define TYPE_XLNX_ZYNQMP_PMU_SOC "xlnx,zynqmp-pmu-soc"
-typedef struct XlnxZynqMPPMUSoCState XlnxZynqMPPMUSoCState;
-DECLARE_INSTANCE_CHECKER(XlnxZynqMPPMUSoCState, XLNX_ZYNQMP_PMU_SOC,
- TYPE_XLNX_ZYNQMP_PMU_SOC)
+OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPPMUSoCState, XLNX_ZYNQMP_PMU_SOC)
#define XLNX_ZYNQMP_PMU_ROM_SIZE 0x8000
#define XLNX_ZYNQMP_PMU_ROM_ADDR 0xFFD00000
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index b613e1e011..e091bc4ed5 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -231,9 +231,7 @@
#define TYPE_GT64120_PCI_HOST_BRIDGE "gt64120"
-typedef struct GT64120State GT64120State;
-DECLARE_INSTANCE_CHECKER(GT64120State, GT64120_PCI_HOST_BRIDGE,
- TYPE_GT64120_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(GT64120State, GT64120_PCI_HOST_BRIDGE)
struct GT64120State {
PCIHostState parent_obj;
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 5b73ea4692..4019c9dc1a 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -89,9 +89,7 @@ typedef struct {
} MaltaFPGAState;
#define TYPE_MIPS_MALTA "mips-malta"
-typedef struct MaltaState MaltaState;
-DECLARE_INSTANCE_CHECKER(MaltaState, MIPS_MALTA,
- TYPE_MIPS_MALTA)
+OBJECT_DECLARE_SIMPLE_TYPE(MaltaState, MIPS_MALTA)
struct MaltaState {
SysBusDevice parent_obj;
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
index dca3fba028..a4deb3e7a0 100644
--- a/hw/misc/applesmc.c
+++ b/hw/misc/applesmc.c
@@ -90,9 +90,7 @@ struct AppleSMCData {
QLIST_ENTRY(AppleSMCData) node;
};
-typedef struct AppleSMCState AppleSMCState;
-DECLARE_INSTANCE_CHECKER(AppleSMCState, APPLE_SMC,
- TYPE_APPLE_SMC)
+OBJECT_DECLARE_SIMPLE_TYPE(AppleSMCState, APPLE_SMC)
struct AppleSMCState {
ISADevice parent_obj;
diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c
index 822deffc0c..ec0d4b90d3 100644
--- a/hw/misc/arm_integrator_debug.c
+++ b/hw/misc/arm_integrator_debug.c
@@ -21,9 +21,7 @@
#include "qemu/module.h"
#include "qom/object.h"
-typedef struct IntegratorDebugState IntegratorDebugState;
-DECLARE_INSTANCE_CHECKER(IntegratorDebugState, INTEGRATOR_DEBUG,
- TYPE_INTEGRATOR_DEBUG)
+OBJECT_DECLARE_SIMPLE_TYPE(IntegratorDebugState, INTEGRATOR_DEBUG)
struct IntegratorDebugState {
SysBusDevice parent_obj;
diff --git a/hw/misc/arm_l2x0.c b/hw/misc/arm_l2x0.c
index 93948c3bd8..75c3eb8982 100644
--- a/hw/misc/arm_l2x0.c
+++ b/hw/misc/arm_l2x0.c
@@ -30,9 +30,7 @@
#define CACHE_ID 0x410000c8
#define TYPE_ARM_L2X0 "l2x0"
-typedef struct L2x0State L2x0State;
-DECLARE_INSTANCE_CHECKER(L2x0State, ARM_L2X0,
- TYPE_ARM_L2X0)
+OBJECT_DECLARE_SIMPLE_TYPE(L2x0State, ARM_L2X0)
struct L2x0State {
SysBusDevice parent_obj;
diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c
index f0f49e76e8..42d4693854 100644
--- a/hw/misc/arm_sysctl.c
+++ b/hw/misc/arm_sysctl.c
@@ -23,9 +23,7 @@
#define LOCK_VALUE 0xa05f
#define TYPE_ARM_SYSCTL "realview_sysctl"
-typedef struct arm_sysctl_state arm_sysctl_state;
-DECLARE_INSTANCE_CHECKER(arm_sysctl_state, ARM_SYSCTL,
- TYPE_ARM_SYSCTL)
+OBJECT_DECLARE_SIMPLE_TYPE(arm_sysctl_state, ARM_SYSCTL)
struct arm_sysctl_state {
SysBusDevice parent_obj;
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index dc6dd87c22..40a38ebd85 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -670,7 +670,12 @@ static void aspeed_ast2600_scu_reset(DeviceState *dev)
memcpy(s->regs, asc->resets, asc->nr_regs * 4);
- s->regs[AST2600_SILICON_REV] = s->silicon_rev;
+ /*
+ * A0 reports A0 in _REV, but subsequent revisions report A1 regardless
+ * of actual revision. QEMU and Linux only support A1 onwards so this is
+ * sufficient.
+ */
+ s->regs[AST2600_SILICON_REV] = AST2600_A1_SILICON_REV;
s->regs[AST2600_SILICON_REV2] = s->silicon_rev;
s->regs[AST2600_HW_STRAP1] = s->hw_strap1;
s->regs[AST2600_HW_STRAP2] = s->hw_strap2;
diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c
index c6b0cffd77..ab6de69ce7 100644
--- a/hw/misc/debugexit.c
+++ b/hw/misc/debugexit.c
@@ -14,9 +14,7 @@
#include "qom/object.h"
#define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit"
-typedef struct ISADebugExitState ISADebugExitState;
-DECLARE_INSTANCE_CHECKER(ISADebugExitState, ISA_DEBUG_EXIT_DEVICE,
- TYPE_ISA_DEBUG_EXIT_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(ISADebugExitState, ISA_DEBUG_EXIT_DEVICE)
struct ISADebugExitState {
ISADevice parent_obj;
diff --git a/hw/misc/eccmemctl.c b/hw/misc/eccmemctl.c
index 468c2a491d..c65806e3d9 100644
--- a/hw/misc/eccmemctl.c
+++ b/hw/misc/eccmemctl.c
@@ -127,9 +127,7 @@
#define ECC_DIAG_MASK (ECC_DIAG_SIZE - 1)
#define TYPE_ECC_MEMCTL "eccmemctl"
-typedef struct ECCState ECCState;
-DECLARE_INSTANCE_CHECKER(ECCState, ECC_MEMCTL,
- TYPE_ECC_MEMCTL)
+OBJECT_DECLARE_SIMPLE_TYPE(ECCState, ECC_MEMCTL)
struct ECCState {
SysBusDevice parent_obj;
diff --git a/hw/misc/empty_slot.c b/hw/misc/empty_slot.c
index 57dcdfbe14..37b0ddfb02 100644
--- a/hw/misc/empty_slot.c
+++ b/hw/misc/empty_slot.c
@@ -18,9 +18,7 @@
#include "qom/object.h"
#define TYPE_EMPTY_SLOT "empty_slot"
-typedef struct EmptySlot EmptySlot;
-DECLARE_INSTANCE_CHECKER(EmptySlot, EMPTY_SLOT,
- TYPE_EMPTY_SLOT)
+OBJECT_DECLARE_SIMPLE_TYPE(EmptySlot, EMPTY_SLOT)
struct EmptySlot {
SysBusDevice parent_obj;
diff --git a/hw/misc/exynos4210_clk.c b/hw/misc/exynos4210_clk.c
index 4b469f6419..58cec282f7 100644
--- a/hw/misc/exynos4210_clk.c
+++ b/hw/misc/exynos4210_clk.c
@@ -25,9 +25,7 @@
#include "qom/object.h"
#define TYPE_EXYNOS4210_CLK "exynos4210.clk"
-typedef struct Exynos4210ClkState Exynos4210ClkState;
-DECLARE_INSTANCE_CHECKER(Exynos4210ClkState, EXYNOS4210_CLK,
- TYPE_EXYNOS4210_CLK)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210ClkState, EXYNOS4210_CLK)
#define CLK_PLL_LOCKED BIT(29)
diff --git a/hw/misc/exynos4210_pmu.c b/hw/misc/exynos4210_pmu.c
index b19b82a88c..e24139c630 100644
--- a/hw/misc/exynos4210_pmu.c
+++ b/hw/misc/exynos4210_pmu.c
@@ -395,9 +395,7 @@ static const Exynos4210PmuReg exynos4210_pmu_regs[] = {
#define PMU_NUM_OF_REGISTERS ARRAY_SIZE(exynos4210_pmu_regs)
#define TYPE_EXYNOS4210_PMU "exynos4210.pmu"
-typedef struct Exynos4210PmuState Exynos4210PmuState;
-DECLARE_INSTANCE_CHECKER(Exynos4210PmuState, EXYNOS4210_PMU,
- TYPE_EXYNOS4210_PMU)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210PmuState, EXYNOS4210_PMU)
struct Exynos4210PmuState {
SysBusDevice parent_obj;
diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c
index 13ec6e188b..1b9e8347a1 100644
--- a/hw/misc/exynos4210_rng.c
+++ b/hw/misc/exynos4210_rng.c
@@ -36,9 +36,7 @@
} while (0)
#define TYPE_EXYNOS4210_RNG "exynos4210.rng"
-typedef struct Exynos4210RngState Exynos4210RngState;
-DECLARE_INSTANCE_CHECKER(Exynos4210RngState, EXYNOS4210_RNG,
- TYPE_EXYNOS4210_RNG)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210RngState, EXYNOS4210_RNG)
/*
* Exynos4220, PRNG, only polling mode is supported.
diff --git a/hw/misc/milkymist-hpdmc.c b/hw/misc/milkymist-hpdmc.c
index f25715e09e..5e26d90ceb 100644
--- a/hw/misc/milkymist-hpdmc.c
+++ b/hw/misc/milkymist-hpdmc.c
@@ -44,9 +44,7 @@ enum {
};
#define TYPE_MILKYMIST_HPDMC "milkymist-hpdmc"
-typedef struct MilkymistHpdmcState MilkymistHpdmcState;
-DECLARE_INSTANCE_CHECKER(MilkymistHpdmcState, MILKYMIST_HPDMC,
- TYPE_MILKYMIST_HPDMC)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistHpdmcState, MILKYMIST_HPDMC)
struct MilkymistHpdmcState {
SysBusDevice parent_obj;
diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c
index 489bb8873f..83491dbca2 100644
--- a/hw/misc/milkymist-pfpu.c
+++ b/hw/misc/milkymist-pfpu.c
@@ -121,9 +121,7 @@ static const char *opcode_to_str[] = {
#endif
#define TYPE_MILKYMIST_PFPU "milkymist-pfpu"
-typedef struct MilkymistPFPUState MilkymistPFPUState;
-DECLARE_INSTANCE_CHECKER(MilkymistPFPUState, MILKYMIST_PFPU,
- TYPE_MILKYMIST_PFPU)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistPFPUState, MILKYMIST_PFPU)
struct MilkymistPFPUState {
SysBusDevice parent_obj;
diff --git a/hw/misc/mst_fpga.c b/hw/misc/mst_fpga.c
index f74d8cdd4a..edfc35d5f0 100644
--- a/hw/misc/mst_fpga.c
+++ b/hw/misc/mst_fpga.c
@@ -41,9 +41,7 @@
#define MST_PCMCIA_CD1_IRQ 13
#define TYPE_MAINSTONE_FPGA "mainstone-fpga"
-typedef struct mst_irq_state mst_irq_state;
-DECLARE_INSTANCE_CHECKER(mst_irq_state, MAINSTONE_FPGA,
- TYPE_MAINSTONE_FPGA)
+OBJECT_DECLARE_SIMPLE_TYPE(mst_irq_state, MAINSTONE_FPGA)
struct mst_irq_state {
SysBusDevice parent_obj;
diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c
index 577a15bf58..e389651869 100644
--- a/hw/misc/pc-testdev.c
+++ b/hw/misc/pc-testdev.c
@@ -54,11 +54,9 @@ struct PCTestdev {
uint32_t ioport_data;
char iomem_buf[IOMEM_LEN];
};
-typedef struct PCTestdev PCTestdev;
#define TYPE_TESTDEV "pc-testdev"
-DECLARE_INSTANCE_CHECKER(PCTestdev, TESTDEV,
- TYPE_TESTDEV)
+OBJECT_DECLARE_SIMPLE_TYPE(PCTestdev, TESTDEV)
static uint64_t test_irq_line_read(void *opaque, hwaddr addr, unsigned size)
{
diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index 86d4816769..03845c8de3 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -92,12 +92,10 @@ struct PCITestDevState {
uint64_t membar_size;
MemoryRegion membar;
};
-typedef struct PCITestDevState PCITestDevState;
#define TYPE_PCI_TEST_DEV "pci-testdev"
-DECLARE_INSTANCE_CHECKER(PCITestDevState, PCI_TEST_DEV,
- TYPE_PCI_TEST_DEV)
+OBJECT_DECLARE_SIMPLE_TYPE(PCITestDevState, PCI_TEST_DEV)
#define IOTEST_IS_MEM(i) (strcmp(IOTEST_TYPE(i), "portio"))
#define IOTEST_REGION(d, i) (IOTEST_IS_MEM(i) ? &(d)->mmio : &(d)->portio)
diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c
index cac8497f81..676c23f7db 100644
--- a/hw/misc/puv3_pm.c
+++ b/hw/misc/puv3_pm.c
@@ -19,9 +19,7 @@
#include "qemu/log.h"
#define TYPE_PUV3_PM "puv3_pm"
-typedef struct PUV3PMState PUV3PMState;
-DECLARE_INSTANCE_CHECKER(PUV3PMState, PUV3_PM,
- TYPE_PUV3_PM)
+OBJECT_DECLARE_SIMPLE_TYPE(PUV3PMState, PUV3_PM)
struct PUV3PMState {
SysBusDevice parent_obj;
diff --git a/hw/misc/sga.c b/hw/misc/sga.c
index 477f587ef3..4dbe6d78f9 100644
--- a/hw/misc/sga.c
+++ b/hw/misc/sga.c
@@ -34,9 +34,7 @@
#define SGABIOS_FILENAME "sgabios.bin"
#define TYPE_SGA "sga"
-typedef struct ISASGAState ISASGAState;
-DECLARE_INSTANCE_CHECKER(ISASGAState, SGA,
- TYPE_SGA)
+OBJECT_DECLARE_SIMPLE_TYPE(ISASGAState, SGA)
struct ISASGAState {
ISADevice parent_obj;
diff --git a/hw/misc/slavio_misc.c b/hw/misc/slavio_misc.c
index ab27ad462e..e8eb71570a 100644
--- a/hw/misc/slavio_misc.c
+++ b/hw/misc/slavio_misc.c
@@ -40,9 +40,7 @@
*/
#define TYPE_SLAVIO_MISC "slavio_misc"
-typedef struct MiscState MiscState;
-DECLARE_INSTANCE_CHECKER(MiscState, SLAVIO_MISC,
- TYPE_SLAVIO_MISC)
+OBJECT_DECLARE_SIMPLE_TYPE(MiscState, SLAVIO_MISC)
struct MiscState {
SysBusDevice parent_obj;
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
index 7ee8a496ff..e5198fce80 100644
--- a/hw/misc/tmp105.h
+++ b/hw/misc/tmp105.h
@@ -19,9 +19,7 @@
#include "qom/object.h"
#define TYPE_TMP105 "tmp105"
-typedef struct TMP105State TMP105State;
-DECLARE_INSTANCE_CHECKER(TMP105State, TMP105,
- TYPE_TMP105)
+OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105)
/**
* TMP105State:
diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c
index 212d6e0e83..ef3c682e32 100644
--- a/hw/misc/tmp421.c
+++ b/hw/misc/tmp421.c
@@ -65,17 +65,14 @@ struct TMP421State {
uint8_t pointer;
};
-typedef struct TMP421State TMP421State;
struct TMP421Class {
I2CSlaveClass parent_class;
DeviceInfo *dev;
};
-typedef struct TMP421Class TMP421Class;
#define TYPE_TMP421 "tmp421-generic"
-DECLARE_OBJ_CHECKERS(TMP421State, TMP421Class,
- TMP421, TYPE_TMP421)
+OBJECT_DECLARE_TYPE(TMP421State, TMP421Class, TMP421)
/* the TMP421 registers */
diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c
index bedf09a6f5..a2b28019e3 100644
--- a/hw/misc/zynq_slcr.c
+++ b/hw/misc/zynq_slcr.c
@@ -183,9 +183,7 @@ REG32(DDRIOB, 0xb40)
#define ZYNQ_SLCR_NUM_REGS (ZYNQ_SLCR_MMIO_SIZE / 4)
#define TYPE_ZYNQ_SLCR "xilinx,zynq_slcr"
-typedef struct ZynqSLCRState ZynqSLCRState;
-DECLARE_INSTANCE_CHECKER(ZynqSLCRState, ZYNQ_SLCR,
- TYPE_ZYNQ_SLCR)
+OBJECT_DECLARE_SIMPLE_TYPE(ZynqSLCRState, ZYNQ_SLCR)
struct ZynqSLCRState {
SysBusDevice parent_obj;
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 56b96e9b0f..674b04b354 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -151,9 +151,7 @@ do { printf("sonic ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0)
#define SONIC_DESC_ADDR 0xFFFE
#define TYPE_DP8393X "dp8393x"
-typedef struct dp8393xState dp8393xState;
-DECLARE_INSTANCE_CHECKER(dp8393xState, DP8393X,
- TYPE_DP8393X)
+OBJECT_DECLARE_SIMPLE_TYPE(dp8393xState, DP8393X)
struct dp8393xState {
SysBusDevice parent_obj;
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index 938d44f198..b6f1ae3c8f 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -56,9 +56,7 @@
#include "qom/object.h"
#define TYPE_E1000E "e1000e"
-typedef struct E1000EState E1000EState;
-DECLARE_INSTANCE_CHECKER(E1000EState, E1000E,
- TYPE_E1000E)
+OBJECT_DECLARE_SIMPLE_TYPE(E1000EState, E1000E)
struct E1000EState {
PCIDevice parent_obj;
diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index 36d898ad16..1b82aec794 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -324,9 +324,7 @@ static void mdio_cycle(struct qemu_mdio *bus)
#define FS_ETH_MAX_REGS 0x17
#define TYPE_ETRAX_FS_ETH "etraxfs-eth"
-typedef struct ETRAXFSEthState ETRAXFSEthState;
-DECLARE_INSTANCE_CHECKER(ETRAXFSEthState, ETRAX_FS_ETH,
- TYPE_ETRAX_FS_ETH)
+OBJECT_DECLARE_SIMPLE_TYPE(ETRAXFSEthState, ETRAX_FS_ETH)
struct ETRAXFSEthState {
SysBusDevice parent_obj;
diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h
index 0c929d9afd..fddf551544 100644
--- a/hw/net/fsl_etsec/etsec.h
+++ b/hw/net/fsl_etsec/etsec.h
@@ -150,8 +150,7 @@ struct eTSEC {
typedef struct eTSEC eTSEC;
#define TYPE_ETSEC_COMMON "eTSEC"
-DECLARE_INSTANCE_CHECKER(eTSEC, ETSEC_COMMON,
- TYPE_ETSEC_COMMON)
+OBJECT_DECLARE_SIMPLE_TYPE(eTSEC, ETSEC_COMMON)
#define eTSEC_TRANSMIT 1
#define eTSEC_RECEIVE 2
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 57a59accd0..ab57c02c8e 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -181,9 +181,7 @@ static const VMStateDescription vmstate_lan9118_packet = {
}
};
-typedef struct lan9118_state lan9118_state;
-DECLARE_INSTANCE_CHECKER(lan9118_state, LAN9118,
- TYPE_LAN9118)
+OBJECT_DECLARE_SIMPLE_TYPE(lan9118_state, LAN9118)
struct lan9118_state {
SysBusDevice parent_obj;
diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
index 41a8543edf..78c20c94e5 100644
--- a/hw/net/milkymist-minimac2.c
+++ b/hw/net/milkymist-minimac2.c
@@ -99,9 +99,7 @@ struct MilkymistMinimac2MdioState {
typedef struct MilkymistMinimac2MdioState MilkymistMinimac2MdioState;
#define TYPE_MILKYMIST_MINIMAC2 "milkymist-minimac2"
-typedef struct MilkymistMinimac2State MilkymistMinimac2State;
-DECLARE_INSTANCE_CHECKER(MilkymistMinimac2State, MILKYMIST_MINIMAC2,
- TYPE_MILKYMIST_MINIMAC2)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistMinimac2State, MILKYMIST_MINIMAC2)
struct MilkymistMinimac2State {
SysBusDevice parent_obj;
diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
index 61dbd575da..2ade72dea0 100644
--- a/hw/net/mipsnet.c
+++ b/hw/net/mipsnet.c
@@ -25,9 +25,7 @@
#define MAX_ETH_FRAME_SIZE 1514
#define TYPE_MIPS_NET "mipsnet"
-typedef struct MIPSnetState MIPSnetState;
-DECLARE_INSTANCE_CHECKER(MIPSnetState, MIPS_NET,
- TYPE_MIPS_NET)
+OBJECT_DECLARE_SIMPLE_TYPE(MIPSnetState, MIPS_NET)
struct MIPSnetState {
SysBusDevice parent_obj;
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index 688a0cc4f6..dd6f6e34d3 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -33,9 +33,7 @@
#include "qemu/module.h"
#include "qom/object.h"
-typedef struct ISANE2000State ISANE2000State;
-DECLARE_INSTANCE_CHECKER(ISANE2000State, ISA_NE2000,
- TYPE_ISA_NE2000)
+OBJECT_DECLARE_SIMPLE_TYPE(ISANE2000State, ISA_NE2000)
struct ISANE2000State {
ISADevice parent_obj;
diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 5cd204c30c..0b3dc3146e 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -272,9 +272,7 @@ typedef struct desc {
#define DEFAULT_PHY 1
#define TYPE_OPEN_ETH "open_eth"
-typedef struct OpenEthState OpenEthState;
-DECLARE_INSTANCE_CHECKER(OpenEthState, OPEN_ETH,
- TYPE_OPEN_ETH)
+OBJECT_DECLARE_SIMPLE_TYPE(OpenEthState, OPEN_ETH)
struct OpenEthState {
SysBusDevice parent_obj;
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 449970bc52..ccc3fce2a0 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -52,9 +52,7 @@
#define TYPE_PCI_PCNET "pcnet"
-typedef struct PCIPCNetState PCIPCNetState;
-DECLARE_INSTANCE_CHECKER(PCIPCNetState, PCI_PCNET,
- TYPE_PCI_PCNET)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIPCNetState, PCI_PCNET)
struct PCIPCNetState {
/*< private >*/
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 9246388f58..ba5ace1ab7 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -94,9 +94,7 @@ static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...)
#define TYPE_RTL8139 "rtl8139"
-typedef struct RTL8139State RTL8139State;
-DECLARE_INSTANCE_CHECKER(RTL8139State, RTL8139,
- TYPE_RTL8139)
+OBJECT_DECLARE_SIMPLE_TYPE(RTL8139State, RTL8139)
/* Symbolic offsets to registers. */
enum RTL8139_registers {
diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
index 9fad904321..ad778cd8fc 100644
--- a/hw/net/smc91c111.c
+++ b/hw/net/smc91c111.c
@@ -25,9 +25,7 @@
#define NUM_PACKETS 4
#define TYPE_SMC91C111 "smc91c111"
-typedef struct smc91c111_state smc91c111_state;
-DECLARE_INSTANCE_CHECKER(smc91c111_state, SMC91C111,
- TYPE_SMC91C111)
+OBJECT_DECLARE_SIMPLE_TYPE(smc91c111_state, SMC91C111)
struct smc91c111_state {
SysBusDevice parent_obj;
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index d34cb29607..2093f1bad0 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -85,9 +85,7 @@ typedef uint64_t vlan_bd_t;
#define VLAN_MAX_BUFS (VLAN_RX_BDS_LEN / 8)
#define TYPE_VIO_SPAPR_VLAN_DEVICE "spapr-vlan"
-typedef struct SpaprVioVlan SpaprVioVlan;
-DECLARE_INSTANCE_CHECKER(SpaprVioVlan, VIO_SPAPR_VLAN_DEVICE,
- TYPE_VIO_SPAPR_VLAN_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(SpaprVioVlan, VIO_SPAPR_VLAN_DEVICE)
#define RX_POOL_MAX_BDS 4096
#define RX_MAX_POOLS 5
diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
index 9f13afa4e4..8dd60783d8 100644
--- a/hw/net/stellaris_enet.c
+++ b/hw/net/stellaris_enet.c
@@ -51,9 +51,7 @@ do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__);} while (0)
#define SE_TCTL_DUPLEX 0x08
#define TYPE_STELLARIS_ENET "stellaris_enet"
-typedef struct stellaris_enet_state stellaris_enet_state;
-DECLARE_INSTANCE_CHECKER(stellaris_enet_state, STELLARIS_ENET,
- TYPE_STELLARIS_ENET)
+OBJECT_DECLARE_SIMPLE_TYPE(stellaris_enet_state, STELLARIS_ENET)
typedef struct {
uint8_t data[2048];
diff --git a/hw/net/sungem.c b/hw/net/sungem.c
index 91753830a7..33c3722df6 100644
--- a/hw/net/sungem.c
+++ b/hw/net/sungem.c
@@ -23,9 +23,7 @@
#define TYPE_SUNGEM "sungem"
-typedef struct SunGEMState SunGEMState;
-DECLARE_INSTANCE_CHECKER(SunGEMState, SUNGEM,
- TYPE_SUNGEM)
+OBJECT_DECLARE_SIMPLE_TYPE(SunGEMState, SUNGEM)
#define MAX_PACKET_SIZE 9016
diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c
index 7364ba1019..fc34905f87 100644
--- a/hw/net/sunhme.c
+++ b/hw/net/sunhme.c
@@ -130,9 +130,7 @@
#define MII_COMMAND_WRITE 0x1
#define TYPE_SUNHME "sunhme"
-typedef struct SunHMEState SunHMEState;
-DECLARE_INSTANCE_CHECKER(SunHMEState, SUNHME,
- TYPE_SUNHME)
+OBJECT_DECLARE_SIMPLE_TYPE(SunHMEState, SUNHME)
/* Maximum size of buffer */
#define HME_FIFO_SIZE 0x800
diff --git a/hw/net/tulip.h b/hw/net/tulip.h
index 87e3ab79bc..ffd1f88d57 100644
--- a/hw/net/tulip.h
+++ b/hw/net/tulip.h
@@ -6,9 +6,7 @@
#include "qom/object.h"
#define TYPE_TULIP "tulip"
-typedef struct TULIPState TULIPState;
-DECLARE_INSTANCE_CHECKER(TULIPState, TULIP,
- TYPE_TULIP)
+OBJECT_DECLARE_SIMPLE_TYPE(TULIPState, TULIP)
#define CSR(_x) ((_x) << 3)
diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c
index a066550023..00859a7d50 100644
--- a/hw/net/xgmac.c
+++ b/hw/net/xgmac.c
@@ -140,9 +140,7 @@ typedef struct RxTxStats {
} RxTxStats;
#define TYPE_XGMAC "xgmac"
-typedef struct XgmacState XgmacState;
-DECLARE_INSTANCE_CHECKER(XgmacState, XGMAC,
- TYPE_XGMAC)
+OBJECT_DECLARE_SIMPLE_TYPE(XgmacState, XGMAC)
struct XgmacState {
SysBusDevice parent_obj;
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
index 4e13786e50..f8cf5290e1 100644
--- a/hw/net/xilinx_axienet.c
+++ b/hw/net/xilinx_axienet.c
@@ -43,9 +43,7 @@
#define TYPE_XILINX_AXI_ENET_DATA_STREAM "xilinx-axienet-data-stream"
#define TYPE_XILINX_AXI_ENET_CONTROL_STREAM "xilinx-axienet-control-stream"
-typedef struct XilinxAXIEnet XilinxAXIEnet;
-DECLARE_INSTANCE_CHECKER(XilinxAXIEnet, XILINX_AXI_ENET,
- TYPE_XILINX_AXI_ENET)
+OBJECT_DECLARE_SIMPLE_TYPE(XilinxAXIEnet, XILINX_AXI_ENET)
typedef struct XilinxAXIEnetStreamSlave XilinxAXIEnetStreamSlave;
DECLARE_INSTANCE_CHECKER(XilinxAXIEnetStreamSlave, XILINX_AXI_ENET_DATA_STREAM,
diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c
index 44fb7a94d3..3660a47c51 100644
--- a/hw/nvram/ds1225y.c
+++ b/hw/nvram/ds1225y.c
@@ -110,9 +110,7 @@ static const VMStateDescription vmstate_nvram = {
};
#define TYPE_DS1225Y "ds1225y"
-typedef struct SysBusNvRamState SysBusNvRamState;
-DECLARE_INSTANCE_CHECKER(SysBusNvRamState, DS1225Y,
- TYPE_DS1225Y)
+OBJECT_DECLARE_SIMPLE_TYPE(SysBusNvRamState, DS1225Y)
struct SysBusNvRamState {
SysBusDevice parent_obj;
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index f3a4728288..0e95d057fd 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1056,7 +1056,7 @@ bool fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
return false;
}
size = array->len;
- fw_cfg_add_file(s, filename, g_byte_array_free(array, TRUE), size);
+ fw_cfg_add_file(s, filename, g_byte_array_free(array, FALSE), size);
return true;
}
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
index 57ccc174f2..fc53a42572 100644
--- a/hw/nvram/spapr_nvram.c
+++ b/hw/nvram/spapr_nvram.c
@@ -48,11 +48,9 @@ struct SpaprNvram {
BlockBackend *blk;
VMChangeStateEntry *vmstate;
};
-typedef struct SpaprNvram SpaprNvram;
#define TYPE_VIO_SPAPR_NVRAM "spapr-nvram"
-DECLARE_INSTANCE_CHECKER(SpaprNvram, VIO_SPAPR_NVRAM,
- TYPE_VIO_SPAPR_NVRAM)
+OBJECT_DECLARE_SIMPLE_TYPE(SpaprNvram, VIO_SPAPR_NVRAM)
#define MIN_NVRAM_SIZE (8 * KiB)
#define DEFAULT_NVRAM_SIZE (64 * KiB)
diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index e88998d88c..4773d07e6d 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -34,9 +34,7 @@
#include "hw/pci/pci_bus.h"
#include "qom/object.h"
-typedef struct DECState DECState;
-DECLARE_INSTANCE_CHECKER(DECState, DEC_21154,
- TYPE_DEC_21154)
+OBJECT_DECLARE_SIMPLE_TYPE(DECState, DEC_21154)
struct DECState {
PCIHostState parent_obj;
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index 67c71d566b..8931afc049 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -20,9 +20,7 @@
#include "qom/object.h"
#define TYPE_GEN_PCIE_ROOT_PORT "pcie-root-port"
-typedef struct GenPCIERootPort GenPCIERootPort;
-DECLARE_INSTANCE_CHECKER(GenPCIERootPort, GEN_PCIE_ROOT_PORT,
- TYPE_GEN_PCIE_ROOT_PORT)
+OBJECT_DECLARE_SIMPLE_TYPE(GenPCIERootPort, GEN_PCIE_ROOT_PORT)
#define GEN_PCIE_ROOT_PORT_AER_OFFSET 0x100
#define GEN_PCIE_ROOT_PORT_ACS_OFFSET \
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index b86d76caf3..657a06ddbe 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -35,9 +35,7 @@
#define TYPE_PCI_BRIDGE_DEV "pci-bridge"
#define TYPE_PCI_BRIDGE_SEAT_DEV "pci-bridge-seat"
-typedef struct PCIBridgeDev PCIBridgeDev;
-DECLARE_INSTANCE_CHECKER(PCIBridgeDev, PCI_BRIDGE_DEV,
- TYPE_PCI_BRIDGE_DEV)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIBridgeDev, PCI_BRIDGE_DEV)
struct PCIBridgeDev {
/*< private >*/
diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c
index abc98f8cd9..1cd917a459 100644
--- a/hw/pci-bridge/pcie_pci_bridge.c
+++ b/hw/pci-bridge/pcie_pci_bridge.c
@@ -27,11 +27,9 @@ struct PCIEPCIBridge {
MemoryRegion shpc_bar;
/*< public >*/
};
-typedef struct PCIEPCIBridge PCIEPCIBridge;
#define TYPE_PCIE_PCI_BRIDGE_DEV "pcie-pci-bridge"
-DECLARE_INSTANCE_CHECKER(PCIEPCIBridge, PCIE_PCI_BRIDGE_DEV,
- TYPE_PCIE_PCI_BRIDGE_DEV)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIEPCIBridge, PCIE_PCI_BRIDGE_DEV)
static void pcie_pci_bridge_realize(PCIDevice *d, Error **errp)
{
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index d10fbd39d3..a99eced065 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -240,12 +240,10 @@ struct BonitoState {
};
#define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost"
-DECLARE_INSTANCE_CHECKER(BonitoState, BONITO_PCI_HOST_BRIDGE,
- TYPE_BONITO_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(BonitoState, BONITO_PCI_HOST_BRIDGE)
#define TYPE_PCI_BONITO "Bonito"
-DECLARE_INSTANCE_CHECKER(PCIBonitoState, PCI_BONITO,
- TYPE_PCI_BONITO)
+OBJECT_DECLARE_SIMPLE_TYPE(PCIBonitoState, PCI_BONITO)
static void bonito_writel(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index fd7d6dcc06..57c29b20af 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -35,9 +35,7 @@
#include "trace.h"
#include "qom/object.h"
-typedef struct GrackleState GrackleState;
-DECLARE_INSTANCE_CHECKER(GrackleState, GRACKLE_PCI_HOST_BRIDGE,
- TYPE_GRACKLE_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(GrackleState, GRACKLE_PCI_HOST_BRIDGE)
struct GrackleState {
PCIHostState parent_obj;
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 93c62235ca..aecbcc2446 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -42,9 +42,7 @@
* https://wiki.qemu.org/File:29054901.pdf
*/
-typedef struct I440FXState I440FXState;
-DECLARE_INSTANCE_CHECKER(I440FXState, I440FX_PCI_HOST_BRIDGE,
- TYPE_I440FX_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(I440FXState, I440FX_PCI_HOST_BRIDGE)
struct I440FXState {
PCIHostState parent_obj;
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index f376374e24..9517aab913 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -92,9 +92,7 @@ struct pci_inbound {
#define TYPE_PPC_E500_PCI_HOST_BRIDGE "e500-pcihost"
-typedef struct PPCE500PCIState PPCE500PCIState;
-DECLARE_INSTANCE_CHECKER(PPCE500PCIState, PPC_E500_PCI_HOST_BRIDGE,
- TYPE_PPC_E500_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(PPCE500PCIState, PPC_E500_PCI_HOST_BRIDGE)
struct PPCE500PCIState {
PCIHostState parent_obj;
@@ -116,9 +114,7 @@ struct PPCE500PCIState {
};
#define TYPE_PPC_E500_PCI_BRIDGE "e500-host-bridge"
-typedef struct PPCE500PCIBridgeState PPCE500PCIBridgeState;
-DECLARE_INSTANCE_CHECKER(PPCE500PCIBridgeState, PPC_E500_PCI_BRIDGE,
- TYPE_PPC_E500_PCI_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(PPCE500PCIBridgeState, PPC_E500_PCI_BRIDGE)
struct PPCE500PCIBridgeState {
/*< private >*/
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index b234fd7c8a..d0323fefb1 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -43,9 +43,7 @@
#define TYPE_RAVEN_PCI_DEVICE "raven"
#define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
-typedef struct RavenPCIState RavenPCIState;
-DECLARE_INSTANCE_CHECKER(RavenPCIState, RAVEN_PCI_DEVICE,
- TYPE_RAVEN_PCI_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(RavenPCIState, RAVEN_PCI_DEVICE)
struct RavenPCIState {
PCIDevice dev;
diff --git a/hw/ppc/e500-ccsr.h b/hw/ppc/e500-ccsr.h
index de4b9d2bc3..249c17be3b 100644
--- a/hw/ppc/e500-ccsr.h
+++ b/hw/ppc/e500-ccsr.h
@@ -11,10 +11,8 @@ struct PPCE500CCSRState {
MemoryRegion ccsr_space;
};
-typedef struct PPCE500CCSRState PPCE500CCSRState;
#define TYPE_CCSR "e500-ccsr"
-DECLARE_INSTANCE_CHECKER(PPCE500CCSRState, CCSR,
- TYPE_CCSR)
+OBJECT_DECLARE_SIMPLE_TYPE(PPCE500CCSRState, CCSR)
#endif /* E500_CCSR_H */
diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h
index 63870751ff..1e5853b032 100644
--- a/hw/ppc/e500.h
+++ b/hw/ppc/e500.h
@@ -14,7 +14,6 @@ struct PPCE500MachineState {
*/
PlatformBusDevice *pbus_dev;
};
-typedef struct PPCE500MachineState PPCE500MachineState;
struct PPCE500MachineClass {
/*< private >*/
@@ -39,14 +38,12 @@ struct PPCE500MachineClass {
hwaddr pci_mmio_bus_base;
hwaddr spin_base;
};
-typedef struct PPCE500MachineClass PPCE500MachineClass;
void ppce500_init(MachineState *machine);
hwaddr booke206_page_size_to_tlb(uint64_t size);
#define TYPE_PPCE500_MACHINE "ppce500-base-machine"
-DECLARE_OBJ_CHECKERS(PPCE500MachineState, PPCE500MachineClass,
- PPCE500_MACHINE, TYPE_PPCE500_MACHINE)
+OBJECT_DECLARE_TYPE(PPCE500MachineState, PPCE500MachineClass, PPCE500_MACHINE)
#endif
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 2b6425f600..f3976b9a45 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -92,9 +92,7 @@ struct Core99MachineState {
/* Mac NVRAM */
#define TYPE_MACIO_NVRAM "macio-nvram"
-typedef struct MacIONVRAMState MacIONVRAMState;
-DECLARE_INSTANCE_CHECKER(MacIONVRAMState, MACIO_NVRAM,
- TYPE_MACIO_NVRAM)
+OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM)
struct MacIONVRAMState {
/*< private >*/
diff --git a/hw/ppc/mpc8544_guts.c b/hw/ppc/mpc8544_guts.c
index b76b5e4701..e8d2d51c20 100644
--- a/hw/ppc/mpc8544_guts.c
+++ b/hw/ppc/mpc8544_guts.c
@@ -55,9 +55,7 @@
#define MPC8544_GUTS_ADDR_SRDS2CR3 0xF18
#define TYPE_MPC8544_GUTS "mpc8544-guts"
-typedef struct GutsState GutsState;
-DECLARE_INSTANCE_CHECKER(GutsState, MPC8544_GUTS,
- TYPE_MPC8544_GUTS)
+OBJECT_DECLARE_SIMPLE_TYPE(GutsState, MPC8544_GUTS)
struct GutsState {
/*< private >*/
diff --git a/hw/ppc/ppc440_pcix.c b/hw/ppc/ppc440_pcix.c
index a564fcd600..ee952314c8 100644
--- a/hw/ppc/ppc440_pcix.c
+++ b/hw/ppc/ppc440_pcix.c
@@ -46,9 +46,7 @@ struct PLBInMap {
};
#define TYPE_PPC440_PCIX_HOST_BRIDGE "ppc440-pcix-host"
-typedef struct PPC440PCIXState PPC440PCIXState;
-DECLARE_INSTANCE_CHECKER(PPC440PCIXState, PPC440_PCIX_HOST_BRIDGE,
- TYPE_PPC440_PCIX_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(PPC440PCIXState, PPC440_PCIX_HOST_BRIDGE)
#define PPC440_PCIX_NR_POMS 3
#define PPC440_PCIX_NR_PIMS 3
diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c
index d9ca6bba9b..f6f89058ab 100644
--- a/hw/ppc/ppc440_uc.c
+++ b/hw/ppc/ppc440_uc.c
@@ -1033,9 +1033,7 @@ void ppc4xx_dma_init(CPUPPCState *env, int dcr_base)
#include "hw/pci/pcie_host.h"
#define TYPE_PPC460EX_PCIE_HOST "ppc460ex-pcie-host"
-typedef struct PPC460EXPCIEState PPC460EXPCIEState;
-DECLARE_INSTANCE_CHECKER(PPC460EXPCIEState, PPC460EX_PCIE_HOST,
- TYPE_PPC460EX_PCIE_HOST)
+OBJECT_DECLARE_SIMPLE_TYPE(PPC460EXPCIEState, PPC460EX_PCIE_HOST)
struct PPC460EXPCIEState {
PCIExpressHost host;
diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
index ca2553bf8b..28724c06f8 100644
--- a/hw/ppc/ppc4xx_pci.c
+++ b/hw/ppc/ppc4xx_pci.c
@@ -44,9 +44,7 @@ struct PCITargetMap {
uint32_t la;
};
-typedef struct PPC4xxPCIState PPC4xxPCIState;
-DECLARE_INSTANCE_CHECKER(PPC4xxPCIState, PPC4xx_PCI_HOST_BRIDGE,
- TYPE_PPC4xx_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(PPC4xxPCIState, PPC4xx_PCI_HOST_BRIDGE)
#define PPC4xx_PCI_NR_PMMS 3
#define PPC4xx_PCI_NR_PTMS 2
diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c
index cd8000ad73..25c9ce745f 100644
--- a/hw/ppc/ppce500_spin.c
+++ b/hw/ppc/ppce500_spin.c
@@ -47,9 +47,7 @@ typedef struct spin_info {
} QEMU_PACKED SpinInfo;
#define TYPE_E500_SPIN "e500-spin"
-typedef struct SpinState SpinState;
-DECLARE_INSTANCE_CHECKER(SpinState, E500_SPIN,
- TYPE_E500_SPIN)
+OBJECT_DECLARE_SIMPLE_TYPE(SpinState, E500_SPIN)
struct SpinState {
SysBusDevice parent_obj;
diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
index d1e2fb3f8b..4e48ef245c 100644
--- a/hw/ppc/prep_systemio.c
+++ b/hw/ppc/prep_systemio.c
@@ -36,9 +36,7 @@
#include "trace.h"
#define TYPE_PREP_SYSTEMIO "prep-systemio"
-typedef struct PrepSystemIoState PrepSystemIoState;
-DECLARE_INSTANCE_CHECKER(PrepSystemIoState, PREP_SYSTEMIO,
- TYPE_PREP_SYSTEMIO)
+OBJECT_DECLARE_SIMPLE_TYPE(PrepSystemIoState, PREP_SYSTEMIO)
/* Bit as defined in PowerPC Reference Plaform v1.1, sect. 6.1.5, p. 132 */
#define PREP_BIT(n) (1 << (7 - (n)))
diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c
index 8611ffa96d..4db5b51a2d 100644
--- a/hw/ppc/rs6000_mc.c
+++ b/hw/ppc/rs6000_mc.c
@@ -29,9 +29,7 @@
#include "qom/object.h"
#define TYPE_RS6000MC "rs6000-mc"
-typedef struct RS6000MCState RS6000MCState;
-DECLARE_INSTANCE_CHECKER(RS6000MCState, RS6000MC,
- TYPE_RS6000MC)
+OBJECT_DECLARE_SIMPLE_TYPE(RS6000MCState, RS6000MC)
struct RS6000MCState {
ISADevice parent_obj;
diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c
index 6c99633faa..d14800e9de 100644
--- a/hw/ppc/spapr_rng.c
+++ b/hw/ppc/spapr_rng.c
@@ -30,9 +30,7 @@
#include "kvm_ppc.h"
#include "qom/object.h"
-typedef struct SpaprRngState SpaprRngState;
-DECLARE_INSTANCE_CHECKER(SpaprRngState, SPAPR_RNG,
- TYPE_SPAPR_RNG)
+OBJECT_DECLARE_SIMPLE_TYPE(SpaprRngState, SPAPR_RNG)
struct SpaprRngState {
/*< private >*/
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 40bbf530d4..759059cd7b 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -54,25 +54,25 @@ static const struct MemmapEntry {
hwaddr base;
hwaddr size;
} sifive_e_memmap[] = {
- [SIFIVE_E_DEBUG] = { 0x0, 0x1000 },
- [SIFIVE_E_MROM] = { 0x1000, 0x2000 },
- [SIFIVE_E_OTP] = { 0x20000, 0x2000 },
- [SIFIVE_E_CLINT] = { 0x2000000, 0x10000 },
- [SIFIVE_E_PLIC] = { 0xc000000, 0x4000000 },
- [SIFIVE_E_AON] = { 0x10000000, 0x8000 },
- [SIFIVE_E_PRCI] = { 0x10008000, 0x8000 },
- [SIFIVE_E_OTP_CTRL] = { 0x10010000, 0x1000 },
- [SIFIVE_E_GPIO0] = { 0x10012000, 0x1000 },
- [SIFIVE_E_UART0] = { 0x10013000, 0x1000 },
- [SIFIVE_E_QSPI0] = { 0x10014000, 0x1000 },
- [SIFIVE_E_PWM0] = { 0x10015000, 0x1000 },
- [SIFIVE_E_UART1] = { 0x10023000, 0x1000 },
- [SIFIVE_E_QSPI1] = { 0x10024000, 0x1000 },
- [SIFIVE_E_PWM1] = { 0x10025000, 0x1000 },
- [SIFIVE_E_QSPI2] = { 0x10034000, 0x1000 },
- [SIFIVE_E_PWM2] = { 0x10035000, 0x1000 },
- [SIFIVE_E_XIP] = { 0x20000000, 0x20000000 },
- [SIFIVE_E_DTIM] = { 0x80000000, 0x4000 }
+ [SIFIVE_E_DEV_DEBUG] = { 0x0, 0x1000 },
+ [SIFIVE_E_DEV_MROM] = { 0x1000, 0x2000 },
+ [SIFIVE_E_DEV_OTP] = { 0x20000, 0x2000 },
+ [SIFIVE_E_DEV_CLINT] = { 0x2000000, 0x10000 },
+ [SIFIVE_E_DEV_PLIC] = { 0xc000000, 0x4000000 },
+ [SIFIVE_E_DEV_AON] = { 0x10000000, 0x8000 },
+ [SIFIVE_E_DEV_PRCI] = { 0x10008000, 0x8000 },
+ [SIFIVE_E_DEV_OTP_CTRL] = { 0x10010000, 0x1000 },
+ [SIFIVE_E_DEV_GPIO0] = { 0x10012000, 0x1000 },
+ [SIFIVE_E_DEV_UART0] = { 0x10013000, 0x1000 },
+ [SIFIVE_E_DEV_QSPI0] = { 0x10014000, 0x1000 },
+ [SIFIVE_E_DEV_PWM0] = { 0x10015000, 0x1000 },
+ [SIFIVE_E_DEV_UART1] = { 0x10023000, 0x1000 },
+ [SIFIVE_E_DEV_QSPI1] = { 0x10024000, 0x1000 },
+ [SIFIVE_E_DEV_PWM1] = { 0x10025000, 0x1000 },
+ [SIFIVE_E_DEV_QSPI2] = { 0x10034000, 0x1000 },
+ [SIFIVE_E_DEV_PWM2] = { 0x10035000, 0x1000 },
+ [SIFIVE_E_DEV_XIP] = { 0x20000000, 0x20000000 },
+ [SIFIVE_E_DEV_DTIM] = { 0x80000000, 0x4000 }
};
static void sifive_e_machine_init(MachineState *machine)
@@ -90,9 +90,9 @@ static void sifive_e_machine_init(MachineState *machine)
/* Data Tightly Integrated Memory */
memory_region_init_ram(main_mem, NULL, "riscv.sifive.e.ram",
- memmap[SIFIVE_E_DTIM].size, &error_fatal);
+ memmap[SIFIVE_E_DEV_DTIM].size, &error_fatal);
memory_region_add_subregion(sys_mem,
- memmap[SIFIVE_E_DTIM].base, main_mem);
+ memmap[SIFIVE_E_DEV_DTIM].base, main_mem);
/* Mask ROM reset vector */
uint32_t reset_vec[4];
@@ -111,7 +111,7 @@ static void sifive_e_machine_init(MachineState *machine)
reset_vec[i] = cpu_to_le32(reset_vec[i]);
}
rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec),
- memmap[SIFIVE_E_MROM].base, &address_space_memory);
+ memmap[SIFIVE_E_DEV_MROM].base, &address_space_memory);
if (machine->kernel_filename) {
riscv_load_kernel(machine->kernel_filename, NULL);
@@ -195,12 +195,12 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp)
/* Mask ROM */
memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom",
- memmap[SIFIVE_E_MROM].size, &error_fatal);
+ memmap[SIFIVE_E_DEV_MROM].size, &error_fatal);
memory_region_add_subregion(sys_mem,
- memmap[SIFIVE_E_MROM].base, &s->mask_rom);
+ memmap[SIFIVE_E_DEV_MROM].base, &s->mask_rom);
/* MMIO */
- s->plic = sifive_plic_create(memmap[SIFIVE_E_PLIC].base,
+ s->plic = sifive_plic_create(memmap[SIFIVE_E_DEV_PLIC].base,
(char *)SIFIVE_E_PLIC_HART_CONFIG, 0,
SIFIVE_E_PLIC_NUM_SOURCES,
SIFIVE_E_PLIC_NUM_PRIORITIES,
@@ -210,14 +210,14 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp)
SIFIVE_E_PLIC_ENABLE_STRIDE,
SIFIVE_E_PLIC_CONTEXT_BASE,
SIFIVE_E_PLIC_CONTEXT_STRIDE,
- memmap[SIFIVE_E_PLIC].size);
- sifive_clint_create(memmap[SIFIVE_E_CLINT].base,
- memmap[SIFIVE_E_CLINT].size, 0, ms->smp.cpus,
+ memmap[SIFIVE_E_DEV_PLIC].size);
+ sifive_clint_create(memmap[SIFIVE_E_DEV_CLINT].base,
+ memmap[SIFIVE_E_DEV_CLINT].size, 0, ms->smp.cpus,
SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE,
SIFIVE_CLINT_TIMEBASE_FREQ, false);
create_unimplemented_device("riscv.sifive.e.aon",
- memmap[SIFIVE_E_AON].base, memmap[SIFIVE_E_AON].size);
- sifive_e_prci_create(memmap[SIFIVE_E_PRCI].base);
+ memmap[SIFIVE_E_DEV_AON].base, memmap[SIFIVE_E_DEV_AON].size);
+ sifive_e_prci_create(memmap[SIFIVE_E_DEV_PRCI].base);
/* GPIO */
@@ -226,7 +226,7 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp)
}
/* Map GPIO registers */
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_E_GPIO0].base);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_E_DEV_GPIO0].base);
/* Pass all GPIOs to the SOC layer so they are available to the board */
qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL);
@@ -238,27 +238,27 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp)
SIFIVE_E_GPIO0_IRQ0 + i));
}
- sifive_uart_create(sys_mem, memmap[SIFIVE_E_UART0].base,
+ sifive_uart_create(sys_mem, memmap[SIFIVE_E_DEV_UART0].base,
serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART0_IRQ));
create_unimplemented_device("riscv.sifive.e.qspi0",
- memmap[SIFIVE_E_QSPI0].base, memmap[SIFIVE_E_QSPI0].size);
+ memmap[SIFIVE_E_DEV_QSPI0].base, memmap[SIFIVE_E_DEV_QSPI0].size);
create_unimplemented_device("riscv.sifive.e.pwm0",
- memmap[SIFIVE_E_PWM0].base, memmap[SIFIVE_E_PWM0].size);
- sifive_uart_create(sys_mem, memmap[SIFIVE_E_UART1].base,
+ memmap[SIFIVE_E_DEV_PWM0].base, memmap[SIFIVE_E_DEV_PWM0].size);
+ sifive_uart_create(sys_mem, memmap[SIFIVE_E_DEV_UART1].base,
serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART1_IRQ));
create_unimplemented_device("riscv.sifive.e.qspi1",
- memmap[SIFIVE_E_QSPI1].base, memmap[SIFIVE_E_QSPI1].size);
+ memmap[SIFIVE_E_DEV_QSPI1].base, memmap[SIFIVE_E_DEV_QSPI1].size);
create_unimplemented_device("riscv.sifive.e.pwm1",
- memmap[SIFIVE_E_PWM1].base, memmap[SIFIVE_E_PWM1].size);
+ memmap[SIFIVE_E_DEV_PWM1].base, memmap[SIFIVE_E_DEV_PWM1].size);
create_unimplemented_device("riscv.sifive.e.qspi2",
- memmap[SIFIVE_E_QSPI2].base, memmap[SIFIVE_E_QSPI2].size);
+ memmap[SIFIVE_E_DEV_QSPI2].base, memmap[SIFIVE_E_DEV_QSPI2].size);
create_unimplemented_device("riscv.sifive.e.pwm2",
- memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size);
+ memmap[SIFIVE_E_DEV_PWM2].base, memmap[SIFIVE_E_DEV_PWM2].size);
/* Flash memory */
memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip",
- memmap[SIFIVE_E_XIP].size, &error_fatal);
- memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base,
+ memmap[SIFIVE_E_DEV_XIP].size, &error_fatal);
+ memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_DEV_XIP].base,
&s->xip_mem);
}
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 4f12a93188..a97637fb33 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -70,23 +70,23 @@ static const struct MemmapEntry {
hwaddr base;
hwaddr size;
} sifive_u_memmap[] = {
- [SIFIVE_U_DEBUG] = { 0x0, 0x100 },
- [SIFIVE_U_MROM] = { 0x1000, 0xf000 },
- [SIFIVE_U_CLINT] = { 0x2000000, 0x10000 },
- [SIFIVE_U_L2CC] = { 0x2010000, 0x1000 },
- [SIFIVE_U_PDMA] = { 0x3000000, 0x100000 },
- [SIFIVE_U_L2LIM] = { 0x8000000, 0x2000000 },
- [SIFIVE_U_PLIC] = { 0xc000000, 0x4000000 },
- [SIFIVE_U_PRCI] = { 0x10000000, 0x1000 },
- [SIFIVE_U_UART0] = { 0x10010000, 0x1000 },
- [SIFIVE_U_UART1] = { 0x10011000, 0x1000 },
- [SIFIVE_U_GPIO] = { 0x10060000, 0x1000 },
- [SIFIVE_U_OTP] = { 0x10070000, 0x1000 },
- [SIFIVE_U_GEM] = { 0x10090000, 0x2000 },
- [SIFIVE_U_GEM_MGMT] = { 0x100a0000, 0x1000 },
- [SIFIVE_U_DMC] = { 0x100b0000, 0x10000 },
- [SIFIVE_U_FLASH0] = { 0x20000000, 0x10000000 },
- [SIFIVE_U_DRAM] = { 0x80000000, 0x0 },
+ [SIFIVE_U_DEV_DEBUG] = { 0x0, 0x100 },
+ [SIFIVE_U_DEV_MROM] = { 0x1000, 0xf000 },
+ [SIFIVE_U_DEV_CLINT] = { 0x2000000, 0x10000 },
+ [SIFIVE_U_DEV_L2CC] = { 0x2010000, 0x1000 },
+ [SIFIVE_U_DEV_PDMA] = { 0x3000000, 0x100000 },
+ [SIFIVE_U_DEV_L2LIM] = { 0x8000000, 0x2000000 },
+ [SIFIVE_U_DEV_PLIC] = { 0xc000000, 0x4000000 },
+ [SIFIVE_U_DEV_PRCI] = { 0x10000000, 0x1000 },
+ [SIFIVE_U_DEV_UART0] = { 0x10010000, 0x1000 },
+ [SIFIVE_U_DEV_UART1] = { 0x10011000, 0x1000 },
+ [SIFIVE_U_DEV_GPIO] = { 0x10060000, 0x1000 },
+ [SIFIVE_U_DEV_OTP] = { 0x10070000, 0x1000 },
+ [SIFIVE_U_DEV_GEM] = { 0x10090000, 0x2000 },
+ [SIFIVE_U_DEV_GEM_MGMT] = { 0x100a0000, 0x1000 },
+ [SIFIVE_U_DEV_DMC] = { 0x100b0000, 0x10000 },
+ [SIFIVE_U_DEV_FLASH0] = { 0x20000000, 0x10000000 },
+ [SIFIVE_U_DEV_DRAM] = { 0x80000000, 0x0 },
};
#define OTP_SERIAL 1
@@ -145,10 +145,10 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
g_free(nodename);
nodename = g_strdup_printf("/memory@%lx",
- (long)memmap[SIFIVE_U_DRAM].base);
+ (long)memmap[SIFIVE_U_DEV_DRAM].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- memmap[SIFIVE_U_DRAM].base >> 32, memmap[SIFIVE_U_DRAM].base,
+ memmap[SIFIVE_U_DEV_DRAM].base >> 32, memmap[SIFIVE_U_DEV_DRAM].base,
mem_size >> 32, mem_size);
qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory");
g_free(nodename);
@@ -203,39 +203,39 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
g_free(nodename);
}
nodename = g_strdup_printf("/soc/clint@%lx",
- (long)memmap[SIFIVE_U_CLINT].base);
+ (long)memmap[SIFIVE_U_DEV_CLINT].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv,clint0");
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_CLINT].base,
- 0x0, memmap[SIFIVE_U_CLINT].size);
+ 0x0, memmap[SIFIVE_U_DEV_CLINT].base,
+ 0x0, memmap[SIFIVE_U_DEV_CLINT].size);
qemu_fdt_setprop(fdt, nodename, "interrupts-extended",
cells, ms->smp.cpus * sizeof(uint32_t) * 4);
g_free(cells);
g_free(nodename);
nodename = g_strdup_printf("/soc/otp@%lx",
- (long)memmap[SIFIVE_U_OTP].base);
+ (long)memmap[SIFIVE_U_DEV_OTP].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cell(fdt, nodename, "fuse-count", SIFIVE_U_OTP_REG_SIZE);
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_OTP].base,
- 0x0, memmap[SIFIVE_U_OTP].size);
+ 0x0, memmap[SIFIVE_U_DEV_OTP].base,
+ 0x0, memmap[SIFIVE_U_DEV_OTP].size);
qemu_fdt_setprop_string(fdt, nodename, "compatible",
"sifive,fu540-c000-otp");
g_free(nodename);
prci_phandle = phandle++;
nodename = g_strdup_printf("/soc/clock-controller@%lx",
- (long)memmap[SIFIVE_U_PRCI].base);
+ (long)memmap[SIFIVE_U_DEV_PRCI].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cell(fdt, nodename, "phandle", prci_phandle);
qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x1);
qemu_fdt_setprop_cells(fdt, nodename, "clocks",
hfclk_phandle, rtcclk_phandle);
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_PRCI].base,
- 0x0, memmap[SIFIVE_U_PRCI].size);
+ 0x0, memmap[SIFIVE_U_DEV_PRCI].base,
+ 0x0, memmap[SIFIVE_U_DEV_PRCI].size);
qemu_fdt_setprop_string(fdt, nodename, "compatible",
"sifive,fu540-c000-prci");
g_free(nodename);
@@ -259,7 +259,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
g_free(nodename);
}
nodename = g_strdup_printf("/soc/interrupt-controller@%lx",
- (long)memmap[SIFIVE_U_PLIC].base);
+ (long)memmap[SIFIVE_U_DEV_PLIC].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cell(fdt, nodename, "#interrupt-cells", 1);
qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv,plic0");
@@ -267,8 +267,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
qemu_fdt_setprop(fdt, nodename, "interrupts-extended",
cells, (ms->smp.cpus * 4 - 2) * sizeof(uint32_t));
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_PLIC].base,
- 0x0, memmap[SIFIVE_U_PLIC].size);
+ 0x0, memmap[SIFIVE_U_DEV_PLIC].base,
+ 0x0, memmap[SIFIVE_U_DEV_PLIC].size);
qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", 0x35);
qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle);
plic_phandle = qemu_fdt_get_phandle(fdt, nodename);
@@ -277,7 +277,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
gpio_phandle = phandle++;
nodename = g_strdup_printf("/soc/gpio@%lx",
- (long)memmap[SIFIVE_U_GPIO].base);
+ (long)memmap[SIFIVE_U_DEV_GPIO].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cell(fdt, nodename, "phandle", gpio_phandle);
qemu_fdt_setprop_cells(fdt, nodename, "clocks",
@@ -287,8 +287,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
qemu_fdt_setprop_cell(fdt, nodename, "#gpio-cells", 2);
qemu_fdt_setprop(fdt, nodename, "gpio-controller", NULL, 0);
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_GPIO].base,
- 0x0, memmap[SIFIVE_U_GPIO].size);
+ 0x0, memmap[SIFIVE_U_DEV_GPIO].base,
+ 0x0, memmap[SIFIVE_U_DEV_GPIO].size);
qemu_fdt_setprop_cells(fdt, nodename, "interrupts", SIFIVE_U_GPIO_IRQ0,
SIFIVE_U_GPIO_IRQ1, SIFIVE_U_GPIO_IRQ2, SIFIVE_U_GPIO_IRQ3,
SIFIVE_U_GPIO_IRQ4, SIFIVE_U_GPIO_IRQ5, SIFIVE_U_GPIO_IRQ6,
@@ -306,7 +306,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
g_free(nodename);
nodename = g_strdup_printf("/soc/dma@%lx",
- (long)memmap[SIFIVE_U_PDMA].base);
+ (long)memmap[SIFIVE_U_DEV_PDMA].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cell(fdt, nodename, "#dma-cells", 1);
qemu_fdt_setprop_cells(fdt, nodename, "interrupts",
@@ -315,18 +315,18 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
SIFIVE_U_PDMA_IRQ6, SIFIVE_U_PDMA_IRQ7);
qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle);
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_PDMA].base,
- 0x0, memmap[SIFIVE_U_PDMA].size);
+ 0x0, memmap[SIFIVE_U_DEV_PDMA].base,
+ 0x0, memmap[SIFIVE_U_DEV_PDMA].size);
qemu_fdt_setprop_string(fdt, nodename, "compatible",
"sifive,fu540-c000-pdma");
g_free(nodename);
nodename = g_strdup_printf("/soc/cache-controller@%lx",
- (long)memmap[SIFIVE_U_L2CC].base);
+ (long)memmap[SIFIVE_U_DEV_L2CC].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_L2CC].base,
- 0x0, memmap[SIFIVE_U_L2CC].size);
+ 0x0, memmap[SIFIVE_U_DEV_L2CC].base,
+ 0x0, memmap[SIFIVE_U_DEV_L2CC].size);
qemu_fdt_setprop_cells(fdt, nodename, "interrupts",
SIFIVE_U_L2CC_IRQ0, SIFIVE_U_L2CC_IRQ1, SIFIVE_U_L2CC_IRQ2);
qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle);
@@ -341,15 +341,15 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
phy_phandle = phandle++;
nodename = g_strdup_printf("/soc/ethernet@%lx",
- (long)memmap[SIFIVE_U_GEM].base);
+ (long)memmap[SIFIVE_U_DEV_GEM].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_string(fdt, nodename, "compatible",
"sifive,fu540-c000-gem");
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_GEM].base,
- 0x0, memmap[SIFIVE_U_GEM].size,
- 0x0, memmap[SIFIVE_U_GEM_MGMT].base,
- 0x0, memmap[SIFIVE_U_GEM_MGMT].size);
+ 0x0, memmap[SIFIVE_U_DEV_GEM].base,
+ 0x0, memmap[SIFIVE_U_DEV_GEM].size,
+ 0x0, memmap[SIFIVE_U_DEV_GEM_MGMT].base,
+ 0x0, memmap[SIFIVE_U_DEV_GEM_MGMT].size);
qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control");
qemu_fdt_setprop_string(fdt, nodename, "phy-mode", "gmii");
qemu_fdt_setprop_cell(fdt, nodename, "phy-handle", phy_phandle);
@@ -370,19 +370,19 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
g_free(nodename);
nodename = g_strdup_printf("/soc/ethernet@%lx/ethernet-phy@0",
- (long)memmap[SIFIVE_U_GEM].base);
+ (long)memmap[SIFIVE_U_DEV_GEM].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_cell(fdt, nodename, "phandle", phy_phandle);
qemu_fdt_setprop_cell(fdt, nodename, "reg", 0x0);
g_free(nodename);
nodename = g_strdup_printf("/soc/serial@%lx",
- (long)memmap[SIFIVE_U_UART0].base);
+ (long)memmap[SIFIVE_U_DEV_UART0].base);
qemu_fdt_add_subnode(fdt, nodename);
qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,uart0");
qemu_fdt_setprop_cells(fdt, nodename, "reg",
- 0x0, memmap[SIFIVE_U_UART0].base,
- 0x0, memmap[SIFIVE_U_UART0].size);
+ 0x0, memmap[SIFIVE_U_DEV_UART0].base,
+ 0x0, memmap[SIFIVE_U_DEV_UART0].size);
qemu_fdt_setprop_cells(fdt, nodename, "clocks",
prci_phandle, PRCI_CLK_TLCLK);
qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle);
@@ -414,7 +414,7 @@ static void sifive_u_machine_init(MachineState *machine)
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *main_mem = g_new(MemoryRegion, 1);
MemoryRegion *flash0 = g_new(MemoryRegion, 1);
- target_ulong start_addr = memmap[SIFIVE_U_DRAM].base;
+ target_ulong start_addr = memmap[SIFIVE_U_DEV_DRAM].base;
uint32_t start_addr_hi32 = 0x00000000;
int i;
uint32_t fdt_load_addr;
@@ -429,13 +429,13 @@ static void sifive_u_machine_init(MachineState *machine)
/* register RAM */
memory_region_init_ram(main_mem, NULL, "riscv.sifive.u.ram",
machine->ram_size, &error_fatal);
- memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DRAM].base,
+ memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_DRAM].base,
main_mem);
/* register QSPI0 Flash */
memory_region_init_ram(flash0, NULL, "riscv.sifive.u.flash0",
- memmap[SIFIVE_U_FLASH0].size, &error_fatal);
- memory_region_add_subregion(system_memory, memmap[SIFIVE_U_FLASH0].base,
+ memmap[SIFIVE_U_DEV_FLASH0].size, &error_fatal);
+ memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_FLASH0].base,
flash0);
/* register gpio-restart */
@@ -461,14 +461,14 @@ static void sifive_u_machine_init(MachineState *machine)
switch (s->msel) {
case MSEL_MEMMAP_QSPI0_FLASH:
- start_addr = memmap[SIFIVE_U_FLASH0].base;
+ start_addr = memmap[SIFIVE_U_DEV_FLASH0].base;
break;
case MSEL_L2LIM_QSPI0_FLASH:
case MSEL_L2LIM_QSPI2_SD:
- start_addr = memmap[SIFIVE_U_L2LIM].base;
+ start_addr = memmap[SIFIVE_U_DEV_L2LIM].base;
break;
default:
- start_addr = memmap[SIFIVE_U_DRAM].base;
+ start_addr = memmap[SIFIVE_U_DEV_DRAM].base;
break;
}
@@ -496,7 +496,7 @@ static void sifive_u_machine_init(MachineState *machine)
}
/* Compute the fdt load address in dram */
- fdt_load_addr = riscv_load_fdt(memmap[SIFIVE_U_DRAM].base,
+ fdt_load_addr = riscv_load_fdt(memmap[SIFIVE_U_DEV_DRAM].base,
machine->ram_size, s->fdt);
#if defined(TARGET_RISCV64)
start_addr_hi32 = start_addr >> 32;
@@ -528,10 +528,10 @@ static void sifive_u_machine_init(MachineState *machine)
reset_vec[i] = cpu_to_le32(reset_vec[i]);
}
rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec),
- memmap[SIFIVE_U_MROM].base, &address_space_memory);
+ memmap[SIFIVE_U_DEV_MROM].base, &address_space_memory);
- riscv_rom_copy_firmware_info(memmap[SIFIVE_U_MROM].base,
- memmap[SIFIVE_U_MROM].size,
+ riscv_rom_copy_firmware_info(memmap[SIFIVE_U_DEV_MROM].base,
+ memmap[SIFIVE_U_DEV_MROM].size,
sizeof(reset_vec), kernel_entry);
}
@@ -674,8 +674,8 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
/* boot rom */
memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom",
- memmap[SIFIVE_U_MROM].size, &error_fatal);
- memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base,
+ memmap[SIFIVE_U_DEV_MROM].size, &error_fatal);
+ memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_MROM].base,
mask_rom);
/*
@@ -688,8 +688,8 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
* too generous to misbehaving guests.
*/
memory_region_init_ram(l2lim_mem, NULL, "riscv.sifive.u.l2lim",
- memmap[SIFIVE_U_L2LIM].size, &error_fatal);
- memory_region_add_subregion(system_memory, memmap[SIFIVE_U_L2LIM].base,
+ memmap[SIFIVE_U_DEV_L2LIM].size, &error_fatal);
+ memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_L2LIM].base,
l2lim_mem);
/* create PLIC hart topology configuration string */
@@ -707,7 +707,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
}
/* MMIO */
- s->plic = sifive_plic_create(memmap[SIFIVE_U_PLIC].base,
+ s->plic = sifive_plic_create(memmap[SIFIVE_U_DEV_PLIC].base,
plic_hart_config, 0,
SIFIVE_U_PLIC_NUM_SOURCES,
SIFIVE_U_PLIC_NUM_PRIORITIES,
@@ -717,27 +717,27 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
SIFIVE_U_PLIC_ENABLE_STRIDE,
SIFIVE_U_PLIC_CONTEXT_BASE,
SIFIVE_U_PLIC_CONTEXT_STRIDE,
- memmap[SIFIVE_U_PLIC].size);
+ memmap[SIFIVE_U_DEV_PLIC].size);
g_free(plic_hart_config);
- sifive_uart_create(system_memory, memmap[SIFIVE_U_UART0].base,
+ sifive_uart_create(system_memory, memmap[SIFIVE_U_DEV_UART0].base,
serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART0_IRQ));
- sifive_uart_create(system_memory, memmap[SIFIVE_U_UART1].base,
+ sifive_uart_create(system_memory, memmap[SIFIVE_U_DEV_UART1].base,
serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART1_IRQ));
- sifive_clint_create(memmap[SIFIVE_U_CLINT].base,
- memmap[SIFIVE_U_CLINT].size, 0, ms->smp.cpus,
+ sifive_clint_create(memmap[SIFIVE_U_DEV_CLINT].base,
+ memmap[SIFIVE_U_DEV_CLINT].size, 0, ms->smp.cpus,
SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE,
SIFIVE_CLINT_TIMEBASE_FREQ, false);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->prci), errp)) {
return;
}
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_DEV_PRCI].base);
qdev_prop_set_uint32(DEVICE(&s->gpio), "ngpio", 16);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
return;
}
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_U_GPIO].base);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_U_DEV_GPIO].base);
/* Pass all GPIOs to the SOC layer so they are available to the board */
qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL);
@@ -751,7 +751,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
/* PDMA */
sysbus_realize(SYS_BUS_DEVICE(&s->dma), errp);
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->dma), 0, memmap[SIFIVE_U_PDMA].base);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->dma), 0, memmap[SIFIVE_U_DEV_PDMA].base);
/* Connect PDMA interrupts to the PLIC */
for (i = 0; i < SIFIVE_PDMA_IRQS; i++) {
@@ -764,7 +764,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
if (!sysbus_realize(SYS_BUS_DEVICE(&s->otp), errp)) {
return;
}
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_OTP].base);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_DEV_OTP].base);
/* FIXME use qdev NIC properties instead of nd_table[] */
if (nd->used) {
@@ -776,18 +776,18 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
if (!sysbus_realize(SYS_BUS_DEVICE(&s->gem), errp)) {
return;
}
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_GEM].base);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_DEV_GEM].base);
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem), 0,
qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_GEM_IRQ));
create_unimplemented_device("riscv.sifive.u.gem-mgmt",
- memmap[SIFIVE_U_GEM_MGMT].base, memmap[SIFIVE_U_GEM_MGMT].size);
+ memmap[SIFIVE_U_DEV_GEM_MGMT].base, memmap[SIFIVE_U_DEV_GEM_MGMT].size);
create_unimplemented_device("riscv.sifive.u.dmc",
- memmap[SIFIVE_U_DMC].base, memmap[SIFIVE_U_DMC].size);
+ memmap[SIFIVE_U_DEV_DMC].base, memmap[SIFIVE_U_DEV_DMC].size);
create_unimplemented_device("riscv.sifive.u.l2cc",
- memmap[SIFIVE_U_L2CC].base, memmap[SIFIVE_U_L2CC].size);
+ memmap[SIFIVE_U_DEV_L2CC].base, memmap[SIFIVE_U_DEV_L2CC].size);
}
static Property sifive_u_soc_props[] = {
diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c
index 10fac3d9c9..bc5ce1a9f4 100644
--- a/hw/rtc/ds1338.c
+++ b/hw/rtc/ds1338.c
@@ -30,9 +30,7 @@
#define CTRL_OSF 0x20
#define TYPE_DS1338 "ds1338"
-typedef struct DS1338State DS1338State;
-DECLARE_INSTANCE_CHECKER(DS1338State, DS1338,
- TYPE_DS1338)
+OBJECT_DECLARE_SIMPLE_TYPE(DS1338State, DS1338)
struct DS1338State {
I2CSlave parent_obj;
diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c
index f8a4fe8a47..4c97624478 100644
--- a/hw/rtc/exynos4210_rtc.c
+++ b/hw/rtc/exynos4210_rtc.c
@@ -85,9 +85,7 @@
#define RTC_BASE_FREQ 32768
#define TYPE_EXYNOS4210_RTC "exynos4210.rtc"
-typedef struct Exynos4210RTCState Exynos4210RTCState;
-DECLARE_INSTANCE_CHECKER(Exynos4210RTCState, EXYNOS4210_RTC,
- TYPE_EXYNOS4210_RTC)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210RTCState, EXYNOS4210_RTC)
struct Exynos4210RTCState {
SysBusDevice parent_obj;
diff --git a/hw/rtc/m41t80.c b/hw/rtc/m41t80.c
index 0b7048c3f4..396d110ba2 100644
--- a/hw/rtc/m41t80.c
+++ b/hw/rtc/m41t80.c
@@ -17,9 +17,7 @@
#include "qom/object.h"
#define TYPE_M41T80 "m41t80"
-typedef struct M41t80State M41t80State;
-DECLARE_INSTANCE_CHECKER(M41t80State, M41T80,
- TYPE_M41T80)
+OBJECT_DECLARE_SIMPLE_TYPE(M41t80State, M41T80)
struct M41t80State {
I2CSlave parent_obj;
diff --git a/hw/rtc/sun4v-rtc.c b/hw/rtc/sun4v-rtc.c
index 18979d25d0..e037acd1b5 100644
--- a/hw/rtc/sun4v-rtc.c
+++ b/hw/rtc/sun4v-rtc.c
@@ -20,9 +20,7 @@
#define TYPE_SUN4V_RTC "sun4v_rtc"
-typedef struct Sun4vRtc Sun4vRtc;
-DECLARE_INSTANCE_CHECKER(Sun4vRtc, SUN4V_RTC,
- TYPE_SUN4V_RTC)
+OBJECT_DECLARE_SIMPLE_TYPE(Sun4vRtc, SUN4V_RTC)
struct Sun4vRtc {
SysBusDevice parent_obj;
diff --git a/hw/rtc/twl92230.c b/hw/rtc/twl92230.c
index 4f83eff5c3..f838913b37 100644
--- a/hw/rtc/twl92230.c
+++ b/hw/rtc/twl92230.c
@@ -34,9 +34,7 @@
#define VERBOSE 1
#define TYPE_TWL92230 "twl92230"
-typedef struct MenelausState MenelausState;
-DECLARE_INSTANCE_CHECKER(MenelausState, TWL92230,
- TYPE_TWL92230)
+OBJECT_DECLARE_SIMPLE_TYPE(MenelausState, TWL92230)
struct MenelausState {
I2CSlave parent_obj;
diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h
index cf7d492084..832c78cd42 100644
--- a/hw/s390x/ccw-device.h
+++ b/hw/s390x/ccw-device.h
@@ -38,7 +38,6 @@ struct CCWDeviceClass {
void (*realize)(CcwDevice *, Error **);
void (*refill_ids)(CcwDevice *);
};
-typedef struct CCWDeviceClass CCWDeviceClass;
static inline CcwDevice *to_ccw_dev_fast(DeviceState *d)
{
@@ -47,7 +46,6 @@ static inline CcwDevice *to_ccw_dev_fast(DeviceState *d)
#define TYPE_CCW_DEVICE "ccw-device"
-DECLARE_OBJ_CHECKERS(CcwDevice, CCWDeviceClass,
- CCW_DEVICE, TYPE_CCW_DEVICE)
+OBJECT_DECLARE_TYPE(CcwDevice, CCWDeviceClass, CCW_DEVICE)
#endif
diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h
index 9e6061a043..9e90169695 100644
--- a/hw/s390x/ipl.h
+++ b/hw/s390x/ipl.h
@@ -153,9 +153,7 @@ struct QemuIplParameters {
typedef struct QemuIplParameters QemuIplParameters;
#define TYPE_S390_IPL "s390-ipl"
-typedef struct S390IPLState S390IPLState;
-DECLARE_INSTANCE_CHECKER(S390IPLState, S390_IPL,
- TYPE_S390_IPL)
+OBJECT_DECLARE_SIMPLE_TYPE(S390IPLState, S390_IPL)
struct S390IPLState {
/*< private >*/
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 045805980f..97464d0ad3 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -37,18 +37,10 @@
#define UID_UNDEFINED 0
#define UID_CHECKING_ENABLED 0x01
-typedef struct S390pciState S390pciState;
-DECLARE_INSTANCE_CHECKER(S390pciState, S390_PCI_HOST_BRIDGE,
- TYPE_S390_PCI_HOST_BRIDGE)
-typedef struct S390PCIBus S390PCIBus;
-DECLARE_INSTANCE_CHECKER(S390PCIBus, S390_PCI_BUS,
- TYPE_S390_PCI_BUS)
-typedef struct S390PCIBusDevice S390PCIBusDevice;
-DECLARE_INSTANCE_CHECKER(S390PCIBusDevice, S390_PCI_DEVICE,
- TYPE_S390_PCI_DEVICE)
-typedef struct S390PCIIOMMU S390PCIIOMMU;
-DECLARE_INSTANCE_CHECKER(S390PCIIOMMU, S390_PCI_IOMMU,
- TYPE_S390_PCI_IOMMU)
+OBJECT_DECLARE_SIMPLE_TYPE(S390pciState, S390_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(S390PCIBus, S390_PCI_BUS)
+OBJECT_DECLARE_SIMPLE_TYPE(S390PCIBusDevice, S390_PCI_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(S390PCIIOMMU, S390_PCI_IOMMU)
#define HP_EVENT_TO_CONFIGURED 0x0301
#define HP_EVENT_RESERVED_TO_STANDBY 0x0302
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index db2f49cb27..5cc559fe4c 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -125,7 +125,7 @@ void qmp_dump_skeys(const char *filename, Error **errp)
return;
}
- fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ fd = qemu_open_old(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd < 0) {
error_setg_file_open(errp, errno, filename);
return;
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index cea259685d..49a2b8ca42 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -54,10 +54,7 @@
#define CCW_CMD_SET_VIRTIO_REV 0x83
#define TYPE_VIRTIO_CCW_DEVICE "virtio-ccw-device"
-typedef struct VirtIOCCWDeviceClass VirtIOCCWDeviceClass;
-typedef struct VirtioCcwDevice VirtioCcwDevice;
-DECLARE_OBJ_CHECKERS(VirtioCcwDevice, VirtIOCCWDeviceClass,
- VIRTIO_CCW_DEVICE, TYPE_VIRTIO_CCW_DEVICE)
+OBJECT_DECLARE_TYPE(VirtioCcwDevice, VirtIOCCWDeviceClass, VIRTIO_CCW_DEVICE)
typedef struct VirtioBusState VirtioCcwBusState;
typedef struct VirtioBusClass VirtioCcwBusClass;
@@ -105,9 +102,7 @@ static inline int virtio_ccw_rev_max(VirtioCcwDevice *dev)
/* virtio-scsi-ccw */
#define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw"
-typedef struct VirtIOSCSICcw VirtIOSCSICcw;
-DECLARE_INSTANCE_CHECKER(VirtIOSCSICcw, VIRTIO_SCSI_CCW,
- TYPE_VIRTIO_SCSI_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSCSICcw, VIRTIO_SCSI_CCW)
struct VirtIOSCSICcw {
VirtioCcwDevice parent_obj;
@@ -118,9 +113,7 @@ struct VirtIOSCSICcw {
/* vhost-scsi-ccw */
#define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw"
-typedef struct VHostSCSICcw VHostSCSICcw;
-DECLARE_INSTANCE_CHECKER(VHostSCSICcw, VHOST_SCSI_CCW,
- TYPE_VHOST_SCSI_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VHostSCSICcw, VHOST_SCSI_CCW)
struct VHostSCSICcw {
VirtioCcwDevice parent_obj;
@@ -131,9 +124,7 @@ struct VHostSCSICcw {
/* virtio-blk-ccw */
#define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
-typedef struct VirtIOBlkCcw VirtIOBlkCcw;
-DECLARE_INSTANCE_CHECKER(VirtIOBlkCcw, VIRTIO_BLK_CCW,
- TYPE_VIRTIO_BLK_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBlkCcw, VIRTIO_BLK_CCW)
struct VirtIOBlkCcw {
VirtioCcwDevice parent_obj;
@@ -143,9 +134,7 @@ struct VirtIOBlkCcw {
/* virtio-balloon-ccw */
#define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw"
-typedef struct VirtIOBalloonCcw VirtIOBalloonCcw;
-DECLARE_INSTANCE_CHECKER(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW,
- TYPE_VIRTIO_BALLOON_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW)
struct VirtIOBalloonCcw {
VirtioCcwDevice parent_obj;
@@ -155,9 +144,7 @@ struct VirtIOBalloonCcw {
/* virtio-serial-ccw */
#define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw"
-typedef struct VirtioSerialCcw VirtioSerialCcw;
-DECLARE_INSTANCE_CHECKER(VirtioSerialCcw, VIRTIO_SERIAL_CCW,
- TYPE_VIRTIO_SERIAL_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtioSerialCcw, VIRTIO_SERIAL_CCW)
struct VirtioSerialCcw {
VirtioCcwDevice parent_obj;
@@ -167,9 +154,7 @@ struct VirtioSerialCcw {
/* virtio-net-ccw */
#define TYPE_VIRTIO_NET_CCW "virtio-net-ccw"
-typedef struct VirtIONetCcw VirtIONetCcw;
-DECLARE_INSTANCE_CHECKER(VirtIONetCcw, VIRTIO_NET_CCW,
- TYPE_VIRTIO_NET_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIONetCcw, VIRTIO_NET_CCW)
struct VirtIONetCcw {
VirtioCcwDevice parent_obj;
@@ -179,9 +164,7 @@ struct VirtIONetCcw {
/* virtio-rng-ccw */
#define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw"
-typedef struct VirtIORNGCcw VirtIORNGCcw;
-DECLARE_INSTANCE_CHECKER(VirtIORNGCcw, VIRTIO_RNG_CCW,
- TYPE_VIRTIO_RNG_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIORNGCcw, VIRTIO_RNG_CCW)
struct VirtIORNGCcw {
VirtioCcwDevice parent_obj;
@@ -191,9 +174,7 @@ struct VirtIORNGCcw {
/* virtio-crypto-ccw */
#define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw"
-typedef struct VirtIOCryptoCcw VirtIOCryptoCcw;
-DECLARE_INSTANCE_CHECKER(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW,
- TYPE_VIRTIO_CRYPTO_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW)
struct VirtIOCryptoCcw {
VirtioCcwDevice parent_obj;
@@ -206,9 +187,7 @@ VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
#include "hw/9pfs/virtio-9p.h"
#define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw"
-typedef struct V9fsCCWState V9fsCCWState;
-DECLARE_INSTANCE_CHECKER(V9fsCCWState, VIRTIO_9P_CCW,
- TYPE_VIRTIO_9P_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(V9fsCCWState, VIRTIO_9P_CCW)
struct V9fsCCWState {
VirtioCcwDevice parent_obj;
@@ -219,9 +198,7 @@ struct V9fsCCWState {
#ifdef CONFIG_VHOST_VSOCK
#define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw"
-typedef struct VHostVSockCCWState VHostVSockCCWState;
-DECLARE_INSTANCE_CHECKER(VHostVSockCCWState, VHOST_VSOCK_CCW,
- TYPE_VHOST_VSOCK_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VHostVSockCCWState, VHOST_VSOCK_CCW)
struct VHostVSockCCWState {
VirtioCcwDevice parent_obj;
@@ -231,9 +208,7 @@ struct VHostVSockCCWState {
#endif /* CONFIG_VHOST_VSOCK */
#define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw"
-typedef struct VirtIOGPUCcw VirtIOGPUCcw;
-DECLARE_INSTANCE_CHECKER(VirtIOGPUCcw, VIRTIO_GPU_CCW,
- TYPE_VIRTIO_GPU_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUCcw, VIRTIO_GPU_CCW)
struct VirtIOGPUCcw {
VirtioCcwDevice parent_obj;
@@ -241,9 +216,7 @@ struct VirtIOGPUCcw {
};
#define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw"
-typedef struct VirtIOInputCcw VirtIOInputCcw;
-DECLARE_INSTANCE_CHECKER(VirtIOInputCcw, VIRTIO_INPUT_CCW,
- TYPE_VIRTIO_INPUT_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputCcw, VIRTIO_INPUT_CCW)
struct VirtIOInputCcw {
VirtioCcwDevice parent_obj;
@@ -254,9 +227,7 @@ struct VirtIOInputCcw {
#define TYPE_VIRTIO_KEYBOARD_CCW "virtio-keyboard-ccw"
#define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw"
#define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw"
-typedef struct VirtIOInputHIDCcw VirtIOInputHIDCcw;
-DECLARE_INSTANCE_CHECKER(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW,
- TYPE_VIRTIO_INPUT_HID_CCW)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW)
struct VirtIOInputHIDCcw {
VirtioCcwDevice parent_obj;
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index e8354a47da..7d13c7dc1c 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -305,13 +305,11 @@ struct LSIState {
uint8_t script_ram[2048 * sizeof(uint32_t)];
};
-typedef struct LSIState LSIState;
#define TYPE_LSI53C810 "lsi53c810"
#define TYPE_LSI53C895A "lsi53c895a"
-DECLARE_INSTANCE_CHECKER(LSIState, LSI53C895A,
- TYPE_LSI53C895A)
+OBJECT_DECLARE_SIMPLE_TYPE(LSIState, LSI53C895A)
static const char *scsi_phases[] = {
"DOUT",
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 1f0388a755..e859534eaf 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -55,10 +55,7 @@
#define TYPE_SCSI_DISK_BASE "scsi-disk-base"
-typedef struct SCSIDiskClass SCSIDiskClass;
-typedef struct SCSIDiskState SCSIDiskState;
-DECLARE_OBJ_CHECKERS(SCSIDiskState, SCSIDiskClass,
- SCSI_DISK_BASE, TYPE_SCSI_DISK_BASE)
+OBJECT_DECLARE_TYPE(SCSIDiskState, SCSIDiskClass, SCSI_DISK_BASE)
struct SCSIDiskClass {
SCSIDeviceClass parent_class;
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index c3e6d1ecef..4aa0224c47 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -91,9 +91,7 @@ typedef struct vscsi_req {
} vscsi_req;
#define TYPE_VIO_SPAPR_VSCSI_DEVICE "spapr-vscsi"
-typedef struct VSCSIState VSCSIState;
-DECLARE_INSTANCE_CHECKER(VSCSIState, VIO_SPAPR_VSCSI_DEVICE,
- TYPE_VIO_SPAPR_VSCSI_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(VSCSIState, VIO_SPAPR_VSCSI_DEVICE)
struct VSCSIState {
SpaprVioDevice vdev;
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index 40095bed09..a63d25de48 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -61,12 +61,9 @@ struct PVSCSIClass {
PCIDeviceClass parent_class;
DeviceRealize parent_dc_realize;
};
-typedef struct PVSCSIClass PVSCSIClass;
#define TYPE_PVSCSI "pvscsi"
-typedef struct PVSCSIState PVSCSIState;
-DECLARE_OBJ_CHECKERS(PVSCSIState, PVSCSIClass,
- PVSCSI, TYPE_PVSCSI)
+OBJECT_DECLARE_TYPE(PVSCSIState, PVSCSIClass, PVSCSI)
/* Compatibility flags for migration */
diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index 4d3ec28f5d..8cde32049e 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -64,9 +64,7 @@ enum {
};
#define TYPE_MILKYMIST_MEMCARD "milkymist-memcard"
-typedef struct MilkymistMemcardState MilkymistMemcardState;
-DECLARE_INSTANCE_CHECKER(MilkymistMemcardState, MILKYMIST_MEMCARD,
- TYPE_MILKYMIST_MEMCARD)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistMemcardState, MILKYMIST_MEMCARD)
#define TYPE_MILKYMIST_SDBUS "milkymist-sdbus"
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 7829e933a5..960f155098 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -23,9 +23,7 @@
#define PL181_FIFO_LEN 16
#define TYPE_PL181 "pl181"
-typedef struct PL181State PL181State;
-DECLARE_INSTANCE_CHECKER(PL181State, PL181,
- TYPE_PL181)
+OBJECT_DECLARE_SIMPLE_TYPE(PL181State, PL181)
#define TYPE_PL181_BUS "pl181-bus"
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index dd07258d4e..14c8e04a89 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -52,11 +52,9 @@ struct ssi_sd_state {
int32_t stopping;
SDBus sdbus;
};
-typedef struct ssi_sd_state ssi_sd_state;
#define TYPE_SSI_SD "ssi-sd"
-DECLARE_INSTANCE_CHECKER(ssi_sd_state, SSI_SD,
- TYPE_SSI_SD)
+OBJECT_DECLARE_SIMPLE_TYPE(ssi_sd_state, SSI_SD)
/* State word bits. */
#define SSI_SDR_LOCKED 0x0001
diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
index dc73845125..73d2d0bccb 100644
--- a/hw/sh4/sh_pci.c
+++ b/hw/sh4/sh_pci.c
@@ -35,9 +35,7 @@
#define TYPE_SH_PCI_HOST_BRIDGE "sh_pci"
-typedef struct SHPCIState SHPCIState;
-DECLARE_INSTANCE_CHECKER(SHPCIState, SH_PCI_HOST_BRIDGE,
- TYPE_SH_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(SHPCIState, SH_PCI_HOST_BRIDGE)
struct SHPCIState {
PCIHostState parent_obj;
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 947b69d159..54a2b2f9ef 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -582,9 +582,7 @@ static void idreg_init(hwaddr addr)
idreg_data, sizeof(idreg_data));
}
-typedef struct IDRegState IDRegState;
-DECLARE_INSTANCE_CHECKER(IDRegState, MACIO_ID_REGISTER,
- TYPE_MACIO_ID_REGISTER)
+OBJECT_DECLARE_SIMPLE_TYPE(IDRegState, MACIO_ID_REGISTER)
struct IDRegState {
SysBusDevice parent_obj;
@@ -625,9 +623,7 @@ static const TypeInfo idreg_info = {
};
#define TYPE_TCX_AFX "tcx_afx"
-typedef struct AFXState AFXState;
-DECLARE_INSTANCE_CHECKER(AFXState, TCX_AFX,
- TYPE_TCX_AFX)
+OBJECT_DECLARE_SIMPLE_TYPE(AFXState, TCX_AFX)
struct AFXState {
SysBusDevice parent_obj;
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index b4aabfc076..ad5ca2472a 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -90,11 +90,9 @@ struct EbusState {
MemoryRegion bar0;
MemoryRegion bar1;
};
-typedef struct EbusState EbusState;
#define TYPE_EBUS "ebus"
-DECLARE_INSTANCE_CHECKER(EbusState, EBUS,
- TYPE_EBUS)
+OBJECT_DECLARE_SIMPLE_TYPE(EbusState, EBUS)
const char *fw_cfg_arch_key_name(uint16_t key)
{
@@ -229,9 +227,7 @@ typedef struct ResetData {
} ResetData;
#define TYPE_SUN4U_POWER "power"
-typedef struct PowerDevice PowerDevice;
-DECLARE_INSTANCE_CHECKER(PowerDevice, SUN4U_POWER,
- TYPE_SUN4U_POWER)
+OBJECT_DECLARE_SIMPLE_TYPE(PowerDevice, SUN4U_POWER)
struct PowerDevice {
SysBusDevice parent_obj;
diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c
index faf7633e70..4278d0e444 100644
--- a/hw/ssi/ssi.c
+++ b/hw/ssi/ssi.c
@@ -24,8 +24,7 @@ struct SSIBus {
};
#define TYPE_SSI_BUS "SSI"
-DECLARE_INSTANCE_CHECKER(SSIBus, SSI_BUS,
- TYPE_SSI_BUS)
+OBJECT_DECLARE_SIMPLE_TYPE(SSIBus, SSI_BUS)
static const TypeInfo ssi_bus_info = {
.name = TYPE_SSI_BUS,
diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c
index 34fc8da69a..fec8817d94 100644
--- a/hw/ssi/xilinx_spi.c
+++ b/hw/ssi/xilinx_spi.c
@@ -79,9 +79,7 @@
#define FIFO_CAPACITY 256
#define TYPE_XILINX_SPI "xlnx.xps-spi"
-typedef struct XilinxSPI XilinxSPI;
-DECLARE_INSTANCE_CHECKER(XilinxSPI, XILINX_SPI,
- TYPE_XILINX_SPI)
+OBJECT_DECLARE_SIMPLE_TYPE(XilinxSPI, XILINX_SPI)
struct XilinxSPI {
SysBusDevice parent_obj;
diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c
index c694c98d08..c6e02d2b5a 100644
--- a/hw/timer/altera_timer.c
+++ b/hw/timer/altera_timer.c
@@ -45,9 +45,7 @@
#define CONTROL_STOP 0x0008
#define TYPE_ALTERA_TIMER "ALTR.timer"
-typedef struct AlteraTimer AlteraTimer;
-DECLARE_INSTANCE_CHECKER(AlteraTimer, ALTERA_TIMER,
- TYPE_ALTERA_TIMER)
+OBJECT_DECLARE_SIMPLE_TYPE(AlteraTimer, ALTERA_TIMER)
struct AlteraTimer {
SysBusDevice busdev;
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index 79117f45b0..98e70b2d26 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -191,9 +191,7 @@ static arm_timer_state *arm_timer_init(uint32_t freq)
*/
#define TYPE_SP804 "sp804"
-typedef struct SP804State SP804State;
-DECLARE_INSTANCE_CHECKER(SP804State, SP804,
- TYPE_SP804)
+OBJECT_DECLARE_SIMPLE_TYPE(SP804State, SP804)
struct SP804State {
SysBusDevice parent_obj;
@@ -313,9 +311,7 @@ static void sp804_realize(DeviceState *dev, Error **errp)
/* Integrator/CP timer module. */
#define TYPE_INTEGRATOR_PIT "integrator_pit"
-typedef struct icp_pit_state icp_pit_state;
-DECLARE_INSTANCE_CHECKER(icp_pit_state, INTEGRATOR_PIT,
- TYPE_INTEGRATOR_PIT)
+OBJECT_DECLARE_SIMPLE_TYPE(icp_pit_state, INTEGRATOR_PIT)
struct icp_pit_state {
SysBusDevice parent_obj;
diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c
index 52e637545a..64108241ba 100644
--- a/hw/timer/cadence_ttc.c
+++ b/hw/timer/cadence_ttc.c
@@ -70,9 +70,7 @@ typedef struct {
} CadenceTimerState;
#define TYPE_CADENCE_TTC "cadence_ttc"
-typedef struct CadenceTTCState CadenceTTCState;
-DECLARE_INSTANCE_CHECKER(CadenceTTCState, CADENCE_TTC,
- TYPE_CADENCE_TTC)
+OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC)
struct CadenceTTCState {
SysBusDevice parent_obj;
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
index 0329cae3d9..08ee3ca76c 100644
--- a/hw/timer/exynos4210_mct.c
+++ b/hw/timer/exynos4210_mct.c
@@ -243,9 +243,7 @@ typedef struct {
} Exynos4210MCTLT;
#define TYPE_EXYNOS4210_MCT "exynos4210.mct"
-typedef struct Exynos4210MCTState Exynos4210MCTState;
-DECLARE_INSTANCE_CHECKER(Exynos4210MCTState, EXYNOS4210_MCT,
- TYPE_EXYNOS4210_MCT)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210MCTState, EXYNOS4210_MCT)
struct Exynos4210MCTState {
SysBusDevice parent_obj;
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
index 5340fc0425..4fa3d87396 100644
--- a/hw/timer/exynos4210_pwm.c
+++ b/hw/timer/exynos4210_pwm.c
@@ -103,9 +103,7 @@ typedef struct {
} Exynos4210PWM;
#define TYPE_EXYNOS4210_PWM "exynos4210.pwm"
-typedef struct Exynos4210PWMState Exynos4210PWMState;
-DECLARE_INSTANCE_CHECKER(Exynos4210PWMState, EXYNOS4210_PWM,
- TYPE_EXYNOS4210_PWM)
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210PWMState, EXYNOS4210_PWM)
struct Exynos4210PWMState {
SysBusDevice parent_obj;
diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c
index e539fc24f0..d511890109 100644
--- a/hw/timer/grlib_gptimer.c
+++ b/hw/timer/grlib_gptimer.c
@@ -56,9 +56,7 @@
#define COUNTER_RELOAD_OFFSET 0x04
#define TIMER_BASE 0x10
-typedef struct GPTimerUnit GPTimerUnit;
-DECLARE_INSTANCE_CHECKER(GPTimerUnit, GRLIB_GPTIMER,
- TYPE_GRLIB_GPTIMER)
+OBJECT_DECLARE_SIMPLE_TYPE(GPTimerUnit, GRLIB_GPTIMER)
typedef struct GPTimer GPTimer;
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index edaa5a0adf..05fd86af81 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -48,9 +48,7 @@
#define HPET_MSI_SUPPORT 0
-typedef struct HPETState HPETState;
-DECLARE_INSTANCE_CHECKER(HPETState, HPET,
- TYPE_HPET)
+OBJECT_DECLARE_SIMPLE_TYPE(HPETState, HPET)
struct HPETState;
typedef struct HPETTimer { /* timers */
diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c
index 93ecb51a97..be87c65b3e 100644
--- a/hw/timer/lm32_timer.c
+++ b/hw/timer/lm32_timer.c
@@ -56,9 +56,7 @@ enum {
};
#define TYPE_LM32_TIMER "lm32-timer"
-typedef struct LM32TimerState LM32TimerState;
-DECLARE_INSTANCE_CHECKER(LM32TimerState, LM32_TIMER,
- TYPE_LM32_TIMER)
+OBJECT_DECLARE_SIMPLE_TYPE(LM32TimerState, LM32_TIMER)
struct LM32TimerState {
SysBusDevice parent_obj;
diff --git a/hw/timer/milkymist-sysctl.c b/hw/timer/milkymist-sysctl.c
index 29500e0457..950437b685 100644
--- a/hw/timer/milkymist-sysctl.c
+++ b/hw/timer/milkymist-sysctl.c
@@ -63,9 +63,7 @@ enum {
};
#define TYPE_MILKYMIST_SYSCTL "milkymist-sysctl"
-typedef struct MilkymistSysctlState MilkymistSysctlState;
-DECLARE_INSTANCE_CHECKER(MilkymistSysctlState, MILKYMIST_SYSCTL,
- TYPE_MILKYMIST_SYSCTL)
+OBJECT_DECLARE_SIMPLE_TYPE(MilkymistSysctlState, MILKYMIST_SYSCTL)
struct MilkymistSysctlState {
SysBusDevice parent_obj;
diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c
index 3a35ac2b0a..d5bf26b56b 100644
--- a/hw/timer/puv3_ost.c
+++ b/hw/timer/puv3_ost.c
@@ -21,9 +21,7 @@
#include "hw/unicore32/puv3.h"
#define TYPE_PUV3_OST "puv3_ost"
-typedef struct PUV3OSTState PUV3OSTState;
-DECLARE_INSTANCE_CHECKER(PUV3OSTState, PUV3_OST,
- TYPE_PUV3_OST)
+OBJECT_DECLARE_SIMPLE_TYPE(PUV3OSTState, PUV3_OST)
/* puv3 ostimer implementation. */
struct PUV3OSTState {
diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
index 8c3a1f5489..2ae5ae3212 100644
--- a/hw/timer/pxa2xx_timer.c
+++ b/hw/timer/pxa2xx_timer.c
@@ -67,9 +67,7 @@ static int pxa2xx_timer4_freq[8] = {
};
#define TYPE_PXA2XX_TIMER "pxa2xx-timer"
-typedef struct PXA2xxTimerInfo PXA2xxTimerInfo;
-DECLARE_INSTANCE_CHECKER(PXA2xxTimerInfo, PXA2XX_TIMER,
- TYPE_PXA2XX_TIMER)
+OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxTimerInfo, PXA2XX_TIMER)
typedef struct {
diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c
index 08d6888015..5b2d20cb6a 100644
--- a/hw/timer/slavio_timer.c
+++ b/hw/timer/slavio_timer.c
@@ -60,9 +60,7 @@ typedef struct CPUTimerState {
} CPUTimerState;
#define TYPE_SLAVIO_TIMER "slavio_timer"
-typedef struct SLAVIO_TIMERState SLAVIO_TIMERState;
-DECLARE_INSTANCE_CHECKER(SLAVIO_TIMERState, SLAVIO_TIMER,
- TYPE_SLAVIO_TIMER)
+OBJECT_DECLARE_SIMPLE_TYPE(SLAVIO_TIMERState, SLAVIO_TIMER)
struct SLAVIO_TIMERState {
SysBusDevice parent_obj;
diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
index fafdcffa9c..6fd876eebf 100644
--- a/hw/tpm/tpm_tis_isa.c
+++ b/hw/tpm/tpm_tis_isa.c
@@ -38,10 +38,8 @@ struct TPMStateISA {
/*< public >*/
TPMState state; /* not a QOM object */
};
-typedef struct TPMStateISA TPMStateISA;
-DECLARE_INSTANCE_CHECKER(TPMStateISA, TPM_TIS_ISA,
- TYPE_TPM_TIS_ISA)
+OBJECT_DECLARE_SIMPLE_TYPE(TPMStateISA, TPM_TIS_ISA)
static int tpm_tis_pre_save_isa(void *opaque)
{
diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index 20b28eeb28..2c32aa7099 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -38,10 +38,8 @@ struct TPMStateSysBus {
/*< public >*/
TPMState state; /* not a QOM object */
};
-typedef struct TPMStateSysBus TPMStateSysBus;
-DECLARE_INSTANCE_CHECKER(TPMStateSysBus, TPM_TIS_SYSBUS,
- TYPE_TPM_TIS_SYSBUS)
+OBJECT_DECLARE_SIMPLE_TYPE(TPMStateSysBus, TPM_TIS_SYSBUS)
static int tpm_tis_pre_save_sysbus(void *opaque)
{
diff --git a/hw/usb/ccid.h b/hw/usb/ccid.h
index ef2bb3462d..6b82a55bd4 100644
--- a/hw/usb/ccid.h
+++ b/hw/usb/ccid.h
@@ -13,13 +13,10 @@
#include "hw/qdev-core.h"
#include "qom/object.h"
-typedef struct CCIDCardState CCIDCardState;
typedef struct CCIDCardInfo CCIDCardInfo;
#define TYPE_CCID_CARD "ccid-card"
-typedef struct CCIDCardClass CCIDCardClass;
-DECLARE_OBJ_CHECKERS(CCIDCardState, CCIDCardClass,
- CCID_CARD, TYPE_CCID_CARD)
+OBJECT_DECLARE_TYPE(CCIDCardState, CCIDCardClass, CCID_CARD)
/*
* callbacks to be used by the CCID device (hw/usb-ccid.c) to call
diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
index 65247ca799..e1486f81e0 100644
--- a/hw/usb/dev-audio.c
+++ b/hw/usb/dev-audio.c
@@ -654,11 +654,9 @@ struct USBAudioState {
uint32_t buffer_user, buffer;
bool multi;
};
-typedef struct USBAudioState USBAudioState;
#define TYPE_USB_AUDIO "usb-audio"
-DECLARE_INSTANCE_CHECKER(USBAudioState, USB_AUDIO,
- TYPE_USB_AUDIO)
+OBJECT_DECLARE_SIMPLE_TYPE(USBAudioState, USB_AUDIO)
static void output_callback(void *opaque, int avail)
{
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index 05cfe6baca..fc39bab79f 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -44,11 +44,9 @@ struct USBHIDState {
char *display;
uint32_t head;
};
-typedef struct USBHIDState USBHIDState;
#define TYPE_USB_HID "usb-hid"
-DECLARE_INSTANCE_CHECKER(USBHIDState, USB_HID,
- TYPE_USB_HID)
+OBJECT_DECLARE_SIMPLE_TYPE(USBHIDState, USB_HID)
enum {
STR_MANUFACTURER = 1,
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index 7a182f9bec..40c1f90694 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -50,11 +50,9 @@ struct USBHubState {
QEMUTimer *port_timer;
USBHubPort ports[MAX_PORTS];
};
-typedef struct USBHubState USBHubState;
#define TYPE_USB_HUB "usb-hub"
-DECLARE_INSTANCE_CHECKER(USBHubState, USB_HUB,
- TYPE_USB_HUB)
+OBJECT_DECLARE_SIMPLE_TYPE(USBHubState, USB_HUB)
#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index c61c0e0878..bbb8274344 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -238,8 +238,7 @@ typedef struct {
} QEMU_PACKED ObjectInfo;
#define TYPE_USB_MTP "usb-mtp"
-DECLARE_INSTANCE_CHECKER(MTPState, USB_MTP,
- TYPE_USB_MTP)
+OBJECT_DECLARE_SIMPLE_TYPE(MTPState, USB_MTP)
#define QEMU_STORAGE_ID 0x00010001
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index cd32f57685..6c49c16015 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -653,11 +653,9 @@ struct USBNetState {
NICConf conf;
QTAILQ_HEAD(, rndis_response) rndis_resp;
};
-typedef struct USBNetState USBNetState;
#define TYPE_USB_NET "usb-net"
-DECLARE_INSTANCE_CHECKER(USBNetState, USB_NET,
- TYPE_USB_NET)
+OBJECT_DECLARE_SIMPLE_TYPE(USBNetState, USB_NET)
static int is_rndis(USBNetState *s)
{
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 1a038a222e..b1622b7c7f 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -110,11 +110,9 @@ struct USBSerialState {
int latency; /* ms */
CharBackend cs;
};
-typedef struct USBSerialState USBSerialState;
#define TYPE_USB_SERIAL "usb-serial-dev"
-DECLARE_INSTANCE_CHECKER(USBSerialState, USB_SERIAL,
- TYPE_USB_SERIAL)
+OBJECT_DECLARE_SIMPLE_TYPE(USBSerialState, USB_SERIAL)
enum {
STR_MANUFACTURER = 1,
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 59b2248f34..946df9734a 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -61,9 +61,7 @@ do { \
#define D_VERBOSE 4
#define TYPE_USB_CCID_DEV "usb-ccid"
-typedef struct USBCCIDState USBCCIDState;
-DECLARE_INSTANCE_CHECKER(USBCCIDState, USB_CCID_DEV,
- TYPE_USB_CCID_DEV)
+OBJECT_DECLARE_SIMPLE_TYPE(USBCCIDState, USB_CCID_DEV)
/*
* The two options for variable sized buffers:
* make them constant size, for large enough constant,
@@ -1177,8 +1175,7 @@ static Property ccid_props[] = {
};
#define TYPE_CCID_BUS "ccid-bus"
-DECLARE_INSTANCE_CHECKER(CCIDBus, CCID_BUS,
- TYPE_CCID_BUS)
+OBJECT_DECLARE_SIMPLE_TYPE(CCIDBus, CCID_BUS)
static const TypeInfo ccid_bus_info = {
.name = TYPE_CCID_BUS,
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index c36c8e7820..cec071d96c 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -133,8 +133,7 @@ struct UASDevice {
};
#define TYPE_USB_UAS "usb-uas"
-DECLARE_INSTANCE_CHECKER(UASDevice, USB_UAS,
- TYPE_USB_UAS)
+OBJECT_DECLARE_SIMPLE_TYPE(UASDevice, USB_UAS)
struct UASRequest {
uint16_t tag;
diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c
index 85c4d827bf..b595048635 100644
--- a/hw/usb/dev-wacom.c
+++ b/hw/usb/dev-wacom.c
@@ -53,11 +53,9 @@ struct USBWacomState {
uint8_t idle;
int changed;
};
-typedef struct USBWacomState USBWacomState;
#define TYPE_USB_WACOM "usb-wacom-tablet"
-DECLARE_INSTANCE_CHECKER(USBWacomState, USB_WACOM,
- TYPE_USB_WACOM)
+OBJECT_DECLARE_SIMPLE_TYPE(USBWacomState, USB_WACOM)
enum {
STR_MANUFACTURER = 1,
diff --git a/hw/usb/hcd-dwc2.h b/hw/usb/hcd-dwc2.h
index 919e3e43b1..6998b04706 100644
--- a/hw/usb/hcd-dwc2.h
+++ b/hw/usb/hcd-dwc2.h
@@ -181,7 +181,6 @@ struct DWC2Class {
};
#define TYPE_DWC2_USB "dwc2-usb"
-DECLARE_OBJ_CHECKERS(DWC2State, DWC2Class,
- DWC2_USB, TYPE_DWC2_USB)
+OBJECT_DECLARE_TYPE(DWC2State, DWC2Class, DWC2_USB)
#endif
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 1301ce0be7..fd122dd4cd 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -329,9 +329,7 @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *dev);
void ehci_reset(void *opaque);
#define TYPE_PCI_EHCI "pci-ehci-usb"
-typedef struct EHCIPCIState EHCIPCIState;
-DECLARE_INSTANCE_CHECKER(EHCIPCIState, PCI_EHCI,
- TYPE_PCI_EHCI)
+OBJECT_DECLARE_SIMPLE_TYPE(EHCIPCIState, PCI_EHCI)
struct EHCIPCIState {
/*< private >*/
@@ -350,10 +348,7 @@ struct EHCIPCIState {
#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"
#define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb"
-typedef struct EHCISysBusState EHCISysBusState;
-typedef struct SysBusEHCIClass SysBusEHCIClass;
-DECLARE_OBJ_CHECKERS(EHCISysBusState, SysBusEHCIClass,
- SYS_BUS_EHCI, TYPE_SYS_BUS_EHCI)
+OBJECT_DECLARE_TYPE(EHCISysBusState, SysBusEHCIClass, SYS_BUS_EHCI)
struct EHCISysBusState {
/*< private >*/
@@ -374,9 +369,7 @@ struct SysBusEHCIClass {
uint16_t portnr;
};
-typedef struct FUSBH200EHCIState FUSBH200EHCIState;
-DECLARE_INSTANCE_CHECKER(FUSBH200EHCIState, FUSBH200_EHCI,
- TYPE_FUSBH200_EHCI)
+OBJECT_DECLARE_SIMPLE_TYPE(FUSBH200EHCIState, FUSBH200_EHCI)
struct FUSBH200EHCIState {
/*< private >*/
diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c
index f8168a06a3..f95199e0bb 100644
--- a/hw/usb/hcd-ohci-pci.c
+++ b/hw/usb/hcd-ohci-pci.c
@@ -32,9 +32,7 @@
#include "qom/object.h"
#define TYPE_PCI_OHCI "pci-ohci"
-typedef struct OHCIPCIState OHCIPCIState;
-DECLARE_INSTANCE_CHECKER(OHCIPCIState, PCI_OHCI,
- TYPE_PCI_OHCI)
+OBJECT_DECLARE_SIMPLE_TYPE(OHCIPCIState, PCI_OHCI)
struct OHCIPCIState {
/*< private >*/
diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h
index 6e28e97839..11ac57058d 100644
--- a/hw/usb/hcd-ohci.h
+++ b/hw/usb/hcd-ohci.h
@@ -93,9 +93,7 @@ typedef struct OHCIState {
} OHCIState;
#define TYPE_SYSBUS_OHCI "sysbus-ohci"
-typedef struct OHCISysBusState OHCISysBusState;
-DECLARE_INSTANCE_CHECKER(OHCISysBusState, SYSBUS_OHCI,
- TYPE_SYSBUS_OHCI)
+OBJECT_DECLARE_SIMPLE_TYPE(OHCISysBusState, SYSBUS_OHCI)
struct OHCISysBusState {
/*< private >*/
diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h
index 2110c0399e..c3dfc14405 100644
--- a/hw/usb/hcd-xhci.h
+++ b/hw/usb/hcd-xhci.h
@@ -27,9 +27,7 @@
#define TYPE_NEC_XHCI "nec-usb-xhci"
#define TYPE_QEMU_XHCI "qemu-xhci"
-typedef struct XHCIState XHCIState;
-DECLARE_INSTANCE_CHECKER(XHCIState, XHCI,
- TYPE_XHCI)
+OBJECT_DECLARE_SIMPLE_TYPE(XHCIState, XHCI)
#define MAXPORTS_2 15
#define MAXPORTS_3 15
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 43c93504a2..b950501d10 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -61,9 +61,7 @@
/* ------------------------------------------------------------------------ */
#define TYPE_USB_HOST_DEVICE "usb-host"
-typedef struct USBHostDevice USBHostDevice;
-DECLARE_INSTANCE_CHECKER(USBHostDevice, USB_HOST_DEVICE,
- TYPE_USB_HOST_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(USBHostDevice, USB_HOST_DEVICE)
typedef struct USBHostRequest USBHostRequest;
typedef struct USBHostIsoXfer USBHostIsoXfer;
@@ -1147,7 +1145,7 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
if (s->hostdevice) {
int fd;
s->needs_autoscan = false;
- fd = qemu_open(s->hostdevice, O_RDWR);
+ fd = qemu_open_old(s->hostdevice, O_RDWR);
if (fd < 0) {
error_setg_errno(errp, errno, "failed to open %s", s->hostdevice);
return;
diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c
index dd20996d13..1dd4071e68 100644
--- a/hw/usb/tusb6010.c
+++ b/hw/usb/tusb6010.c
@@ -31,9 +31,7 @@
#include "qom/object.h"
#define TYPE_TUSB6010 "tusb6010"
-typedef struct TUSBState TUSBState;
-DECLARE_INSTANCE_CHECKER(TUSBState, TUSB6010,
- TYPE_TUSB6010)
+OBJECT_DECLARE_SIMPLE_TYPE(TUSBState, TUSB6010)
struct TUSBState {
SysBusDevice parent_obj;
diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c
index e9c8aa4595..ae00e93f35 100644
--- a/hw/usb/u2f-passthru.c
+++ b/hw/usb/u2f-passthru.c
@@ -383,7 +383,7 @@ static int u2f_passthru_open_from_device(struct udev_device *device)
{
const char *devnode = udev_device_get_devnode(device);
- int fd = qemu_open(devnode, O_RDWR);
+ int fd = qemu_open_old(devnode, O_RDWR);
if (fd < 0) {
return -1;
} else if (!u2f_passthru_is_u2f_device(fd)) {
@@ -482,7 +482,7 @@ static void u2f_passthru_realize(U2FKeyState *base, Error **errp)
return;
#endif
} else {
- fd = qemu_open(key->hidraw, O_RDWR);
+ fd = qemu_open_old(key->hidraw, O_RDWR);
if (fd < 0) {
error_setg(errp, "%s: Failed to open %s", TYPE_U2F_PASSTHRU,
key->hidraw);
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index 582c091a24..9571c2f91f 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -36,10 +36,8 @@ struct VFIOAPDevice {
APDevice apdev;
VFIODevice vdev;
};
-typedef struct VFIOAPDevice VFIOAPDevice;
-DECLARE_INSTANCE_CHECKER(VFIOAPDevice, VFIO_AP_DEVICE,
- TYPE_VFIO_AP_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(VFIOAPDevice, VFIO_AP_DEVICE)
static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
{
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 33357140b8..13471ae294 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -1254,7 +1254,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
}
}
- fd = qemu_open("/dev/vfio/vfio", O_RDWR);
+ fd = qemu_open_old("/dev/vfio/vfio", O_RDWR);
if (fd < 0) {
error_setg_errno(errp, errno, "failed to open /dev/vfio/vfio");
ret = -errno;
@@ -1479,7 +1479,7 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp)
group = g_malloc0(sizeof(*group));
snprintf(path, sizeof(path), "/dev/vfio/%d", groupid);
- group->fd = qemu_open(path, O_RDWR);
+ group->fd = qemu_open_old(path, O_RDWR);
if (group->fd < 0) {
error_setg_errno(errp, errno, "failed to open %s", path);
goto free_group_exit;
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 5e53d5b863..bce71a9ac9 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -115,9 +115,7 @@ typedef struct VFIOMSIXInfo {
} VFIOMSIXInfo;
#define TYPE_VFIO_PCI "vfio-pci"
-typedef struct VFIOPCIDevice VFIOPCIDevice;
-DECLARE_INSTANCE_CHECKER(VFIOPCIDevice, VFIO_PCI,
- TYPE_VFIO_PCI)
+OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI)
struct VFIOPCIDevice {
PCIDevice pdev;
diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c
index 85acd3d2eb..48e9ff38e2 100644
--- a/hw/virtio/virtio-input-pci.c
+++ b/hw/virtio/virtio-input-pci.c
@@ -14,14 +14,11 @@
#include "qemu/module.h"
#include "qom/object.h"
-typedef struct VirtIOInputPCI VirtIOInputPCI;
-typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI;
/*
* virtio-input-pci: This extends VirtioPCIProxy.
*/
-DECLARE_INSTANCE_CHECKER(VirtIOInputPCI, VIRTIO_INPUT_PCI,
- TYPE_VIRTIO_INPUT_PCI)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputPCI, VIRTIO_INPUT_PCI)
struct VirtIOInputPCI {
VirtIOPCIProxy parent_obj;
@@ -32,8 +29,7 @@ struct VirtIOInputPCI {
#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci"
#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci"
#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci"
-DECLARE_INSTANCE_CHECKER(VirtIOInputHIDPCI, VIRTIO_INPUT_HID_PCI,
- TYPE_VIRTIO_INPUT_HID_PCI)
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDPCI, VIRTIO_INPUT_HID_PCI)
struct VirtIOInputHIDPCI {
VirtIOPCIProxy parent_obj;
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 47b6bb4e26..06e2af12de 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -19,7 +19,6 @@
#include "hw/virtio/virtio-bus.h"
#include "qom/object.h"
-typedef struct VirtIOPCIProxy VirtIOPCIProxy;
/* virtio-pci-bus */
@@ -91,9 +90,7 @@ typedef struct {
* virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
*/
#define TYPE_VIRTIO_PCI "virtio-pci"
-typedef struct VirtioPCIClass VirtioPCIClass;
-DECLARE_OBJ_CHECKERS(VirtIOPCIProxy, VirtioPCIClass,
- VIRTIO_PCI, TYPE_VIRTIO_PCI)
+OBJECT_DECLARE_TYPE(VirtIOPCIProxy, VirtioPCIClass, VIRTIO_PCI)
struct VirtioPCIClass {
PCIDeviceClass parent_class;
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 4f64899a56..502f45a939 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -102,11 +102,9 @@ struct I6300State {
*/
};
-typedef struct I6300State I6300State;
#define TYPE_WATCHDOG_I6300ESB_DEVICE "i6300esb"
-DECLARE_INSTANCE_CHECKER(I6300State, WATCHDOG_I6300ESB_DEVICE,
- TYPE_WATCHDOG_I6300ESB_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(I6300State, WATCHDOG_I6300ESB_DEVICE)
/* This function is called when the watchdog has either been enabled
* (hence it starts counting down) or has been keep-alived.
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index f46971eac6..c74c4678f2 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -37,11 +37,9 @@ void xen_pt_log(const PCIDevice *d, const char *f, ...) GCC_FMT_ATTR(2, 3);
typedef const struct XenPTRegInfo XenPTRegInfo;
typedef struct XenPTReg XenPTReg;
-typedef struct XenPCIPassthroughState XenPCIPassthroughState;
#define TYPE_XEN_PT_DEVICE "xen-pci-passthrough"
-DECLARE_INSTANCE_CHECKER(XenPCIPassthroughState, XEN_PT_DEVICE,
- TYPE_XEN_PT_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(XenPCIPassthroughState, XEN_PT_DEVICE)
uint32_t igd_read_opregion(XenPCIPassthroughState *s);
void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val);