/** @file\r
DevicePathToText protocol as defined in the UEFI 2.0 specification.\r
\r
-Copyright (c) 2013, 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
\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 1394 device path structure to its string representative.\r
\r
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
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 Hard drive device path structure to its string representative.\r
\r
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
\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
{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_1394_DP, DevPathToText1394 },\r
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },\r
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },\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
+ {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },\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
// 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
// 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