]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.c
SignedCapsulePkg/Universal: Fix various typos
[mirror_edk2.git] / SignedCapsulePkg / Universal / SystemFirmwareUpdate / SystemFirmwareReportDxe.c
index f5f9827c7764e7f6b94ac7f37961565f10c35785..ebd1d0d53db8e41c57a8baab8bb758a5b27bb652 100644 (file)
@@ -8,14 +8,8 @@
 \r
   FmpSetImage() will receive untrusted input and do basic validation.\r
 \r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -36,7 +30,7 @@ SYSTEM_FMP_PRIVATE_DATA *mSystemFmpPrivate = NULL;
   @param[out] LastAttemptVersion The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
   @param[out] LastAttemptStatus  The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
 \r
-  @retval EFI_SUCESS            Process Capsule Image successfully.\r
+  @retval EFI_SUCCESS           Process Capsule Image successfully.\r
   @retval EFI_UNSUPPORTED       Capsule image is not supported by the firmware.\r
   @retval EFI_VOLUME_CORRUPTED  FV volume in the capsule is corrupted.\r
   @retval EFI_OUT_OF_RESOURCES  Not enough memory.\r
@@ -145,7 +139,7 @@ DispatchSystemFmpImages (
   @retval EFI_ABORTED            The operation is aborted.\r
   @retval EFI_INVALID_PARAMETER  The Image was NULL.\r
   @retval EFI_UNSUPPORTED        The operation is not supported.\r
-  @retval EFI_SECURITY_VIOLATIO  The operation could not be performed due to an authentication failure.\r
+  @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -180,7 +174,7 @@ FmpSetImage (
   // Process FV\r
   //\r
   Status = DispatchSystemFmpImages((VOID *)Image, ImageSize, &SystemFmpPrivate->LastAttempt.LastAttemptVersion, &SystemFmpPrivate->LastAttempt.LastAttemptStatus);\r
-  DEBUG((DEBUG_INFO, "(Agent)SetImage - LastAttemp Version - 0x%x, State - 0x%x\n", SystemFmpPrivate->LastAttempt.LastAttemptVersion, SystemFmpPrivate->LastAttempt.LastAttemptStatus));\r
+  DEBUG((DEBUG_INFO, "(Agent)SetImage - LastAttempt Version - 0x%x, State - 0x%x\n", SystemFmpPrivate->LastAttempt.LastAttemptVersion, SystemFmpPrivate->LastAttempt.LastAttemptStatus));\r
   if (EFI_ERROR(Status)) {\r
     VarStatus = gRT->SetVariable(\r
                        SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,\r
@@ -189,26 +183,37 @@ FmpSetImage (
                        sizeof(SystemFmpPrivate->LastAttempt),\r
                        &SystemFmpPrivate->LastAttempt\r
                        );\r
-    DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));\r
+    DEBUG((DEBUG_INFO, "(Agent)SetLastAttempt - %r\n", VarStatus));\r
     return Status;\r
   }\r
 \r
   //\r
-  // Pass Thru\r
+  // Pass Thru to System FMP Protocol on same handle as FMP Protocol\r
   //\r
-  Status = gBS->LocateProtocol(&gSystemFmpProtocolGuid, NULL, (VOID **)&SystemFmp);\r
+  Status = gBS->HandleProtocol(\r
+                  SystemFmpPrivate->Handle,\r
+                  &gSystemFmpProtocolGuid,\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
+    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)SetLastAttempt - %r\n", VarStatus));\r
+      return Status;\r
+    }\r
   }\r
 \r
   return SystemFmp->SetImage(SystemFmp, ImageIndex, Image, ImageSize, VendorCode, Progress, AbortReason);\r