X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FCore%2FPei%2FPeiMain.h;h=6d95a5d32c784b1759263cc13bbff3d9e2366c0b;hb=9bedaec05b7b8ba9aee248361bb61a85a26726cb;hp=3f61247a0f71d60670ae74488183944ecabfba4d;hpb=d39d1260c615b716675f67f5c4e1f4f52df01dad;p=mirror_edk2.git diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h index 3f61247a0f..6d95a5d32c 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -282,7 +282,7 @@ struct _PEI_CORE_INSTANCE { EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress; // // The field is define for Loading modules at fixed address feature to tracker the PEI code - // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page + // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page // available or not. // UINT64 *PeiCodeMemoryRangeUsageBitMap; @@ -394,6 +394,41 @@ PeimDispatchReadiness ( IN VOID *DependencyExpression ); +/** + Migrate a PEIM from temporary RAM to permanent memory. + + @param PeimFileHandle Pointer to the FFS file header of the image. + @param MigratedFileHandle Pointer to the FFS file header of the migrated image. + + @retval EFI_SUCCESS Sucessfully migrated the PEIM to permanent memory. + +**/ +EFI_STATUS +EFIAPI +MigratePeim ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN EFI_PEI_FILE_HANDLE MigratedFileHandle + ); + +/** + Migrate FVs out of temporary RAM before the cache is flushed. + + @param Private PeiCore's private data structure + @param SecCoreData Points to a data structure containing information about the PEI core's operating + environment, such as the size and location of temporary RAM, the stack location and + the BFV location. + + @retval EFI_SUCCESS Succesfully migrated installed FVs from temporary RAM to permanent memory. + @retval EFI_OUT_OF_RESOURCES Insufficient memory exists to allocate needed pages. + +**/ +EFI_STATUS +EFIAPI +EvacuateTempRam ( + IN PEI_CORE_INSTANCE *Private, + IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData + ); + /** Conduct PEIM dispatch. @@ -477,6 +512,50 @@ ConvertPpiPointers ( IN PEI_CORE_INSTANCE *PrivateData ); +/** + + Migrate Notify Pointers inside an FV from temporary memory to permanent memory. + + @param PrivateData Pointer to PeiCore's private data structure. + @param OrgFvHandle Address of FV Handle in temporary memory. + @param FvHandle Address of FV Handle in permanent memory. + @param FvSize Size of the FV. + +**/ +VOID +ConvertPpiPointersFv ( + IN PEI_CORE_INSTANCE *PrivateData, + IN UINTN OrgFvHandle, + IN UINTN FvHandle, + IN UINTN FvSize + ); + +/** + + Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory. + + @param PrivateData Pointer to PeiCore's private data structure. + @param CoreFvHandle Address of PEI_CORE FV Handle in temporary memory. + +**/ +VOID +ConvertPeiCorePpiPointers ( + IN PEI_CORE_INSTANCE *PrivateData, + PEI_CORE_FV_HANDLE CoreFvHandle + ); + +/** + + Dumps the PPI lists to debug output. + + @param PrivateData Points to PeiCore's private instance data. + +**/ +VOID +DumpPpiList ( + IN PEI_CORE_INSTANCE *PrivateData + ); + /** Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi. @@ -555,7 +634,7 @@ PeiLocatePpi ( @retval EFI_SUCCESS if successful @retval EFI_OUT_OF_RESOURCES if no space in the database - @retval EFI_INVALID_PARAMETER if not a good decriptor + @retval EFI_INVALID_PARAMETER if not a good descriptor **/ EFI_STATUS @@ -808,6 +887,37 @@ PeiFfsFindNextFile ( IN OUT EFI_PEI_FILE_HANDLE *FileHandle ); +/** + Go through the file to search SectionType section. + Search within encapsulation sections (compression and GUIDed) recursively, + until the match section is found. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param SectionType Filter to find only section of this type. + @param SectionInstance Pointer to the filter to find the specific instance of section. + @param Section From where to search. + @param SectionSize The file size to search. + @param OutputBuffer A pointer to the discovered section, if successful. + NULL if section not found. + @param AuthenticationStatus Updated upon return to point to the authentication status for this section. + @param IsFfs3Fv Indicates the FV format. + + @return EFI_NOT_FOUND The match section is not found. + @return EFI_SUCCESS The match section is found. + +**/ +EFI_STATUS +ProcessSection ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_SECTION_TYPE SectionType, + IN OUT UINTN *SectionInstance, + IN EFI_COMMON_SECTION_HEADER *Section, + IN UINTN SectionSize, + OUT VOID **OutputBuffer, + OUT UINT32 *AuthenticationStatus, + IN BOOLEAN IsFfs3Fv + ); + /** Searches for the next matching section within the specified file. @@ -931,6 +1041,33 @@ MigrateMemoryPages ( IN BOOLEAN TemporaryRamMigrated ); +/** + Removes any FV HOBs whose base address is not in PEI installed memory. + + @param[in] Private Pointer to PeiCore's private data structure. + +**/ +VOID +RemoveFvHobsInTemporaryMemory ( + IN PEI_CORE_INSTANCE *Private + ); + +/** + Migrate the base address in firmware volume allocation HOBs + from temporary memory to PEI installed memory. + + @param[in] PrivateData Pointer to PeiCore's private data structure. + @param[in] OrgFvHandle Address of FV Handle in temporary memory. + @param[in] FvHandle Address of FV Handle in permanent memory. + +**/ +VOID +ConvertFvHob ( + IN PEI_CORE_INSTANCE *PrivateData, + IN UINTN OrgFvHandle, + IN UINTN FvHandle + ); + /** Migrate MemoryBaseAddress in memory allocation HOBs from the temporary memory to PEI installed memory. @@ -1217,8 +1354,8 @@ PeiFfsGetVolumeInfo ( ); /** - This routine enable a PEIM to register itself to shadow when PEI Foundation - discovery permanent memory. + This routine enables a PEIM to register itself for shadow when the PEI Foundation + discovers permanent memory. @param FileHandle File handle of a PEIM. @@ -1249,6 +1386,38 @@ InitializeImageServices ( IN PEI_CORE_INSTANCE *OldCoreData ); +/** + Loads and relocates a PE/COFF image in place. + + @param Pe32Data The base address of the PE/COFF file that is to be loaded and relocated + @param ImageAddress The base address of the relocated PE/COFF image + + @retval EFI_SUCCESS The file was loaded and relocated + @retval Others The file not be loaded and error occurred. + +**/ +EFI_STATUS +LoadAndRelocatePeCoffImageInPlace ( + IN VOID *Pe32Data, + IN VOID *ImageAddress + ); + +/** + Find the PE32 Data for an FFS file. + + @param FileHandle Pointer to the FFS file header of the image. + @param Pe32Data Pointer to a (VOID *) PE32 Data pointer. + + @retval EFI_SUCCESS Image is successfully loaded. + @retval EFI_NOT_FOUND Fail to locate PE32 Data. + +**/ +EFI_STATUS +PeiGetPe32Data ( + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT VOID **Pe32Data + ); + /** The wrapper function of PeiLoadImageLoadImage(). @@ -1314,12 +1483,13 @@ ProcessFvFile ( ); /** - Get instance of PEI_CORE_FV_HANDLE for next volume according to given index. + Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index. - This routine also will install FvInfo PPI for FV HOB in PI ways. + This routine also will install an instance of the FvInfo PPI for the FV HOB + as defined in the PI specification. @param Private Pointer of PEI_CORE_INSTANCE - @param Instance The index of FV want to be searched. + @param Instance Index of the FV to search @return Instance of PEI_CORE_FV_HANDLE. **/