]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/PeiMain.h
Merge Temporary Ram support patch.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
index 156c6b2ed44d459ef320ffaff79928a4973d2493..319bf87711f3a20a6325ced26b6017041c4706e4 100644 (file)
@@ -25,8 +25,6 @@ Revision History
 #define _PEI_MAIN_H_\r
 \r
 #include <PiPei.h>\r
-#include <FrameworkPei.h>\r
-#include <Guid/StatusCodeDataTypeId.h>\r
 #include <Ppi/DxeIpl.h>\r
 #include <Ppi/MemoryDiscovered.h>\r
 #include <Ppi/StatusCode.h>\r
@@ -37,6 +35,7 @@ Revision History
 #include <Ppi/GuidedSectionExtraction.h>\r
 #include <Ppi/LoadFile.h>\r
 #include <Ppi/Security2.h>\r
+#include <Ppi/TemporaryRamSupport.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PeiCoreEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
@@ -53,6 +52,7 @@ Revision History
 #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/AprioriFileName.h>\r
 \r
@@ -67,8 +67,6 @@ typedef union {
   VOID                        *Raw;\r
 } PEI_PPI_LIST_POINTERS;\r
 \r
-#define PEI_STACK_SIZE 0x20000\r
-\r
 #define MAX_PPI_DESCRIPTORS 64\r
 \r
 typedef struct {\r
@@ -93,11 +91,20 @@ typedef struct {
 \r
 typedef struct {\r
   EFI_FIRMWARE_VOLUME_HEADER          *FvHeader;\r
-  UINT8                               PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];   \r
+  UINT8                               PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
   EFI_PEI_FILE_HANDLE                 FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
   BOOLEAN                             ScanFv;\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
+} CACHE_SECTION_DATA;\r
+\r
 //\r
 // Pei Core private data structure instance\r
 //\r
@@ -112,7 +119,7 @@ typedef struct{
   PEI_CORE_FV_HANDLE                 Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
   EFI_PEI_FILE_HANDLE                CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
   UINTN                              AprioriCount;\r
-  UINTN                              CurrentPeimFvCount; \r
+  UINTN                              CurrentPeimFvCount;\r
   UINTN                              CurrentPeimCount;\r
   EFI_PEI_FILE_HANDLE                CurrentFileHandle;\r
   UINTN                              AllFvCount;\r
@@ -127,9 +134,15 @@ typedef struct{
   VOID                               *CpuIo;\r
   EFI_PEI_SECURITY2_PPI              *PrivateSecurityPpi;\r
   EFI_PEI_SERVICES                   ServiceTableShadow;\r
+  UINTN                              SizeOfTemporaryMemory;\r
   UINTN                              SizeOfCacheAsRam;\r
   VOID                               *MaxTopOfCarHeap;\r
   EFI_PEI_PPI_DESCRIPTOR             *XipLoadFile;\r
+  EFI_PHYSICAL_ADDRESS               PhysicalMemoryBegin;\r
+  UINT64                             PhysicalMemoryLength;\r
+  EFI_PHYSICAL_ADDRESS               FreePhysicalMemoryTop;\r
+  VOID*                              ShadowedPeiCore;\r
+  CACHE_SECTION_DATA                 CacheSection;\r
 } PEI_CORE_INSTANCE;\r
 \r
 //\r
@@ -459,8 +472,9 @@ Returns:
 \r
 VOID\r
 ConvertPpiPointers (\r
-  IN CONST EFI_PEI_SERVICES              **PeiServices,\r
-  IN EFI_HOB_HANDOFF_INFO_TABLE    *OldHandOffHob,\r
+  IN CONST EFI_PEI_SERVICES                     **PeiServices,\r
+  IN UINTN                         OldCheckingBottom,\r
+  IN UINTN                         OldCheckingTop,\r
   IN EFI_HOB_HANDOFF_INFO_TABLE    *NewHandOffHob\r
   )\r
 /*++\r
@@ -471,9 +485,10 @@ Routine Description:
 \r
 Arguments:\r
 \r
-  PeiServices   - The PEI core services table.\r
-  OldHandOffHob - The old handoff HOB list.\r
-  NewHandOffHob - The new handoff HOB list.\r
+  PeiServices       - The PEI core services table.\r
+  OldCheckingBottom - The old checking bottom.\r
+  OldCheckingTop    - The old checking top.\r
+  NewHandOffHob     - The new handoff HOB list.\r
 \r
 Returns:\r
 \r
@@ -1161,7 +1176,7 @@ Returns:
 --*/\r
 ;\r
 \r
-VOID \r
+VOID\r
 PeiInitializeFv (\r
   IN  PEI_CORE_INSTANCE           *PrivateData,\r
   IN CONST EFI_SEC_PEI_HAND_OFF   *SecCoreData\r
@@ -1177,9 +1192,9 @@ Arguments:
   SecCoreData     - Pointer to EFI_SEC_PEI_HAND_OFF.\r
 \r
 Returns:\r
-  NONE  \r
-  \r
---*/  \r
+  NONE\r
+\r
+--*/\r
 ;\r
 \r
 EFI_STATUS\r
@@ -1198,7 +1213,7 @@ Routine Description:
 Arguments:\r
 \r
   PeiServices - General purpose services available to every PEIM.\r
-    \r
+\r
 Returns:\r
 \r
   Status -  EFI_SUCCESS if the interface could be successfully\r
@@ -1209,7 +1224,7 @@ Returns:
 \r
 \r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 PeiFfsFindFileByName (\r
   IN  CONST EFI_GUID        *FileName,\r
   IN  EFI_PEI_FV_HANDLE     VolumeHandle,\r
@@ -1229,13 +1244,13 @@ Arguments:
                 - NULL if file not found\r
 Returns:\r
   EFI_STATUS\r
-  \r
---*/  \r
+\r
+--*/\r
 ;\r
 \r
 \r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 PeiFfsGetFileInfo (\r
   IN EFI_PEI_FILE_HANDLE  FileHandle,\r
   OUT EFI_FV_FILE_INFO    *FileInfo\r
@@ -1252,12 +1267,12 @@ Arguments:
 \r
 Returns:\r
   EFI_STATUS\r
-  \r
---*/    \r
+\r
+--*/\r
 ;\r
 \r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 PeiFfsGetVolumeInfo (\r
   IN EFI_PEI_FV_HANDLE  VolumeHandle,\r
   OUT EFI_FV_INFO       *VolumeInfo\r
@@ -1271,11 +1286,11 @@ Routine Description:
 Arguments:\r
   VolumeHandle    - The handle to Fv Volume.\r
   VolumeInfo      - The pointer to volume information.\r
-  \r
+\r
 Returns:\r
   EFI_STATUS\r
-  \r
---*/    \r
+\r
+--*/\r
 ;\r
 \r
 \r
@@ -1293,13 +1308,13 @@ Routine Description:
 \r
 Arguments:\r
   FileHandle  - File handle of a PEIM.\r
-  \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
 \r
---*/  \r
+--*/\r
 ;\r
 \r
 \r
@@ -1308,12 +1323,12 @@ Returns:
   discovery permanent memory.\r
 \r
        @param FileHandle       File handle of a PEIM.\r
-  \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
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiRegisterForShadow (\r
@@ -1376,8 +1391,8 @@ Arguments:
       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
+    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
@@ -1404,8 +1419,27 @@ Arguments:
 Returns:\r
 \r
   NONE.\r
-  \r
---*/      \r
+\r
+--*/\r
 ;\r
 \r
+/**\r
+  Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\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
+\r
+\r
+  @retval EFI_NOT_FOUND                                FV image can't be found.\r
+  @retval EFI_SUCCESS                                          Successfully to process it.\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
+  );\r
+\r
 #endif\r