From 7e1c8e21597afd1d21558af51ce6d9a40dbaa0b3 Mon Sep 17 00:00:00 2001 From: Appukuttan V K Date: Wed, 3 Apr 2024 23:23:24 +0530 Subject: [PATCH] drivers/intel/fsp2_0: Add dedicated caller function for ap procedure calls Add FSP 2 Multi Processor Platform Initialization module a function indirection to ensure that efi_ap_procedure functions are called with the appropriate C calling convention. BUG=b:329034258 TEST=Verified both x86_32 and x86_64 builds on Meteor Lake board (Rex) Change-Id: I64e65b2941207375d5e27c84aa26061e7e72a7f6 Signed-off-by: Appukuttan V K Reviewed-on: https://review.coreboot.org/c/coreboot/+/81663 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 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 a891ba0109..41fccd6a52 100644 --- a/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c +++ b/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c @@ -12,6 +12,18 @@ #define BSP_CPU_SLOT 0 +struct efi_ap_procedure_caller_params { + efi_ap_procedure procedure; + void *argument; +}; + +static void efi_ap_procedure_caller(void *arg) +{ + struct efi_ap_procedure_caller_params *params = + (struct efi_ap_procedure_caller_params *)arg; + params->procedure(params->argument); +} + efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processors, efi_uintn_t *number_of_enabled_processors) { @@ -58,14 +70,19 @@ 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) { + struct efi_ap_procedure_caller_params params = { + .procedure = procedure, + .argument = argument + }; + if (!cpu_info()) return FSP_DEVICE_ERROR; if (procedure == NULL) return FSP_INVALID_PARAMETER; - if (mp_run_on_all_aps((void *)procedure, argument, timeout_usec, !run_serial) != - CB_SUCCESS) { + if (mp_run_on_all_aps((void *)efi_ap_procedure_caller, ¶ms, + timeout_usec, !run_serial) != CB_SUCCESS) { printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__); return FSP_NOT_STARTED; } @@ -76,6 +93,11 @@ 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) { + struct efi_ap_procedure_caller_params params = { + .procedure = procedure, + .argument = argument + }; + if (!cpu_info()) return FSP_DEVICE_ERROR; @@ -99,8 +121,8 @@ efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure, * due to lack of acquiring a spin lock while accessing common data structure in * multiprocessor environment. */ - if (mp_run_on_all_aps((void *)procedure, argument, timeout_usec, false) != - CB_SUCCESS) { + if (mp_run_on_all_aps((void *)efi_ap_procedure_caller, + ¶ms, timeout_usec, false) != CB_SUCCESS) { printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__); return FSP_NOT_STARTED; } @@ -111,6 +133,11 @@ 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) { + struct efi_ap_procedure_caller_params params = { + .procedure = procedure, + .argument = argument + }; + if (!cpu_info()) return FSP_DEVICE_ERROR; @@ -123,7 +150,7 @@ efi_return_status_t mp_startup_this_ap(efi_ap_procedure procedure, if (procedure == NULL) return FSP_INVALID_PARAMETER; - if (mp_run_on_aps((void *)procedure, argument, + if (mp_run_on_aps((void *)efi_ap_procedure_caller, ¶ms, processor_number, timeout_usec) != CB_SUCCESS) { printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__); return FSP_NOT_STARTED;