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

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI FmpGetImageInfo (IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN OUT UINTN *ImageInfoSize, IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, OUT UINT32 *DescriptorVersion, OUT UINT8 *DescriptorCount, OUT UINTN *DescriptorSize, OUT UINT32 *PackageVersion, OUT CHAR16 **PackageVersionName)
 
EFI_STATUS EFIAPI FmpGetImage (IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN OUT VOID *Image, IN OUT UINTN *ImageSize)
 
EFI_STATUS EFIAPI FmpCheckImage (IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN CONST VOID *Image, IN UINTN ImageSize, OUT UINT32 *ImageUpdatable)
 
EFI_STATUS EFIAPI FmpGetPackageInfo (IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, OUT UINT32 *PackageVersion, OUT CHAR16 **PackageVersionName, OUT UINT32 *PackageVersionNameMaxLen, OUT UINT64 *AttributesSupported, OUT UINT64 *AttributesSetting)
 
EFI_STATUS EFIAPI FmpSetPackageInfo (IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode, IN UINT32 PackageVersion, IN CONST CHAR16 *PackageVersionName)
 
EFI_STATUS InitializePrivateData (IN SYSTEM_FMP_PRIVATE_DATA *SystemFmpPrivate)
 

Variables

EFI_GUID gSystemFmpLastAttemptVariableGuid = SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_GUID
 
EFI_GUID gSystemFmpProtocolGuid = SYSTEM_FMP_PROTOCOL_GUID
 
EFI_FIRMWARE_MANAGEMENT_PROTOCOL mFirmwareManagementProtocol
 

Detailed Description

Produce FMP instance for system firmware.

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

Definition in file SystemFirmwareCommonDxe.c.

Function Documentation

◆ FmpCheckImage()

EFI_STATUS EFIAPI FmpCheckImage ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL This,
IN UINT8  ImageIndex,
IN CONST VOID *  Image,
IN UINTN  ImageSize,
OUT UINT32 *  ImageUpdatable 
)

Checks if the firmware image is valid for the device.

This function allows firmware update application to validate the firmware image without invoking the SetImage() first.

Parameters
[in]ThisA pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
[in]ImageIndexA unique number identifying the firmware image(s) within the device. The number is between 1 and DescriptorCount.
[in]ImagePoints to the new image.
[in]ImageSizeSize of the new image in bytes.
[out]ImageUpdatableIndicates if the new image is valid for update. It also provides, if available, additional information if the image is invalid.
Return values
EFI_SUCCESSThe image was successfully checked.
EFI_INVALID_PARAMETERThe Image was NULL.
EFI_UNSUPPORTEDThe operation is not supported.
EFI_SECURITY_VIOLATIONThe operation could not be performed due to an authentication failure.

Definition at line 203 of file SystemFirmwareCommonDxe.c.

◆ FmpGetImage()

EFI_STATUS EFIAPI FmpGetImage ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL This,
IN UINT8  ImageIndex,
IN OUT VOID *  Image,
IN OUT UINTN ImageSize 
)

Retrieves a copy of the current firmware image of the device.

This function allows a copy of the current firmware image to be created and saved. The saved copy could later been used, for example, in firmware image recovery or rollback.

Parameters
[in]ThisA pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
[in]ImageIndexA unique number identifying the firmware image(s) within the device. The number is between 1 and DescriptorCount.
[in,out]ImagePoints to the buffer where the current image is copied to.
[in,out]ImageSizeOn entry, points to the size of the buffer pointed to by Image, in bytes. On return, points to the length of the image, in bytes.
Return values
EFI_SUCCESSThe device was successfully updated with the new image.
EFI_BUFFER_TOO_SMALLThe buffer specified by ImageSize is too small to hold the image. The current buffer size needed to hold the image is returned in ImageSize.
EFI_INVALID_PARAMETERThe Image was NULL.
EFI_NOT_FOUNDThe current image is not copied to the buffer.
EFI_UNSUPPORTEDThe operation is not supported.
EFI_SECURITY_VIOLATIONThe operation could not be performed due to an authentication failure.

