]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
Remove the redundancy commas when converting the SASEx device path node to text.
[mirror_edk2.git] / MdeModulePkg / Universal / DevicePathDxe / DevicePathToText.c
index 5de21b1f9d9b954bf2eebac25c0d986d88fcbfe7..1f90f64204a79b370aad39734307686a1934a93b 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   DevicePathToText protocol as defined in the UEFI 2.0 specification.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2011, 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
@@ -29,6 +29,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 CHAR16 *\r
+EFIAPI\r
 CatPrint (\r
   IN OUT POOL_PRINT   *Str,\r
   IN CHAR16           *Fmt,\r
@@ -36,36 +37,32 @@ CatPrint (
   )\r
 {\r
   UINT16  *AppendStr;\r
+  UINTN   AppendCount;\r
   VA_LIST Args;\r
-  UINTN   Size;\r
 \r
   AppendStr = AllocateZeroPool (0x1000);\r
-  if (AppendStr == NULL) {\r
-    return Str->Str;\r
-  }\r
+  ASSERT (AppendStr != NULL);\r
 \r
   VA_START (Args, Fmt);\r
-  UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);\r
+  AppendCount = UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);\r
   VA_END (Args);\r
-  if (NULL == Str->Str) {\r
-    Size   = StrSize (AppendStr);\r
-    Str->Str  = AllocateZeroPool (Size);\r
-    ASSERT (Str->Str != NULL);\r
-  } else {\r
-    Size = StrSize (AppendStr) - sizeof (UINT16);\r
-    Size = Size + StrSize (Str->Str);\r
+\r
+  if (Str->Length + AppendCount * sizeof (CHAR16) > Str->Capacity) {\r
+    Str->Capacity = Str->Length + (AppendCount + 1) * sizeof (CHAR16) * 2;\r
     Str->Str = ReallocatePool (\r
-                StrSize (Str->Str),\r
-                Size,\r
-                Str->Str\r
-                );\r
+                 Str->Length,\r
+                 Str->Capacity,\r
+                 Str->Str\r
+                 );\r
     ASSERT (Str->Str != NULL);\r
   }\r
 \r
