SignedCapsulePkg SystemFirmwareReportDxe: Try LocateProtocol
authorStar Zeng <star.zeng@intel.com>
Mon, 30 Jul 2018 05:42:41 +0000 (13:42 +0800)
committerStar Zeng <star.zeng@intel.com>
Wed, 1 Aug 2018 02:05:12 +0000 (10:05 +0800)
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>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.c

index fb7b63b..8802404 100644 (file)
@@ -202,17 +202,24 @@ FmpSetImage (
                   (VOID **)&SystemFmp\r
                   );\r
   if (EFI_ERROR(Status)) {\r
-    DEBUG((DEBUG_INFO, "(Agent)SetImage - SystemFmpProtocol - %r\n", Status));\r
-    SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;\r
-    VarStatus = gRT->SetVariable(\r
-                       SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,\r
-                       &gSystemFmpLastAttemptVariableGuid,\r
-                       EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-                       sizeof(SystemFmpPrivate->LastAttempt),\r
-                       &SystemFmpPrivate->LastAttempt\r
-                       );\r
-    DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));\r
-    return Status;\r
+    Status = gBS->LocateProtocol (\r
+                    &gSystemFmpProtocolGuid,\r
+                    NULL,\r
+                    (VOID **)&SystemFmp\r
+                    );\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((DEBUG_INFO, "(Agent)SetImage - SystemFmpProtocol - %r\n", Status));\r
+      SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;\r
+      VarStatus = gRT->SetVariable(\r
+                         SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,\r
+                         &gSystemFmpLastAttemptVariableGuid,\r
+                         EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+                         sizeof(SystemFmpPrivate->LastAttempt),\r
+                         &SystemFmpPrivate->LastAttempt\r
+                         );\r
+      DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));\r
+      return Status;\r
+    }\r
   }\r
 \r
   return SystemFmp->SetImage(SystemFmp, ImageIndex, Image, ImageSize, VendorCode, Progress, AbortReason);\r