summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/DevicePathDxe
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-26 09:29:46 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-26 09:29:46 +0000
commit501793fad4084c43828ba2f4e2d9355d29abe9f7 (patch)
treeac49b115a60da8a6d1fd0ae42eff53c29d113acb /MdeModulePkg/Universal/DevicePathDxe
parent8f5e3a12a9dc5f5b782204ee655db6cb22e25ea5 (diff)
downloadedk2-501793fad4084c43828ba2f4e2d9355d29abe9f7.tar.gz
edk2-501793fad4084c43828ba2f4e2d9355d29abe9f7.tar.bz2
edk2-501793fad4084c43828ba2f4e2d9355d29abe9f7.zip
Adopt new IPv4/IPv6 device path for network modules.
Signed-off-by: tye Reviewed-by: niruiyu Adopt SasEx and new IPv6 device path for DevicePathDxe driver. Signed-off-by: niruiyu Reviewed-by: erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12574 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/DevicePathDxe')
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c86
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c101
2 files changed, 183 insertions, 4 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},
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
index d7cff207fe..2cfd6730d2 100644
--- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
+++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
@@ -654,6 +654,66 @@ DevPathToTextFibreEx (
}
/**
+ Converts a Sas Ex 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
+DevPathToTextSasEx (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
+ )
+{
+ SASEX_DEVICE_PATH *SasEx;
+ UINTN Index;
+
+ SasEx = DevPath;
+ CatPrint (Str, L"SasEx(0x");
+
+ for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {
+ CatPrint (Str, L"%02x", SasEx->SasAddress[Index]);
+ }
+ CatPrint (Str, L",0x");
+ for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {
+ CatPrint (Str, L"%02x", SasEx->Lun[Index]);
+ }
+ CatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);
+
+ if ((SasEx->DeviceTopology & 0x0f) == 0) {
+ CatPrint (Str, L"NoTopology,0,0,0,");
+ } else if (((SasEx->DeviceTopology & 0x0f) == 1) || ((SasEx->DeviceTopology & 0x0f) == 2)) {
+ CatPrint (
+ Str,
+ L"%s,%s,%s,",
+ ((SasEx->DeviceTopology & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",
+ ((SasEx->DeviceTopology & (0x1 << 5)) != 0) ? L"External" : L"Internal",
+ ((SasEx->DeviceTopology & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"
+ );
+ if ((SasEx->DeviceTopology & 0x0f) == 1) {
+ CatPrint (Str, L"0,");
+ } else {
+ CatPrint (Str, L"0x%x,", (SasEx->DeviceTopology >> 8) & 0xff);
+ }
+ } else {
+ CatPrint (Str, L"0,0,0,0,");
+ }
+
+ CatPrint (Str, L")");
+ return ;
+
+}
+
+/**
Converts a 1394 device path structure to its string representative.
@param Str The string representative of input device.
@@ -1205,10 +1265,21 @@ DevPathToTextIPv6 (
IPDevPath->Protocol
);
+ switch (IPDevPath->IpAddressOrigin) {
+ case 0:
+ CatPrint (Str, L",Static");
+ break;
+ case 1:
+ CatPrint (Str, L",StatelessAutoConfigure");
+ break;
+ default:
+ CatPrint (Str, L",StatefulAutoConfigure");
+ break;
+ }
+
CatPrint (
Str,
- L",%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
- IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",
+ L",%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
IPDevPath->LocalIpAddress.Addr[0],
IPDevPath->LocalIpAddress.Addr[1],
IPDevPath->LocalIpAddress.Addr[2],
@@ -1226,6 +1297,31 @@ DevPathToTextIPv6 (
IPDevPath->LocalIpAddress.Addr[14],
IPDevPath->LocalIpAddress.Addr[15]
);
+
+ if (DevicePathNodeLength (IPDevPath) == sizeof (IPv6_DEVICE_PATH)) {
+ CatPrint (
+ Str,
+ L",0x%x,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
+ IPDevPath->PrefixLength,
+ IPDevPath->GatewayIpAddress.Addr[0],
+ IPDevPath->GatewayIpAddress.Addr[1],
+ IPDevPath->GatewayIpAddress.Addr[2],
+ IPDevPath->GatewayIpAddress.Addr[3],
+ IPDevPath->GatewayIpAddress.Addr[4],
+ IPDevPath->GatewayIpAddress.Addr[5],
+ IPDevPath->GatewayIpAddress.Addr[6],
+ IPDevPath->GatewayIpAddress.Addr[7],
+ IPDevPath->GatewayIpAddress.Addr[8],
+ IPDevPath->GatewayIpAddress.Addr[9],
+ IPDevPath->GatewayIpAddress.Addr[10],
+ IPDevPath->GatewayIpAddress.Addr[11],
+ IPDevPath->GatewayIpAddress.Addr[12],
+ IPDevPath->GatewayIpAddress.Addr[13],
+ IPDevPath->GatewayIpAddress.Addr[14],
+ IPDevPath->GatewayIpAddress.Addr[15]
+ );
+ }
+ CatPrint (Str, L")");
}
/**
@@ -1790,6 +1886,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
{MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre},
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx},
+ {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx},
{MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394},
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb},
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID},