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.eu
Subject: [PATCH 7/8] q800: wire up remaining IRQs in classic mode
Date: Wed, 13 Oct 2021 22:21:31 +0100	[thread overview]
Message-ID: <20211013212132.31519-8-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20211013212132.31519-1-mark.cave-ayland@ilande.co.uk>

Explicitly wire up the remaining IRQs in classic mode to enable the use of
g_assert_not_reached() in the default case to detect any unexpected IRQs.

Add a comment explaining the IRQ routing differences in A/UX mode based
upon the comments in NetBSD (also noting that at least A/UX 3.0.1 still
uses classic mode).

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/m68k/q800.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index d55e6a7541..fa851e2ec9 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -111,6 +111,37 @@ struct GLUEState {
 
 #define GLUE_IRQ_NUBUS_9       0
 
+/*
+ * The GLUE logic on the Quadra 800 supports 2 different IRQ routing modes
+ * controlled from the VIA1 auxmode GPIO (port B bit 6) which are documented
+ * in NetBSD as follows:
+ *
+ * A/UX mode (Linux, NetBSD, auxmode GPIO low)
+ *
+ *   Level 0:        Spurious: ignored
+ *   Level 1:        Software
+ *   Level 2:        VIA2 (except ethernet, sound)
+ *   Level 3:        Ethernet
+ *   Level 4:        Serial (SCC)
+ *   Level 5:        Sound
+ *   Level 6:        VIA1
+ *   Level 7:        NMIs: parity errors, RESET button, YANCC error
+ *
+ * Classic mode (default: used by MacOS, A/UX 3.0.1, auxmode GPIO high)
+ *
+ *   Level 0:        Spurious: ignored
+ *   Level 1:        VIA1 (clock, ADB)
+ *   Level 2:        VIA2 (NuBus, SCSI)
+ *   Level 3:
+ *   Level 4:        Serial (SCC)
+ *   Level 5:
+ *   Level 6:
+ *   Level 7:        Non-maskable: parity errors, RESET button
+ *
+ * Note that despite references to A/UX mode in Linux and NetBSD, at least
+ * A/UX 3.0.1 still uses Classic mode.
+ */
+
 static void GLUE_set_irq(void *opaque, int irq, int level)
 {
     GLUEState *s = opaque;
@@ -144,10 +175,25 @@ static void GLUE_set_irq(void *opaque, int irq, int level)
     case 1:
         /* Classic mode */
         switch (irq) {
+        case GLUE_IRQ_IN_VIA1:
+            irq = 0;
+            break;
+
+        case GLUE_IRQ_IN_VIA2:
+            irq = 1;
+            break;
+
         case GLUE_IRQ_IN_SONIC:
             /* Route to VIA2 instead */
             qemu_set_irq(s->irqs[GLUE_IRQ_NUBUS_9], level);
             return;
+
+        case GLUE_IRQ_IN_ESCC:
+            irq = 3;
+            break;
+
+        default:
+            g_assert_not_reached();
         }
         break;
 
-- 
2.20.1



  parent reply	other threads:[~2021-10-13 21:28 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
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 ` Mark Cave-Ayland [this message]
2021-10-16 18:09   ` [PATCH 7/8] q800: wire up remaining IRQs " 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=20211013212132.31519-8-mark.cave-ayland@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.