aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/char/parallel-isa.c5
-rw-r--r--hw/char/serial-isa.c4
-rw-r--r--hw/dma/i8257.c9
-rw-r--r--hw/ide/isa.c5
-rw-r--r--hw/intc/i8259_common.c5
-rw-r--r--hw/isa/isa-bus.c4
-rw-r--r--hw/isa/isa-superio.c20
-rw-r--r--hw/ppc/prep.c26
-rw-r--r--hw/rtc/m48t59-isa.c7
-rw-r--r--hw/rtc/mc146818rtc.c4
-rw-r--r--hw/sparc64/sun4u.c6
11 files changed, 55 insertions, 40 deletions
diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c
index bcc577f61c..1ccbb96e70 100644
--- a/hw/char/parallel-isa.c
+++ b/hw/char/parallel-isa.c
@@ -14,17 +14,18 @@
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
#include "hw/char/parallel.h"
+#include "qapi/error.h"
static void parallel_init(ISABus *bus, int index, Chardev *chr)
{
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_create(bus, "isa-parallel");
+ isadev = isa_new("isa-parallel");
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "index", index);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isadev, bus, &error_fatal);
}
void parallel_hds_isa_init(ISABus *bus, int n)
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 165e320e65..d69aab5714 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -160,11 +160,11 @@ static void serial_isa_init(ISABus *bus, int index, Chardev *chr)
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_create(bus, TYPE_ISA_SERIAL);
+ isadev = isa_new(TYPE_ISA_SERIAL);
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "index", index);
qdev_prop_set_chr(dev, "chardev", chr);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isadev, bus, &error_fatal);
}
void serial_hds_isa_init(ISABus *bus, int from, int to)
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index 1b3435ab58..db808029b0 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -27,6 +27,7 @@
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "hw/dma/i8257.h"
+#include "qapi/error.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
#include "qemu/log.h"
@@ -638,21 +639,21 @@ void i8257_dma_init(ISABus *bus, bool high_page_enable)
ISADevice *isa1, *isa2;
DeviceState *d;
- isa1 = isa_create(bus, TYPE_I8257);
+ isa1 = isa_new(TYPE_I8257);
d = DEVICE(isa1);
qdev_prop_set_int32(d, "base", 0x00);
qdev_prop_set_int32(d, "page-base", 0x80);
qdev_prop_set_int32(d, "pageh-base", high_page_enable ? 0x480 : -1);
qdev_prop_set_int32(d, "dshift", 0);
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa1, bus, &error_fatal);
- isa2 = isa_create(bus, TYPE_I8257);
+ isa2 = isa_new(TYPE_I8257);
d = DEVICE(isa2);
qdev_prop_set_int32(d, "base", 0xc0);
qdev_prop_set_int32(d, "page-base", 0x88);
qdev_prop_set_int32(d, "pageh-base", high_page_enable ? 0x488 : -1);
qdev_prop_set_int32(d, "dshift", 1);
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa2, bus, &error_fatal);
isa_bus_dma(bus, ISADMA(isa1), ISADMA(isa2));
}
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 8395807b08..f28c8fba6c 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -27,6 +27,7 @@
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
+#include "qapi/error.h"
#include "qemu/module.h"
#include "sysemu/dma.h"
@@ -86,12 +87,12 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
ISADevice *isadev;
ISAIDEState *s;
- isadev = isa_create(bus, TYPE_ISA_IDE);
+ isadev = isa_new(TYPE_ISA_IDE);
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "iobase", iobase);
qdev_prop_set_uint32(dev, "iobase2", iobase2);
qdev_prop_set_uint32(dev, "irq", isairq);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isadev, bus, &error_fatal);
s = ISA_IDE(dev);
if (hd0) {
diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c
index 99f8f6abd5..d90b40fe4c 100644
--- a/hw/intc/i8259_common.c
+++ b/hw/intc/i8259_common.c
@@ -29,6 +29,7 @@
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "monitor/monitor.h"
+#include "qapi/error.h"
static int irq_level[16];
static uint64_t irq_count[16];
@@ -94,13 +95,13 @@ ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master)
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_create(bus, name);
+ isadev = isa_new(name);
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "iobase", master ? 0x20 : 0xa0);
qdev_prop_set_uint32(dev, "elcr_addr", master ? 0x4d0 : 0x4d1);
qdev_prop_set_uint8(dev, "elcr_mask", master ? 0xf8 : 0xde);
qdev_prop_set_bit(dev, "master", master);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isadev, bus, &error_fatal);
return isadev;
}
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index e6412d39b4..9a95ac3f96 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -190,8 +190,8 @@ ISADevice *isa_create_simple(ISABus *bus, const char *name)
{
ISADevice *dev;
- dev = isa_create(bus, name);
- qdev_init_nofail(DEVICE(dev));
+ dev = isa_new(name);
+ isa_realize_and_unref(dev, bus, &error_fatal);
return dev;
}
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 3dcdc234a4..d3d58f9f16 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -51,7 +51,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
} else {
name = g_strdup_printf("parallel%d", i);
}
- isa = isa_create(bus, "isa-parallel");
+ isa = isa_new("isa-parallel");
d = DEVICE(isa);
qdev_prop_set_uint32(d, "index", i);
if (k->parallel.get_iobase) {
@@ -63,7 +63,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
qdev_prop_set_chr(d, "chardev", chr);
object_property_add_child(OBJECT(dev), name, OBJECT(isa));
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->parallel[i] = isa;
trace_superio_create_parallel(i,
k->parallel.get_iobase ?
@@ -90,7 +90,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
} else {
name = g_strdup_printf("serial%d", i);
}
- isa = isa_create(bus, TYPE_ISA_SERIAL);
+ isa = isa_new(TYPE_ISA_SERIAL);
d = DEVICE(isa);
qdev_prop_set_uint32(d, "index", i);
if (k->serial.get_iobase) {
@@ -102,7 +102,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
qdev_prop_set_chr(d, "chardev", chr);
object_property_add_child(OBJECT(dev), name, OBJECT(isa));
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->serial[i] = isa;
trace_superio_create_serial(i,
k->serial.get_iobase ?
@@ -115,7 +115,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
/* Floppy disc */
if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) {
- isa = isa_create(bus, "isa-fdc");
+ isa = isa_new("isa-fdc");
d = DEVICE(isa);
if (k->floppy.get_iobase) {
qdev_prop_set_uint32(d, "iobase", k->floppy.get_iobase(sio, 0));
@@ -136,7 +136,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
&error_fatal);
}
object_property_add_child(OBJECT(sio), "isa-fdc", OBJECT(isa));
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->floppy = isa;
trace_superio_create_floppy(0,
k->floppy.get_iobase ?
@@ -146,14 +146,14 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
/* Keyboard, mouse */
- isa = isa_create(bus, TYPE_I8042);
+ isa = isa_new(TYPE_I8042);
object_property_add_child(OBJECT(sio), TYPE_I8042, OBJECT(isa));
- qdev_init_nofail(DEVICE(isa));
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->kbc = isa;
/* IDE */
if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) {
- isa = isa_create(bus, "isa-ide");
+ isa = isa_new("isa-ide");
d = DEVICE(isa);
if (k->ide.get_iobase) {
qdev_prop_set_uint32(d, "iobase", k->ide.get_iobase(sio, 0));
@@ -164,7 +164,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
if (k->ide.get_irq) {
qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
}
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
object_property_add_child(OBJECT(sio), "isa-ide", OBJECT(isa));
sio->ide = isa;
trace_superio_create_ide(0,
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index c7af0e16c3..73a40b2cbe 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -244,6 +244,7 @@ static void ibm_40p_init(MachineState *machine)
SysBusDevice *pcihost, *s;
Nvram *m48t59 = NULL;
PCIBus *pci_bus;
+ ISADevice *isa_dev;
ISABus *isa_bus;
void *fw_cfg;
int i;
@@ -292,14 +293,16 @@ static void ibm_40p_init(MachineState *machine)
isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0"));
/* Memory controller */
- dev = DEVICE(isa_create(isa_bus, "rs6000-mc"));
+ isa_dev = isa_new("rs6000-mc");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "ram-size", machine->ram_size);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
/* RTC */
- dev = DEVICE(isa_create(isa_bus, TYPE_MC146818_RTC));
+ isa_dev = isa_new(TYPE_MC146818_RTC);
+ dev = DEVICE(isa_dev);
qdev_prop_set_int32(dev, "base_year", 1900);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
/* initialize CMOS checksums */
cmos_checksum = 0x6aa9;
@@ -310,19 +313,22 @@ static void ibm_40p_init(MachineState *machine)
if (defaults_enabled()) {
m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59"));
- dev = DEVICE(isa_create(isa_bus, "cs4231a"));
+ isa_dev = isa_new("cs4231a");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "iobase", 0x830);
qdev_prop_set_uint32(dev, "irq", 10);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
- dev = DEVICE(isa_create(isa_bus, "pc87312"));
+ isa_dev = isa_new("pc87312");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "config", 12);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
- dev = DEVICE(isa_create(isa_bus, "prep-systemio"));
+ isa_dev = isa_new("prep-systemio");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "ibm-planar-id", 0xfc);
qdev_prop_set_uint32(dev, "equipment", 0xc0);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(1, 0),
"lsi53c810"));
diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c
index 131eb5b7d3..50430b7a85 100644
--- a/hw/rtc/m48t59-isa.c
+++ b/hw/rtc/m48t59-isa.c
@@ -28,6 +28,7 @@
#include "hw/qdev-properties.h"
#include "hw/rtc/m48t59.h"
#include "m48t59-internal.h"
+#include "qapi/error.h"
#include "qemu/module.h"
#define TYPE_M48TXX_ISA "isa-m48txx"
@@ -61,6 +62,7 @@ static M48txxInfo m48txx_isa_info[] = {
Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
int base_year, int model)
{
+ ISADevice *isa_dev;
DeviceState *dev;
int i;
@@ -70,10 +72,11 @@ Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
continue;
}
- dev = DEVICE(isa_create(bus, m48txx_isa_info[i].bus_name));
+ isa_dev = isa_new(m48txx_isa_info[i].bus_name);
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "iobase", io_base);
qdev_prop_set_int32(dev, "base-year", base_year);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, bus, &error_fatal);
return NVRAM(dev);
}
diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
index 1e9fa0f33f..7a38540cb9 100644
--- a/hw/rtc/mc146818rtc.c
+++ b/hw/rtc/mc146818rtc.c
@@ -974,10 +974,10 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_create(bus, TYPE_MC146818_RTC);
+ isadev = isa_new(TYPE_MC146818_RTC);
dev = DEVICE(isadev);
qdev_prop_set_int32(dev, "base_year", base_year);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isadev, bus, &error_fatal);
if (intercept_irq) {
qdev_connect_gpio_out(dev, 0, intercept_irq);
} else {
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 0b898d6e3d..8470c33f99 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -300,6 +300,7 @@ static void ebus_isa_irq_handler(void *opaque, int n, int level)
static void ebus_realize(PCIDevice *pci_dev, Error **errp)
{
EbusState *s = EBUS(pci_dev);
+ ISADevice *isa_dev;
SysBusDevice *sbd;
DeviceState *dev;
qemu_irq *isa_irq;
@@ -338,7 +339,8 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
for (i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
- dev = DEVICE(isa_create(s->isa_bus, TYPE_ISA_FDC));
+ isa_dev = isa_new(TYPE_ISA_FDC);
+ dev = DEVICE(isa_dev);
if (fd[0]) {
qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fd[0]),
&error_abort);
@@ -348,7 +350,7 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
&error_abort);
}
qdev_prop_set_uint32(dev, "dma", -1);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, s->isa_bus, &error_fatal);
/* Power */
dev = qdev_new(TYPE_SUN4U_POWER);