public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/UefiBootManagerLib: Generate boot description for SD/eMMC
@ 2017-09-05  0:33 Hao Wu
  2017-09-05  1:57 ` Ni, Ruiyu
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Wu @ 2017-09-05  0:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Ruiyu Ni

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.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 .../Library/UefiBootManagerLib/BmBootDescription.c | 23 ++++++++++++++++++++++
 .../UefiBootManagerLib/UefiBootManagerLib.inf      |  1 +
 2 files changed, 24 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
index 7647bac2d0..d56c3e7e2c 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
@@ -155,6 +155,7 @@ BmGetDescriptionFromDiskInfo (
   CONST UINTN                  SerialNumberLength = 20;
   CHAR8                        *StrPtr;
   UINT8                        Temp;
+  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;
 
   Description  = NULL;
 
@@ -229,6 +230,28 @@ BmGetDescriptionFromDiskInfo (
 
       BmEliminateExtraSpaces (Description);
     }
+  } else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoSdMmcInterfaceGuid)) {
+    DevicePath = DevicePathFromHandle (Handle);
+    if (DevicePath == NULL) {
+      return NULL;
+    }
+
+    while (!IsDevicePathEnd (DevicePath) && (DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH)) {
+      DevicePath = NextDevicePathNode (DevicePath);
+    }
+    if (IsDevicePathEnd (DevicePath)) {
+      return NULL;
+    }
+
+    if (DevicePathSubType (DevicePath) == MSG_SD_DP) {
+      Description = L"SD Device";
+    } else if (DevicePathSubType (DevicePath) == MSG_EMMC_DP) {
+      Description = L"eMMC Device";
+    } else {
+      return NULL;
+    }
+
+    Description = AllocateCopyPool (StrSize (Description), Description);
   }
 
   return Description;
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index 264d726c26..ad4901db57 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -91,6 +91,7 @@
   gEfiDiskInfoAhciInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID
   gEfiDiskInfoIdeInterfaceGuid                  ## SOMETIMES_CONSUMES ## GUID
   gEfiDiskInfoScsiInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID
+  gEfiDiskInfoSdMmcInterfaceGuid                ## SOMETIMES_CONSUMES ## GUID
 
 [Protocols]
   gEfiPciRootBridgeIoProtocolGuid               ## CONSUMES
-- 
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MdeModulePkg/UefiBootManagerLib: Generate boot description for SD/eMMC
  2017-09-05  0:33 [PATCH] MdeModulePkg/UefiBootManagerLib: Generate boot description for SD/eMMC Hao Wu
@ 2017-09-05  1:57 ` Ni, Ruiyu
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ruiyu @ 2017-09-05  1:57 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Wu, Hao A
> Sent: Tuesday, September 5, 2017 8:33 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [PATCH] MdeModulePkg/UefiBootManagerLib: Generate boot
> description for SD/eMMC
> 
> 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.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  .../Library/UefiBootManagerLib/BmBootDescription.c | 23
> ++++++++++++++++++++++
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  1 +
>  2 files changed, 24 insertions(+)
> 
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> index 7647bac2d0..d56c3e7e2c 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> @@ -155,6 +155,7 @@ BmGetDescriptionFromDiskInfo (
>    CONST UINTN                  SerialNumberLength = 20;
>    CHAR8                        *StrPtr;
>    UINT8                        Temp;
> +  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;
> 
>    Description  = NULL;
> 
> @@ -229,6 +230,28 @@ BmGetDescriptionFromDiskInfo (
> 
>        BmEliminateExtraSpaces (Description);
>      }
> +  } else if (CompareGuid (&DiskInfo->Interface,
> &gEfiDiskInfoSdMmcInterfaceGuid)) {
> +    DevicePath = DevicePathFromHandle (Handle);
> +    if (DevicePath == NULL) {
> +      return NULL;
> +    }
> +
> +    while (!IsDevicePathEnd (DevicePath) && (DevicePathType
> (DevicePath) != MESSAGING_DEVICE_PATH)) {
> +      DevicePath = NextDevicePathNode (DevicePath);
> +    }
> +    if (IsDevicePathEnd (DevicePath)) {
> +      return NULL;
> +    }
> +
> +    if (DevicePathSubType (DevicePath) == MSG_SD_DP) {
> +      Description = L"SD Device";
> +    } else if (DevicePathSubType (DevicePath) == MSG_EMMC_DP) {
> +      Description = L"eMMC Device";
> +    } else {
> +      return NULL;
> +    }
> +
> +    Description = AllocateCopyPool (StrSize (Description),
> + Description);
>    }
> 
>    return Description;
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index 264d726c26..ad4901db57 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -91,6 +91,7 @@
>    gEfiDiskInfoAhciInterfaceGuid                 ## SOMETIMES_CONSUMES ##
> GUID
>    gEfiDiskInfoIdeInterfaceGuid                  ## SOMETIMES_CONSUMES ## GUID
>    gEfiDiskInfoScsiInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID
> +  gEfiDiskInfoSdMmcInterfaceGuid                ## SOMETIMES_CONSUMES ##
> GUID
> 
>  [Protocols]
>    gEfiPciRootBridgeIoProtocolGuid               ## CONSUMES
> --
> 2.12.0.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-05  1:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05  0:33 [PATCH] MdeModulePkg/UefiBootManagerLib: Generate boot description for SD/eMMC Hao Wu
2017-09-05  1:57 ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox