mirror of https://github.com/acidanthera/audk.git
Add device path node/text conversion for NVMe device path node.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Jin <eric.jin@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15495 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7447345a36
commit
a06ec3e2af
|
@ -1771,6 +1771,44 @@ DevPathFromTextSasEx (
|
||||||
return (EFI_DEVICE_PATH_PROTOCOL *) SasEx;
|
return (EFI_DEVICE_PATH_PROTOCOL *) SasEx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts a text device path node to NVM Express Namespace device path structure.
|
||||||
|
|
||||||
|
@param TextDeviceNode The input Text device path node.
|
||||||
|
|
||||||
|
@return A pointer to the newly-created NVM Express Namespace device path structure.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
DevPathFromTextNVMe (
|
||||||
|
IN CHAR16 *TextDeviceNode
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR16 *NamespaceIdStr;
|
||||||
|
CHAR16 *NamespaceUuidStr;
|
||||||
|
NVME_NAMESPACE_DEVICE_PATH *Nvme;
|
||||||
|
UINT8 *Uuid;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
NamespaceIdStr = GetNextParamStr (&TextDeviceNode);
|
||||||
|
NamespaceUuidStr = GetNextParamStr (&TextDeviceNode);
|
||||||
|
Nvme = (NVME_NAMESPACE_DEVICE_PATH *) CreateDeviceNode (
|
||||||
|
MESSAGING_DEVICE_PATH,
|
||||||
|
MSG_NVME_NAMESPACE_DP,
|
||||||
|
(UINT16) sizeof (NVME_NAMESPACE_DEVICE_PATH)
|
||||||
|
);
|
||||||
|
|
||||||
|
Nvme->NamespaceId = (UINT32) Strtoi (NamespaceIdStr);
|
||||||
|
Uuid = (UINT8 *) &Nvme->NamespaceUuid;
|
||||||
|
|
||||||
|
Index = sizeof (Nvme->NamespaceUuid) / sizeof (UINT8);
|
||||||
|
while (Index-- != 0) {
|
||||||
|
Uuid[Index] = (UINT8) StrHexToUintn (SplitStr (&NamespaceUuidStr, L'-'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (EFI_DEVICE_PATH_PROTOCOL *) Nvme;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts a text device path node to Debug Port device path structure.
|
Converts a text device path node to Debug Port device path structure.
|
||||||
|
|
||||||
|
@ -3040,6 +3078,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
|
||||||
{L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
|
{L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
|
||||||
{L"SAS", DevPathFromTextSAS },
|
{L"SAS", DevPathFromTextSAS },
|
||||||
{L"SasEx", DevPathFromTextSasEx },
|
{L"SasEx", DevPathFromTextSasEx },
|
||||||
|
{L"NVMe", DevPathFromTextNVMe },
|
||||||
{L"DebugPort", DevPathFromTextDebugPort },
|
{L"DebugPort", DevPathFromTextDebugPort },
|
||||||
{L"MAC", DevPathFromTextMAC },
|
{L"MAC", DevPathFromTextMAC },
|
||||||
{L"IPv4", DevPathFromTextIPv4 },
|
{L"IPv4", DevPathFromTextIPv4 },
|
||||||
|
|
|
@ -696,6 +696,41 @@ DevPathToTextSasEx (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts a NVM Express Namespace device path structure to its string representative.
|
||||||
|
|
||||||
|
@param Str The string representative of input device.
|
||||||
|
@param DevPath The input device path structure.
|
||||||
|
@param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
||||||
|
of the display node is used, where applicable. If DisplayOnly
|
||||||
|
is FALSE, then the longer text representation of the display node
|
||||||
|
is used.
|
||||||
|
@param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
||||||
|
representation for a device node can be used, where applicable.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
DevPathToTextNVMe (
|
||||||
|
IN OUT POOL_PRINT *Str,
|
||||||
|
IN VOID *DevPath,
|
||||||
|
IN BOOLEAN DisplayOnly,
|
||||||
|
IN BOOLEAN AllowShortcuts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NVME_NAMESPACE_DEVICE_PATH *Nvme;
|
||||||
|
UINT8 *Uuid;
|
||||||
|
|
||||||
|
Nvme = DevPath;
|
||||||
|
Uuid = (UINT8 *) &Nvme->NamespaceUuid;
|
||||||
|
UefiDevicePathLibCatPrint (
|
||||||
|
Str,
|
||||||
|
L"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
|
||||||
|
Nvme->NamespaceId,
|
||||||
|
Uuid[7], Uuid[6], Uuid[5], Uuid[4],
|
||||||
|
Uuid[3], Uuid[2], Uuid[1], Uuid[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts a 1394 device path structure to its string representative.
|
Converts a 1394 device path structure to its string representative.
|
||||||
|
|
||||||
|
@ -1833,6 +1868,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
|
||||||
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
|
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
|
||||||
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
|
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
|
||||||
{MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
|
{MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
|
||||||
|
{MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },
|
||||||
{MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
|
{MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
|
||||||
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
|
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
|
||||||
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
|
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
|
||||||
|
|
Loading…
Reference in New Issue