[edk2-devel] [PATCH 3/4] MdeModulePkg: Use pcd to control if BootManager in BootOrder

Gao, Zhichao zhichao.gao at intel.com
Wed Jul 17 07:50:07 UTC 2019


From: Bret Barkelew <Bret.Barkelew at microsoft.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1979

Use pcd PcdBootManagerInBootOrder to control whether BootManager
is in BootOrder. Also add EFI_UNSUPPORTED to indicate the
BootManager is not in the BootOrder.

Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Star Zeng <star.zeng at intel.com>
Cc: Liming gao <liming.gao at intel.com>
Cc: Sean Brogan <sean.brogan at microsoft.com>
Cc: Michael Turner <Michael.Turner at microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew at microsoft.com>
Signed-off-by: Zhichao Gao <zhichao.gao at intel.com>
---
 .../Library/UefiBootManagerLib/BmBoot.c       | 20 +++++++++++++------
 .../UefiBootManagerLib/UefiBootManagerLib.inf |  1 +
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 952033fc82..611acb91e2 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2320,11 +2320,13 @@ EfiBootManagerRefreshAllBootOption (
 
   @param  BootOption    Return the boot option of the Boot Manager Menu
 
-  @retval EFI_SUCCESS   Successfully register the Boot Manager Menu.
-  @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found.
-  @retval others        Return status of gRT->SetVariable (). BootOption still points
-                        to the Boot Manager Menu even the Status is not EFI_SUCCESS
-                        and EFI_NOT_FOUND.
+  @retval EFI_SUCCESS       Successfully register the Boot Manager Menu.
+  @retval EFI_NOT_FOUND     The Boot Manager Menu cannot be found.
+  @retval EFI_UNSUPPORTED   The Boot Manager Menu isn't register to Boot Order because of
+                            PcdBootManagerInBootOrder.
+  @retval others            Return status of gRT->SetVariable (). BootOption still points
+                            to the Boot Manager Menu even the Status is not EFI_SUCCESS
+                            and EFI_NOT_FOUND.
 **/
 EFI_STATUS
 BmRegisterBootManagerMenu (
@@ -2436,7 +2438,13 @@ BmRegisterBootManagerMenu (
     EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
     );
 
-  return EfiBootManagerAddLoadOptionVariable (BootOption, 0);
+  if (PcdGetBool (PcdBootManagerInBootOrder)) {
+    Status = EfiBootManagerAddLoadOptionVariable (BootOption, 0);
+  } else {
+    Status = EFI_UNSUPPORTED;
+  }
+
+  return Status;
 }
 
 /**
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index ed6b4679eb..cfc01f57c6 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -116,3 +116,4 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile                     ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfigureForm               ## SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount                          ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerInBootOrder                  ## CONSUMES
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43855): https://edk2.groups.io/g/devel/message/43855
Mute This Topic: https://groups.io/mt/32501047/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