TianoCore EDK2 master
Loading...
Searching...
No Matches
FvLib.c File Reference

Go to the source code of this file.

Macros

#define GET_OCCUPIED_SIZE(ActualSize, Alignment)    (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
 

Functions

EFI_FFS_FILE_STATE GetFileState (IN UINT8 ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
 
UINT8 CalculateHeaderChecksum (IN EFI_FFS_FILE_HEADER *FileHeader)
 
EFI_STATUS EFIAPI FfsFindNextFile (IN EFI_FV_FILETYPE SearchType, IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, IN OUT EFI_FFS_FILE_HEADER **FileHeader)
 
EFI_STATUS EFIAPI FindFfsSectionInSections (IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
 
EFI_STATUS EFIAPI FfsFindSection (IN EFI_SECTION_TYPE SectionType, IN EFI_FFS_FILE_HEADER *FfsFileHeader, IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader)
 
EFI_STATUS EFIAPI FfsFindSectionData (IN EFI_SECTION_TYPE SectionType, IN EFI_FFS_FILE_HEADER *FfsFileHeader, IN OUT VOID **SectionData, IN OUT UINTN *SectionDataSize)
 

Detailed Description

Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file FvLib.c.

Macro Definition Documentation

◆ GET_OCCUPIED_SIZE

#define GET_OCCUPIED_SIZE (   ActualSize,
  Alignment 
)     (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))

Definition at line 16 of file FvLib.c.

Function Documentation

◆ CalculateHeaderChecksum()

UINT8 CalculateHeaderChecksum ( IN EFI_FFS_FILE_HEADER FileHeader)

Calculates the checksum of the header of a file.

Parameters
FileHeaderPointer to FFS File Header.
Returns
Checksum of the header.

Definition at line 59 of file FvLib.c.

◆ FfsFindNextFile()

EFI_STATUS EFIAPI FfsFindNextFile ( IN EFI_FV_FILETYPE  SearchType,
IN EFI_FIRMWARE_VOLUME_HEADER FwVolHeader,
IN OUT EFI_FFS_FILE_HEADER **  FileHeader 
)

Given the input file pointer, search for the next matching file in the FFS volume as defined by SearchType. The search starts from FileHeader inside the Firmware Volume defined by FwVolHeader.

Parameters
SearchTypeFilter to find only files of this type. Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
FwVolHeaderPointer to the FV header of the volume to search. This parameter must point to a valid FFS volume.
FileHeaderPointer to the current file from which to begin searching. This pointer will be updated upon return to reflect the file found.
Return values
EFI_NOT_FOUNDNo files matching the search criteria were found
EFI_SUCCESS

Definition at line 112 of file FvLib.c.

◆ FfsFindSection()

EFI_STATUS EFIAPI FfsFindSection ( IN EFI_SECTION_TYPE  SectionType,
IN EFI_FFS_FILE_HEADER FfsFileHeader,
IN OUT EFI_COMMON_SECTION_HEADER **  SectionHeader 
)

Given the input file pointer, search for the next matching section in the FFS volume.

Parameters
SearchTypeFilter to find only sections of this type.
FfsFileHeaderPointer to the current file to search.
SectionHeaderPointer to the Section matching SectionType in FfsFileHeader. NULL if section not found
Return values
EFI_NOT_FOUNDNo files matching the search criteria were found
EFI_SUCCESS

Definition at line 305 of file FvLib.c.

◆ FfsFindSectionData()

EFI_STATUS EFIAPI FfsFindSectionData ( IN EFI_SECTION_TYPE  SectionType,
IN EFI_FFS_FILE_HEADER FfsFileHeader,
IN OUT VOID **  SectionData,
IN OUT UINTN SectionDataSize 
)

Given the input file pointer, search for the next matching section in the FFS volume.

Parameters
[in]SectionTypeFilter to find only sections of this type.
[in]FfsFileHeaderPointer to the current file to search.
[in,out]SectionDataPointer to the Section matching SectionType in FfsFileHeader. NULL if section not found
[in,out]SectionDataSizeThe size of SectionData, excluding the section header.
Return values
EFI_NOT_FOUNDNo files matching the search criteria were found
EFI_SUCCESS

Definition at line 352 of file FvLib.c.

◆ FindFfsSectionInSections()

EFI_STATUS EFIAPI FindFfsSectionInSections ( IN VOID *  Sections,
IN UINTN  SizeOfSections,
IN EFI_SECTION_TYPE  SectionType,
OUT EFI_COMMON_SECTION_HEADER **  FoundSection 
)

Locates a section within a series of sections with the specified section type.

Parameters
[in]SectionsThe sections to search
[in]SizeOfSectionsTotal size of all sections
[in]SectionTypeThe section type to locate
[out]FoundSectionThe FFS section if found
Return values
EFI_SUCCESSThe file and section was found
EFI_NOT_FOUNDThe file and section was not found
EFI_VOLUME_CORRUPTEDThe firmware volume was corrupted

Definition at line 240 of file FvLib.c.

◆ GetFileState()

EFI_FFS_FILE_STATE GetFileState ( IN UINT8  ErasePolarity,
IN EFI_FFS_FILE_HEADER FfsHeader 
)

Returns the highest bit set of the State field

Parameters
ErasePolarityErase Polarity as defined by EFI_FVB_ERASE_POLARITY in the Attributes field.
FfsHeaderPointer to FFS File Header.
Returns
the highest bit in the State field

Definition at line 29 of file FvLib.c.