aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/acpica/madt.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2004-01-30 00:24:45 +0000
committerPeter Wemm <peter@FreeBSD.org>2004-01-30 00:24:45 +0000
commit8a703d13b0f20e76afe1c6e10015586dd2d297f0 (patch)
tree28dec38d0e336338f1fd59f4a558d2de8b88d373 /sys/amd64/acpica/madt.c
parent9608d7e2cd58c1a7fff6562810f2ce519e6ec50a (diff)
downloadsrc-8a703d13b0f20e76afe1c6e10015586dd2d297f0.tar.gz
src-8a703d13b0f20e76afe1c6e10015586dd2d297f0.zip
Merge some more changes from i386.
Notes
Notes: svn path=/head/; revision=125221
Diffstat (limited to 'sys/amd64/acpica/madt.c')
-rw-r--r--sys/amd64/acpica/madt.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/sys/amd64/acpica/madt.c b/sys/amd64/acpica/madt.c
index 68759c57c763..d8d6437b9b8b 100644
--- a/sys/amd64/acpica/madt.c
+++ b/sys/amd64/acpica/madt.c
@@ -320,13 +320,22 @@ madt_setup_local(void)
}
/*
- * Run through the MP table enumerating I/O APICs.
+ * Enumerate I/O APICs and setup interrupt sources.
*/
static int
madt_setup_io(void)
{
int i;
+ /* Try to initialize ACPI so that we can access the FADT. */
+ i = acpi_Startup();
+ if (ACPI_FAILURE(i)) {
+ printf("MADT: ACPI Startup failed with %s\n",
+ AcpiFormatException(i));
+ printf("Try disabling either ACPI or apic support.\n");
+ panic("Using MADT but ACPI doesn't work");
+ }
+
/* First, we run through adding I/O APIC's. */
madt_walk_table(madt_parse_apics, NULL);
@@ -523,6 +532,7 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr)
{
void *new_ioapic, *old_ioapic;
u_int new_pin, old_pin;
+ int force_lo;
if (bootverbose)
printf("MADT: intr override: source %u, irq %u\n",
@@ -535,9 +545,27 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr)
return;
}
+ /*
+ * If the SCI is remapped to a non-ISA global interrupt,
+ * force it to level trigger and active-lo polarity.
+ * If the SCI is identity mapped but has edge trigger and
+ * active-hi polarity, also force it to use level/lo.
+ */
+ force_lo = 0;
+ if (intr->Source == AcpiGbl_FADT->SciInt)
+ if (intr->Interrupt > 15 || (intr->Interrupt == intr->Source &&
+ intr->TriggerMode == TRIGGER_EDGE &&
+ intr->Polarity == POLARITY_ACTIVE_HIGH))
+ force_lo = 1;
+
if (intr->Source != intr->Interrupt) {
- /* XXX: This assumes that the SCI uses IRQ 9. */
- if (intr->Interrupt > 15 && intr->Source == 9)
+ /*
+ * If the SCI is remapped to a non-ISA global interrupt,
+ * then override the vector we use to setup and allocate
+ * the interrupt.
+ */
+ if (intr->Interrupt > 15 &&
+ intr->Source == AcpiGbl_FADT->SciInt)
acpi_OverrideInterruptLevel(intr->Interrupt);
else
ioapic_remap_vector(new_ioapic, new_pin, intr->Source);
@@ -549,10 +577,18 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr)
intr->Source)
ioapic_disable_pin(old_ioapic, old_pin);
}
- ioapic_set_triggermode(new_ioapic, new_pin,
- interrupt_trigger(intr->TriggerMode));
- ioapic_set_polarity(new_ioapic, new_pin,
- interrupt_polarity(intr->Polarity));
+ if (force_lo) {
+ printf(
+ "MADT: Forcing active-lo polarity and level trigger for IRQ %d\n",
+ intr->Source);
+ ioapic_set_polarity(new_ioapic, new_pin, 0);
+ ioapic_set_triggermode(new_ioapic, new_pin, 0);
+ } else {
+ ioapic_set_polarity(new_ioapic, new_pin,
+ interrupt_polarity(intr->Polarity));
+ ioapic_set_triggermode(new_ioapic, new_pin,
+ interrupt_trigger(intr->TriggerMode));
+ }
}
/*