summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@gmail.com>2022-12-10 04:45:38 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-17 03:47:36 +0000
commit0e5717009779ec6c1e35f979426a2cd407b3e73a (patch)
tree3654dbfa4776e0614c0b1e573d37763246a1b4da /MdeModulePkg/Library
parent16e0969ef775b898ac700f3261d76030b8ab9ef0 (diff)
downloadedk2-0e5717009779ec6c1e35f979426a2cd407b3e73a.tar.gz
edk2-0e5717009779ec6c1e35f979426a2cd407b3e73a.tar.bz2
edk2-0e5717009779ec6c1e35f979426a2cd407b3e73a.zip
MdeModulePkg/BmBoot: Skip removable media if it is not present
Only enumerate devices that have media present. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..bde22fa659 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2218,6 +2218,15 @@ BmEnumerateBootOptions (
continue;
}
+ //
+ // Skip removable media if not present
+ //
+ if ((BlkIo->Media->RemovableMedia == TRUE) &&
+ (BlkIo->Media->MediaPresent == FALSE))
+ {
+ continue;
+ }
+
Description = BmGetBootDescription (Handles[Index]);
BootOptions = ReallocatePool (
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),