Module Name:    src
Committed By:   tsutsui
Date:           Sat Jan 20 19:36:47 UTC 2018

Modified Files:
        src/sys/arch/atari/isa: isa_milan.c

Log Message:
Ack EOI for IRQ_SLAVE of the master PIC after ack for IRQ of the slave PIC.

I'm not sure if there are possible races in the original code, but
this is what i8259_asm_ack2() in sys/arch/x86/include/i8259.h does
and it looks this change makes a Milan kernel a bit stable.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/isa/isa_milan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/isa/isa_milan.c
diff -u src/sys/arch/atari/isa/isa_milan.c:1.15 src/sys/arch/atari/isa/isa_milan.c:1.16
--- src/sys/arch/atari/isa/isa_milan.c:1.15	Sat Jan 20 18:33:09 2018
+++ src/sys/arch/atari/isa/isa_milan.c	Sat Jan 20 19:36:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_milan.c,v 1.15 2018/01/20 18:33:09 tsutsui Exp $	*/
+/*	$NetBSD: isa_milan.c,v 1.16 2018/01/20 19:36:47 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isa_milan.c,v 1.15 2018/01/20 18:33:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_milan.c,v 1.16 2018/01/20 19:36:47 tsutsui Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -122,9 +122,11 @@ isa_callback(int vector)
 
 	s = splx(iinfo_p->ipl);
 	(void) (iinfo_p->ifunc)(iinfo_p->iarg);
-	if (vector > 7)
+	if (vector > 7) {
 		WICU(AD_8259_SLAVE, 0x60 | (vector & 7));
-	else WICU(AD_8259_MASTER, 0x60 | (vector & 7));
+		vector = IRQ_SLAVE;
+	}
+	WICU(AD_8259_MASTER, 0x60 | (vector & 7));
 	splx(s);
 }
 
@@ -140,10 +142,6 @@ milan_isa_intr(int vector, int sr)
 		return;
 	}
 
-	/* Ack cascade 0x60 == Specific EOI		*/
-	if (vector > 7)
-		WICU(AD_8259_MASTER, 0x60|IRQ_SLAVE);
-
 	iinfo_p = &milan_isa_iinfo[vector];
 	if (iinfo_p->ifunc == NULL) {
 		printf("milan_isa_intr: Stray interrupt: %d (mask:%04x)\n",
@@ -159,9 +157,11 @@ milan_isa_intr(int vector, int sr)
 	else {
 		s = splx(iinfo_p->ipl);
 		(void) (iinfo_p->ifunc)(iinfo_p->iarg);
-		if (vector > 7)
+		if (vector > 7) {
 			WICU(AD_8259_SLAVE, 0x60 | (vector & 7));
-		else WICU(AD_8259_MASTER, 0x60 | (vector & 7));
+			vector = IRQ_SLAVE;
+		}
+		WICU(AD_8259_MASTER, 0x60 | (vector & 7));
 		splx(s);
 	}
 }

Reply via email to