]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/PeiMain.h
MdeModulePkg/FaultTolerantWriteDxe: implement standalone MM version
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
index 277f54a0c6ada0d37ec4e01ee6e807aff6d89e37..322e7cd84524b9c6029cfc531ac5de8504e6e160 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Definition of Pei Core Structures and Services\r
-  \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -66,37 +66,60 @@ typedef union {
 } PEI_PPI_LIST_POINTERS;\r
 \r
 ///\r
-/// PPI database structure which contains two link: PpiList and NotifyList. PpiList\r
-/// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.\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
 typedef struct {\r
+  UINTN                 CurrentCount;\r
+  UINTN                 MaxCount;\r
+  UINTN                 LastDispatchedCount;\r
   ///\r
-  /// index of end of PpiList link list.\r
+  /// MaxCount number of entries.\r
   ///\r
-  INTN                    PpiListEnd;\r
+  PEI_PPI_LIST_POINTERS *PpiPtrs;\r
+} PEI_PPI_LIST;\r
+\r
+typedef struct {\r
+  UINTN                 CurrentCount;\r
+  UINTN                 MaxCount;\r
   ///\r
-  /// index of end of notify link list.\r
+  /// MaxCount number of entries.\r
   ///\r
-  INTN                    NotifyListEnd;\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
-  /// index of the dispatched notify list.\r
+  /// MaxCount number of entries.\r
   ///\r
-  INTN                    DispatchListEnd;\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
-  /// index of last installed Ppi description in PpiList link list.\r
+  /// PPI List.\r
   ///\r
-  INTN                    LastDispatchedInstall;\r
+  PEI_PPI_LIST              PpiList;\r
   ///\r
-  /// index of last dispatched notify in Notify link list.\r
-  /// \r
-  INTN                    LastDispatchedNotify;\r
+  /// Notify List at dispatch level.\r
   ///\r
-  /// Ppi database has the PcdPeiCoreMaxPpiSupported number of entries.\r
+  PEI_CALLBACK_NOTIFY_LIST  CallbackNotifyList;\r
   ///\r
-  PEI_PPI_LIST_POINTERS   *PpiListPtrs;\r
+  /// Notify List at callback level.\r
+  ///\r
+  PEI_DISPATCH_NOTIFY_LIST  DispatchNotifyList;\r
 } PEI_PPI_DATABASE;\r
 \r
-\r
 //\r
 // PEI_CORE_FV_HANDE.PeimState\r
 // Do not change these values as there is code doing math to change states.\r
@@ -104,19 +127,25 @@ typedef struct {
 //\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_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
   EFI_PEI_FIRMWARE_VOLUME_PPI         *FvPpi;\r
   EFI_PEI_FV_HANDLE                   FvHandle;\r
+  UINTN                               PeimCount;\r
   //\r
-  // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.\r
+  // Ponter to the buffer with the PeimCount number of Entries.\r
   //\r
   UINT8                               *PeimState;\r
   //\r
-  // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.\r
+  // Ponter to the buffer with the PeimCount number of Entries.\r
   //\r
   EFI_PEI_FILE_HANDLE                 *FvFileHandles;\r
   BOOLEAN                             ScanFv;\r
@@ -157,7 +186,7 @@ typedef struct _PEI_CORE_INSTANCE  PEI_CORE_INSTANCE;
 \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
+  @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
@@ -176,6 +205,11 @@ EFI_STATUS
   IN PEI_CORE_INSTANCE              *OldCoreData\r
   );\r
 \r
+//\r
+// Number of files to grow by each time we run out of room\r
+//\r
+#define TEMP_FILE_GROWTH_STEP 32\r
+\r
 #define PEI_CORE_HANDLE_SIGNATURE  SIGNATURE_32('P','e','i','C')\r
 \r
 ///\r
