[edk2-devel] [PATCH 1/2] MdeModulePkg: Capsule upgrade fixes.

Sandeep Dhanvada sandeep.dhanvada at xilinx.com
Mon Nov 9 11:03:03 UTC 2020


ConnectAllControlers() function is taken from
ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c:ConnectAllEfi()

without this function call, connect command should be explicitly
exeucted on shell for the FMP SetImage to be executed after capsule
update.

Signed-off-by: Sandeep Dhanvada <sandeep.dhanvada at xilinx.com>
---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 9094213..818a91b 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -1001,6 +1001,48 @@ SetFmpImageData (
 }

 /**
+  This function will connect all current system handles recursively. The
+  connection will finish until every handle's child handle created if it have.
+
+  This function is taken from ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c
+
+  @retval EFI_SUCCESS           All handles and it's child handle have been
+                                connected
+  @retval EFI_STATUS            Return the status of gBS->LocateHandleBuffer().
+
+**/
+
+EFI_STATUS
+ConnectAllControllers (VOID)
+{
+  EFI_STATUS  Status;
+  UINTN       HandleCount;
+  EFI_HANDLE  *HandleBuffer;
+  UINTN       Index;
+
+  Status = gBS->LocateHandleBuffer (
+                  AllHandles,
+                  NULL,
+                  NULL,
+                  &HandleCount,
+                  &HandleBuffer
+                 );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  for (Index = 0; Index < HandleCount; Index++) {
+    Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
+  }
+
+  if (HandleBuffer != NULL) {
+    FreePool (HandleBuffer);
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
   Start a UEFI image in the FMP payload.

   @param[in]  ImageBuffer   A pointer to the memory location containing a copy of the image to be loaded..
@@ -1067,6 +1109,7 @@ StartFmpImage (
     DEBUG ((DEBUG_ERROR, "Driver Return Status = %r\n", Status));
   }

+  ConnectAllControllers();
   FreePool(DriverDevicePath);
   return Status;
 }
--
2.1.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67178): https://edk2.groups.io/g/devel/message/67178
Mute This Topic: https://groups.io/mt/78135577/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list