public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] SignedCapsulePkg SystemFirmwareReportDxe: Try LocateProtocol
@ 2018-07-31  0:57 Star Zeng
  2018-07-31 11:06 ` Yao, Jiewen
  0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2018-07-31  0:57 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Michael D Kinney, Jiewen Yao

Try LocateProtocol after HandleProtocol fails to be compatible
with old SystemFirmwareUpdateDxe.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../SystemFirmwareUpdate/SystemFirmwareReportDxe.c | 29 ++++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.c
index fb7b63be9d13..8802404c9a6b 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.c
@@ -202,17 +202,24 @@ FmpSetImage (
                   (VOID **)&SystemFmp
                   );
   if (EFI_ERROR(Status)) {
-    DEBUG((DEBUG_INFO, "(Agent)SetImage - SystemFmpProtocol - %r\n", Status));
-    SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;
-    VarStatus = gRT->SetVariable(
-                       SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,
-                       &gSystemFmpLastAttemptVariableGuid,
-                       EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
-                       sizeof(SystemFmpPrivate->LastAttempt),
-                       &SystemFmpPrivate->LastAttempt
-                       );
-    DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));
-    return Status;
+    Status = gBS->LocateProtocol (
+                    &gSystemFmpProtocolGuid,
+                    NULL,
+                    (VOID **)&SystemFmp
+                    );
+    if (EFI_ERROR(Status)) {
+      DEBUG((DEBUG_INFO, "(Agent)SetImage - SystemFmpProtocol - %r\n", Status));
+      SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;
+      VarStatus = gRT->SetVariable(
+                         SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,
+                         &gSystemFmpLastAttemptVariableGuid,
+                         EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+                         sizeof(SystemFmpPrivate->LastAttempt),
+                         &SystemFmpPrivate->LastAttempt
+                         );
+      DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));
+      return Status;
+    }
   }
 
   return SystemFmp->SetImage(SystemFmp, ImageIndex, Image, ImageSize, VendorCode, Progress, AbortReason);
-- 
2.7.0.windows.1



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

end of thread, other threads:[~2018-07-31 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31  0:57 [PATCH] SignedCapsulePkg SystemFirmwareReportDxe: Try LocateProtocol Star Zeng
2018-07-31 11:06 ` Yao, Jiewen

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