From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: eric.jin@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Mon, 15 Apr 2019 20:02:03 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 20:02:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,355,1549958400"; d="scan'208";a="316291217" Received: from jjin9-mobl.ccr.corp.intel.com ([10.239.192.124]) by orsmga005.jf.intel.com with ESMTP; 15 Apr 2019 20:02:01 -0700 From: "Eric Jin" To: devel@edk2.groups.io Cc: Michael D Kinney Subject: [Staging/Bug_1525_FmpDevicePkg_MultipleControllers][PATCH] MdeModulePkg/EsrtFmpDxe: Correct the LastAttemptVersion algorithm in ESRT entry Date: Tue, 16 Apr 2019 11:01:58 +0800 Message-Id: <20190416030158.27096-1-eric.jin@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin --- 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