]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiMisc.h
NetworkPkg: Bug fix of iSCSI to support MPIO
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiMisc.h
index 8646f666a47aa4ec94678451379c4caec39aec02..1bcaeb8bcc815cbfb4033eecab359eebe341a5f1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Miscellaneous definitions for iSCSI driver.\r
 \r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -17,20 +17,37 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 typedef struct _ISCSI_DRIVER_DATA ISCSI_DRIVER_DATA;\r
 \r
+///\r
+/// IPv4 Device Path Node Length\r
+///\r
+#define IP4_NODE_LEN_NEW_VERSIONS    27\r
+\r
+///\r
+/// IPv6 Device Path Node Length\r
+///\r
+#define IP6_NODE_LEN_OLD_VERSIONS    43\r
+#define IP6_NODE_LEN_NEW_VERSIONS    60\r
+\r
+///\r
+/// The ignored field StaticIpAddress's offset in old IPv6 Device Path\r
+///\r
+#define IP6_OLD_IPADDRESS_OFFSET      42\r
+\r
 #pragma pack(1)\r
 typedef struct _ISCSI_SESSION_CONFIG_NVDATA {\r
   UINT16            TargetPort;\r
   UINT8             Enabled;\r
   UINT8             IpMode;\r
 \r
-  EFI_IPv4_ADDRESS  LocalIp;\r
+  EFI_IP_ADDRESS    LocalIp;\r
   EFI_IPv4_ADDRESS  SubnetMask;\r
-  EFI_IPv4_ADDRESS  Gateway;\r
+  EFI_IP_ADDRESS    Gateway;\r
 \r
   BOOLEAN           InitiatorInfoFromDhcp;\r
   BOOLEAN           TargetInfoFromDhcp;\r
   CHAR8             TargetName[ISCSI_NAME_MAX_SIZE];\r
   EFI_IP_ADDRESS    TargetIp;\r
+  UINT8             PrefixLength;\r
   UINT8             BootLun[8];\r
 \r
   UINT16            ConnectTimeout; ///< timout value in milliseconds\r
@@ -231,7 +248,7 @@ IScsiGetNicInfoByIndex (
 \r
 \r
 /**\r
-  Get the NIC's PCI location and return it accroding to the composited\r
+  Get the NIC's PCI location and return it according to the composited\r
   format defined in iSCSI Boot Firmware Table.\r
 \r
   @param[in]   Controller        The handle of the controller.\r
@@ -289,14 +306,33 @@ IScsiCreateDriverData (
 /**\r
   Clean the iSCSI driver data.\r
 \r
-  @param[in]  Private The iSCSI driver data.\r
+  @param[in]              Private The iSCSI driver data.\r
+\r
+  @retval EFI_SUCCES      The clean operation is successful.\r
+  @retval Others          Other errors as indicated.\r
 \r
 **/\r
-VOID\r
+EFI_STATUS\r
 IScsiCleanDriverData (\r
   IN ISCSI_DRIVER_DATA  *Private\r
   );\r
 \r
+/**\r
+  Check wheather the Controller handle is configured to use DHCP protocol.\r
+\r
+  @param[in]  Controller           The handle of the controller.\r
+  @param[in]  IpVersion            IP_VERSION_4 or IP_VERSION_6.\r
+  \r
+  @retval TRUE                     The handle of the controller need the Dhcp protocol.\r
+  @retval FALSE                    The handle of the controller does not need the Dhcp protocol.\r
+  \r
+**/\r
+BOOLEAN\r
+IScsiDhcpIsConfigured (\r
+  IN EFI_HANDLE  Controller,\r
+  IN UINT8       IpVersion\r
+  );\r
+\r
 /**\r
   Get the various configuration data of this iSCSI instance.\r
 \r
@@ -340,4 +376,34 @@ IScsiOnExitBootService (
   IN VOID       *Context\r
   );\r
 \r
+/**\r
+  Tests whether a controller handle is being managed by IScsi driver.\r
+\r
+  This function tests whether the driver specified by DriverBindingHandle is\r
+  currently managing the controller specified by ControllerHandle.  This test\r
+  is performed by evaluating if the the protocol specified by ProtocolGuid is\r
+  present on ControllerHandle and is was opened by DriverBindingHandle and Nic\r
+  Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
+  If ProtocolGuid is NULL, then ASSERT().\r
+\r
+  @param  ControllerHandle     A handle for a controller to test.\r
+  @param  DriverBindingHandle  Specifies the driver binding handle for the\r
+                               driver.\r
+  @param  ProtocolGuid         Specifies the protocol that the driver specified\r
+                               by DriverBindingHandle opens in its Start()\r
+                               function.\r
+\r
+  @retval EFI_SUCCESS          ControllerHandle is managed by the driver\r
+                               specified by DriverBindingHandle.\r
+  @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the driver\r
+                               specified by DriverBindingHandle.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+IScsiTestManagedDevice (\r
+  IN  EFI_HANDLE       ControllerHandle,\r
+  IN  EFI_HANDLE       DriverBindingHandle,\r
+  IN  EFI_GUID         *ProtocolGuid\r
+  );\r
 #endif\r