From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01b.ixn.mail.zen.net.uk (smarthost01b.ixn.mail.zen.net.uk [212.23.1.21]) by mx.groups.io with SMTP id smtpd.web12.2054.1644528563007155895 for ; Thu, 10 Feb 2022 13:29:23 -0800 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.21, mailfrom: sean@starlabs.systems) Received: from [217.155.46.38] (helo=sean-StarBook.lan) by smarthost01b.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nIH0B-0007U5-Qj; Thu, 10 Feb 2022 21:29:20 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: zhichao.gao@intel.com, Matt DeVillier Subject: [PATCH 17/18] BmBoot: prioritize internal boot devices over external Date: Thu, 10 Feb 2022 21:29:18 +0000 Message-Id: <41aaff25c2260eeaa713d3358a4a383da7e418a6.1644527848.git.sean@starlabs.systems> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-smarthost01b-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Content-Transfer-Encoding: quoted-printable From: Matt DeVillier This prevents some internally-attached USB devices (card readers, etc) from defaulting ahead of SATA/NVMe/eMMC drives. Signed-off-by: Matt DeVillier --- 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 2da6d2381e..a41a69afd2 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2216,8 +2216,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 b4855431b0..38e2573a6d 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