summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroyger <royger@FreeBSD.org>2014-08-04 08:58:50 +0000
committerroyger <royger@FreeBSD.org>2014-08-04 08:58:50 +0000
commitafa7324d1a48870891af54639720591577af719c (patch)
treee52a505b72845388fd192da477732b428ec61d25
parent668dd4b0cbdb6a2f5f99e82eb2a9bae2988794aa (diff)
downloadFreeBSD-src-afa7324d1a48870891af54639720591577af719c.zip
FreeBSD-src-afa7324d1a48870891af54639720591577af719c.tar.gz
x86/madt: make the interrupt override parser a public function
Split a portion of the code in madt_parse_interrupt_override to a separate function, that is public and can be used from other code. This will be needed by the Xen port, since FreeBSD needs to parse the interrupt overrides and notify Xen about them. This commit should not introduce any functional change. Sponsored by: Citrix Systems R&D Reviewed by: jhb, gibbs x86/acpica/madt.c: - Introduce madt_parse_interrupt_values() that parses the intr information from ACPI and returns the triggering and the polarity. This is a subset of the functionality that used to be part of madt_parse_interrupt_override(). - Make madt_found_sci_override a global variable that can be used from other files. x86/include/acpica_machdep.h: - Prototype of madt_parse_interrupt_values. - Extern declaration of madt_found_sci_override.
-rw-r--r--sys/x86/acpica/madt.c73
-rw-r--r--sys/x86/include/acpica_machdep.h7
2 files changed, 50 insertions, 30 deletions
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index 99eaafc..b9cc895 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -57,7 +57,7 @@ static struct lapic_info {
u_int la_acpi_id:8;
} lapics[MAX_APIC_ID + 1];
-static int madt_found_sci_override;
+int madt_found_sci_override;
static ACPI_TABLE_MADT *madt;
static vm_paddr_t madt_physaddr;
static vm_offset_t madt_length;
@@ -380,41 +380,27 @@ madt_find_interrupt(int intr, void **apic, u_int *pin)
return (0);
}
-/*
- * Parse an interrupt source override for an ISA interrupt.
- */
-static void
-madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr)
+void
+madt_parse_interrupt_values(void *entry,
+ enum intr_trigger *trig, enum intr_polarity *pol)
{
- void *new_ioapic, *old_ioapic;
- u_int new_pin, old_pin;
- enum intr_trigger trig;
- enum intr_polarity pol;
+ ACPI_MADT_INTERRUPT_OVERRIDE *intr;
char buf[64];
- if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 &&
- intr->GlobalIrq == 2) {
- if (bootverbose)
- printf("MADT: Skipping timer override\n");
- return;
- }
+ intr = entry;
+
if (bootverbose)
printf("MADT: Interrupt override: source %u, irq %u\n",
intr->SourceIrq, intr->GlobalIrq);
KASSERT(intr->Bus == 0, ("bus for interrupt overrides must be zero"));
- if (madt_find_interrupt(intr->GlobalIrq, &new_ioapic, &new_pin) != 0) {
- printf("MADT: Could not find APIC for vector %u (IRQ %u)\n",
- intr->GlobalIrq, intr->SourceIrq);
- return;
- }
/*
* Lookup the appropriate trigger and polarity modes for this
* entry.
*/
- trig = interrupt_trigger(intr->IntiFlags, intr->SourceIrq);
- pol = interrupt_polarity(intr->IntiFlags, intr->SourceIrq);
-
+ *trig = interrupt_trigger(intr->IntiFlags, intr->SourceIrq);
+ *pol = interrupt_polarity(intr->IntiFlags, intr->SourceIrq);
+
/*
* If the SCI is identity mapped but has edge trigger and
* active-hi polarity or the force_sci_lo tunable is set,
@@ -424,29 +410,56 @@ madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr)
madt_found_sci_override = 1;
if (getenv_string("hw.acpi.sci.trigger", buf, sizeof(buf))) {
if (tolower(buf[0]) == 'e')
- trig = INTR_TRIGGER_EDGE;
+ *trig = INTR_TRIGGER_EDGE;
else if (tolower(buf[0]) == 'l')
- trig = INTR_TRIGGER_LEVEL;
+ *trig = INTR_TRIGGER_LEVEL;
else
panic(
"Invalid trigger %s: must be 'edge' or 'level'",
buf);
printf("MADT: Forcing SCI to %s trigger\n",
- trig == INTR_TRIGGER_EDGE ? "edge" : "level");
+ *trig == INTR_TRIGGER_EDGE ? "edge" : "level");
}
if (getenv_string("hw.acpi.sci.polarity", buf, sizeof(buf))) {
if (tolower(buf[0]) == 'h')
- pol = INTR_POLARITY_HIGH;
+ *pol = INTR_POLARITY_HIGH;
else if (tolower(buf[0]) == 'l')
- pol = INTR_POLARITY_LOW;
+ *pol = INTR_POLARITY_LOW;
else
panic(
"Invalid polarity %s: must be 'high' or 'low'",
buf);
printf("MADT: Forcing SCI to active %s polarity\n",
- pol == INTR_POLARITY_HIGH ? "high" : "low");
+ *pol == INTR_POLARITY_HIGH ? "high" : "low");
}
}
+}
+
+/*
+ * Parse an interrupt source override for an ISA interrupt.
+ */
+static void
+madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr)
+{
+ void *new_ioapic, *old_ioapic;
+ u_int new_pin, old_pin;
+ enum intr_trigger trig;
+ enum intr_polarity pol;
+
+ if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 &&
+ intr->GlobalIrq == 2) {
+ if (bootverbose)
+ printf("MADT: Skipping timer override\n");
+ return;
+ }
+
+ if (madt_find_interrupt(intr->GlobalIrq, &new_ioapic, &new_pin) != 0) {
+ printf("MADT: Could not find APIC for vector %u (IRQ %u)\n",
+ intr->GlobalIrq, intr->SourceIrq);
+ return;
+ }
+
+ madt_parse_interrupt_values(intr, &trig, &pol);
/* Remap the IRQ if it is mapped to a different interrupt vector. */
if (intr->SourceIrq != intr->GlobalIrq) {
diff --git a/sys/x86/include/acpica_machdep.h b/sys/x86/include/acpica_machdep.h
index 4743786..46080c0 100644
--- a/sys/x86/include/acpica_machdep.h
+++ b/sys/x86/include/acpica_machdep.h
@@ -69,11 +69,18 @@ int acpi_release_global_lock(volatile uint32_t *);
(Acq) = acpi_release_global_lock(&((GLptr)->GlobalLock)); \
} while (0)
+enum intr_trigger;
+enum intr_polarity;
+
void acpi_SetDefaultIntrModel(int model);
void acpi_cpu_c1(void);
void *acpi_map_table(vm_paddr_t pa, const char *sig);
void acpi_unmap_table(void *table);
vm_paddr_t acpi_find_table(const char *sig);
+void madt_parse_interrupt_values(void *entry,
+ enum intr_trigger *trig, enum intr_polarity *pol);
+
+extern int madt_found_sci_override;
#endif /* _KERNEL */
OpenPOWER on IntegriCloud