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

The PcdBootManagerInBootOrder should only control whether
BootManager is in BootOrder. It shouldn't affect the Hotkey
service with BootManager.
Acctually, setting this pcd hides the boot option from BootOrder.
But it didn't disable the boot option.

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>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 611acb91e2..8bdac924b4 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2322,8 +2322,6 @@ EfiBootManagerRefreshAllBootOption (
 
   @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.
@@ -2344,6 +2342,7 @@ BmRegisterBootManagerMenu (
   UINTN                              Index;
   VOID                               *Data;
   UINTN                              DataSize;
+  UINT16                             OptionNumber;
 
   DevicePath = NULL;
   Description = NULL;
@@ -2441,7 +2440,17 @@ BmRegisterBootManagerMenu (
   if (PcdGetBool (PcdBootManagerInBootOrder)) {
     Status = EfiBootManagerAddLoadOptionVariable (BootOption, 0);
   } else {
-    Status = EFI_UNSUPPORTED;
+    //
+    // Get the free option number if the option number is unassigned
+    //
+    if (BootOption->OptionNumber == LoadOptionNumberUnassigned) {
+      Status = BmGetFreeOptionNumber (BootOption->OptionType, &OptionNumber);
+      if (EFI_ERROR (Status)) {
+        return Status;
+      }
+      BootOption->OptionNumber = OptionNumber;
+    }
+    Status = EfiBootManagerLoadOptionToVariable (BootOption);
   }
 
   return Status;
-- 
2.21.0.windows.1


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

View/Reply Online (#43856): https://edk2.groups.io/g/devel/message/43856
Mute This Topic: https://groups.io/mt/32501048/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to