All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH 4/8] mac_via: add GPIO for A/UX mode
Date: Fri, 15 Oct 2021 20:50:49 +0100	[thread overview]
Message-ID: <b4a9202b-c6a4-8063-554b-111ff5f3ddd5@ilande.co.uk> (raw)
In-Reply-To: <0f7cc593-a9ca-d549-b317-25e1432408ae@vivier.eu>

On 15/10/2021 07:58, Laurent Vivier wrote:

> Le 13/10/2021 à 23:21, Mark Cave-Ayland a écrit :
>> Add a new auxmode GPIO that is updated when port B bit 6 is changed indicating
>> whether the hardware is configured for A/UX mode.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>   hw/misc/mac_via.c         | 18 ++++++++++++++++++
>>   hw/misc/trace-events      |  1 +
>>   include/hw/misc/mac_via.h |  1 +
>>   3 files changed, 20 insertions(+)
>>
>> diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
>> index 7a53a8b4c0..a08ffbcd88 100644
>> --- a/hw/misc/mac_via.c
>> +++ b/hw/misc/mac_via.c
>> @@ -880,6 +880,20 @@ static void via1_adb_update(MOS6522Q800VIA1State *v1s)
>>       }
>>   }
>>   
>> +static void via1_auxmode_update(MOS6522Q800VIA1State *v1s)
>> +{
>> +    MOS6522State *s = MOS6522(v1s);
>> +    int oldirq, irq;
>> +
> 
> Please, add a comment to explain what happens here as "vMystery" is not self-explicit.

Would something simple like:

/* Check to see if the A/UX mode bit has changed */

suffice here?

>> +    oldirq = (v1s->last_b & VIA1B_vMystery) ? 1 : 0;
>> +    irq = (s->b & VIA1B_vMystery) ? 1 : 0;
> 
> For me, it would be clearer with:
> 
>      oldirq = !!(v1s->last_b & VIA1B_vMystery);
>      irq = !!(s->b & VIA1B_vMystery);
> 
> but it's a matter of taste.

I had to think carefully about that one :)  If you're fine with the existing version 
I'd prefer to keep it as I find it easier to read.

