[edk2-devel] [PATCH] MdeModulePkg/BmBoot: skip secondary eMMC entries

Sean Rhodes posted 1 patch 2 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/c0a283cd72c819d90819ef17766e5bca9e862ed6.1643405714.git.sean@starlabs.systems
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
[edk2-devel] [PATCH] MdeModulePkg/BmBoot: skip secondary eMMC entries
Posted by Sean Rhodes 2 years, 3 months ago
From: Matt DeVillier <matt.devillier@gmail.com>

Internal eMMC devices often show multiple entries, so skip
any after the initial entry.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..f7da5bcdfc 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2175,12 +2175,14 @@ BmEnumerateBootOptions (
   EFI_BLOCK_IO_PROTOCOL         *BlkIo;
   UINTN                         Removable;
   UINTN                         Index;
+  UINTN                         EmmcCount;
   CHAR16                        *Description;
 
   ASSERT (BootOptionCount != NULL);
 
   *BootOptionCount = 0;
   BootOptions      = NULL;
+  EmmcCount        = 0;
 
   //
   // Parse removable block io followed by fixed block io
@@ -2219,6 +2221,17 @@ BmEnumerateBootOptions (
       }
 
       Description = BmGetBootDescription (Handles[Index]);
+
+      //
+      // Skip secondary entries for internal eMMC devices
+      //
+      if (StrCmp(Description, L"eMMC Device") == 0) {
+        EmmcCount++;
+        if (EmmcCount > 1) {
+          continue;
+        }
+      }
+
       BootOptions = ReallocatePool (
                       sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
                       sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount + 1),
-- 
2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86185): https://edk2.groups.io/g/devel/message/86185
Mute This Topic: https://groups.io/mt/88757871/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-