aboutsummaryrefslogtreecommitdiff
path: root/hw/misc/macio/macio.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/misc/macio/macio.c')
-rw-r--r--hw/misc/macio/macio.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 5d57f45dc6..9aa7e7559b 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -41,7 +41,7 @@ typedef struct MacIOState
MemoryRegion bar;
CUDAState cuda;
- void *dbdma;
+ DBDMAState *dbdma;
MemoryRegion *pic_mem;
MemoryRegion *escc_mem;
uint64_t frequency;
@@ -127,10 +127,15 @@ static void macio_common_realize(PCIDevice *d, Error **errp)
MacIOState *s = MACIO(d);
SysBusDevice *sysbus_dev;
Error *err = NULL;
- MemoryRegion *dbdma_mem;
- s->dbdma = DBDMA_init(&dbdma_mem);
- memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem);
+ object_property_set_bool(OBJECT(s->dbdma), true, "realized", &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
+ sysbus_dev = SYS_BUS_DEVICE(s->dbdma);
+ memory_region_add_subregion(&s->bar, 0x08000,
+ sysbus_mmio_get_region(sysbus_dev, 0));
object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err);
if (err) {
@@ -154,7 +159,10 @@ static void macio_realize_ide(MacIOState *s, MACIOIDEState *ide,
sysbus_dev = SYS_BUS_DEVICE(ide);
sysbus_connect_irq(sysbus_dev, 0, irq0);
sysbus_connect_irq(sysbus_dev, 1, irq1);
- macio_ide_register_dma(ide, s->dbdma, dmaid);
+ qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
+ object_property_set_link(OBJECT(ide), OBJECT(s->dbdma), "dbdma", errp);
+ macio_ide_register_dma(ide);
+
object_property_set_bool(OBJECT(ide), true, "realized", errp);
}
@@ -334,6 +342,9 @@ static void macio_instance_init(Object *obj)
object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA);
qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default());
object_property_add_child(obj, "cuda", OBJECT(&s->cuda), NULL);
+
+ s->dbdma = MAC_DBDMA(object_new(TYPE_MAC_DBDMA));
+ object_property_add_child(obj, "dbdma", OBJECT(s->dbdma), NULL);
}
static const VMStateDescription vmstate_macio_oldworld = {