From: "Sean Rhodes" <sean@starlabs.systems>
To: devel@edk2.groups.io
Cc: Matt DeVillier <matt.devillier@gmail.com>,
Zhichao Gao <zhichao.gao@intel.com>, Ray Ni <ray.ni@intel.com>,
Sean Rhodes <sean@starlabs.systems>
Subject: [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: Add Pcd to prioritize internal devices
Date: Fri, 4 Mar 2022 22:52:39 +0000 [thread overview]
Message-ID: <8d861caf929257f2c4b060ee2818da48e4bd6548.1646434359.git.sean@starlabs.systems> (raw)
From: Matt DeVillier <matt.devillier@gmail.com>
Add Pcd to allow configuring internal devices to be prioritized over
internally-attached USB devices, such as card readers, over SATA, NVMe
and eMMC drives.
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 10 ++++++++--
.../Library/UefiBootManagerLib/UefiBootManagerLib.inf | 1 +
MdeModulePkg/MdeModulePkg.dec | 3 +++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..28c3cff471 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2214,8 +2214,14 @@ BmEnumerateBootOptions (
//
// Skip the fixed block io then the removable block io
//
- if (BlkIo->Media->RemovableMedia == ((Removable == 0) ? FALSE : TRUE)) {
- continue;
+ if (FixedPcdGetBool (PcdPrioritizeInternal)) {
+ if (BlkIo->Media->RemovableMedia == (Removable == 0)) {
+ continue;
+ }
+ } else {
+ if (BlkIo->Media->RemovableMedia == ((Removable == 0) ? FALSE : TRUE)) {
+ continue;
+ }
}
Description = BmGetBootDescription (Handles[Index]);
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index fe05d5f1cc..207420e334 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.PcdPrioritizeInternal
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 463e889e9a..ded82d1cff 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1077,6 +1077,9 @@
# @Prompt Enable UEFI Stack Guard.
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055
+ # Prioritize Internal Devices
+ gEfiMdeModulePkgTokenSpaceGuid.PcdPrioritizeInternal|FALSE|BOOLEAN|0x00000031
+
[PcdsFixedAtBuild, PcdsPatchableInModule]
## Dynamic type PCD can be registered callback function for Pcd setting action.
# PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function
--
2.32.0
next reply other threads:[~2022-03-04 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 22:52 Sean Rhodes [this message]
2022-03-04 22:52 ` [PATCH 2/2] UefiPayloadPkg: Hookup Prioritise Internal build option Sean Rhodes
-- strict thread matches above, loose matches on Subject: below --
2022-03-16 22:21 [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: Add Pcd to prioritize internal devices Sean Rhodes
2022-03-21 10:03 Sean Rhodes
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=8d861caf929257f2c4b060ee2818da48e4bd6548.1646434359.git.sean@starlabs.systems \
--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