summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2015-05-08 07:31:39 +0000
committerniruiyu <niruiyu@Edk2>2015-05-08 07:31:39 +0000
commitc808ac7bee55fe9a199add003c97baa852b572bb (patch)
tree7ba71cc25a07db007d20760da94a048f4293bdae /MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
parent4128acd90e08ae877e61eed1b3142cee6f8dfc1f (diff)
downloadedk2-c808ac7bee55fe9a199add003c97baa852b572bb.tar.gz
edk2-c808ac7bee55fe9a199add003c97baa852b572bb.tar.bz2
edk2-c808ac7bee55fe9a199add003c97baa852b572bb.zip
MdePkg: Add ToText/FromText support for URI device path node
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17370 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index dec084c313..e3ab6e1e3d 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -2742,6 +2742,38 @@ DevPathFromTextBluetooth (
}
/**
+ Converts a text device path node to URI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created URI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUri (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *UriStr;
+ UINTN UriLength;
+ URI_DEVICE_PATH *Uri;
+
+ UriStr = GetNextParamStr (&TextDeviceNode);
+ UriLength = StrnLenS (UriStr, MAX_UINT16 - sizeof (URI_DEVICE_PATH));
+ Uri = (URI_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_URI_DP,
+ (UINT16) (sizeof (URI_DEVICE_PATH) + UriLength)
+ );
+
+ while (UriLength-- != 0) {
+ Uri->Uri[UriLength] = (CHAR8) UriStr[UriLength];
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Uri;
+}
+
+/**
Converts a media text device path node to media device path structure.
@param TextDeviceNode The input Text device path node.
@@ -3181,6 +3213,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
{L"Unit", DevPathFromTextUnit },
{L"iSCSI", DevPathFromTextiSCSI },
{L"Vlan", DevPathFromTextVlan },
+ {L"Uri", DevPathFromTextUri },
{L"Bluetooth", DevPathFromTextBluetooth },
{L"MediaPath", DevPathFromTextMediaPath },
{L"HD", DevPathFromTextHD },