[edk2-devel] [PATCH 4/4] MdeModulePkg: PcdBootManagerInBootOrder should only affect BootOrder

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


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.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>
---
 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/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