From 501793fad4084c43828ba2f4e2d9355d29abe9f7 Mon Sep 17 00:00:00 2001 From: niruiyu Date: Wed, 26 Oct 2011 09:29:46 +0000 Subject: [PATCH] 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 --- MdeModulePkg/Include/Library/NetLib.h | 2 + MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 20 +++- .../DevicePathDxe/DevicePathFromText.c | 86 ++++++++++++++- .../DevicePathDxe/DevicePathToText.c | 101 +++++++++++++++++- .../Universal/Network/IScsiDxe/IScsiCHAP.h | 4 +- .../Network/IScsiDxe/IScsiConfigNVDataStruc.h | 5 +- .../Universal/Network/IScsiDxe/IScsiMisc.c | 14 ++- .../Universal/Network/IScsiDxe/IScsiProto.c | 8 ++ .../Universal/Network/Tcp4Dxe/Tcp4Misc.c | 4 +- MdePkg/Include/Protocol/DevicePath.h | 43 +++++++- NetworkPkg/IScsiDxe/IScsiMisc.c | 18 +++- NetworkPkg/TcpDxe/TcpMisc.c | 4 +- NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +- 13 files changed, 291 insertions(+), 20 deletions(-) diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index f1c6595a0d..875af7b283 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -61,6 +61,8 @@ typedef UINT16 TCP_PORTNO; #define IP_VERSION_4 4 #define IP_VERSION_6 6 +#define IP6_PREFIX_LENGTH 64 + #pragma pack(1) // diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 82322c98c8..1743e9bdfa 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -2578,7 +2578,6 @@ ON_EXIT: The header type of IPv4 device path node is MESSAGING_DEVICE_PATH. The header subtype of IPv4 device path node is MSG_IPv4_DP. - The length of the IPv4 device path node in bytes is 19. Get other info from parameters to make up the whole IPv4 device path node. @param[in, out] Node Pointer to the IPv4 device path node. @@ -2606,7 +2605,7 @@ NetLibCreateIPv4DPathNode ( { Node->Header.Type = MESSAGING_DEVICE_PATH; Node->Header.SubType = MSG_IPv4_DP; - SetDevicePathNodeLength (&Node->Header, 19); + SetDevicePathNodeLength (&Node->Header, sizeof (IPv4_DEVICE_PATH)); CopyMem (&Node->LocalIpAddress, &LocalIp, sizeof (EFI_IPv4_ADDRESS)); CopyMem (&Node->RemoteIpAddress, &RemoteIp, sizeof (EFI_IPv4_ADDRESS)); @@ -2621,6 +2620,14 @@ NetLibCreateIPv4DPathNode ( } else { Node->StaticIpAddress = NetLibDefaultAddressIsStatic (Controller); } + + // + // Set the Gateway IP address to default value 0:0:0:0. + // Set the Subnet mask to default value 255:255:255:0. + // + ZeroMem (&Node->GatewayIpAddress, sizeof (EFI_IPv4_ADDRESS)); + SetMem (&Node->SubnetMask, sizeof (EFI_IPv4_ADDRESS), 0xff); + Node->SubnetMask.Addr[3] = 0; } /** @@ -2662,7 +2669,14 @@ NetLibCreateIPv6DPathNode ( Node->RemotePort = RemotePort; Node->Protocol = Protocol; - Node->StaticIpAddress = FALSE; + + // + // Set default value to IPAddressOrigin, PrefixLength. + // Set the Gateway IP address to unspecified address. + // + Node->IpAddressOrigin = 0; + Node->PrefixLength = IP6_PREFIX_LENGTH; + ZeroMem (&Node->GatewayIpAddress, sizeof (EFI_IPv6_ADDRESS)); } /** 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 @@ -1684,6 +1684,74 @@ DevPathFromTextSAS ( return (EFI_DEVICE_PATH_PROTOCOL *) Sas; } +/** + 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. @@ -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 @@ -653,6 +653,66 @@ DevPathToTextFibreEx ( CatPrint (Str, L")"); } +/** + 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. @@ -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}, diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h index 59d514fe18..f6a64e56da 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h @@ -41,9 +41,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA { UINT8 CHAPType; - CHAR8 CHAPName[ISCSI_CHAP_NAME_MAX_LEN]; + CHAR8 CHAPName[ISCSI_CHAP_NAME_STORAGE]; CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE]; - CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_MAX_LEN]; + CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE]; CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE]; } ISCSI_CHAP_AUTH_CONFIG_NVDATA; diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfigNVDataStruc.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfigNVDataStruc.h index 85ad3d173e..7c2e4e65fa 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfigNVDataStruc.h +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfigNVDataStruc.h @@ -73,6 +73,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define ISCSI_CHAP_SECRET_STORAGE 17 #define ISCSI_CHAP_NAME_MAX_LEN 126 +#define ISCSI_CHAP_NAME_STORAGE 127 #define ISID_CONFIGURABLE_MIN_LEN 6 #define ISID_CONFIGURABLE_MAX_LEN 12 @@ -96,9 +97,9 @@ typedef struct { UINT8 TargetInfoFromDhcp; UINT8 CHAPType; - CHAR16 CHAPName[ISCSI_CHAP_NAME_MAX_LEN]; + CHAR16 CHAPName[ISCSI_CHAP_NAME_STORAGE]; CHAR16 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE]; - CHAR16 ReverseCHAPName[ISCSI_CHAP_NAME_MAX_LEN]; + CHAR16 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE]; CHAR16 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE]; CHAR16 IsId[ISID_CONFIGURABLE_STORAGE]; diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c index 840692b45d..5341e5a01e 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c @@ -757,7 +757,19 @@ IScsiGetTcpConnDevicePath ( ) { DPathNode->Ipv4.LocalPort = 0; - DPathNode->Ipv4.StaticIpAddress = (BOOLEAN) (!Session->ConfigData.NvData.InitiatorInfoFromDhcp); + DPathNode->Ipv4.StaticIpAddress = + (BOOLEAN) (!Session->ConfigData.NvData.InitiatorInfoFromDhcp); + + IP4_COPY_ADDRESS ( + &DPathNode->Ipv4.GatewayIpAddress, + &Session->ConfigData.NvData.Gateway + ); + + IP4_COPY_ADDRESS ( + &DPathNode->Ipv4.SubnetMask, + &Session->ConfigData.NvData.SubnetMask + ); + break; } diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c index 3836053d93..331f9d8d22 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c @@ -692,6 +692,14 @@ IScsiProcessLoginRsp ( LoginRsp->MaxCmdSN = NTOHL (LoginRsp->MaxCmdSN); if ((Conn->CurrentStage == ISCSI_SECURITY_NEGOTIATION) && (Conn->CHAPStep == ISCSI_CHAP_INITIAL)) { + // + // If the Login Request is a leading Login Request, the target MUST use + // the value presented in CmdSN as the target value for ExpCmdSN. + // + if ((Session->State == SESSION_STATE_FREE) && (Session->CmdSN != LoginRsp->ExpCmdSN)) { + return EFI_PROTOCOL_ERROR; + } + // // It's the initial Login Response, initialize the local ExpStatSN, MaxCmdSN // and ExpCmdSN. diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c index 2ed3c254f3..b3591aa7df 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c @@ -1,7 +1,7 @@ /** @file Misc support routines for tcp. -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1115,6 +1115,8 @@ TcpInstallDevicePath ( Tcb->UseDefaultAddr ); + IP4_COPY_ADDRESS (&Ip4DPathNode.SubnetMask, &Tcb->SubnetMask); + Sock->DevicePath = AppendDevicePathNode ( Sock->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &Ip4DPathNode diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h index 7318ff2744..9c56d9e05e 100644 --- a/MdePkg/Include/Protocol/DevicePath.h +++ b/MdePkg/Include/Protocol/DevicePath.h @@ -598,10 +598,21 @@ typedef struct { /// UINT16 Protocol; /// - /// 0x00 - The Source IP Address was assigned though DHCP. - /// 0x01 - The Source IP Address is statically bound. + /// 0x00 - The Local IP Address was manually configured. + /// 0x01 - The Local IP Address is assigned through IPv6 + /// stateless auto-configuration. + /// 0x02 - The Local IP Address is assigned through IPv6 + /// stateful configuration. /// - BOOLEAN StaticIpAddress; + UINT8 IpAddressOrigin; + /// + /// The prefix length + /// + UINT8 PrefixLength; + /// + /// The gateway IP address + /// + EFI_IPv6_ADDRESS GatewayIpAddress; } IPv6_DEVICE_PATH; /// @@ -750,6 +761,30 @@ typedef struct { UINT16 RelativeTargetPort; } SAS_DEVICE_PATH; +/// +/// Serial Attached SCSI (SAS) Ex Device Path SubType +/// +#define MSG_SASEX_DP 0x16 +typedef struct { + EFI_DEVICE_PATH_PROTOCOL Header; + /// + /// 8-byte array of the SAS Address for Serial Attached SCSI Target Port. + /// + UINT8 SasAddress[8]; + /// + /// 8-byte array of the SAS Logical Unit Number. + /// + UINT8 Lun[8]; + /// + /// More Information about the device and its interconnect. + /// + UINT16 DeviceTopology; + /// + /// Relative Target Port (RTP). + /// + UINT16 RelativeTargetPort; +} SASEX_DEVICE_PATH; + /// /// iSCSI Device Path SubType /// @@ -1047,6 +1082,7 @@ typedef union { UART_DEVICE_PATH Uart; UART_FLOW_CONTROL_DEVICE_PATH UartFlowControl; SAS_DEVICE_PATH Sas; + SASEX_DEVICE_PATH SasEx; HARDDRIVE_DEVICE_PATH HardDrive; CDROM_DEVICE_PATH CD; @@ -1095,6 +1131,7 @@ typedef union { UART_DEVICE_PATH *Uart; UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl; SAS_DEVICE_PATH *Sas; + SASEX_DEVICE_PATH *SasEx; HARDDRIVE_DEVICE_PATH *HardDrive; CDROM_DEVICE_PATH *CD; diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index 731081f1df..f3ecdb5f6a 100644 --- a/NetworkPkg/IScsiDxe/IScsiMisc.c +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c @@ -1287,11 +1287,25 @@ IScsiGetTcpConnDevicePath ( if (DevicePathType (&DPathNode->DevPath) == MESSAGING_DEVICE_PATH) { if (!Conn->Ipv6Flag && DevicePathSubType (&DPathNode->DevPath) == MSG_IPv4_DP) { DPathNode->Ipv4.LocalPort = 0; - DPathNode->Ipv4.StaticIpAddress = (BOOLEAN) !Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp; + + DPathNode->Ipv4.StaticIpAddress = + (BOOLEAN) (!Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp); + + IP4_COPY_ADDRESS ( + &DPathNode->Ipv4.GatewayIpAddress, + &Session->ConfigData->SessionConfigData.Gateway + ); + + IP4_COPY_ADDRESS ( + &DPathNode->Ipv4.SubnetMask, + &Session->ConfigData->SessionConfigData.SubnetMask + ); break; } else if (Conn->Ipv6Flag && DevicePathSubType (&DPathNode->DevPath) == MSG_IPv6_DP) { DPathNode->Ipv6.LocalPort = 0; - DPathNode->Ipv6.StaticIpAddress = (BOOLEAN) !Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp; + DPathNode->Ipv6.IpAddressOrigin = 0; + DPathNode->Ipv6.PrefixLength = IP6_PREFIX_LENGTH; + ZeroMem (&DPathNode->Ipv6.GatewayIpAddress, sizeof (EFI_IPv6_ADDRESS)); break; } } diff --git a/NetworkPkg/TcpDxe/TcpMisc.c b/NetworkPkg/TcpDxe/TcpMisc.c index 492ec35fb8..21bd9dfec1 100644 --- a/NetworkPkg/TcpDxe/TcpMisc.c +++ b/NetworkPkg/TcpDxe/TcpMisc.c @@ -1,7 +1,7 @@ /** @file Misc support routines for TCP driver. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -1245,6 +1245,8 @@ TcpInstallDevicePath ( Tcb->UseDefaultAddr ); + IP4_COPY_ADDRESS (&Ip4DPathNode.SubnetMask, &Tcb->SubnetMask); + DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &Ip4DPathNode; } else { NetLibCreateIPv6DPathNode ( diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c index 8cfc8fb93c..179009f91c 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c @@ -949,7 +949,7 @@ PxeBcCreateIp6Children ( ZeroMem (&Ip6Node, sizeof (IPv6_DEVICE_PATH)); Ip6Node.Header.Type = MESSAGING_DEVICE_PATH; Ip6Node.Header.SubType = MSG_IPv6_DP; - Ip6Node.StaticIpAddress = FALSE; + Ip6Node.PrefixLength = IP6_PREFIX_LENGTH; SetDevicePathNodeLength (&Ip6Node.Header, sizeof (Ip6Node)); -- 2.39.2