Lean Sheng Tan has submitted this change. ( https://review.coreboot.org/c/coreboot/+/76070?usp=email )
Change subject: acpi/acpi.c: Add and use acpi_arch_fill_madt() ......................................................................
acpi/acpi.c: Add and use acpi_arch_fill_madt()
Signed-off-by: Arthur Heymans arthur@aheymans.xyz Change-Id: I4e5032fd02af7e8e9ffd2e20aa214a8392ab6335 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76070 Reviewed-by: Eric Lai eric_lai@quanta.corp-partner.google.com Reviewed-by: Lean Sheng Tan sheng.tan@9elements.com Reviewed-by: Sridhar Siricilla sridhar.siricilla@intel.com Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/acpi/acpi.c M src/acpi/acpi_apic.c M src/include/acpi/acpi.h 3 files changed, 20 insertions(+), 13 deletions(-)
Approvals: Kyösti Mälkki: Looks good to me, approved Eric Lai: Looks good to me, but someone else must approve Lean Sheng Tan: Looks good to me, approved Sridhar Siricilla: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 65be82e..1330f12 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -165,15 +165,7 @@ if (acpi_fill_header(header, "APIC", MADT, sizeof(acpi_madt_t)) != CB_SUCCESS) return;
- madt->lapic_addr = cpu_get_lapic_addr(); - if (CONFIG(ACPI_HAVE_PCAT_8259)) - madt->flags |= 1; - - if (CONFIG(ACPI_COMMON_MADT_LAPIC)) - current = acpi_create_madt_lapics_with_nmis(current); - - if (CONFIG(ACPI_COMMON_MADT_IOAPIC)) - current = acpi_create_madt_ioapic_gsi0_default(current); + current = acpi_arch_fill_madt(madt, current);
if (CONFIG(ACPI_CUSTOM_MADT)) current = acpi_fill_madt(current); diff --git a/src/acpi/acpi_apic.c b/src/acpi/acpi_apic.c index 38daaab..f952d0a 100644 --- a/src/acpi/acpi_apic.c +++ b/src/acpi/acpi_apic.c @@ -139,7 +139,7 @@ return irqoverride->length; }
-unsigned long acpi_create_madt_ioapic_gsi0_default(unsigned long current) +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);
@@ -194,7 +194,7 @@ return current; }
-unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current) +static unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current) { current = acpi_create_madt_lapics(current); current = acpi_create_madt_lapic_nmis(current); @@ -227,3 +227,19 @@
return x2apic->length; } + +unsigned long acpi_arch_fill_madt(acpi_madt_t *madt, unsigned long current) +{ + madt->lapic_addr = cpu_get_lapic_addr(); + + if (CONFIG(ACPI_HAVE_PCAT_8259)) + madt->flags |= 1; + + if (CONFIG(ACPI_COMMON_MADT_LAPIC)) + current = acpi_create_madt_lapics_with_nmis(current); + + if (CONFIG(ACPI_COMMON_MADT_IOAPIC)) + current = acpi_create_madt_ioapic_gsi0_default(current); + + return current; +} diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h index 510c790..151cdd0 100644 --- a/src/include/acpi/acpi.h +++ b/src/include/acpi/acpi.h @@ -1530,6 +1530,7 @@ void preload_acpi_dsdt(void); unsigned long write_acpi_tables(const unsigned long addr); unsigned long acpi_fill_madt(unsigned long current); +unsigned long acpi_arch_fill_madt(acpi_madt_t *madt, unsigned long current);
void acpi_fill_fadt(acpi_fadt_t *fadt); void arch_fill_fadt(acpi_fadt_t *fadt); @@ -1556,12 +1557,10 @@ u8 eniw, u32 hbig, u16 restriction, u16 qtg_id, const u32 *interleave_target);
-unsigned long acpi_create_madt_ioapic_gsi0_default(unsigned long current); int acpi_create_madt_ioapic_from_hw(acpi_madt_ioapic_t *ioapic, u32 addr);
unsigned long acpi_create_madt_one_lapic(unsigned long current, u32 cpu, u32 apic);
-unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current); unsigned long acpi_create_madt_lapic_nmis(unsigned long current);
int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic);