Fix the 1nd issue mentioned in 
https://bugzilla.tianocore.org/show_bug.cgi?id=1525

Update the ESRT entry with the last attempt status and last attempt
version from the first FMP instance whose last attempt status is not
SUCCESS. If all FMP instances are SUCCESS, then set last attempt version
to the smallest value from all FMP instances

CC: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric....@intel.com>
---
 MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c 
b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
index bd92d1da40..848bd44e9d 100644
--- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
+++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
@@ -196,20 +196,22 @@ CreateEsrtEntry (
       // VERSION 3 supports last attempt values
       //
       if (FmpVersion >= 3) {
-        Entry->LastAttemptVersion =
-          MIN (
-            FmpImageInfoBuf->LastAttemptVersion,
-            Entry->LastAttemptVersion
-            );
         //
         // Update the ESRT entry with the last attempt status and last attempt
         // version from the first FMP instance whose last attempt status is not
-        // SUCCESS.
+        // SUCCESS.  If all FMP instances are SUCCESS, then set version to the 
+        // smallest value from all FMP instances.
         //
         if (Entry->LastAttemptStatus == LAST_ATTEMPT_STATUS_SUCCESS) {
           if (FmpImageInfoBuf->LastAttemptStatus != 
LAST_ATTEMPT_STATUS_SUCCESS) {
             Entry->LastAttemptStatus = FmpImageInfoBuf->LastAttemptStatus;
             Entry->LastAttemptVersion = FmpImageInfoBuf->LastAttemptVersion;
+          } else {
+            Entry->LastAttemptVersion =
+              MIN (
+                FmpImageInfoBuf->LastAttemptVersion,
+                Entry->LastAttemptVersion
+                );
           }
         }
       }
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39145): https://edk2.groups.io/g/devel/message/39145
Mute This Topic: https://groups.io/mt/31196314/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to