public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Eric Jin" <eric.jin@intel.com>
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>
Subject: [PATCH 2/3] MdeModulePkg/EsrtFmpDxe: Correct LastAttemptVersion algorithm in ESRT
Date: Wed, 31 Jul 2019 23:03:37 +0800	[thread overview]
Message-ID: <20190731150337.21036-1-eric.jin@intel.com> (raw)

REF: 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: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Eric Jin <eric.jin@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 d48f205797..804c6d2ca3 100644
--- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
+++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
@@ -179,20 +179,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


                 reply	other threads:[~2019-07-31 15:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190731150337.21036-1-eric.jin@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox