public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Staging/Bug_1525_FmpDevicePkg_MultipleControllers][PATCH] MdeModulePkg/EsrtFmpDxe: Correct the LastAttemptVersion algorithm in ESRT entry
@ 2019-04-16  3:01 Eric Jin
  2019-04-16 16:11 ` Michael D Kinney
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Jin @ 2019-04-16  3:01 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney

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.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
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 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Staging/Bug_1525_FmpDevicePkg_MultipleControllers][PATCH] MdeModulePkg/EsrtFmpDxe: Correct the LastAttemptVersion algorithm in ESRT entry
  2019-04-16  3:01 [Staging/Bug_1525_FmpDevicePkg_MultipleControllers][PATCH] MdeModulePkg/EsrtFmpDxe: Correct the LastAttemptVersion algorithm in ESRT entry Eric Jin
@ 2019-04-16 16:11 ` Michael D Kinney
  0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2019-04-16 16:11 UTC (permalink / raw)
  To: Jin, Eric, devel@edk2.groups.io, Kinney, Michael D

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: Jin, Eric
> Sent: Monday, April 15, 2019 8:02 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> Subject:
> [Staging/Bug_1525_FmpDevicePkg_MultipleControllers][PAT
> CH] MdeModulePkg/EsrtFmpDxe: Correct the
> LastAttemptVersion algorithm in ESRT entry
> 
> 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.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> 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 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-16 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-16  3:01 [Staging/Bug_1525_FmpDevicePkg_MultipleControllers][PATCH] MdeModulePkg/EsrtFmpDxe: Correct the LastAttemptVersion algorithm in ESRT entry Eric Jin
2019-04-16 16:11 ` Michael D Kinney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox