diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 80099aa66a2e..9c3b98ade7c8 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -2098,6 +2098,7 @@ init386(first) printf("WARNING: loader(8) metadata is missing!\n"); #ifdef DEV_ISA + elcr_probe(); atpic_startup(); #endif diff --git a/sys/i386/include/intr_machdep.h b/sys/i386/include/intr_machdep.h index a9880636a302..ff193467788b 100644 --- a/sys/i386/include/intr_machdep.h +++ b/sys/i386/include/intr_machdep.h @@ -84,6 +84,7 @@ struct intsrc { struct intrframe; extern struct mtx icu_lock; +extern int elcr_found; /* XXX: The elcr_* prototypes probably belong somewhere else. */ int elcr_probe(void); diff --git a/sys/i386/isa/atpic.c b/sys/i386/isa/atpic.c index 8f456ac44f6a..d326c683b48f 100644 --- a/sys/i386/isa/atpic.c +++ b/sys/i386/isa/atpic.c @@ -112,9 +112,6 @@ __FBSDID("$FreeBSD$"); static void atpic_init(void *dummy); unsigned int imen; /* XXX */ -#ifndef PC98 -static int using_elcr; -#endif inthand_t IDTVEC(atpic_intr0), IDTVEC(atpic_intr1), IDTVEC(atpic_intr2), @@ -313,7 +310,7 @@ atpic_resume(struct intsrc *isrc) if (ai->at_irq == 0) { i8259_init(ap, ap == &atpics[SLAVE]); #ifndef PC98 - if (ap == &atpics[SLAVE] && using_elcr) + if (ap == &atpics[SLAVE] && elcr_found) elcr_resume(); #endif } @@ -369,7 +366,7 @@ atpic_config_intr(struct intsrc *isrc, enum intr_trigger trig, vector); return (EINVAL); } - if (!using_elcr) { + if (!elcr_found) { if (bootverbose) printf("atpic: No ELCR to configure IRQ%u as %s\n", vector, trig == INTR_TRIGGER_EDGE ? "edge/high" : @@ -492,8 +489,7 @@ atpic_startup(void) * assume level trigger for any interrupt that we aren't sure is * edge triggered. */ - if (elcr_probe() == 0) { - using_elcr = 1; + if (elcr_found) { for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) ai->at_trigger = elcr_read_trigger(i); } else { diff --git a/sys/i386/isa/elcr.c b/sys/i386/isa/elcr.c index 2cfcfa46d0b0..266d78396db9 100644 --- a/sys/i386/isa/elcr.c +++ b/sys/i386/isa/elcr.c @@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$"); #define ELCR_MASK(irq) (1 << (irq)) static int elcr_status; -#ifdef INVARIANTS -static int elcr_found; -#endif +int elcr_found; /* * Check to see if we have what looks like a valid ELCR. We do this by @@ -88,9 +86,7 @@ elcr_probe(void) } if (resource_disabled("elcr", 0)) return (ENXIO); -#ifdef INVARIANTS elcr_found = 1; -#endif return (0); }