soc/intel/alderlake/acpi.c: Don't look up coreboot CPU index

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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69510
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/intel/alderlake/acpi.c b/src/soc/intel/alderlake/acpi.c
index 1c820c2..c874067 100644
--- a/src/soc/intel/alderlake/acpi.c
+++ b/src/soc/intel/alderlake/acpi.c
@@ -279,6 +279,7 @@
 	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 @@
 				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;