From 786e4e87b4dc1f7f8447af719c1ee633175f1422 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 13 Dec 2005 16:47:33 +0000 Subject: [PATCH] MFC: Slam the door more forcefully on mixed mode. --- sys/amd64/isa/atpic.c | 15 +++++++++++++++ sys/i386/isa/atpic.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/sys/amd64/isa/atpic.c b/sys/amd64/isa/atpic.c index f6d3fb1b4de1..feefa83aa65b 100644 --- a/sys/amd64/isa/atpic.c +++ b/sys/amd64/isa/atpic.c @@ -453,6 +453,21 @@ atpic_init(void *dummy __unused) struct atpic_intsrc *ai; int i; + /* + * If any of the ISA IRQs have an interrupt source already, then + * assume that the APICs are being used and don't register any + * of our interrupt sources. This makes sure we don't accidentally + * use mixed mode. The "accidental" use could otherwise occur on + * machines that route the ACPI SCI interrupt to a different ISA + * IRQ (at least one machines routes it to IRQ 13) thus disabling + * that APIC ISA routing and allowing the ATPIC source for that IRQ + * to leak through. We used to depend on this feature for routing + * IRQ0 via mixed mode, but now we don't use mixed mode at all. + */ + for (i = 0; i < NUM_ISA_IRQS; i++) + if (intr_lookup_source(i) != NULL) + return; + /* Loop through all interrupt sources and add them. */ for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) { if (i == ICU_SLAVEID) diff --git a/sys/i386/isa/atpic.c b/sys/i386/isa/atpic.c index 8d17ec18679d..00361c747b56 100644 --- a/sys/i386/isa/atpic.c +++ b/sys/i386/isa/atpic.c @@ -516,6 +516,21 @@ atpic_init(void *dummy __unused) struct atpic_intsrc *ai; int i; + /* + * If any of the ISA IRQs have an interrupt source already, then + * assume that the APICs are being used and don't register any + * of our interrupt sources. This makes sure we don't accidentally + * use mixed mode. The "accidental" use could otherwise occur on + * machines that route the ACPI SCI interrupt to a different ISA + * IRQ (at least one machines routes it to IRQ 13) thus disabling + * that APIC ISA routing and allowing the ATPIC source for that IRQ + * to leak through. We used to depend on this feature for routing + * IRQ0 via mixed mode, but now we don't use mixed mode at all. + */ + for (i = 0; i < NUM_ISA_IRQS; i++) + if (intr_lookup_source(i) != NULL) + return; + /* Loop through all interrupt sources and add them. */ for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) { if (i == ICU_SLAVEID)