]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / DevicePathToText.c
index 83c3f8bc67398b34074698ce47381aac1520e55b..fb65ebd8f40a806eed35104c7f1a6aa11c54ecf0 100644 (file)
@@ -1,14 +1,9 @@
 /** @file\r
   DevicePathToText protocol as defined in the UEFI 2.0 specification.\r
 \r
-Copyright (c) 2013, 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -29,6 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 CHAR16 *\r
+EFIAPI\r
 UefiDevicePathLibCatPrint (\r
   IN OUT POOL_PRINT   *Str,\r
   IN CHAR16           *Fmt,\r
@@ -40,6 +36,7 @@ UefiDevicePathLibCatPrint (
 \r
   VA_START (Args, Fmt);\r
   Count = SPrintLength (Fmt, Args);\r
+  VA_END(Args);\r
 \r
   if ((Str->Count + (Count + 1)) * sizeof (CHAR16) > Str->Capacity) {\r
     Str->Capacity = (Str->Count + (Count + 1) * 2) * sizeof (CHAR16);\r
@@ -50,9 +47,10 @@ UefiDevicePathLibCatPrint (
                  );\r
     ASSERT (Str->Str != NULL);\r
   }\r
+  VA_START (Args, Fmt);\r
   UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args);\r
   Str->Count += Count;\r
-  \r
+\r
   VA_END (Args);\r
   return Str->Str;\r
 }\r
@@ -191,7 +189,7 @@ DevPathToTextVendor (
         UefiDevicePathLibCatPrint (Str, L"VenVt100Plus()");\r
         return ;\r
       } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {\r
-        UefiDevicePathLibCatPrint (Str, L"VenUft8()");\r
+        UefiDevicePathLibCatPrint (Str, L"VenUtf8()");\r
         return ;\r
       } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {\r
         FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);\r
@@ -305,6 +303,38 @@ DevPathToTextController (
     );\r
 }\r
 \r
+/**\r
+  Converts a BMC 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
+DevPathToTextBmc (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  BMC_DEVICE_PATH    *Bmc;\r
+\r
+  Bmc = DevPath;\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"BMC(0x%x,0x%lx)",\r
+    Bmc->InterfaceType,\r
+    ReadUnaligned64 ((UINT64 *) (&Bmc->BaseAddress))\r
+    );\r
+}\r
+\r
 /**\r
   Converts a ACPI device path structure to its string representative.\r
 \r
@@ -397,9 +427,30 @@ DevPathToTextAcpiEx (
   UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;\r
   CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;\r
 \r
+  if (DisplayOnly) {\r
+    if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A03) ||\r
+        (EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03 && EISA_ID_TO_NUM (AcpiEx->HID) != 0x0A08)) {\r
+      if (AcpiEx->UID == 0) {\r
+        UefiDevicePathLibCatPrint (Str, L"PciRoot(%a)", UIDStr);\r
+      } else {\r
+        UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", AcpiEx->UID);\r
+      }\r
+      return;\r
+    }\r
+\r
+    if (EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08 || EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A08) {\r
+      if (AcpiEx->UID == 0) {\r
+        UefiDevicePathLibCatPrint (Str, L"PcieRoot(%a)", UIDStr);\r
+      } else {\r
+        UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", AcpiEx->UID);\r
+      }\r
+      return;\r
+    }\r
+  }\r
+\r
   //\r
   // Converts EISA identification to string.\r
-  // \r
+  //\r
   UnicodeSPrint (\r
     HIDText,\r
     sizeof (HIDText),\r
@@ -419,19 +470,28 @@ DevPathToTextAcpiEx (
     (AcpiEx->CID >> 16) & 0xFFFF\r
     );\r
 \r
-  if ((*HIDStr == '\0') && (*CIDStr == '\0') && (AcpiEx->UID == 0)) {\r
+  if ((*HIDStr == '\0') && (*CIDStr == '\0') && (*UIDStr != '\0')) {\r
     //\r
     // use AcpiExp()\r
     //\r
-    UefiDevicePathLibCatPrint (\r
-      Str,\r
-      L"AcpiExp(%s,%s,%a)",\r
-      HIDText,\r
-      CIDText,\r
-      UIDStr\r
-      );\r
+    if (AcpiEx->CID == 0) {\r
+      UefiDevicePathLibCatPrint (\r
+        Str,\r
+        L"AcpiExp(%s,0,%a)",\r
+        HIDText,\r
+        UIDStr\r
+       );\r
+    } else {\r
+      UefiDevicePathLibCatPrint (\r
+        Str,\r
+        L"AcpiExp(%s,%s,%a)",\r
+        HIDText,\r
+        CIDText,\r
+        UIDStr\r
+       );\r
+    }\r
   } else {\r
-    if (AllowShortcuts) {\r
+    if (DisplayOnly) {\r
       //\r
       // display only\r
       //\r
@@ -441,16 +501,16 @@ DevPathToTextAcpiEx (
         UefiDevicePathLibCatPrint (Str, L"AcpiEx(%s,", HIDText);\r
       }\r
 \r
-      if (AcpiEx->UID == 0) {\r
-        UefiDevicePathLibCatPrint (Str, L"%a,", UIDStr);\r
+      if (AcpiEx->CID == 0) {\r
+        UefiDevicePathLibCatPrint (Str, L"%a,", CIDStr);\r
       } else {\r
-        UefiDevicePathLibCatPrint (Str, L"0x%x,", AcpiEx->UID);\r
+        UefiDevicePathLibCatPrint (Str, L"%s,", CIDText);\r
       }\r
 \r
-      if (AcpiEx->CID == 0) {\r
-        UefiDevicePathLibCatPrint (Str, L"%a)", CIDStr);\r
+      if (AcpiEx->UID == 0) {\r
+        UefiDevicePathLibCatPrint (Str, L"%a)", UIDStr);\r
       } else {\r
-        UefiDevicePathLibCatPrint (Str, L"%s)", CIDText);\r
+        UefiDevicePathLibCatPrint (Str, L"0x%x)", AcpiEx->UID);\r
       }\r
     } else {\r
       UefiDevicePathLibCatPrint (\r
@@ -695,6 +755,130 @@ DevPathToTextSasEx (
 \r
 }\r
 \r
+/**\r
+  Converts a NVM Express Namespace 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
+DevPathToTextNVMe (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  NVME_NAMESPACE_DEVICE_PATH *Nvme;\r
+  UINT8                      *Uuid;\r
+\r
+  Nvme = DevPath;\r
+  Uuid = (UINT8 *) &Nvme->NamespaceUuid;\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",\r
+    Nvme->NamespaceId,\r
+    Uuid[7], Uuid[6], Uuid[5], Uuid[4],\r
+    Uuid[3], Uuid[2], Uuid[1], Uuid[0]\r
+    );\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 EMMC (Embedded MMC) 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
+DevPathToTextEmmc (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  EMMC_DEVICE_PATH             *Emmc;\r
+\r
+  Emmc = DevPath;\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"eMMC(0x%x)",\r
+    Emmc->SlotNumber\r
+    );\r
+}\r
+\r
 /**\r
   Converts a 1394 device path structure to its string representative.\r
 \r
@@ -782,7 +966,7 @@ DevPathToTextUsbWWID (
 \r
   SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof (USB_WWID_DEVICE_PATH));\r
   Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));\r
-  if (SerialNumberStr [Length - 1] != 0) {\r
+  if (Length >= 1 && SerialNumberStr [Length - 1] != 0) {\r
     //\r
     // In case no NULL terminator in SerialNumber, create a new one with NULL terminator\r
     //\r
@@ -989,22 +1173,13 @@ DevPathToTextSata (
   SATA_DEVICE_PATH *Sata;\r
 \r
   Sata = DevPath;\r
-  if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) {\r
-    UefiDevicePathLibCatPrint (\r
-      Str,\r
-      L"Sata(0x%x,0x%x)",\r
-      Sata->HBAPortNumber,\r
-      Sata->Lun\r
-      );\r
-  } else {\r
-    UefiDevicePathLibCatPrint (\r
-      Str,\r
-      L"Sata(0x%x,0x%x,0x%x)",\r
-      Sata->HBAPortNumber,\r
-      Sata->PortMultiplierPortNumber,\r
-      Sata->Lun\r
-      );\r
-  }\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"Sata(0x%x,0x%x,0x%x)",\r
+    Sata->HBAPortNumber,\r
+    Sata->PortMultiplierPortNumber,\r
+    Sata->Lun\r
+    );\r
 }\r
 \r
 /**\r
@@ -1213,7 +1388,7 @@ DevPathToTextIPv6 (
     UefiDevicePathLibCatPrint (Str, L")");\r
     return ;\r
   }\r
-  \r
+\r
   UefiDevicePathLibCatPrint (Str, L",");\r
   CatNetworkProtocol (Str, IPDevPath->Protocol);\r
 \r
@@ -1388,18 +1563,20 @@ DevPathToTextiSCSI (
 {\r
   ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;\r
   UINT16                      Options;\r
+  UINTN                       Index;\r
 \r
   ISCSIDevPath = DevPath;\r
   UefiDevicePathLibCatPrint (\r
     Str,\r
-    L"iSCSI(%a,0x%x,0x%lx,",\r
+    L"iSCSI(%a,0x%x,0x",\r
     ISCSIDevPath->TargetName,\r
-    ISCSIDevPath->TargetPortalGroupTag,\r
-    ISCSIDevPath->Lun\r
+    ISCSIDevPath->TargetPortalGroupTag\r
     );\r
-\r
+  for (Index = 0; Index < sizeof (ISCSIDevPath->Lun) / sizeof (UINT8); Index++) {\r
+    UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *)&ISCSIDevPath->Lun)[Index]);\r
+  }\r
   Options = ISCSIDevPath->LoginOption;\r
-  UefiDevicePathLibCatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
+  UefiDevicePathLibCatPrint (Str, L",%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
   UefiDevicePathLibCatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
   if (((Options >> 11) & 0x0001) != 0) {\r
     UefiDevicePathLibCatPrint (Str, L"%s,", L"None");\r
@@ -1440,6 +1617,195 @@ 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[0],\r
+    Bluetooth->BD_ADDR.Address[1],\r
+    Bluetooth->BD_ADDR.Address[2],\r
+    Bluetooth->BD_ADDR.Address[3],\r
+    Bluetooth->BD_ADDR.Address[4],\r
+    Bluetooth->BD_ADDR.Address[5]\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
+  UINT8                 SSId[33];\r
+\r
+  WiFi = DevPath;\r
+\r
+  SSId[32] = '\0';\r
+  CopyMem (SSId, WiFi->SSId, 32);\r
+\r
+  UefiDevicePathLibCatPrint (Str, L"Wi-Fi(%a)", SSId);\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
+DevPathToTextBluetoothLE (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  BLUETOOTH_LE_DEVICE_PATH  *BluetoothLE;\r
+\r
+  BluetoothLE = DevPath;\r
+  UefiDevicePathLibCatPrint (\r
+    Str,\r
+    L"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",\r
+    BluetoothLE->Address.Address[0],\r
+    BluetoothLE->Address.Address[1],\r
+    BluetoothLE->Address.Address[2],\r
+    BluetoothLE->Address.Address[3],\r
+    BluetoothLE->Address.Address[4],\r
+    BluetoothLE->Address.Address[5],\r
+    BluetoothLE->Address.Type\r
+    );\r
+}\r
+\r
+/**\r
+  Converts a DNS 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
+DevPathToTextDns (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  DNS_DEVICE_PATH  *DnsDevPath;\r
+  UINT32           DnsServerIpCount;\r
+  UINT32           DnsServerIpIndex;\r
+\r
+  DnsDevPath     = DevPath;\r
+  DnsServerIpCount = (UINT32) (DevicePathNodeLength(DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS);\r
+\r
+  UefiDevicePathLibCatPrint (Str, L"Dns(");\r
+\r
+  for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) {\r
+    if (DnsDevPath->IsIPv6 == 0x00) {\r
+      CatIPv4Address (Str, &(DnsDevPath->DnsServerIp[DnsServerIpIndex].v4));\r
+    } else {\r
+      CatIPv6Address (Str, &(DnsDevPath->DnsServerIp[DnsServerIpIndex].v6));\r
+    }\r
+\r
+    if (DnsServerIpIndex < DnsServerIpCount - 1) {\r
+      UefiDevicePathLibCatPrint (Str, L",");\r
+    }\r
+  }\r
+\r
+  UefiDevicePathLibCatPrint (Str, L")");\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
@@ -1670,6 +2036,75 @@ DevPathRelativeOffsetRange (
     );\r
 }\r
 \r
+/**\r
+  Converts a Ram Disk 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
+DevPathToTextRamDisk (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath,\r
+  IN BOOLEAN              DisplayOnly,\r
+  IN BOOLEAN              AllowShortcuts\r
+  )\r
+{\r
+  MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;\r
+\r
+  RamDisk = DevPath;\r
+\r
+  if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid)) {\r
+    UefiDevicePathLibCatPrint (\r
+      Str,\r
+      L"VirtualDisk(0x%lx,0x%lx,%d)",\r
+      LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r
+      LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r
+      RamDisk->Instance\r
+      );\r
+  } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) {\r
+    UefiDevicePathLibCatPrint (\r
+      Str,\r
+      L"VirtualCD(0x%lx,0x%lx,%d)",\r
+      LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r
+      LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r
+      RamDisk->Instance\r
+      );\r
+  } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) {\r
+    UefiDevicePathLibCatPrint (\r
+      Str,\r
+      L"PersistentVirtualDisk(0x%lx,0x%lx,%d)",\r
+      LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r
+      LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r
+      RamDisk->Instance\r
+      );\r
+  } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) {\r
+    UefiDevicePathLibCatPrint (\r
+      Str,\r
+      L"PersistentVirtualCD(0x%lx,0x%lx,%d)",\r
+      LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r
+      LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r
+      RamDisk->Instance\r
+      );\r
+  } else {\r
+    UefiDevicePathLibCatPrint (\r
+      Str,\r
+      L"RamDisk(0x%lx,0x%lx,%d,%g)",\r
+      LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],\r
+      LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],\r
+      RamDisk->Instance,\r
+      &RamDisk->TypeGuid\r
+      );\r
+  }\r
+}\r
+\r
 /**\r
   Converts a BIOS Boot Specification device path structure to its string representative.\r
 \r
@@ -1763,6 +2198,15 @@ DevPathToTextEndInstance (
   UefiDevicePathLibCatPrint (Str, L",");\r
 }\r
 \r
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {\r
+  {HARDWARE_DEVICE_PATH,  L"HardwarePath"   },\r
+  {ACPI_DEVICE_PATH,      L"AcpiPath"       },\r
+  {MESSAGING_DEVICE_PATH, L"Msg"            },\r
+  {MEDIA_DEVICE_PATH,     L"MediaPath"      },\r
+  {BBS_DEVICE_PATH,       L"BbsPath"        },\r
+  {0, NULL}\r
+};\r
+\r
 /**\r
   Converts an unknown device path structure to its string representative.\r
 \r
@@ -1777,22 +2221,54 @@ DevPathToTextEndInstance (
 \r
 **/\r
 VOID\r
