[edk2] [PATCH 1/4] ArmVirtPkg/ArmVirtPlatformLib: base boot mode on capsule presence

Ard Biesheuvel posted 4 patches 7 years, 8 months ago
[edk2] [PATCH 1/4] ArmVirtPkg/ArmVirtPlatformLib: base boot mode on capsule presence
Posted by Ard Biesheuvel 7 years, 8 months ago
Instead of unconditionally returning BOOT_WITH_FULL_CONFIGURATION when
enquiring the platform about the boot mode, let's return enable the use
of capsules by returning BOOT_ON_FLASH_UPDATE when a capsule HOB is
detected.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf | 5 +++--
 ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c                 | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf b/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf
index 3cb3fb1f3aea..dbbe0fbee21a 100644
--- a/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf
@@ -29,11 +29,12 @@ [Packages]
   ArmVirtPkg/ArmVirtPkg.dec
 
 [LibraryClasses]
+  ArmLib
+  FdtLib
+  HobLib
   IoLib
   MemoryAllocationLib
-  ArmLib
   PrintLib
-  FdtLib
 
 [Sources.common]
   Virt.c
diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c b/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c
index fcaf3c681a97..58175110ab43 100644
--- a/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c
+++ b/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c
@@ -18,6 +18,7 @@
 #include <Library/IoLib.h>
 #include <Library/ArmPlatformLib.h>
 #include <Library/DebugLib.h>
+#include <Library/HobLib.h>
 #include <Library/PcdLib.h>
 #include <ArmPlatform.h>
 #include <libfdt.h>
@@ -38,6 +39,9 @@ ArmPlatformGetBootMode (
   VOID
   )
 {
+  if (GetFirstHob (EFI_HOB_TYPE_UEFI_CAPSULE) != NULL) {
+    return BOOT_ON_FLASH_UPDATE;
+  }
   return BOOT_WITH_FULL_CONFIGURATION;
 }
 
-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel