1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

- 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)
This commit is contained in:
John Baldwin 2003-11-19 15:38:56 +00:00
parent dbed417dab
commit 8c770ed571
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122897

View File

@ -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)