]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
MdePkg: Add WiFi device path definition and its node/text conversion
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / DevicePathToText.c
index 030001905b0464173e0ebd05257dd0ff3cffaf7d..68b937293eb8aad749741dcb92768fe9aabc912b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   DevicePathToText protocol as defined in the UEFI 2.0 specification.\r
 \r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -731,6 +731,64 @@ DevPathToTextNVMe (
     );\r
 }\r
 \r
+/**\r
+  Converts a UFS device path structure to its string representative.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param DevPath         The input device path structure.\r
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextUfs (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  UFS_DEVICE_PATH  *Ufs;\r
+\r
+  Ufs = DevPath;\r
+  UefiDevicePathLibCatPrint (Str, L"UFS(0x%x,0x%x)", Ufs->Pun, Ufs->Lun);\r
+}\r
+\r
+/**\r
+  Converts a SD (Secure Digital) device path structure to its string representative.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param DevPath         The input device path structure.\r
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextSd (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  SD_DEVICE_PATH             *Sd;\r
+\r
+  Sd = DevPath;\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"SD(0x%x)",\r
+    Sd->SlotNumber\r
+    );\r
+}\r
+\r
 /**\r
   Converts a 1394 device path structure to its string representative.\r
 \r
@@ -1467,6 +1525,108 @@ DevPathToTextVlan (
   UefiDevicePathLibCatPrint (Str, L"Vlan(%d)", Vlan->VlanId);\r
 }\r
 \r
+/**\r
+  Converts a Bluetooth device path structure to its string representative.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param DevPath         The input device path structure.\r
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextBluetooth (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  BLUETOOTH_DEVICE_PATH  *Bluetooth;\r
+\r
+  Bluetooth = DevPath;\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"Bluetooth(%02x:%02x:%02x:%02x:%02x:%02x)",\r
+    Bluetooth->BD_ADDR.Address[5],\r
+    Bluetooth->BD_ADDR.Address[4],\r
+    Bluetooth->BD_ADDR.Address[3],\r
+    Bluetooth->BD_ADDR.Address[2],\r
+    Bluetooth->BD_ADDR.Address[1],\r
+    Bluetooth->BD_ADDR.Address[0]\r
+    );\r
+}\r
+\r
+/**\r
+  Converts a Wi-Fi device path structure to its string representative.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param DevPath         The input device path structure.\r
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextWiFi (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  WIFI_DEVICE_PATH      *WiFi;\r
+\r
+  WiFi = DevPath;\r
+  UefiDevicePathLibCatPrint (Str, L"WiFi(%a)", WiFi->SSId);\r
+}\r
+\r
+/**\r
+  Converts a URI device path structure to its string representative.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param DevPath         The input device path structure.\r
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextUri (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  URI_DEVICE_PATH    *Uri;\r
+  UINTN              UriLength;\r
+  CHAR8              *UriStr;\r
+\r
+  //\r
+  // Uri in the device path may not be null terminated.\r
+  //\r
+  Uri       = DevPath;\r
+  UriLength = DevicePathNodeLength (Uri) - sizeof (URI_DEVICE_PATH);\r
+  UriStr = AllocatePool (UriLength + 1);\r
+  ASSERT (UriStr != NULL);\r
+\r
+  CopyMem (UriStr, Uri->Uri, UriLength);\r
+  UriStr[UriLength] = '\0';\r
+  UefiDevicePathLibCatPrint (Str, L"Uri(%a)", UriStr);\r
+  FreePool (UriStr);\r
+}\r
+\r
 /**\r
   Converts a Hard drive device path structure to its string representative.\r
 \r
@@ -1869,6 +2029,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
   {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP,            DevPathToTextFibreEx        },\r
   {MESSAGING_DEVICE_PATH, MSG_SASEX_DP,                     DevPathToTextSasEx          },\r
   {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP,            DevPathToTextNVMe           },\r
+  {MESSAGING_DEVICE_PATH, MSG_UFS_DP,                       DevPathToTextUfs            },\r
+  {MESSAGING_DEVICE_PATH, MSG_SD_DP,                        DevPathToTextSd             },\r
   {MESSAGING_DEVICE_PATH, MSG_1394_DP,                      DevPathToText1394           },\r
   {MESSAGING_DEVICE_PATH, MSG_USB_DP,                       DevPathToTextUsb            },\r
   {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP,                  DevPathToTextUsbWWID        },\r
@@ -1884,6 +2046,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
   {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP,                    DevPathToTextVendor         },\r
   {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP,                     DevPathToTextiSCSI          },\r
   {MESSAGING_DEVICE_PATH, MSG_VLAN_DP,                      DevPathToTextVlan           },\r
+  {MESSAGING_DEVICE_PATH, MSG_URI_DP,                       DevPathToTextUri            },\r
+  {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP,                 DevPathToTextBluetooth      },\r
+  {MESSAGING_DEVICE_PATH, MSG_WIFI_DP,                      DevPathToTextWiFi           },\r
   {MEDIA_DEVICE_PATH,     MEDIA_HARDDRIVE_DP,               DevPathToTextHardDrive      },\r
   {MEDIA_DEVICE_PATH,     MEDIA_CDROM_DP,                   DevPathToTextCDROM          },\r
   {MEDIA_DEVICE_PATH,     MEDIA_VENDOR_DP,                  DevPathToTextVendor         },\r