From 10bdee13272a77aed46912363db691cf4c088a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 11 Apr 2023 01:00:17 +0300 Subject: ACPI: Add COMMON_ACPI_MADT_IOAPIC and CUSTOM_ACPI_MADT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig COMMON_ACPI_MADT_IOAPIC to replace platforms' implementations of adding IOAPIC and IRQ override entries for ACPI MADT tables. Platforms that have a more complex MADT may continue to add custom entries using CUSTOM_ACPI_MADT. Change-Id: I0b77769f89cc319ad228eb37bc341e2150b8a892 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/74348 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/acpi/Kconfig | 15 ++++++++++++--- src/acpi/acpi.c | 17 ++++++++++++++++- src/mainboard/asus/p2b/Kconfig | 2 +- src/soc/intel/quark/Kconfig | 2 +- 4 files changed, 30 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/acpi/Kconfig b/src/acpi/Kconfig index 5af8b221bd..3b02070554 100644 --- a/src/acpi/Kconfig +++ b/src/acpi/Kconfig @@ -31,13 +31,22 @@ config ACPI_SOC_NVS Set to indicate exists for the platform with a definition for global_nvs. +config ACPI_CUSTOM_MADT + bool + default n if ACPI_NO_CUSTOM_MADT + default y + help + Selected by platforms that need to expose custom MADT entries. + +config ACPI_NO_CUSTOM_MADT + bool + default y if ACPI_COMMON_MADT_LAPIC && ACPI_COMMON_MADT_IOAPIC + config ACPI_COMMON_MADT_LAPIC bool -config ACPI_NO_MADT +config ACPI_COMMON_MADT_IOAPIC bool - help - Selected by platforms that don't expose a useful MADT. config ACPI_NO_PCAT_8259 bool diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index c357e2bd23..e06ac470e0 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -276,6 +276,18 @@ int acpi_create_madt_sci_override(acpi_madt_irqoverride_t *irqoverride) return irqoverride->length; } +static unsigned long acpi_create_madt_ioapic_gsi0_default(unsigned long current) +{ + current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + + current += acpi_create_madt_irqoverride((void *)current, MP_BUS_ISA, 0, 2, + MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH); + + current += acpi_create_madt_sci_override((void *)current); + + return current; +} + static int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu, u16 flags, u8 lint) { @@ -353,7 +365,10 @@ static void acpi_create_madt(acpi_madt_t *madt) if (CONFIG(ACPI_COMMON_MADT_LAPIC)) current = acpi_create_madt_lapics_with_nmis(current); - if (!CONFIG(ACPI_NO_MADT)) + if (CONFIG(ACPI_COMMON_MADT_IOAPIC)) + current = acpi_create_madt_ioapic_gsi0_default(current); + + if (CONFIG(ACPI_CUSTOM_MADT)) current = acpi_fill_madt(current); /* (Re)calculate length and checksum. */ diff --git a/src/mainboard/asus/p2b/Kconfig b/src/mainboard/asus/p2b/Kconfig index 986cfdeb98..a645bcc1f6 100644 --- a/src/mainboard/asus/p2b/Kconfig +++ b/src/mainboard/asus/p2b/Kconfig @@ -9,7 +9,7 @@ config BASE_ASUS_P2B_D config BOARD_SPECIFIC_OPTIONS def_bool y - select ACPI_NO_MADT + select ACPI_NO_CUSTOM_MADT select CPU_INTEL_SLOT_1 select NORTHBRIDGE_INTEL_I440BX select SOUTHBRIDGE_INTEL_I82371EB diff --git a/src/soc/intel/quark/Kconfig b/src/soc/intel/quark/Kconfig index 58f01daaeb..631755cca1 100644 --- a/src/soc/intel/quark/Kconfig +++ b/src/soc/intel/quark/Kconfig @@ -9,7 +9,7 @@ if SOC_INTEL_QUARK config CPU_SPECIFIC_OPTIONS def_bool y - select ACPI_NO_MADT + select ACPI_NO_CUSTOM_MADT select ARCH_X86 select NO_ECAM_MMCONF_SUPPORT select NO_SMM -- cgit v1.2.3