From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01a.ixn.mail.zen.net.uk (smarthost01a.ixn.mail.zen.net.uk [212.23.1.20]) by mx.groups.io with SMTP id smtpd.web10.3210.1647469300115145787 for ; Wed, 16 Mar 2022 15:21:41 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.20, mailfrom: sean@starlabs.systems) Received: from [217.155.46.38] (helo=sean-StarBook.lan) by smarthost01a.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nUc1P-0004TB-93; Wed, 16 Mar 2022 22:21:35 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: Matt DeVillier , Jian J Wang , Liming Gao , Sean Rhodes Subject: [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: Add Pcd to prioritize internal devices Date: Wed, 16 Mar 2022 22:21:32 +0000 Message-Id: X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Originating-smarthost01a-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Content-Transfer-Encoding: quoted-printable From: Matt DeVillier 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: Jian J Wang Cc: Liming Gao Signed-off-by: Matt DeVillier Signed-off-by: Sean Rhodes --- 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/MdeModulePk= g/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 ( //=0D // Skip the fixed block io then the removable block io=0D //=0D - if (BlkIo->Media->RemovableMedia =3D=3D ((Removable =3D=3D 0) ? FALS= E : TRUE)) {=0D - continue;=0D + if (FixedPcdGetBool (PcdPrioritizeInternal)) {=0D + if (BlkIo->Media->RemovableMedia =3D=3D (Removable =3D=3D 0)) {=0D + continue;=0D + }=0D + } else {=0D + if (BlkIo->Media->RemovableMedia =3D=3D ((Removable =3D=3D 0) ? FA= LSE : TRUE)) {=0D + continue;=0D + }=0D }=0D =0D Description =3D BmGetBootDescription (Handles[Index]);=0D 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=0D gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfigureForm = ## SOMETIMES_CONSUMES=0D gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount = ## CONSUMES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdPrioritizeInternal=0D 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.=0D gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055= =0D =0D + # Prioritize Internal Devices=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdPrioritizeInternal|FALSE|BOOLEAN|0x000= 00031=0D +=0D [PcdsFixedAtBuild, PcdsPatchableInModule]=0D ## Dynamic type PCD can be registered callback function for Pcd setting = action.=0D # PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of= callback function=0D --=20 2.32.0