public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sandeep Dhanvada" <sandeep.dhanvada@xilinx.com>
To: <devel@edk2.groups.io>
Cc: <sandeep.dhanvada@xilinx.com>
Subject: [PATCH 1/2] MdeModulePkg: Capsule upgrade fixes.
Date: Mon, 9 Nov 2020 16:33:03 +0530	[thread overview]
Message-ID: <8c8e1cbd38d4f7daaf135b1728d57dfa70fab7c3.1604918017.git.sandeep.dhanvada@xilinx.com> (raw)
In-Reply-To: <cover.1604918017.git.sandeep.dhanvada@xilinx.com>

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@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.

  reply	other threads:[~2020-11-09 11:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 11:03 [PATCH 0/2] OvmfPkg: FMP Capsule Update Modifications Sandeep Dhanvada
2020-11-09 11:03 ` Sandeep Dhanvada [this message]
2020-11-09 11:03 ` [PATCH 2/2] OvmfPkg: Add EsrtFmpDxe in OVMF X64 Builds Sandeep Dhanvada
2020-11-10 21:17   ` [edk2-devel] " Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c8e1cbd38d4f7daaf135b1728d57dfa70fab7c3.1604918017.git.sandeep.dhanvada@xilinx.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox