Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 2003 22:24:30 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29485 for review
Message-ID:  <200304230524.h3N5OUmH061322@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29485

Change 29485 by peter@peter_daintree on 2003/04/22 22:23:39

	finally (!) implement the detection of 'stray interrupt' vs
	'glitch' on the isa ICU.  Glitches are expected as a byproduct
	of the PIC design.
	XXX why is this code duplicated?? :-(

Affected files ...

.. //depot/projects/hammer/sys/x86_64/isa/intr_machdep.c#13 edit
.. //depot/projects/hammer/sys/x86_64/isa/ithread.c#4 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/isa/intr_machdep.c#13 (text+ko) ====

@@ -252,6 +252,9 @@
 /*
  * Caught a stray interrupt, notify
  */
+static int isaglitch7;
+static int isaglitch15;
+
 static void
 isa_strayintr(vcookiep)
 	void *vcookiep;
@@ -265,8 +268,7 @@
 		isr = inb(IO_ICU1);
 		outb(IO_ICU1, OCW3_SEL | OCW3_RIS); /* reselect IIR */
 		if ((isr & 0x80) == 0) {
-			/* Remove debugging message below */
-			log(LOG_ERR, "glitch on irq 7\n");
+			isaglitch7++;
 			return;
 		}
 	}
@@ -275,8 +277,7 @@
 		isr = inb(IO_ICU2);
 		outb(IO_ICU2, OCW3_SEL | OCW3_RIS); /* reselect IIR */
 		if ((isr & 0x80) == 0) {
-			/* Remove debugging message below */
-			log(LOG_ERR, "glitch on irq 15\n");
+			isaglitch15++;
 			return;
 		}
 	}

==== //depot/projects/hammer/sys/x86_64/isa/ithread.c#4 (text+ko) ====

@@ -39,6 +39,7 @@
 
 #include <x86_64/isa/icu.h>
 #include <x86_64/isa/intr_machdep.h>
+#include <x86_64/isa/isa.h>
 
 struct int_entropy {
 	struct proc *p;
@@ -46,6 +47,8 @@
 };
 
 static u_int straycount[ICU_LEN];
+static u_int glitchcount7;
+static u_int glitchcount15;
 
 #define	MAX_STRAY_LOG	5
 
@@ -58,7 +61,7 @@
 {
 	int irq = (uintptr_t) cookie;	/* IRQ we're handling */
 	struct ithd *ithd = ithds[irq];	/* and the process that does it */
-	int error;
+	int error, isr;
 
 	/* This used to be in icu_vector.s */
 	/*
@@ -79,7 +82,26 @@
 	/*
 	 * Log stray interrupts.
 	 */
-	if (error == EINVAL)
+	if (error == EINVAL) {
+		/* Determine if it is a stray interrupt or simply a glitch */
+		if (irq == 7) {
+			outb(IO_ICU1, OCW3_SEL);	/* select IS register */
+			isr = inb(IO_ICU1);
+			outb(IO_ICU1, OCW3_SEL | OCW3_RIS); /* reselect IIR */
+			if ((isr & 0x80) == 0) {
+				glitchcount7++;
+				return;
+			}
+		}
+		if (irq == 15) {
+			outb(IO_ICU2, OCW3_SEL);	/* select IS register */
+			isr = inb(IO_ICU2);
+			outb(IO_ICU2, OCW3_SEL | OCW3_RIS); /* reselect IIR */
+			if ((isr & 0x80) == 0) {
+				glitchcount15++;
+				return;
+			}
+		}
 		if (straycount[irq] < MAX_STRAY_LOG) {
 			printf("stray irq %d\n", irq);
 			if (++straycount[irq] == MAX_STRAY_LOG)
@@ -87,4 +109,5 @@
 			    "got %d stray irq %d's: not logging anymore\n",
 				    MAX_STRAY_LOG, irq);
 		}
+	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304230524.h3N5OUmH061322>