PERFORCE change 29485 for review
Peter Wemm
peter at FreeBSD.org
Tue Apr 22 22:24:32 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29485
Change 29485 by peter at 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);
}
+ }
}
More information about the p4-projects
mailing list