mirror of https://github.com/acidanthera/audk.git
OvmfPkg/Sec: Add FindFfsSectionInstance
This allow you to search for an 'instance' of a section within a series of FFS sections. For example, we will split the MAINFV into a PEI and DXE FV, and then compress those two FV's together within a FFS FV file. The DXE FV will appear as the second section of the file, and therefore we will search for it using an Instance=1 value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15150 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b6f564a763
commit
4b4b783dbe
|
@ -128,9 +128,13 @@ FindMainFv (
|
|||
Locates a section within a series of sections
|
||||
with the specified section type.
|
||||
|
||||
The Instance parameter indicates which instance of the section
|
||||
type to return. (0 is first instance, 1 is second...)
|
||||
|
||||
@param[in] Sections The sections to search
|
||||
@param[in] SizeOfSections Total size of all sections
|
||||
@param[in] SectionType The section type to locate
|
||||
@param[in] Instance The section instance number
|
||||
@param[out] FoundSection The FFS section if found
|
||||
|
||||
@retval EFI_SUCCESS The file and section was found
|
||||
|
@ -139,10 +143,11 @@ FindMainFv (
|
|||
|
||||
**/
|
||||
EFI_STATUS
|
||||
FindFfsSectionInSections (
|
||||
FindFfsSectionInstance (
|
||||
IN VOID *Sections,
|
||||
IN UINTN SizeOfSections,
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN UINTN Instance,
|
||||
OUT EFI_COMMON_SECTION_HEADER **FoundSection
|
||||
)
|
||||
{
|
||||
|
@ -182,14 +187,49 @@ FindFfsSectionInSections (
|
|||
// Look for the requested section type
|
||||
//
|
||||
if (Section->Type == SectionType) {
|
||||
*FoundSection = Section;
|
||||
return EFI_SUCCESS;
|
||||
if (Instance == 0) {
|
||||
*FoundSection = Section;
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
Instance--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
/**
|
||||
Locates a section within a series of sections
|
||||
with the specified section type.
|
||||
|
||||
@param[in] Sections The sections to search
|
||||
@param[in] SizeOfSections Total size of all sections
|
||||
@param[in] SectionType The section type to locate
|
||||
@param[out] FoundSection The FFS section if found
|
||||
|
||||
@retval EFI_SUCCESS The file and section was found
|
||||
@retval EFI_NOT_FOUND The file and section was not found
|
||||
@retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
FindFfsSectionInSections (
|
||||
IN VOID *Sections,
|
||||
IN UINTN SizeOfSections,
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
OUT EFI_COMMON_SECTION_HEADER **FoundSection
|
||||
)
|
||||
{
|
||||
return FindFfsSectionInstance (
|
||||
Sections,
|
||||
SizeOfSections,
|
||||
SectionType,
|
||||
0,
|
||||
FoundSection
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Locates a FFS file with the specified file type and a section
|
||||
within that file with the specified section type.
|
||||
|
|
Loading…
Reference in New Issue