[PATCH 3/4] MdeModulePkg/BmBoot: Skip removable media if it is not present


Sean Rhodes
 

From: Matt DeVillier <matt.devillier@...>

Only enumerate devices that have media present.

Cc: Hao A Wu <hao.a.wu@...>
Cc: Ray Ni <ray.ni@...>
Reviewed-by: Sean Rhodes <sean@...>
Signed-off-by: Matt DeVillier <matt.devillier@...>
Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
---
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePk=
g/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;=0D
}=0D
=0D
+ //=0D
+ // Skip removable media if not present=0D
+ //=0D
+ if ((BlkIo->Media->RemovableMedia =3D=3D TRUE) &&=0D
+ (BlkIo->Media->MediaPresent =3D=3D FALSE))=0D
+ {=0D
+ continue;=0D
+ }=0D
+=0D
Description =3D BmGetBootDescription (Handles[Index]);=0D
BootOptions =3D ReallocatePool (=0D
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOption=
Count),=0D
--=20
2.37.2


Wu, Hao A
 

Hello,

Could you help to co-work with BDS modules reviewers for reviewing this patch?

py BaseTools/Scripts/GetMaintainer.py 294ce61c3b1a63c89bd16a78f8e8b40e889dac5a
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
Jian J Wang <jian.j.wang@...>
Liming Gao <gaoliming@...>
Zhichao Gao <zhichao.gao@...>
Ray Ni <ray.ni@...>
devel@edk2.groups.io

Best Regards,
Hao Wu

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
Rhodes
Sent: Monday, December 5, 2022 5:18 PM
To: devel@edk2.groups.io
Cc: Matt DeVillier <matt.devillier@...>; Wu, Hao A
<hao.a.wu@...>; Ni, Ray <ray.ni@...>; Rhodes, Sean
<sean@...>
Subject: [edk2-devel] [PATCH 3/4] MdeModulePkg/BmBoot: Skip removable
media if it is not present

From: Matt DeVillier <matt.devillier@...>

Only enumerate devices that have media present.

Cc: Hao A Wu <hao.a.wu@...>
Cc: Ray Ni <ray.ni@...>
Reviewed-by: Sean Rhodes <sean@...>
Signed-off-by: Matt DeVillier <matt.devillier@...>
Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
---
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++
1 file changed, 9 insertions(+)

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),

--
2.37.2



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96952): https://edk2.groups.io/g/devel/message/96952
Mute This Topic: https://groups.io/mt/95465402/1768737
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@...]
-=-=-=-=-=-=