From b1859a6687553900337c9ace092517e921e95e3b Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 30 Apr 2020 21:27:47 -0700 Subject: cpu: Add a helper function cpu_get_lapic_addr This change adds a helper function cpu_get_lapic_addr() that returns LOCAL_APIC_ADDR for x86. It also adds a weak default implementation which returns 0 if platform does not support LAPIC. This is being done in preparation to move all ACPI table support in coreboot out of arch/x86. BUG=b:155428745 Change-Id: I4d9c50ee46804164712aaa22be1b434f800871ec Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/c/coreboot/+/40929 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Duncan Laurie --- src/arch/x86/acpi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/arch/x86/acpi.c') diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c index 5c15a5e6af..8e7b51d79d 100644 --- a/src/arch/x86/acpi.c +++ b/src/arch/x86/acpi.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -222,6 +221,15 @@ int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, return lapic_nmi->length; } +__weak uintptr_t cpu_get_lapic_addr(void) +{ + /* + * If an architecture does not support LAPIC, this weak implementation returns LAPIC + * addr as 0. + */ + return 0; +} + void acpi_create_madt(acpi_madt_t *madt) { acpi_header_t *header = &(madt->header); @@ -242,7 +250,7 @@ void acpi_create_madt(acpi_madt_t *madt) header->length = sizeof(acpi_madt_t); header->revision = get_acpi_table_revision(MADT); - madt->lapic_addr = LOCAL_APIC_ADDR; + madt->lapic_addr = cpu_get_lapic_addr(); if (CONFIG(ACPI_HAVE_PCAT_8259)) madt->flags |= 1; -- cgit v1.2.3