From: Bret Barkelew <bret.barke...@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.w...@intel.com>
Cc: Hao A Wu <hao.a...@intel.com>
Cc: Ray Ni <ray...@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Liming gao <liming....@intel.com>
Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Michael Turner <michael.tur...@microsoft.com>
Cc: Bret Barkelew <bret.barke...@microsoft.com>
Signed-off-by: Zhichao Gao <zhichao....@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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to