TianoCore EDK2 master
Loading...
Searching...
No Matches
FwVolRead.c File Reference
#include "DxeMain.h"
#include "FwVolDriver.h"

Go to the source code of this file.

Functions

EFI_FV_FILE_ATTRIBUTES FfsAttributes2FvFileAttributes (IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes)
 
EFI_STATUS EFIAPI FvGetNextFile (IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, IN OUT VOID *Key, IN OUT EFI_FV_FILETYPE *FileType, OUT EFI_GUID *NameGuid, OUT EFI_FV_FILE_ATTRIBUTES *Attributes, OUT UINTN *Size)
 
EFI_STATUS EFIAPI FvReadFile (IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, IN CONST EFI_GUID *NameGuid, IN OUT VOID **Buffer, IN OUT UINTN *BufferSize, OUT EFI_FV_FILETYPE *FoundType, OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, OUT UINT32 *AuthenticationStatus)
 
EFI_STATUS EFIAPI FvReadFileSection (IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, IN OUT VOID **Buffer, IN OUT UINTN *BufferSize, OUT UINT32 *AuthenticationStatus)
 

Variables

UINT8 mFvAttributes [] = { 0, 4, 7, 9, 10, 12, 15, 16 }
 
UINT8 mFvAttributes2 [] = { 17, 18, 19, 20, 21, 22, 23, 24 }
 

Detailed Description

Implements functions to read firmware file

Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file FwVolRead.c.

Function Documentation

◆ FfsAttributes2FvFileAttributes()

EFI_FV_FILE_ATTRIBUTES FfsAttributes2FvFileAttributes ( IN EFI_FFS_FILE_ATTRIBUTES  FfsAttributes)

Convert the FFS File Attributes to FV File Attributes

Parameters
FfsAttributesThe attributes of UINT8 type.
Returns
The attributes of EFI_FV_FILE_ATTRIBUTES

Definition at line 44 of file FwVolRead.c.

◆ FvGetNextFile()

EFI_STATUS EFIAPI FvGetNextFile ( IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL This,
IN OUT VOID *  Key,
IN OUT EFI_FV_FILETYPE *  FileType,
OUT EFI_GUID NameGuid,
OUT EFI_FV_FILE_ATTRIBUTES Attributes,
OUT UINTN Size 
)

Given the input key, search for the next matching file in the volume.

Parameters
ThisIndicates the calling context.
KeyKey is a pointer to a caller allocated buffer that contains implementation specific data that is used to track where to begin the search for the next file. The size of the buffer must be at least This->KeySize bytes long. To reinitialize the search and begin from the beginning of the firmware volume, the entire buffer must be cleared to zero. Other than clearing the buffer to initiate a new search, the caller must not modify the data in the buffer between calls to GetNextFile().
FileTypeFileType is a pointer to a caller allocated EFI_FV_FILETYPE. The GetNextFile() API can filter it's search for files based on the value of *FileType input. A *FileType input of 0 causes GetNextFile() to search for files of all types. If a file is found, the file's type is returned in *FileType. FileType is not modified if no file is found.
NameGuidNameGuid is a pointer to a caller allocated EFI_GUID. If a file is found, the file's name is returned in *NameGuid. *NameGuid is not modified if no file is found.
AttributesAttributes is a pointer to a caller allocated EFI_FV_FILE_ATTRIBUTES. If a file is found, the file's attributes are returned in *Attributes. *Attributes is not modified if no file is found.
SizeSize is a pointer to a caller allocated UINTN. If a file is found, the file's size is returned in *Size. *Size is not modified if no file is found.
Return values
EFI_SUCCESSSuccessfully find the file.
EFI_DEVICE_ERRORDevice error.
EFI_ACCESS_DENIEDFv could not read.
EFI_NOT_FOUNDNo matching file found.
EFI_INVALID_PARAMETERInvalid parameter

Definition at line 115 of file FwVolRead.c.

◆ FvReadFile()

