From aab91213b2189472cc3f0e6bc11bf60e76902771 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Sat, 12 Nov 2022 19:10:43 +0100 Subject: [PATCH] soc/intel/alderlake/acpi.c: Don't look up coreboot CPU index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The coreboot CPU index for a lapic is arbitrary: it depends on which CPU obtains a spinlock first. Simply using an increasing index will result in consistent ACPI tables across each boot. Change-Id: Iaaaef213b32b33e3ec9f4874d576896c2335211c Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/69510 Reviewed-by: Kyösti Mälkki Reviewed-by: Werner Zeh Tested-by: build bot (Jenkins) --- src/soc/intel/alderlake/acpi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/soc/intel/alderlake/acpi.c b/src/soc/intel/alderlake/acpi.c index 1c820c2750..c874067701 100644 --- a/src/soc/intel/alderlake/acpi.c +++ b/src/soc/intel/alderlake/acpi.c @@ -279,6 +279,7 @@ void soc_lpi_get_constraints(void *unused) acpigen_emit_byte(RETURN_OP); acpigen_write_package(num_entries); + size_t cpu_index = 0; for (dev = all_devices; dev; dev = dev->next) { min_sleep_state = get_min_sleep_state(dev); if (min_sleep_state == NONE) @@ -294,15 +295,8 @@ void soc_lpi_get_constraints(void *unused) break; case DEVICE_PATH_APIC: - /* Lookup CPU id */ - for (size_t i = 0; i < CONFIG_MAX_CPUS; i++) { - if (cpu_get_apic_id(i) == dev->path.apic.apic_id) { - snprintf(path, sizeof(path), - CONFIG_ACPI_CPU_STRING, i); - break; - } - } - + snprintf(path, sizeof(path), CONFIG_ACPI_CPU_STRING, + cpu_index++); acpigen_emit_namestring(path); break;