-  Str->MaxLen = MAX_CHAR * sizeof (UINT16);\r
-  if (Size < Str->MaxLen) {\r
+  if (Str->Length == 0) {\r
+    StrCpy (Str->Str, AppendStr);\r
+    Str->Length = (AppendCount + 1) * sizeof (CHAR16);\r
+  } else {\r
     StrCat (Str->Str, AppendStr);\r
-    Str->Len = Size - sizeof (UINT16);\r
+    Str->Length += AppendCount * sizeof (CHAR16);\r
   }\r
 \r
   FreePool (AppendStr);\r
@@ -73,9 +70,9 @@ CatPrint (
 }\r
 \r
 /**\r
-  Converts a PCI device path structure to its string representive.\r
+  Converts a PCI device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -100,9 +97,9 @@ DevPathToTextPci (
 }\r
 \r
 /**\r
-  Converts a PC Card device path structure to its string representive.\r
+  Converts a PC Card device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -127,9 +124,9 @@ DevPathToTextPccard (
 }\r
 \r
 /**\r
-  Converts a Memory Map device path structure to its string representive.\r
+  Converts a Memory Map device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -160,9 +157,9 @@ DevPathToTextMemMap (
 }\r
 \r
 /**\r
-  Converts a Vendor device path structure to its string representive.\r
+  Converts a Vendor device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -208,7 +205,7 @@ DevPathToTextVendor (
       } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {\r
         CatPrint (Str, L"VenUft8()");\r
         return ;\r
-      } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingUartFlowControlGuid)) {\r
+      } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {\r
         FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);\r
         switch (FlowControlMap & 0x00000003) {\r
         case 0:\r
@@ -228,7 +225,7 @@ DevPathToTextVendor (
         }\r
 \r
         return ;\r
-      } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingSASGuid)) {\r
+      } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {\r
         CatPrint (\r
           Str,\r
           L"SAS(0x%lx,0x%lx,0x%x,",\r
@@ -287,9 +284,9 @@ DevPathToTextVendor (
 }\r
 \r
 /**\r
-  Converts a Controller device path structure to its string representive.\r
+  Converts a Controller device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -318,9 +315,9 @@ DevPathToTextController (
 }\r
 \r
 /**\r
-  Converts a ACPI device path structure to its string representive.\r
+  Converts a ACPI device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -347,6 +344,10 @@ DevPathToTextAcpi (
       CatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);\r
       break;\r
 \r
+    case 0x0a08:\r
+      CatPrint (Str, L"PcieRoot(0x%x)", Acpi->UID);\r
+      break;\r
+\r
     case 0x0604:\r
       CatPrint (Str, L"Floppy(0x%x)", Acpi->UID);\r
       break;\r
@@ -404,9 +405,9 @@ EisaIdToText (
 }\r
 \r
 /**\r
-  Converts a ACPI extended HID device path structure to its string representive.\r
+  Converts a ACPI extended HID device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -488,9 +489,9 @@ DevPathToTextAcpiEx (
 }\r
 \r
 /**\r
-  Converts a ACPI address device path structure to its string representive.\r
+  Converts a ACPI address device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -525,9 +526,9 @@ DevPathToTextAcpiAdr (
 }\r
 \r
 /**\r
-  Converts a ATAPI device path structure to its string representive.\r
+  Converts a ATAPI device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -555,17 +556,17 @@ DevPathToTextAtapi (
     CatPrint (\r
       Str,\r
       L"Ata(%s,%s,0x%x)",\r
-      Atapi->PrimarySecondary ? L"Secondary" : L"Primary",\r
-      Atapi->SlaveMaster ? L"Slave" : L"Master",\r
+      (Atapi->PrimarySecondary == 1) ? L"Secondary" : L"Primary",\r
+      (Atapi->SlaveMaster == 1) ? L"Slave" : L"Master",\r
       Atapi->Lun\r
       );\r
   }\r
 }\r
 \r
 /**\r
-  Converts a SCSI device path structure to its string representive.\r
+  Converts a SCSI device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -590,9 +591,9 @@ DevPathToTextScsi (
 }\r
 \r
 /**\r
-  Converts a Fibre device path structure to its string representive.\r
+  Converts a Fibre device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -617,9 +618,105 @@ DevPathToTextFibre (
 }\r
 \r
 /**\r
-  Converts a 1394 device path structure to its string representive.\r
+  Converts a FibreEx device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
+DevPathToTextFibreEx (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  FIBRECHANNELEX_DEVICE_PATH  *FibreEx;\r
+  UINTN                       Index;\r
+\r
+  FibreEx = DevPath;\r
+  CatPrint (Str, L"FibreEx(0x");\r
+  for (Index = 0; Index < sizeof (FibreEx->WWN) / sizeof (FibreEx->WWN[0]); Index++) {\r
+    CatPrint (Str, L"%02x", FibreEx->WWN[Index]);\r
+  }\r
+  CatPrint (Str, L",0x");\r
+  for (Index = 0; Index < sizeof (FibreEx->Lun) / sizeof (FibreEx->Lun[0]); Index++) {\r
+    CatPrint (Str, L"%02x", FibreEx->Lun[Index]);\r
+  }\r
+  CatPrint (Str, L")");\r
+}\r
+\r
+/**\r
+  Converts a Sas Ex 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
+DevPathToTextSasEx (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  SASEX_DEVICE_PATH  *SasEx;\r
+  UINTN              Index;\r
+\r
+  SasEx = DevPath;\r
+  CatPrint (Str, L"SasEx(0x");\r
+\r
+  for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {\r
+    CatPrint (Str, L"%02x", SasEx->SasAddress[Index]);\r
+  }\r
+  CatPrint (Str, L",0x");\r
+  for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {\r
+    CatPrint (Str, L"%02x", SasEx->Lun[Index]);\r
+  }\r
+  CatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);\r
+\r
+  if ((SasEx->DeviceTopology & 0x0f) == 0) {\r
+    CatPrint (Str, L"NoTopology,0,0,0");\r
+  } else if (((SasEx->DeviceTopology & 0x0f) == 1) || ((SasEx->DeviceTopology & 0x0f) == 2)) {\r
+    CatPrint (\r
+      Str,\r
+      L"%s,%s,%s,",\r
+      ((SasEx->DeviceTopology & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",\r
+      ((SasEx->DeviceTopology & (0x1 << 5)) != 0) ? L"External" : L"Internal",\r
+      ((SasEx->DeviceTopology & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"\r
+      );\r
+    if ((SasEx->DeviceTopology & 0x0f) == 1) {\r
+      CatPrint (Str, L"0");\r
+    } else {\r
+      CatPrint (Str, L"0x%x", (SasEx->DeviceTopology >> 8) & 0xff);\r
+    }\r
+  } else {\r
+    CatPrint (Str, L"0,0,0,0");\r
+  }\r
+\r
+  CatPrint (Str, L")");\r
+  return ;\r
+\r
+}\r
+\r
+/**\r
+  Converts a 1394 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
@@ -647,9 +744,9 @@ DevPathToText1394 (
 }\r
 \r
 /**\r
-  Converts a USB device path structure to its string representive.\r
+  Converts a USB device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -674,9 +771,9 @@ DevPathToTextUsb (
 }\r
 \r
 /**\r
-  Converts a USB WWID device path structure to its string representive.\r
+  Converts a USB WWID device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -708,6 +805,7 @@ DevPathToTextUsbWWID (
     // In case no NULL terminator in SerialNumber, create a new one with NULL terminator\r
     //\r
     NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);\r
+    ASSERT (NewStr != NULL);\r
     NewStr [Length] = 0;\r
     SerialNumberStr = NewStr;\r
   }\r
@@ -723,9 +821,9 @@ DevPathToTextUsbWWID (
 }\r
 \r
 /**\r
-  Converts a Logic Unit device path structure to its string representive.\r
+  Converts a Logic Unit device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -750,9 +848,9 @@ DevPathToTextLogicalUnit (
 }\r
 \r
 /**\r
-  Converts a USB class device path structure to its string representive.\r
+  Converts a USB class device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -886,9 +984,9 @@ DevPathToTextUsbClass (
 }\r
 \r
 /**\r
-  Converts a SATA device path structure to its string representive.\r
+  Converts a SATA device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -909,19 +1007,28 @@ DevPathToTextSata (
   SATA_DEVICE_PATH *Sata;\r
 \r
   Sata = DevPath;\r
-  CatPrint (\r
-    Str,\r
-    L"Sata(0x%x,0x%x,0x%x)",\r
-    (UINTN) Sata->HBAPortNumber,\r
-    (UINTN) Sata->PortMultiplierPortNumber,\r
-    (UINTN) Sata->Lun\r
-    );\r
+  if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) {\r
+    CatPrint (\r
+      Str,\r
+      L"Sata(0x%x,0x%x)",\r
+      Sata->HBAPortNumber,\r
+      Sata->Lun\r
+      );\r
+  } else {\r
+    CatPrint (\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
 /**\r
-  Converts a I20 device path structure to its string representive.\r
+  Converts a I20 device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -946,9 +1053,9 @@ DevPathToTextI2O (
 }\r
 \r
 /**\r
-  Converts a MAC address device path structure to its string representive.\r
+  Converts a MAC address device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -987,9 +1094,31 @@ DevPathToTextMacAddr (
 }\r
 \r
 /**\r
-  Converts a IPv4 device path structure to its string representive.\r
+  Converts network protocol string to its text representation.\r
+\r
+  @param Str             The string representative of input device.\r
+  @param Protocol        The network protocol ID.\r
+\r
+**/\r
+VOID\r
+CatNetworkProtocol (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN UINT16          Protocol\r
+  )\r
+{\r
+  if (Protocol == RFC_1700_TCP_PROTOCOL) {\r
+    CatPrint (Str, L"TCP");\r
+  } else if (Protocol == RFC_1700_UDP_PROTOCOL) {\r
+    CatPrint (Str, L"UDP");\r
+  } else {\r
+    CatPrint (Str, L"0x%x", Protocol);\r
+  }\r
+}\r
+\r
+/**\r
+  Converts a IPv4 device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1024,24 +1153,48 @@ DevPathToTextIPv4 (
 \r
   CatPrint (\r
     Str,\r
-    L"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",\r
+    L"IPv4(%d.%d.%d.%d,",\r
     IPDevPath->RemoteIpAddress.Addr[0],\r
     IPDevPath->RemoteIpAddress.Addr[1],\r
     IPDevPath->RemoteIpAddress.Addr[2],\r
-    IPDevPath->RemoteIpAddress.Addr[3],\r
-    IPDevPath->Protocol ? L"TCP" : L"UDP",\r
-    (IPDevPath->StaticIpAddress == TRUE) ? L"Static" : L"DHCP",\r
+    IPDevPath->RemoteIpAddress.Addr[3]\r
+    );\r
+\r
+  CatNetworkProtocol (\r
+    Str,\r
+    IPDevPath->Protocol\r
+    );\r
+\r
+  CatPrint (\r
+    Str,\r
+    L",%s,%d.%d.%d.%d",\r
+    IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",\r
     IPDevPath->LocalIpAddress.Addr[0],\r
     IPDevPath->LocalIpAddress.Addr[1],\r
     IPDevPath->LocalIpAddress.Addr[2],\r
     IPDevPath->LocalIpAddress.Addr[3]\r
     );\r
+  if (DevicePathNodeLength (IPDevPath) == sizeof (IPv4_DEVICE_PATH)) {\r
+    CatPrint (\r
+      Str,\r
+      L",%d.%d.%d.%d,%d.%d.%d.%d",\r
+      IPDevPath->GatewayIpAddress.Addr[0],\r
+      IPDevPath->GatewayIpAddress.Addr[1],\r
+      IPDevPath->GatewayIpAddress.Addr[2],\r
+      IPDevPath->GatewayIpAddress.Addr[3],\r
+      IPDevPath->SubnetMask.Addr[0],\r
+      IPDevPath->SubnetMask.Addr[1],\r
+      IPDevPath->SubnetMask.Addr[2],\r
+      IPDevPath->SubnetMask.Addr[3]\r
+      );\r
+  }\r
+  CatPrint (Str, L")");\r
 }\r
 \r
 /**\r
-  Converts a IPv6 device path structure to its string representive.\r
+  Converts a IPv6 device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1088,7 +1241,7 @@ DevPathToTextIPv6 (
 \r
   CatPrint (\r
     Str,\r
-    L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,%s,%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",\r
+    L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",\r
     IPDevPath->RemoteIpAddress.Addr[0],\r
     IPDevPath->RemoteIpAddress.Addr[1],\r
     IPDevPath->RemoteIpAddress.Addr[2],\r
@@ -1104,9 +1257,29 @@ DevPathToTextIPv6 (
     IPDevPath->RemoteIpAddress.Addr[12],\r
     IPDevPath->RemoteIpAddress.Addr[13],\r
     IPDevPath->RemoteIpAddress.Addr[14],\r
-    IPDevPath->RemoteIpAddress.Addr[15],\r
-    IPDevPath->Protocol ? L"TCP" : L"UDP",\r
-    (IPDevPath->StaticIpAddress == TRUE) ? L"Static" : L"DHCP",\r
+    IPDevPath->RemoteIpAddress.Addr[15]\r
+    );\r
+    \r
+  CatNetworkProtocol (\r
+    Str,\r
+    IPDevPath->Protocol\r
+    );\r
+\r
+  switch (IPDevPath->IpAddressOrigin) {\r
+    case 0:\r
+      CatPrint (Str, L",Static");\r
+      break;\r
+    case 1:\r
+      CatPrint (Str, L",StatelessAutoConfigure");\r
+      break;\r
+    default:\r
+      CatPrint (Str, L",StatefulAutoConfigure");\r
+      break;\r
+  }\r
+\r
+  CatPrint (\r
+    Str,\r
+    L",%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",\r
     IPDevPath->LocalIpAddress.Addr[0],\r
     IPDevPath->LocalIpAddress.Addr[1],\r
     IPDevPath->LocalIpAddress.Addr[2],\r
@@ -1124,12 +1297,37 @@ DevPathToTextIPv6 (
     IPDevPath->LocalIpAddress.Addr[14],\r
     IPDevPath->LocalIpAddress.Addr[15]\r
     );\r
+\r
+  if (DevicePathNodeLength (IPDevPath) == sizeof (IPv6_DEVICE_PATH)) {\r
+    CatPrint (\r
+      Str,\r
+      L",0x%x,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",\r
+      IPDevPath->PrefixLength,\r
+      IPDevPath->GatewayIpAddress.Addr[0],\r
+      IPDevPath->GatewayIpAddress.Addr[1],\r
+      IPDevPath->GatewayIpAddress.Addr[2],\r
+      IPDevPath->GatewayIpAddress.Addr[3],\r
+      IPDevPath->GatewayIpAddress.Addr[4],\r
+      IPDevPath->GatewayIpAddress.Addr[5],\r
+      IPDevPath->GatewayIpAddress.Addr[6],\r
+      IPDevPath->GatewayIpAddress.Addr[7],\r
+      IPDevPath->GatewayIpAddress.Addr[8],\r
+      IPDevPath->GatewayIpAddress.Addr[9],\r
+      IPDevPath->GatewayIpAddress.Addr[10],\r
+      IPDevPath->GatewayIpAddress.Addr[11],\r
+      IPDevPath->GatewayIpAddress.Addr[12],\r
+      IPDevPath->GatewayIpAddress.Addr[13],\r
+      IPDevPath->GatewayIpAddress.Addr[14],\r
+      IPDevPath->GatewayIpAddress.Addr[15]\r
+      );\r
+  }\r
+  CatPrint (Str, L")");\r
 }\r
 \r
 /**\r
-  Converts an Infini Band device path structure to its string representive.\r
+  Converts an Infini Band device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1162,9 +1360,9 @@ DevPathToTextInfiniBand (
 }\r
 \r
 /**\r
-  Converts a UART device path structure to its string representive.\r
+  Converts a UART device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1254,9 +1452,9 @@ DevPathToTextUart (
 }\r
 \r
 /**\r
-  Converts an iSCSI device path structure to its string representive.\r
+  Converts an iSCSI device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1281,7 +1479,7 @@ DevPathToTextiSCSI (
   CatPrint (\r
     Str,\r
     L"iSCSI(%a,0x%x,0x%lx,",\r
-    ISCSIDevPath->iSCSITargetName,\r
+    ISCSIDevPath->TargetName,\r
     ISCSIDevPath->TargetPortalGroupTag,\r
     ISCSIDevPath->Lun\r
     );\r
@@ -1302,9 +1500,36 @@ DevPathToTextiSCSI (
 }\r
 \r
 /**\r
-  Converts a Hard drive device path structure to its string representive.\r
+  Converts a VLAN device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
+DevPathToTextVlan (\r
+  IN OUT POOL_PRINT  *Str,\r
+  IN VOID            *DevPath,\r
+  IN BOOLEAN         DisplayOnly,\r
+  IN BOOLEAN         AllowShortcuts\r
+  )\r
+{\r
+  VLAN_DEVICE_PATH  *Vlan;\r
+\r
+  Vlan = DevPath;\r
+  CatPrint (Str, L"Vlan(%d)", Vlan->VlanId);\r
+}\r
+\r
+/**\r
+  Converts a Hard drive 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
@@ -1360,9 +1585,9 @@ DevPathToTextHardDrive (
 }\r
 \r
 /**\r
-  Converts a CDROM device path structure to its string representive.\r
+  Converts a CDROM device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1392,9 +1617,9 @@ DevPathToTextCDROM (
 }\r
 \r
 /**\r
-  Converts a File device path structure to its string representive.\r
+  Converts a File device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1419,9 +1644,9 @@ DevPathToTextFilePath (
 }\r
 \r
 /**\r
-  Converts a Media protocol device path structure to its string representive.\r
+  Converts a Media protocol device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1446,9 +1671,9 @@ DevPathToTextMediaProtocol (
 }\r
 \r
 /**\r
-  Converts a Firmware Volume device path structure to its string representive.\r
+  Converts a Firmware Volume device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1473,9 +1698,9 @@ DevPathToTextFv (
 }\r
 \r
 /**\r
-  Converts a Firmware Volume File device path structure to its string representive.\r
+  Converts a Firmware Volume File device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1500,9 +1725,41 @@ DevPathToTextFvFile (
 }\r
 \r
 /**\r
-  Converts a BIOS Boot Specification device path structure to its string representive.\r
+  Converts a Relative Offset 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
+DevPathRelativeOffsetRange (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath,\r
+  IN BOOLEAN              DisplayOnly,\r
+  IN BOOLEAN              AllowShortcuts\r
+  )\r
+{\r
+  MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;\r
+\r
+  Offset = DevPath;\r
+  CatPrint (\r
+    Str,\r
+    L"Offset(0x%lx,0x%lx)",\r
+    Offset->StartingOffset,\r
+    Offset->EndingOffset\r
+    );\r
+}\r
+\r
+/**\r
+  Converts a BIOS Boot Specification device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1569,9 +1826,9 @@ DevPathToTextBBS (
 }\r
 \r
 /**\r
-  Converts an End-of-Device-Path structure to its string representive.\r
+  Converts an End-of-Device-Path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1593,9 +1850,9 @@ DevPathToTextEndInstance (
 }\r
 \r
 /**\r
-  Converts an unknown device path structure to its string representive.\r
+  Converts an unknown device path structure to its string representative.\r
 \r
-  @param Str             The string representive of input device.\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
@@ -1628,6 +1885,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
   {MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi},\r
   {MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},\r
   {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_1394_DP, DevPathToText1394},\r
   {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb},\r
   {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID},\r
@@ -1642,14 +1901,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
   {MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart},\r
   {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor},\r
   {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI},\r
+  {MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan},\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
-  {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},\r
   {MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol},\r
   {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},\r
   {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
   {BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS},\r
   {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance},\r
   {0, 0, NULL}\r
@@ -1680,7 +1940,6 @@ ConvertDeviceNodeToText (
 {\r
   POOL_PRINT  Str;\r
   UINTN       Index;\r
-  UINTN       NewSize;\r
   VOID        (*DumpNode)(POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);\r
 \r
   if (DeviceNode == NULL) {\r
@@ -1713,13 +1972,7 @@ ConvertDeviceNodeToText (
   //\r
   DumpNode (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts);\r
 \r
-  //\r
-  // Shrink pool used for string allocation\r
-  //\r
-  NewSize = (Str.Len + 1) * sizeof (CHAR16);\r
-  Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);\r
   ASSERT (Str.Str != NULL);\r
-  Str.Str[Str.Len] = 0;\r
   return Str.Str;\r
 }\r
 \r
@@ -1750,7 +2003,6 @@ ConvertDevicePathToText (
   EFI_DEVICE_PATH_PROTOCOL  *DevPathNode;\r
   EFI_DEVICE_PATH_PROTOCOL  *AlignedDevPathNode;\r
   UINTN                     Index;\r
-  UINTN                     NewSize;\r
   VOID                      (*DumpNode) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);\r
 \r
   if (DevicePath == NULL) {\r
@@ -1768,7 +2020,7 @@ ConvertDevicePathToText (
     // Find the handler to dump this device path node\r
     //\r
     DumpNode = NULL;\r
-    for (Index = 0; DevPathToTextTable[Index].Function; Index += 1) {\r
+    for (Index = 0; DevPathToTextTable[Index].Function != NULL; Index += 1) {\r
 \r
       if (DevicePathType (DevPathNode) == DevPathToTextTable[Index].Type &&\r
           DevicePathSubType (DevPathNode) == DevPathToTextTable[Index].SubType\r
@@ -1784,10 +2036,10 @@ ConvertDevicePathToText (
       DumpNode = DevPathToTextNodeUnknown;\r
     }\r
     //\r
-    //  Put a path seperator in if needed\r
+    //  Put a path separator in if needed\r
     //\r
-    if ((Str.Len != 0) && DumpNode != DevPathToTextEndInstance) {\r
-      if (*(Str.Str + Str.Len / sizeof (CHAR16) - 1) != L',') {\r
+    if ((Str.Length != 0) && (DumpNode != DevPathToTextEndInstance)) {\r
+      if (*(Str.Str + Str.Length / sizeof (CHAR16) - 1) != L',') {\r
         CatPrint (&Str, L"/");\r
       }\r
     }\r
@@ -1805,9 +2057,9 @@ ConvertDevicePathToText (
     DevPathNode = NextDevicePathNode (DevPathNode);\r
   }\r
 \r
-  NewSize = (Str.Len + 1) * sizeof (CHAR16);\r
-  Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);\r
-  ASSERT (Str.Str != NULL);\r
-  Str.Str[Str.Len] = 0;\r
-  return Str.Str;\r
+  if (Str.Str == NULL) {\r
+    return AllocateZeroPool (sizeof (CHAR16));\r
+  } else {\r
+    return Str.Str;\r
+  }\r
 }\r