/** @file\r
CPU Register Table Library functions.\r
\r
- Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
to check whether procedure has done.\r
**/\r
VOID\r
-StartupAPsWorker (\r
+StartupAllAPsWorker (\r
IN EFI_AP_PROCEDURE Procedure,\r
IN EFI_EVENT MpEvent\r
)\r
//\r
// Wakeup all APs for programming.\r
//\r
- StartupAPsWorker (SetProcessorRegister, MpEvent);\r
+ StartupAllAPsWorker (SetProcessorRegister, MpEvent);\r
}\r
\r
//\r
/** @file\r
CPU Register Table Library functions.\r
\r
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
#include <Library/PeiServicesLib.h>\r
#include <Library/PeiServicesTablePointerLib.h>\r
#include <Ppi/MpServices.h>\r
+#include <Ppi/MpServices2.h>\r
+\r
#include "RegisterCpuFeatures.h"\r
\r
#define REGISTER_CPU_FEATURES_GUID \\r
\r
**/\r
VOID\r
-StartupAPsWorker (\r
+StartupAllAPsWorker (\r
IN EFI_AP_PROCEDURE Procedure,\r
IN EFI_EVENT MpEvent\r
)\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
+/**\r
+ Worker function to execute a caller provided function on all enabled CPUs.\r
+\r
+ @param[in] Procedure A pointer to the function to be run on\r
+ enabled CPUs of the system.\r
+\r
+**/\r
+VOID\r
+StartupAllCPUsWorker (\r
+ IN EFI_AP_PROCEDURE Procedure\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi;\r
+ CPU_FEATURES_DATA *CpuFeaturesData;\r
+\r
+ CpuFeaturesData = GetCpuFeaturesData ();\r
+\r
+ //\r
+ // Get MP Services2 Ppi\r
+ //\r
+ Status = PeiServicesLocatePpi (\r
+ &gEdkiiPeiMpServices2PpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **)&CpuMp2Ppi\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Wakeup all APs for data collection.\r
+ //\r
+ Status = CpuMp2Ppi->StartupAllCPUs (\r
+ CpuMp2Ppi,\r
+ Procedure,\r
+ 0,\r
+ CpuFeaturesData\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+}\r
+\r
/**\r
Worker function to switch the requested AP to be the BSP from that point onward.\r
\r
CpuFeaturesData->BspNumber = OldBspNumber;\r
\r
//\r
- // Known limitation: In PEI phase, CpuFeatures driver not\r
- // support async mode execute tasks. So semaphore type\r
- // register can't been used for this instance, must use\r
- // DXE type instance.\r
- //\r
-\r
- if (CpuFeaturesData->NumberOfCpus > 1) {\r
- //\r
- // Wakeup all APs for programming.\r
- //\r
- StartupAPsWorker (SetProcessorRegister, NULL);\r
- }\r
-\r
- //\r
- // Programming BSP\r
+ // Start to program register for all CPUs.\r
//\r
- SetProcessorRegister (CpuFeaturesData);\r
+ StartupAllCPUsWorker (SetProcessorRegister);\r
\r
//\r
// Switch to new BSP if required\r