summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-11-12 18:51:04 +0100
committerArthur Heymans <arthur@aheymans.xyz>2022-11-29 19:58:13 +0000
commitcc22607dbfbab0c9ce42c071b5b3c4a304845313 (patch)
tree529d9b50ba52c291f72a5c6eb6df2459a5b61a93 /src/drivers
parentaab91213b2189472cc3f0e6bc11bf60e76902771 (diff)
Revert "src/arch/x86: Use core apic id to get cpu_index()"
This reverts commit 095c931cf12924da9011b47aa64f4a6f11d89f13. Previously cpu_info() was implemented with a struct on top of an aligned stack. As FSP changed the stack value cpu_info() could not be used in FSP context (which PPI is). Now cpu_info() uses GDT segments, which FSP does not touch so it can be used. This also exports cpu_infos from cpu.c as it's a convenient way to get the struct device * for a certain index. TESTED on aldrvp: FSP-S works and is able to run code on APs. Change-Id: I3a40156ba275b572d7d1913d8c17c24b4c8f6d78 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69509 Reviewed-by: Subrata Banik <subratabanik@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c b/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c
index 66bbc2f085..d286ee325b 100644
--- a/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c
+++ b/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c
@@ -31,16 +31,17 @@ efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number,
int apicid;
uint8_t package, core, thread;
- if (cpu_index() < 0)
+ if (processor_number >= MIN(get_cpu_count(), CONFIG_MAX_CPUS))
+ return FSP_NOT_FOUND;
+
+ extern struct cpu_info cpu_infos[];
+ struct cpu_info *info = &cpu_infos[processor_number];
+ if (!info)
return FSP_DEVICE_ERROR;
if (processor_info_buffer == NULL)
return FSP_INVALID_PARAMETER;
-
- if (processor_number >= get_cpu_count())
- return FSP_NOT_FOUND;
-
- apicid = cpu_get_apic_id(processor_number);
+ apicid = info->cpu->path.apic.apic_id;
if (apicid < 0)
return FSP_DEVICE_ERROR;
@@ -66,7 +67,7 @@ efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number,
efi_return_status_t mp_startup_all_aps(efi_ap_procedure procedure,
bool run_serial, efi_uintn_t timeout_usec, void *argument)
{
- if (cpu_index() < 0)
+ if (!cpu_info())
return FSP_DEVICE_ERROR;
if (procedure == NULL)
@@ -84,7 +85,7 @@ efi_return_status_t mp_startup_all_aps(efi_ap_procedure procedure,
efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure,
efi_uintn_t timeout_usec, void *argument)
{
- if (cpu_index() < 0)
+ if (!cpu_info())
return FSP_DEVICE_ERROR;
if (procedure == NULL)
@@ -119,7 +120,7 @@ efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure,
efi_return_status_t mp_startup_this_ap(efi_ap_procedure procedure,
efi_uintn_t processor_number, efi_uintn_t timeout_usec, void *argument)
{
- if (cpu_index() < 0)
+ if (!cpu_info())
return FSP_DEVICE_ERROR;
if (processor_number > get_cpu_count())