Am Wed, 23 Oct 2024 09:58:23 +0100
schrieb Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>:
> Move initialisation of the memory regions and GPIOs from next_pc_realize() to
> the new next_pc_init() function.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> hw/m68k/next-cube.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
> index 0c3f8780a1..3b4c361156 100644
> --- a/hw/m68k/next-cube.c
> +++ b/hw/m68k/next-cube.c
> @@ -897,20 +897,24 @@ static void next_pc_reset(DeviceState *dev)
>
> static void next_pc_realize(DeviceState *dev, Error **errp)
> {
> - NeXTPC *s = NEXT_PC(dev);
> - SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> + /* SCSI */
> + next_scsi_init(dev);
> +}
> +
> +static void next_pc_init(Object *obj)
> +{
> + NeXTPC *s = NEXT_PC(obj);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>
> - qdev_init_gpio_in(dev, next_irq, NEXT_NUM_IRQS);
> + qdev_init_gpio_in(DEVICE(obj), next_irq, NEXT_NUM_IRQS);
>
> memory_region_init_io(&s->mmiomem, OBJECT(s), &next_mmio_ops, s,
> "next.mmio", 0x9000);
> memory_region_init_io(&s->scrmem, OBJECT(s), &next_scr_ops, s,
> "next.scr", 0x20000);
> +
> sysbus_init_mmio(sbd, &s->mmiomem);
> sysbus_init_mmio(sbd, &s->scrmem);
> -
> - /* SCSI */
> - next_scsi_init(dev);
> }
>
> /*
> @@ -972,6 +976,7 @@ static void next_pc_class_init(ObjectClass *klass, void *data)
> static const TypeInfo next_pc_info = {
> .name = TYPE_NEXT_PC,
> .parent = TYPE_SYS_BUS_DEVICE,
> + .instance_init = next_pc_init,
> .instance_size = sizeof(NeXTPC),
> .class_init = next_pc_class_init,
> };
Reviewed-by: Thomas Huth <huth@tuxfamily.org>