qdev: Convert uses of qdev_create() manually
Same transformation as in the previous commit. Manual, because convincing Coccinelle to transform these cases is somewhere between not worthwhile and infeasible (at least for me). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-11-armbru@redhat.com>
This commit is contained in:
parent
3e80f6902c
commit
df70796916
@ -311,20 +311,20 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
|||||||
|
|
||||||
switch (machine_id) {
|
switch (machine_id) {
|
||||||
case CALXEDA_HIGHBANK:
|
case CALXEDA_HIGHBANK:
|
||||||
dev = qdev_create(NULL, "l2x0");
|
dev = qdev_new("l2x0");
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
busdev = SYS_BUS_DEVICE(dev);
|
busdev = SYS_BUS_DEVICE(dev);
|
||||||
sysbus_mmio_map(busdev, 0, 0xfff12000);
|
sysbus_mmio_map(busdev, 0, 0xfff12000);
|
||||||
|
|
||||||
dev = qdev_create(NULL, TYPE_A9MPCORE_PRIV);
|
dev = qdev_new(TYPE_A9MPCORE_PRIV);
|
||||||
break;
|
break;
|
||||||
case CALXEDA_MIDWAY:
|
case CALXEDA_MIDWAY:
|
||||||
dev = qdev_create(NULL, TYPE_A15MPCORE_PRIV);
|
dev = qdev_new(TYPE_A15MPCORE_PRIV);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
|
qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
|
||||||
qdev_prop_set_uint32(dev, "num-irq", NIRQ_GIC);
|
qdev_prop_set_uint32(dev, "num-irq", NIRQ_GIC);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
busdev = SYS_BUS_DEVICE(dev);
|
busdev = SYS_BUS_DEVICE(dev);
|
||||||
sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE);
|
sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE);
|
||||||
for (n = 0; n < smp_cpus; n++) {
|
for (n = 0; n < smp_cpus; n++) {
|
||||||
@ -338,17 +338,17 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
|||||||
pic[n] = qdev_get_gpio_in(dev, n);
|
pic[n] = qdev_get_gpio_in(dev, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = qdev_create(NULL, "sp804");
|
dev = qdev_new("sp804");
|
||||||
qdev_prop_set_uint32(dev, "freq0", 150000000);
|
qdev_prop_set_uint32(dev, "freq0", 150000000);
|
||||||
qdev_prop_set_uint32(dev, "freq1", 150000000);
|
qdev_prop_set_uint32(dev, "freq1", 150000000);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
busdev = SYS_BUS_DEVICE(dev);
|
busdev = SYS_BUS_DEVICE(dev);
|
||||||
sysbus_mmio_map(busdev, 0, 0xfff34000);
|
sysbus_mmio_map(busdev, 0, 0xfff34000);
|
||||||
sysbus_connect_irq(busdev, 0, pic[18]);
|
sysbus_connect_irq(busdev, 0, pic[18]);
|
||||||
pl011_create(0xfff36000, pic[20], serial_hd(0));
|
pl011_create(0xfff36000, pic[20], serial_hd(0));
|
||||||
|
|
||||||
dev = qdev_create(NULL, TYPE_HIGHBANK_REGISTERS);
|
dev = qdev_new(TYPE_HIGHBANK_REGISTERS);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
busdev = SYS_BUS_DEVICE(dev);
|
busdev = SYS_BUS_DEVICE(dev);
|
||||||
sysbus_mmio_map(busdev, 0, 0xfff3c000);
|
sysbus_mmio_map(busdev, 0, 0xfff3c000);
|
||||||
|
|
||||||
@ -363,18 +363,18 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
|||||||
|
|
||||||
if (nd_table[0].used) {
|
if (nd_table[0].used) {
|
||||||
qemu_check_nic_model(&nd_table[0], "xgmac");
|
qemu_check_nic_model(&nd_table[0], "xgmac");
|
||||||
dev = qdev_create(NULL, "xgmac");
|
dev = qdev_new("xgmac");
|
||||||
qdev_set_nic_properties(dev, &nd_table[0]);
|
qdev_set_nic_properties(dev, &nd_table[0]);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff50000);
|
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff50000);
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[77]);
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[77]);
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[78]);
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[78]);
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 2, pic[79]);
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 2, pic[79]);
|
||||||
|
|
||||||
qemu_check_nic_model(&nd_table[1], "xgmac");
|
qemu_check_nic_model(&nd_table[1], "xgmac");
|
||||||
dev = qdev_create(NULL, "xgmac");
|
dev = qdev_new("xgmac");
|
||||||
qdev_set_nic_properties(dev, &nd_table[1]);
|
qdev_set_nic_properties(dev, &nd_table[1]);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff51000);
|
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff51000);
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[80]);
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[80]);
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[81]);
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[81]);
|
||||||
|
@ -211,7 +211,7 @@ static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms,
|
|||||||
* Create a single flash device. We use the same parameters as
|
* Create a single flash device. We use the same parameters as
|
||||||
* the flash devices on the Versatile Express board.
|
* the flash devices on the Versatile Express board.
|
||||||
*/
|
*/
|
||||||
DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
|
||||||
|
|
||||||
qdev_prop_set_uint64(dev, "sector-length", SBSA_FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint64(dev, "sector-length", SBSA_FLASH_SECTOR_SIZE);
|
||||||
qdev_prop_set_uint8(dev, "width", 4);
|
qdev_prop_set_uint8(dev, "width", 4);
|
||||||
@ -243,7 +243,7 @@ static void sbsa_flash_map1(PFlashCFI01 *flash,
|
|||||||
assert(QEMU_IS_ALIGNED(size, SBSA_FLASH_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(size, SBSA_FLASH_SECTOR_SIZE));
|
||||||
assert(size / SBSA_FLASH_SECTOR_SIZE <= UINT32_MAX);
|
assert(size / SBSA_FLASH_SECTOR_SIZE <= UINT32_MAX);
|
||||||
qdev_prop_set_uint32(dev, "num-blocks", size / SBSA_FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint32(dev, "num-blocks", size / SBSA_FLASH_SECTOR_SIZE);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
|
|
||||||
memory_region_add_subregion(sysmem, base,
|
memory_region_add_subregion(sysmem, base,
|
||||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
|
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
|
||||||
|
@ -948,7 +948,7 @@ static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms,
|
|||||||
* Create a single flash device. We use the same parameters as
|
* Create a single flash device. We use the same parameters as
|
||||||
* the flash devices on the Versatile Express board.
|
* the flash devices on the Versatile Express board.
|
||||||
*/
|
*/
|
||||||
DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
|
||||||
|
|
||||||
qdev_prop_set_uint64(dev, "sector-length", VIRT_FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint64(dev, "sector-length", VIRT_FLASH_SECTOR_SIZE);
|
||||||
qdev_prop_set_uint8(dev, "width", 4);
|
qdev_prop_set_uint8(dev, "width", 4);
|
||||||
@ -980,7 +980,7 @@ static void virt_flash_map1(PFlashCFI01 *flash,
|
|||||||
assert(QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE));
|
||||||
assert(size / VIRT_FLASH_SECTOR_SIZE <= UINT32_MAX);
|
assert(size / VIRT_FLASH_SECTOR_SIZE <= UINT32_MAX);
|
||||||
qdev_prop_set_uint32(dev, "num-blocks", size / VIRT_FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint32(dev, "num-blocks", size / VIRT_FLASH_SECTOR_SIZE);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
|
|
||||||
memory_region_add_subregion(sysmem, base,
|
memory_region_add_subregion(sysmem, base,
|
||||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
|
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
|
||||||
|
@ -937,7 +937,7 @@ static void xen_block_device_create(XenBackendInstance *backend,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
xendev = XEN_DEVICE(qdev_create(BUS(xenbus), type));
|
xendev = XEN_DEVICE(qdev_new(type));
|
||||||
blockdev = XEN_BLOCK_DEVICE(xendev);
|
blockdev = XEN_BLOCK_DEVICE(xendev);
|
||||||
|
|
||||||
object_property_set_str(OBJECT(xendev), vdev, "vdev", &local_err);
|
object_property_set_str(OBJECT(xendev), vdev, "vdev", &local_err);
|
||||||
@ -965,7 +965,7 @@ static void xen_block_device_create(XenBackendInstance *backend,
|
|||||||
blockdev->iothread = iothread;
|
blockdev->iothread = iothread;
|
||||||
blockdev->drive = drive;
|
blockdev->drive = drive;
|
||||||
|
|
||||||
object_property_set_bool(OBJECT(xendev), true, "realized", &local_err);
|
qdev_realize_and_unref(DEVICE(xendev), BUS(xenbus), &local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate_prepend(errp, local_err,
|
error_propagate_prepend(errp, local_err,
|
||||||
"realization of device %s failed: ",
|
"realization of device %s failed: ",
|
||||||
|
@ -1127,7 +1127,7 @@ SerialMM *serial_mm_init(MemoryRegion *address_space,
|
|||||||
qemu_irq irq, int baudbase,
|
qemu_irq irq, int baudbase,
|
||||||
Chardev *chr, enum device_endian end)
|
Chardev *chr, enum device_endian end)
|
||||||
{
|
{
|
||||||
SerialMM *smm = SERIAL_MM(qdev_create(NULL, TYPE_SERIAL_MM));
|
SerialMM *smm = SERIAL_MM(qdev_new(TYPE_SERIAL_MM));
|
||||||
MemoryRegion *mr;
|
MemoryRegion *mr;
|
||||||
|
|
||||||
qdev_prop_set_uint8(DEVICE(smm), "regshift", regshift);
|
qdev_prop_set_uint8(DEVICE(smm), "regshift", regshift);
|
||||||
@ -1135,7 +1135,7 @@ SerialMM *serial_mm_init(MemoryRegion *address_space,
|
|||||||
qdev_prop_set_chr(DEVICE(smm), "chardev", chr);
|
qdev_prop_set_chr(DEVICE(smm), "chardev", chr);
|
||||||
qdev_set_legacy_instance_id(DEVICE(smm), base, 2);
|
qdev_set_legacy_instance_id(DEVICE(smm), base, 2);
|
||||||
qdev_prop_set_uint8(DEVICE(smm), "endianness", end);
|
qdev_prop_set_uint8(DEVICE(smm), "endianness", end);
|
||||||
qdev_init_nofail(DEVICE(smm));
|
qdev_realize_and_unref(DEVICE(smm), NULL, &error_fatal);
|
||||||
|
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, irq);
|
sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, irq);
|
||||||
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(smm), 0);
|
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(smm), 0);
|
||||||
|
@ -933,10 +933,9 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
|
|||||||
/* ddc, edid */
|
/* ddc, edid */
|
||||||
I2CBus *i2cbus = i2c_init_bus(DEVICE(s), "ati-vga.ddc");
|
I2CBus *i2cbus = i2c_init_bus(DEVICE(s), "ati-vga.ddc");
|
||||||
bitbang_i2c_init(&s->bbi2c, i2cbus);
|
bitbang_i2c_init(&s->bbi2c, i2cbus);
|
||||||
I2CSlave *i2cddc = I2C_SLAVE(qdev_create(BUS(i2cbus), TYPE_I2CDDC));
|
I2CSlave *i2cddc = I2C_SLAVE(qdev_new(TYPE_I2CDDC));
|
||||||
i2c_set_slave_address(i2cddc, 0x50);
|
i2c_set_slave_address(i2cddc, 0x50);
|
||||||
object_property_set_bool(OBJECT(i2cddc), true, "realized",
|
qdev_realize_and_unref(DEVICE(i2cddc), BUS(i2cbus), &error_abort);
|
||||||
&error_abort);
|
|
||||||
|
|
||||||
/* mmio register space */
|
/* mmio register space */
|
||||||
memory_region_init_io(&s->mm, OBJECT(s), &ati_mm_ops, s,
|
memory_region_init_io(&s->mm, OBJECT(s), &ati_mm_ops, s,
|
||||||
|
@ -1831,10 +1831,9 @@ static void sm501_init(SM501State *s, DeviceState *dev,
|
|||||||
/* i2c */
|
/* i2c */
|
||||||
s->i2c_bus = i2c_init_bus(dev, "sm501.i2c");
|
s->i2c_bus = i2c_init_bus(dev, "sm501.i2c");
|
||||||
/* ddc */
|
/* ddc */
|
||||||
I2CDDCState *ddc = I2CDDC(qdev_create(BUS(s->i2c_bus), TYPE_I2CDDC));
|
I2CDDCState *ddc = I2CDDC(qdev_new(TYPE_I2CDDC));
|
||||||
i2c_set_slave_address(I2C_SLAVE(ddc), 0x50);
|
i2c_set_slave_address(I2C_SLAVE(ddc), 0x50);
|
||||||
object_property_set_bool(OBJECT(ddc), true, "realized",
|
qdev_realize_and_unref(DEVICE(ddc), BUS(s->i2c_bus), &error_abort);
|
||||||
&error_abort);
|
|
||||||
|
|
||||||
/* mmio */
|
/* mmio */
|
||||||
memory_region_init(&s->mmio_region, OBJECT(dev), "sm501.mmio", MMIO_SIZE);
|
memory_region_init(&s->mmio_region, OBJECT(dev), "sm501.mmio", MMIO_SIZE);
|
||||||
|
@ -1252,7 +1252,7 @@ static void xlnx_dp_init(Object *obj)
|
|||||||
s->dpcd = DPCD(aux_create_slave(s->aux_bus, "dpcd"));
|
s->dpcd = DPCD(aux_create_slave(s->aux_bus, "dpcd"));
|
||||||
object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd));
|
object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd));
|
||||||
|
|
||||||
s->edid = I2CDDC(qdev_create(BUS(aux_get_i2c_bus(s->aux_bus)), "i2c-ddc"));
|
s->edid = I2CDDC(qdev_new("i2c-ddc"));
|
||||||
i2c_set_slave_address(I2C_SLAVE(s->edid), 0x50);
|
i2c_set_slave_address(I2C_SLAVE(s->edid), 0x50);
|
||||||
object_property_add_child(OBJECT(s), "edid", OBJECT(s->edid));
|
object_property_add_child(OBJECT(s), "edid", OBJECT(s->edid));
|
||||||
|
|
||||||
@ -1271,7 +1271,8 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp)
|
|||||||
qdev_init_nofail(DEVICE(s->dpcd));
|
qdev_init_nofail(DEVICE(s->dpcd));
|
||||||
aux_map_slave(AUX_SLAVE(s->dpcd), 0x0000);
|
aux_map_slave(AUX_SLAVE(s->dpcd), 0x0000);
|
||||||
|
|
||||||
qdev_init_nofail(DEVICE(s->edid));
|
qdev_realize_and_unref(DEVICE(s->edid), BUS(aux_get_i2c_bus(s->aux_bus)),
|
||||||
|
&error_fatal);
|
||||||
|
|
||||||
s->console = graphic_console_init(dev, 0, &xlnx_dp_gfx_ops, s);
|
s->console = graphic_console_init(dev, 0, &xlnx_dp_gfx_ops, s);
|
||||||
surface = qemu_console_surface(s->console);
|
surface = qemu_console_surface(s->console);
|
||||||
|
@ -1205,7 +1205,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
|||||||
* when the HPET wants to take over. Thus we have to disable the latter.
|
* when the HPET wants to take over. Thus we have to disable the latter.
|
||||||
*/
|
*/
|
||||||
if (!no_hpet && (!kvm_irqchip_in_kernel() || kvm_has_pit_state2())) {
|
if (!no_hpet && (!kvm_irqchip_in_kernel() || kvm_has_pit_state2())) {
|
||||||
hpet = qdev_try_create(NULL, TYPE_HPET);
|
hpet = qdev_try_new(TYPE_HPET);
|
||||||
if (hpet) {
|
if (hpet) {
|
||||||
/* For pc-piix-*, hpet's intcap is always IRQ2. For pc-q35-1.7
|
/* For pc-piix-*, hpet's intcap is always IRQ2. For pc-q35-1.7
|
||||||
* and earlier, use IRQ2 for compat. Otherwise, use IRQ16~23,
|
* and earlier, use IRQ2 for compat. Otherwise, use IRQ16~23,
|
||||||
@ -1216,7 +1216,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
|||||||
if (!compat) {
|
if (!compat) {
|
||||||
qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
|
qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
|
||||||
}
|
}
|
||||||
qdev_init_nofail(hpet);
|
qdev_realize_and_unref(hpet, NULL, &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE);
|
sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE);
|
||||||
|
|
||||||
for (i = 0; i < GSI_NUM_PINS; i++) {
|
for (i = 0; i < GSI_NUM_PINS; i++) {
|
||||||
|
@ -85,7 +85,7 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms,
|
|||||||
const char *name,
|
const char *name,
|
||||||
const char *alias_prop_name)
|
const char *alias_prop_name)
|
||||||
{
|
{
|
||||||
DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
|
||||||
|
|
||||||
qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE);
|
||||||
qdev_prop_set_uint8(dev, "width", 1);
|
qdev_prop_set_uint8(dev, "width", 1);
|
||||||
@ -187,7 +187,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
|
|||||||
total_size += size;
|
total_size += size;
|
||||||
qdev_prop_set_uint32(DEVICE(system_flash), "num-blocks",
|
qdev_prop_set_uint32(DEVICE(system_flash), "num-blocks",
|
||||||
size / FLASH_SECTOR_SIZE);
|
size / FLASH_SECTOR_SIZE);
|
||||||
qdev_init_nofail(DEVICE(system_flash));
|
qdev_realize_and_unref(DEVICE(system_flash), NULL, &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(system_flash), 0,
|
sysbus_mmio_map(SYS_BUS_DEVICE(system_flash), 0,
|
||||||
0x100000000ULL - total_size);
|
0x100000000ULL - total_size);
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, bool pcie, Error **errp)
|
|||||||
bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS);
|
bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS);
|
||||||
} else {
|
} else {
|
||||||
bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS);
|
bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS);
|
||||||
bds = qdev_create(BUS(bus), "pci-bridge");
|
bds = qdev_new("pci-bridge");
|
||||||
bds->id = dev_name;
|
bds->id = dev_name;
|
||||||
qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
|
qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
|
||||||
qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
|
qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
|
||||||
@ -257,7 +257,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, bool pcie, Error **errp)
|
|||||||
|
|
||||||
qdev_realize_and_unref(ds, NULL, &error_fatal);
|
qdev_realize_and_unref(ds, NULL, &error_fatal);
|
||||||
if (bds) {
|
if (bds) {
|
||||||
qdev_init_nofail(bds);
|
qdev_realize_and_unref(bds, &bus->qbus, &error_fatal);
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_word_test_and_set_mask(dev->config + PCI_STATUS,
|
pci_word_test_and_set_mask(dev->config + PCI_STATUS,
|
||||||
|
@ -818,7 +818,7 @@ static void pnv_init(MachineState *machine)
|
|||||||
pnv->chips = g_new0(PnvChip *, pnv->num_chips);
|
pnv->chips = g_new0(PnvChip *, pnv->num_chips);
|
||||||
for (i = 0; i < pnv->num_chips; i++) {
|
for (i = 0; i < pnv->num_chips; i++) {
|
||||||
char chip_name[32];
|
char chip_name[32];
|
||||||
Object *chip = OBJECT(qdev_create(NULL, chip_typename));
|
Object *chip = OBJECT(qdev_new(chip_typename));
|
||||||
|
|
||||||
pnv->chips[i] = PNV_CHIP(chip);
|
pnv->chips[i] = PNV_CHIP(chip);
|
||||||
|
|
||||||
@ -850,7 +850,7 @@ static void pnv_init(MachineState *machine)
|
|||||||
object_property_set_link(chip, OBJECT(pnv), "xive-fabric",
|
object_property_set_link(chip, OBJECT(pnv), "xive-fabric",
|
||||||
&error_abort);
|
&error_abort);
|
||||||
}
|
}
|
||||||
object_property_set_bool(chip, true, "realized", &error_fatal);
|
qdev_realize_and_unref(DEVICE(chip), NULL, &error_fatal);
|
||||||
}
|
}
|
||||||
g_free(chip_typename);
|
g_free(chip_typename);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ static PFlashCFI01 *virt_flash_create1(RISCVVirtState *s,
|
|||||||
* Create a single flash device. We use the same parameters as
|
* Create a single flash device. We use the same parameters as
|
||||||
* the flash devices on the ARM virt board.
|
* the flash devices on the ARM virt board.
|
||||||
*/
|
*/
|
||||||
DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
|
||||||
|
|
||||||
qdev_prop_set_uint64(dev, "sector-length", VIRT_FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint64(dev, "sector-length", VIRT_FLASH_SECTOR_SIZE);
|
||||||
qdev_prop_set_uint8(dev, "width", 4);
|
qdev_prop_set_uint8(dev, "width", 4);
|
||||||
@ -114,7 +114,7 @@ static void virt_flash_map1(PFlashCFI01 *flash,
|
|||||||
assert(QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE));
|
||||||
assert(size / VIRT_FLASH_SECTOR_SIZE <= UINT32_MAX);
|
assert(size / VIRT_FLASH_SECTOR_SIZE <= UINT32_MAX);
|
||||||
qdev_prop_set_uint32(dev, "num-blocks", size / VIRT_FLASH_SECTOR_SIZE);
|
qdev_prop_set_uint32(dev, "num-blocks", size / VIRT_FLASH_SECTOR_SIZE);
|
||||||
qdev_init_nofail(dev);
|
qdev_realize_and_unref(dev, NULL, &error_fatal);
|
||||||
|
|
||||||
memory_region_add_subregion(sysmem, base,
|
memory_region_add_subregion(sysmem, base,
|
||||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
|
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
|
||||||
|
@ -824,7 +824,7 @@ static S390PCIBusDevice *s390_pci_device_new(S390pciState *s,
|
|||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
|
|
||||||
dev = qdev_try_create(BUS(s->bus), TYPE_S390_PCI_DEVICE);
|
dev = qdev_try_new(TYPE_S390_PCI_DEVICE);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
error_setg(errp, "zPCI device could not be created");
|
error_setg(errp, "zPCI device could not be created");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -837,7 +837,7 @@ static S390PCIBusDevice *s390_pci_device_new(S390pciState *s,
|
|||||||
"zPCI device could not be created: ");
|
"zPCI device could not be created: ");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
object_property_set_bool(OBJECT(dev), true, "realized", &local_err);
|
qdev_realize_and_unref(dev, BUS(s->bus), &local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
object_unparent(OBJECT(dev));
|
object_unparent(OBJECT(dev));
|
||||||
error_propagate_prepend(errp, local_err,
|
error_propagate_prepend(errp, local_err,
|
||||||
|
@ -213,15 +213,15 @@ static void leon3_generic_hw_init(MachineState *machine)
|
|||||||
reset_info->sp = LEON3_RAM_OFFSET + ram_size;
|
reset_info->sp = LEON3_RAM_OFFSET + ram_size;
|
||||||
qemu_register_reset(main_cpu_reset, reset_info);
|
qemu_register_reset(main_cpu_reset, reset_info);
|
||||||
|
|
||||||
ahb_pnp = GRLIB_AHB_PNP(qdev_create(NULL, TYPE_GRLIB_AHB_PNP));
|
ahb_pnp = GRLIB_AHB_PNP(qdev_new(TYPE_GRLIB_AHB_PNP));
|
||||||
object_property_set_bool(OBJECT(ahb_pnp), true, "realized", &error_fatal);
|
qdev_realize_and_unref(DEVICE(ahb_pnp), NULL, &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(ahb_pnp), 0, LEON3_AHB_PNP_OFFSET);
|
sysbus_mmio_map(SYS_BUS_DEVICE(ahb_pnp), 0, LEON3_AHB_PNP_OFFSET);
|
||||||
grlib_ahb_pnp_add_entry(ahb_pnp, 0, 0, GRLIB_VENDOR_GAISLER,
|
grlib_ahb_pnp_add_entry(ahb_pnp, 0, 0, GRLIB_VENDOR_GAISLER,
|
||||||
GRLIB_LEON3_DEV, GRLIB_AHB_MASTER,
|
GRLIB_LEON3_DEV, GRLIB_AHB_MASTER,
|
||||||
GRLIB_CPU_AREA);
|
GRLIB_CPU_AREA);
|
||||||
|
|
||||||
apb_pnp = GRLIB_APB_PNP(qdev_create(NULL, TYPE_GRLIB_APB_PNP));
|
apb_pnp = GRLIB_APB_PNP(qdev_new(TYPE_GRLIB_APB_PNP));
|
||||||
object_property_set_bool(OBJECT(apb_pnp), true, "realized", &error_fatal);
|
qdev_realize_and_unref(DEVICE(apb_pnp), NULL, &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(apb_pnp), 0, LEON3_APB_PNP_OFFSET);
|
sysbus_mmio_map(SYS_BUS_DEVICE(apb_pnp), 0, LEON3_APB_PNP_OFFSET);
|
||||||
grlib_ahb_pnp_add_entry(ahb_pnp, LEON3_APB_PNP_OFFSET, 0xFFF,
|
grlib_ahb_pnp_add_entry(ahb_pnp, LEON3_APB_PNP_OFFSET, 0xFFF,
|
||||||
GRLIB_VENDOR_GAISLER, GRLIB_APBMST_DEV,
|
GRLIB_VENDOR_GAISLER, GRLIB_APBMST_DEV,
|
||||||
|
@ -326,21 +326,21 @@ static USBDevice *usb_try_create_simple(USBBus *bus, const char *name,
|
|||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
USBDevice *dev;
|
DeviceState *dev;
|
||||||
|
|
||||||
dev = USB_DEVICE(qdev_try_create(&bus->qbus, name));
|
dev = qdev_try_new(name);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
error_setg(errp, "Failed to create USB device '%s'", name);
|
error_setg(errp, "Failed to create USB device '%s'", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
object_property_set_bool(OBJECT(dev), true, "realized", &err);
|
qdev_realize_and_unref(dev, &bus->qbus, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate_prepend(errp, err,
|
error_propagate_prepend(errp, err,
|
||||||
"Failed to initialize USB device '%s': ",
|
"Failed to initialize USB device '%s': ",
|
||||||
name);
|
name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return dev;
|
return USB_DEVICE(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
USBDevice *usb_create_simple(USBBus *bus, const char *name)
|
USBDevice *usb_create_simple(USBBus *bus, const char *name)
|
||||||
|
Loading…
Reference in New Issue
Block a user