From owner-p4-projects@FreeBSD.ORG Tue Apr 22 22:24:32 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7F9F137B404; Tue, 22 Apr 2003 22:24:31 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E5E037B401 for ; Tue, 22 Apr 2003 22:24:31 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CDBE43FBD for ; Tue, 22 Apr 2003 22:24:30 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3N5OU0U061330 for ; Tue, 22 Apr 2003 22:24:30 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3N5OUmH061322 for perforce@freebsd.org; Tue, 22 Apr 2003 22:24:30 -0700 (PDT) Date: Tue, 22 Apr 2003 22:24:30 -0700 (PDT) Message-Id: <200304230524.h3N5OUmH061322@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 29485 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Apr 2003 05:24:32 -0000 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 #include +#include 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); } + } }