Definition at line 171 of file SystemFirmwareCommonDxe.c.

◆ FmpGetImageInfo()

EFI_STATUS EFIAPI FmpGetImageInfo ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL This,
IN OUT UINTN ImageInfoSize,
IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageInfo,
OUT UINT32 *  DescriptorVersion,
OUT UINT8 *  DescriptorCount,
OUT UINTN DescriptorSize,
OUT UINT32 *  PackageVersion,
OUT CHAR16 **  PackageVersionName 
)

Returns information about the current firmware image(s) of the device.

This function allows a copy of the current firmware image to be created and saved. The saved copy could later been used, for example, in firmware image recovery or rollback.

Parameters
[in]ThisA pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
[in,out]ImageInfoSizeA pointer to the size, in bytes, of the ImageInfo buffer. On input, this is the size of the buffer allocated by the caller. On output, it is the size of the buffer returned by the firmware if the buffer was large enough, or the size of the buffer needed to contain the image(s) information if the buffer was too small.
[in,out]ImageInfoA pointer to the buffer in which firmware places the current image(s) information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
[out]DescriptorVersionA pointer to the location in which firmware returns the version number associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[out]DescriptorCountA pointer to the location in which firmware returns the number of descriptors or firmware images within this device.
[out]DescriptorSizeA pointer to the location in which firmware returns the size, in bytes, of an individual EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[out]PackageVersionA version number that represents all the firmware images in the device. The format is vendor specific and new version must have a greater value than the old version. If PackageVersion is not supported, the value is 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version comparison is to be performed using PackageVersionName. A value of 0xFFFFFFFD indicates that package version update is in progress.
[out]PackageVersionNameA pointer to a pointer to a null-terminated string representing the package version name. The buffer is allocated by this function with AllocatePool(), and it is the caller's responsibility to free it with a call to FreePool().
Return values
EFI_SUCCESSThe device was successfully updated with the new image.
EFI_BUFFER_TOO_SMALLThe ImageInfo buffer was too small. The current buffer size needed to hold the image(s) information is returned in ImageInfoSize.
EFI_INVALID_PARAMETERImageInfoSize is NULL.
EFI_DEVICE_ERRORValid information could not be returned. Possible corrupted image.

Definition at line 63 of file SystemFirmwareCommonDxe.c.

◆ FmpGetPackageInfo()

EFI_STATUS EFIAPI FmpGetPackageInfo ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL This,
OUT UINT32 *  PackageVersion,
OUT CHAR16 **  PackageVersionName,
OUT UINT32 *  PackageVersionNameMaxLen,
OUT UINT64 *  AttributesSupported,
OUT UINT64 *  AttributesSetting 
)

Returns information about the firmware package.

This function returns package information.

Parameters
[in]ThisA pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
[out]PackageVersionA version number that represents all the firmware images in the device. The format is vendor specific and new version must have a greater value than the old version. If PackageVersion is not supported, the value is 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version comparison is to be performed using PackageVersionName. A value of 0xFFFFFFFD indicates that package version update is in progress.
[out]PackageVersionNameA pointer to a pointer to a null-terminated string representing the package version name. The buffer is allocated by this function with AllocatePool(), and it is the caller's responsibility to free it with a call to FreePool().
[out]PackageVersionNameMaxLenThe maximum length of package version name if device supports update of package version name. A value of 0 indicates the device does not support update of package version name. Length is the number of Unicode characters, including the terminating null character.
[out]AttributesSupportedPackage attributes that are supported by this device. See 'Package Attribute Definitions' for possible returned values of this parameter. A value of 1 indicates the attribute is supported and the current setting value is indicated in AttributesSetting. A value of 0 indicates the attribute is not supported and the current setting value in AttributesSetting is meaningless.
[out]AttributesSettingPackage attributes. See 'Package Attribute Definitions' for possible returned values of this parameter
Return values
EFI_SUCCESSThe package information was successfully returned.
EFI_UNSUPPORTEDThe operation is not supported.

