This device path node is introduced in UEFI2.6 spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.t...@intel.com>
---
 MdePkg/Include/Protocol/DevicePath.h               | 11 ++++++++
 .../Library/UefiDevicePathLib/DevicePathFromText.c | 29 ++++++++++++++++++++
 .../Library/UefiDevicePathLib/DevicePathToText.c   | 32 ++++++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/MdePkg/Include/Protocol/DevicePath.h 
b/MdePkg/Include/Protocol/DevicePath.h
index 631136be..9a9ad2c 100644
--- a/MdePkg/Include/Protocol/DevicePath.h
+++ b/MdePkg/Include/Protocol/DevicePath.h
@@ -855,6 +855,15 @@ typedef struct {
 } SD_DEVICE_PATH;
 
 ///
+/// EMMC (Embedded MMC) Device Path SubType.
+///
+#define MSG_EMMC_DP                 0x1D
+typedef struct {
+  EFI_DEVICE_PATH_PROTOCOL        Header;
+  UINT8                           SlotNumber;
+} EMMC_DEVICE_PATH;
+
+///
 /// iSCSI Device Path SubType
 ///
 #define MSG_ISCSI_DP              0x13
@@ -1239,6 +1248,7 @@ typedef union {
   WIFI_DEVICE_PATH                           WiFi;
   UFS_DEVICE_PATH                            Ufs;
   SD_DEVICE_PATH                             Sd;
+  EMMC_DEVICE_PATH                           Emmc;
   HARDDRIVE_DEVICE_PATH                      HardDrive;
   CDROM_DEVICE_PATH                          CD;
 
@@ -1295,6 +1305,7 @@ typedef union {
   WIFI_DEVICE_PATH                           *WiFi;
   UFS_DEVICE_PATH                            *Ufs;
   SD_DEVICE_PATH                             *Sd;
+  EMMC_DEVICE_PATH                           *Emmc;
   HARDDRIVE_DEVICE_PATH                      *HardDrive;
   CDROM_DEVICE_PATH                          *CD;
 
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index 6a9b389..961ccb5 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -1903,6 +1903,34 @@ DevPathFromTextSd (
 }
 
 /**
+  Converts a text device path node to EMMC (Embedded MMC) device path 
structure.
+
+  @param TextDeviceNode  The input Text device path node.
+
+  @return A pointer to the newly-created EMMC device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextEmmc (
+  IN CHAR16 *TextDeviceNode
+  )
+{
+  CHAR16            *SlotNumberStr;
+  EMMC_DEVICE_PATH  *Emmc;
+
+  SlotNumberStr = GetNextParamStr (&TextDeviceNode);
+  Emmc          = (EMMC_DEVICE_PATH *) CreateDeviceNode (
+                                       MESSAGING_DEVICE_PATH,
+                                       MSG_EMMC_DP,
+                                       (UINT16) sizeof (EMMC_DEVICE_PATH)
+                                       );
+
+  Emmc->SlotNumber = (UINT8) Strtoi (SlotNumberStr);
+
+  return (EFI_DEVICE_PATH_PROTOCOL *) Emmc;
+}
+
+/**
   Converts a text device path node to Debug Port device path structure.
 
   @param TextDeviceNode  The input Text device path node.
@@ -3501,6 +3529,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE 
mUefiDevicePathLibDevP
   {L"NVMe",                    DevPathFromTextNVMe                    },
   {L"UFS",                     DevPathFromTextUfs                     },
   {L"SD",                      DevPathFromTextSd                      },
+  {L"Emmc",                    DevPathFromTextEmmc                    },
   {L"DebugPort",               DevPathFromTextDebugPort               },
   {L"MAC",                     DevPathFromTextMAC                     },
   {L"IPv4",                    DevPathFromTextIPv4                    },
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index 363830b..92db3b1 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -823,6 +823,37 @@ DevPathToTextSd (
 }
 
 /**
+  Converts a EMMC (Embedded MMC) device path structure to its string 
representative.
+
+  @param Str             The string representative of input device.
+  @param DevPath         The input device path structure.
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text 
representation
+                         of the display node is used, where applicable. If 
DisplayOnly
+                         is FALSE, then the longer text representation of the 
display node
+                         is used.
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of 
text
+                         representation for a device node can be used, where 
applicable.
+
+**/
+VOID
+DevPathToTextEmmc (
+  IN OUT POOL_PRINT  *Str,
+  IN VOID            *DevPath,
+  IN BOOLEAN         DisplayOnly,
+  IN BOOLEAN         AllowShortcuts
+  )
+{
+  EMMC_DEVICE_PATH             *Emmc;
+
+  Emmc = DevPath;
+  UefiDevicePathLibCatPrint (
+    Str,
+    L"Emmc(0x%x)",
+    Emmc->SlotNumber
+    );
+}
+
+/**
   Converts a 1394 device path structure to its string representative.
 
   @param Str             The string representative of input device.
@@ -2139,6 +2170,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const 
DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
   {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP,            DevPathToTextNVMe  
         },
   {MESSAGING_DEVICE_PATH, MSG_UFS_DP,                       DevPathToTextUfs   
         },
   {MESSAGING_DEVICE_PATH, MSG_SD_DP,                        DevPathToTextSd    
         },
+  {MESSAGING_DEVICE_PATH, MSG_EMMC_DP,                      DevPathToTextEmmc  
         },
   {MESSAGING_DEVICE_PATH, MSG_1394_DP,                      DevPathToText1394  
         },
   {MESSAGING_DEVICE_PATH, MSG_USB_DP,                       DevPathToTextUsb   
         },
   {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP,                  
DevPathToTextUsbWWID        },
-- 
2.7.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to