@@ -27,6 +27,7 @@
#include "qom/object.h"
#include "target/m68k/cpu-qom.h"
#include "exec/memory.h"
+#include "hw/m68k/q800-glue.h"
/*
* The main Q800 machine
@@ -37,6 +38,7 @@ struct Q800MachineState {
M68kCPU cpu;
MemoryRegion rom;
+ GLUEState glue;
};
#define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800")
@@ -158,7 +158,6 @@ static void q800_machine_init(MachineState *machine)
SysBusDevice *sysbus;
BusState *adb_bus;
NubusBus *nubus;
- DeviceState *glue;
DriveInfo *dinfo;
uint8_t rng_seed[32];
@@ -194,10 +193,10 @@ static void q800_machine_init(MachineState *machine)
}
/* IRQ Glue */
- glue = qdev_new(TYPE_GLUE);
- object_property_set_link(OBJECT(glue), "cpu", OBJECT(&m->cpu),
+ object_initialize_child(OBJECT(machine), "glue", &m->glue, TYPE_GLUE);
+ object_property_set_link(OBJECT(&m->glue), "cpu", OBJECT(&m->cpu),
&error_abort);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(glue), &error_fatal);
+ sysbus_realize(SYS_BUS_DEVICE(&m->glue), &error_fatal);
/* VIA 1 */
via1_dev = qdev_new(TYPE_MOS6522_Q800_VIA1);
@@ -208,10 +207,12 @@ static void q800_machine_init(MachineState *machine)
sysbus = SYS_BUS_DEVICE(via1_dev);
sysbus_realize_and_unref(sysbus, &error_fatal);
sysbus_mmio_map(sysbus, 1, VIA_BASE);
- sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_VIA1));
+ sysbus_connect_irq(sysbus, 0,
+ qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA1));
/* A/UX mode */
qdev_connect_gpio_out(via1_dev, 0,
- qdev_get_gpio_in_named(glue, "auxmode", 0));
+ qdev_get_gpio_in_named(DEVICE(&m->glue),
+ "auxmode", 0));
adb_bus = qdev_get_child_bus(via1_dev, "adb.0");
dev = qdev_new(TYPE_ADB_KEYBOARD);
@@ -224,7 +225,8 @@ static void q800_machine_init(MachineState *machine)
sysbus = SYS_BUS_DEVICE(via2_dev);
sysbus_realize_and_unref(sysbus, &error_fatal);
sysbus_mmio_map(sysbus, 1, VIA_BASE + VIA_SIZE);
- sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_VIA2));
+ sysbus_connect_irq(sysbus, 0,
+ qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA2));
/* MACSONIC */
@@ -257,7 +259,8 @@ static void q800_machine_init(MachineState *machine)
sysbus = SYS_BUS_DEVICE(dev);
sysbus_realize_and_unref(sysbus, &error_fatal);
sysbus_mmio_map(sysbus, 0, SONIC_BASE);
- sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_SONIC));
+ sysbus_connect_irq(sysbus, 0,
+ qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_SONIC));
memory_region_init_rom(dp8393x_prom, NULL, "dp8393x-q800.prom",
SONIC_PROM_SIZE, &error_fatal);
@@ -294,7 +297,8 @@ static void q800_machine_init(MachineState *machine)
sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(escc_orgate, 0));
sysbus_connect_irq(sysbus, 1, qdev_get_gpio_in(escc_orgate, 1));
qdev_connect_gpio_out(escc_orgate, 0,
- qdev_get_gpio_in(glue, GLUE_IRQ_IN_ESCC));
+ qdev_get_gpio_in(DEVICE(&m->glue),
+ GLUE_IRQ_IN_ESCC));
sysbus_mmio_map(sysbus, 0, SCC_BASE);
/* SCSI */
@@ -349,7 +353,7 @@ static void q800_machine_init(MachineState *machine)
* Since the framebuffer in slot 0x9 uses a separate IRQ, wire the unused
* IRQ via GLUE for use by SONIC Ethernet in classic mode
*/
- qdev_connect_gpio_out(glue, GLUE_IRQ_NUBUS_9,
+ qdev_connect_gpio_out(DEVICE(&m->glue), GLUE_IRQ_NUBUS_9,
qdev_get_gpio_in_named(via2_dev, "nubus-irq",
VIA2_NUBUS_IRQ_9));