FmpDevicePkg: Add Last Attempt Status support to dependency libs

The FMP dependency libraries are leveraged during firmware update
to check for dependencies required to update the image.

This change adds granular Last Attempt Status code support to these
services so failures can be more easily observed during the firmware
update process via Last Attempt Status codes.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael Kubacki
2020-10-20 07:59:38 +08:00
committed by mergify[bot]
parent 004ce0ab04
commit 207414cba4
7 changed files with 189 additions and 47 deletions

View File

@@ -730,6 +730,15 @@ GetAllHeaderSize (
LAST_ATTEMPT_STATUS_DRIVER_MIN_ERROR_CODE_VALUE
to LAST_ATTEMPT_STATUS_DRIVER_MAX_ERROR_CODE_VALUE.
This function might also return error codes that occur within libraries
linked against this module that return last attempt error codes such as:
LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_LIB_MIN_ERROR_CODE_VALUE to
LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_LIB_MAX_ERROR_CODE_VALUE
LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_CHECK_LIB_MIN_ERROR_CODE_VALUE to
LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_CHECK_LIB_MAX_ERROR_CODE_VALUE
@retval EFI_SUCCESS The image was successfully checked.
@retval EFI_ABORTED The operation is aborted.
@retval EFI_INVALID_PARAMETER The Image was NULL.
@@ -925,7 +934,16 @@ CheckTheImageInternal (
//
// Get the dependency from Image.
//
Dependencies = GetImageDependency ((EFI_FIRMWARE_IMAGE_AUTHENTICATION *)Image, ImageSize, &DependenciesSize);
Dependencies = GetImageDependency (
(EFI_FIRMWARE_IMAGE_AUTHENTICATION *) Image,
ImageSize,
&DependenciesSize,
LastAttemptStatus
);
if (*LastAttemptStatus != LAST_ATTEMPT_STATUS_SUCCESS) {
Status = EFI_ABORTED;
goto cleanup;
}
//
// Check the FmpPayloadHeader
@@ -964,11 +982,18 @@ CheckTheImageInternal (
//
// Evaluate dependency expression
//
Private->DependenciesSatisfied = CheckFmpDependency (Private->Descriptor.ImageTypeId, Version, Dependencies, DependenciesSize);
Private->DependenciesSatisfied = CheckFmpDependency (
Private->Descriptor.ImageTypeId,
Version,
Dependencies,
DependenciesSize,
&LocalLastAttemptStatus
);
if (!Private->DependenciesSatisfied) {
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): CheckTheImage() - Dependency check failed.\n", mImageIdName));
*ImageUpdatable = IMAGE_UPDATABLE_INVALID;
Status = EFI_SUCCESS;
*LastAttemptStatus = LocalLastAttemptStatus;
goto cleanup;
}
@@ -1181,7 +1206,7 @@ SetTheImage (
//
// Get the dependency from Image.
//
Dependencies = GetImageDependency ((EFI_FIRMWARE_IMAGE_AUTHENTICATION *)Image, ImageSize, &DependenciesSize);
Dependencies = GetImageDependency ((EFI_FIRMWARE_IMAGE_AUTHENTICATION *)Image, ImageSize, &DependenciesSize, &LastAttemptStatus);
//
// No functional error in CheckTheImage. Attempt to get the Version to