summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c')
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c86
1 files changed, 84 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
index bc9af70135..11f5c159df 100644
--- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
+++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
@@ -1685,6 +1685,74 @@ DevPathFromTextSAS (
}
/**
+ Converts a text device path node to Serial Attached SCSI Ex device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Serial Attached SCSI Ex device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextSasEx (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *AddressStr;
+ CHAR16 *LunStr;
+ CHAR16 *RTPStr;
+ CHAR16 *SASSATAStr;
+ CHAR16 *LocationStr;
+ CHAR16 *ConnectStr;
+ CHAR16 *DriveBayStr;
+ UINT16 Info;
+ SASEX_DEVICE_PATH *SasEx;
+
+ AddressStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ RTPStr = GetNextParamStr (&TextDeviceNode);
+ SASSATAStr = GetNextParamStr (&TextDeviceNode);
+ LocationStr = GetNextParamStr (&TextDeviceNode);
+ ConnectStr = GetNextParamStr (&TextDeviceNode);
+ DriveBayStr = GetNextParamStr (&TextDeviceNode);
+ Info = 0x0000;
+ SasEx = (SASEX_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SASEX_DP,
+ (UINT16) sizeof (SASEX_DEVICE_PATH)
+ );
+
+ Strtoi64 (AddressStr, (UINT64 *) &SasEx->SasAddress);
+ Strtoi64 (LunStr, (UINT64 *) &SasEx->Lun);
+ *(UINT64 *) &SasEx->SasAddress = SwapBytes64 (*(UINT64 *) &SasEx->SasAddress);
+ *(UINT64 *) &SasEx->Lun = SwapBytes64 (*(UINT64 *) &SasEx->Lun);
+ SasEx->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
+ if (StrCmp (SASSATAStr, L"NoTopology") != 0) {
+ if (StrCmp (DriveBayStr, L"0") == 0) {
+ Info |= 0x0001;
+ } else {
+ Info |= 0x0002;
+ Info = (UINT16) (Info | (Strtoi (DriveBayStr) << 8));
+ }
+
+ if (StrCmp (SASSATAStr, L"SATA") == 0) {
+ Info |= 0x0010;
+ }
+
+ if (StrCmp (LocationStr, L"External") == 0) {
+ Info |= 0x0020;
+ }
+
+ if (StrCmp (ConnectStr, L"Expanded") == 0) {
+ Info |= 0x0040;
+ }
+ }
+
+ SasEx->DeviceTopology = Info;
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) SasEx;
+}
+
+/**
Converts a text device path node to Debug Port device path structure.
@param TextDeviceNode The input Text device path node.
@@ -1843,12 +1911,16 @@ DevPathFromTextIPv6 (
CHAR16 *ProtocolStr;
CHAR16 *TypeStr;
CHAR16 *LocalIPStr;
+ CHAR16 *GatewayIPStr;
+ CHAR16 *PrefixLengthStr;
IPv6_DEVICE_PATH *IPv6;
RemoteIPStr = GetNextParamStr (&TextDeviceNode);
ProtocolStr = GetNextParamStr (&TextDeviceNode);
TypeStr = GetNextParamStr (&TextDeviceNode);
LocalIPStr = GetNextParamStr (&TextDeviceNode);
+ PrefixLengthStr = GetNextParamStr (&TextDeviceNode);
+ GatewayIPStr = GetNextParamStr (&TextDeviceNode);
IPv6 = (IPv6_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_IPv6_DP,
@@ -1858,12 +1930,21 @@ DevPathFromTextIPv6 (
StrToIPv6Addr (&RemoteIPStr, &IPv6->RemoteIpAddress);
IPv6->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);
if (StrCmp (TypeStr, L"Static") == 0) {
- IPv6->StaticIpAddress = TRUE;
+ IPv6->IpAddressOrigin = 0;
+ } else if (StrCmp (TypeStr, L"StatelessAutoConfigure") == 0) {
+ IPv6->IpAddressOrigin = 1;
} else {
- IPv6->StaticIpAddress = FALSE;
+ IPv6->IpAddressOrigin = 2;
}
StrToIPv6Addr (&LocalIPStr, &IPv6->LocalIpAddress);
+ if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*PrefixLengthStr)) {
+ StrToIPv6Addr (&GatewayIPStr, &IPv6->GatewayIpAddress);
+ IPv6->PrefixLength = (UINT8) Strtoi (PrefixLengthStr);
+ } else {
+ ZeroMem (&IPv6->GatewayIpAddress, sizeof (IPv6->GatewayIpAddress));
+ IPv6->PrefixLength = 0;
+ }
IPv6->LocalPort = 0;
IPv6->RemotePort = 0;
@@ -2895,6 +2976,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[]
{L"VenUtf8", DevPathFromTextVenUtf8},
{L"UartFlowCtrl", DevPathFromTextUartFlowCtrl},
{L"SAS", DevPathFromTextSAS},
+ {L"SasEx", DevPathFromTextSasEx},
{L"DebugPort", DevPathFromTextDebugPort},
{L"MAC", DevPathFromTextMAC},
{L"IPv4", DevPathFromTextIPv4},