>> +
>> +    if (irq != oldirq) {
>> +        trace_via1_auxmode(irq);
>> +        qemu_set_irq(v1s->auxmode_irq, irq);
>> +    }
>> +}
>> +
>>   static uint64_t mos6522_q800_via1_read(void *opaque, hwaddr addr, unsigned size)
>>   {
>>       MOS6522Q800VIA1State *s = MOS6522_Q800_VIA1(opaque);
>> @@ -902,6 +916,7 @@ static void mos6522_q800_via1_write(void *opaque, hwaddr addr, uint64_t val,
>>       case VIA_REG_B:
>>           via1_rtc_update(v1s);
>>           via1_adb_update(v1s);
>> +        via1_auxmode_update(v1s);
>>   
>>           v1s->last_b = ms->b;
>>           break;
>> @@ -1046,6 +1061,9 @@ static void mos6522_q800_via1_init(Object *obj)
>>                 TYPE_ADB_BUS, DEVICE(v1s), "adb.0");
>>   
>>       qdev_init_gpio_in(DEVICE(obj), via1_irq_request, VIA1_IRQ_NB);
>> +
>> +    /* A/UX mode */
>> +    qdev_init_gpio_out(DEVICE(obj), &v1s->auxmode_irq, 1);
>>   }
>>   
>>   static const VMStateDescription vmstate_q800_via1 = {
>> diff --git a/hw/misc/trace-events b/hw/misc/trace-events
>> index ede413965b..2da96d167a 100644
>> --- a/hw/misc/trace-events
>> +++ b/hw/misc/trace-events
>> @@ -228,6 +228,7 @@ via1_rtc_cmd_pram_sect_write(int sector, int offset, int addr, int value) "secto
>>   via1_adb_send(const char *state, uint8_t data, const char *vadbint) "state %s data=0x%02x vADBInt=%s"
>>   via1_adb_receive(const char *state, uint8_t data, const char *vadbint, int status, int index, int size) "state %s data=0x%02x vADBInt=%s status=0x%x index=%d size=%d"
>>   via1_adb_poll(uint8_t data, const char *vadbint, int status, int index, int size) "data=0x%02x vADBInt=%s status=0x%x index=%d size=%d"
>> +via1_auxmode(int mode) "setting auxmode to %d"
>>   
>>   # grlib_ahb_apb_pnp.c
>>   grlib_ahb_pnp_read(uint64_t addr, uint32_t value) "AHB PnP read addr:0x%03"PRIx64" data:0x%08x"
>> diff --git a/include/hw/misc/mac_via.h b/include/hw/misc/mac_via.h
>> index 4506abe5d0..b445565866 100644
>> --- a/include/hw/misc/mac_via.h
>> +++ b/include/hw/misc/mac_via.h
>> @@ -43,6 +43,7 @@ struct MOS6522Q800VIA1State {
>>       MemoryRegion via_mem;
>>   
>>       qemu_irq irqs[VIA1_IRQ_NB];
>> +    qemu_irq auxmode_irq;
>>       uint8_t last_b;
>>   
>>       /* RTC */
>>
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>


ATB,

Mark.


  reply	other threads:[~2021-10-15 19:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 21:21 [PATCH 0/8] q800: GLUE updates for A/UX mode Mark Cave-Ayland
2021-10-13 21:21 ` [PATCH 1/8] mac_via: update comment for VIA1B_vMystery bit Mark Cave-Ayland
2021-10-15  6:14   ` Laurent Vivier
2021-10-15 19:30     ` Mark Cave-Ayland
2021-10-13 21:21 ` [PATCH 2/8] q800: move VIA1 IRQ from level 1 to level 6 Mark Cave-Ayland
2021-10-15  6:24   ` Laurent Vivier
2021-10-13 21:21 ` [PATCH 3/8] q800: use GLUE IRQ numbers instead of IRQ level for GLUE IRQs Mark Cave-Ayland
2021-10-15  6:31   ` Laurent Vivier
2021-10-15  8:51     ` BALATON Zoltan
2021-10-15 19:42     ` Mark Cave-Ayland
2021-10-17  9:40     ` Mark Cave-Ayland
2021-10-17 13:30       ` Laurent Vivier
2021-10-13 21:21 ` [PATCH 4/8] mac_via: add GPIO for A/UX mode Mark Cave-Ayland
2021-10-15  6:58   ` Laurent Vivier
2021-10-15 19:50     ` Mark Cave-Ayland [this message]
2021-10-16 17:04       ` Laurent Vivier
2021-10-15  7:17   ` Laurent Vivier
2021-10-15 19:59     ` Mark Cave-Ayland
2021-10-16 17:06       ` Laurent Vivier
2021-10-13 21:21 ` [PATCH 5/8] q800: wire up auxmode GPIO to GLUE Mark Cave-Ayland
2021-10-15  7:01   ` Laurent Vivier
2021-10-16 18:00   ` Laurent Vivier
2021-10-13 21:21 ` [PATCH 6/8] q800: route SONIC on-board Ethernet IRQ via nubus IRQ 9 in classic mode Mark Cave-Ayland
2021-10-16 18:08   ` Laurent Vivier
2021-10-17 10:07     ` Mark Cave-Ayland
2021-10-13 21:21 ` [PATCH 7/8] q800: wire up remaining IRQs " Mark Cave-Ayland
2021-10-16 18:09   ` Laurent Vivier
2021-10-13 21:21 ` [PATCH 8/8] q800: add NMI handler Mark Cave-Ayland
2021-10-15  8:40   ` Laurent Vivier
2021-10-15 20:12     ` Mark Cave-Ayland
2021-10-16 17:09       ` Laurent Vivier
2021-10-17 10:00         ` Mark Cave-Ayland
2021-10-17 16:56           ` Laurent Vivier
2021-10-20 13:32             ` Mark Cave-Ayland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4a9202b-c6a4-8063-554b-111ff5f3ddd5@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.