public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: devel@edk2.groups.io
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>,
	Star Zeng <star.zeng@intel.com>,
	Liming gao <liming.gao@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Michael Turner <Michael.Turner@microsoft.com>
Subject: [PATCH 3/4] MdeModulePkg: Use pcd to control if BootManager in BootOrder
Date: Wed, 17 Jul 2019 15:50:07 +0800	[thread overview]
Message-ID: <20190717075008.22716-4-zhichao.gao@intel.com> (raw)
In-Reply-To: <20190717075008.22716-1-zhichao.gao@intel.com>

From: Bret Barkelew <Bret.Barkelew@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@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Zhichao Gao <zhichao.gao@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


  parent reply	other threads:[~2019-07-17  7:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  7:50 [PATCH 0/4] Add a pcd PcdBootManagerInBootOrder to control whether BootManager is in BootOrder Gao, Zhichao
2019-07-17  7:50 ` [PATCH 1/4] MdeModulePkg: Add PcdBootManagerInBootOrder to dec file Gao, Zhichao
2019-07-17  7:50 ` [PATCH 2/4] MdeModulePkg: Add prompt and help string for PcdBootManagerInBootOrder Gao, Zhichao
2019-07-17  7:50 ` Gao, Zhichao [this message]
2019-07-17  7:50 ` [PATCH 4/4] MdeModulePkg: PcdBootManagerInBootOrder should only affect BootOrder Gao, Zhichao
2019-07-17  8:07 ` [PATCH 0/4] Add a pcd PcdBootManagerInBootOrder to control whether BootManager is in BootOrder Ni, Ray
2019-07-17  8:28   ` Gao, Zhichao
2019-07-17  8:42     ` Ni, Ray
2019-07-17  8:44   ` Gao, Zhichao
2019-07-18  0:50     ` Ni, Ray
2019-07-17 12:59   ` [edk2-devel] " Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190717075008.22716-4-zhichao.gao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox