q800: wire up remaining IRQs in classic mode

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>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211020134131.4392-8-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Mark Cave-Ayland 2021-10-20 14:41:30 +01:00 committed by Laurent Vivier
parent f7c6e12e24
commit c7710c1ebf

View File

@ -111,6 +111,37 @@ struct GLUEState {
#define GLUE_IRQ_NUBUS_9 0 #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) static void GLUE_set_irq(void *opaque, int irq, int level)
{ {
GLUEState *s = opaque; GLUEState *s = opaque;
@ -119,10 +150,25 @@ static void GLUE_set_irq(void *opaque, int irq, int level)
if (s->auxmode) { if (s->auxmode) {
/* Classic mode */ /* Classic mode */
switch (irq) { switch (irq) {
case GLUE_IRQ_IN_VIA1:
irq = 0;
break;
case GLUE_IRQ_IN_VIA2:
irq = 1;
break;
case GLUE_IRQ_IN_SONIC: case GLUE_IRQ_IN_SONIC:
/* Route to VIA2 instead */ /* Route to VIA2 instead */
qemu_set_irq(s->irqs[GLUE_IRQ_NUBUS_9], level); qemu_set_irq(s->irqs[GLUE_IRQ_NUBUS_9], level);
return; return;
case GLUE_IRQ_IN_ESCC:
irq = 3;
break;
default:
g_assert_not_reached();
} }
} else { } else {
/* A/UX mode */ /* A/UX mode */
@ -142,6 +188,9 @@ static void GLUE_set_irq(void *opaque, int irq, int level)
case GLUE_IRQ_IN_ESCC: case GLUE_IRQ_IN_ESCC:
irq = 3; irq = 3;
break; break;
default:
g_assert_not_reached();
} }
} }