diff options
author | jhb <jhb@FreeBSD.org> | 2003-11-19 15:38:56 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-11-19 15:38:56 +0000 |
commit | 1e7f54677c41894d0ec6c5cb3206b79189681983 (patch) | |
tree | c817399a7995ee36b3ef5742a793094d9cea84c0 /sys/i386/isa | |
parent | 2a56ea9233a11583b4ff53e21188d2ac489bd55c (diff) | |
download | FreeBSD-src-1e7f54677c41894d0ec6c5cb3206b79189681983.zip FreeBSD-src-1e7f54677c41894d0ec6c5cb3206b79189681983.tar.gz |
- Add counts to the ATPIC interrupt sources and point the ATPIC interrupt
source count pointers at them so that intr_execute_handlers() won't
choke when it tries to handle an unregisterd ATPIC interrupt source.
- Install the low-level ATPIC interrupt handlers when we first program the
ATPIC in atpic_startup() rather than at SI_SUB_INTR. This is only
necessary to work around buggy code that enables interrupts too early
in the boot process (namely, the vm86 code).
Approved by: re (rwatson)
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/atpic.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/i386/isa/atpic.c b/sys/i386/isa/atpic.c index ba44094..2f8c78c 100644 --- a/sys/i386/isa/atpic.c +++ b/sys/i386/isa/atpic.c @@ -119,6 +119,8 @@ struct atpic_intsrc { struct intsrc at_intsrc; int at_irq; /* Relative to PIC base. */ inthand_t *at_intr; + u_long at_count; + u_long at_straycount; }; static void atpic_enable_source(struct intsrc *isrc); @@ -297,29 +299,38 @@ i8259_init(struct atpic *pic, int slave) void atpic_startup(void) { + struct atpic_intsrc *ai; + int i; /* Start off with all interrupts disabled. */ imen = 0xffff; i8259_init(&atpics[MASTER], 0); i8259_init(&atpics[SLAVE], 1); atpic_enable_source((struct intsrc *)&atintrs[ICU_SLAVEID]); + + /* Install low-level interrupt handlers for all of our IRQs. */ + for (i = 0; i < sizeof(atintrs) / sizeof(struct atpic_intsrc); i++) { + if (i == ICU_SLAVEID) + continue; + ai = &atintrs[i]; + ai->at_intsrc.is_count = &ai->at_count; + ai->at_intsrc.is_straycount = &ai->at_straycount; + setidt(((struct atpic *)ai->at_intsrc.is_pic)->at_intbase + + ai->at_irq, ai->at_intr, SDT_SYS386IGT, SEL_KPL, + GSEL(GCODE_SEL, SEL_KPL)); + } } static void atpic_init(void *dummy __unused) { - struct atpic_intsrc *ai; int i; /* Loop through all interrupt sources and add them. */ for (i = 0; i < sizeof(atintrs) / sizeof(struct atpic_intsrc); i++) { if (i == ICU_SLAVEID) continue; - ai = &atintrs[i]; - setidt(((struct atpic *)ai->at_intsrc.is_pic)->at_intbase + - ai->at_irq, ai->at_intr, SDT_SYS386IGT, SEL_KPL, - GSEL(GCODE_SEL, SEL_KPL)); - intr_register_source(&ai->at_intsrc); + intr_register_source(&atintrs[i].at_intsrc); } } SYSINIT(atpic_init, SI_SUB_INTR, SI_ORDER_SECOND + 1, atpic_init, NULL) |