qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 6/8] q800: route SONIC on-board Ethernet IRQ via nubus IRQ 9 in classic mode
Date: Wed, 20 Oct 2021 16:07:02 +0200	[thread overview]
Message-ID: <08c7efd8-00fc-77b7-2206-d6c1f45abade@vivier.eu> (raw)
In-Reply-To: <20211020134131.4392-7-mark.cave-ayland@ilande.co.uk>

Le 20/10/2021 à 15:41, Mark Cave-Ayland a écrit :
> When the hardware is operating in classic mode the SONIC on-board Ethernet IRQ is
> routed to nubus IRQ 9 instead of directly to the CPU at level 3. This does not
> affect the framebuffer which although it exists in slot 9, has its own
> dedicated IRQ on the Quadra 800 hardware.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/m68k/q800.c | 57 ++++++++++++++++++++++++++++++++++++--------------
>   1 file changed, 41 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
> index 0093872d89..7a8de089f4 100644
> --- a/hw/m68k/q800.c
> +++ b/hw/m68k/q800.c
> @@ -101,6 +101,7 @@ struct GLUEState {
>       M68kCPU *cpu;
>       uint8_t ipr;
>       uint8_t auxmode;
> +    qemu_irq irqs[1];
>   };
>   
>   #define GLUE_IRQ_IN_VIA1       0
> @@ -108,27 +109,40 @@ struct GLUEState {
>   #define GLUE_IRQ_IN_SONIC      2
>   #define GLUE_IRQ_IN_ESCC       3
>   
> +#define GLUE_IRQ_NUBUS_9       0
> +
>   static void GLUE_set_irq(void *opaque, int irq, int level)
>   {
>       GLUEState *s = opaque;
>       int i;
>   
> -    switch (irq) {
> -    case GLUE_IRQ_IN_VIA1:
> -        irq = 5;
> -        break;
> -
> -    case GLUE_IRQ_IN_VIA2:
> -        irq = 1;
> -        break;
> -
> -    case GLUE_IRQ_IN_SONIC:
> -        irq = 2;
> -        break;
> -
> -    case GLUE_IRQ_IN_ESCC:
> -        irq = 3;
> -        break;
> +    if (s->auxmode) {
> +        /* Classic mode */
> +        switch (irq) {
> +        case GLUE_IRQ_IN_SONIC:
> +            /* Route to VIA2 instead */
> +            qemu_set_irq(s->irqs[GLUE_IRQ_NUBUS_9], level);
> +            return;
> +        }
> +    } else {
> +        /* A/UX mode */
> +        switch (irq) {
> +        case GLUE_IRQ_IN_VIA1:
> +            irq = 5;
> +            break;
> +
> +        case GLUE_IRQ_IN_VIA2:
> +            irq = 1;
> +            break;
> +
> +        case GLUE_IRQ_IN_SONIC:
> +            irq = 2;
> +            break;
> +
> +        case GLUE_IRQ_IN_ESCC:
> +            irq = 3;
> +            break;
> +        }
>       }
>   
>       if (level) {
> @@ -186,9 +200,12 @@ static Property glue_properties[] = {
>   static void glue_init(Object *obj)
>   {
>       DeviceState *dev = DEVICE(obj);
> +    GLUEState *s = GLUE(dev);
>   
>       qdev_init_gpio_in(dev, GLUE_set_irq, 8);
>       qdev_init_gpio_in_named(dev, glue_auxmode_set_irq, "auxmode", 1);
> +
> +    qdev_init_gpio_out(dev, s->irqs, 1);
>   }
>   
>   static void glue_class_init(ObjectClass *klass, void *data)
> @@ -454,6 +471,14 @@ static void q800_init(MachineState *machine)
>                                                        VIA2_NUBUS_IRQ_9 + i));
>       }
>   
> +    /*
> +     * Since the framebuffer in slot 0x9 uses a separate IRQ, wire the unused
> +     * IRQ via GLUE for use by SONIC Ethernet in classic mode
> +     */
> +    qdev_connect_gpio_out(glue, GLUE_IRQ_NUBUS_9,
> +                          qdev_get_gpio_in_named(via2_dev, "nubus-irq",
> +                                                 VIA2_NUBUS_IRQ_9));
> +
>       nubus = &NUBUS_BRIDGE(dev)->bus;
>   
>       /* framebuffer in nubus slot #9 */
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


  reply	other threads:[~2021-10-20 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 13:41 [PATCH v2 0/8] q800: GLUE updates for A/UX mode Mark Cave-Ayland
2021-10-20 13:41 ` [PATCH v2 1/8] mac_via: update comment for VIA1B_vMystery bit Mark Cave-Ayland
2021-10-20 13:41 ` [PATCH v2 2/8] q800: move VIA1 IRQ from level 1 to level 6 Mark Cave-Ayland
2021-10-20 13:41 ` [PATCH v2 3/8] q800: use GLUE IRQ numbers instead of IRQ level for GLUE IRQs Mark Cave-Ayland
2021-10-20 14:04   ` Laurent Vivier
2021-10-20 13:41 ` [PATCH v2 4/8] mac_via: add GPIO for A/UX mode Mark Cave-Ayland
2021-10-20 13:41 ` [PATCH v2 5/8] q800: wire up auxmode GPIO to GLUE Mark Cave-Ayland
2021-10-20 13:41 ` [PATCH v2 6/8] q800: route SONIC on-board Ethernet IRQ via nubus IRQ 9 in classic mode Mark Cave-Ayland
2021-10-20 14:07   ` Laurent Vivier [this message]
2021-10-20 13:41 ` [PATCH v2 7/8] q800: wire up remaining IRQs " Mark Cave-Ayland
2021-10-20 13:41 ` [PATCH v2 8/8] q800: add NMI handler 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=08c7efd8-00fc-77b7-2206-d6c1f45abade@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).