TianoCore EDK2 master
|
#include "SystemFirmwareDxe.h"
Go to the source code of this file.
Functions | |
EFI_STATUS | ParseUpdateDataFile (IN UINT8 *DataBuffer, IN UINTN BufferSize, IN OUT CONFIG_HEADER *ConfigHeader, IN OUT UPDATE_CONFIG_DATA **UpdateArray) |
EFI_STATUS | PerformUpdate (IN VOID *SystemFirmwareImage, IN UINTN SystemFirmwareImageSize, IN UPDATE_CONFIG_DATA *ConfigData, OUT UINT32 *LastAttemptVersion, OUT UINT32 *LastAttemptStatus, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, IN UINTN StartPercentage, IN UINTN EndPercentage) |
EFI_STATUS | UpdateImage (IN VOID *SystemFirmwareImage, IN UINTN SystemFirmwareImageSize, IN VOID *ConfigImage, IN UINTN ConfigImageSize, OUT UINT32 *LastAttemptVersion, OUT UINT32 *LastAttemptStatus, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress) |
EFI_STATUS | SystemFirmwareAuthenticatedUpdate (IN VOID *Image, IN UINTN ImageSize, OUT UINT32 *LastAttemptVersion, OUT UINT32 *LastAttemptStatus, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress) |
EFI_STATUS EFIAPI | GetVariableHook (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data) |
EFI_STATUS EFIAPI | GetNextVariableNameHook (IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VendorGuid) |
EFI_STATUS EFIAPI | SetVariableHook (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data) |
EFI_STATUS EFIAPI | QueryVariableInfoHook (IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize) |
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) |
EFI_FIRMWARE_IMAGE_DESCRIPTOR * | GetFmpImageDescriptors (IN EFI_HANDLE Handle, IN EFI_GUID *ProtocolGuid, OUT UINT8 *FmpImageInfoCount, OUT UINTN *DescriptorSize) |
EFI_HANDLE * | FindMatchingFmpHandles (IN EFI_GUID *ProtocolGuid, OUT UINTN *HandleCount) |
EFI_STATUS | UninstallMatchingSystemFmpProtocols (VOID) |
EFI_STATUS EFIAPI | SystemFirmwareUpdateMainDxe (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
Variables | |
SYSTEM_FMP_PRIVATE_DATA * | mSystemFmpPrivate = NULL |
EFI_GUID | mCurrentImageTypeId |
BOOLEAN | mNvRamUpdated = FALSE |
SetImage instance to update system firmware.
Caution: This module requires additional review when modified. This module will have external input - capsule image. This external input must be validated carefully to avoid security issue like buffer overflow, integer overflow.
FmpSetImage() will receive untrusted input and do basic validation.
Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SystemFirmwareUpdateDxe.c.
EFI_HANDLE * FindMatchingFmpHandles | ( | IN EFI_GUID * | ProtocolGuid, |
OUT UINTN * | HandleCount | ||
) |
Search for handles with an FMP protocol whose EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageTypeId matches the ImageTypeId produced by this module.
[in] | ProtocolGuid | Pointer to the GUID of the protocol to search. |
[out] | HandleCount | Pointer to the number of returned handles. |
Definition at line 650 of file SystemFirmwareUpdateDxe.c.
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 | ||
) |
Updates the firmware image of the device.
This function updates the hardware with the new firmware image. This function returns EFI_UNSUPPORTED if the firmware image is not updatable. If the firmware image is updatable, the function should perform the following minimal validations before proceeding to do the firmware image update.
VendorCode enables vendor to implement vendor-specific firmware image update policy. Null if the caller did not specify the policy or use the default policy. As an example, vendor can implement a policy to allow an option to force a firmware image update when the abort reason is due to the new firmware image version is older than the current firmware image version or bad image checksum. Sensitive operations such as those wiping the entire firmware image and render the device to be non-functional should be encoded in the image itself rather than passed with the VendorCode. AbortReason enables vendor to have the option to provide a more detailed description of the abort reason to the caller.
[in] | This | A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance. |
[in] | ImageIndex | A unique number identifying the firmware image(s) within the device. The number is between 1 and DescriptorCount. |
[in] | Image | Points to the new image. |
[in] | ImageSize | Size of the new image in bytes. |
[in] | VendorCode | This enables vendor to implement vendor-specific firmware image update policy. Null indicates the caller did not specify the policy or use the default policy. |
[in] | Progress | A function used by the driver to report the progress of the firmware update. |
[out] | AbortReason | A pointer to a pointer to a null-terminated string providing more details for the aborted operation. The buffer is allocated by this function with AllocatePool(), and it is the caller's responsibility to free it with a call to FreePool(). |
EFI_SUCCESS | The device was successfully updated with the new image. |
EFI_ABORTED | The operation is aborted. |
EFI_INVALID_PARAMETER | The Image was NULL. |
EFI_UNSUPPORTED | The operation is not supported. |
EFI_SECURITY_VIOLATION | The operation could not be performed due to an authentication failure. |
Definition at line 470 of file SystemFirmwareUpdateDxe.c.
EFI_FIRMWARE_IMAGE_DESCRIPTOR * GetFmpImageDescriptors | ( | IN EFI_HANDLE | Handle, |
IN EFI_GUID * | ProtocolGuid, | ||
OUT UINT8 * | FmpImageInfoCount, | ||
OUT UINTN * | DescriptorSize | ||
) |
Get the set of EFI_FIRMWARE_IMAGE_DESCRIPTOR structures from an FMP Protocol.
[in] | Handle | Handle with an FMP Protocol or a System FMP Protocol. |
[in] | ProtocolGuid | Pointer to the FMP Protocol GUID or System FMP Protocol GUID. |
[out] | FmpImageInfoCount | Pointer to the number of EFI_FIRMWARE_IMAGE_DESCRIPTOR structures. |
[out] | DescriptorSize | Pointer to the size, in bytes, of each EFI_FIRMWARE_IMAGE_DESCRIPTOR structure. |
Definition at line 547 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS EFIAPI GetNextVariableNameHook | ( | IN OUT UINTN * | VariableNameSize, |
IN OUT CHAR16 * | VariableName, | ||
IN OUT EFI_GUID * | VendorGuid | ||
) |
This code Finds the Next available variable.
[in,out] | VariableNameSize | Size of the variable name. |
[in,out] | VariableName | Pointer to variable name. |
[in,out] | VendorGuid | Variable Vendor Guid. |
Definition at line 351 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS EFIAPI GetVariableHook | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
OUT UINT32 *Attributes | OPTIONAL, | ||
IN OUT UINTN * | DataSize, | ||
OUT VOID * | Data | ||
) |
This code finds variable in storage blocks (Volatile or Non-Volatile).
[in] | VariableName | Name of Variable to be found. |
[in] | VendorGuid | Variable vendor GUID. |
[out] | Attributes | Attribute value of the variable found. |
[in,out] | DataSize | Size of Data found. If size is less than the data, this value contains the required size. |
[out] | Data | Data pointer. |
Definition at line 323 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS ParseUpdateDataFile | ( | IN UINT8 * | DataBuffer, |
IN UINTN | BufferSize, | ||
IN OUT CONFIG_HEADER * | ConfigHeader, | ||
IN OUT UPDATE_CONFIG_DATA ** | UpdateArray | ||
) |
Parse Config data file to get the updated data array.
[in] | DataBuffer | Config raw file buffer. |
[in] | BufferSize | Size of raw buffer. |
[in,out] | ConfigHeader | Pointer to the config header. |
[in,out] | UpdateArray | Pointer to the config of update data. |
EFI_NOT_FOUND | No config data is found. |
EFI_OUT_OF_RESOURCES | No enough memory is allocated. |
EFI_SUCCESS | Parse the config file successfully. |
Definition at line 31 of file ParseConfigProfile.c.
EFI_STATUS PerformUpdate | ( | IN VOID * | SystemFirmwareImage, |
IN UINTN | SystemFirmwareImageSize, | ||
IN UPDATE_CONFIG_DATA * | ConfigData, | ||
OUT UINT32 * | LastAttemptVersion, | ||
OUT UINT32 * | LastAttemptStatus, | ||
IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS | Progress, | ||
IN UINTN | StartPercentage, | ||
IN UINTN | EndPercentage | ||
) |
Update System Firmware image component.
[in] | SystemFirmwareImage | Points to the System Firmware image. |
[in] | SystemFirmwareImageSize | The length of the System Firmware image in bytes. |
[in] | ConfigData | Points to the component configuration structure. |
[out] | LastAttemptVersion | The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[out] | LastAttemptStatus | The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[in] | Progress | A function used by the driver to report the progress of the firmware update. |
[in] | StartPercentage | The start completion percentage value that may be used to report progress during the flash write operation. |
[in] | EndPercentage | The end completion percentage value that may be used to report progress during the flash write operation. |
EFI_SUCCESS | The System Firmware image is updated. |
EFI_WRITE_PROTECTED | The flash device is read only. |
Definition at line 64 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS EFIAPI QueryVariableInfoHook | ( | IN UINT32 | Attributes, |
OUT UINT64 * | MaximumVariableStorageSize, | ||
OUT UINT64 * | RemainingVariableStorageSize, | ||
OUT UINT64 * | MaximumVariableSize | ||
) |
This code returns information about the EFI variables.
[in] | Attributes | Attributes bitmask to specify the type of variables on which to return information. |
[out] | MaximumVariableStorageSize | Pointer to the maximum size of the storage space available for the EFI variables associated with the attributes specified. |
[out] | RemainingVariableStorageSize | Pointer to the remaining size of the storage space available for EFI variables associated with the attributes specified. |
[out] | MaximumVariableSize | Pointer to the maximum size of an individual EFI variables associated with the attributes specified. |
Definition at line 411 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS EFIAPI SetVariableHook | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
IN UINT32 | Attributes, | ||
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
This code sets variable in storage blocks (Volatile or Non-Volatile).
[in] | VariableName | Name of Variable to be found. |
[in] | VendorGuid | Variable vendor GUID. |
[in] | Attributes | Attribute value of the variable found |
[in] | DataSize | Size of Data found. If size is less than the data, this value contains the required size. |
[in] | Data | Data pointer. |
Definition at line 381 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS SystemFirmwareAuthenticatedUpdate | ( | IN VOID * | Image, |
IN UINTN | ImageSize, | ||
OUT UINT32 * | LastAttemptVersion, | ||
OUT UINT32 * | LastAttemptStatus, | ||
IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS | Progress | ||
) |
Authenticate and update System Firmware image.
Caution: This function may receive untrusted input.
[in] | Image | The EDKII system FMP capsule image. |
[in] | ImageSize | The size of the EDKII system FMP capsule image in bytes. |
[out] | LastAttemptVersion | The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[out] | LastAttemptStatus | The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[in] | Progress | A function used by the driver to report the progress of the firmware update. |
EFI_SUCCESS | EDKII system FMP capsule passes authentication and the System Firmware image is updated. |
EFI_SECURITY_VIOLATION | EDKII system FMP capsule fails authentication and the System Firmware image is not updated. |
EFI_WRITE_PROTECTED | The flash device is read only. |
Definition at line 260 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS EFIAPI SystemFirmwareUpdateMainDxe | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
System FMP module entrypoint
[in] | ImageHandle | The firmware allocated handle for the EFI image. |
[in] | SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | System FMP module is initialized. |
EFI_OUT_OF_RESOURCES | There are not enough resources avaulable to initialize this module. |
Other | System FMP Protocols could not be uninstalled. |
Other | System FMP Protocol could not be installed. |
Other | FMP Protocol could not be installed. |
Definition at line 811 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS UninstallMatchingSystemFmpProtocols | ( | VOID | ) |
Uninstall System FMP Protocol instances that may have been installed by SystemFirmwareUpdateDxe drivers dispatches by other capsules.
EFI_SUCCESS | All System FMP Protocols found were uninstalled. |
Definition at line 746 of file SystemFirmwareUpdateDxe.c.
EFI_STATUS UpdateImage | ( | IN VOID * | SystemFirmwareImage, |
IN UINTN | SystemFirmwareImageSize, | ||
IN VOID * | ConfigImage, | ||
IN UINTN | ConfigImageSize, | ||
OUT UINT32 * | LastAttemptVersion, | ||
OUT UINT32 * | LastAttemptStatus, | ||
IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS | Progress | ||
) |
Update System Firmware image.
[in] | SystemFirmwareImage | Points to the System Firmware image. |
[in] | SystemFirmwareImageSize | The length of the System Firmware image in bytes. |
[in] | ConfigImage | Points to the config file image. |
[in] | ConfigImageSize | The length of the config file image in bytes. |
[out] | LastAttemptVersion | The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[out] | LastAttemptStatus | The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[in] | Progress | A function used by the driver to report the progress of the firmware update. |
EFI_SUCCESS | The System Firmware image is updated. |
EFI_WRITE_PROTECTED | The flash device is read only. |
Definition at line 126 of file SystemFirmwareUpdateDxe.c.
EFI_GUID mCurrentImageTypeId |
Definition at line 23 of file SystemFirmwareUpdateDxe.c.
BOOLEAN mNvRamUpdated = FALSE |
Definition at line 25 of file SystemFirmwareUpdateDxe.c.
SYSTEM_FMP_PRIVATE_DATA* mSystemFmpPrivate = NULL |
Definition at line 21 of file SystemFirmwareUpdateDxe.c.