--- /dev/null
+/** @file\r
+ This file declares EDKII Multi-processor service PPI.\r
+\r
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__\r
+#define __EDKII_PEI_MP_SERVICES2_PPI_H__\r
+\r
+#include <Ppi/MpServices.h>\r
+\r
+#define EDKII_PEI_MP_SERVICES2_PPI_GUID \\r
+ { \\r
+ 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba} \\r
+ }\r
+\r
+typedef struct _EDKII_PEI_MP_SERVICES2_PPI EDKII_PEI_MP_SERVICES2_PPI;\r
+\r
+/**\r
+ Get the number of CPU's.\r
+\r
+ @param[in] This Pointer to this instance of the PPI.\r
+ @param[out] NumberOfProcessors Pointer to the total number of logical processors in\r
+ the system, including the BSP and disabled APs.\r
+ @param[out] NumberOfEnabledProcessors\r
+ Number of processors in the system that are enabled.\r
+\r
+ @retval EFI_SUCCESS The number of logical processors and enabled\r
+ logical processors was retrieved.\r
+ @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
+ @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.\r
+ NumberOfEnabledProcessors is NULL.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ OUT UINTN *NumberOfProcessors,\r
+ OUT UINTN *NumberOfEnabledProcessors\r
+ );\r
+\r
+/**\r
+ Get information on a specific CPU.\r
+\r
+ @param[in] This Pointer to this instance of the PPI.\r
+ @param[in] ProcessorNumber Pointer to the total number of logical processors in\r
+ the system, including the BSP and disabled APs.\r
+ @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled.\r
+\r
+ @retval EFI_SUCCESS Processor information was returned.\r
+ @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
+ @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
+ @retval EFI_NOT_FOUND The processor with the handle specified by\r
+ ProcessorNumber does not exist in the platform.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ IN UINTN ProcessorNumber,\r
+ OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
+ );\r
+\r
+/**\r
+ Activate all of the application proessors.\r
+\r
+ @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
+ @param[in] Procedure A pointer to the function to be run on enabled APs of\r
+ the system.\r
+ @param[in] SingleThread If TRUE, then all the enabled APs execute the function\r
+ specified by Procedure one by one, in ascending order\r
+ of processor handle number. If FALSE, then all the\r
+ enabled APs execute the function specified by Procedure\r
+ simultaneously.\r
+ @param[in] TimeoutInMicroSeconds\r
+ Indicates the time limit in microseconds for APs to\r
+ return from Procedure, for blocking mode only. Zero\r
+ means infinity. If the timeout expires before all APs\r
+ return from Procedure, then Procedure on the failed APs\r
+ is terminated. All enabled APs are available for next\r
+ function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
+ or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r
+ timeout expires in blocking mode, BSP returns\r
+ EFI_TIMEOUT.\r
+ @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r
+\r
+ @retval EFI_SUCCESS In blocking mode, all APs have finished before the\r
+ timeout expired.\r
+ @retval EFI_DEVICE_ERROR Caller processor is AP.\r
+ @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
+ @retval EFI_NOT_READY Any enabled APs are busy.\r
+ @retval EFI_TIMEOUT In blocking mode, the timeout expired before all\r
+ enabled APs have finished.\r
+ @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ IN EFI_AP_PROCEDURE Procedure,\r
+ IN BOOLEAN SingleThread,\r
+ IN UINTN TimeoutInMicroSeconds,\r
+ IN VOID *ProcedureArgument OPTIONAL\r
+ );\r
+\r
+/**\r
+ Activate a specific application processor.\r
+\r
+ @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
+ @param[in] Procedure A pointer to the function to be run on enabled APs of\r
+ the system.\r
+ @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
+ total number of logical processors minus 1. The total\r
+ number of logical processors can be retrieved by\r
+ EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
+ @param[in] TimeoutInMicroSeconds\r
+ Indicates the time limit in microseconds for APs to\r
+ return from Procedure, for blocking mode only. Zero\r
+ means infinity. If the timeout expires before all APs\r
+ return from Procedure, then Procedure on the failed APs\r
+ is terminated. All enabled APs are available for next\r
+ function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
+ or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r
+ timeout expires in blocking mode, BSP returns\r
+ EFI_TIMEOUT.\r
+ @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r
+\r
+ @retval EFI_SUCCESS In blocking mode, specified AP finished before the\r
+ timeout expires.\r
+ @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
+ @retval EFI_TIMEOUT In blocking mode, the timeout expired before the\r
+ specified AP has finished.\r
+ @retval EFI_NOT_FOUND The processor with the handle specified by\r
+ ProcessorNumber does not exist.\r
+ @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
+ @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ IN EFI_AP_PROCEDURE Procedure,\r
+ IN UINTN ProcessorNumber,\r
+ IN UINTN TimeoutInMicroseconds,\r
+ IN VOID *ProcedureArgument OPTIONAL\r
+ );\r
+\r
+/**\r
+ Switch the boot strap processor.\r
+\r
+ @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
+ @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
+ total number of logical processors minus 1. The total\r
+ number of logical processors can be retrieved by\r
+ EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
+ @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled\r
+ AP. Otherwise, it will be disabled.\r
+\r
+ @retval EFI_SUCCESS BSP successfully switched.\r
+ @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this\r
+ service returning.\r
+ @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
+ @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
+ @retval EFI_NOT_FOUND The processor with the handle specified by\r
+ ProcessorNumber does not exist.\r
+ @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled\r
+ AP.\r
+ @retval EFI_NOT_READY The specified AP is busy.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_SWITCH_BSP) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ IN UINTN ProcessorNumber,\r
+ IN BOOLEAN EnableOldBSP\r
+ );\r
+\r
+/**\r
+ Enable or disable an application processor.\r
+\r
+ @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
+ @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
+ total number of logical processors minus 1. The total\r
+ number of logical processors can be retrieved by\r
+ EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
+ @param[in] EnableAP Specifies the new state for the processor for enabled,\r
+ FALSE for disabled.\r
+ @param[in] HealthFlag If not NULL, a pointer to a value that specifies the\r
+ new health status of the AP. This flag corresponds to\r
+ StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo().\r
+ Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
+ bits are ignored. If it is NULL, this parameter is\r
+ ignored.\r
+\r
+ @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
+ @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior\r
+ to this service returning.\r
+ @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
+ @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
+ @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
+ does not exist.\r
+ @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ IN UINTN ProcessorNumber,\r
+ IN BOOLEAN EnableAP,\r
+ IN UINT32 *HealthFlag OPTIONAL\r
+ );\r
+\r
+/**\r
+ Identify the currently executing processor.\r
+\r
+ @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
+ @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
+ total number of logical processors minus 1. The total\r
+ number of logical processors can be retrieved by\r
+ EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
+\r
+ @retval EFI_SUCCESS The current processor handle number was returned in\r
+ ProcessorNumber.\r
+ @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_WHOAMI) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ OUT UINTN *ProcessorNumber\r
+ );\r
+\r
+\r
+/**\r
+ Activate all of the application proessors.\r
+\r
+ @param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_PPI instance.\r
+ @param[in] Procedure A pointer to the function to be run on enabled APs of\r
+ the system.\r
+ @param[in] TimeoutInMicroSeconds\r
+ Indicates the time limit in microseconds for APs to\r
+ return from Procedure, for blocking mode only. Zero\r
+ means infinity. If the timeout expires in blocking\r
+ mode, BSP returns EFI_TIMEOUT.\r
+ @param[in] ProcedureArgument The parameter passed into Procedure for all CPUs.\r
+\r
+ @retval EFI_SUCCESS In blocking mode, all APs have finished before the\r
+ timeout expired.\r
+ @retval EFI_DEVICE_ERROR Caller processor is AP.\r
+ @retval EFI_NOT_READY Any enabled APs are busy.\r
+ @retval EFI_TIMEOUT In blocking mode, the timeout expired before all\r
+ enabled APs have finished.\r
+ @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS) (\r
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,\r
+ IN EFI_AP_PROCEDURE Procedure,\r
+ IN UINTN TimeoutInMicroSeconds,\r
+ IN VOID *ProcedureArgument OPTIONAL\r
+ );\r
+\r
+struct _EDKII_PEI_MP_SERVICES2_PPI {\r
+ EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;\r
+ EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;\r
+ EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;\r
+ EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;\r
+ EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP;\r
+ EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r
+ EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI;\r
+ EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs;\r
+};\r
+\r
+extern EFI_GUID gEdkiiPeiMpServices2PpiGuid;\r
+\r
+#endif\r