qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/12] mac_via: move ADB variables to MOS6522Q800VIA1State


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 05/12] mac_via: move ADB variables to MOS6522Q800VIA1State
Date: Tue, 31 Aug 2021 00:12:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 8/30/21 12:24 PM, Mark Cave-Ayland wrote:
> The ADB is accessed using clock and data pins on q800 VIA1 port B and so can 
> be
> moved to MOS6522Q800VIA1State.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/m68k/q800.c            |   6 +-
>  hw/misc/mac_via.c         | 169 +++++++++++++++++++-------------------
>  include/hw/misc/mac_via.h |  20 ++---
>  3 files changed, 96 insertions(+), 99 deletions(-)

> @@ -967,17 +962,10 @@ static void mac_via_realize(DeviceState *dev, Error 
> **errp)
>      MacVIAState *m = MAC_VIA(dev);
>      MOS6522Q800VIA1State *v1s = &m->mos6522_via1;
>      MOS6522State *ms;
> -    ADBBusState *adb_bus = &m->adb_bus;
> +    ADBBusState *adb_bus = &v1s->adb_bus;
>      struct tm tm;
>      int ret;
>  
> -    /* Init VIAs 1 and 2 */
> -    object_initialize_child(OBJECT(dev), "via1", &m->mos6522_via1,
> -                            TYPE_MOS6522_Q800_VIA1);
> -
> -    object_initialize_child(OBJECT(dev), "via2", &m->mos6522_via2,
> -                            TYPE_MOS6522_Q800_VIA2);
> -

Preferably moving object_initialize_child() from realize()
to init() in a previous patch (so this patch is only about ADB):

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


>      /* Pass through mos6522 output IRQs */
>      ms = MOS6522(&m->mos6522_via1);
>      object_property_add_alias(OBJECT(dev), "irq[0]", OBJECT(ms),
> @@ -1006,9 +994,9 @@ static void mac_via_realize(DeviceState *dev, Error 
> **errp)
>      qemu_get_timedate(&tm, 0);
>      v1s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
>  
> -    adb_register_autopoll_callback(adb_bus, adb_via_poll, m);
> -    m->adb_data_ready = qdev_get_gpio_in_named(dev, "via1-irq",
> -                                               VIA1_IRQ_ADB_READY_BIT);
> +    adb_register_autopoll_callback(adb_bus, adb_via_poll, v1s);
> +    v1s->adb_data_ready = qdev_get_gpio_in_named(dev, "via1-irq",
> +                                                 VIA1_IRQ_ADB_READY_BIT);
>  
>      if (v1s->blk) {
>          int64_t len = blk_getlength(v1s->blk);
> @@ -1049,9 +1037,12 @@ static void mac_via_init(Object *obj)
>                            &m->mos6522_via2, "via2", VIA_SIZE);
>      memory_region_add_subregion(&m->mmio, VIA_SIZE, &m->via2mem);
>  
> -    /* ADB */
> -    qbus_create_inplace((BusState *)&m->adb_bus, sizeof(m->adb_bus),
> -                        TYPE_ADB_BUS, DEVICE(obj), "adb.0");
> +    /* Init VIAs 1 and 2 */
> +    object_initialize_child(obj, "via1", &m->mos6522_via1,
> +                            TYPE_MOS6522_Q800_VIA1);
> +
> +    object_initialize_child(obj, "via2", &m->mos6522_via2,
> +                            TYPE_MOS6522_Q800_VIA2);
>  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]