]> 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 aa23cc57edae9caf6096233f78cde112c7f4682f..fbfe4f59da9935f2e03305c796b359253e28c665 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Definition of Pei Core Structures and Services\r
   \r
-Copyright (c) 2006 - 2010, 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