diff options
author | Aamir Bohra <aamir.bohra@intel.com> | 2021-02-19 16:35:09 +0530 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2021-02-23 03:39:54 +0000 |
commit | 01ae4a7706f95bfe77fd629516d3b9436ae9629d (patch) | |
tree | 4d2ef787993a99a2f448ae87ff990ae5fbec4e79 | |
parent | d192590e29167a34a55439308686957feee07b71 (diff) | |
download | coreboot-01ae4a7706f95bfe77fd629516d3b9436ae9629d.tar.xz |
intel/fsp2_0: Fix the mp_get_processor_info
FSP expects mp_get_processor_info to give processor specfic apic ID,
core(zero-indexed), package(zero-indexed) and thread(zero-indexed) info.
This function is run from BSP for all logical processor, With current
implementation the location information returned is incorrect per logical
processor. Also the processor id returned does not correspond to the
processor index, rather is returned only for the BSP.
BUG=b:179113790
Change-Id: Ief8677e4830a765af61a0df9621ecaa372730fca
Signed-off-by: Aamir Bohra <aamir.bohra@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50880
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c | 21 |
1 files changed, 13 insertions, 8 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 87056a5b7c..29a02b108c 100644 --- a/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c +++ b/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include <console/console.h> +#include <cpu/cpu.h> #include <cpu/x86/mp.h> #include <cpu/x86/lapic.h> #include <cpu/intel/microcode.h> @@ -10,7 +11,6 @@ #include <intelblocks/mp_init.h> #define BSP_CPU_SLOT 0 -#define SINGLE_CHIP_PACKAGE 0 efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processors, efi_uintn_t *number_of_enabled_processors) @@ -28,7 +28,8 @@ efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processor efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number, efi_processor_information *processor_info_buffer) { - unsigned int num_virt_cores, num_phys_cores; + int apicid; + uint8_t package, core, thread; if (cpu_index() < 0) return FSP_DEVICE_ERROR; @@ -39,7 +40,12 @@ efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number, if (processor_number >= get_cpu_count()) return FSP_NOT_FOUND; - processor_info_buffer->ProcessorId = lapicid(); + apicid = cpu_get_apic_id(processor_number); + + if (apicid < 0) + return FSP_DEVICE_ERROR; + + processor_info_buffer->ProcessorId = apicid; processor_info_buffer->StatusFlag = PROCESSOR_HEALTH_STATUS_BIT | PROCESSOR_ENABLED_BIT; @@ -48,12 +54,11 @@ efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number, processor_info_buffer->StatusFlag |= PROCESSOR_AS_BSP_BIT; /* Fill EFI_CPU_PHYSICAL_LOCATION structure information */ - cpu_read_topology(&num_phys_cores, &num_virt_cores); + get_cpu_topology_from_apicid(apicid, &package, &core, &thread); - /* FSP will add one to the value in this Package field */ - processor_info_buffer->Location.Package = SINGLE_CHIP_PACKAGE; - processor_info_buffer->Location.Core = num_phys_cores; - processor_info_buffer->Location.Thread = num_virt_cores; + processor_info_buffer->Location.Package = package; + processor_info_buffer->Location.Core = core; + processor_info_buffer->Location.Thread = thread; return FSP_SUCCESS; } |