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:
Ruiyu Ni
2014-05-05 07:33:21 +00:00
committed by niruiyu
parent 7447345a36
commit a06ec3e2af
2 changed files with 75 additions and 0 deletions

View File

@@ -1771,6 +1771,44 @@ DevPathFromTextSasEx (
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.
@@ -3040,6 +3078,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
{L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
{L"SAS", DevPathFromTextSAS },
{L"SasEx", DevPathFromTextSasEx },
{L"NVMe", DevPathFromTextNVMe },
{L"DebugPort", DevPathFromTextDebugPort },
{L"MAC", DevPathFromTextMAC },
{L"IPv4", DevPathFromTextIPv4 },