X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=MdeModulePkg%2FCore%2FPei%2FPeiMain.h;h=e629b2368a40c93d7d0fdf194db9f8d37456a393;hb=2fead09fae17666cf82bcfeb38425af3adcbe646;hp=3cd642ea4f9635c30506caad28f41a39404d79e4;hpb=40f26b8f443f271f0b6d9df3c0214df4269b7485;p=mirror_edk2.git diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h index 3cd642ea4f..e629b2368a 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -1,7 +1,7 @@ /** @file Definition of Pei Core Structures and Services -Copyright (c) 2006 - 2007, Intel Corporation +Copyright (c) 2006 - 2008, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -43,10 +43,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include +/// +/// It is an FFS type extension used for PeiFindFileEx. It indicates current +/// Ffs searching is for all PEIMs can be dispatched by PeiCore. +/// #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff /// @@ -59,14 +62,33 @@ typedef union { } PEI_PPI_LIST_POINTERS; /// -/// PPI database structure +/// PPI database structure which contains two link: PpiList and NotifyList. PpiList +/// is in head of PpiListPtrs array and notify is in end of PpiListPtrs. /// typedef struct { + /// + /// index of end of PpiList link list. + /// INTN PpiListEnd; + /// + /// index of end of notify link list. + /// INTN NotifyListEnd; + /// + /// index of the dispatched notify list. + /// INTN DispatchListEnd; + /// + /// index of last installed Ppi description in PpiList link list. + /// INTN LastDispatchedInstall; + /// + /// index of last dispatched notify in Notify link list. + /// INTN LastDispatchedNotify; + /// + /// Ppi database. + /// PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)]; } PEI_PPI_DATABASE; @@ -98,7 +120,7 @@ typedef struct { } CACHE_SECTION_DATA; -#define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C') +#define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C') /// /// Pei Core private data structure instance @@ -114,6 +136,9 @@ typedef struct{ UINTN CurrentPeimFvCount; UINTN CurrentPeimCount; EFI_PEI_FILE_HANDLE CurrentFileHandle; + BOOLEAN PeimNeedingDispatch; + BOOLEAN PeimDispatchOnThisPass; + BOOLEAN PeimDispatcherReenter; UINTN AllFvCount; EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)]; EFI_PEI_HOB_POINTERS HobList; @@ -121,14 +146,9 @@ typedef struct{ BOOLEAN PeiMemoryInstalled; EFI_PHYSICAL_ADDRESS StackBase; UINT64 StackSize; - VOID *BottomOfCarHeap; - VOID *TopOfCarHeap; VOID *CpuIo; EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi; EFI_PEI_SERVICES ServiceTableShadow; - UINTN SizeOfTemporaryMemory; - UINTN SizeOfCacheAsRam; - VOID *MaxTopOfCarHeap; EFI_PEI_PPI_DESCRIPTOR *XipLoadFile; EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin; UINT64 PhysicalMemoryLength; @@ -143,9 +163,22 @@ typedef struct{ #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \ CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE) +/** + Function Pointer type for PeiCore function. + @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size + and location of temporary RAM, the stack location and the BFV location. + @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core. + An empty PPI list consists of a single descriptor with the end-tag + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization + phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such + that both the PEI Foundation and any modules can leverage the associated service + calls and/or code in these early PPIs + @param OldCoreData Pointer to old core data that is used to initialize the + core's data areas. +**/ typedef EFI_STATUS -(EFIAPI *PEI_CORE_ENTRY_POINT)( +(EFIAPI *PEICORE_FUNCTION_POINTER)( IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, IN PEI_CORE_INSTANCE *OldCoreData @@ -155,7 +188,7 @@ EFI_STATUS /// Union of temporarily used function pointers (to save stack space) /// typedef union { - PEI_CORE_ENTRY_POINT PeiCore; + PEICORE_FUNCTION_POINTER PeiCore; EFI_PEIM_ENTRY_POINT2 PeimEntry; EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry; EFI_DXE_IPL_PPI *DxeIpl; @@ -164,8 +197,6 @@ typedef union { VOID *Raw; } PEI_CORE_TEMP_POINTERS; - - typedef struct { CONST EFI_SEC_PEI_HAND_OFF *SecCoreData; EFI_PEI_PPI_DESCRIPTOR *PpiList; @@ -182,9 +213,8 @@ typedef struct { with the old core data. - @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. + @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size + and location of temporary RAM, the stack location and the BFV location. @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core. An empty PPI list consists of a single descriptor with the end-tag EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization @@ -194,17 +224,14 @@ typedef struct { @param Data Pointer to old core data that is used to initialize the core's data areas. - @retval EFI_NOT_FOUND Never reach - **/ -EFI_STATUS +VOID EFIAPI PeiCore ( IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, - IN CONST EFI_PEI_PPI_DESCRIPTOR *PpList, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, IN VOID *Data - ) -; + ); // // Dispatcher support functions @@ -220,7 +247,7 @@ PeiCore ( operation types (AND, OR). - @param PeiServices Calling context. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to the BNF described above and is stored in postfix notation. @@ -234,29 +261,20 @@ BOOLEAN PeimDispatchReadiness ( IN EFI_PEI_SERVICES **PeiServices, IN VOID *DependencyExpression - ) -; + ); /** Conduct PEIM dispatch. - @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. - PrivateData - Pointer to the private data passed in from caller - DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data. - @param Private EDES_TODO: Add parameter description - - @retval EFI_SUCCESS Successfully dispatched PEIM. - @retval EFI_NOT_FOUND The dispatch failed. + @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data + @param PrivateData Pointer to the private data passed in from caller **/ VOID PeiDispatcher ( IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *PrivateData - ) -; + ); /** Initialize the Dispatcher's data members @@ -264,9 +282,8 @@ PeiDispatcher ( @param PrivateData PeiCore's private data structure @param OldCoreData Old data from SecCore NULL if being run in non-permament memory mode. - @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. + @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size + and location of temporary RAM, the stack location and the BFV location. **/ VOID @@ -274,8 +291,7 @@ InitializeDispatcherData ( IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *OldCoreData, IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData - ) -; + ); /** This routine parses the Dependency Expression, if available, and @@ -284,10 +300,10 @@ InitializeDispatcherData ( @param Private PeiCore's private data structure @param FileHandle PEIM's file handle - @param PeimCount Peim count in all dispatched PEIMs. + @param PeimCount The index of last dispatched PEIM. - @retval TRUE Can be dispatched - @retval FALSE Cannot be dispatched + @retval TRUE Can be dispatched + @retval FALSE Cannot be dispatched **/ BOOLEAN @@ -295,8 +311,7 @@ DepexSatisfied ( IN PEI_CORE_INSTANCE *Private, IN EFI_PEI_FILE_HANDLE FileHandle, IN UINTN PeimCount - ) -; + ); // // PPI support functions @@ -314,16 +329,17 @@ VOID InitializePpiServices ( IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *OldCoreData - ) -; + ); /** Migrate the Hob list from the CAR stack to PEI installed memory. - @param PeiServices The PEI core services table. - @param OldCheckingBottom The old checking bottom. - @param OldCheckingTop The old checking top. + @param PrivateData Pointer to PeiCore's private data structure. + @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range + will be fixup for PpiData and PpiDescriptor pointer. + @param OldCheckingTop Top of temporary memory range. All Ppi in this range + will be fixup for PpiData and PpiDescriptor. @param Fixup The address difference between the new Hob list and old Hob list. @@ -334,20 +350,19 @@ ConvertPpiPointers ( IN UINTN OldCheckingBottom, IN UINTN OldCheckingTop, IN INTN Fixup - ) -; + ); /** - Install PPI services. + Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi. - @param PeiServices - Pointer to the PEI Service Table - @param PpiList - Pointer to a list of PEI PPI Descriptors. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param PpiList Pointer to ppi array that want to be installed. - @retval EFI_SUCCESS - if all PPIs in PpiList are successfully installed. - @retval EFI_INVALID_PARAMETER - if PpiList is NULL pointer - @retval EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid - @retval EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI + @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed. + @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer + if any PPI in PpiList is not valid + @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI **/ EFI_STATUS @@ -355,21 +370,20 @@ EFIAPI PeiInstallPpi ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList - ) -; + ); /** Re-Install PPI services. - @param PeiServices - Pointer to the PEI Service Table - @param OldPpi - Pointer to the old PEI PPI Descriptors. - @param NewPpi - Pointer to the new PEI PPI Descriptors. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param OldPpi Pointer to the old PEI PPI Descriptors. + @param NewPpi Pointer to the new PEI PPI Descriptors. - @retval EFI_SUCCESS - if the operation was successful - @retval EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL - @retval EFI_INVALID_PARAMETER - if NewPpi is not valid - @retval EFI_NOT_FOUND - if the PPI was not in the database + @retval EFI_SUCCESS if the operation was successful + @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL + if NewPpi is not valid + @retval EFI_NOT_FOUND if the PPI was not in the database **/ EFI_STATUS @@ -378,20 +392,19 @@ PeiReInstallPpi ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi - ) -; + ); /** Locate a given named PPI. - @param PeiServices - Pointer to the PEI Service Table - @param Guid - Pointer to GUID of the PPI. - @param Instance - Instance Number to discover. - @param PpiDescriptor - Pointer to reference the found descriptor. If not NULL, + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param Guid Pointer to GUID of the PPI. + @param Instance Instance Number to discover. + @param PpiDescriptor Pointer to reference the found descriptor. If not NULL, returns a pointer to the descriptor (includes flags, etc) - @param Ppi - Pointer to reference the found PPI + @param Ppi Pointer to reference the found PPI @retval EFI_SUCCESS if the PPI is in the database @retval EFI_NOT_FOUND if the PPI is not in the database @@ -400,21 +413,20 @@ PeiReInstallPpi ( EFI_STATUS EFIAPI PeiLocatePpi ( - IN CONST EFI_PEI_SERVICES **PeiServices, - IN CONST EFI_GUID *Guid, + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi - ) -; + ); /** Install a notification for a given PPI. - @param PeiServices - Pointer to the PEI Service Table - @param NotifyList - Pointer to list of Descriptors to notify upon. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param NotifyList Pointer to list of Descriptors to notify upon. @retval EFI_SUCCESS if successful @retval EFI_OUT_OF_RESOURCES if no space in the database @@ -426,8 +438,7 @@ EFIAPI PeiNotifyPpi ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList - ) -; + ); /** @@ -439,8 +450,7 @@ PeiNotifyPpi ( VOID ProcessNotifyList ( IN PEI_CORE_INSTANCE *PrivateData - ) -; + ); /** @@ -462,8 +472,7 @@ DispatchNotify ( IN INTN InstallStopIndex, IN INTN NotifyStartIndex, IN INTN NotifyStopIndex - ) -; + ); // // Boot mode support functions @@ -471,7 +480,7 @@ DispatchNotify ( /** This service enables PEIMs to ascertain the present value of the boot mode. - @param PeiServices The PEI core services table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param BootMode A pointer to contain the value of the boot mode. @retval EFI_SUCCESS The boot mode was returned successfully. @@ -482,18 +491,17 @@ EFI_STATUS EFIAPI PeiGetBootMode ( IN CONST EFI_PEI_SERVICES **PeiServices, - IN OUT EFI_BOOT_MODE *BootMode - ) -; + IN OUT EFI_BOOT_MODE *BootMode + ); /** This service enables PEIMs to update the boot mode variable. - @param PeiServices - The PEI core services table. - @param BootMode - The value of the boot mode to set. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param BootMode The value of the boot mode to set. - @return EFI_SUCCESS - The value was successfully updated + @return EFI_SUCCESS The value was successfully updated **/ EFI_STATUS @@ -501,8 +509,7 @@ EFIAPI PeiSetBootMode ( IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_BOOT_MODE BootMode - ) -; + ); // // Security support functions @@ -511,7 +518,7 @@ PeiSetBootMode ( Initialize the security services. - @param PeiServices The PEI core services table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param OldCoreData Pointer to the old core data. NULL if being run in non-permament memory mode. @@ -520,11 +527,10 @@ VOID InitializeSecurityServices ( IN EFI_PEI_SERVICES **PeiServices, IN PEI_CORE_INSTANCE *OldCoreData - ) -; + ); /** - Verify a Firmware volume + Verify a Firmware volume. @param CurrentFvAddress Pointer to the current Firmware Volume under consideration @@ -535,8 +541,7 @@ InitializeSecurityServices ( EFI_STATUS VerifyFv ( IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress - ) -; + ); /** @@ -556,15 +561,14 @@ VerifyPeim ( IN PEI_CORE_INSTANCE *PrivateData, IN EFI_PEI_FV_HANDLE VolumeHandle, IN EFI_PEI_FILE_HANDLE FileHandle - ) -; + ); /** Gets the pointer to the HOB List. - @param PeiServices The PEI core services table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param HobList Pointer to the HOB List. @retval EFI_SUCCESS Get the pointer of HOB List @@ -577,16 +581,15 @@ EFIAPI PeiGetHobList ( IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT VOID **HobList - ) -; + ); /** Add a new HOB to the HOB List. - @param PeiServices - The PEI core services table. - @param Type - Type of the new HOB. - @param Length - Length of the new HOB to allocate. - @param Hob - Pointer to the new HOB. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param Type Type of the new HOB. + @param Length Length of the new HOB to allocate. + @param Hob Pointer to the new HOB. @return EFI_SUCCESS Success to create hob. @retval EFI_INVALID_PARAMETER if Hob is NULL @@ -601,8 +604,7 @@ PeiCreateHob ( IN UINT16 Type, IN UINT16 Length, IN OUT VOID **Hob - ) -; + ); /** @@ -620,8 +622,7 @@ PeiCoreBuildHobHandoffInfoTable ( IN EFI_BOOT_MODE BootMode, IN EFI_PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength - ) -; + ); // @@ -633,11 +634,11 @@ PeiCoreBuildHobHandoffInfoTable ( the Firmware Volume defined by FwVolHeader. - @param PeiServices Pointer to the PEI Core Services Table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param SearchType Filter to find only files of this type. Type EFI_FV_FILETYPE_ALL causes no filtering to be done. - @param VolumeHandle Pointer to the FV header of the volume to search. - @param FileHandle Pointer to the current file from which to begin searching. + @param FwVolHeader Pointer to the FV header of the volume to search. + @param FileHeader Pointer to the current file from which to begin searching. This pointer will be updated upon return to reflect the file found. @retval EFI_NOT_FOUND No files matching the search criteria were found @retval EFI_SUCCESS Success to find next file in given volume @@ -650,17 +651,15 @@ PeiFfsFindNextFile ( IN UINT8 SearchType, IN EFI_PEI_FV_HANDLE FwVolHeader, IN OUT EFI_PEI_FILE_HANDLE *FileHeader - ) -; + ); /** Given the input file pointer, search for the next matching section in the FFS volume. - - @param PeiServices Pointer to the PEI Core Services Table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param SectionType Filter to find only sections of this type. - @param FileHandle Pointer to the current file to search. + @param FfsFileHeader Pointer to the current file to search. @param SectionData Pointer to the Section matching SectionType in FfsFileHeader. NULL if section not found @@ -675,28 +674,26 @@ PeiFfsFindSectionData ( IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FfsFileHeader, IN OUT VOID **SectionData - ) -; + ); /** search the firmware volumes by index - @param PeiServices The PEI core services table. - @param Instance Instance of FV to find - @param VolumeHandle Pointer to found Volume. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param Instance Instance of FV to find + @param FwVolHeader Pointer to found Volume. - @retval EFI_INVALID_PARAMETER FwVolHeader is NULL - @retval EFI_SUCCESS Firmware volume instance successfully found. + @retval EFI_INVALID_PARAMETER FwVolHeader is NULL + @retval EFI_SUCCESS Firmware volume instance successfully found. **/ EFI_STATUS EFIAPI PeiFvFindNextVolume ( - IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Instance, IN OUT EFI_PEI_FV_HANDLE *FwVolHeader - ) -; + ); // // Memory support functions @@ -705,11 +702,9 @@ PeiFvFindNextVolume ( Initialize the memory services. - - @param PrivateData Add parameter description - @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. + @param PrivateData PeiCore's private data structure + @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size + and location of temporary RAM, the stack location and the BFV location. @param OldCoreData Pointer to the PEI Core data. NULL if being run in non-permament memory mode. @@ -719,17 +714,16 @@ InitializeMemoryServices ( IN PEI_CORE_INSTANCE *PrivateData, IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *OldCoreData - ) -; + ); /** Install the permanent memory is now available. Creates HOB (PHIT and Stack). - @param PeiServices - The PEI core services table. - @param MemoryBegin - Start of memory address. - @param MemoryLength - Length of memory. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param MemoryBegin Start of memory address. + @param MemoryLength Length of memory. @return EFI_SUCCESS Always success. @@ -740,8 +734,7 @@ PeiInstallPeiMemory ( IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength - ) -; + ); /** @@ -749,10 +742,10 @@ PeiInstallPeiMemory ( not usable prior to the memory installation. - @param PeiServices - The PEI core services table. - @param MemoryType - Type of memory to allocate. - @param Pages - Number of pages to allocate. - @param Memory - Pointer of memory allocated. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param MemoryType Type of memory to allocate. + @param Pages Number of pages to allocate. + @param Memory Pointer of memory allocated. @retval EFI_SUCCESS The allocation was successful @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported. @@ -768,17 +761,16 @@ PeiAllocatePages ( IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory - ) -; + ); /** Memory allocation service on the CAR. - @param PeiServices - The PEI core services table. - @param Size - Amount of memory required - @param Buffer - Address of pointer to the buffer + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param Size Amount of memory required + @param Buffer Address of pointer to the buffer @retval EFI_SUCCESS The allocation was successful @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement @@ -791,44 +783,42 @@ PeiAllocatePool ( IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Size, OUT VOID **Buffer - ) -; + ); /** Routine for load image file. - @param PeiServices - The PEI core services table. - @param FileHandle - Pointer to the FFS file header of the image. - @param EntryPoint - Pointer to entry point of specified image file for output. - @param AuthenticationState - Pointer to attestation authentication state of image. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param FileHandle Pointer to the FFS file header of the image. + @param EntryPoint Pointer to entry point of specified image file for output. + @param AuthenticationState Pointer to attestation authentication state of image. - @retval EFI_SUCCESS - Image is successfully loaded. - @retval EFI_NOT_FOUND - Fail to locate necessary PPI - @retval Others - Fail to load file. + @retval EFI_SUCCESS Image is successfully loaded. + @retval EFI_NOT_FOUND Fail to locate necessary PPI + @retval Others Fail to load file. **/ EFI_STATUS PeiLoadImage ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_FILE_HANDLE FileHandle, OUT EFI_PHYSICAL_ADDRESS *EntryPoint, OUT UINT32 *AuthenticationState - ) -; + ); /** Core version of the Status Code reporter - @param PeiServices The PEI core services table. - @param CodeType Type of Status Code. - @param Value Value to output for Status Code. - @param Instance Instance Number of this status code. - @param CallerId ID of the caller of this status code. - @param Data Optional data associated with this status code. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param CodeType Type of Status Code. + @param Value Value to output for Status Code. + @param Instance Instance Number of this status code. + @param CallerId ID of the caller of this status code. + @param Data Optional data associated with this status code. @retval EFI_SUCCESS if status code is successfully reported @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed @@ -843,15 +833,14 @@ PeiReportStatusCode ( IN UINT32 Instance, IN CONST EFI_GUID *CallerId, IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL - ) -; + ); /** Core version of the Reset System - @param PeiServices - The PEI core services table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @retval EFI_NOT_AVAILABLE_YET PPI not available yet. @retval EFI_DEVICE_ERROR Did not reset system. @@ -862,8 +851,7 @@ EFI_STATUS EFIAPI PeiResetSystem ( IN CONST EFI_PEI_SERVICES **PeiServices - ) -; + ); /** @@ -873,23 +861,19 @@ PeiResetSystem ( @param PrivateData - Pointer to PEI_CORE_INSTANCE. @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF. - @return NONE - **/ VOID PeiInitializeFv ( IN PEI_CORE_INSTANCE *PrivateData, IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData - ) -; + ); /** Process Firmware Volum Information once FvInfoPPI install. - - @param PeiServices - General purpose services available to every PEIM. - @param NotifyDescriptor EDES_TODO: Add parameter description - @param Ppi EDES_TODO: Add parameter description + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param NotifyDescriptor Address of the notification descriptor data structure. + @param Ppi Address of the PPI that was installed. @retval EFI_SUCCESS if the interface could be successfully installed @@ -900,20 +884,19 @@ FirmwareVolmeInfoPpiNotifyCallback ( IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi - ) -; + ); /** Given the input VolumeHandle, search for the next matching name file. + @param FileName File name to search. + @param VolumeHandle The current FV to search. + @param FileHandle Pointer to the file matching name in VolumeHandle. + NULL if file not found - @param FileName - File name to search. - @param VolumeHandle - The current FV to search. - @param FileHandle - Pointer to the file matching name in VolumeHandle. - - NULL if file not found - - @return EFI_STATUS + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS Success to search given file **/ EFI_STATUS @@ -922,16 +905,15 @@ PeiFfsFindFileByName ( IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle - ) -; + ); /** Returns information about a specific file. - @param FileHandle - The handle to file. - @param FileInfo - Pointer to the file information. + @param FileHandle The handle to file. + @param FileInfo Pointer to the file information. @retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo. @retval EFI_SUCCESS Success to collect file info. @@ -942,15 +924,14 @@ EFIAPI PeiFfsGetFileInfo ( IN EFI_PEI_FILE_HANDLE FileHandle, OUT EFI_FV_FILE_INFO *FileInfo - ) -; + ); /** Collect information of given Fv Volume. - @param VolumeHandle - The handle to Fv Volume. - @param VolumeInfo - The pointer to volume information. + @param VolumeHandle The handle to Fv Volume. + @param VolumeInfo The pointer to volume information. @retval EFI_INVALID_PARAMETER VolumeInfo is NULL @retval EFI_SUCCESS Success to collect fv info. @@ -960,8 +941,7 @@ EFIAPI PeiFfsGetVolumeInfo ( IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo - ) -; + ); /** This routine enable a PEIM to register itself to shadow when PEI Foundation @@ -978,8 +958,7 @@ EFI_STATUS EFIAPI PeiRegisterForShadow ( IN EFI_PEI_FILE_HANDLE FileHandle - ) -; + ); /** Given the input file pointer, search for the next matching file in the @@ -1005,32 +984,31 @@ PeiFindFileEx ( IN EFI_FV_FILETYPE SearchType, IN OUT EFI_PEI_FILE_HANDLE *FileHandle, IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL - ) -; + ); /** + Initialize image service that install PeiLoadFilePpi. - Install Pei Load File PPI. - - - @param PrivateData - Pointer to PEI_CORE_INSTANCE. - @param OldCoreData - Pointer to PEI_CORE_INSTANCE. + @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE. + @param OldCoreData Pointer to Old PeiCore's private data. + If NULL, PeiCore is entered at first time, stack/heap in temporary memory. + If not NULL, PeiCore is entered at second time, stack/heap has been moved + to permenent memory. **/ VOID InitializeImageServices ( IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *OldCoreData - ) -; + ); /** Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob. - @param PeiServices Pointer to the PEI Core Services Table. - @param FileHandle File handle of a Fv type file. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param FvFileHandle File handle of a Fv type file. @param AuthenticationState Pointer to attestation authentication state of image. - + If return 0, means pass security checking. @retval EFI_NOT_FOUND FV image can't be found. @retval EFI_SUCCESS Successfully to process it. @@ -1038,9 +1016,52 @@ InitializeImageServices ( **/ EFI_STATUS ProcessFvFile ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_FILE_HANDLE FvFileHandle, - OUT UINT32 *AuthenticationState + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_FILE_HANDLE FvFileHandle, + OUT UINT32 *AuthenticationState + ); + +/** + The wrapper function of PeiLoadImageLoadImage(). + + @param This Pointer to EFI_PEI_LOAD_FILE_PPI. + @param FileHandle Pointer to the FFS file header of the image. + @param ImageAddressArg Pointer to PE/TE image. + @param ImageSizeArg Size of PE/TE image. + @param EntryPoint Pointer to entry point of specified image file for output. + @param AuthenticationState Pointer to attestation authentication state of image. + + @return Status of PeiLoadImageLoadImage(). + +**/ +EFI_STATUS +EFIAPI +PeiLoadImageLoadImageWrapper ( + IN CONST EFI_PEI_LOAD_FILE_PPI *This, + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL + OUT UINT64 *ImageSizeArg, OPTIONAL + OUT EFI_PHYSICAL_ADDRESS *EntryPoint, + OUT UINT32 *AuthenticationState + ); + +/** + + Provide a callback for when the security PPI is installed. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param NotifyDescriptor The descriptor for the notification event. + @param Ppi Pointer to the PPI in question. + + @return Always success + +**/ +EFI_STATUS +EFIAPI +SecurityPpiNotifyCallback ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi ); #endif