aboutsummaryrefslogtreecommitdiff
path: root/hw/m68k
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-10-24 10:30:06 +0200
committerThomas Huth <huth@tuxfamily.org>2023-11-01 07:20:34 +0100
commit4768968960f74db92d9fac360c17838cda39614b (patch)
tree993dfca2900bc415c9366c0ea0f2d699264a6e4c /hw/m68k
parent989c8a46cc9ec211b94c4dfa0f8fd8662ab697da (diff)
hw/m68k/mcf_intc: Expose MMIO region via SysBus API
QOM objects shouldn't access each other internals fields except using the QOM API. Here the caller of mcf_intc_init() access the MMIO region from the MCF_INTC state. Avoid that by exposing that region via sysbus_init_mmio(), then get it with sysbus_mmio_get_region(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Thomas Huth <huth@tuxfamily.org> Reviewed-by: Thomas Huth <huth@tuxfamily.org> Message-ID: <20231024083010.12453-4-philmd@linaro.org> Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Diffstat (limited to 'hw/m68k')
-rw-r--r--hw/m68k/mcf_intc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c
index 4cd30188c0..1f74ea0e14 100644
--- a/hw/m68k/mcf_intc.c
+++ b/hw/m68k/mcf_intc.c
@@ -173,6 +173,7 @@ static void mcf_intc_instance_init(Object *obj)
mcf_intc_state *s = MCF_INTC(obj);
memory_region_init_io(&s->iomem, obj, &mcf_intc_ops, s, "mcf", 0x100);
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
}
static void mcf_intc_class_init(ObjectClass *oc, void *data)
@@ -211,7 +212,8 @@ qemu_irq *mcf_intc_init(MemoryRegion *sysmem,
s = MCF_INTC(dev);
s->cpu = cpu;
- memory_region_add_subregion(sysmem, base, &s->iomem);
+ memory_region_add_subregion(sysmem, base,
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0));
return qemu_allocate_irqs(mcf_intc_set_irq, s, 64);
}