aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/hw/arm/aspeed.h6
-rw-r--r--include/hw/arm/aspeed_soc.h1
-rw-r--r--include/hw/audio/pcspk.h5
-rw-r--r--include/hw/char/cadence_uart.h5
-rw-r--r--include/hw/char/cmsdk-apb-uart.h4
-rw-r--r--include/hw/char/pl011.h9
-rw-r--r--include/hw/char/xilinx_uartlite.h4
-rw-r--r--include/hw/cris/etraxfs.h4
-rw-r--r--include/hw/isa/isa.h5
-rw-r--r--include/hw/misc/auxbus.h18
-rw-r--r--include/hw/misc/unimp.h5
-rw-r--r--include/hw/net/ne2000-isa.h5
-rw-r--r--include/hw/pci/pci.h6
-rw-r--r--include/hw/ppc/pnv_psi.h2
-rw-r--r--include/hw/qdev-core.h13
-rw-r--r--include/hw/riscv/sifive_e.h2
-rw-r--r--include/hw/riscv/sifive_u.h2
-rw-r--r--include/hw/sd/sdhci.h5
-rw-r--r--include/hw/ssi/ssi.h5
-rw-r--r--include/hw/sysbus.h19
-rw-r--r--include/hw/timer/cmsdk-apb-timer.h4
-rw-r--r--include/hw/timer/i8254.h9
-rw-r--r--include/hw/usb.h6
-rw-r--r--include/qom/object.h34
24 files changed, 102 insertions, 76 deletions
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 18521484b9..95b4daece8 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -23,6 +23,11 @@ typedef struct AspeedMachine {
bool mmio_exec;
} AspeedMachine;
+#define ASPEED_MAC0_ON (1 << 0)
+#define ASPEED_MAC1_ON (1 << 1)
+#define ASPEED_MAC2_ON (1 << 2)
+#define ASPEED_MAC3_ON (1 << 3)
+
#define ASPEED_MACHINE_CLASS(klass) \
OBJECT_CLASS_CHECK(AspeedMachineClass, (klass), TYPE_ASPEED_MACHINE)
#define ASPEED_MACHINE_GET_CLASS(obj) \
@@ -39,6 +44,7 @@ typedef struct AspeedMachineClass {
const char *fmc_model;
const char *spi_model;
uint32_t num_cs;
+ uint32_t macs_mask;
void (*i2c_init)(AspeedBoardState *bmc);
} AspeedMachineClass;
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 78b9f6ae53..914115f3ef 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -40,7 +40,6 @@ typedef struct AspeedSoCState {
/*< public >*/
ARMCPU cpu[ASPEED_CPUS_NUM];
- uint32_t num_cpus;
A15MPPrivState a7mpcore;
MemoryRegion *dram_mr;
MemoryRegion sram;
diff --git a/include/hw/audio/pcspk.h b/include/hw/audio/pcspk.h
index 632cce9f68..7e7f5f49dc 100644
--- a/include/hw/audio/pcspk.h
+++ b/include/hw/audio/pcspk.h
@@ -27,6 +27,7 @@
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
+#include "qapi/error.h"
#define TYPE_PC_SPEAKER "isa-pcspk"
@@ -35,11 +36,11 @@ static inline ISADevice *pcspk_init(ISABus *bus, ISADevice *pit)
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_create(bus, TYPE_PC_SPEAKER);
+ isadev = isa_new(TYPE_PC_SPEAKER);
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "iobase", 0x61);
object_property_set_link(OBJECT(dev), OBJECT(pit), "pit", NULL);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isadev, bus, &error_fatal);
return isadev;
}
diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h
index 2a179a572f..ed7b58d31d 100644
--- a/include/hw/char/cadence_uart.h
+++ b/include/hw/char/cadence_uart.h
@@ -22,6 +22,7 @@
#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qapi/error.h"
#include "qemu/timer.h"
#define CADENCE_UART_RX_FIFO_SIZE 16
@@ -59,10 +60,10 @@ static inline DeviceState *cadence_uart_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, TYPE_CADENCE_UART);
+ dev = qdev_new(TYPE_CADENCE_UART);
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, irq);
diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h
index 3c1b53db4e..bc9069f9fd 100644
--- a/include/hw/char/cmsdk-apb-uart.h
+++ b/include/hw/char/cmsdk-apb-uart.h
@@ -62,11 +62,11 @@ static inline DeviceState *cmsdk_apb_uart_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, TYPE_CMSDK_APB_UART);
+ dev = qdev_new(TYPE_CMSDK_APB_UART);
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
qdev_prop_set_uint32(dev, "pclk-frq", pclk_frq);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, txint);
sysbus_connect_irq(s, 1, rxint);
diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
index 14187165c6..bed758350f 100644
--- a/include/hw/char/pl011.h
+++ b/include/hw/char/pl011.h
@@ -18,6 +18,7 @@
#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qapi/error.h"
#define TYPE_PL011 "pl011"
#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
@@ -57,10 +58,10 @@ static inline DeviceState *pl011_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, "pl011");
+ dev = qdev_new("pl011");
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, irq);
@@ -74,10 +75,10 @@ static inline DeviceState *pl011_luminary_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, "pl011_luminary");
+ dev = qdev_new("pl011_luminary");
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, irq);
diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h
index 194e2feafe..bb32d0fcb3 100644
--- a/include/hw/char/xilinx_uartlite.h
+++ b/include/hw/char/xilinx_uartlite.h
@@ -25,10 +25,10 @@ static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, "xlnx.xps-uartlite");
+ dev = qdev_new("xlnx.xps-uartlite");
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, irq);
diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h
index 403e7f95e6..9e99380e0c 100644
--- a/include/hw/cris/etraxfs.h
+++ b/include/hw/cris/etraxfs.h
@@ -41,10 +41,10 @@ static inline DeviceState *etraxfs_ser_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, "etraxfs,serial");
+ dev = qdev_new("etraxfs,serial");
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, irq);
return dev;
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 02c2350274..52b61eed88 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -103,8 +103,9 @@ void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16);
IsaDma *isa_get_dma(ISABus *bus, int nchan);
MemoryRegion *isa_address_space(ISADevice *dev);
MemoryRegion *isa_address_space_io(ISADevice *dev);
-ISADevice *isa_create(ISABus *bus, const char *name);
-ISADevice *isa_try_create(ISABus *bus, const char *name);
+ISADevice *isa_new(const char *name);
+ISADevice *isa_try_new(const char *name);
+bool isa_realize_and_unref(ISADevice *dev, ISABus *bus, Error **errp);
ISADevice *isa_create_simple(ISABus *bus, const char *name);
ISADevice *isa_vga_init(ISABus *bus);
diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h
index a539a98c4b..15a8973517 100644
--- a/include/hw/misc/auxbus.h
+++ b/include/hw/misc/auxbus.h
@@ -84,14 +84,21 @@ struct AUXSlave {
};
/**
- * aux_init_bus: Initialize an AUX bus.
+ * aux_bus_init: Initialize an AUX bus.
*
* Returns the new AUX bus created.
*
* @parent The device where this bus is located.
* @name The name of the bus.
*/
-AUXBus *aux_init_bus(DeviceState *parent, const char *name);
+AUXBus *aux_bus_init(DeviceState *parent, const char *name);
+
+/**
+ * aux_bus_realize: Realize an AUX bus.
+ *
+ * @bus: The AUX bus.
+ */
+void aux_bus_realize(AUXBus *bus);
/*
* aux_request: Make a request on the bus.
@@ -124,13 +131,6 @@ I2CBus *aux_get_i2c_bus(AUXBus *bus);
*/
void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio);
-/* aux_create_slave: Create a new device on an AUX bus
- *
- * @bus The AUX bus for the new device.
- * @name The type of the device to be created.
- */
-DeviceState *aux_create_slave(AUXBus *bus, const char *name);
-
/* aux_map_slave: Map the mmio for an AUX slave on the bus.
*
* @dev The AUX slave.
diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h
index 44d87be903..4c1d13c9bf 100644
--- a/include/hw/misc/unimp.h
+++ b/include/hw/misc/unimp.h
@@ -10,6 +10,7 @@
#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
+#include "qapi/error.h"
#define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
@@ -40,11 +41,11 @@ static inline void create_unimplemented_device(const char *name,
hwaddr base,
hwaddr size)
{
- DeviceState *dev = qdev_create(NULL, TYPE_UNIMPLEMENTED_DEVICE);
+ DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE);
qdev_prop_set_string(dev, "name", name);
qdev_prop_set_uint64(dev, "size", size);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(dev), 0, base, -1000);
}
diff --git a/include/hw/net/ne2000-isa.h b/include/hw/net/ne2000-isa.h
index eef17a680d..af59ee0b02 100644
--- a/include/hw/net/ne2000-isa.h
+++ b/include/hw/net/ne2000-isa.h
@@ -13,6 +13,7 @@
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
#include "net/net.h"
+#include "qapi/error.h"
#define TYPE_ISA_NE2000 "ne2k_isa"
@@ -23,14 +24,14 @@ static inline ISADevice *isa_ne2000_init(ISABus *bus, int base, int irq,
qemu_check_nic_model(nd, "ne2k_isa");
- d = isa_try_create(bus, TYPE_ISA_NE2000);
+ d = isa_try_new(TYPE_ISA_NE2000);
if (d) {
DeviceState *dev = DEVICE(d);
qdev_prop_set_uint32(dev, "iobase", base);
qdev_prop_set_uint32(dev, "irq", irq);
qdev_set_nic_properties(dev, nd);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(d, bus, &error_fatal);
}
return d;
}
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index cfedf5a995..a4e9c33416 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -712,12 +712,14 @@ pci_get_quad_by_mask(uint8_t *config, uint64_t mask)
return (val & mask) >> ctz32(mask);
}
-PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
+PCIDevice *pci_new_multifunction(int devfn, bool multifunction,
const char *name);
+PCIDevice *pci_new(int devfn, const char *name);
+bool pci_realize_and_unref(PCIDevice *dev, PCIBus *bus, Error **errp);
+
PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
bool multifunction,
const char *name);
-PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name);
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
void lsi53c8xx_handle_legacy_cmdline(DeviceState *lsi_dev);
diff --git a/include/hw/ppc/pnv_psi.h b/include/hw/ppc/pnv_psi.h
index f0f5b55197..979fc59f33 100644
--- a/include/hw/ppc/pnv_psi.h
+++ b/include/hw/ppc/pnv_psi.h
@@ -31,7 +31,7 @@
#define PSIHB_XSCOM_MAX 0x20
typedef struct PnvPsi {
- SysBusDevice parent;
+ DeviceState parent;
MemoryRegion regs_mr;
uint64_t bar;
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index b870b27966..7dc10be46f 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -57,7 +57,7 @@ typedef void (*BusUnrealize)(BusState *bus);
* After successful realization, setting static properties will fail.
*
* As an interim step, the #DeviceState:realized property can also be
- * set with qdev_init_nofail().
+ * set with qdev_realize().
* In the future, devices will propagate this state change to their children
* and along busses they expose.
* The point in time will be deferred to machine creation, so that values
@@ -320,9 +320,11 @@ compat_props_add(GPtrArray *arr,
/*** Board API. This should go away once we have a machine config file. ***/
-DeviceState *qdev_create(BusState *bus, const char *name);
-DeviceState *qdev_try_create(BusState *bus, const char *name);
-void qdev_init_nofail(DeviceState *dev);
+DeviceState *qdev_new(const char *name);
+DeviceState *qdev_try_new(const char *name);
+bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp);
+bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp);
+void qdev_unrealize(DeviceState *dev);
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
int required_for_version);
HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev);
@@ -411,6 +413,9 @@ typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque);
void qbus_create_inplace(void *bus, size_t size, const char *typename,
DeviceState *parent, const char *name);
BusState *qbus_create(const char *typename, DeviceState *parent, const char *name);
+bool qbus_realize(BusState *bus, Error **errp);
+void qbus_unrealize(BusState *bus);
+
/* Returns > 0 if either devfn or busfn skip walk somewhere in cursion,
* < 0 if either devfn or busfn terminate walk somewhere in cursion,
* 0 otherwise. */
diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h
index 414992119e..d386ea9223 100644
--- a/include/hw/riscv/sifive_e.h
+++ b/include/hw/riscv/sifive_e.h
@@ -29,7 +29,7 @@
typedef struct SiFiveESoCState {
/*< private >*/
- SysBusDevice parent_obj;
+ DeviceState parent_obj;
/*< public >*/
RISCVHartArrayState cpus;
diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h
index 16c297ec5f..5f62cf5f85 100644
--- a/include/hw/riscv/sifive_u.h
+++ b/include/hw/riscv/sifive_u.h
@@ -31,7 +31,7 @@
typedef struct SiFiveUSoCState {
/*< private >*/
- SysBusDevice parent_obj;
+ DeviceState parent_obj;
/*< public >*/
CPUClusterState e_cluster;
diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index c6868c9699..5d9275f3d6 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -74,6 +74,7 @@ typedef struct SDHCIState {
uint16_t acmd12errsts; /* Auto CMD12 error status register */
uint16_t hostctl2; /* Host Control 2 */
uint64_t admasysaddr; /* ADMA System Address Register */
+ uint16_t vendor_spec; /* Vendor specific register */
/* Read-only registers */
uint64_t capareg; /* Capabilities Register */
@@ -96,8 +97,12 @@ typedef struct SDHCIState {
uint32_t quirks;
uint8_t sd_spec_version;
uint8_t uhs_mode;
+ uint8_t vendor; /* For vendor specific functionality */
} SDHCIState;
+#define SDHCI_VENDOR_NONE 0
+#define SDHCI_VENDOR_IMX 1
+
/*
* Controller does not provide transfer-complete interrupt when not
* busy.
diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h
index 1107cb89ee..93f2b8b0be 100644
--- a/include/hw/ssi/ssi.h
+++ b/include/hw/ssi/ssi.h
@@ -79,17 +79,12 @@ extern const VMStateDescription vmstate_ssi_slave;
}
DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
-DeviceState *ssi_create_slave_no_init(SSIBus *bus, const char *name);
/* Master interface. */
SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
-/* Automatically connect all children nodes a spi controller as slaves */
-void ssi_auto_connect_slaves(DeviceState *parent, qemu_irq *cs_lines,
- SSIBus *bus);
-
/* max111x.c */
void max111x_set_input(DeviceState *dev, int line, uint8_t value);
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index c4a1c0adfa..da9f85c58c 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -90,22 +90,8 @@ void sysbus_add_io(SysBusDevice *dev, hwaddr addr,
MemoryRegion *mem);
MemoryRegion *sysbus_address_space(SysBusDevice *dev);
-/**
- * sysbus_init_child_obj:
- * @parent: The parent object
- * @childname: Used as name of the "child<>" property in the parent
- * @child: A pointer to the memory to be used for the object.
- * @childsize: The maximum size available at @child for the object.
- * @childtype: The name of the type of the object to instantiate.
- *
- * This function will initialize an object and attach it to the main system
- * bus. The memory for the object should have already been allocated. The
- * object will then be added as child to the given parent. The returned object
- * has a reference count of 1 (for the "child<...>" property from the parent),
- * so the object will be finalized automatically when the parent gets removed.
- */
-void sysbus_init_child_obj(Object *parent, const char *childname, void *child,
- size_t childsize, const char *childtype);
+bool sysbus_realize(SysBusDevice *dev, Error **errp);
+bool sysbus_realize_and_unref(SysBusDevice *dev, Error **errp);
/* Call func for every dynamically created sysbus device in the system */
void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque);
@@ -121,5 +107,4 @@ static inline DeviceState *sysbus_create_simple(const char *name,
return sysbus_create_varargs(name, addr, irq, NULL);
}
-
#endif /* HW_SYSBUS_H */
diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h
index e93caccc3c..f24bda6a46 100644
--- a/include/hw/timer/cmsdk-apb-timer.h
+++ b/include/hw/timer/cmsdk-apb-timer.h
@@ -48,10 +48,10 @@ static inline DeviceState *cmsdk_apb_timer_create(hwaddr addr,
DeviceState *dev;
SysBusDevice *s;
- dev = qdev_create(NULL, TYPE_CMSDK_APB_TIMER);
+ dev = qdev_new(TYPE_CMSDK_APB_TIMER);
s = SYS_BUS_DEVICE(dev);
qdev_prop_set_uint32(dev, "pclk-frq", pclk_frq);
- qdev_init_nofail(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, addr);
sysbus_connect_irq(s, 0, timerint);
return dev;
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 45cb42571f..e75b4a5a08 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -27,6 +27,7 @@
#include "hw/qdev-properties.h"
#include "hw/isa/isa.h"
+#include "qapi/error.h"
#define PIT_FREQ 1193182
@@ -54,10 +55,10 @@ static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
DeviceState *dev;
ISADevice *d;
- d = isa_create(bus, TYPE_I8254);
+ d = isa_new(TYPE_I8254);
dev = DEVICE(d);
qdev_prop_set_uint32(dev, "iobase", base);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(d, bus, &error_fatal);
qdev_connect_gpio_out(dev, 0,
isa_irq >= 0 ? isa_get_irq(d, isa_irq) : alt_irq);
@@ -69,10 +70,10 @@ static inline ISADevice *kvm_pit_init(ISABus *bus, int base)
DeviceState *dev;
ISADevice *d;
- d = isa_create(bus, TYPE_KVM_I8254);
+ d = isa_new(TYPE_KVM_I8254);
dev = DEVICE(d);
qdev_prop_set_uint32(dev, "iobase", base);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(d, bus, &error_fatal);
return d;
}
diff --git a/include/hw/usb.h b/include/hw/usb.h
index e2128c7c45..e29a37635b 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -502,9 +502,9 @@ void usb_bus_new(USBBus *bus, size_t bus_size,
void usb_bus_release(USBBus *bus);
USBBus *usb_bus_find(int busnr);
void usb_legacy_register(const char *typename, const char *usbdevice_name,
- USBDevice *(*usbdevice_init)(USBBus *bus,
- const char *params));
-USBDevice *usb_create(USBBus *bus, const char *name);
+ USBDevice *(*usbdevice_init)(const char *params));
+USBDevice *usb_new(const char *name);
+bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp);
USBDevice *usb_create_simple(USBBus *bus, const char *name);
USBDevice *usbdevice_create(const char *cmdline);
void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,
diff --git a/include/qom/object.h b/include/qom/object.h
index c7c97ead60..94a61ccc3f 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -781,7 +781,7 @@ int object_set_propv(Object *obj,
void object_initialize(void *obj, size_t size, const char *typename);
/**
- * object_initialize_child:
+ * object_initialize_child_with_props:
* @parentobj: The parent object to add a property to
* @propname: The name of the property
* @childobj: A pointer to the memory to be used for the object.
@@ -801,12 +801,13 @@ void object_initialize(void *obj, size_t size, const char *typename);
* If the object implements the user creatable interface, the object will
* be marked complete once all the properties have been processed.
*/
-void object_initialize_child(Object *parentobj, const char *propname,
+void object_initialize_child_with_props(Object *parentobj,
+ const char *propname,
void *childobj, size_t size, const char *type,
Error **errp, ...) QEMU_SENTINEL;
/**
- * object_initialize_childv:
+ * object_initialize_child_with_propsv:
* @parentobj: The parent object to add a property to
* @propname: The name of the property
* @childobj: A pointer to the memory to be used for the object.
@@ -817,11 +818,32 @@ void object_initialize_child(Object *parentobj, const char *propname,
*
* See object_initialize_child() for documentation.
*/
-void object_initialize_childv(Object *parentobj, const char *propname,
+void object_initialize_child_with_propsv(Object *parentobj,
+ const char *propname,
void *childobj, size_t size, const char *type,
Error **errp, va_list vargs);
/**
+ * object_initialize_child:
+ * @parent: The parent object to add a property to
+ * @propname: The name of the property
+ * @child: A precisely typed pointer to the memory to be used for the
+ * object.
+ * @type: The name of the type of the object to instantiate.
+ *
+ * This is like
+ * object_initialize_child_with_props(parent, propname,
+ * child, sizeof(*child), type,
+ * &error_abort, NULL)
+ */
+#define object_initialize_child(parent, propname, child, type) \
+ object_initialize_child_internal((parent), (propname), \
+ (child), sizeof(*(child)), (type))
+void object_initialize_child_internal(Object *parent, const char *propname,
+ void *child, size_t size,
+ const char *type);
+
+/**
* object_dynamic_cast:
* @obj: The object to cast.
* @typename: The @typename to cast to.
@@ -1404,7 +1426,7 @@ Object *object_get_internal_root(void);
* path is the path within the composition tree starting from the root.
* %NULL if the object doesn't have a parent (and thus a canonical path).
*/
-char *object_get_canonical_path_component(Object *obj);
+char *object_get_canonical_path_component(const Object *obj);
/**
* object_get_canonical_path:
@@ -1412,7 +1434,7 @@ char *object_get_canonical_path_component(Object *obj);
* Returns: The canonical path for a object. This is the path within the
* composition tree starting from the root.
*/
-char *object_get_canonical_path(Object *obj);
+char *object_get_canonical_path(const Object *obj);
/**
* object_resolve_path: