From: "Ashish Singhal" <ashishsingha@nvidia.com>
To: <devel@edk2.groups.io>, <jian.j.wang@intel.com>,
<gaoliming@byosoft.com.cn>, <zhichao.gao@intel.com>,
<ray.ni@intel.com>
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Subject: [PATCH] MdeModulePkg/UefiBootManagerLib: Configurable New Boot Options
Date: Mon, 16 May 2022 17:01:59 -0600 [thread overview]
Message-ID: <3fe4f5fff1141c3576ccf81b5993992c2bee81bb.1652741915.git.ashishsingha@nvidia.com> (raw)
Add a new PCD to be able to configure whether newly detected boot options
are to be added at the beginning of the current boot options list or at
the end.
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 6 +++++-
.../Library/UefiBootManagerLib/UefiBootManagerLib.inf | 1 +
MdeModulePkg/MdeModulePkg.dec | 5 +++++
MdeModulePkg/MdeModulePkg.uni | 4 ++++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..8a46100c2a 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2435,7 +2435,11 @@ EfiBootManagerRefreshAllBootOption (
//
for (Index = 0; Index < BootOptionCount; Index++) {
if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == -1) {
- EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1);
+ if (PcdGetBool (PcdNewBootOptionAtStart)) {
+ EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], 0);
+ } else {
+ EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1);
+ }
//
// Try best to add the boot options so continue upon failure.
//
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index fe05d5f1cc..46f41a7c63 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -119,3 +119,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfigureForm ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdNewBootOptionAtStart ## CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index cf79292ec8..9d696f117b 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2146,6 +2146,11 @@
# @Prompt GHCB Pool Size
gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize|0|UINT64|0x00030008
+ ## This dynamic PCD holds the flag to tell UEFI boot manager whether to add newly detected devices at
+ # the end, or at the start of the boot option.
+ # @Prompt Add new devices in boot options at start
+ gEfiMdeModulePkgTokenSpaceGuid.PcdNewBootOptionAtStart|FALSE|BOOLEAN|0x00030009
+
[PcdsDynamicEx]
## This dynamic PCD enables the default variable setting.
# Its value is the default store ID value. The default value is zero as Standard default.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index b070f15ff2..8e68db1c25 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1325,6 +1325,10 @@
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbBase_HELP #language en-US "Used with SEV-ES support to identify an address range that is not to be encrypted."
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNewBootOptionAtStart_PROMPT #language en-US "Add new devices in boot options at start"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNewBootOptionAtStart_HELP #language en-US "Used by UEFI boot manager to decide whether to place newly detcted devices at start of the list or end."
+
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbSize_PROMPT #language en-US "Guest-Hypervisor Communication Block (GHCB) Pool Base Size"
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbSize_HELP #language en-US "Used with SEV-ES support to identify the size of the address range that is not to be encrypted."
--
2.17.1
next reply other threads:[~2022-05-16 23:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 23:01 Ashish Singhal [this message]
2022-05-17 14:11 ` [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configurable New Boot Options Ni, Ray
2022-05-17 16:08 ` Ashish Singhal
2022-05-19 15:50 ` Ashish Singhal
2022-05-26 13:15 ` Ni, Ray
2022-05-26 13:16 ` Ashish Singhal
2022-05-26 13:29 ` Ni, Ray
2022-05-26 13:37 ` Ashish Singhal
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=3fe4f5fff1141c3576ccf81b5993992c2bee81bb.1652741915.git.ashishsingha@nvidia.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