@@ -183,33 +217,39 @@ EFI_STATUS
 ///\r
 struct _PEI_CORE_INSTANCE {\r
   UINTN                              Signature;\r
-  \r
+\r
   ///\r
   /// Point to ServiceTableShadow\r
   ///\r
   EFI_PEI_SERVICES                   *Ps;\r
   PEI_PPI_DATABASE                   PpiData;\r
-  \r
+\r
   ///\r
   /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r
   ///\r
   UINTN                              FvCount;\r
-  \r
+\r
+  ///\r
+  /// The max count of FVs which contains FFS and could be dispatched by PeiCore.\r
   ///\r
-  /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.\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 PcdPeiCoreMaxFvSupported number of entries.\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
   ///\r
-  /// Pointer to the buffer with the PcdPeiCoreMaxPeimPerFv number of entries.\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
@@ -233,18 +273,22 @@ struct _PEI_CORE_INSTANCE {
   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 offet to Ps. \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 offet 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 correspoding memory page\r
-  // available or not. \r
+  // available or not.\r
   //\r
   UINT64                            *PeiCodeMemoryRangeUsageBitMap;\r
   //\r
@@ -252,18 +296,20 @@ struct _PEI_CORE_INSTANCE {
   //\r
   PE_COFF_LOADER_READ_FILE          ShadowedImageRead;\r
 \r
+  UINTN                             TempPeimCount;\r
+\r
   //\r
-  // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv + 1 number of entries.\r
+  // Pointer to the temp buffer with the TempPeimCount number of entries.\r
   //\r
-  EFI_PEI_FILE_HANDLE               *FileHandles;\r
+  EFI_PEI_FILE_HANDLE               *TempFileHandles;\r
   //\r
-  // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv number of entries.\r
+  // Pointer to the temp buffer with the TempPeimCount number of entries.\r
   //\r
-  EFI_GUID                          *FileGuid;\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 phisical memory. \r
+  // Those Memory Range will be migrated into physical memory.\r
   //\r
   HOLE_MEMORY_DATA                  HoleData[HOLE_MAX_NUMBER];\r
 };\r
@@ -303,7 +349,7 @@ typedef struct {
   with the old core data.\r
 \r
 \r
-  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size \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
@@ -411,7 +457,7 @@ DepexSatisfied (
   Initialize PPI services.\r
 \r
   @param PrivateData     Pointer to the PEI Core data.\r
-  @param OldCoreData     Pointer to old PEI Core data. \r
+  @param OldCoreData     Pointer to old PEI Core data.\r
                          NULL if being run in non-permament memory mode.\r
 \r
 **/\r
@@ -423,9 +469,9 @@ InitializePpiServices (
 \r
 /**\r
 \r
-  Migrate the Hob list from the temporary memory stack to PEI installed memory.\r
+  Migrate the Hob list from the temporary memory to PEI installed memory.\r
 \r
-  @param SecCoreData     Points to a data structure containing SEC to PEI handoff data, such as the size \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
@@ -532,13 +578,13 @@ PeiNotifyPpi (
 \r
 **/\r
 VOID\r
-ProcessNotifyList (\r
+ProcessDispatchNotifyList (\r
   IN PEI_CORE_INSTANCE  *PrivateData\r
   );\r
 \r
 /**\r
 \r
-  Dispatch notifications.\r
+  Process notifications.\r
 \r
   @param PrivateData        PeiCore's private data structure\r
   @param NotifyType         Type of notify to fire.\r
@@ -549,7 +595,7 @@ ProcessNotifyList (
 \r
 **/\r
 VOID\r
-DispatchNotify (\r
+ProcessNotify (\r
   IN PEI_CORE_INSTANCE  *PrivateData,\r
   IN UINTN               NotifyType,\r
   IN INTN                InstallStartIndex,\r
@@ -843,7 +889,7 @@ PeiFfsFindNextVolume (
   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
+  @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-permament memory mode.\r
@@ -877,30 +923,81 @@ PeiInstallPeiMemory (
   );\r
 \r
 /**\r
+  Migrate memory pages allocated in pre-memory phase.\r
+  Copy memory pages at temporary heap top to permanent heap top.\r
 \r
-  Memory allocation service on permanent memory,\r
-  not usable prior to the memory installation.\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
-  @param PeiServices               An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
-  @param MemoryType                Type of memory to allocate.\r
-  @param Pages                     Number of pages to allocate.\r
-  @param Memory                    Pointer of memory allocated.\r
+/**\r
+  Migrate MemoryBaseAddress in memory allocation HOBs\r
+  from the temporary memory to PEI installed memory.\r
 \r
-  @retval EFI_SUCCESS              The allocation was successful\r
-  @retval EFI_INVALID_PARAMETER    Only AllocateAnyAddress is supported.\r
-  @retval EFI_NOT_AVAILABLE_YET    Called with permanent memory not available\r
-  @retval EFI_OUT_OF_RESOURCES     There is not enough HOB heap to satisfy the requirement\r
-                                   to allocate the number of pages.\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
+  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
+/**\r
+  Frees memory pages.\r
+\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
 /**\r
@@ -1103,7 +1200,7 @@ PeiFfsGetFileInfo (
 \r
 **/\r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 PeiFfsGetFileInfo2 (\r
   IN EFI_PEI_FILE_HANDLE  FileHandle,\r
   OUT EFI_FV_FILE_INFO2   *FileInfo\r
@@ -1203,7 +1300,7 @@ SecurityPpiNotifyCallback (
   );\r
 \r
 /**\r
-  Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.\r
+  Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.\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
@@ -1214,7 +1311,7 @@ SecurityPpiNotifyCallback (
   @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
 **/\r
 EFI_STATUS\r
 ProcessFvFile (\r
@@ -1222,15 +1319,15 @@ ProcessFvFile (
   IN  PEI_CORE_FV_HANDLE          *ParentFvCoreHandle,\r
   IN  EFI_PEI_FILE_HANDLE         ParentFvFileHandle\r
   );\r
-  \r
+\r
 /**\r
   Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.\r
-  \r
+\r
   This routine also will install FvInfo ppi for FV hob in PI ways.\r
-  \r
+\r
   @param Private    Pointer of PEI_CORE_INSTANCE\r
   @param Instance   The index of FV want to be searched.\r
-  \r
+\r
   @return Instance of PEI_CORE_FV_HANDLE.\r
 **/\r
 PEI_CORE_FV_HANDLE *\r
@@ -1238,19 +1335,19 @@ FindNextCoreFvHandle (
   IN PEI_CORE_INSTANCE  *Private,\r
   IN UINTN              Instance\r
   );\r
-    \r
+\r
 //\r
 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
-//    \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
+\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
@@ -1260,7 +1357,7 @@ FindNextCoreFvHandle (
   @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
+  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -1272,15 +1369,15 @@ PeiDefaultMemRead (
   IN  UINTN                             Count,\r
   IN  OUT VOID                          *Buffer\r
   );\r
-  \r
+\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
+\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
@@ -1290,7 +1387,7 @@ PeiDefaultMemRead (
   @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
+  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -1302,14 +1399,14 @@ PeiDefaultMemWrite (
   IN  UINTN                             Count,\r
   IN  OUT VOID                          *Buffer\r
   );\r
-  \r
+\r
 /**\r
   IO-based read services.\r
-  \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
+  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
@@ -1331,14 +1428,14 @@ PeiDefaultIoRead (
   IN      UINTN                           Count,\r
   IN OUT  VOID                            *Buffer\r
   );\r
-  \r
+\r
 /**\r
   IO-based write services.\r
-  \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
+  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
@@ -1360,13 +1457,13 @@ PeiDefaultIoWrite (
   IN      UINTN                           Count,\r
   IN OUT  VOID                            *Buffer\r
   );\r
-  \r
+\r
 /**\r
   8-bit I/O read operations.\r
-  \r
-  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1380,13 +1477,13 @@ PeiDefaultIoRead8 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\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
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1400,13 +1497,13 @@ PeiDefaultIoRead16 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\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
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1420,13 +1517,13 @@ PeiDefaultIoRead32 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\r
-  \r
+\r
 /**\r
   Reads an 64-bit I/O port.\r
-  \r
-  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
+\r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1440,7 +1537,7 @@ PeiDefaultIoRead64 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\r
-  \r
+\r
 /**\r
   8-bit I/O write operations.\r
 \r
@@ -1457,7 +1554,7 @@ PeiDefaultIoWrite8 (
   IN  UINT64                      Address,\r
   IN  UINT8                       Data\r
   );\r
-  \r
+\r
 /**\r
   16-bit I/O write operations.\r
 \r
@@ -1474,7 +1571,7 @@ PeiDefaultIoWrite16 (
   IN  UINT64                      Address,\r
   IN  UINT16                      Data\r
   );\r
-  \r
+\r
 /**\r
   32-bit I/O write operations.\r
 \r
@@ -1491,7 +1588,7 @@ PeiDefaultIoWrite32 (
   IN  UINT64                      Address,\r
   IN  UINT32                      Data\r
   );\r
-  \r
+\r
 /**\r
   64-bit I/O write operations.\r
 \r
@@ -1508,13 +1605,13 @@ PeiDefaultIoWrite64 (
   IN  UINT64                      Address,\r
   IN  UINT64                      Data\r
   );\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
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1529,13 +1626,13 @@ PeiDefaultMemRead8 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\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
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1550,13 +1647,13 @@ PeiDefaultMemRead16 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\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
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1571,13 +1668,13 @@ PeiDefaultMemRead32 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\r
-  \r
+\r
 /**\r
   64-bit memory read operations.\r
 \r
-  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
+  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
   return 0.\r
-  \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
@@ -1592,7 +1689,7 @@ PeiDefaultMemRead64 (
   IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
   IN  UINT64                      Address\r
   );\r
-  \r
+\r
 /**\r
   8-bit memory write operations.\r
 \r
@@ -1610,7 +1707,7 @@ PeiDefaultMemWrite8 (
   IN  UINT64                        Address,\r
   IN  UINT8                         Data\r
   );\r
-  \r
+\r
 /**\r
   16-bit memory write operations.\r
 \r
@@ -1646,7 +1743,7 @@ PeiDefaultMemWrite32 (
   IN  UINT64                        Address,\r
   IN  UINT32                        Data\r
   );\r
-  \r
+\r
 /**\r
   64-bit memory write operations.\r
 \r
@@ -1664,19 +1761,19 @@ PeiDefaultMemWrite64 (
   IN  UINT64                        Address,\r
   IN  UINT64                        Data\r
   );\r
-  \r
-extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi;                                        \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
 /**\r
   Reads from 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
+  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
@@ -1688,7 +1785,7 @@ extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi;
   @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
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -1699,13 +1796,13 @@ PeiDefaultPciCfg2Read (
   IN        UINT64                    Address,\r
   IN OUT    VOID                      *Buffer\r
   );\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
+  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
@@ -1727,7 +1824,7 @@ PeiDefaultPciCfg2Write (
   IN        UINT64                    Address,\r
   IN OUT    VOID                      *Buffer\r
   );\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
@@ -1756,21 +1853,21 @@ PeiDefaultPciCfg2Modify (
   IN        UINT64                    Address,\r
   IN        VOID                      *SetBits,\r
   IN        VOID                      *ClearBits\r
-  );    \r
-  \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
+  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
+\r
   @param PrivateData   Pointer to PEI_CORE_INSTANCE.\r
-**/  \r
+**/\r
 VOID\r
 PeiReinitializeFv (\r
   IN  PEI_CORE_INSTANCE           *PrivateData\r
   );\r
-      \r
+\r
 #endif\r