-DevPathToTextNodeUnknown (\r
+DevPathToTextNodeGeneric (\r
   IN OUT POOL_PRINT  *Str,\r
   IN VOID            *DevPath,\r
   IN BOOLEAN         DisplayOnly,\r
   IN BOOLEAN         AllowShortcuts\r
   )\r
 {\r
-  UefiDevicePathLibCatPrint (Str, L"?");\r
+  EFI_DEVICE_PATH_PROTOCOL *Node;\r
+  UINTN                    Index;\r
+\r
+  Node = DevPath;\r
+\r
+  for (Index = 0; mUefiDevicePathLibToTextTableGeneric[Index].Text != NULL; Index++) {\r
+    if (DevicePathType (Node) == mUefiDevicePathLibToTextTableGeneric[Index].Type) {\r
+      break;\r
+    }\r
+  }\r
+\r
+  if (mUefiDevicePathLibToTextTableGeneric[Index].Text == NULL) {\r
+    //\r
+    // It's a node whose type cannot be recognized\r
+    //\r
+    UefiDevicePathLibCatPrint (Str, L"Path(%d,%d", DevicePathType (Node), DevicePathSubType (Node));\r
+  } else {\r
+    //\r
+    // It's a node whose type can be recognized\r
+    //\r
+    UefiDevicePathLibCatPrint (Str, L"%s(%d", mUefiDevicePathLibToTextTableGeneric[Index].Text, DevicePathSubType (Node));\r
+  }\r
+\r
+  Index = sizeof (EFI_DEVICE_PATH_PROTOCOL);\r
+  if (Index < DevicePathNodeLength (Node)) {\r
+    UefiDevicePathLibCatPrint (Str, L",");\r
+    for (; Index < DevicePathNodeLength (Node); Index++) {\r
+      UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *) Node)[Index]);\r
+    }\r
+  }\r
+\r
+  UefiDevicePathLibCatPrint (Str, L")");\r
 }\r
 \r
-GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibDevPathToTextTable[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {\r
   {HARDWARE_DEVICE_PATH,  HW_PCI_DP,                        DevPathToTextPci            },\r
   {HARDWARE_DEVICE_PATH,  HW_PCCARD_DP,                     DevPathToTextPccard         },\r
   {HARDWARE_DEVICE_PATH,  HW_MEMMAP_DP,                     DevPathToTextMemMap         },\r
   {HARDWARE_DEVICE_PATH,  HW_VENDOR_DP,                     DevPathToTextVendor         },\r
   {HARDWARE_DEVICE_PATH,  HW_CONTROLLER_DP,                 DevPathToTextController     },\r
+  {HARDWARE_DEVICE_PATH,  HW_BMC_DP,                        DevPathToTextBmc            },\r
   {ACPI_DEVICE_PATH,      ACPI_DP,                          DevPathToTextAcpi           },\r
   {ACPI_DEVICE_PATH,      ACPI_EXTENDED_DP,                 DevPathToTextAcpiEx         },\r
   {ACPI_DEVICE_PATH,      ACPI_ADR_DP,                      DevPathToTextAcpiAdr        },\r
@@ -1801,6 +2277,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
   {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP,              DevPathToTextFibre          },\r
   {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_EMMC_DP,                      DevPathToTextEmmc           },\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
@@ -1816,6 +2296,11 @@ 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_DNS_DP,                       DevPathToTextDns            },\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
+  {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP,              DevPathToTextBluetoothLE    },\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
@@ -1824,6 +2309,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
   {MEDIA_DEVICE_PATH,     MEDIA_PIWG_FW_VOL_DP,             DevPathToTextFv             },\r
   {MEDIA_DEVICE_PATH,     MEDIA_PIWG_FW_FILE_DP,            DevPathToTextFvFile         },\r
   {MEDIA_DEVICE_PATH,     MEDIA_RELATIVE_OFFSET_RANGE_DP,   DevPathRelativeOffsetRange  },\r
+  {MEDIA_DEVICE_PATH,     MEDIA_RAM_DISK_DP,                DevPathToTextRamDisk        },\r
   {BBS_DEVICE_PATH,       BBS_BBS_DP,                       DevPathToTextBBS            },\r
   {END_DEVICE_PATH_TYPE,  END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance    },\r
   {0, 0, NULL}\r
@@ -1866,12 +2352,12 @@ UefiDevicePathLibConvertDeviceNodeToText (
   // Process the device path node\r
   // If not found, use a generic function\r
   //\r
-  ToText = DevPathToTextNodeUnknown;\r
-  for (Index = 0; mUefiDevicePathLibDevPathToTextTable[Index].Function != NULL; Index++) {\r
-    if (DevicePathType (DeviceNode) == mUefiDevicePathLibDevPathToTextTable[Index].Type &&\r
-        DevicePathSubType (DeviceNode) == mUefiDevicePathLibDevPathToTextTable[Index].SubType\r
+  ToText = DevPathToTextNodeGeneric;\r
+  for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) {\r
+    if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type &&\r
+        DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType\r
         ) {\r
-      ToText = mUefiDevicePathLibDevPathToTextTable[Index].Function;\r
+      ToText = mUefiDevicePathLibToTextTable[Index].Function;\r
       break;\r
     }\r
   }\r
@@ -1929,13 +2415,13 @@ UefiDevicePathLibConvertDevicePathToText (
     // Find the handler to dump this device path node\r
     // If not found, use a generic function\r
     //\r
-    ToText = DevPathToTextNodeUnknown;\r
-    for (Index = 0; mUefiDevicePathLibDevPathToTextTable[Index].Function != NULL; Index += 1) {\r
+    ToText = DevPathToTextNodeGeneric;\r
+    for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) {\r
 \r
-      if (DevicePathType (Node) == mUefiDevicePathLibDevPathToTextTable[Index].Type &&\r
-          DevicePathSubType (Node) == mUefiDevicePathLibDevPathToTextTable[Index].SubType\r
+      if (DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type &&\r
+          DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType\r
           ) {\r
-        ToText = mUefiDevicePathLibDevPathToTextTable[Index].Function;\r
+        ToText = mUefiDevicePathLibToTextTable[Index].Function;\r
         break;\r
       }\r
     }\r
@@ -1947,14 +2433,14 @@ UefiDevicePathLibConvertDevicePathToText (
         UefiDevicePathLibCatPrint (&Str, L"/");\r
       }\r
     }\r
-    \r
+\r
     AlignedNode = AllocateCopyPool (DevicePathNodeLength (Node), Node);\r
     //\r
     // Print this node of the device path\r
     //\r
     ToText (&Str, AlignedNode, DisplayOnly, AllowShortcuts);\r
     FreePool (AlignedNode);\r
-    \r
+\r
     //\r
     // Next device path node\r
     //\r