summaryrefslogtreecommitdiff
path: root/sys/arch/i386/isa/isa_machdep.c
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2001-11-18 20:46:50 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2001-11-18 20:46:50 +0000
commited3510e3ec23ddc3fdabcc9e73813f8ef36614e8 (patch)
tree4f8baa91f7ddf04a3ca8636e81a37082d4b94cca /sys/arch/i386/isa/isa_machdep.c
parent8376e8e1fbcb5f1432e20d080b7f7e197c6a7f07 (diff)
Revert niklas's broken ICU interrupt handling changes; deraadt@ ok
Diffstat (limited to 'sys/arch/i386/isa/isa_machdep.c')
-rw-r--r--sys/arch/i386/isa/isa_machdep.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c
index b57340a2977..19d352fe8ad 100644
--- a/sys/arch/i386/isa/isa_machdep.c
+++ b/sys/arch/i386/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.41 2001/11/12 20:28:20 niklas Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.42 2001/11/18 20:46:49 aaron Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -129,7 +129,6 @@
#define _I386_BUS_DMA_PRIVATE
#include <machine/bus.h>
-#include <machine/intr.h>
#include <machine/pio.h>
#include <machine/cpufunc.h>
@@ -222,8 +221,8 @@ isa_defaultirq()
/* icu vectors */
for (i = 0; i < ICU_LEN; i++)
- setgate(&idt[ICU_OFFSET + i], IDTVEC(intr)[i], 0,
- SDT_SYS386IGT, SEL_KPL, GICODE_SEL);
+ setgate(&idt[ICU_OFFSET + i], IDTVEC(intr)[i], 0, SDT_SYS386IGT,
+ SEL_KPL, GICODE_SEL);
/* initialize 8259's */
outb(IO_ICU1, 0x11); /* reset; program device, four bytes */
@@ -261,13 +260,13 @@ isa_defaultirq()
int
isa_nmi()
{
+
/* This is historic garbage; these ports are not readable */
log(LOG_CRIT, "No-maskable interrupt, may be parity error\n");
return(0);
}
-u_long intrstray[ICU_LEN];
-
+u_long intrstray[ICU_LEN] = {0};
/*
* Caught a stray interrupt, notify
*/
@@ -288,7 +287,6 @@ isa_strayintr(irq)
int fastvec;
int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
-int ilevel[ICU_LEN];
struct intrhand *intrhand[ICU_LEN];
/*
@@ -307,45 +305,45 @@ intr_calculatemasks()
for (irq = 0; irq < ICU_LEN; irq++) {
register int levels = 0;
for (q = intrhand[irq]; q; q = q->ih_next)
- levels |= 1 << IPL(q->ih_level);
+ levels |= 1 << q->ih_level;
intrlevel[irq] = levels;
}
/* Then figure out which IRQs use each level. */
- for (level = 0; level < NIPL; level++) {
+ for (level = 0; level < 5; level++) {
register int irqs = 0;
for (irq = 0; irq < ICU_LEN; irq++)
if (intrlevel[irq] & (1 << level))
irqs |= 1 << irq;
- imask[level] = irqs;
+ imask[level] = irqs | SIR_ALLMASK;
}
/*
- * Initialize soft interrupt masks to block themselves.
+ * There are tty, network and disk drivers that use free() at interrupt
+ * time, so imp > (tty | net | bio).
*/
- IMASK(IPL_SOFTCLOCK) |= 1 << SIR_CLOCK;
- IMASK(IPL_SOFTNET) |= 1 << SIR_NET;
- IMASK(IPL_SOFTTTY) |= 1 << SIR_TTY;
+ imask[IPL_IMP] |= imask[IPL_TTY] | imask[IPL_NET] | imask[IPL_BIO];
+ imask[IPL_AUDIO] |= imask[IPL_IMP];
/*
* Enforce a hierarchy that gives slow devices a better chance at not
* dropping data.
*/
- for (level = 0; level < NIPL - 1; level++)
- imask[level + 1] |= imask[level];
+ imask[IPL_TTY] |= imask[IPL_NET] | imask[IPL_BIO];
+ imask[IPL_NET] |= imask[IPL_BIO];
+
+ /*
+ * These are pseudo-levels.
+ */
+ imask[IPL_NONE] = 0x00000000;
+ imask[IPL_HIGH] = 0xffffffff;
/* And eventually calculate the complete masks. */
for (irq = 0; irq < ICU_LEN; irq++) {
register int irqs = 1 << irq;
- int level = IPL_NONE;
-
- for (q = intrhand[irq]; q; q = q->ih_next) {
- irqs |= IMASK(q->ih_level);
- if (q->ih_level > level)
- level = q->ih_level;
- }
- intrmask[irq] = irqs;
- ilevel[irq] = level;
+ for (q = intrhand[irq]; q; q = q->ih_next)
+ irqs |= imask[q->ih_level];
+ intrmask[irq] = irqs | SIR_ALLMASK;
}
/* Lastly, determine which IRQs are actually in use. */
@@ -359,16 +357,13 @@ intr_calculatemasks()
imen = ~irqs;
SET_ICUS();
}
-
- /* For speed of splx, provide the inverse of the interrupt masks. */
- for (irq = 0; irq < ICU_LEN; irq++)
- iunmask[irq] = ~imask[irq];
}
int
fakeintr(arg)
void *arg;
{
+
return 0;
}