/** @file\r
Pei Core Main Entry Point\r
\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2019, 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
IN PEI_CORE_INSTANCE *PrivateData\r
)\r
{\r
- EFI_PEI_FILE_HANDLE PeiCoreFileHandle;\r
- EFI_PHYSICAL_ADDRESS EntryPoint;\r
- EFI_STATUS Status;\r
- UINT32 AuthenticationState;\r
+ EFI_PEI_FILE_HANDLE PeiCoreFileHandle;\r
+ EFI_PHYSICAL_ADDRESS EntryPoint;\r
+ EFI_STATUS Status;\r
+ UINT32 AuthenticationState;\r
+ UINTN Index;\r
+ EFI_PEI_CORE_FV_LOCATION_PPI *PeiCoreFvLocationPpi;\r
+ UINTN PeiCoreFvIndex;\r
\r
PeiCoreFileHandle = NULL;\r
-\r
//\r
- // Find the PEI Core in the BFV\r
+ // Default PeiCore is in BFV\r
+ //\r
+ PeiCoreFvIndex = 0;\r
+ //\r
+ // Find the PEI Core either from EFI_PEI_CORE_FV_LOCATION_PPI indicated FV or BFV\r
+ //\r
+ Status = PeiServicesLocatePpi (\r
+ &gEfiPeiCoreFvLocationPpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **) &PeiCoreFvLocationPpi\r
+ );\r
+ if (!EFI_ERROR (Status) && (PeiCoreFvLocationPpi->PeiCoreFvLocation != NULL)) {\r
+ //\r
+ // If PeiCoreFvLocation present, the PEI Core should be found from indicated FV\r
+ //\r
+ for (Index = 0; Index < PrivateData->FvCount; Index ++) {\r
+ if (PrivateData->Fv[Index].FvHandle == PeiCoreFvLocationPpi->PeiCoreFvLocation) {\r
+ PeiCoreFvIndex = Index;\r
+ break;\r
+ }\r
+ }\r
+ ASSERT (Index < PrivateData->FvCount);\r
+ }\r
+ //\r
+ // Find PEI Core from the given FV index\r
//\r
- Status = PrivateData->Fv[0].FvPpi->FindFileByType (\r
- PrivateData->Fv[0].FvPpi,\r
- EFI_FV_FILETYPE_PEI_CORE,\r
- PrivateData->Fv[0].FvHandle,\r
- &PeiCoreFileHandle\r
- );\r
+ Status = PrivateData->Fv[PeiCoreFvIndex].FvPpi->FindFileByType (\r
+ PrivateData->Fv[PeiCoreFvIndex].FvPpi,\r
+ EFI_FV_FILETYPE_PEI_CORE,\r
+ PrivateData->Fv[PeiCoreFvIndex].FvHandle,\r
+ &PeiCoreFileHandle\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r