public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, lersek@redhat.com, leif.lindholm@linaro.org
Cc: jiewen.yao@intel.com, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 3/4] ArmVirtPkg/PlatformBootManagerLib: process pending capsules
Date: Thu,  2 Mar 2017 16:15:04 +0000	[thread overview]
Message-ID: <1488471305-23752-4-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org>

Process any capsule HOBs that were left for us by CapsulePei. This
involves calling ProcessCapsules() twice, as explained in the comment
in DxeCapsuleLibFmp.

1) The first call must be before EndOfDxe. The system capsules is processed.
   If device capsule FMP protocols are exposted at this time and device FMP
   capsule has zero EmbeddedDriverCount, the device capsules are processed.
   Each individual capsule result is recorded in capsule record variable.
   System may reset in this function, if reset is required by capsule and
   all capsules are processed.
   If not all capsules are processed, reset will be defered to second call.

2) The second call must be after EndOfDxe and after ConnectAll, so that all
   device capsule FMP protocols are exposed.
   The system capsules are skipped. If the device capsules are NOT processed
   in first call, they are processed here.
   Each individual capsule result is recorded in capsule record variable.
   System may reset in this function, if reset is required by capsule
   processed in first call and second call.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c               | 17 +++++++++++++++++
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 94da51ad49f1..1ebfecd992f7 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -17,7 +17,9 @@
 
 #include <IndustryStandard/Pci22.h>
 #include <Library/BootLogoLib.h>
+#include <Library/CapsuleLib.h>
 #include <Library/DevicePathLib.h>
+#include <Library/HobLib.h>
 #include <Library/PcdLib.h>
 #include <Library/QemuBootOrderLib.h>
 #include <Library/UefiBootManagerLib.h>
@@ -579,6 +581,13 @@ PlatformBootManagerBeforeConsole (
   )
 {
   RETURN_STATUS PcdStatus;
+  EFI_STATUS    Status;
+
+  if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) {
+    DEBUG((DEBUG_INFO, "ProcessCapsules Before EndOfDxe ......\n"));
+    Status = ProcessCapsules ();
+    DEBUG((DEBUG_INFO, "ProcessCapsules %r\n", Status));
+  }
 
   //
   // Signal EndOfDxe PI Event
@@ -663,6 +672,8 @@ PlatformBootManagerAfterConsole (
   VOID
   )
 {
+  EFI_STATUS    Status;
+
   //
   // Show the splash screen.
   //
@@ -673,6 +684,12 @@ PlatformBootManagerAfterConsole (
   //
   EfiBootManagerConnectAll ();
 
+  if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) {
+    DEBUG((DEBUG_INFO, "ProcessCapsules After EndOfDxe ......\n"));
+    Status = ProcessCapsules ();
+    DEBUG((DEBUG_INFO, "ProcessCapsules %r\n", Status));
+  }
+
   //
   // Process QEMU's -kernel command line option. Note that the kernel booted
   // this way should receive ACPI tables, which is why we connect all devices
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 1f162c663fc1..4d218097a420 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -45,8 +45,10 @@ [LibraryClasses]
   BaseLib
   BaseMemoryLib
   BootLogoLib
+  CapsuleLib
   DebugLib
   DevicePathLib
+  HobLib
   MemoryAllocationLib
   PcdLib
   PrintLib
-- 
2.7.4



  parent reply	other threads:[~2017-03-02 16:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 16:15 [PATCH 0/4] ArmVirtPkg: implement basic capsule support Ard Biesheuvel
2017-03-02 16:15 ` [PATCH 1/4] ArmVirtPkg/ArmVirtPlatformLib: base boot mode on capsule presence Ard Biesheuvel
2017-03-02 16:15 ` [PATCH 2/4] ArmVirtPkg/ArmVirtMemoryInitPeiLib: check for capsules before memory init Ard Biesheuvel
2017-03-02 16:15 ` Ard Biesheuvel [this message]
2017-03-02 16:15 ` [PATCH 4/4] ArmVirtPkg/ArmVirtQemu: enable basic capsule support Ard Biesheuvel
2017-03-02 17:09 ` [PATCH 0/4] ArmVirtPkg: implement " Laszlo Ersek
2017-03-02 17:22   ` Ard Biesheuvel
2017-03-02 18:56     ` 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=1488471305-23752-4-git-send-email-ard.biesheuvel@linaro.org \
    --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