]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/PeiMain.h
Patch from open source community for CryptoPkg to allow it to build for ARM using...
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
index 705bd72e3f001042b06a87767dce83611acddaa1..fbfe4f59da9935f2e03305c796b359253e28c665 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Definition of Pei Core Structures and Services\r
   \r
-Copyright (c) 2006 - 2009, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -128,19 +128,45 @@ typedef struct {
   UINTN                               SectionIndex;\r
 } CACHE_SECTION_DATA;\r
 \r
+///\r
+/// Forward declaration for PEI_CORE_INSTANCE\r
+///\r
+typedef struct _PEI_CORE_INSTANCE  PEI_CORE_INSTANCE;\r
+\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 *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
 #define PEI_CORE_HANDLE_SIGNATURE  SIGNATURE_32('P','e','i','C')\r
 \r
 ///\r
 /// Pei Core private data structure instance\r
 ///\r
-typedef struct{\r
+struct _PEI_CORE_INSTANCE {\r
   UINTN                              Signature;\r
   \r
   ///\r
   /// Point to ServiceTableShadow\r
   ///\r
-  EFI_PEI_SERVICES                   *PS;\r
+  EFI_PEI_SERVICES                   *Ps;\r
   PEI_PPI_DATABASE                   PpiData;\r
   \r
   ///\r
@@ -166,8 +192,6 @@ typedef struct{
   EFI_PEI_HOB_POINTERS               HobList;\r
   BOOLEAN                            SwitchStackSignal;\r
   BOOLEAN                            PeiMemoryInstalled;\r
-  EFI_PHYSICAL_ADDRESS               StackBase;\r
-  UINT64                             StackSize;\r
   VOID                               *CpuIo;\r
   EFI_PEI_SECURITY2_PPI              *PrivateSecurityPpi;\r
   EFI_PEI_SERVICES                   ServiceTableShadow;\r
@@ -175,36 +199,33 @@ typedef struct{
   EFI_PHYSICAL_ADDRESS               PhysicalMemoryBegin;\r
   UINT64                             PhysicalMemoryLength;\r
   EFI_PHYSICAL_ADDRESS               FreePhysicalMemoryTop;\r
-  VOID*                              ShadowedPeiCore;\r
+  UINTN                              HeapOffset;\r
+  BOOLEAN                            HeapOffsetPositive;\r
+  PEICORE_FUNCTION_POINTER           ShadowedPeiCore;\r
   CACHE_SECTION_DATA                 CacheSection;\r
-} PEI_CORE_INSTANCE;\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
+  //\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
+  //\r
+  UINT64                            *PeiCodeMemoryRangeUsageBitMap;\r
+  //\r
+  // This field points to the shadowed image read function\r
+  //\r
+  PE_COFF_LOADER_READ_FILE          ShadowedImageRead;\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
-  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 *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
+  CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r
 \r
 ///\r
 /// Union of temporarily used function pointers (to save stack space)\r
@@ -364,6 +385,8 @@ InitializePpiServices (
                              will be fixup for PpiData and PpiDescriptor.\r
   @param Fixup               The address difference between\r
                              the new Hob list and old Hob list.\r
+  @param FixupPositive       TRUE if new Hob list is above the old Hob list.  \r
+                             Otherwise FALSE.\r
 \r
 **/\r
 VOID\r
@@ -371,7 +394,8 @@ ConvertPpiPointers (
   IN PEI_CORE_INSTANCE       *PrivateData,\r
   IN UINTN                   OldCheckingBottom,\r
   IN UINTN                   OldCheckingTop,\r
-  IN INTN                    Fixup\r
+  IN UINTN                   Fixup,\r
+  IN BOOLEAN                 FixupPositive\r
   );\r
 \r
 /**\r
@@ -656,7 +680,7 @@ PeiCoreBuildHobHandoffInfoTable (
   @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 VolumeHandle    Handle of firmware volume in which to search.\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
@@ -715,7 +739,7 @@ EFIAPI
 PeiFfsFindNextVolume (\r
   IN CONST EFI_PEI_SERVICES          **PeiServices,\r
   IN UINTN                           Instance,\r
-  IN OUT EFI_PEI_FV_HANDLE           *FwVolHeader\r
+  IN OUT EFI_PEI_FV_HANDLE           *VolumeHandle\r
   );\r
 \r
 //\r
@@ -815,6 +839,7 @@ PeiAllocatePool (
 \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
@@ -827,6 +852,7 @@ EFI_STATUS
 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
@@ -934,7 +960,7 @@ PeiFfsFindFileByName (
   Returns information about a specific file.\r
 \r
   @param FileHandle       Handle of the file.\r
-  @param FileInfo         Upon exit, points to the files information.\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
@@ -952,7 +978,7 @@ PeiFfsGetFileInfo (
   Returns information about the specified volume.\r
 \r
   @param VolumeHandle    Handle of the volume.\r
-  @param VolumeInfo      Upon exit, points to the volumes information.\r
+  @param VolumeInfo      Upon exit, points to the volume's information.\r
 \r
   @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r
   @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.\r