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
+ // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page\r
// available or not.\r
//\r
UINT64 *PeiCodeMemoryRangeUsageBitMap;\r
IN VOID *DependencyExpression\r
);\r
\r
+/**\r
+ Migrate a PEIM from temporary RAM to permanent memory.\r
+\r
+ @param PeimFileHandle Pointer to the FFS file header of the image.\r
+ @param MigratedFileHandle Pointer to the FFS file header of the migrated image.\r
+\r
+ @retval EFI_SUCCESS Sucessfully migrated the PEIM to permanent memory.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MigratePeim (\r
+ IN EFI_PEI_FILE_HANDLE FileHandle,\r
+ IN EFI_PEI_FILE_HANDLE MigratedFileHandle\r
+ );\r
+\r
+/**\r
+ Migrate FVs out of temporary RAM before the cache is flushed.\r
+\r
+ @param Private PeiCore's private data structure\r
+ @param SecCoreData Points to a data structure containing information about the PEI core's operating\r
+ environment, such as the size and location of temporary RAM, the stack location and\r
+ the BFV location.\r
+\r
+ @retval EFI_SUCCESS Succesfully migrated installed FVs from temporary RAM to permanent memory.\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient memory exists to allocate needed pages.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EvacuateTempRam (\r
+ IN PEI_CORE_INSTANCE *Private,\r
+ IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
+ );\r
+\r
/**\r
Conduct PEIM dispatch.\r
\r
IN PEI_CORE_INSTANCE *PrivateData\r
);\r
\r
+/**\r
+\r
+ Migrate Notify Pointers inside an FV from temporary memory to permanent memory.\r
+\r
+ @param PrivateData Pointer to PeiCore's private data structure.\r
+ @param OrgFvHandle Address of FV Handle in temporary memory.\r
+ @param FvHandle Address of FV Handle in permanent memory.\r
+ @param FvSize Size of the FV.\r
+\r
+**/\r
+VOID\r
+ConvertPpiPointersFv (\r
+ IN PEI_CORE_INSTANCE *PrivateData,\r
+ IN UINTN OrgFvHandle,\r
+ IN UINTN FvHandle,\r
+ IN UINTN FvSize\r
+ );\r
+\r
+/**\r
+\r
+ Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory.\r
+\r
+ @param PrivateData Pointer to PeiCore's private data structure.\r
+ @param CoreFvHandle Address of PEI_CORE FV Handle in temporary memory.\r
+\r
+**/\r
+VOID\r
+ConvertPeiCorePpiPointers (\r
+ IN PEI_CORE_INSTANCE *PrivateData,\r
+ PEI_CORE_FV_HANDLE CoreFvHandle\r
+ );\r
+\r
+/**\r
+\r
+ Dumps the PPI lists to debug output.\r
+\r
+ @param PrivateData Points to PeiCore's private instance data.\r
+\r
+**/\r
+VOID\r
+DumpPpiList (\r
+ IN PEI_CORE_INSTANCE *PrivateData\r
+ );\r
+\r
/**\r
\r
Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r
\r
@retval EFI_SUCCESS if successful\r
@retval EFI_OUT_OF_RESOURCES if no space in the database\r
- @retval EFI_INVALID_PARAMETER if not a good decriptor\r
+ @retval EFI_INVALID_PARAMETER if not a good descriptor\r
\r
**/\r
EFI_STATUS\r
IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
);\r
\r
+/**\r
+ Go through the file to search SectionType section.\r
+ Search within encapsulation sections (compression and GUIDed) recursively,\r
+ until the match section is found.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+ @param SectionType Filter to find only section of this type.\r
+ @param SectionInstance Pointer to the filter to find the specific instance of section.\r
+ @param Section From where to search.\r
+ @param SectionSize The file size to search.\r
+ @param OutputBuffer A pointer to the discovered section, if successful.\r
+ NULL if section not found.\r
+ @param AuthenticationStatus Updated upon return to point to the authentication status for this section.\r
+ @param IsFfs3Fv Indicates the FV format.\r
+\r
+ @return EFI_NOT_FOUND The match section is not found.\r
+ @return EFI_SUCCESS The match section is found.\r
+\r
+**/\r
+EFI_STATUS\r
+ProcessSection (\r
+ IN CONST EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ IN OUT UINTN *SectionInstance,\r
+ IN EFI_COMMON_SECTION_HEADER *Section,\r
+ IN UINTN SectionSize,\r
+ OUT VOID **OutputBuffer,\r
+ OUT UINT32 *AuthenticationStatus,\r
+ IN BOOLEAN IsFfs3Fv\r
+ );\r
+\r
/**\r
Searches for the next matching section within the specified file.\r
\r
IN BOOLEAN TemporaryRamMigrated\r
);\r
\r
+/**\r
+ Removes any FV HOBs whose base address is not in PEI installed memory.\r
+\r
+ @param[in] Private Pointer to PeiCore's private data structure.\r
+\r
+**/\r
+VOID\r
+RemoveFvHobsInTemporaryMemory (\r
+ IN PEI_CORE_INSTANCE *Private\r
+ );\r
+\r
+/**\r
+ Migrate the base address in firmware volume allocation HOBs\r
+ from temporary memory to PEI installed memory.\r
+\r
+ @param[in] PrivateData Pointer to PeiCore's private data structure.\r
+ @param[in] OrgFvHandle Address of FV Handle in temporary memory.\r
+ @param[in] FvHandle Address of FV Handle in permanent memory.\r
+\r
+**/\r
+VOID\r
+ConvertFvHob (\r
+ IN PEI_CORE_INSTANCE *PrivateData,\r
+ IN UINTN OrgFvHandle,\r
+ IN UINTN FvHandle\r
+ );\r
+\r
/**\r
Migrate MemoryBaseAddress in memory allocation HOBs\r
from the temporary memory to PEI installed memory.\r
);\r
\r
/**\r
- This routine enable a PEIM to register itself to shadow when PEI Foundation\r
- discovery permanent memory.\r
+ This routine enables a PEIM to register itself for shadow when the PEI Foundation\r
+ discovers permanent memory.\r
\r
@param FileHandle File handle of a PEIM.\r
\r
IN PEI_CORE_INSTANCE *OldCoreData\r
);\r
\r
+/**\r
+ Loads and relocates a PE/COFF image in place.\r
+\r
+ @param Pe32Data The base address of the PE/COFF file that is to be loaded and relocated\r
+ @param ImageAddress The base address of the relocated PE/COFF image\r
+\r
+ @retval EFI_SUCCESS The file was loaded and relocated\r
+ @retval Others The file not be loaded and error occurred.\r
+\r
+**/\r
+EFI_STATUS\r
+LoadAndRelocatePeCoffImageInPlace (\r
+ IN VOID *Pe32Data,\r
+ IN VOID *ImageAddress\r
+ );\r
+\r
+/**\r
+ Find the PE32 Data for an FFS file.\r
+\r
+ @param FileHandle Pointer to the FFS file header of the image.\r
+ @param Pe32Data Pointer to a (VOID *) PE32 Data pointer.\r
+\r
+ @retval EFI_SUCCESS Image is successfully loaded.\r
+ @retval EFI_NOT_FOUND Fail to locate PE32 Data.\r
+\r
+**/\r
+EFI_STATUS\r
+PeiGetPe32Data (\r
+ IN EFI_PEI_FILE_HANDLE FileHandle,\r
+ OUT VOID **Pe32Data\r
+ );\r
+\r
/**\r
The wrapper function of PeiLoadImageLoadImage().\r
\r
);\r
\r
/**\r
- Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.\r
+ Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.\r
\r
- This routine also will install FvInfo PPI for FV HOB in PI ways.\r
+ This routine also will install an instance of the FvInfo PPI for the FV HOB\r
+ as defined in the PI specification.\r
\r
@param Private Pointer of PEI_CORE_INSTANCE\r
- @param Instance The index of FV want to be searched.\r
+ @param Instance Index of the FV to search\r
\r
@return Instance of PEI_CORE_FV_HANDLE.\r
**/\r