]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/PeiMain.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
index 4876851cbe9c61e92420f68ca580721d28291d88..556beddad533989f12967d2dedd21319d39f90b9 100644 (file)
@@ -1,25 +1,10 @@
-/*++\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. 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
-\r
-Module Name:\r
-\r
-  PeiMain.h\r
-\r
-Abstract:\r
-\r
+/** @file\r
   Definition of Pei Core Structures and Services\r
 \r
-Revision History\r
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
---*/\r
+**/\r
 \r
 #ifndef _PEI_MAIN_H_\r
 #define _PEI_MAIN_H_\r
@@ -29,12 +14,18 @@ Revision History
 #include <Ppi/MemoryDiscovered.h>\r
 #include <Ppi/StatusCode.h>\r
 #include <Ppi/Reset.h>\r
+#include <Ppi/Reset2.h>\r
 #include <Ppi/FirmwareVolume.h>\r
 #include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Ppi/FirmwareVolumeInfo2.h>\r
 #include <Ppi/Decompress.h>\r
 #include <Ppi/GuidedSectionExtraction.h>\r
 #include <Ppi/LoadFile.h>\r
 #include <Ppi/Security2.h>\r
+#include <Ppi/TemporaryRamSupport.h>\r
+#include <Ppi/TemporaryRamDone.h>\r
+#include <Ppi/SecHobData.h>\r
+#include <Ppi/PeiCoreFvLocation.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PeiCoreEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
@@ -46,133 +37,296 @@ Revision History
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/CacheMaintenanceLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <IndustryStandard/PeImage.h>\r
 #include <Library/PeiServicesTablePointerLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
-#include <Library/PeiPiLib.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
+#include <Guid/FirmwareFileSystem3.h>\r
 #include <Guid/AprioriFileName.h>\r
+#include <Guid/MigratedFvInfo.h>\r
 \r
-#define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE   0xff\r
+///\r
+/// It is an FFS type extension used for PeiFindFileEx. It indicates current\r
+/// FFS searching is for all PEIMs can be dispatched by PeiCore.\r
+///\r
+#define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE  0xff\r
 \r
-//\r
-// Pei Core private data structures\r
-//\r
+///\r
+/// Pei Core private data structures\r
+///\r
 typedef union {\r
-  EFI_PEI_PPI_DESCRIPTOR      *Ppi;\r
-  EFI_PEI_NOTIFY_DESCRIPTOR   *Notify;\r
-  VOID                        *Raw;\r
+  EFI_PEI_PPI_DESCRIPTOR       *Ppi;\r
+  EFI_PEI_NOTIFY_DESCRIPTOR    *Notify;\r
+  VOID                         *Raw;\r
 } PEI_PPI_LIST_POINTERS;\r
 \r
-#define PEI_STACK_SIZE 0x20000\r
+///\r
+/// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room\r
+///\r
+#define PPI_GROWTH_STEP              64\r
+#define CALLBACK_NOTIFY_GROWTH_STEP  32\r
+#define DISPATCH_NOTIFY_GROWTH_STEP  8\r
 \r
-#define MAX_PPI_DESCRIPTORS 64\r
+typedef struct {\r
+  UINTN                    CurrentCount;\r
+  UINTN                    MaxCount;\r
+  UINTN                    LastDispatchedCount;\r
+  ///\r
+  /// MaxCount number of entries.\r
+  ///\r
+  PEI_PPI_LIST_POINTERS    *PpiPtrs;\r
+} PEI_PPI_LIST;\r
 \r
 typedef struct {\r
-  INTN                    PpiListEnd;\r
-  INTN                    NotifyListEnd;\r
-  INTN                    DispatchListEnd;\r
-  INTN                    LastDispatchedInstall;\r
-  INTN                    LastDispatchedNotify;\r
-  PEI_PPI_LIST_POINTERS   PpiListPtrs[MAX_PPI_DESCRIPTORS];\r
-} PEI_PPI_DATABASE;\r
+  UINTN                    CurrentCount;\r
+  UINTN                    MaxCount;\r
+  ///\r
+  /// MaxCount number of entries.\r
+  ///\r
+  PEI_PPI_LIST_POINTERS    *NotifyPtrs;\r
+} PEI_CALLBACK_NOTIFY_LIST;\r
 \r
+typedef struct {\r
+  UINTN                    CurrentCount;\r
+  UINTN                    MaxCount;\r
+  UINTN                    LastDispatchedCount;\r
+  ///\r
+  /// MaxCount number of entries.\r
+  ///\r
+  PEI_PPI_LIST_POINTERS    *NotifyPtrs;\r
+} PEI_DISPATCH_NOTIFY_LIST;\r
+\r
+///\r
+/// PPI database structure which contains three links:\r
+/// PpiList, CallbackNotifyList and DispatchNotifyList.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// PPI List.\r
+  ///\r
+  PEI_PPI_LIST                PpiList;\r
+  ///\r
+  /// Notify List at dispatch level.\r
+  ///\r
+  PEI_CALLBACK_NOTIFY_LIST    CallbackNotifyList;\r
+  ///\r
+  /// Notify List at callback level.\r
+  ///\r
+  PEI_DISPATCH_NOTIFY_LIST    DispatchNotifyList;\r
+} PEI_PPI_DATABASE;\r
 \r
 //\r
-// PEI_CORE_FV_HANDE.PeimState\r
+// PEI_CORE_FV_HANDLE.PeimState\r
 // Do not change these values as there is code doing math to change states.\r
 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r
 //\r
-#define PEIM_STATE_NOT_DISPATCHED         0x00\r
-#define PEIM_STATE_DISPATCHED             0x01\r
-#define PEIM_STATE_REGISITER_FOR_SHADOW   0x02\r
-#define PEIM_STATE_DONE                   0x03\r
+#define PEIM_STATE_NOT_DISPATCHED       0x00\r
+#define PEIM_STATE_DISPATCHED           0x01\r
+#define PEIM_STATE_REGISTER_FOR_SHADOW  0x02\r
+#define PEIM_STATE_DONE                 0x03\r
+\r
+//\r
+// Number of FV instances to grow by each time we run out of room\r
+//\r
+#define FV_GROWTH_STEP  8\r
 \r
 typedef struct {\r
-  EFI_FIRMWARE_VOLUME_HEADER          *FvHeader;\r
-  UINT8                               PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];   \r
-  EFI_PEI_FILE_HANDLE                 FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
-  BOOLEAN                             ScanFv;\r
+  EFI_FIRMWARE_VOLUME_HEADER     *FvHeader;\r
+  EFI_PEI_FIRMWARE_VOLUME_PPI    *FvPpi;\r
+  EFI_PEI_FV_HANDLE              FvHandle;\r
+  UINTN                          PeimCount;\r
+  //\r
+  // Pointer to the buffer with the PeimCount number of Entries.\r
+  //\r
+  UINT8                          *PeimState;\r
+  //\r
+  // Pointer to the buffer with the PeimCount number of Entries.\r
+  //\r
+  EFI_PEI_FILE_HANDLE            *FvFileHandles;\r
+  BOOLEAN                        ScanFv;\r
+  UINT32                         AuthenticationStatus;\r
 } PEI_CORE_FV_HANDLE;\r
 \r
-#define CACHE_SETION_MAX_NUMBER       0x10\r
 typedef struct {\r
-  EFI_COMMON_SECTION_HEADER*          Section[CACHE_SETION_MAX_NUMBER];\r
-  VOID*                               SectionData[CACHE_SETION_MAX_NUMBER];\r
-  UINTN                               SectionSize[CACHE_SETION_MAX_NUMBER];\r
-  UINTN                               AllSectionCount;\r
-  UINTN                               SectionIndex;\r
+  EFI_GUID                     FvFormat;\r
+  VOID                         *FvInfo;\r
+  UINT32                       FvInfoSize;\r
+  UINT32                       AuthenticationStatus;\r
+  EFI_PEI_NOTIFY_DESCRIPTOR    NotifyDescriptor;\r
+} PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r
+\r
+#define CACHE_SETION_MAX_NUMBER  0x10\r
+typedef struct {\r
+  EFI_COMMON_SECTION_HEADER    *Section[CACHE_SETION_MAX_NUMBER];\r
+  VOID                         *SectionData[CACHE_SETION_MAX_NUMBER];\r
+  UINTN                        SectionSize[CACHE_SETION_MAX_NUMBER];\r
+  UINT32                       AuthenticationStatus[CACHE_SETION_MAX_NUMBER];\r
+  UINTN                        AllSectionCount;\r
+  UINTN                        SectionIndex;\r
 } CACHE_SECTION_DATA;\r
 \r
-//\r
-// Pei Core private data structure instance\r
-//\r
-\r
-#define PEI_CORE_HANDLE_SIGNATURE  EFI_SIGNATURE_32('P','e','i','C')\r
-\r
-typedef struct{\r
-  UINTN                              Signature;\r
-  EFI_PEI_SERVICES                   *PS;     // Point to ServiceTableShadow\r
-  PEI_PPI_DATABASE                   PpiData;\r
-  UINTN                              FvCount;\r
-  PEI_CORE_FV_HANDLE                 Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
-  EFI_PEI_FILE_HANDLE                CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
-  UINTN                              AprioriCount;\r
-  UINTN                              CurrentPeimFvCount; \r
-  UINTN                              CurrentPeimCount;\r
-  EFI_PEI_FILE_HANDLE                CurrentFileHandle;\r
-  UINTN                              AllFvCount;\r
-  EFI_PEI_FV_HANDLE                  AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
-  EFI_PEI_HOB_POINTERS               HobList;\r
-  BOOLEAN                            SwitchStackSignal;\r
-  BOOLEAN                            PeiMemoryInstalled;\r
-  EFI_PHYSICAL_ADDRESS               StackBase;\r
-  UINT64                             StackSize;\r
-  VOID                               *BottomOfCarHeap;\r
-  VOID                               *TopOfCarHeap;\r
-  VOID                               *CpuIo;\r
-  EFI_PEI_SECURITY2_PPI              *PrivateSecurityPpi;\r
-  EFI_PEI_SERVICES                   ServiceTableShadow;\r
-  UINTN                              SizeOfCacheAsRam;\r
-  VOID                               *MaxTopOfCarHeap;\r
-  EFI_PEI_PPI_DESCRIPTOR             *XipLoadFile;\r
-  CACHE_SECTION_DATA                 CacheSection;\r
-} PEI_CORE_INSTANCE;\r
-\r
-//\r
-// Pei Core Instance Data Macros\r
-//\r
+#define HOLE_MAX_NUMBER  0x3\r
+typedef struct {\r
+  EFI_PHYSICAL_ADDRESS    Base;\r
+  UINTN                   Size;\r
+  UINTN                   Offset;\r
+  BOOLEAN                 OffsetPositive;\r
+} HOLE_MEMORY_DATA;\r
 \r
-#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r
-  CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)\r
+///\r
+/// Forward declaration for PEI_CORE_INSTANCE\r
+///\r
+typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;\r
 \r
