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>
This commit is contained in:
Philippe Mathieu-Daudé 2023-10-24 10:30:06 +02:00 committed by Thomas Huth
parent 989c8a46cc
commit 4768968960

View File

@ -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);
}