[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/24] q800: move GLUE device to Q800MachineState
From: |
Laurent Vivier |
Subject: |
[PULL 09/24] q800: move GLUE device to Q800MachineState |
Date: |
Thu, 22 Jun 2023 09:55:29 +0200 |
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Also change the instantiation of the GLUE device to use
object_initialize_child().
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230621085353.113233-10-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
include/hw/m68k/q800.h | 2 ++
hw/m68k/q800.c | 24 ++++++++++++++----------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h
index d1f1ae4b8864..fda42e0a1c30 100644
--- a/include/hw/m68k/q800.h
+++ b/include/hw/m68k/q800.h
@@ -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")
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 9f9de2ebafb7..505e50d4af2e 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -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));
--
2.40.1
- [PULL 01/24] q800: fix up minor spacing issues in hw_compat_q800 GlobalProperty array, (continued)
- [PULL 01/24] q800: fix up minor spacing issues in hw_compat_q800 GlobalProperty array, Laurent Vivier, 2023/06/22
- [PULL 04/24] q800: rename q800_init() to q800_machine_init(), Laurent Vivier, 2023/06/22
- [PULL 12/24] q800: move VIA1 device to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 03/24] q800: introduce Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 02/24] q800: add missing space after parent object in GLUEState, Laurent Vivier, 2023/06/22
- [PULL 10/24] q800: introduce mac-io container memory region, Laurent Vivier, 2023/06/22
- [PULL 17/24] q800: move escc_orgate device to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 14/24] hw/net/dp8393x.c: move TYPE_DP8393X and dp8393xState into dp8393x.h, Laurent Vivier, 2023/06/22
- [PULL 21/24] q800: don't access Nubus bus directly from the mac-nubus-bridge device, Laurent Vivier, 2023/06/22
- [PULL 15/24] q800: move dp8393x device to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 09/24] q800: move GLUE device to Q800MachineState,
Laurent Vivier <=
- [PULL 23/24] mac_via: fix rtc command decoding from PRAM addresses 0x0 to 0xf, Laurent Vivier, 2023/06/22
- [PULL 24/24] mac_via: fix rtc command decoding for the PRAM seconds registers, Laurent Vivier, 2023/06/22
- [PULL 08/24] q800-glue.c: switch TypeInfo registration to use DEFINE_TYPES() macro, Laurent Vivier, 2023/06/22
- [PULL 11/24] q800: reimplement mac-io region aliasing using IO memory region, Laurent Vivier, 2023/06/22
- [PULL 06/24] q800: move ROM memory region to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 13/24] q800: move VIA2 device to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 16/24] q800: move ESCC device to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 07/24] q800: move GLUE device into separate q800-glue.c file, Laurent Vivier, 2023/06/22
- [PULL 18/24] q800: move ESP device to Q800MachineState, Laurent Vivier, 2023/06/22
- [PULL 20/24] q800: move mac-nubus-bridge device to Q800MachineState, Laurent Vivier, 2023/06/22