summaryrefslogtreecommitdiffstats
path: root/FmpDevicePkg/FmpDxe
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2020-10-20 07:59:38 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-10-28 06:05:52 +0000
commit207414cba4a18970ca2d7b2d3168c17f2df09f97 (patch)
tree338d823de374f3590c3dd663671771b7c6dd91db /FmpDevicePkg/FmpDxe
parent004ce0ab041409d6c39b7d49b69c816ea0cddd70 (diff)
downloadedk2-207414cba4a18970ca2d7b2d3168c17f2df09f97.tar.gz
edk2-207414cba4a18970ca2d7b2d3168c17f2df09f97.tar.bz2
edk2-207414cba4a18970ca2d7b2d3168c17f2df09f97.zip
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>
Diffstat (limited to 'FmpDevicePkg/FmpDxe')
-rw-r--r--FmpDevicePkg/FmpDxe/FmpDxe.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index b7fd9c93ae..de7f1fe53e 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -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