soc/intel: Introduce ioapic_get_sci_pin()
According to ACPI Release 6.5 systems supporting PIC (i8259)
interrupt mechanism need to report IRQ vector for the SCI_INT
field. In PIC mode only IRQ0..15 are allowed hardware vectors.
This change should cover section 5.2.9 to not pass SCI_INT
larger than IRQ15. Section 5.2.15.5 needs follow-up work.
Care should be taken that ioapic_get_sci_pin() is called
after platform code has potentially changed the routing
from the default.
It appears touched all platforms except siemens/mc_aplX
currently program SCI as IRQ9.
Change-Id: I723c207f1dcbba5e6fc0452fe1dbd087fad290ee
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74326
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index 2540929..a2865cb 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -17,6 +17,7 @@
#include <acpi/acpi_ivrs.h>
#include <acpi/acpigen.h>
#include <arch/hpet.h>
+#include <arch/smp/mpspec.h>
#include <cbfs.h>
#include <cbmem.h>
#include <commonlib/helpers.h>
@@ -225,6 +226,24 @@
}
#endif
+u16 acpi_sci_int(void)
+{
+#if ENV_X86
+ u8 gsi, irq, flags;
+
+ ioapic_get_sci_pin(&gsi, &irq, &flags);
+
+ /* ACPI Release 6.5, 5.2.9 and 5.2.15.5. */
+ if (!CONFIG(ACPI_HAVE_PCAT_8259))
+ return gsi;
+
+ assert(irq < 16);
+ return irq;
+#else
+ return 0;
+#endif
+}
+
int acpi_create_madt_irqoverride(acpi_madt_irqoverride_t *irqoverride,
u8 bus, u8 source, u32 gsirq, u16 flags)
{
@@ -238,6 +257,25 @@
return irqoverride->length;
}
+int acpi_create_madt_sci_override(acpi_madt_irqoverride_t *irqoverride)
+{
+ u8 gsi, irq, flags;
+
+ ioapic_get_sci_pin(&gsi, &irq, &flags);
+
+ if (!CONFIG(ACPI_HAVE_PCAT_8259))
+ irq = gsi;
+
+ irqoverride->type = IRQ_SOURCE_OVERRIDE; /* Interrupt source override */
+ irqoverride->length = sizeof(acpi_madt_irqoverride_t);
+ irqoverride->bus = MP_BUS_ISA;
+ irqoverride->source = irq;
+ irqoverride->gsirq = gsi;
+ irqoverride->flags = flags;
+
+ return irqoverride->length;
+}
+
static int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu,
u16 flags, u8 lint)
{