Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/isa -mask interrupts w/o a handler



details:   https://anonhg.NetBSD.org/src/rev/9e9a759a6ddd
branches:  trunk
changeset: 477626:9e9a759a6ddd
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Oct 25 14:49:41 1999 +0000

description:
-mask interrupts w/o a handler
-update PIC _after_ the interrupt handler is linked into the chain
This fixes problems with dynamically installed interrupt handlers:
Interrupts were enabled before the handler was installed under some
circumstances (esp. on faster machines), leading to endless interrupt
handling.

diffstat:

 sys/arch/i386/isa/isa_machdep.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r c4e6e6824f4c -r 9e9a759a6ddd sys/arch/i386/isa/isa_machdep.c
--- a/sys/arch/i386/isa/isa_machdep.c   Mon Oct 25 14:36:21 1999 +0000
+++ b/sys/arch/i386/isa/isa_machdep.c   Mon Oct 25 14:49:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isa_machdep.c,v 1.43 1999/09/17 19:59:43 thorpej Exp $ */
+/*     $NetBSD: isa_machdep.c,v 1.44 1999/10/25 14:49:41 drochner Exp $        */
 
 #define ISA_DMA_STATS
 
@@ -243,15 +243,18 @@
 void
 intr_calculatemasks()
 {
-       int irq, level;
+       int irq, level, unusedirqs;
        struct intrhand *q;
 
        /* First, figure out which levels each IRQ uses. */
+       unusedirqs = 0xffff;
        for (irq = 0; irq < ICU_LEN; irq++) {
                int levels = 0;
                for (q = intrhand[irq]; q; q = q->ih_next)
                        levels |= 1 << q->ih_level;
                intrlevel[irq] = levels;
+               if (levels)
+                       unusedirqs &= ~(1 << irq);
        }
 
        /* Then figure out which IRQs use each level. */
@@ -260,7 +263,7 @@
                for (irq = 0; irq < ICU_LEN; irq++)
                        if (intrlevel[irq] & (1 << level))
                                irqs |= 1 << irq;
-               imask[level] = irqs;
+               imask[level] = irqs | unusedirqs;
        }
 
        /*
@@ -329,7 +332,6 @@
                if (irqs >= 0x100) /* any IRQs >= 8 in use */
                        irqs |= 1 << IRQ_SLAVE;
                imen = ~irqs;
-               SET_ICUS();
        }
 }
 
@@ -486,6 +488,7 @@
        ih->ih_irq = irq;
        *p = ih;
 
+       SET_ICUS();
        return (ih);
 }
 
@@ -517,6 +520,7 @@
        free(ih, M_DEVBUF);
 
        intr_calculatemasks();
+       SET_ICUS();
 
        if (intrhand[irq] == NULL)
                intrtype[irq] = IST_NONE;



Home | Main Index | Thread Index | Old Index