]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UefiBootManagerLib: Generate boot description for SD/eMMC
authorHao Wu <hao.a.wu@intel.com>
Mon, 4 Sep 2017 02:18:41 +0000 (10:18 +0800)
committerHao Wu <hao.a.wu@intel.com>
Wed, 6 Sep 2017 01:52:17 +0000 (09:52 +0800)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=620

Adds the support for SD/eMMC device path to show as a boot option.

The CID register content (returned from DiskInfo->Inquiry) seems do not
provide very useful/readable 'OEM/Application ID' and 'Product name'
field.

For SD devices, the OID is a 2-character ASCII string and the Product name
is a 5-character ASCII string.

For eMMC devices, the OID is an 8-bit binary number and the Product name
is a 6-character ASCII string.

These strings are relatively short and do not provide a very readable
description. Hence, this commit uses general 'SD (eMMC) Device' for the
boot option description.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf

index 7647bac2d03711298d65ab13703ed9c7ea42f74f..d56c3e7e2ca7acf41b7d602b27371dcf8c600e87 100644 (file)
@@ -155,6 +155,7 @@ BmGetDescriptionFromDiskInfo (
   CONST UINTN                  SerialNumberLength = 20;\r
   CHAR8                        *StrPtr;\r
   UINT8                        Temp;\r
+  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
 \r
   Description  = NULL;\r
 \r
@@ -229,6 +230,28 @@ BmGetDescriptionFromDiskInfo (
 \r
       BmEliminateExtraSpaces (Description);\r
     }\r
+  } else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoSdMmcInterfaceGuid)) {\r
+    DevicePath = DevicePathFromHandle (Handle);\r
+    if (DevicePath == NULL) {\r
+      return NULL;\r
+    }\r
+\r
+    while (!IsDevicePathEnd (DevicePath) && (DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH)) {\r
+      DevicePath = NextDevicePathNode (DevicePath);\r
+    }\r
+    if (IsDevicePathEnd (DevicePath)) {\r
+      return NULL;\r
+    }\r
+\r
+    if (DevicePathSubType (DevicePath) == MSG_SD_DP) {\r
+      Description = L"SD Device";\r
+    } else if (DevicePathSubType (DevicePath) == MSG_EMMC_DP) {\r
+      Description = L"eMMC Device";\r
+    } else {\r
+      return NULL;\r
+    }\r
+\r
+    Description = AllocateCopyPool (StrSize (Description), Description);\r
   }\r
 \r
   return Description;\r
index 264d726c26aec686410bd3ab75a1c8fcf9b9f355..ad4901db5713f8ab78d982615100c360669f0709 100644 (file)
@@ -91,6 +91,7 @@
   gEfiDiskInfoAhciInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID\r
   gEfiDiskInfoIdeInterfaceGuid                  ## SOMETIMES_CONSUMES ## GUID\r
   gEfiDiskInfoScsiInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID\r
+  gEfiDiskInfoSdMmcInterfaceGuid                ## SOMETIMES_CONSUMES ## GUID\r
 \r
 [Protocols]\r
   gEfiPciRootBridgeIoProtocolGuid               ## CONSUMES\r