From 30cca6ca2ad92c44104fc5a1f261356b038abe20 Mon Sep 17 00:00:00 2001 From: Aamir Bohra Date: Thu, 4 Feb 2021 20:57:51 +0530 Subject: drivers/intel/fsp2_0: Add support for MP services2 PPI Add support for MP services2 PPIs, which is slight modification over MP services 1 PPIs. A new API StartupAllCPUs have been added to allow running a task on BSP and all APs. Also the EFI_PEI_SERVICES parameter has been removed from all MP PPI APIs. This implementation also selects the respective MP services PPI version supported for SoCs BUG=b:169196864 Change-Id: Id74baf17fb90147d229c78be90268fdc3ec1badc Signed-off-by: Aamir Bohra Reviewed-on: https://review.coreboot.org/c/coreboot/+/49474 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/intel/fsp2_0/Kconfig | 3 - .../intel/fsp2_0/include/fsp/ppi/mp_service_ppi.h | 36 ++- src/drivers/intel/fsp2_0/ppi/Kconfig | 25 +- src/drivers/intel/fsp2_0/ppi/Makefile.inc | 2 + src/drivers/intel/fsp2_0/ppi/mp_service1.c | 76 ++++++ src/drivers/intel/fsp2_0/ppi/mp_service2.c | 86 +++++++ src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c | 77 ++---- src/include/efi/efi_datatype.h | 22 -- src/soc/intel/alderlake/Kconfig | 2 +- src/soc/intel/elkhartlake/Kconfig | 2 +- src/soc/intel/icelake/Kconfig | 2 +- src/soc/intel/jasperlake/Kconfig | 2 +- src/soc/intel/tigerlake/Kconfig | 2 +- .../MdePkg/Include/Ppi/MpServices2.h | 279 +++++++++++++++++++++ 14 files changed, 527 insertions(+), 89 deletions(-) create mode 100644 src/drivers/intel/fsp2_0/ppi/mp_service1.c create mode 100644 src/drivers/intel/fsp2_0/ppi/mp_service2.c create mode 100644 src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Ppi/MpServices2.h diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index d294786889..285bedf8b7 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -268,7 +268,4 @@ config SOC_INTEL_COMMON_FSP_RESET Common code block to handle platform reset request raised by FSP. The FSP will use the FSP EAS v2.0 section 12.2.2 (OEM Status Code) to indicate that a reset is required. - -source "src/drivers/intel/fsp2_0/ppi/Kconfig" - endif diff --git a/src/drivers/intel/fsp2_0/include/fsp/ppi/mp_service_ppi.h b/src/drivers/intel/fsp2_0/include/fsp/ppi/mp_service_ppi.h index 836e996631..3c30063111 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/ppi/mp_service_ppi.h +++ b/src/drivers/intel/fsp2_0/include/fsp/ppi/mp_service_ppi.h @@ -11,10 +11,36 @@ #include #include -/* - * SOC must call this function to get required EFI_PEI_MP_SERVICES_PPI - * structure. - */ -efi_pei_mp_services_ppi *mp_fill_ppi_services_data(void); +/* SOC must call this function to get required EFI_PEI_MP_SERVICES_PPI structure */ +void *mp_fill_ppi_services_data(void); + +/* get the number of logical processors in the platform */ +efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processors, + efi_uintn_t *number_of_enabled_processors); + +/* get processor info such as id, status */ +efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number, + efi_processor_information *processor_info_buffer); + +/* executes a caller provided function on all enabled APs */ +efi_return_status_t mp_startup_all_aps(efi_ap_procedure procedure, + efi_uintn_t timeout_usec, void *argument); + +/* executes a caller provided function on all enabled APs + BSP */ +efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure, + efi_uintn_t timeout_usec, void *argument); + +/* executes a caller provided function on specific AP */ +efi_return_status_t mp_startup_this_ap(efi_ap_procedure procedure, + efi_uintn_t processor_number, efi_uintn_t timeout_usec, void *argument); + +/* get the processor instance */ +efi_return_status_t mp_identify_processor(efi_uintn_t *processor_number); + +/* for the APIs that are not supported/required */ +static inline efi_return_status_t mp_api_unsupported(void) +{ + return FSP_UNSUPPORTED; +} #endif /* MP_SERVICE_PPI_H */ diff --git a/src/drivers/intel/fsp2_0/ppi/Kconfig b/src/drivers/intel/fsp2_0/ppi/Kconfig index bb99dc3474..7cbc87f7ab 100644 --- a/src/drivers/intel/fsp2_0/ppi/Kconfig +++ b/src/drivers/intel/fsp2_0/ppi/Kconfig @@ -5,7 +5,24 @@ config MP_SERVICES_PPI default n depends on SOC_INTEL_COMMON_BLOCK_CPU_MPINIT help - This option allows SoC user to create MP service PPI for Intel - FSP usage, coreboot will provide EFI_PEI_MP_SERVICES_PPI structure - definitions along with all APIs as per EDK2 specification. Intel FSP - will use this PPI to run CPU feature programming on APs. + This option allows to create MP service PPI for Intel FSP usage. + Intel FSP will use this PPI to run CPU feature programming on APs. + +config MP_SERVICES_PPI_V1 + bool + default n + select MP_SERVICES_PPI + help + This option provides EFI_PEI_MP_SERVICES_PPI structure definitions + along with all APIs as per EDK2 specification. + +config MP_SERVICES_PPI_V2 + bool + default n + select MP_SERVICES_PPI + help + This option provides EDKII_PEI_MP_SERVICES2_PPI structure definitions + along with all APIs as per EDK2 specification. MP services2 PPI is slight + modification over MP services1 PPIs. A new API StartupAllCPUs have been + added to allow running a task on BSP and all APs. Also the EFI_PEI_SERVICES + parameter has been removed from all MP PPI APIs. diff --git a/src/drivers/intel/fsp2_0/ppi/Makefile.inc b/src/drivers/intel/fsp2_0/ppi/Makefile.inc index 59a550f909..8bda899ea9 100644 --- a/src/drivers/intel/fsp2_0/ppi/Makefile.inc +++ b/src/drivers/intel/fsp2_0/ppi/Makefile.inc @@ -1,3 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only ramstage-$(CONFIG_MP_SERVICES_PPI) += mp_service_ppi.c +ramstage-$(CONFIG_MP_SERVICES_PPI_V1) += mp_service1.c +ramstage-$(CONFIG_MP_SERVICES_PPI_V2) += mp_service2.c diff --git a/src/drivers/intel/fsp2_0/ppi/mp_service1.c b/src/drivers/intel/fsp2_0/ppi/mp_service1.c new file mode 100644 index 0000000000..7d351e40f4 --- /dev/null +++ b/src/drivers/intel/fsp2_0/ppi/mp_service1.c @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include + +typedef EFI_PEI_MP_SERVICES_PPI efi_pei_mp_services_ppi; + +static efi_return_status_t mps1_get_number_of_processors(const + efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, + efi_uintn_t *number_of_processors, efi_uintn_t *number_of_enabled_processors) +{ + return mp_get_number_of_processors(number_of_processors, number_of_enabled_processors); +} + +static efi_return_status_t mps1_get_processor_info(const + efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, + efi_uintn_t processor_number, + efi_processor_information *processor_info_buffer) +{ + return mp_get_processor_info(processor_number, processor_info_buffer); +} + +static efi_return_status_t mps1_startup_all_aps(const + efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, + efi_ap_procedure procedure, efi_boolean_t ignored3, + efi_uintn_t timeout_usec, void *argument) +{ + return mp_startup_all_aps(procedure, timeout_usec, argument); +} + +static efi_return_status_t mps1_startup_this_ap(const + efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, + efi_ap_procedure procedure, efi_uintn_t processor_number, + efi_uintn_t timeout_usec, void *argument) +{ + return mp_startup_this_ap(procedure, processor_number, timeout_usec, argument); +} + +static efi_return_status_t mps1_switch_bsp(const efi_pei_services **ignored1, + efi_pei_mp_services_ppi *ignored2, efi_uintn_t ignored3, + efi_boolean_t ignored4) +{ + return mp_api_unsupported(); +} + +static efi_return_status_t mps1_enable_disable_ap(const + efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, + efi_uintn_t ignored3, efi_boolean_t ignored4, efi_uint32_t *ignored5) +{ + return mp_api_unsupported(); +} + +static efi_return_status_t mps1_identify_processor(const + efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, + efi_uintn_t *processor_number) +{ + return mp_identify_processor(processor_number); +} + +/* EDK2 UEFIPKG Open Source MP Service PPI to be installed */ + +static efi_pei_mp_services_ppi mp_service1_ppi = { + mps1_get_number_of_processors, + mps1_get_processor_info, + mps1_startup_all_aps, + mps1_startup_this_ap, + mps1_switch_bsp, + mps1_enable_disable_ap, + mps1_identify_processor, +}; + +void *mp_fill_ppi_services_data(void) +{ + return (void *)&mp_service1_ppi; +} diff --git a/src/drivers/intel/fsp2_0/ppi/mp_service2.c b/src/drivers/intel/fsp2_0/ppi/mp_service2.c new file mode 100644 index 0000000000..8d27b16e77 --- /dev/null +++ b/src/drivers/intel/fsp2_0/ppi/mp_service2.c @@ -0,0 +1,86 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include + +typedef EDKII_PEI_MP_SERVICES2_PPI efi_pei_mp_services_ppi; + +static efi_return_status_t mps2_get_number_of_processors( + efi_pei_mp_services_ppi *ignored1, + efi_uintn_t *number_of_processors, + efi_uintn_t *number_of_enabled_processors) +{ + return mp_get_number_of_processors(number_of_processors, number_of_enabled_processors); +} + +static efi_return_status_t mps2_get_processor_info( + efi_pei_mp_services_ppi *ignored1, + efi_uintn_t processor_number, + efi_processor_information *processor_info_buffer) +{ + return mp_get_processor_info(processor_number, processor_info_buffer); +} + +static efi_return_status_t mps2_startup_all_aps( + efi_pei_mp_services_ppi *ignored1, + efi_ap_procedure procedure, efi_boolean_t ignored2, + efi_uintn_t timeout_usec, void *argument) +{ + return mp_startup_all_aps(procedure, timeout_usec, argument); +} + +static efi_return_status_t mps2_startup_all_cpus( + efi_pei_mp_services_ppi *ignored1, + efi_ap_procedure procedure, + efi_uintn_t timeout_usec, void *argument) +{ + return mp_startup_all_cpus(procedure, timeout_usec, argument); +} + +static efi_return_status_t mps2_startup_this_ap( + efi_pei_mp_services_ppi *ignored1, + efi_ap_procedure procedure, efi_uintn_t processor_number, + efi_uintn_t timeout_usec, void *argument) +{ + return mp_startup_this_ap(procedure, processor_number, timeout_usec, argument); +} + +static efi_return_status_t mps2_switch_bsp( + efi_pei_mp_services_ppi *ignored1, efi_uintn_t ignored2, + efi_boolean_t ignored3) +{ + return mp_api_unsupported(); +} + +static efi_return_status_t mps2_enable_disable_ap( + efi_pei_mp_services_ppi *ignored1, + efi_uintn_t ignored2, efi_boolean_t ignored3, efi_uint32_t *ignored4) +{ + return mp_api_unsupported(); +} + +static efi_return_status_t mps2_identify_processor( + efi_pei_mp_services_ppi *ignored1, + efi_uintn_t *processor_number) +{ + return mp_identify_processor(processor_number); +} + +/* EDK2 UEFIPKG Open Source MP Services 2 PPI to be installed */ + +static efi_pei_mp_services_ppi mp_service2_ppi = { + mps2_get_number_of_processors, + mps2_get_processor_info, + mps2_startup_all_aps, + mps2_startup_this_ap, + mps2_switch_bsp, + mps2_enable_disable_ap, + mps2_identify_processor, + mps2_startup_all_cpus, +}; + +void *mp_fill_ppi_services_data(void) +{ + return (void *)&mp_service2_ppi; +} 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 03184e16ca..87056a5b7c 100644 --- a/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c +++ b/src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c @@ -12,9 +12,7 @@ #define BSP_CPU_SLOT 0 #define SINGLE_CHIP_PACKAGE 0 -static efi_return_status_t mp_get_number_of_processors(const - efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, - efi_uintn_t *number_of_processors, +efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processors, efi_uintn_t *number_of_enabled_processors) { if (number_of_processors == NULL || number_of_enabled_processors == @@ -27,9 +25,7 @@ static efi_return_status_t mp_get_number_of_processors(const return FSP_SUCCESS; } -static efi_return_status_t mp_get_processor_info(const - efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, - efi_uintn_t processor_number, +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; @@ -62,9 +58,7 @@ static efi_return_status_t mp_get_processor_info(const return FSP_SUCCESS; } -static efi_return_status_t mp_startup_all_aps(const - efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, - efi_ap_procedure procedure, efi_boolean_t ignored3, +efi_return_status_t mp_startup_all_aps(efi_ap_procedure procedure, efi_uintn_t timeout_usec, void *argument) { if (cpu_index() < 0) @@ -82,14 +76,34 @@ static efi_return_status_t mp_startup_all_aps(const return FSP_SUCCESS; } -static efi_return_status_t mp_startup_this_ap(const - efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, - efi_ap_procedure procedure, efi_uintn_t processor_number, +efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure, efi_uintn_t timeout_usec, void *argument) { if (cpu_index() < 0) return FSP_DEVICE_ERROR; + if (procedure == NULL) + return FSP_INVALID_PARAMETER; + + /* Run on BSP */ + procedure(argument); + + /* Run on APs */ + if (mp_run_on_aps((void *)procedure, argument, + MP_RUN_ON_ALL_CPUS, timeout_usec)) { + printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__); + return FSP_NOT_STARTED; + } + + return FSP_SUCCESS; +} + +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) + return FSP_DEVICE_ERROR; + if (processor_number > get_cpu_count()) return FSP_NOT_FOUND; @@ -108,25 +122,7 @@ static efi_return_status_t mp_startup_this_ap(const return FSP_SUCCESS; } -static efi_return_status_t mp_switch_bsp(const efi_pei_services **ignored1, - efi_pei_mp_services_ppi *ignored2, efi_uintn_t ignored3, - efi_boolean_t ignored4) -{ - /* FSP don't need this API hence return unsupported */ - return FSP_UNSUPPORTED; -} - -static efi_return_status_t mp_enable_disable_ap(const - efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, - efi_uintn_t ignored3, efi_boolean_t ignored4, efi_uint32_t *ignored5) -{ - /* FSP don't need this API hence return unsupported */ - return FSP_UNSUPPORTED; -} - -static efi_return_status_t mp_identify_processor(const - efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, - efi_uintn_t *processor_number) +efi_return_status_t mp_identify_processor(efi_uintn_t *processor_number) { int index; @@ -142,22 +138,3 @@ static efi_return_status_t mp_identify_processor(const return FSP_SUCCESS; } - -/* - * EDK2 UEFIPKG Open Source MP Service PPI to be installed - */ - -static efi_pei_mp_services_ppi mp_service_ppi = { - mp_get_number_of_processors, - mp_get_processor_info, - mp_startup_all_aps, - mp_startup_this_ap, - mp_switch_bsp, - mp_enable_disable_ap, - mp_identify_processor, -}; - -efi_pei_mp_services_ppi *mp_fill_ppi_services_data(void) -{ - return &mp_service_ppi; -} diff --git a/src/include/efi/efi_datatype.h b/src/include/efi/efi_datatype.h index f6a20a7056..8766183d7a 100644 --- a/src/include/efi/efi_datatype.h +++ b/src/include/efi/efi_datatype.h @@ -3,66 +3,44 @@ /* Create EFI equivalent datatype in coreboot based on UEFI specification */ #ifndef __EFI_DATATYPE_H__ #define __EFI_DATATYPE_H__ - #include #include -#include /* Basic Data types */ - /* 8-byte unsigned value. */ typedef UINT64 efi_uint64_t; - /* 8-byte signed value. */ typedef INT64 efi_int64_t; - /* 4-byte unsigned value. */ typedef UINT32 efi_uint32_t; - /* 4-byte signed value. */ typedef INT32 efi_int32_t; - /* 2-byte unsigned value. */ typedef UINT16 efi_uint16_t; - /* 2-byte Character. */ typedef CHAR16 efi_char16_t; - /* 2-byte signed value. */ typedef INT16 efi_int16_t; - /* Logical Boolean. */ typedef BOOLEAN efi_boolean_t; - /* 1-byte unsigned value. */ typedef UINT8 efi_uint8_t; - /* 1-byte Character */ typedef CHAR8 efi_char8_t; - /* 1-byte signed value */ typedef INT8 efi_int8_t; - /* Unsigned value of native width. */ typedef UINTN efi_uintn_t; - /* Signed value of native width. */ typedef INTN efi_intn_t; - /* Status codes common to all execution phases */ typedef EFI_STATUS efi_return_status_t; - /* Data structure */ - /* Data structure for EFI_PEI_SERVICE. */ typedef EFI_PEI_SERVICES efi_pei_services; -/* Data structure for UEFI PI Multi-processor PPI */ -typedef EFI_PEI_MP_SERVICES_PPI efi_pei_mp_services_ppi; - /* Structure that describes information about a logical CPU. */ typedef EFI_PROCESSOR_INFORMATION efi_processor_information; - /* * The function prototype for invoking a function on an * Application Processor. diff --git a/src/soc/intel/alderlake/Kconfig b/src/soc/intel/alderlake/Kconfig index 91a3f65d25..ec79855074 100644 --- a/src/soc/intel/alderlake/Kconfig +++ b/src/soc/intel/alderlake/Kconfig @@ -34,7 +34,7 @@ config CPU_SPECIFIC_OPTIONS select INTEL_GMA_ADD_VBT if RUN_FSP_GOP select IOAPIC select INTEL_TME - select MP_SERVICES_PPI + select MP_SERVICES_PPI_V2 select MRC_SETTINGS_PROTECT select PARALLEL_MP select PARALLEL_MP_AP_WORK diff --git a/src/soc/intel/elkhartlake/Kconfig b/src/soc/intel/elkhartlake/Kconfig index 8c0b4e6f91..25804d7d02 100644 --- a/src/soc/intel/elkhartlake/Kconfig +++ b/src/soc/intel/elkhartlake/Kconfig @@ -26,7 +26,7 @@ config CPU_SPECIFIC_OPTIONS select INTEL_GMA_ACPI select INTEL_GMA_ADD_VBT if RUN_FSP_GOP select IOAPIC - select MP_SERVICES_PPI + select MP_SERVICES_PPI_V1 select MRC_SETTINGS_PROTECT select PARALLEL_MP select PARALLEL_MP_AP_WORK diff --git a/src/soc/intel/icelake/Kconfig b/src/soc/intel/icelake/Kconfig index 7915bdb869..501e6c3339 100644 --- a/src/soc/intel/icelake/Kconfig +++ b/src/soc/intel/icelake/Kconfig @@ -26,7 +26,7 @@ config CPU_SPECIFIC_OPTIONS select INTEL_GMA_ACPI select INTEL_GMA_ADD_VBT if RUN_FSP_GOP select IOAPIC - select MP_SERVICES_PPI + select MP_SERVICES_PPI_V1 select MRC_SETTINGS_PROTECT select PARALLEL_MP select PARALLEL_MP_AP_WORK diff --git a/src/soc/intel/jasperlake/Kconfig b/src/soc/intel/jasperlake/Kconfig index 81503c3cde..08bd4be651 100644 --- a/src/soc/intel/jasperlake/Kconfig +++ b/src/soc/intel/jasperlake/Kconfig @@ -27,7 +27,7 @@ config CPU_SPECIFIC_OPTIONS select INTEL_GMA_ACPI select INTEL_GMA_ADD_VBT if RUN_FSP_GOP select IOAPIC - select MP_SERVICES_PPI + select MP_SERVICES_PPI_V1 select MRC_SETTINGS_PROTECT select PARALLEL_MP select PARALLEL_MP_AP_WORK diff --git a/src/soc/intel/tigerlake/Kconfig b/src/soc/intel/tigerlake/Kconfig index 6ffde9274b..3e080cce60 100644 --- a/src/soc/intel/tigerlake/Kconfig +++ b/src/soc/intel/tigerlake/Kconfig @@ -30,7 +30,7 @@ config CPU_SPECIFIC_OPTIONS select INTEL_GMA_ACPI select INTEL_GMA_ADD_VBT if RUN_FSP_GOP select IOAPIC - select MP_SERVICES_PPI + select MP_SERVICES_PPI_V1 select MRC_SETTINGS_PROTECT select PARALLEL_MP select PARALLEL_MP_AP_WORK diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Ppi/MpServices2.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Ppi/MpServices2.h new file mode 100644 index 0000000000..8efa6fed87 --- /dev/null +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Ppi/MpServices2.h @@ -0,0 +1,279 @@ +/** @file + This file declares EDKII Multi-processor service PPI. + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__ +#define __EDKII_PEI_MP_SERVICES2_PPI_H__ + +#include + +#define EDKII_PEI_MP_SERVICES2_PPI_GUID \ + { \ + 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba} \ + } + +typedef struct _EDKII_PEI_MP_SERVICES2_PPI EDKII_PEI_MP_SERVICES2_PPI; + +/** + Get the number of CPU's. + + @param[in] This Pointer to this instance of the PPI. + @param[out] NumberOfProcessors Pointer to the total number of logical processors in + the system, including the BSP and disabled APs. + @param[out] NumberOfEnabledProcessors + Number of processors in the system that are enabled. + + @retval EFI_SUCCESS The number of logical processors and enabled + logical processors was retrieved. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL. + NumberOfEnabledProcessors is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + OUT UINTN *NumberOfProcessors, + OUT UINTN *NumberOfEnabledProcessors + ); + +/** + Get information on a specific CPU. + + @param[in] This Pointer to this instance of the PPI. + @param[in] ProcessorNumber Pointer to the total number of logical processors in + the system, including the BSP and disabled APs. + @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled. + + @retval EFI_SUCCESS Processor information was returned. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL. + @retval EFI_NOT_FOUND The processor with the handle specified by + ProcessorNumber does not exist in the platform. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN UINTN ProcessorNumber, + OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer + ); + +/** + Activate all of the application proessors. + + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] Procedure A pointer to the function to be run on enabled APs of + the system. + @param[in] SingleThread If TRUE, then all the enabled APs execute the function + specified by Procedure one by one, in ascending order + of processor handle number. If FALSE, then all the + enabled APs execute the function specified by Procedure + simultaneously. + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds for APs to + return from Procedure, for blocking mode only. Zero + means infinity. If the timeout expires before all APs + return from Procedure, then Procedure on the failed APs + is terminated. All enabled APs are available for next + function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs() + or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the + timeout expires in blocking mode, BSP returns + EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for all APs. + + @retval EFI_SUCCESS In blocking mode, all APs have finished before the + timeout expired. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_STARTED No enabled APs exist in the system. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_TIMEOUT In blocking mode, the timeout expired before all + enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN BOOLEAN SingleThread, + IN UINTN TimeoutInMicroSeconds, + IN VOID *ProcedureArgument OPTIONAL + ); + +/** + Activate a specific application processor. + + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] Procedure A pointer to the function to be run on enabled APs of + the system. + @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds for APs to + return from Procedure, for blocking mode only. Zero + means infinity. If the timeout expires before all APs + return from Procedure, then Procedure on the failed APs + is terminated. All enabled APs are available for next + function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs() + or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the + timeout expires in blocking mode, BSP returns + EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for all APs. + + @retval EFI_SUCCESS In blocking mode, specified AP finished before the + timeout expires. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_TIMEOUT In blocking mode, the timeout expired before the + specified AP has finished. + @retval EFI_NOT_FOUND The processor with the handle specified by + ProcessorNumber does not exist. + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN UINTN ProcessorNumber, + IN UINTN TimeoutInMicroseconds, + IN VOID *ProcedureArgument OPTIONAL + ); + +/** + Switch the boot strap processor. + + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled + AP. Otherwise, it will be disabled. + + @retval EFI_SUCCESS BSP successfully switched. + @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this + service returning. + @retval EFI_UNSUPPORTED Switching the BSP is not supported. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_NOT_FOUND The processor with the handle specified by + ProcessorNumber does not exist. + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled + AP. + @retval EFI_NOT_READY The specified AP is busy. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_SWITCH_BSP) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN UINTN ProcessorNumber, + IN BOOLEAN EnableOldBSP + ); + +/** + Enable or disable an application processor. + + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + @param[in] EnableAP Specifies the new state for the processor for enabled, + FALSE for disabled. + @param[in] HealthFlag If not NULL, a pointer to a value that specifies the + new health status of the AP. This flag corresponds to + StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo(). + Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other + bits are ignored. If it is NULL, this parameter is + ignored. + + @retval EFI_SUCCESS The specified AP was enabled or disabled successfully. + @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior + to this service returning. + @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber + does not exist. + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN UINTN ProcessorNumber, + IN BOOLEAN EnableAP, + IN UINT32 *HealthFlag OPTIONAL + ); + +/** + Identify the currently executing processor. + + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + + @retval EFI_SUCCESS The current processor handle number was returned in + ProcessorNumber. + @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_WHOAMI) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + OUT UINTN *ProcessorNumber + ); + + +/** + Activate all of the application proessors. + + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_PPI instance. + @param[in] Procedure A pointer to the function to be run on enabled APs of + the system. + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds for APs to + return from Procedure, for blocking mode only. Zero + means infinity. If the timeout expires in blocking + mode, BSP returns EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for all CPUs. + + @retval EFI_SUCCESS In blocking mode, all APs have finished before the + timeout expired. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_TIMEOUT In blocking mode, the timeout expired before all + enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN UINTN TimeoutInMicroSeconds, + IN VOID *ProcedureArgument OPTIONAL + ); + +struct _EDKII_PEI_MP_SERVICES2_PPI { + EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors; + EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo; + EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs; + EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP; + EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP; + EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP; + EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI; + EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs; +}; + +extern EFI_GUID gEdkiiPeiMpServices2PpiGuid; + +#endif -- cgit v1.2.3