EFI_STATUS EFIAPI FvReadFile ( IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL This,
IN CONST EFI_GUID NameGuid,
IN OUT VOID **  Buffer,
IN OUT UINTN BufferSize,
OUT EFI_FV_FILETYPE *  FoundType,
OUT EFI_FV_FILE_ATTRIBUTES FileAttributes,
OUT UINT32 *  AuthenticationStatus 
)

Locates a file in the firmware volume and copies it to the supplied buffer.

Parameters
ThisIndicates the calling context.
NameGuidPointer to an EFI_GUID, which is the filename.
BufferBuffer is a pointer to pointer to a buffer in which the file or section contents or are returned.
BufferSizeBufferSize is a pointer to caller allocated UINTN. On input *BufferSize indicates the size in bytes of the memory region pointed to by Buffer. On output, *BufferSize contains the number of bytes required to read the file.
FoundTypeFoundType is a pointer to a caller allocated EFI_FV_FILETYPE that on successful return from Read() contains the type of file read. This output reflects the file type irrespective of the value of the SectionType input.
FileAttributesFileAttributes is a pointer to a caller allocated EFI_FV_FILE_ATTRIBUTES. On successful return from Read(), FileAttributes contains the attributes of the file read.
AuthenticationStatusAuthenticationStatus is a pointer to a caller allocated UINTN in which the authentication status is returned.
Return values
EFI_SUCCESSSuccessfully read to memory buffer.
EFI_WARN_BUFFER_TOO_SMALLBuffer too small.
EFI_NOT_FOUNDNot found.
EFI_DEVICE_ERRORDevice error.
EFI_ACCESS_DENIEDCould not read.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESNot enough buffer to be allocated.

Definition at line 268 of file FwVolRead.c.

◆ FvReadFileSection()

EFI_STATUS EFIAPI FvReadFileSection ( IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL This,
IN CONST EFI_GUID NameGuid,
IN EFI_SECTION_TYPE  SectionType,
IN UINTN  SectionInstance,
IN OUT VOID **  Buffer,
IN OUT UINTN BufferSize,
OUT UINT32 *  AuthenticationStatus 
)

Locates a section in a given FFS File and copies it to the supplied buffer (not including section header).

Parameters
ThisIndicates the calling context.
NameGuidPointer to an EFI_GUID, which is the filename.
SectionTypeIndicates the section type to return.
SectionInstanceIndicates which instance of sections with a type of SectionType to return.
BufferBuffer is a pointer to pointer to a buffer in which the file or section contents or are returned.
BufferSizeBufferSize is a pointer to caller allocated UINTN.
AuthenticationStatusAuthenticationStatus is a pointer to a caller allocated UINT32 in which the authentication status is returned.
Return values
EFI_SUCCESSSuccessfully read the file section into buffer.
EFI_WARN_BUFFER_TOO_SMALLBuffer too small.
EFI_NOT_FOUNDSection not found.
EFI_DEVICE_ERRORDevice error.
EFI_ACCESS_DENIEDCould not read.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 432 of file FwVolRead.c.

Variable Documentation

◆ mFvAttributes

UINT8 mFvAttributes[] = { 0, 4, 7, 9, 10, 12, 15, 16 }

Required Alignment Alignment Value in FFS FFS_ATTRIB_DATA_ALIGNMENT2 Alignment Value in (bytes) Attributes Field in FFS Attributes Field Firmware Volume Interfaces 1 0 0 0 16 1 0 4 128 2 0 7 512 3 0 9 1 KB 4 0 10 4 KB 5 0 12 32 KB 6 0 15 64 KB 7 0 16 128 KB 0 1 17 256 KB 1 1 18 512 KB 2 1 19 1 MB 3 1 20 2 MB 4 1 21 4 MB 5 1 22 8 MB 6 1 23 16 MB 7 1 24

Definition at line 32 of file FwVolRead.c.

◆ mFvAttributes2

UINT8 mFvAttributes2[] = { 17, 18, 19, 20, 21, 22, 23, 24 }

Definition at line 33 of file FwVolRead.c.