From 8b8400a889abadbbd2156d4a35a27203068766f1 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 4 Nov 2022 13:27:07 +0100 Subject: drivers/fsp2_0/mp_service_ppi: Use struct device to fill in buffer Now the CPU topology is filled in struct device during mp_init. Change-Id: I7322b43f5b95dda5fbe81e7427f5269c9d6f8755 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/69223 Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/drivers') 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 d286ee325b..a891ba0109 100644 --- a/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c +++ b/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c @@ -28,9 +28,6 @@ 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) { - int apicid; - uint8_t package, core, thread; - if (processor_number >= MIN(get_cpu_count(), CONFIG_MAX_CPUS)) return FSP_NOT_FOUND; @@ -39,14 +36,10 @@ efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number, if (!info) return FSP_DEVICE_ERROR; + struct device *dev = info->cpu; + if (processor_info_buffer == NULL) return FSP_INVALID_PARAMETER; - apicid = info->cpu->path.apic.apic_id; - - if (apicid < 0) - return FSP_DEVICE_ERROR; - - processor_info_buffer->ProcessorId = apicid; processor_info_buffer->StatusFlag = PROCESSOR_HEALTH_STATUS_BIT | PROCESSOR_ENABLED_BIT; @@ -54,12 +47,10 @@ efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number, if (processor_number == BSP_CPU_SLOT) processor_info_buffer->StatusFlag |= PROCESSOR_AS_BSP_BIT; - /* Fill EFI_CPU_PHYSICAL_LOCATION structure information */ - get_cpu_topology_from_apicid(apicid, &package, &core, &thread); - - processor_info_buffer->Location.Package = package; - processor_info_buffer->Location.Core = core; - processor_info_buffer->Location.Thread = thread; + processor_info_buffer->ProcessorId = dev->path.apic.apic_id; + processor_info_buffer->Location.Package = dev->path.apic.package_id; + processor_info_buffer->Location.Core = dev->path.apic.core_id; + processor_info_buffer->Location.Thread = dev->path.apic.thread_id; return FSP_SUCCESS; } -- cgit v1.2.3