-//\r
-// BUGBUG: Where does this go really?\r
-//\r
+/**\r
+  Function Pointer type for PeiCore function.\r
+  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size\r
+                         and location of temporary RAM, the stack location and the BFV location.\r
+  @param PpiList         Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
+                         An empty PPI list consists of a single descriptor with the end-tag\r
+                         EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
+                         phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
+                         that both the PEI Foundation and any modules can leverage the associated service\r
+                         calls and/or code in these early PPIs\r
+  @param OldCoreData     Pointer to old core data that is used to initialize the\r
+                         core's data areas.\r
+**/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *PEI_CORE_ENTRY_POINT)(\r
+(EFIAPI *PEICORE_FUNCTION_POINTER)(\r
   IN CONST  EFI_SEC_PEI_HAND_OFF    *SecCoreData,\r
   IN CONST  EFI_PEI_PPI_DESCRIPTOR  *PpiList,\r
   IN PEI_CORE_INSTANCE              *OldCoreData\r
   );\r
 \r
 //\r
-// Union of temporarily used function pointers (to save stack space)\r
+// Number of files to grow by each time we run out of room\r
 //\r
-typedef union {\r
-  PEI_CORE_ENTRY_POINT         PeiCore;\r
-  EFI_PEIM_ENTRY_POINT2        PeimEntry;\r
-  EFI_PEIM_NOTIFY_ENTRY_POINT  PeimNotifyEntry;\r
-  EFI_DXE_IPL_PPI              *DxeIpl;\r
-  EFI_PEI_PPI_DESCRIPTOR       *PpiDescriptor;\r
-  EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor;\r
-  VOID                         *Raw;\r
-} PEI_CORE_TEMP_POINTERS;\r
+#define TEMP_FILE_GROWTH_STEP  32\r
+\r
+#define PEI_CORE_HANDLE_SIGNATURE  SIGNATURE_32('P','e','i','C')\r
+\r
+///\r
+/// Pei Core private data structure instance\r
+///\r
+struct _PEI_CORE_INSTANCE {\r
+  UINTN                             Signature;\r
+\r
+  ///\r
+  /// Point to ServiceTableShadow\r
+  ///\r
+  EFI_PEI_SERVICES                  *Ps;\r
+  PEI_PPI_DATABASE                  PpiData;\r
+\r
+  ///\r
+  /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r
+  ///\r
+  UINTN                             FvCount;\r
+\r
+  ///\r
+  /// The max count of FVs which contains FFS and could be dispatched by PeiCore.\r
+  ///\r
+  UINTN                             MaxFvCount;\r
+\r
+  ///\r
+  /// Pointer to the buffer with the MaxFvCount number of entries.\r
+  /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.\r
+  ///\r
+  PEI_CORE_FV_HANDLE                *Fv;\r
+\r
+  ///\r
+  /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.\r
+  /// Each entry is for one FV which could not be dispatched by PeiCore.\r
+  ///\r
+  PEI_CORE_UNKNOW_FORMAT_FV_INFO    *UnknownFvInfo;\r
+  UINTN                             MaxUnknownFvInfoCount;\r
+  UINTN                             UnknownFvInfoCount;\r
+\r
+  ///\r
+  /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.\r
+  ///\r
+  EFI_PEI_FILE_HANDLE               *CurrentFvFileHandles;\r
+  UINTN                             AprioriCount;\r
+  UINTN                             CurrentPeimFvCount;\r
+  UINTN                             CurrentPeimCount;\r
+  EFI_PEI_FILE_HANDLE               CurrentFileHandle;\r
+  BOOLEAN                           PeimNeedingDispatch;\r
+  BOOLEAN                           PeimDispatchOnThisPass;\r
+  BOOLEAN                           PeimDispatcherReenter;\r
+  EFI_PEI_HOB_POINTERS              HobList;\r
+  BOOLEAN                           SwitchStackSignal;\r
+  BOOLEAN                           PeiMemoryInstalled;\r
+  VOID                              *CpuIo;\r
+  EFI_PEI_SECURITY2_PPI             *PrivateSecurityPpi;\r
+  EFI_PEI_SERVICES                  ServiceTableShadow;\r
+  EFI_PEI_PPI_DESCRIPTOR            *XipLoadFile;\r
+  EFI_PHYSICAL_ADDRESS              PhysicalMemoryBegin;\r
+  UINT64                            PhysicalMemoryLength;\r
+  EFI_PHYSICAL_ADDRESS              FreePhysicalMemoryTop;\r
+  UINTN                             HeapOffset;\r
+  BOOLEAN                           HeapOffsetPositive;\r
+  UINTN                             StackOffset;\r
+  BOOLEAN                           StackOffsetPositive;\r
+  //\r
+  // Information for migrating memory pages allocated in pre-memory phase.\r
+  //\r
+  HOLE_MEMORY_DATA                  MemoryPages;\r
+  PEICORE_FUNCTION_POINTER          ShadowedPeiCore;\r
+  CACHE_SECTION_DATA                CacheSection;\r
+  //\r
+  // For Loading modules at fixed address feature to cache the top address below which the\r
+  // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field\r
+  // and Ps should not be changed since maybe user could get this top address by using the offset to Ps.\r
+  //\r
+  EFI_PHYSICAL_ADDRESS              LoadModuleAtFixAddressTopAddress;\r
+  //\r
+  // The field is define for Loading modules at fixed address feature to tracker the PEI code\r
+  // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page\r
+  // available or not.\r
+  //\r
+  UINT64                            *PeiCodeMemoryRangeUsageBitMap;\r
+  //\r
+  // This field points to the shadowed image read function\r
+  //\r
+  PE_COFF_LOADER_READ_FILE          ShadowedImageRead;\r
+\r
+  UINTN                             TempPeimCount;\r
 \r
+  //\r
+  // Pointer to the temp buffer with the TempPeimCount number of entries.\r
+  //\r
+  EFI_PEI_FILE_HANDLE               *TempFileHandles;\r
+  //\r
+  // Pointer to the temp buffer with the TempPeimCount number of entries.\r
+  //\r
+  EFI_GUID                          *TempFileGuid;\r
+\r
+  //\r
+  // Temp Memory Range is not covered by PeiTempMem and Stack.\r
+  // Those Memory Range will be migrated into physical memory.\r
+  //\r
+  HOLE_MEMORY_DATA                  HoleData[HOLE_MAX_NUMBER];\r
+};\r
+\r
+///\r
+/// Pei Core Instance Data Macros\r
+///\r
+#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r
+  CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r
 \r
+///\r
+/// Union of temporarily used function pointers (to save stack space)\r
+///\r
+typedef union {\r
+  PEICORE_FUNCTION_POINTER       PeiCore;\r
+  EFI_PEIM_ENTRY_POINT2          PeimEntry;\r
+  EFI_PEIM_NOTIFY_ENTRY_POINT    PeimNotifyEntry;\r
+  EFI_DXE_IPL_PPI                *DxeIpl;\r
+  EFI_PEI_PPI_DESCRIPTOR         *PpiDescriptor;\r
+  EFI_PEI_NOTIFY_DESCRIPTOR      *NotifyDescriptor;\r
+  VOID                           *Raw;\r
+} PEI_CORE_TEMP_POINTERS;\r
 \r
 typedef struct {\r
   CONST EFI_SEC_PEI_HAND_OFF    *SecCoreData;\r
@@ -183,1228 +337,1705 @@ typedef struct {
 //\r
 // PeiCore function\r
 //\r
-EFI_STATUS\r
-EFIAPI\r
-PeiCore (\r
-  IN CONST EFI_SEC_PEI_HAND_OFF        *SecCoreData,\r
-  IN CONST EFI_PEI_PPI_DESCRIPTOR      *PpList,\r
-  IN VOID                              *Data\r
-  )\r
-/*++\r
 \r
-Routine Description:\r
+/**\r
 \r
   The entry routine to Pei Core, invoked by PeiMain during transition\r
   from SEC to PEI. After switching stack in the PEI core, it will restart\r
   with the old core data.\r
 \r
-Arguments:\r
 \r
-  PeiStartupDescriptor - Information and services provided by SEC phase.\r
-  OldCoreData          - Pointer to old core data that is used to initialize the\r
+  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size\r
+                         and location of temporary RAM, the stack location and the BFV location.\r
+  @param PpiList         Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
+                         An empty PPI list consists of a single descriptor with the end-tag\r
+                         EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
+                         phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
+                         that both the PEI Foundation and any modules can leverage the associated service\r
+                         calls and/or code in these early PPIs\r
+  @param Data            Pointer to old core data that is used to initialize the\r
                          core's data areas.\r
 \r
-Returns:\r
-\r
-  This function never returns\r
-  EFI_NOT_FOUND        - Never reach\r
-\r
---*/\r
-;\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiCore (\r
+  IN CONST EFI_SEC_PEI_HAND_OFF    *SecCoreData,\r
+  IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList,\r
+  IN VOID                          *Data\r
+  );\r
 \r
 //\r
 // Dispatcher support functions\r
 //\r
 \r
-BOOLEAN\r
-PeimDispatchReadiness (\r
-  IN EFI_PEI_SERVICES   **PeiServices,\r
-  IN VOID               *DependencyExpression\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
 \r
   This is the POSTFIX version of the dependency evaluator.  When a\r
   PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r
-  the evaluation stack.  When that entry is poped from the evaluation\r
+  the evaluation stack.  When that entry is popped from the evaluation\r
   stack, the PPI is checked if it is installed.  This method allows\r
   some time savings as not all PPIs must be checked for certain\r
   operation types (AND, OR).\r
 \r
-Arguments:\r
-\r
-  PeiServices               - Calling context.\r
 \r
-  DependencyExpression      - Pointer to a dependency expression.  The Grammar adheres to\r
-                              the BNF described above and is stored in postfix notation.\r
+  @param PeiServices            An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param DependencyExpression   Pointer to a dependency expression.  The Grammar adheres to\r
+                                the BNF described above and is stored in postfix notation.\r
 \r
-Returns:\r
-\r
-  Status = EFI_SUCCESS            if it is a well-formed Grammar\r
-           EFI_INVALID_PARAMETER  if the dependency expression overflows\r
-                                  the evaluation stack\r
-           EFI_INVALID_PARAMETER  if the dependency expression underflows\r
-                                  the evaluation stack\r
-           EFI_INVALID_PARAMETER  if the dependency expression is not a\r
-                                  well-formed Grammar.\r
---*/\r
-;\r
+  @retval TRUE      if it is a well-formed Grammar\r
+  @retval FALSE     if the dependency expression overflows the evaluation stack\r
+                    if the dependency expression underflows the evaluation stack\r
+                    if the dependency expression is not a well-formed Grammar.\r
 \r
+**/\r
+BOOLEAN\r
+PeimDispatchReadiness (\r
+  IN EFI_PEI_SERVICES  **PeiServices,\r
+  IN VOID              *DependencyExpression\r
+  );\r
 \r
-VOID\r
-PeiDispatcher (\r
-  IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData,\r
-  IN PEI_CORE_INSTANCE           *PrivateData\r
-  )\r
+/**\r
+  Migrate a PEIM from temporary RAM to permanent memory.\r
 \r
-/*++\r
+  @param PeimFileHandle       Pointer to the FFS file header of the image.\r
+  @param MigratedFileHandle   Pointer to the FFS file header of the migrated image.\r
 \r
-Routine Description:\r
+  @retval EFI_SUCCESS         Sucessfully migrated the PEIM to permanent memory.\r
 \r
-  Conduct PEIM dispatch.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MigratePeim (\r
+  IN  EFI_PEI_FILE_HANDLE  FileHandle,\r
+  IN  EFI_PEI_FILE_HANDLE  MigratedFileHandle\r
+  );\r
 \r
-Arguments:\r
+/**\r
+  Migrate FVs out of temporary RAM before the cache is flushed.\r
 \r
-  PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR\r
-  PrivateData          - Pointer to the private data passed in from caller\r
-  DispatchData         - Pointer to PEI_CORE_DISPATCH_DATA data.\r
+  @param Private         PeiCore's private data structure\r
+  @param SecCoreData     Points to a data structure containing information about the PEI core's operating\r
+                         environment, such as the size and location of temporary RAM, the stack location and\r
+                         the BFV location.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           Successfully migrated installed FVs from temporary RAM to permanent memory.\r
+  @retval EFI_OUT_OF_RESOURCES  Insufficient memory exists to allocate needed pages.\r
 \r
-  EFI_SUCCESS   - Successfully dispatched PEIM.\r
-  EFI_NOT_FOUND - The dispatch failed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EvacuateTempRam (\r
+  IN PEI_CORE_INSTANCE           *Private,\r
+  IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
+  Conduct PEIM dispatch.\r
 \r
+  @param SecCoreData     Pointer to the data structure containing SEC to PEI handoff data\r
+  @param PrivateData     Pointer to the private data passed in from caller\r
 \r
+**/\r
 VOID\r
-InitializeDispatcherData (\r
-  IN PEI_CORE_INSTANCE            *PrivateData,\r
-  IN PEI_CORE_INSTANCE            *OldCoreData,\r
-  IN CONST EFI_SEC_PEI_HAND_OFF   *SecCoreData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+PeiDispatcher (\r
+  IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData,\r
+  IN PEI_CORE_INSTANCE           *PrivateData\r
+  );\r
 \r
+/**\r
   Initialize the Dispatcher's data members\r
 \r
-Arguments:\r
-\r
-  PeiServices          - The PEI core services table.\r
-  OldCoreData          - Pointer to old core data (before switching stack).\r
-                         NULL if being run in non-permament memory mode.\r
-  PeiStartupDescriptor - Information and services provided by SEC phase.\r
-\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-;\r
-\r
-\r
-BOOLEAN\r
-Dispatched (\r
-  IN UINT8  CurrentPeim,\r
-  IN UINT32 DispatchedPeimBitMap\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine checks to see if a particular PEIM has been dispatched during\r
-  the PEI core dispatch.\r
-\r
-Arguments:\r
-  CurrentPeim - The PEIM/FV in the bit array to check.\r
-  DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.\r
-\r
-Returns:\r
-  TRUE if PEIM already dispatched\r
-  FALSE if not\r
-\r
---*/\r
-;\r
+  @param PrivateData     PeiCore's private data structure\r
+  @param OldCoreData     Old data from SecCore\r
+                         NULL if being run in non-permanent memory mode.\r
+  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size\r
+                         and location of temporary RAM, the stack location and the BFV location.\r
 \r
+**/\r
 VOID\r
-SetDispatched (\r
-  IN EFI_PEI_SERVICES   **PeiServices,\r
-  IN UINT8              CurrentPeim,\r
-  OUT UINT32            *DispatchedPeimBitMap\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine sets a PEIM as having been dispatched once its entry\r
-  point has been invoked.\r
+InitializeDispatcherData (\r
+  IN PEI_CORE_INSTANCE           *PrivateData,\r
+  IN PEI_CORE_INSTANCE           *OldCoreData,\r
+  IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData\r
+  );\r
 \r
-Arguments:\r
+/**\r
+  This routine parses the Dependency Expression, if available, and\r
+  decides if the module can be executed.\r
 \r
-  PeiServices          - The PEI core services table.\r
-  CurrentPeim          - The PEIM/FV in the bit array to check.\r
-  DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.\r
 \r
-Returns:\r
-  None\r
+  @param Private         PeiCore's private data structure\r
+  @param FileHandle      PEIM's file handle\r
+  @param PeimCount       The index of last dispatched PEIM.\r
 \r
---*/\r
-;\r
+  @retval TRUE           Can be dispatched\r
+  @retval FALSE          Cannot be dispatched\r
 \r
+**/\r
 BOOLEAN\r
 DepexSatisfied (\r
-  IN PEI_CORE_INSTANCE          *Private,\r
-  IN EFI_PEI_FILE_HANDLE        FileHandle,\r
-  IN UINTN                      PeimCount\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  IN PEI_CORE_INSTANCE    *Private,\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
+  IN UINTN                PeimCount\r
+  );\r
 \r
-  This routine parses the Dependency Expression, if available, and\r
-  decides if the module can be executed.\r
+//\r
+// PPI support functions\r
+//\r
 \r
-Arguments:\r
-  PeiServices - The PEI Service Table\r
-  CurrentPeimAddress - Address of the PEIM Firmware File under investigation\r
+/**\r
 \r
-Returns:\r
-  TRUE  - Can be dispatched\r
-  FALSE - Cannot be dispatched\r
+  Initialize PPI services.\r
 \r
---*/\r
-;\r
+  @param PrivateData     Pointer to the PEI Core data.\r
+  @param OldCoreData     Pointer to old PEI Core data.\r
+                         NULL if being run in non-permanent memory mode.\r
 \r
-#if   defined (MDE_CPU_IPF)\r
-  //\r
-  // In Ipf we should make special changes for the PHIT pointers to support\r
-  // recovery boot in cache mode.\r
-  //\r
-#define  SWITCH_TO_CACHE_MODE(CoreData)  SwitchToCacheMode(CoreData)\r
-#define  CACHE_MODE_ADDRESS_MASK         0x7FFFFFFFFFFFFFFFULL\r
+**/\r
 VOID\r
-SwitchToCacheMode (\r
-  IN PEI_CORE_INSTANCE           *CoreData\r
-)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.\r
+InitializePpiServices (\r
+  IN PEI_CORE_INSTANCE  *PrivateData,\r
+  IN PEI_CORE_INSTANCE  *OldCoreData\r
+  );\r
 \r
-Arguments:\r
+/**\r
 \r
-  CoreData   - The PEI core Private Data\r
+  Migrate the Hob list from the temporary memory to PEI installed memory.\r
 \r
-Returns:\r
+  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size\r
+                         and location of temporary RAM, the stack location and the BFV location.\r
+  @param PrivateData     Pointer to PeiCore's private data structure.\r
 \r
---*/\r
-;\r
+**/\r
+VOID\r
+ConvertPpiPointers (\r
+  IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData,\r
+  IN PEI_CORE_INSTANCE           *PrivateData\r
+  );\r
 \r
-#else\r
+/**\r
 \r
-#define  SWITCH_TO_CACHE_MODE(CoreData)\r
+  Migrate Notify Pointers inside an FV from temporary memory to permanent memory.\r
 \r
-#endif\r
+  @param PrivateData      Pointer to PeiCore's private data structure.\r
+  @param OrgFvHandle      Address of FV Handle in temporary memory.\r
+  @param FvHandle         Address of FV Handle in permanent memory.\r
+  @param FvSize           Size of the FV.\r
 \r
-//\r
-// PPI support functions\r
-//\r
+**/\r
 VOID\r
-InitializePpiServices (\r
-  IN PEI_CORE_INSTANCE   *PrivateData,\r
-  IN PEI_CORE_INSTANCE   *OldCoreData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+ConvertPpiPointersFv (\r
+  IN  PEI_CORE_INSTANCE  *PrivateData,\r
+  IN  UINTN              OrgFvHandle,\r
+  IN  UINTN              FvHandle,\r
+  IN  UINTN              FvSize\r
+  );\r
 \r
-  Initialize PPI services.\r
+/**\r
 \r
-Arguments:\r
+  Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory.\r
 \r
-  PeiServices - The PEI core services table.\r
-  OldCoreData - Pointer to the PEI Core data.\r
-                NULL if being run in non-permament memory mode.\r
+  @param PrivateData      Pointer to PeiCore's private data structure.\r
+  @param CoreFvHandle     Address of PEI_CORE FV Handle in temporary memory.\r
 \r
-Returns:\r
-  Nothing\r
+**/\r
+VOID\r
+ConvertPeiCorePpiPointers (\r
+  IN  PEI_CORE_INSTANCE   *PrivateData,\r
+  IN  PEI_CORE_FV_HANDLE  *CoreFvHandle\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
 \r
-VOID\r
-ConvertPpiPointers (\r
-  IN CONST EFI_PEI_SERVICES              **PeiServices,\r
-  IN EFI_HOB_HANDOFF_INFO_TABLE    *OldHandOffHob,\r
-  IN EFI_HOB_HANDOFF_INFO_TABLE    *NewHandOffHob\r
-  )\r
-/*++\r
+  Dumps the PPI lists to debug output.\r
 \r
-Routine Description:\r
+  @param PrivateData     Points to PeiCore's private instance data.\r
 \r
-  Migrate the Hob list from the CAR stack to PEI installed memory.\r
+**/\r
+VOID\r
+DumpPpiList (\r
+  IN PEI_CORE_INSTANCE  *PrivateData\r
+  );\r
 \r
-Arguments:\r
+/**\r
 \r
-  PeiServices   - The PEI core services table.\r
-  OldHandOffHob - The old handoff HOB list.\r
-  NewHandOffHob - The new handoff HOB list.\r
+  Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r
 \r
-Returns:\r
+  @param PeiServices                An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param PpiList                    Pointer to PPI array that want to be installed.\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS               if all PPIs in PpiList are successfully installed.\r
+  @retval EFI_INVALID_PARAMETER     if PpiList is NULL pointer\r
+                                    if any PPI in PpiList is not valid\r
+  @retval EFI_OUT_OF_RESOURCES      if there is no more memory resource to install PPI\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiInstallPpi (\r
   IN CONST EFI_PEI_SERVICES        **PeiServices,\r
   IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Install PPI services.\r
-\r
-Arguments:\r
+  );\r
 \r
-  PeiServices - Pointer to the PEI Service Table\r
-  PpiList     - Pointer to a list of PEI PPI Descriptors.\r
+/**\r
 \r
-Returns:\r
+  Re-Install PPI services.\r
 \r
-    EFI_SUCCESS             - if all PPIs in PpiList are successfully installed.\r
-    EFI_INVALID_PARAMETER   - if PpiList is NULL pointer\r
-    EFI_INVALID_PARAMETER   - if any PPI in PpiList is not valid\r
-    EFI_OUT_OF_RESOURCES    - if there is no more memory resource to install PPI\r
+  @param PeiServices            An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param OldPpi                 Pointer to the old PEI PPI Descriptors.\r
+  @param NewPpi                 Pointer to the new PEI PPI Descriptors.\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS           if the operation was successful\r
+  @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r
+                                if NewPpi is not valid\r
+  @retval EFI_NOT_FOUND         if the PPI was not in the database\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiReInstallPpi (\r
   IN CONST EFI_PEI_SERVICES        **PeiServices,\r
   IN CONST EFI_PEI_PPI_DESCRIPTOR  *OldPpi,\r
   IN CONST EFI_PEI_PPI_DESCRIPTOR  *NewPpi\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Re-Install PPI services.\r
+  );\r
 \r
-Arguments:\r
+/**\r
 \r
-  PeiServices - Pointer to the PEI Service Table\r
-  OldPpi      - Pointer to the old PEI PPI Descriptors.\r
-  NewPpi      - Pointer to the new PEI PPI Descriptors.\r
+  Locate a given named PPI.\r
 \r
-Returns:\r
 \r
-  EFI_SUCCESS           - if the operation was successful\r
-  EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL\r
-  EFI_INVALID_PARAMETER - if NewPpi is not valid\r
-  EFI_NOT_FOUND         - if the PPI was not in the database\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param Guid            Pointer to GUID of the PPI.\r
+  @param Instance        Instance Number to discover.\r
+  @param PpiDescriptor   Pointer to reference the found descriptor. If not NULL,\r
+                         returns a pointer to the descriptor (includes flags, etc)\r
+  @param Ppi             Pointer to reference the found PPI\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS   if the PPI is in the database\r
+  @retval EFI_NOT_FOUND if the PPI is not in the database\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiLocatePpi (\r
-  IN CONST EFI_PEI_SERVICES            **PeiServices,\r
-  IN CONST EFI_GUID                    *Guid,\r
+  IN CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN CONST EFI_GUID              *Guid,\r
   IN UINTN                       Instance,\r
   IN OUT EFI_PEI_PPI_DESCRIPTOR  **PpiDescriptor,\r
   IN OUT VOID                    **Ppi\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  );\r
 \r
-  Locate a given named PPI.\r
+/**\r
 \r
-Arguments:\r
+  Install a notification for a given PPI.\r
 \r
-  PeiServices   - Pointer to the PEI Service Table\r
-  Guid          - Pointer to GUID of the PPI.\r
-  Instance      - Instance Number to discover.\r
-  PpiDescriptor - Pointer to reference the found descriptor. If not NULL,\r
-                returns a pointer to the descriptor (includes flags, etc)\r
-  Ppi           - Pointer to reference the found PPI\r
 \r
-Returns:\r
+  @param PeiServices            An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param NotifyList             Pointer to list of Descriptors to notify upon.\r
 \r
-  Status -  EFI_SUCCESS   if the PPI is in the database\r
-            EFI_NOT_FOUND if the PPI is not in the database\r
---*/\r
-;\r
+  @retval EFI_SUCCESS           if successful\r
+  @retval EFI_OUT_OF_RESOURCES  if no space in the database\r
+  @retval EFI_INVALID_PARAMETER if not a good descriptor\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiNotifyPpi (\r
   IN CONST EFI_PEI_SERVICES           **PeiServices,\r
   IN CONST EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyList\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Install a notification for a given PPI.\r
-\r
-Arguments:\r
-\r
-  PeiServices - Pointer to the PEI Service Table\r
-  NotifyList  - Pointer to list of Descriptors to notify upon.\r
+  );\r
 \r
-Returns:\r
+/**\r
 \r
-  Status - EFI_SUCCESS          if successful\r
-           EFI_OUT_OF_RESOURCES if no space in the database\r
-           EFI_INVALID_PARAMETER if not a good decriptor\r
+  Process the Notify List at dispatch level.\r
 \r
---*/\r
-;\r
+  @param PrivateData  PeiCore's private data structure.\r
 \r
+**/\r
 VOID\r
-ProcessNotifyList (\r
+ProcessDispatchNotifyList (\r
   IN PEI_CORE_INSTANCE  *PrivateData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Process the Notify List at dispatch level.\r
-\r
-Arguments:\r
+  );\r
 \r
-  PeiServices - Pointer to the PEI Service Table\r
+/**\r
 \r
-Returns:\r
+  Process notifications.\r
 \r
---*/\r
-;\r
+  @param PrivateData        PeiCore's private data structure\r
+  @param NotifyType         Type of notify to fire.\r
+  @param InstallStartIndex  Install Beginning index.\r
+  @param InstallStopIndex   Install Ending index.\r
+  @param NotifyStartIndex   Notify Beginning index.\r
+  @param NotifyStopIndex    Notify Ending index.\r
 \r
+**/\r
 VOID\r
-DispatchNotify (\r
+ProcessNotify (\r
   IN PEI_CORE_INSTANCE  *PrivateData,\r
-  IN UINTN               NotifyType,\r
-  IN INTN                InstallStartIndex,\r
-  IN INTN                InstallStopIndex,\r
-  IN INTN                NotifyStartIndex,\r
-  IN INTN                NotifyStopIndex\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Dispatch notifications.\r
-\r
-Arguments:\r
+  IN UINTN              NotifyType,\r
+  IN INTN               InstallStartIndex,\r
+  IN INTN               InstallStopIndex,\r
+  IN INTN               NotifyStartIndex,\r
+  IN INTN               NotifyStopIndex\r
+  );\r
 \r
-  PeiServices         - Pointer to the PEI Service Table\r
-  NotifyType          - Type of notify to fire.\r
-  InstallStartIndex   - Install Beginning index.\r
-  InstallStopIndex    - Install Ending index.\r
-  NotifyStartIndex    - Notify Beginning index.\r
-  NotifyStopIndex    - Notify Ending index.\r
+/**\r
+  Process PpiList from SEC phase.\r
 \r
-Returns:  None\r
+  @param PeiServices    An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param PpiList        Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
+                        These PPI's will be installed and/or immediately signaled if they are notification type.\r
 \r
---*/\r
-;\r
+**/\r
+VOID\r
+ProcessPpiListFromSec (\r
+  IN CONST EFI_PEI_SERVICES        **PeiServices,\r
+  IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList\r
+  );\r
 \r
 //\r
 // Boot mode support functions\r
 //\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetBootMode (\r
-  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
-  IN OUT EFI_BOOT_MODE *BootMode\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   This service enables PEIMs to ascertain the present value of the boot mode.\r
 \r
-Arguments:\r
-\r
-  PeiServices    - The PEI core services table.\r
-  BootMode       - A pointer to contain the value of the boot mode.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The boot mode was returned successfully.\r
-  EFI_INVALID_PARAMETER - BootMode is NULL.\r
+  @param PeiServices            An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param BootMode               A pointer to contain the value of the boot mode.\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS           The boot mode was returned successfully.\r
+  @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiSetBootMode (\r
+PeiGetBootMode (\r
   IN CONST EFI_PEI_SERVICES  **PeiServices,\r
-  IN EFI_BOOT_MODE     BootMode\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  IN OUT   EFI_BOOT_MODE     *BootMode\r
+  );\r
 \r
+/**\r
   This service enables PEIMs to update the boot mode variable.\r
 \r
-Arguments:\r
 \r
-  PeiServices    - The PEI core services table.\r
-  BootMode       - The value of the boot mode to set.\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param BootMode        The value of the boot mode to set.\r
 \r
-Returns:\r
+  @return EFI_SUCCESS    The value was successfully updated\r
 \r
-  EFI_SUCCESS    - The value was successfully updated\r
-\r
---*/\r
-;\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiSetBootMode (\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
+  IN EFI_BOOT_MODE           BootMode\r
+  );\r
 \r
 //\r
 // Security support functions\r
 //\r
-VOID\r
-InitializeSecurityServices (\r
-  IN EFI_PEI_SERVICES  **PeiServices,\r
-  IN PEI_CORE_INSTANCE *OldCoreData\r
-  )\r
-/*++\r
 \r
-Routine Description:\r
+/**\r
 \r
   Initialize the security services.\r
 \r
-Arguments:\r
-\r
-  PeiServices - The PEI core services table.\r
-  OldCoreData - Pointer to the old core data.\r
-                NULL if being run in non-permament memory mode.\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-;\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param OldCoreData     Pointer to the old core data.\r
+                         NULL if being run in non-permanent memory mode.\r
 \r
-EFI_STATUS\r
-VerifyFv (\r
-  IN EFI_FIRMWARE_VOLUME_HEADER  *CurrentFvAddress\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Provide a callout to the OEM FV verification service.\r
+**/\r
+VOID\r
+InitializeSecurityServices (\r
+  IN EFI_PEI_SERVICES   **PeiServices,\r
+  IN PEI_CORE_INSTANCE  *OldCoreData\r
+  );\r
 \r
-Arguments:\r
+/**\r
+  Verify a Firmware volume.\r
 \r
-  CurrentFvAddress       - Pointer to the FV under investigation.\r
+  @param CurrentFvAddress           Pointer to the current Firmware Volume under consideration\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS               Firmware Volume is legal\r
+  @retval EFI_SECURITY_VIOLATION    Firmware Volume fails integrity test\r
 \r
-  Status - EFI_SUCCESS\r
+**/\r
+EFI_STATUS\r
+VerifyFv (\r
+  IN EFI_FIRMWARE_VOLUME_HEADER  *CurrentFvAddress\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
+  Provide a callout to the security verification service.\r
 \r
+  @param PrivateData     PeiCore's private data structure\r
+  @param VolumeHandle    Handle of FV\r
+  @param FileHandle      Handle of PEIM's FFS\r
+  @param AuthenticationStatus Authentication status\r
 \r
+  @retval EFI_SUCCESS              Image is OK\r
+  @retval EFI_SECURITY_VIOLATION   Image is illegal\r
+  @retval EFI_NOT_FOUND            If security PPI is not installed.\r
+**/\r
 EFI_STATUS\r
 VerifyPeim (\r
-  IN PEI_CORE_INSTANCE      *PrivateData,\r
-  IN EFI_PEI_FV_HANDLE      VolumeHandle,\r
-  IN EFI_PEI_FILE_HANDLE    FileHandle\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Provide a callout to the security verification service.\r
-\r
-Arguments:\r
+  IN PEI_CORE_INSTANCE    *PrivateData,\r
+  IN EFI_PEI_FV_HANDLE    VolumeHandle,\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
+  IN UINT32               AuthenticationStatus\r
+  );\r
 \r
-  PeiServices          - The PEI core services table.\r
-  CurrentPeimAddress   - Pointer to the Firmware File under investigation.\r
+/**\r
 \r
-Returns:\r
+  Gets the pointer to the HOB List.\r
 \r
-  EFI_SUCCESS             - Image is OK\r
-  EFI_SECURITY_VIOLATION  - Image is illegal\r
 \r
---*/\r
-;\r
+  @param PeiServices                   An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param HobList                       Pointer to the HOB List.\r
 \r
+  @retval EFI_SUCCESS                  Get the pointer of HOB List\r
+  @retval EFI_NOT_AVAILABLE_YET        the HOB List is not yet published\r
+  @retval EFI_INVALID_PARAMETER        HobList is NULL (in debug mode)\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiGetHobList (\r
   IN CONST EFI_PEI_SERVICES  **PeiServices,\r
-  IN OUT VOID          **HobList\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Gets the pointer to the HOB List.\r
-\r
-Arguments:\r
-\r
-  PeiServices - The PEI core services table.\r
-  HobList     - Pointer to the HOB List.\r
+  IN OUT VOID                **HobList\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Add a new HOB to the HOB List.\r
 \r
-  EFI_SUCCESS                 - Get the pointer of HOB List\r
-  EFI_NOT_AVAILABLE_YET       - the HOB List is not yet published\r
-  EFI_INVALID_PARAMETER       - HobList is NULL (in debug mode)\r
+  @param PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param Type               Type of the new HOB.\r
+  @param Length             Length of the new HOB to allocate.\r
+  @param Hob                Pointer to the new HOB.\r
 \r
---*/\r
-;\r
+  @return  EFI_SUCCESS           Success to create HOB.\r
+  @retval  EFI_INVALID_PARAMETER if Hob is NULL\r
+  @retval  EFI_NOT_AVAILABLE_YET if HobList is still not available.\r
+  @retval  EFI_OUT_OF_RESOURCES  if there is no more memory to grow the Hoblist.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiCreateHob (\r
   IN CONST EFI_PEI_SERVICES  **PeiServices,\r
-  IN UINT16            Type,\r
-  IN UINT16            Length,\r
-  IN OUT VOID          **Hob\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Add a new HOB to the HOB List.\r
-\r
-Arguments:\r
+  IN UINT16                  Type,\r
+  IN UINT16                  Length,\r
+  IN OUT VOID                **Hob\r
+  );\r
 \r
-  PeiServices - The PEI core services table.\r
-  Type        - Type of the new HOB.\r
-  Length      - Length of the new HOB to allocate.\r
-  Hob         - Pointer to the new HOB.\r
+/**\r
 \r
-Returns:\r
+  Builds a Handoff Information Table HOB\r
 \r
-  Status  - EFI_SUCCESS\r
-          - EFI_INVALID_PARAMETER if Hob is NULL\r
-          - EFI_NOT_AVAILABLE_YET if HobList is still not available.\r
-          - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r
+  @param BootMode        - Current Bootmode\r
+  @param MemoryBegin     - Start Memory Address.\r
+  @param MemoryLength    - Length of Memory.\r
 \r
---*/\r
-;\r
+  @return EFI_SUCCESS Always success to initialize HOB.\r
 \r
+**/\r
 EFI_STATUS\r
 PeiCoreBuildHobHandoffInfoTable (\r
   IN EFI_BOOT_MODE         BootMode,\r
   IN EFI_PHYSICAL_ADDRESS  MemoryBegin,\r
   IN UINT64                MemoryLength\r
-  )\r
-/*++\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Install SEC HOB data to the HOB List.\r
 \r
-  Builds a Handoff Information Table HOB\r
+  @param PeiServices    An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param SecHobList     Pointer to SEC HOB List.\r
 \r
-Arguments:\r
+  @return EFI_SUCCESS           Success to install SEC HOB data.\r
+  @retval EFI_OUT_OF_RESOURCES  If there is no more memory to grow the Hoblist.\r
 \r
-  BootMode      - Current Bootmode\r
-  MemoryBegin   - Start Memory Address.\r
-  MemoryLength  - Length of Memory.\r
+**/\r
+EFI_STATUS\r
+PeiInstallSecHobData (\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
+  IN EFI_HOB_GENERIC_HEADER  *SecHobList\r
+  );\r
 \r
-Returns:\r
+//\r
+// FFS Fw Volume support functions\r
+//\r
 \r
-  EFI_SUCCESS\r
+/**\r
+  Searches for the next matching file in the firmware volume.\r
 \r
---*/\r
-;\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param SearchType      Filter to find only files of this type.\r
+                         Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
+  @param FvHandle        Handle of firmware volume in which to search.\r
+  @param FileHandle      On entry, points to the current handle from which to begin searching or NULL to start\r
+                         at the beginning of the firmware volume. On exit, points the file handle of the next file\r
+                         in the volume or NULL if there are no more files.\r
 \r
+  @retval EFI_NOT_FOUND  The file was not found.\r
+  @retval EFI_NOT_FOUND  The header checksum was not zero.\r
+  @retval EFI_SUCCESS    The file was found.\r
 \r
-//\r
-// FFS Fw Volume support functions\r
-//\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiFfsFindNextFile (\r
-  IN CONST EFI_PEI_SERVICES      **PeiServices,\r
-  IN UINT8                       SearchType,\r
-  IN EFI_PEI_FV_HANDLE           FwVolHeader,\r
-  IN OUT EFI_PEI_FILE_HANDLE     *FileHeader\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-    Given the input file pointer, search for the next matching file in the\r
-    FFS volume as defined by SearchType. The search starts from FileHeader inside\r
-    the Firmware Volume defined by FwVolHeader.\r
-\r
-Arguments:\r
-    PeiServices - Pointer to the PEI Core Services Table.\r
+  IN CONST EFI_PEI_SERVICES   **PeiServices,\r
+  IN UINT8                    SearchType,\r
+  IN EFI_PEI_FV_HANDLE        FvHandle,\r
+  IN OUT EFI_PEI_FILE_HANDLE  *FileHandle\r
+  );\r
 \r
-    SearchType - Filter to find only files of this type.\r
-      Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
+/**\r
+  Go through the file to search SectionType section.\r
+  Search within encapsulation sections (compression and GUIDed) recursively,\r
+  until the match section is found.\r
+\r
+  @param PeiServices          An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param SectionType          Filter to find only section of this type.\r
+  @param SectionInstance      Pointer to the filter to find the specific instance of section.\r
+  @param Section              From where to search.\r
+  @param SectionSize          The file size to search.\r
+  @param OutputBuffer         A pointer to the discovered section, if successful.\r
+                              NULL if section not found.\r
+  @param AuthenticationStatus Updated upon return to point to the authentication status for this section.\r
+  @param IsFfs3Fv             Indicates the FV format.\r
+\r
+  @return EFI_NOT_FOUND       The match section is not found.\r
+  @return EFI_SUCCESS         The match section is found.\r
 \r
-    FwVolHeader - Pointer to the FV header of the volume to search.\r
-      This parameter must point to a valid FFS volume.\r
+**/\r
+EFI_STATUS\r
+ProcessSection (\r
+  IN CONST EFI_PEI_SERVICES     **PeiServices,\r
+  IN EFI_SECTION_TYPE           SectionType,\r
+  IN OUT UINTN                  *SectionInstance,\r
+  IN EFI_COMMON_SECTION_HEADER  *Section,\r
+  IN UINTN                      SectionSize,\r
+  OUT VOID                      **OutputBuffer,\r
+  OUT UINT32                    *AuthenticationStatus,\r
+  IN BOOLEAN                    IsFfs3Fv\r
+  );\r
 \r
-    FileHeader  - Pointer to the current file from which to begin searching.\r
-      This pointer will be updated upon return to reflect the file found.\r
+/**\r
+  Searches for the next matching section within the specified file.\r
 \r
-Returns:\r
-    EFI_NOT_FOUND - No files matching the search criteria were found\r
-    EFI_SUCCESS\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
+  @param SectionType     Filter to find only sections of this type.\r
+  @param FileHandle      Pointer to the current file to search.\r
+  @param SectionData     A pointer to the discovered section, if successful.\r
+                         NULL if section not found\r
 \r
---*/\r
-;\r
+  @retval EFI_NOT_FOUND  The section was not found.\r
+  @retval EFI_SUCCESS    The section was found.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiFfsFindSectionData (\r
-  IN CONST EFI_PEI_SERVICES      **PeiServices,\r
-  IN EFI_SECTION_TYPE            SectionType,\r
-  IN EFI_PEI_FILE_HANDLE         FfsFileHeader,\r
-  IN OUT VOID                    **SectionData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-    Given the input file pointer, search for the next matching section in the\r
-    FFS volume.\r
-\r
-Arguments:\r
-    PeiServices - Pointer to the PEI Core Services Table.\r
-    SearchType - Filter to find only sections of this type.\r
-    FfsFileHeader  - Pointer to the current file to search.\r
-    SectionData - Pointer to the Section matching SectionType in FfsFileHeader.\r
-                - NULL if section not found\r
-\r
-Returns:\r
-    EFI_NOT_FOUND - No files matching the search criteria were found\r
-    EFI_SUCCESS\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PeiFvFindNextVolume (\r
-  IN CONST EFI_PEI_SERVICES                **PeiServices,\r
-  IN UINTN                           Instance,\r
-  IN OUT EFI_PEI_FV_HANDLE           *FwVolHeader\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  IN CONST EFI_PEI_SERVICES   **PeiServices,\r
+  IN     EFI_SECTION_TYPE     SectionType,\r
+  IN     EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT VOID                    **SectionData\r
+  );\r
 \r
-  Return the BFV location\r
+/**\r
+  Searches for the next matching section within the specified file.\r
 \r
-  BugBug -- Move this to the location of this code to where the\r
-  other FV and FFS support code lives.\r
-  Also, update to use FindFV for instances #'s >= 1.\r
+  @param  PeiServices           An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param  SectionType           The value of the section type to find.\r
+  @param  SectionInstance       Section instance to find.\r
+  @param  FileHandle            Handle of the firmware file to search.\r
+  @param  SectionData           A pointer to the discovered section, if successful.\r
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.\r
 \r
-Arguments:\r
+  @retval EFI_SUCCESS      The section was found.\r
+  @retval EFI_NOT_FOUND    The section was not found.\r
 \r
-  PeiServices - The PEI core services table.\r
-  Instance    - Instance of FV to find\r
-  FwVolHeader - Pointer to contain the data to return\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFindSectionData3 (\r
+  IN CONST EFI_PEI_SERVICES   **PeiServices,\r
+  IN     EFI_SECTION_TYPE     SectionType,\r
+  IN     UINTN                SectionInstance,\r
+  IN     EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT VOID                    **SectionData,\r
+  OUT UINT32                  *AuthenticationStatus\r
+  );\r
 \r
-Returns:\r
-  Pointer to the Firmware Volume instance requested\r
+/**\r
+  Search the firmware volumes by index\r
 \r
-  EFI_INVALID_PARAMETER     - FwVolHeader is NULL\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
+  @param Instance        This instance of the firmware volume to find. The value 0 is the Boot Firmware\r
+                         Volume (BFV).\r
+  @param VolumeHandle    On exit, points to the next volume handle or NULL if it does not exist.\r
 \r
-  EFI_SUCCESS               - Firmware volume instance successfully found.\r
+  @retval EFI_INVALID_PARAMETER  VolumeHandle is NULL\r
+  @retval EFI_NOT_FOUND          The volume was not found.\r
+  @retval EFI_SUCCESS            The volume was found.\r
 \r
---*/\r
-;\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFindNextVolume (\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
+  IN UINTN                   Instance,\r
+  IN OUT EFI_PEI_FV_HANDLE   *VolumeHandle\r
+  );\r
 \r
 //\r
 // Memory support functions\r
 //\r
+\r
+/**\r
+\r
+  Initialize the memory services.\r
+\r
+  @param PrivateData     PeiCore's private data structure\r
+  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size\r
+                         and location of temporary RAM, the stack location and the BFV location.\r
+  @param OldCoreData     Pointer to the PEI Core data.\r
+                         NULL if being run in non-permanent memory mode.\r
+\r
+**/\r
 VOID\r
 InitializeMemoryServices (\r
   IN PEI_CORE_INSTANCE           *PrivateData,\r
   IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData,\r
   IN PEI_CORE_INSTANCE           *OldCoreData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialize the memory services.\r
-\r
-Arguments:\r
+  );\r
 \r
-  PeiServices          - The PEI core services table.\r
-  PeiStartupDescriptor - Information and services provided by SEC phase.\r
-  OldCoreData          - Pointer to the PEI Core data.\r
-                         NULL if being run in non-permament memory mode.\r
+/**\r
 \r
-Returns:\r
+  Install the permanent memory is now available.\r
+  Creates HOB (PHIT and Stack).\r
 \r
-  None\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param MemoryBegin     Start of memory address.\r
+  @param MemoryLength    Length of memory.\r
 \r
---*/\r
-;\r
+  @return EFI_SUCCESS Always success.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiInstallPeiMemory (\r
-  IN CONST EFI_PEI_SERVICES      **PeiServices,\r
-  IN EFI_PHYSICAL_ADDRESS  MemoryBegin,\r
-  IN UINT64                MemoryLength\r
-  )\r
-/*++\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
+  IN EFI_PHYSICAL_ADDRESS    MemoryBegin,\r
+  IN UINT64                  MemoryLength\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Migrate memory pages allocated in pre-memory phase.\r
+  Copy memory pages at temporary heap top to permanent heap top.\r
 \r
-  Install the permanent memory is now available.\r
-  Creates HOB (PHIT and Stack).\r
+  @param[in] Private                Pointer to the private data passed in from caller.\r
+  @param[in] TemporaryRamMigrated   Temporary memory has been migrated to permanent memory.\r
+\r
+**/\r
+VOID\r
+MigrateMemoryPages (\r
+  IN PEI_CORE_INSTANCE  *Private,\r
+  IN BOOLEAN            TemporaryRamMigrated\r
+  );\r
 \r
-Arguments:\r
+/**\r
+  Removes any FV HOBs whose base address is not in PEI installed memory.\r
 \r
-  PeiServices   - The PEI core services table.\r
-  MemoryBegin   - Start of memory address.\r
-  MemoryLength  - Length of memory.\r
+  @param[in] Private          Pointer to PeiCore's private data structure.\r
 \r
-Returns:\r
+**/\r
+VOID\r
+RemoveFvHobsInTemporaryMemory (\r
+  IN PEI_CORE_INSTANCE  *Private\r
+  );\r
 \r
-  Status  - EFI_SUCCESS\r
+/**\r
+  Migrate the base address in firmware volume allocation HOBs\r
+  from temporary memory to PEI installed memory.\r
 \r
---*/\r
-;\r
+  @param[in] PrivateData      Pointer to PeiCore's private data structure.\r
+  @param[in] OrgFvHandle      Address of FV Handle in temporary memory.\r
+  @param[in] FvHandle         Address of FV Handle in permanent memory.\r
+\r
+**/\r
+VOID\r
+ConvertFvHob (\r
+  IN PEI_CORE_INSTANCE  *PrivateData,\r
+  IN UINTN              OrgFvHandle,\r
+  IN UINTN              FvHandle\r
+  );\r
+\r
+/**\r
+  Migrate MemoryBaseAddress in memory allocation HOBs\r
+  from the temporary memory to PEI installed memory.\r
+\r
+  @param[in] PrivateData        Pointer to PeiCore's private data structure.\r
+\r
+**/\r
+VOID\r
+ConvertMemoryAllocationHobs (\r
+  IN PEI_CORE_INSTANCE  *PrivateData\r
+  );\r
 \r
+/**\r
+  The purpose of the service is to publish an interface that allows\r
+  PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
+\r
+  Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.\r
+  After InstallPeiMemory() is called, PEI will allocate pages within the region\r
+  of memory provided by InstallPeiMemory() service in a best-effort fashion.\r
+  Location-specific allocations are not managed by the PEI foundation code.\r
+\r
+  @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param  MemoryType       The type of memory to allocate.\r
+  @param  Pages            The number of contiguous 4 KB pages to allocate.\r
+  @param  Memory           Pointer to a physical address. On output, the address is set to the base\r
+                           of the page range that was allocated.\r
+\r
+  @retval EFI_SUCCESS           The memory range was successfully allocated.\r
+  @retval EFI_OUT_OF_RESOURCES  The pages could not be allocated.\r
+  @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,\r
+                                EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,\r
+                                EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiAllocatePages (\r
-  IN CONST EFI_PEI_SERVICES           **PeiServices,\r
-  IN EFI_MEMORY_TYPE            MemoryType,\r
-  IN UINTN                      Pages,\r
-  OUT EFI_PHYSICAL_ADDRESS      *Memory\r
-  )\r
-/*++\r
+  IN CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN       EFI_MEMORY_TYPE       MemoryType,\r
+  IN       UINTN                 Pages,\r
+  OUT      EFI_PHYSICAL_ADDRESS  *Memory\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Frees memory pages.\r
 \r
-  Memory allocation service on permanent memory,\r
-  not usable prior to the memory installation.\r
+  @param[in] PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param[in] Memory             The base physical address of the pages to be freed.\r
+  @param[in] Pages              The number of contiguous 4 KB pages to free.\r
+\r
+  @retval EFI_SUCCESS           The requested pages were freed.\r
+  @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r
+  @retval EFI_NOT_FOUND         The requested memory pages were not allocated with\r
+                                AllocatePages().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFreePages (\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
+  IN EFI_PHYSICAL_ADDRESS    Memory,\r
+  IN UINTN                   Pages\r
+  );\r
 \r
-Arguments:\r
+/**\r
 \r
-  PeiServices - The PEI core services table.\r
-  Type        - Type of allocation.\r
-  MemoryType  - Type of memory to allocate.\r
-  Pages       - Number of pages to allocate.\r
-  Memory      - Pointer of memory allocated.\r
+  Memory allocation service on the temporary memory.\r
 \r
-Returns:\r
 \r
-  Status - EFI_SUCCESS              The allocation was successful\r
-           EFI_INVALID_PARAMETER    Only AllocateAnyAddress is supported.\r
-           EFI_NOT_AVAILABLE_YET    Called with permanent memory not available\r
-           EFI_OUT_OF_RESOURCES     There is not enough HOB heap to satisfy the requirement\r
-                                    to allocate the number of pages.\r
+  @param PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param Size               Amount of memory required\r
+  @param Buffer             Address of pointer to the buffer\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS              The allocation was successful\r
+  @retval EFI_OUT_OF_RESOURCES     There is not enough heap to satisfy the requirement\r
+                                   to allocate the requested size.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiAllocatePool (\r
-  IN CONST EFI_PEI_SERVICES           **PeiServices,\r
-  IN UINTN                      Size,\r
-  OUT VOID                      **Buffer\r
-  )\r
-/*++\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices,\r
+  IN UINTN                   Size,\r
+  OUT VOID                   **Buffer\r
+  );\r
+\r
+/**\r
+\r
+  Routine for load image file.\r
+\r
+\r
+  @param PeiServices            An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param FileHandle             Pointer to the FFS file header of the image.\r
+  @param PeimState              The dispatch state of the input PEIM handle.\r
+  @param EntryPoint             Pointer to entry point of specified image file for output.\r
+  @param AuthenticationState    Pointer to attestation authentication state of image.\r
+\r
+  @retval EFI_SUCCESS     Image is successfully loaded.\r
+  @retval EFI_NOT_FOUND   Fail to locate necessary PPI\r
+  @retval Others          Fail to load file.\r
+\r
+**/\r
+EFI_STATUS\r
+PeiLoadImage (\r
+  IN  CONST EFI_PEI_SERVICES   **PeiServices,\r
+  IN  EFI_PEI_FILE_HANDLE      FileHandle,\r
+  IN  UINT8                    PeimState,\r
+  OUT    EFI_PHYSICAL_ADDRESS  *EntryPoint,\r
+  OUT    UINT32                *AuthenticationState\r
+  );\r
 \r
-Routine Description:\r
+/**\r
 \r
-  Memory allocation service on the CAR.\r
+  Core version of the Status Code reporter\r
 \r
-Arguments:\r
 \r
-  PeiServices - The PEI core services table.\r
+  @param PeiServices            An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param CodeType               Type of Status Code.\r
+  @param Value                  Value to output for Status Code.\r
+  @param Instance               Instance Number of this status code.\r
+  @param CallerId               ID of the caller of this status code.\r
+  @param Data                   Optional data associated with this status code.\r
 \r
-  Size        - Amount of memory required\r
+  @retval EFI_SUCCESS             if status code is successfully reported\r
+  @retval EFI_NOT_AVAILABLE_YET   if StatusCodePpi has not been installed\r
 \r
-  Buffer      - Address of pointer to the buffer\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiReportStatusCode (\r
+  IN CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN EFI_STATUS_CODE_TYPE        CodeType,\r
+  IN EFI_STATUS_CODE_VALUE       Value,\r
+  IN UINT32                      Instance,\r
+  IN CONST EFI_GUID              *CallerId,\r
+  IN CONST EFI_STATUS_CODE_DATA  *Data OPTIONAL\r
+  );\r
 \r
-Returns:\r
+/**\r
 \r
-  Status - EFI_SUCCESS              The allocation was successful\r
-           EFI_OUT_OF_RESOURCES     There is not enough heap to satisfy the requirement\r
-                                    to allocate the requested size.\r
+  Core version of the Reset System\r
 \r
---*/\r
-;\r
 \r
+  @param PeiServices                An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+\r
+  @retval EFI_NOT_AVAILABLE_YET     PPI not available yet.\r
+  @retval EFI_DEVICE_ERROR          Did not reset system.\r
+                                    Otherwise, resets the system.\r
+\r
+**/\r
 EFI_STATUS\r
-PeiLoadImage (\r
-  IN  EFI_PEI_SERVICES            **PeiServices,\r
-  IN  EFI_PEI_FILE_HANDLE         FileHandle,\r
-  OUT    EFI_PHYSICAL_ADDRESS     *EntryPoint,\r
-  OUT    UINT32                   *AuthenticationState\r
-  )\r
-/*++\r
+EFIAPI\r
+PeiResetSystem (\r
+  IN CONST EFI_PEI_SERVICES  **PeiServices\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Resets the entire platform.\r
 \r
-  Get entry point of a Peim file.\r
+  @param[in] ResetType      The type of reset to perform.\r
+  @param[in] ResetStatus    The status code for the reset.\r
+  @param[in] DataSize       The size, in bytes, of ResetData.\r
+  @param[in] ResetData      For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
+                            the data buffer starts with a Null-terminated string, optionally\r
+                            followed by additional binary data. The string is a description\r
+                            that the caller may use to further indicate the reason for the\r
+                            system reset.\r
 \r
-Arguments:\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiResetSystem2 (\r
+  IN EFI_RESET_TYPE  ResetType,\r
+  IN EFI_STATUS      ResetStatus,\r
+  IN UINTN           DataSize,\r
+  IN VOID            *ResetData OPTIONAL\r
+  );\r
 \r
-  PeiServices                 - Calling context.\r
+/**\r
 \r
-  PeimFileHeader              - Peim file's header.\r
+  Initialize PeiCore FV List.\r
 \r
-  EntryPoint                  - Entry point of that Peim file.\r
 \r
-Returns:\r
+  @param PrivateData     - Pointer to PEI_CORE_INSTANCE.\r
+  @param SecCoreData     - Pointer to EFI_SEC_PEI_HAND_OFF.\r
 \r
-  Status code.\r
+**/\r
+VOID\r
+PeiInitializeFv (\r
+  IN  PEI_CORE_INSTANCE          *PrivateData,\r
+  IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
+  Process Firmware Volume Information once FvInfoPPI install.\r
+\r
+  @param PeiServices       An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param NotifyDescriptor  Address of the notification descriptor data structure.\r
+  @param Ppi               Address of the PPI that was installed.\r
 \r
+  @retval EFI_SUCCESS if the interface could be successfully installed\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiReportStatusCode (\r
-  IN CONST EFI_PEI_SERVICES         **PeiServices,\r
-  IN EFI_STATUS_CODE_TYPE     CodeType,\r
-  IN EFI_STATUS_CODE_VALUE    Value,\r
-  IN UINT32                   Instance,\r
-  IN CONST EFI_GUID                 *CallerId,\r
-  IN CONST EFI_STATUS_CODE_DATA     *Data OPTIONAL\r
-  )\r
-/*++\r
+FirmwareVolumeInfoPpiNotifyCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  );\r
+\r
+/**\r
 \r
-Routine Description:\r
+  Given the input VolumeHandle, search for the next matching name file.\r
 \r
-  Core version of the Status Code reporter\r
+  @param FileName        File name to search.\r
+  @param VolumeHandle    The current FV to search.\r
+  @param FileHandle      Pointer to the file matching name in VolumeHandle.\r
+                         NULL if file not found\r
 \r
-Arguments:\r
+  @retval EFI_NOT_FOUND  No files matching the search criteria were found\r
+  @retval EFI_SUCCESS    Success to search given file\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFindFileByName (\r
+  IN  CONST EFI_GUID       *FileName,\r
+  IN  EFI_PEI_FV_HANDLE    VolumeHandle,\r
+  OUT EFI_PEI_FILE_HANDLE  *FileHandle\r
+  );\r
+\r
+/**\r
+  Returns information about a specific file.\r
+\r
+  @param FileHandle       Handle of the file.\r
+  @param FileInfo         Upon exit, points to the file's information.\r
+\r
+  @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
+  @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
+  @retval EFI_SUCCESS           File information returned.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsGetFileInfo (\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT EFI_FV_FILE_INFO    *FileInfo\r
+  );\r
 \r
-  PeiServices - The PEI core services table.\r
+/**\r
+  Returns information about a specific file.\r
 \r
-  CodeType    - Type of Status Code.\r
+  @param FileHandle       Handle of the file.\r
+  @param FileInfo         Upon exit, points to the file's information.\r
 \r
-  Value       - Value to output for Status Code.\r
+  @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
+  @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
+  @retval EFI_SUCCESS           File information returned.\r
 \r
-  Instance    - Instance Number of this status code.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsGetFileInfo2 (\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT EFI_FV_FILE_INFO2   *FileInfo\r
+  );\r
 \r
-  CallerId    - ID of the caller of this status code.\r
+/**\r
+  Returns information about the specified volume.\r
 \r
-  Data        - Optional data associated with this status code.\r
+  @param VolumeHandle    Handle of the volume.\r
+  @param VolumeInfo      Upon exit, points to the volume's information.\r
 \r
-Returns:\r
+  @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r
+  @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.\r
+  @retval EFI_SUCCESS           Volume information returned.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsGetVolumeInfo (\r
+  IN EFI_PEI_FV_HANDLE  VolumeHandle,\r
+  OUT EFI_FV_INFO       *VolumeInfo\r
+  );\r
 \r
-  Status  - EFI_SUCCESS             if status code is successfully reported\r
-          - EFI_NOT_AVAILABLE_YET   if StatusCodePpi has not been installed\r
+/**\r
+  This routine enables a PEIM to register itself for shadow when the PEI Foundation\r
+  discovers permanent memory.\r
 \r
---*/\r
-;\r
+  @param FileHandle             File handle of a PEIM.\r
 \r
+  @retval EFI_NOT_FOUND         The file handle doesn't point to PEIM itself.\r
+  @retval EFI_ALREADY_STARTED   Indicate that the PEIM has been registered itself.\r
+  @retval EFI_SUCCESS           Successfully to register itself.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiResetSystem (\r
-  IN CONST EFI_PEI_SERVICES   **PeiServices\r
-  )\r
-/*++\r
+PeiRegisterForShadow (\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Initialize image service that install PeiLoadFilePpi.\r
 \r
-  Core version of the Reset System\r
+  @param PrivateData     Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r
+  @param OldCoreData     Pointer to Old PeiCore's private data.\r
+                         If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r
+                         If not NULL, PeiCore is entered at second time, stack/heap has been moved\r
+                         to permanent memory.\r
 \r
-Arguments:\r
+**/\r
+VOID\r
+InitializeImageServices (\r
+  IN  PEI_CORE_INSTANCE  *PrivateData,\r
+  IN  PEI_CORE_INSTANCE  *OldCoreData\r
+  );\r
 \r
-  PeiServices - The PEI core services table.\r
+/**\r
+  Loads and relocates a PE/COFF image in place.\r
 \r
-Returns:\r
+  @param Pe32Data         The base address of the PE/COFF file that is to be loaded and relocated\r
+  @param ImageAddress     The base address of the relocated PE/COFF image\r
 \r
-  Status  - EFI_NOT_AVAILABLE_YET. PPI not available yet.\r
-          - EFI_DEVICE_ERROR.   Did not reset system.\r
+  @retval EFI_SUCCESS     The file was loaded and relocated\r
+  @retval Others          The file not be loaded and error occurred.\r
 \r
-  Otherwise, resets the system.\r
+**/\r
+EFI_STATUS\r
+LoadAndRelocatePeCoffImageInPlace (\r
+  IN  VOID  *Pe32Data,\r
+  IN  VOID  *ImageAddress\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
+  Find the PE32 Data for an FFS file.\r
 \r
-VOID \r
-PeiInitializeFv (\r
-  IN  PEI_CORE_INSTANCE           *PrivateData,\r
-  IN CONST EFI_SEC_PEI_HAND_OFF   *SecCoreData\r
-  )\r
-/*++\r
+  @param FileHandle       Pointer to the FFS file header of the image.\r
+  @param Pe32Data         Pointer to a (VOID *) PE32 Data pointer.\r
+\r
+  @retval EFI_SUCCESS      Image is successfully loaded.\r
+  @retval EFI_NOT_FOUND    Fail to locate PE32 Data.\r
 \r
-Routine Description:\r
+**/\r
+EFI_STATUS\r
+PeiGetPe32Data (\r
+  IN     EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT    VOID                 **Pe32Data\r
+  );\r
 \r
-  Initialize PeiCore Fv List.\r
+/**\r
+  The wrapper function of PeiLoadImageLoadImage().\r
 \r
-Arguments:\r
-  PrivateData     - Pointer to PEI_CORE_INSTANCE.\r
-  SecCoreData     - Pointer to EFI_SEC_PEI_HAND_OFF.\r
+  @param This                 Pointer to EFI_PEI_LOAD_FILE_PPI.\r
+  @param FileHandle           Pointer to the FFS file header of the image.\r
+  @param ImageAddressArg      Pointer to PE/TE image.\r
+  @param ImageSizeArg         Size of PE/TE image.\r
+  @param EntryPoint           Pointer to entry point of specified image file for output.\r
+  @param AuthenticationState  Pointer to attestation authentication state of image.\r
 \r
-Returns:\r
-  NONE  \r
-  \r
---*/  \r
-;\r
+  @return Status of PeiLoadImageLoadImage().\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-FirmwareVolmeInfoPpiNotifyCallback (\r
-  IN EFI_PEI_SERVICES              **PeiServices,\r
-  IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,\r
-  IN VOID                          *Ppi\r
-  )\r
-/*++\r
+PeiLoadImageLoadImageWrapper (\r
+  IN     CONST EFI_PEI_LOAD_FILE_PPI  *This,\r
+  IN     EFI_PEI_FILE_HANDLE          FileHandle,\r
+  OUT    EFI_PHYSICAL_ADDRESS         *ImageAddressArg   OPTIONAL,\r
+  OUT    UINT64                       *ImageSizeArg      OPTIONAL,\r
+  OUT    EFI_PHYSICAL_ADDRESS         *EntryPoint,\r
+  OUT    UINT32                       *AuthenticationState\r
+  );\r
 \r
-Routine Description:\r
+/**\r
 \r
-  Process Firmware Volum Information once FvInfoPPI install.\r
+  Provide a callback for when the security PPI is installed.\r
 \r
-Arguments:\r
+  @param PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param NotifyDescriptor   The descriptor for the notification event.\r
+  @param Ppi                Pointer to the PPI in question.\r
 \r
-  PeiServices - General purpose services available to every PEIM.\r
-    \r
-Returns:\r
+  @return Always success\r
 \r
-  Status -  EFI_SUCCESS if the interface could be successfully\r
-            installed\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecurityPpiNotifyCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  );\r
+\r
+/**\r
+  Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.\r
 \r
---*/\r
-;\r
+  @param PrivateData          PeiCore's private data structure\r
+  @param ParentFvCoreHandle   Pointer of EFI_CORE_FV_HANDLE to parent FV image that contain this FV image.\r
+  @param ParentFvFileHandle   File handle of a FV type file that contain this FV image.\r
 \r
+  @retval EFI_NOT_FOUND         FV image can't be found.\r
+  @retval EFI_SUCCESS           Successfully to process it.\r
+  @retval EFI_OUT_OF_RESOURCES  Can not allocate page when aligning FV image\r
+  @retval EFI_SECURITY_VIOLATION Image is illegal\r
+  @retval Others                Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r
 \r
+**/\r
 EFI_STATUS\r
-EFIAPI \r
-PeiFfsFindFileByName (\r
-  IN  CONST EFI_GUID        *FileName,\r
-  IN  EFI_PEI_FV_HANDLE     VolumeHandle,\r
-  OUT EFI_PEI_FILE_HANDLE   *FileHandle\r
-  )\r
-/*++\r
+ProcessFvFile (\r
+  IN  PEI_CORE_INSTANCE    *PrivateData,\r
+  IN  PEI_CORE_FV_HANDLE   *ParentFvCoreHandle,\r
+  IN  EFI_PEI_FILE_HANDLE  ParentFvFileHandle\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.\r
 \r
-  Given the input VolumeHandle, search for the next matching name file.\r
+  This routine also will install an instance of the FvInfo PPI for the FV HOB\r
+  as defined in the PI specification.\r
 \r
-Arguments:\r
+  @param Private    Pointer of PEI_CORE_INSTANCE\r
+  @param Instance   Index of the FV to search\r
 \r
-  FileName      - File name to search.\r
-  VolumeHandle  - The current FV to search.\r
-  FileHandle    - Pointer to the file matching name in VolumeHandle.\r
-                - NULL if file not found\r
-Returns:\r
-  EFI_STATUS\r
-  \r
---*/  \r
-;\r
+  @return Instance of PEI_CORE_FV_HANDLE.\r
+**/\r
+PEI_CORE_FV_HANDLE *\r
+FindNextCoreFvHandle (\r
+  IN PEI_CORE_INSTANCE  *Private,\r
+  IN UINTN              Instance\r
+  );\r
 \r
+//\r
+// Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
+//\r
 \r
+/**\r
+  Memory-based read services.\r
+\r
+  This function is to perform the Memory Access Read service based on installed\r
+  instance of the EFI_PEI_CPU_IO_PPI.\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return EFI_NOT_YET_AVAILABLE.\r
+\r
+  @param  PeiServices           An indirect pointer to the PEI Services Table\r
+                                published by the PEI Foundation.\r
+  @param  This                  Pointer to local data for the interface.\r
+  @param  Width                 The width of the access. Enumerated in bytes.\r
+  @param  Address               The physical address of the access.\r
+  @param  Count                 The number of accesses to perform.\r
+  @param  Buffer                A pointer to the buffer of data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
+**/\r
 EFI_STATUS\r
-EFIAPI \r
-PeiFfsGetFileInfo (\r
-  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
-  OUT EFI_FV_FILE_INFO    *FileInfo\r
-  )\r
-/*++\r
+EFIAPI\r
+PeiDefaultMemRead (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  IN  OUT VOID                  *Buffer\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  Memory-based write services.\r
+\r
+  This function is to perform the Memory Access Write service based on installed\r
+  instance of the EFI_PEI_CPU_IO_PPI.\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return EFI_NOT_YET_AVAILABLE.\r
+\r
+  @param  PeiServices           An indirect pointer to the PEI Services Table\r
+                                published by the PEI Foundation.\r
+  @param  This                  Pointer to local data for the interface.\r
+  @param  Width                 The width of the access. Enumerated in bytes.\r
+  @param  Address               The physical address of the access.\r
+  @param  Count                 The number of accesses to perform.\r
+  @param  Buffer                A pointer to the buffer of data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiDefaultMemWrite (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  IN  OUT VOID                  *Buffer\r
+  );\r
 \r
-  Collect information of given file.\r
+/**\r
+  IO-based read services.\r
+\r
+  This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return EFI_NOT_YET_AVAILABLE.\r
+\r
+  @param  PeiServices           An indirect pointer to the PEI Services Table\r
+                                published by the PEI Foundation.\r
+  @param  This                  Pointer to local data for the interface.\r
+  @param  Width                 The width of the access. Enumerated in bytes.\r
+  @param  Address               The physical address of the access.\r
+  @param  Count                 The number of accesses to perform.\r
+  @param  Buffer                A pointer to the buffer of data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiDefaultIoRead (\r
+  IN      CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN      CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN      EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN      UINT64                    Address,\r
+  IN      UINTN                     Count,\r
+  IN OUT  VOID                      *Buffer\r
+  );\r
 \r
-Arguments:\r
-  FileHandle   - The handle to file.\r
-  FileInfo     - Pointer to the file information.\r
+/**\r
+  IO-based write services.\r
+\r
+  This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return EFI_NOT_YET_AVAILABLE.\r
+\r
+  @param  PeiServices           An indirect pointer to the PEI Services Table\r
+                                published by the PEI Foundation.\r
+  @param  This                  Pointer to local data for the interface.\r
+  @param  Width                 The width of the access. Enumerated in bytes.\r
+  @param  Address               The physical address of the access.\r
+  @param  Count                 The number of accesses to perform.\r
+  @param  Buffer                A pointer to the buffer of data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiDefaultIoWrite (\r
+  IN      CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN      CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN      EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN      UINT64                    Address,\r
+  IN      UINTN                     Count,\r
+  IN OUT  VOID                      *Buffer\r
+  );\r
 \r
-Returns:\r
-  EFI_STATUS\r
-  \r
---*/    \r
-;\r
+/**\r
+  8-bit I/O read operations.\r
 \r
-EFI_STATUS\r
-EFIAPI \r
-PeiFfsGetVolumeInfo (\r
-  IN EFI_PEI_FV_HANDLE  VolumeHandle,\r
-  OUT EFI_FV_INFO       *VolumeInfo\r
-  )\r
-/*++\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
 \r
-Routine Description:\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
 \r
-  Collect information of given Fv Volume.\r
+  @return An 8-bit value returned from the I/O space.\r
+**/\r
+UINT8\r
+EFIAPI\r
+PeiDefaultIoRead8 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
 \r
-Arguments:\r
-  VolumeHandle    - The handle to Fv Volume.\r
-  VolumeInfo      - The pointer to volume information.\r
-  \r
-Returns:\r
-  EFI_STATUS\r
-  \r
---*/    \r
-;\r
+/**\r
+  Reads an 16-bit I/O port.\r
 \r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
 \r
-EFI_STATUS\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+\r
+  @return A 16-bit value returned from the I/O space.\r
+**/\r
+UINT16\r
 EFIAPI\r
-PeiRegisterForShadow (\r
-  IN EFI_PEI_FILE_HANDLE       FileHandle\r
-  )\r
-/*++\r
+PeiDefaultIoRead16 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
+\r
+/**\r
+  Reads an 32-bit I/O port.\r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+\r
+  @return A 32-bit value returned from the I/O space.\r
+**/\r
+UINT32\r
+EFIAPI\r
+PeiDefaultIoRead32 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
+\r
+/**\r
+  Reads an 64-bit I/O port.\r
 \r
-Routine Description:\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
 \r
-  This routine enable a PEIM to register itself to shadow when PEI Foundation\r
-  discovery permanent memory.\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
 \r
-Arguments:\r
-  FileHandle  - File handle of a PEIM.\r
-  \r
-Returns:\r
-  EFI_NOT_FOUND        - The file handle doesn't point to PEIM itself.\r
-  EFI_ALREADY_STARTED  - Indicate that the PEIM has been registered itself.\r
-  EFI_SUCCESS          - Successfully to register itself.\r
+  @return A 64-bit value returned from the I/O space.\r
+**/\r
+UINT64\r
+EFIAPI\r
+PeiDefaultIoRead64 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
 \r
---*/  \r
-;\r
+/**\r
+  8-bit I/O write operations.\r
 \r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDefaultIoWrite8 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT8                     Data\r
+  );\r
 \r
 /**\r
-  This routine enable a PEIM to register itself to shadow when PEI Foundation\r
-  discovery permanent memory.\r
+  16-bit I/O write operations.\r
 \r
-       @param FileHandle       File handle of a PEIM.\r
-  \r
-  @retval EFI_NOT_FOUND                                The file handle doesn't point to PEIM itself.\r
-  @retval EFI_ALREADY_STARTED          Indicate that the PEIM has been registered itself.\r
-  @retval EFI_SUCCESS                                          Successfully to register itself.\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDefaultIoWrite16 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT16                    Data\r
+  );\r
 \r
-**/  \r
-EFI_STATUS\r
+/**\r
+  32-bit I/O write operations.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
+**/\r
+VOID\r
 EFIAPI\r
-PeiRegisterForShadow (\r
-  IN EFI_PEI_FILE_HANDLE       FileHandle\r
-  )\r
-;\r
+PeiDefaultIoWrite32 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT32                    Data\r
+  );\r
+\r
+/**\r
+  64-bit I/O write operations.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDefaultIoWrite64 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT64                    Data\r
+  );\r
+\r
+/**\r
+  8-bit memory read operations.\r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+\r
+  @return An 8-bit value returned from the memory space.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+PeiDefaultMemRead8 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
+\r
+/**\r
+  16-bit memory read operations.\r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+\r
+  @return An 16-bit value returned from the memory space.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+PeiDefaultMemRead16 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
+\r
+/**\r
+  32-bit memory read operations.\r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+\r
+  @return An 32-bit value returned from the memory space.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+PeiDefaultMemRead32 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
 \r
 /**\r
-  Transfers control to a function starting with a new stack.\r
+  64-bit memory read operations.\r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
+  return 0.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+\r
+  @return An 64-bit value returned from the memory space.\r
 \r
-  Transfers control to the function specified by EntryPoint using the new stack\r
-  specified by NewStack and passing in the parameters specified by Context1 and\r
-  Context2. Context1 and Context2 are optional and may be NULL. The function\r
-  EntryPoint must never return.\r
+**/\r
+UINT64\r
+EFIAPI\r
+PeiDefaultMemRead64 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address\r
+  );\r
 \r
-  If EntryPoint is NULL, then ASSERT().\r
-  If NewStack is NULL, then ASSERT().\r
+/**\r
+  8-bit memory write operations.\r
 \r
-  @param  EntryPoint  A pointer to function to call with the new stack.\r
-  @param  Context1    A pointer to the context to pass into the EntryPoint\r
-                      function.\r
-  @param  Context2    A pointer to the context to pass into the EntryPoint\r
-                      function.\r
-  @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
-                      function.\r
-  @param  NewBsp      A pointer to the new BSP for the EntryPoint on IPF. It's\r
-                      Reserved on other architectures.\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
-PeiSwitchStacks (\r
-  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
-  IN      VOID                      *Context1,  OPTIONAL\r
-  IN      VOID                      *Context2,  OPTIONAL\r
-  IN      VOID                      *NewStack,\r
-  IN      VOID                      *NewBsp\r
+PeiDefaultMemWrite8 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT8                     Data\r
   );\r
 \r
-EFI_STATUS\r
-PeiFindFileEx (\r
-  IN  CONST EFI_PEI_FV_HANDLE        FvHandle,\r
-  IN  CONST EFI_GUID                 *FileName,   OPTIONAL\r
-  IN        EFI_FV_FILETYPE          SearchType,\r
-  IN OUT    EFI_PEI_FILE_HANDLE      *FileHandle,\r
-  IN OUT    EFI_PEI_FV_HANDLE        *AprioriFile  OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-    Given the input file pointer, search for the next matching file in the\r
-    FFS volume as defined by SearchType. The search starts from FileHeader inside\r
-    the Firmware Volume defined by FwVolHeader.\r
-\r
-Arguments:\r
-    PeiServices - Pointer to the PEI Core Services Table.\r
-    SearchType - Filter to find only files of this type.\r
-      Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
-    FwVolHeader - Pointer to the FV header of the volume to search.\r
-      This parameter must point to a valid FFS volume.\r
-    FileHeader  - Pointer to the current file from which to begin searching.\r
-      This pointer will be updated upon return to reflect the file found.\r
-    Flag        - Indicator for if this is for PEI Dispath search \r
-    \r
-Returns:\r
-    EFI_NOT_FOUND - No files matching the search criteria were found\r
-    EFI_SUCCESS\r
-\r
---*/\r
-;\r
+/**\r
+  16-bit memory write operations.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
 \r
+**/\r
 VOID\r
-InitializeImageServices (\r
-  IN  PEI_CORE_INSTANCE   *PrivateData,\r
-  IN  PEI_CORE_INSTANCE   *OldCoreData\r
-  )\r
-/*++\r
+EFIAPI\r
+PeiDefaultMemWrite16 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT16                    Data\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  32-bit memory write operations.\r
 \r
-  Install Pei Load File PPI.\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
 \r
-Arguments:\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDefaultMemWrite32 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT32                    Data\r
+  );\r
 \r
-  PrivateData    - Pointer to PEI_CORE_INSTANCE.\r
-  OldCoreData    - Pointer to PEI_CORE_INSTANCE.\r
+/**\r
+  64-bit memory write operations.\r
+\r
+  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This           Pointer to local data for the interface.\r
+  @param  Address        The physical address of the access.\r
+  @param  Data           The data to write.\r
 \r
-Returns:\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDefaultMemWrite64 (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  UINT64                    Address,\r
+  IN  UINT64                    Data\r
+  );\r
 \r
-  NONE.\r
-  \r
---*/      \r
-;\r
+extern EFI_PEI_CPU_IO_PPI  gPeiDefaultCpuIoPpi;\r
+\r
+//\r
+// Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
+//\r
 \r
 /**\r
-  Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r
+  Reads from a given location in the PCI configuration space.\r
 \r
-       @param PeiServices          Pointer to the PEI Core Services Table.\r
-       @param FileHandle               File handle of a Fv type file.\r
-  @param AuthenticationState  Pointer to attestation authentication state of image.\r
+  If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then\r
+  return EFI_NOT_YET_AVAILABLE.\r
 \r
-  \r
-  @retval EFI_NOT_FOUND                                FV image can't be found.\r
-  @retval EFI_SUCCESS                                          Successfully to process it.\r
+  @param  PeiServices     An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This            Pointer to local data for the interface.\r
+  @param  Width           The width of the access. Enumerated in bytes.\r
+                          See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
+  @param  Address         The physical address of the access. The format of\r
+                          the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
+  @param  Buffer          A pointer to the buffer of data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER The invalid access width.\r
+  @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
 \r
 **/\r
 EFI_STATUS\r
-ProcessFvFile (\r
-  IN  EFI_PEI_SERVICES      **PeiServices,\r
-  IN  EFI_PEI_FILE_HANDLE   FvFileHandle,\r
-  OUT UINT32                *AuthenticationState\r
+EFIAPI\r
+PeiDefaultPciCfg2Read (\r
+  IN CONST  EFI_PEI_SERVICES           **PeiServices,\r
+  IN CONST  EFI_PEI_PCI_CFG2_PPI       *This,\r
+  IN        EFI_PEI_PCI_CFG_PPI_WIDTH  Width,\r
+  IN        UINT64                     Address,\r
+  IN OUT    VOID                       *Buffer\r
+  );\r
+\r
+/**\r
+  Write to a given location in the PCI configuration space.\r
+\r
+  If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then\r
+  return EFI_NOT_YET_AVAILABLE.\r
+\r
+  @param  PeiServices     An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+  @param  This            Pointer to local data for the interface.\r
+  @param  Width           The width of the access. Enumerated in bytes.\r
+                          See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
+  @param  Address         The physical address of the access. The format of\r
+                          the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
+  @param  Buffer          A pointer to the buffer of data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER The invalid access width.\r
+  @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiDefaultPciCfg2Write (\r
+  IN CONST  EFI_PEI_SERVICES           **PeiServices,\r
+  IN CONST  EFI_PEI_PCI_CFG2_PPI       *This,\r
+  IN        EFI_PEI_PCI_CFG_PPI_WIDTH  Width,\r
+  IN        UINT64                     Address,\r
+  IN OUT    VOID                       *Buffer\r
+  );\r
+\r
+/**\r
+  This function performs a read-modify-write operation on the contents from a given\r
+  location in the PCI configuration space.\r
+\r
+  @param  PeiServices     An indirect pointer to the PEI Services Table\r
+                          published by the PEI Foundation.\r
+  @param  This            Pointer to local data for the interface.\r
+  @param  Width           The width of the access. Enumerated in bytes. Type\r
+                          EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
+  @param  Address         The physical address of the access.\r
+  @param  SetBits         Points to value to bitwise-OR with the read configuration value.\r
+                          The size of the value is determined by Width.\r
+  @param  ClearBits       Points to the value to negate and bitwise-AND with the read configuration value.\r
+                          The size of the value is determined by Width.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER The invalid access width.\r
+  @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiDefaultPciCfg2Modify (\r
+  IN CONST  EFI_PEI_SERVICES           **PeiServices,\r
+  IN CONST  EFI_PEI_PCI_CFG2_PPI       *This,\r
+  IN        EFI_PEI_PCI_CFG_PPI_WIDTH  Width,\r
+  IN        UINT64                     Address,\r
+  IN        VOID                       *SetBits,\r
+  IN        VOID                       *ClearBits\r
+  );\r
+\r
+extern EFI_PEI_PCI_CFG2_PPI  gPeiDefaultPciCfg2Ppi;\r
+\r
+/**\r
+  After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r
+  be re-installed with the instance in permanent memory and all cached FvPpi pointers in\r
+  PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent\r
+  memory.\r
+\r
+  @param PrivateData   Pointer to PEI_CORE_INSTANCE.\r
+**/\r
+VOID\r
+PeiReinitializeFv (\r
+  IN  PEI_CORE_INSTANCE  *PrivateData\r
   );\r
 \r
 #endif\r