From 2e9f0d3b6aa754dc71cd36086d1eb2a839bdb7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 7 Apr 2023 23:05:46 +0300 Subject: ACPI: Add helper for MADT LAPICs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids some code duplication related to X2APIC mode. Change-Id: I592c69e0f52687924fe41189b082c86913999136 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/74312 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- src/soc/intel/common/block/acpi/cpu_hybrid.c | 11 +++-------- src/soc/intel/xeon_sp/spr/soc_acpi.c | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'src/soc') diff --git a/src/soc/intel/common/block/acpi/cpu_hybrid.c b/src/soc/intel/common/block/acpi/cpu_hybrid.c index 2e39f720ab..e18c28868f 100644 --- a/src/soc/intel/common/block/acpi/cpu_hybrid.c +++ b/src/soc/intel/common/block/acpi/cpu_hybrid.c @@ -81,14 +81,9 @@ static unsigned long acpi_create_madt_lapics_hybrid(unsigned long current) { size_t index; - for (index = 0; index < cpu_apic_info.total_cpu_cnt; index++) { - if (cpu_apic_info.apic_ids[index] < 0xff) - current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, - index, cpu_apic_info.apic_ids[index]); - else - current += acpi_create_madt_lx2apic((acpi_madt_lx2apic_t *)current, - index, cpu_apic_info.apic_ids[index]); - } + for (index = 0; index < cpu_apic_info.total_cpu_cnt; index++) + current = acpi_create_madt_one_lapic(current, index, + cpu_apic_info.apic_ids[index]); return current; } diff --git a/src/soc/intel/xeon_sp/spr/soc_acpi.c b/src/soc/intel/xeon_sp/spr/soc_acpi.c index 619e5bb423..c609f4fa65 100644 --- a/src/soc/intel/xeon_sp/spr/soc_acpi.c +++ b/src/soc/intel/xeon_sp/spr/soc_acpi.c @@ -540,8 +540,7 @@ unsigned long xeonsp_acpi_create_madt_lapics(unsigned long current) } if (!cpu->enabled) continue; - current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, num_cpus, - cpu->path.apic.apic_id); + current = acpi_create_madt_one_lapic(current, num_cpus, cpu->path.apic.apic_id); num_cpus++; } -- cgit v1.2.3