]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/PeiMain.h
Use two PCDs to replace _DISABLE_UNUSED_HII_PROTOCOLS_ macro.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
index 2d1e29d9f44c8d7b443175911ceca5ca9132fed4..ca48a51fbd8698da4cd67cf50fc1e2c4342877bf 100644 (file)
@@ -1,4 +1,4 @@
-/*++\r
+/** @file\r
 \r
 Copyright (c) 2006 - 2007, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -19,14 +19,12 @@ Abstract:
 \r
 Revision History\r
 \r
---*/\r
+**/\r
 \r
 #ifndef _PEI_MAIN_H_\r
 #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
@@ -44,14 +43,16 @@ Revision History
 #include <Library/PerformanceLib.h>\r
 #include <Library/PeiServicesLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
+#include <Library/PeCoffLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/CacheMaintenanceLib.h>\r
 #include <Library/TimerLib.h>\r
-#include <Library/PeCoffLoaderLib.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/AprioriFileName.h>\r
 \r
@@ -66,23 +67,16 @@ 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
   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_LIST_POINTERS   PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];\r
 } PEI_PPI_DATABASE;\r
 \r
 \r
-#define PEI_CORE_MAX_FV_SUPPORTED   4\r
-#define PEI_CORE_MAX_PEIM_PER_FV    32\r
-\r
 //\r
 // PEI_CORE_FV_HANDE.PeimState\r
 // Do not change these values as there is code doing math to change states.\r
@@ -95,11 +89,20 @@ typedef struct {
 \r
 typedef struct {\r
   EFI_FIRMWARE_VOLUME_HEADER          *FvHeader;\r
-  UINT8                               PeimState[PEI_CORE_MAX_PEIM_PER_FV];   \r
-  EFI_PEI_FILE_HANDLE                 FvFileHandles[PEI_CORE_MAX_PEIM_PER_FV];\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
@@ -111,14 +114,14 @@ typedef struct{
   EFI_PEI_SERVICES                   *PS;     // Point to ServiceTableShadow\r
   PEI_PPI_DATABASE                   PpiData;\r
   UINTN                              FvCount;\r
-  PEI_CORE_FV_HANDLE                 Fv[PEI_CORE_MAX_FV_SUPPORTED];\r
-  EFI_PEI_FILE_HANDLE                CurrentFvFileHandles[PEI_CORE_MAX_PEIM_PER_FV];\r
+  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
-  EFI_PEI_FV_HANDLE                  AllFv[PEI_CORE_MAX_FV_SUPPORTED];\r
+  EFI_PEI_FV_HANDLE                  AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
   EFI_PEI_HOB_POINTERS               HobList;\r
   BOOLEAN                            SwitchStackSignal;\r
   BOOLEAN                            PeiMemoryInstalled;\r
@@ -129,9 +132,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
@@ -231,9 +240,6 @@ Arguments:
 \r
   DependencyExpression      - Pointer to a dependency expression.  The Grammar adheres to\r
                               the BNF described above and is stored in postfix notation.\r
-  Runnable                  - is True if the driver can be scheduled and False if the driver\r
-                              cannot be scheduled.  This is the value that the schedulers\r
-                              should use for deciding the state of the driver.\r
 \r
 Returns:\r
 \r
@@ -404,38 +410,6 @@ Returns:
 --*/\r
 ;\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
-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
-\r
-Arguments:\r
-\r
-  CoreData   - The PEI core Private Data\r
-\r
-Returns:\r
-\r
---*/\r
-;\r
-\r
-#else\r
-\r
-#define  SWITCH_TO_CACHE_MODE(CoreData)\r
-\r
-#endif\r
-\r
 //\r
 // PPI support functions\r
 //\r
@@ -464,8 +438,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
@@ -476,9 +451,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
@@ -1166,7 +1142,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
@@ -1182,9 +1158,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
@@ -1203,7 +1179,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
@@ -1214,7 +1190,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
@@ -1234,13 +1210,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
@@ -1257,12 +1233,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
@@ -1276,11 +1252,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
@@ -1298,13 +1274,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
@@ -1313,12 +1289,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
@@ -1326,38 +1302,6 @@ PeiRegisterForShadow (
   )\r
 ;\r
 \r
-/**\r
-  Transfers control to a function starting with a new stack.\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
-  If EntryPoint is NULL, then ASSERT().\r
-  If NewStack is NULL, then ASSERT().\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
-\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
-  );\r
-\r
 EFI_STATUS\r
 PeiFindFileEx (\r
   IN  CONST EFI_PEI_FV_HANDLE        FvHandle,\r
@@ -1381,8 +1325,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
@@ -1399,8 +1343,7 @@ InitializeImageServices (
 \r
 Routine Description:\r
 \r
-  Regitser PeCoffLoader to PeiCore PrivateData. And install\r
-  Pei Load File PPI.\r
+  Install Pei Load File PPI.\r
 \r
 Arguments:\r
 \r
@@ -1410,8 +1353,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