Definition at line 248 of file SystemFirmwareCommonDxe.c.

◆ FmpSetPackageInfo()

EFI_STATUS EFIAPI FmpSetPackageInfo ( IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL This,
IN CONST VOID *  Image,
IN UINTN  ImageSize,
IN CONST VOID *  VendorCode,
IN UINT32  PackageVersion,
IN CONST CHAR16 *  PackageVersionName 
)

Updates information about the firmware package.

This function updates package information. This function returns EFI_UNSUPPORTED if the package information is not updatable. VendorCode enables vendor to implement vendor-specific package information update policy. Null if the caller did not specify this policy or use the default policy.

Parameters
[in]ThisA pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
[in]ImagePoints to the authentication image. Null if authentication is not required.
[in]ImageSizeSize of the authentication image in bytes. 0 if authentication is not required.
[in]VendorCodeThis enables vendor to implement vendor-specific firmware image update policy. Null indicates the caller did not specify this policy or use the default policy.
[in]PackageVersionThe new package version.
[in]PackageVersionNameA pointer to the new null-terminated Unicode string representing the package version name. The string length is equal to or less than the value returned in PackageVersionNameMaxLen.
Return values
EFI_SUCCESSThe device was successfully updated with the new package information.
EFI_INVALID_PARAMETERThe PackageVersionName length is longer than the value returned in PackageVersionNameMaxLen.
EFI_UNSUPPORTEDThe operation is not supported.
EFI_SECURITY_VIOLATIONThe operation could not be performed due to an authentication failure.

Definition at line 293 of file SystemFirmwareCommonDxe.c.

◆ InitializePrivateData()

EFI_STATUS InitializePrivateData ( IN SYSTEM_FMP_PRIVATE_DATA SystemFmpPrivate)

Initialize SystemFmpDriver private data structure.

Parameters
[in]SystemFmpPrivateprivate data structure to be initialized.
Returns
EFI_SUCCESS private data is initialized.

Definition at line 313 of file SystemFirmwareCommonDxe.c.

Variable Documentation

◆ gSystemFmpLastAttemptVariableGuid

EFI_GUID gSystemFmpLastAttemptVariableGuid = SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_GUID

Definition at line 11 of file SystemFirmwareCommonDxe.c.

◆ gSystemFmpProtocolGuid

EFI_GUID gSystemFmpProtocolGuid = SYSTEM_FMP_PROTOCOL_GUID

Definition at line 12 of file SystemFirmwareCommonDxe.c.

◆ mFirmwareManagementProtocol

EFI_FIRMWARE_MANAGEMENT_PROTOCOL mFirmwareManagementProtocol
Initial value:
= {
}
EFI_STATUS EFIAPI FmpGetImageInfo(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN OUT UINTN *ImageInfoSize, IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, OUT UINT32 *DescriptorVersion, OUT UINT8 *DescriptorCount, OUT UINTN *DescriptorSize, OUT UINT32 *PackageVersion, OUT CHAR16 **PackageVersionName)
EFI_STATUS EFIAPI FmpCheckImage(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN CONST VOID *Image, IN UINTN ImageSize, OUT UINT32 *ImageUpdatable)
EFI_STATUS EFIAPI FmpGetImage(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN OUT VOID *Image, IN OUT UINTN *ImageSize)
EFI_STATUS EFIAPI FmpGetPackageInfo(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, OUT UINT32 *PackageVersion, OUT CHAR16 **PackageVersionName, OUT UINT32 *PackageVersionNameMaxLen, OUT UINT64 *AttributesSupported, OUT UINT64 *AttributesSetting)
EFI_STATUS EFIAPI FmpSetPackageInfo(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode, IN UINT32 PackageVersion, IN CONST CHAR16 *PackageVersionName)
EFI_STATUS EFIAPI FmpSetImage(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, OUT CHAR16 **AbortReason)

Definition at line 14 of file SystemFirmwareCommonDxe.c.