summaryrefslogtreecommitdiff
path: root/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/UefiDevicePathLib/DevicePathToText.c')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathToText.c68
1 files changed, 54 insertions, 14 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index eebdbf239..9b1ca8e28 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -1,7 +1,7 @@
/** @file
DevicePathToText protocol as defined in the UEFI 2.0 specification.
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1755,6 +1755,15 @@ DevPathToTextEndInstance (
UefiDevicePathLibCatPrint (Str, L",");
}
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {
+ {HARDWARE_DEVICE_PATH, L"HardwarePath" },
+ {ACPI_DEVICE_PATH, L"AcpiPath" },
+ {MESSAGING_DEVICE_PATH, L"Msg" },
+ {MEDIA_DEVICE_PATH, L"MediaPath" },
+ {BBS_DEVICE_PATH, L"BbsPath" },
+ {0, NULL}
+};
+
/**
Converts an unknown device path structure to its string representative.
@@ -1769,17 +1778,48 @@ DevPathToTextEndInstance (
**/
VOID
-DevPathToTextNodeUnknown (
+DevPathToTextNodeGeneric (
IN OUT POOL_PRINT *Str,
IN VOID *DevPath,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
)
{
- UefiDevicePathLibCatPrint (Str, L"?");
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ UINTN Index;
+
+ Node = DevPath;
+
+ for (Index = 0; mUefiDevicePathLibToTextTableGeneric[Index].Text != NULL; Index++) {
+ if (DevicePathType (Node) == mUefiDevicePathLibToTextTableGeneric[Index].Type) {
+ break;
+ }
+ }
+
+ if (mUefiDevicePathLibToTextTableGeneric[Index].Text == NULL) {
+ //
+ // It's a node whose type cannot be recognized
+ //
+ UefiDevicePathLibCatPrint (Str, L"Path(%d,%d", DevicePathType (Node), DevicePathSubType (Node));
+ } else {
+ //
+ // It's a node whose type can be recognized
+ //
+ UefiDevicePathLibCatPrint (Str, L"%s(%d", mUefiDevicePathLibToTextTableGeneric[Index].Text, DevicePathSubType (Node));
+ }
+
+ Index = sizeof (EFI_DEVICE_PATH_PROTOCOL);
+ if (Index < DevicePathNodeLength (Node)) {
+ UefiDevicePathLibCatPrint (Str, L",");
+ for (; Index < DevicePathNodeLength (Node); Index++) {
+ UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *) Node)[Index]);
+ }
+ }
+
+ UefiDevicePathLibCatPrint (Str, L")");
}
-GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibDevPathToTextTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {
{HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },
{HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },
@@ -1858,12 +1898,12 @@ UefiDevicePathLibConvertDeviceNodeToText (
// Process the device path node
// If not found, use a generic function
//
- ToText = DevPathToTextNodeUnknown;
- for (Index = 0; mUefiDevicePathLibDevPathToTextTable[Index].Function != NULL; Index++) {
- if (DevicePathType (DeviceNode) == mUefiDevicePathLibDevPathToTextTable[Index].Type &&
- DevicePathSubType (DeviceNode) == mUefiDevicePathLibDevPathToTextTable[Index].SubType
+ ToText = DevPathToTextNodeGeneric;
+ for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) {
+ if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type &&
+ DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType
) {
- ToText = mUefiDevicePathLibDevPathToTextTable[Index].Function;
+ ToText = mUefiDevicePathLibToTextTable[Index].Function;
break;
}
}
@@ -1921,13 +1961,13 @@ UefiDevicePathLibConvertDevicePathToText (
// Find the handler to dump this device path node
// If not found, use a generic function
//
- ToText = DevPathToTextNodeUnknown;
- for (Index = 0; mUefiDevicePathLibDevPathToTextTable[Index].Function != NULL; Index += 1) {
+ ToText = DevPathToTextNodeGeneric;
+ for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) {
- if (DevicePathType (Node) == mUefiDevicePathLibDevPathToTextTable[Index].Type &&
- DevicePathSubType (Node) == mUefiDevicePathLibDevPathToTextTable[Index].SubType
+ if (DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type &&
+ DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType
) {
- ToText = mUefiDevicePathLibDevPathToTextTable[Index].Function;
+ ToText = mUefiDevicePathLibToTextTable[Index].Function;
break;
}
}