OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
FvOnFv2Thunk.c File Reference
#include <PiDxe.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/FirmwareVolume.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>

Go to the source code of this file.

Data Structures

struct  FIRMWARE_VOLUME_PRIVATE_DATA
 

Macros

#define FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('f', 'v', 't', 'h')
 
#define FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS(a)
 

Functions

FRAMEWORK_EFI_FV_ATTRIBUTES Fv2AttributesToFvAttributes (IN EFI_FV_ATTRIBUTES Fv2Attributes)
 
EFI_STATUS EFIAPI FvGetVolumeAttributes (IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes)
 
EFI_STATUS EFIAPI FvSetVolumeAttributes (IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes)
 
EFI_STATUS EFIAPI FvReadFile (IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN 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 FvReadSection (IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, IN OUT VOID **Buffer, IN OUT UINTN *BufferSize, OUT UINT32 *AuthenticationStatus)
 
EFI_STATUS EFIAPI FvWriteFile (IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN UINT32 NumberOfFiles, IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy, IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData)
 
EFI_STATUS EFIAPI FvGetNextFile (IN EFI_FIRMWARE_VOLUME_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)
 
VOID EFIAPI FvNotificationEvent (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI InitializeFirmwareVolume2 (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_EVENT mFvRegistration
 
FIRMWARE_VOLUME_PRIVATE_DATA gFirmwareVolumePrivateDataTemplate
 

Detailed Description

UEFI PI specification supersedes Inte's Framework Specification. EFI_FIRMWARE_VOLUME_PROTOCOL defined in Intel Framework Pkg is replaced by EFI_FIRMWARE_VOLUME2_PROTOCOL in MdePkg. This module produces FV on top of FV2. This module is used on platform when both of these two conditions are true: 1) Framework module consuming FV is present 2) And the platform only produces FV2

Copyright (c) 2006 - 2010, 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 http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name:

Definition in file FvOnFv2Thunk.c.

Macro Definition Documentation

◆ FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS

#define FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS ( a)
Value:

Definition at line 40 of file FvOnFv2Thunk.c.

◆ FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE

#define FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('f', 'v', 't', 'h')

Definition at line 32 of file FvOnFv2Thunk.c.

Function Documentation

◆ Fv2AttributesToFvAttributes()

FRAMEWORK_EFI_FV_ATTRIBUTES Fv2AttributesToFvAttributes ( IN EFI_FV_ATTRIBUTES Fv2Attributes)

Convert FV attrbiutes to FV2 attributes.

Parameters
Fv2AttributesFV2 attributes.
Returns
FV attributes.

Definition at line 51 of file FvOnFv2Thunk.c.

◆ FvGetNextFile()

EFI_STATUS EFIAPI FvGetNextFile ( IN EFI_FIRMWARE_VOLUME_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
ThisCalling context
KeyPointer to a caller allocated buffer that contains an implementation specific key that is used to track where to begin searching on successive calls.
FileTypeIndicates the file type to filter for
NameGuidGuid filename of the file found
AttributesAttributes of the file found
SizeSize in bytes of the file found
Return values
EFI_SUCCESSThe output parameters are filled with data obtained from the first matching file that was found.
EFI_NOT_FOUNDNo files of type FileType were found.
EFI_DEVICE_ERRORA hardware error occurred when attempting to access the firmware volume.
EFI_ACCESS_DENIEDThe firmware volume is configured to disallow reads.

Definition at line 345 of file FvOnFv2Thunk.c.

◆ FvGetVolumeAttributes()

EFI_STATUS EFIAPI FvGetVolumeAttributes ( IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,
OUT FRAMEWORK_EFI_FV_ATTRIBUTES * Attributes )

Retrieves attributes, insures positive polarity of attribute bits, returns resulting attributes in output parameter.

Parameters
ThisCalling context
Attributesoutput buffer which contains attributes
Return values
EFI_SUCCESSThe firmware volume attributes were returned.

Definition at line 73 of file FvOnFv2Thunk.c.

◆ FvNotificationEvent()

VOID EFIAPI FvNotificationEvent ( IN EFI_EVENT Event,
IN VOID * Context )

This notification function is invoked when an instance of the EFI_FIRMWARE_VOLUME2_PROTOCOL is produced. It installs another instance of the EFI_FIRMWARE_VOLUME_PROTOCOL on the same handle.

Parameters
EventThe event that occured
ContextContext of event. Not used in this nofication function.

Definition at line 413 of file FvOnFv2Thunk.c.

◆ FvReadFile()

EFI_STATUS EFIAPI FvReadFile ( IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,
IN 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 )

Read the requested file (NameGuid) and returns data in Buffer.

Parameters
ThisCalling context
NameGuidFilename identifying which file to read
BufferPointer to pointer to buffer in which contents of file are returned.
If Buffer is NULL, only type, attributes, and size are returned as there is no output buffer.
If Buffer != NULL and *Buffer == NULL, the output buffer is allocated from BS pool by ReadFile
If Buffer != NULL and *Buffer != NULL, the output buffer has been allocated by the caller and is being passed in.
BufferSizeIndicates the buffer size passed in, and on output the size required to complete the read
FoundTypeIndicates the type of the file who's data is returned
FileAttributesIndicates the attributes of the file who's data is resturned
AuthenticationStatusIndicates the authentication status of the data
Return values
EFI_SUCCESSThe call completed successfully
EFI_WARN_BUFFER_TOO_SMALLThe buffer is too small to contain the requested output. The buffer is filled and the output is truncated.
EFI_NOT_FOUNDNameGuid was not found in the firmware volume.
EFI_DEVICE_ERRORA hardware error occurred when attempting to access the firmware volume.
EFI_ACCESS_DENIEDThe firmware volume is configured to disallow reads.
EFI_OUT_OF_RESOURCESAn allocation failure occurred.

Definition at line 167 of file FvOnFv2Thunk.c.

◆ FvReadSection()

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

Read the requested section from the specified file and returns data in Buffer.

Parameters
ThisCalling context
NameGuidFilename identifying the file from which to read
SectionTypeIndicates what section type to retrieve
SectionInstanceIndicates which instance of SectionType to retrieve
BufferPointer to pointer to buffer in which contents of file are returned.
If Buffer is NULL, only type, attributes, and size are returned as there is no output buffer.
If Buffer != NULL and *Buffer == NULL, the output buffer is allocated from BS pool by ReadFile
If Buffer != NULL and *Buffer != NULL, the output buffer has been allocated by the caller and is being passed in.
BufferSizeIndicates the buffer size passed in, and on output the size required to complete the read
AuthenticationStatusIndicates the authentication status of the data
Return values
EFI_SUCCESSThe call completed successfully.
EFI_WARN_BUFFER_TOO_SMALLThe buffer is too small to contain the requested output. The buffer is filled and the output is truncated.
EFI_OUT_OF_RESOURCESAn allocation failure occurred.
EFI_NOT_FOUNDName was not found in the firmware volume.
EFI_DEVICE_ERRORA hardware error occurred when attempting to access the firmware volume.
EFI_ACCESS_DENIEDThe firmware volume is configured to disallow reads.

Definition at line 234 of file FvOnFv2Thunk.c.

◆ FvSetVolumeAttributes()

EFI_STATUS EFIAPI FvSetVolumeAttributes ( IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,
IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES * Attributes )

Sets volume attributes.

Parameters
ThisCalling context
AttributesBuffer which contains attributes
Return values
EFI_INVALID_PARAMETERA bit in Attributes was invalid
EFI_SUCCESSThe requested firmware volume attributes were set and the resulting EFI_FV_ATTRIBUTES is returned in Attributes.
EFI_ACCESS_DENIEDThe Device is locked and does not permit modification.

Definition at line 111 of file FvOnFv2Thunk.c.

◆ FvWriteFile()

EFI_STATUS EFIAPI FvWriteFile ( IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,
IN UINT32 NumberOfFiles,
IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,
IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA * FileData )

Write the supplied file (NameGuid) to the FV.

Parameters
ThisCalling context
NumberOfFilesIndicates the number of file records pointed to by FileData
WritePolicyIndicates the level of reliability of the write with respect to things like power failure events.
FileDataA pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each element in the array indicates a file to write, and there are NumberOfFiles elements in the input array.
Return values
EFI_SUCCESSThe write completed successfully.
EFI_OUT_OF_RESOURCESThe firmware volume does not have enough free space to store file(s).
EFI_DEVICE_ERRORA hardware error occurred when attempting to access the firmware volume.
EFI_WRITE_PROTECTEDThe firmware volume is configured to disallow writes.
EFI_NOT_FOUNDA delete was requested, but the requested file was not found in the firmware volume.
EFI_INVALID_PARAMETERA delete was requested with a multiple file write. An unsupported WritePolicy was requested. An unknown file type was specified. A file system specific error has occurred.

Definition at line 286 of file FvOnFv2Thunk.c.

◆ InitializeFirmwareVolume2()

EFI_STATUS EFIAPI InitializeFirmwareVolume2 ( IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE * SystemTable )

The user Entry Point for DXE driver. The user code starts with this function as the real entry point for the image goes into a library that calls this function.

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.
otherSome error occurs when executing this entry point.

Definition at line 507 of file FvOnFv2Thunk.c.

Variable Documentation

◆ gFirmwareVolumePrivateDataTemplate

FIRMWARE_VOLUME_PRIVATE_DATA gFirmwareVolumePrivateDataTemplate
Initial value:
= {
{
0,
NULL
},
NULL
}
EFI_STATUS EFIAPI FvWriteFile(IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN UINT32 NumberOfFiles, IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy, IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData)
EFI_STATUS EFIAPI FvGetVolumeAttributes(IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes)
EFI_STATUS EFIAPI FvReadFile(IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN 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 FvSetVolumeAttributes(IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes)
EFI_STATUS EFIAPI FvGetNextFile(IN EFI_FIRMWARE_VOLUME_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 FvReadSection(IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, IN EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, IN OUT VOID **Buffer, IN OUT UINTN *BufferSize, OUT UINT32 *AuthenticationStatus)

Definition at line 383 of file FvOnFv2Thunk.c.

◆ mFvRegistration

EFI_EVENT mFvRegistration

Definition at line 381 of file FvOnFv2Thunk.c.