\r
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
\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
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
EFI_STATUS\r
EFIAPI\r
FfsFindNextVolume (\r
- IN UINTN Instance,\r
- IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
+ IN UINTN Instance,\r
+ IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
);\r
\r
-\r
/**\r
This service enables discovery of additional firmware files.\r
\r
EFI_STATUS\r
EFIAPI\r
FfsFindNextFile (\r
- IN EFI_FV_FILETYPE SearchType,\r
- IN EFI_PEI_FV_HANDLE VolumeHandle,\r
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
+ IN EFI_FV_FILETYPE SearchType,\r
+ IN EFI_PEI_FV_HANDLE VolumeHandle,\r
+ IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
);\r
\r
+/**\r
+ * This is a hook which is used to check if the section is the target one.\r
+ *\r
+ */\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *FFS_CHECK_SECTION_HOOK)(\r
+ IN EFI_COMMON_SECTION_HEADER *Section\r
+ );\r
\r
/**\r
This service enables discovery sections of a given type within a valid FFS file.\r
+ Caller also can provide a SectionCheckHook to do additional checking.\r
\r
- @param SearchType The value of the section type to find.\r
- @param FfsFileHeader A pointer to the file header that contains the set of sections to\r
+ @param SectionType The value of the section type to find.\r
+ @param SectionCheckHook A hook which can check if the section is the target one.\r
+ @param FileHeader A pointer to the file header that contains the set of sections to\r
be searched.\r
@param SectionData A pointer to the discovered section, if successful.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
-FfsFindSectionData (\r
- IN EFI_SECTION_TYPE SectionType,\r
- IN EFI_PEI_FILE_HANDLE FileHandle,\r
- OUT VOID **SectionData\r
+FfsFindSectionDataWithHook (\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ IN FFS_CHECK_SECTION_HOOK SectionCheckHook,\r
+ IN EFI_PEI_FILE_HANDLE FileHandle,\r
+ OUT VOID **SectionData\r
);\r
\r
+/**\r
+ This service enables discovery sections of a given type within a valid FFS file.\r
+\r
+ @param SectionType The value of the section type to find.\r
+ @param FileHandle A pointer to the file header that contains the set of sections to\r
+ be searched.\r
+ @param SectionData A pointer to the discovered section, if successful.\r
+\r
+ @retval EFI_SUCCESS The section was found.\r
+ @retval EFI_NOT_FOUND The section was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FfsFindSectionData (\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ IN EFI_PEI_FILE_HANDLE FileHandle,\r
+ OUT VOID **SectionData\r
+ );\r
\r
/**\r
Find a file in the volume by name\r
- \r
+\r
@param FileName A pointer to the name of the file to\r
find within the firmware volume.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
-FfsFindByName (\r
- IN CONST EFI_GUID *FileName,\r
- IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
- OUT EFI_PEI_FILE_HANDLE *FileHandle\r
+FfsFindFileByName (\r
+ IN CONST EFI_GUID *FileName,\r
+ IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
+ OUT EFI_PEI_FILE_HANDLE *FileHandle\r
);\r
\r
-\r
/**\r
Get information about the file by name.\r
\r
information.\r
\r
@retval EFI_SUCCESS File information returned.\r
- \r
+\r
@retval EFI_INVALID_PARAMETER If FileHandle does not\r
represent a valid file.\r
- \r
+\r
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
- \r
+\r
**/\r
EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
FfsGetFileInfo (\r
- IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
- OUT EFI_FV_FILE_INFO *FileInfo\r
+ IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
+ OUT EFI_FV_FILE_INFO *FileInfo\r
);\r
\r
-\r
/**\r
Get Information about the volume by name\r
\r
information.\r
\r
@retval EFI_SUCCESS File information returned.\r
- \r
+\r
@retval EFI_INVALID_PARAMETER If FileHandle does not\r
represent a valid file.\r
- \r
+\r
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
FfsGetVolumeInfo (\r
- IN EFI_PEI_FV_HANDLE VolumeHandle,\r
- OUT EFI_FV_INFO *VolumeInfo\r
+ IN EFI_PEI_FV_HANDLE VolumeHandle,\r
+ OUT EFI_FV_INFO *VolumeInfo\r
);\r
\r
-\r
-\r
/**\r
Get Fv image from the FV type file, then add FV & FV2 Hob.\r
\r
- @param FileHandle File handle of a Fv type file.\r
-\r
+ @param FileHandle File handle of a Fv type file.\r
\r
- @retval EFI_NOT_FOUND FV image can't be found.\r
- @retval EFI_SUCCESS Successfully to process it.\r
+ @retval EFI_NOT_FOUND FV image can't be found.\r
+ @retval EFI_SUCCESS Successfully to process it.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
FfsProcessFvFile (\r
- IN EFI_PEI_FILE_HANDLE FvFileHandle\r
+ IN EFI_PEI_FILE_HANDLE FvFileHandle\r
);\r
\r
-\r
/**\r
Search through every FV until you find a file of type FileType\r
\r
- @param FileType File handle of a Fv type file.\r
- @param Volumehandle On succes Volume Handle of the match\r
- @param FileHandle On success File Handle of the match\r
- \r
- @retval EFI_NOT_FOUND FV image can't be found.\r
- @retval EFI_SUCCESS Successfully found FileType\r
+ @param FileType File handle of a Fv type file.\r
+ @param Volumehandle On success Volume Handle of the match\r
+ @param FileHandle On success File Handle of the match\r
+\r
+ @retval EFI_NOT_FOUND FV image can't be found.\r
+ @retval EFI_SUCCESS Successfully found FileType\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
FfsAnyFvFindFirstFile (\r
- IN EFI_FV_FILETYPE FileType,\r
- OUT EFI_PEI_FV_HANDLE *VolumeHandle,\r
- OUT EFI_PEI_FILE_HANDLE *FileHandle\r
+ IN EFI_FV_FILETYPE FileType,\r
+ OUT EFI_PEI_FV_HANDLE *VolumeHandle,\r
+ OUT EFI_PEI_FILE_HANDLE *FileHandle\r
);\r
\r
-\r
/**\r
Get Fv image from the FV type file, then add FV & FV2 Hob.\r
\r
- @param FileHandle File handle of a Fv type file.\r
+ @param FileHandle File handle of a Fv type file.\r
\r
\r
- @retval EFI_NOT_FOUND FV image can't be found.\r
- @retval EFI_SUCCESS Successfully to process it.\r
+ @retval EFI_NOT_FOUND FV image can't be found.\r
+ @retval EFI_SUCCESS Successfully to process it.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
FfsProcessFvFile (\r
- IN EFI_PEI_FILE_HANDLE FvFileHandle\r
+ IN EFI_PEI_FILE_HANDLE FvFileHandle\r
);\r
\r
-\r
/**\r
- This service enables PEIMs to ascertain the present value of the boot mode. \r
+ This service enables PEIMs to ascertain the present value of the boot mode.\r
\r
\r
- @retval BootMode \r
+ @retval BootMode\r
\r
**/\r
EFI_BOOT_MODE\r
VOID\r
);\r
\r
-\r
/**\r
- This service enables PEIMs to update the boot mode variable. \r
+ This service enables PEIMs to update the boot mode variable.\r
\r
@param BootMode The value of the boot mode to set.\r
\r
EFI_STATUS\r
EFIAPI\r
SetBootMode (\r
- IN EFI_BOOT_MODE BootMode\r
+ IN EFI_BOOT_MODE BootMode\r
);\r
\r
/**\r
VOID *\r
EFIAPI\r
GetHobList (\r
- VOID \r
+ VOID\r
);\r
\r
-\r
/**\r
Updates the pointer to the HOB list.\r
\r
@param HobList Hob list pointer to store\r
- \r
+\r
**/\r
EFI_STATUS\r
EFIAPI\r
SetHobList (\r
- IN VOID *HobList\r
+ IN VOID *HobList\r
);\r
\r
-EFI_HOB_HANDOFF_INFO_TABLE*\r
+EFI_HOB_HANDOFF_INFO_TABLE *\r
HobConstructor (\r
IN VOID *EfiMemoryBegin,\r
IN UINTN EfiMemoryLength,\r
IN VOID *EfiFreeMemoryTop\r
);\r
\r
-/**\r
- Retrieves the magic value from the PE/COFF header.\r
-\r
- @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r
-\r
- @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32\r
- @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+\r
-\r
-**/\r
-VOID\r
-CreateHobList (\r
- IN VOID *MemoryBegin,\r
- IN UINTN MemoryLength,\r
- IN VOID *HobBase,\r
- IN VOID *StackBase\r
- );\r
-\r
-\r
/**\r
This service enables PEIMs to create various types of HOBs.\r
\r
**/\r
VOID *\r
CreateHob (\r
- IN UINT16 HobType,\r
- IN UINT16 HobLenght\r
+ IN UINT16 HobType,\r
+ IN UINT16 HobLenght\r
);\r
\r
-\r
/**\r
Returns the next instance of a HOB type from the starting HOB.\r
\r
- This function searches the first instance of a HOB type from the starting HOB pointer. \r
+ This function searches the first instance of a HOB type from the starting HOB pointer.\r
If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
VOID *\r
EFIAPI\r
GetNextHob (\r
- IN UINT16 Type,\r
- IN CONST VOID *HobStart\r
+ IN UINT16 Type,\r
+ IN CONST VOID *HobStart\r
);\r
\r
/**\r
Returns the first instance of a HOB type among the whole HOB list.\r
\r
- This function searches the first instance of a HOB type among the whole HOB list. \r
- If there does not exist such HOB type in the HOB list, it will return NULL. \r
+ This function searches the first instance of a HOB type among the whole HOB list.\r
+ If there does not exist such HOB type in the HOB list, it will return NULL.\r
\r
@param Type The HOB type to return.\r
\r
VOID *\r
EFIAPI\r
GetFirstHob (\r
- IN UINT16 Type\r
+ IN UINT16 Type\r
);\r
\r
/**\r
- This function searches the first instance of a HOB from the starting HOB pointer. \r
- Such HOB should satisfy two conditions: \r
- its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. \r
- If there does not exist such HOB from the starting HOB pointer, it will return NULL. \r
+ This function searches the first instance of a HOB from the starting HOB pointer.\r
+ Such HOB should satisfy two conditions:\r
+ its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
+ If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
to extract the data section and its size info respectively.\r
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
VOID *\r
EFIAPI\r
GetNextGuidHob (\r
- IN CONST EFI_GUID *Guid,\r
- IN CONST VOID *HobStart\r
+ IN CONST EFI_GUID *Guid,\r
+ IN CONST VOID *HobStart\r
);\r
\r
/**\r
- This function searches the first instance of a HOB among the whole HOB list. \r
+ This function searches the first instance of a HOB among the whole HOB list.\r
Such HOB should satisfy two conditions:\r
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
VOID *\r
EFIAPI\r
GetFirstGuidHob (\r
- IN CONST EFI_GUID *Guid\r
+ IN CONST EFI_GUID *Guid\r
);\r
\r
-\r
/**\r
Builds a HOB for a loaded PE32 module.\r
\r
VOID\r
EFIAPI\r
BuildModuleHob (\r
- IN CONST EFI_GUID *ModuleName,\r
- IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
- IN UINT64 ModuleLength,\r
- IN EFI_PHYSICAL_ADDRESS EntryPoint\r
+ IN CONST EFI_GUID *ModuleName,\r
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
+ IN UINT64 ModuleLength,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint\r
);\r
\r
/**\r
/**\r
Builds a GUID HOB with a certain data length.\r
\r
- This function builds a customized HOB tagged with a GUID for identification \r
- and returns the start address of GUID HOB data so that caller can fill the customized data. \r
+ This function builds a customized HOB tagged with a GUID for identification\r
+ and returns the start address of GUID HOB data so that caller can fill the customized data.\r
The HOB Header and Name field is already stripped.\r
It can only be invoked during PEI phase;\r
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
VOID *\r
EFIAPI\r
BuildGuidHob (\r
- IN CONST EFI_GUID *Guid,\r
- IN UINTN DataLength\r
+ IN CONST EFI_GUID *Guid,\r
+ IN UINTN DataLength\r
);\r
\r
/**\r
VOID *\r
EFIAPI\r
BuildGuidDataHob (\r
- IN CONST EFI_GUID *Guid,\r
- IN VOID *Data,\r
- IN UINTN DataLength\r
+ IN CONST EFI_GUID *Guid,\r
+ IN VOID *Data,\r
+ IN UINTN DataLength\r
);\r
\r
/**\r
VOID\r
EFIAPI\r
BuildFvHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
);\r
\r
/**\r
- Builds a Firmware Volume HOB and a resrouce descriptor hob \r
+ Builds a Firmware Volume HOB and a resource descriptor hob\r
\r
This function builds a Firmware Volume HOB.\r
It can only be invoked during PEI phase;\r
**/\r
VOID\r
EFIAPI\r
-BuildFvHobs ( \r
+BuildFvHobs (\r
IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
IN UINT64 NumberOfBytes,\r
IN EFI_RESOURCE_ATTRIBUTE_TYPE *ResourceAttribute OPTIONAL\r
- ); \r
-\r
+ );\r
\r
/**\r
Builds a EFI_HOB_TYPE_FV2 HOB.\r
@param Length The size of the Firmware Volume in bytes.\r
@param FvName The name of the Firmware Volume.\r
@param FileName The name of the file.\r
- \r
+\r
**/\r
VOID\r
EFIAPI\r
BuildFv2Hob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN CONST EFI_GUID *FvName,\r
- IN CONST EFI_GUID *FileName\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN CONST EFI_GUID *FvName,\r
+ IN CONST EFI_GUID *FileName\r
);\r
\r
/**\r
VOID\r
EFIAPI\r
BuildCvHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
);\r
\r
/**\r
VOID\r
EFIAPI\r
BuildCpuHob (\r
- IN UINT8 SizeOfMemorySpace,\r
- IN UINT8 SizeOfIoSpace\r
+ IN UINT8 SizeOfMemorySpace,\r
+ IN UINT8 SizeOfIoSpace\r
);\r
\r
/**\r
VOID\r
EFIAPI\r
BuildStackHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
);\r
\r
/**\r
**/\r
VOID\r
UpdateStackHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
);\r
\r
-\r
/**\r
Builds a HOB for the BSP store.\r
\r
VOID\r
EFIAPI\r
BuildBspStoreHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN EFI_MEMORY_TYPE MemoryType\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
);\r
\r
/**\r
VOID\r
EFIAPI\r
BuildMemoryAllocationHob (\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN EFI_MEMORY_TYPE MemoryType\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
);\r
\r
-\r
VOID\r
EFIAPI\r
BuildExtractSectionHob (\r
- IN EFI_GUID *Guid,\r
- IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER SectionGetInfo,\r
- IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction\r
+ IN EFI_GUID *Guid,\r
+ IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER SectionGetInfo,\r
+ IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER SectionExtraction\r
);\r
\r
VOID\r
VOID\r
);\r
\r
-\r
/**\r
Allocates one or more 4KB pages of type EfiBootServicesData.\r
\r
@return A pointer to the allocated buffer or NULL if allocation fails.\r
\r
**/\r
-VOID * \r
+VOID *\r
EFIAPI\r
AllocatePages (\r
- IN UINTN Pages\r
+ IN UINTN Pages\r
);\r
- \r
+\r
+/**\r
+ Allocates one or more 4KB pages of type EfiRuntimeServicesData.\r
+\r
+ Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r
+ allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r
+ is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r
+ returned.\r
+\r
+ @param Pages The number of 4 KB pages to allocate.\r
+\r
+ @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+AllocateRuntimePages (\r
+ IN UINTN Pages\r
+ );\r
+\r
/**\r
Allocates a buffer of type EfiBootServicesData.\r
\r
AllocatePool (\r
IN UINTN AllocationSize\r
);\r
- \r
- \r
+\r
/**\r
Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.\r
\r
IN UINTN Alignment\r
);\r
\r
-\r
EFI_STATUS\r
EFIAPI\r
LoadPeCoffImage (\r
- IN VOID *PeCoffImage,\r
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,\r
- OUT UINT64 *ImageSize,\r
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint\r
+ IN VOID *PeCoffImage,\r
+ OUT EFI_PHYSICAL_ADDRESS *ImageAddress,\r
+ OUT UINT64 *ImageSize,\r
+ OUT EFI_PHYSICAL_ADDRESS *EntryPoint\r
);\r
\r
EFI_STATUS\r
EFI_STATUS\r
EFIAPI\r
LoadDxeCoreFromFv (\r
- IN UINTN *FvInstance, OPTIONAL\r
+ IN UINTN *FvInstance OPTIONAL,\r
IN UINTN StackSize\r
);\r
\r
VOID\r
);\r
\r
-VOID\r
-EFIAPI\r
-AddDxeCoreReportStatusCodeCallback (\r
- VOID\r
- );\r
-\r
-\r
#endif\r