CPU Register Table Library functions.\r
\r
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
/**\r
Worker function to get MP PPI service pointer.\r
\r
- @return PEI PPI service pointer.\r
+ @return MP_SERVICES variable.\r
**/\r
-EFI_PEI_MP_SERVICES_PPI *\r
-GetMpPpi (\r
+MP_SERVICES\r
+GetMpService (\r
VOID\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_PEI_MP_SERVICES_PPI *CpuMpPpi;\r
+ MP_SERVICES MpService;\r
\r
//\r
// Get MP Services Protocol\r
&gEfiPeiMpServicesPpiGuid,\r
0,\r
NULL,\r
- (VOID **)&CpuMpPpi\r
+ (VOID **)&MpService.Ppi\r
);\r
ASSERT_EFI_ERROR (Status);\r
- return CpuMpPpi;\r
+ return MpService;\r
}\r
\r
/**\r
Worker function to return processor index.\r
\r
+ @param CpuFeaturesData Cpu Feature Data structure.\r
+\r
@return The processor index.\r
**/\r
UINTN\r
GetProcessorIndex (\r
- VOID\r
+ IN CPU_FEATURES_DATA *CpuFeaturesData\r
)\r
{\r
EFI_STATUS Status;\r
EFI_PEI_MP_SERVICES_PPI *CpuMpPpi;\r
UINTN ProcessorIndex;\r
\r
- CpuMpPpi = GetMpPpi ();\r
+ CpuMpPpi = CpuFeaturesData->MpService.Ppi;\r
\r
- Status = CpuMpPpi->WhoAmI(GetPeiServicesTablePointer (), CpuMpPpi, &ProcessorIndex);\r
+ //\r
+ // For two reasons which use NULL for WhoAmI:\r
+ // 1. This function will be called by APs and AP should not use PeiServices Table\r
+ // 2. Check WhoAmI implementation, this parameter will not be used.\r
+ //\r
+ Status = CpuMpPpi->WhoAmI(NULL, CpuMpPpi, &ProcessorIndex);\r
ASSERT_EFI_ERROR (Status);\r
return ProcessorIndex;\r
}\r
{\r
EFI_PEI_MP_SERVICES_PPI *CpuMpPpi;\r
EFI_STATUS Status;\r
+ CPU_FEATURES_DATA *CpuFeaturesData;\r
+\r
+ CpuFeaturesData = GetCpuFeaturesData ();\r
+ CpuMpPpi = CpuFeaturesData->MpService.Ppi;\r
\r
- CpuMpPpi = GetMpPpi ();\r
Status = CpuMpPpi->GetProcessorInfo (\r
GetPeiServicesTablePointer(),\r
CpuMpPpi,\r
CPU_FEATURES_DATA *CpuFeaturesData;\r
\r
CpuFeaturesData = GetCpuFeaturesData ();\r
-\r
- //\r
- // Get MP Services Protocol\r
- //\r
- Status = PeiServicesLocatePpi (\r
- &gEfiPeiMpServicesPpiGuid,\r
- 0,\r
- NULL,\r
- (VOID **)&CpuMpPpi\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ CpuMpPpi = CpuFeaturesData->MpService.Ppi;\r
\r
//\r
// Wakeup all APs for data collection.\r
{\r
EFI_STATUS Status;\r
EFI_PEI_MP_SERVICES_PPI *CpuMpPpi;\r
+ CPU_FEATURES_DATA *CpuFeaturesData;\r
\r
- //\r
- // Get MP Services Protocol\r
- //\r
- Status = PeiServicesLocatePpi (\r
- &gEfiPeiMpServicesPpiGuid,\r
- 0,\r
- NULL,\r
- (VOID **)&CpuMpPpi\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ CpuFeaturesData = GetCpuFeaturesData ();\r
+ CpuMpPpi = CpuFeaturesData->MpService.Ppi;\r
\r
//\r
// Wakeup all APs for data collection.\r
{\r
EFI_STATUS Status;\r
EFI_PEI_MP_SERVICES_PPI *CpuMpPpi;\r
+ CPU_FEATURES_DATA *CpuFeaturesData;\r
\r
- //\r
- // Get MP Services Protocol\r
- //\r
- Status = PeiServicesLocatePpi (\r
- &gEfiPeiMpServicesPpiGuid,\r
- 0,\r
- NULL,\r
- (VOID **)&CpuMpPpi\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ CpuFeaturesData = GetCpuFeaturesData ();\r
+ CpuMpPpi = CpuFeaturesData->MpService.Ppi;\r
\r
//\r
// Get the number of CPUs\r
\r
CpuFeaturesData = GetCpuFeaturesData ();\r
\r
- OldBspNumber = GetProcessorIndex();\r
+ OldBspNumber = GetProcessorIndex (CpuFeaturesData);\r
CpuFeaturesData->BspNumber = OldBspNumber;\r
\r
//\r