]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c
1) delete unused parameter from IScsiCHAPOnRspReceived ()
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiExtScsiPassThru.c
index 697424ad72585075205599d399eb57aa49719268..f13a386cbcf8101d7f58d24cb7ad61026fe76cd9 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver.\r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2007, Intel Corporation.<BR>\r
 All rights reserved. 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
@@ -9,16 +10,51 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  IScsiExtScsiPassThru.c\r
-\r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
 #include "IScsiImpl.h"\r
 \r
+/**\r
+  Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function   \r
+  supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
+  nonblocking I/O functionality is optional.                                                             \r
+\r
+  @param[in]      This    A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param[in]      Target  The Target is an array of size TARGET_MAX_BYTES and it represents\r
+                          the id of the SCSI device to send the SCSI Request Packet. Each\r
+                          transport driver may chose to utilize a subset of this size to suit the needs\r
+                          of transport target representation. For example, a Fibre Channel driver\r
+                          may use only 8 bytes (WWN) to represent an FC target.\r
+  @param[in]       Lun    The LUN of the SCSI device to send the SCSI Request Packet.\r
+  @param[in, out]  Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
+                          specified by Target and Lun.\r
+  @param[in]       Event  If nonblocking I/O is not supported then Event is ignored, and blocking\r
+                          I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
+                          Event is not NULL and non blocking I/O is supported, then\r
+                          nonblocking I/O is performed, and Event will be signaled when the\r
+                          SCSI Request Packet completes.\r
+\r
+  @retval EFI_SUCCESS           The SCSI Request Packet was sent by the host. For bi-directional\r
+                                commands, InTransferLength bytes were transferred from\r
+                                InDataBuffer. For write and bi-directional commands,\r
+                                OutTransferLength bytes were transferred by\r
+                                OutDataBuffer.\r
+  @retval EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was not executed. The number of bytes that\r
+                                could be transferred is returned in InTransferLength. For write\r
+                                and bi-directional commands, OutTransferLength bytes were\r
+                                transferred by OutDataBuffer. Currently not implemeted.                                \r
+  @retval EFI_NOT_READY         The SCSI Request Packet could not be sent because there are too many\r
+                                SCSI Request Packets already queued. The caller may retry again later.                             \r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to send the SCSI Request\r
+                                Packet. \r
+  @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
+  @retval EFI_UNSUPPORTED       The command described by the SCSI Request Packet is not supported\r
+                                by the host adapter. This includes the case of Bi-directional SCSI\r
+                                commands not supported by the implementation. The SCSI Request\r
+                                Packet was not sent, so no additional status information is available.\r
+                                Currently not implemeted.\r
+  @retval EFI_TIMEOUT           A timeout occurred while waiting for the SCSI Request Packet to execute.                              \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruFunction (\r
@@ -28,26 +64,6 @@ IScsiExtScsiPassThruFunction (
   IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET           *Packet,\r
   IN EFI_EVENT                                                Event     OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function sends out the SCSI command via iSCSI transport layer and returned\r
-  back the data received from the iSCSI target. \r
-\r
-Arguments:\r
-\r
-  This   - The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
-  Target - The Target ID of device to send the SCSI Request Packet. \r
-  Lun    - The LUN of the device to send the SCSI Request Packet.\r
-  Packet - The SCSI Request Packet to send to the device.\r
-  Event  - The event used in non-blocking mode, it should be always NULL.\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-\r
---*/\r
 {\r
   if (Target[0] != 0) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -60,6 +76,31 @@ Returns:
   return IScsiExecuteScsiCommand (This, Target, Lun, Packet);\r
 }\r
 \r
+/**\r
+  Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These       \r
+  can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
+  Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the       \r
+  Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI    \r
+  channel.                                                                                               \r
+\r
+  @param[in]       This    A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param[in, out]  Target  On input, a pointer to the Target ID (an array of size\r
+                           TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
+                           On output, a pointer to the Target ID (an array of\r
+                           TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
+                           channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
+                           Target array retrieves the Target ID of the first SCSI device present on a\r
+                           SCSI channel.\r
+  @param[in, out]  Lun     On input, a pointer to the LUN of a SCSI device present on the SCSI\r
+                           channel. On output, a pointer to the LUN of the next SCSI device present\r
+                           on a SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           The Target ID and LUN of the next SCSI device on the SCSI\r
+                                channel was returned in Target and Lun.\r
+  @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
+                                not returned on a previous call to GetNextTargetLun().\r
+  @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruGetNextTargetLun (\r
@@ -67,32 +108,6 @@ IScsiExtScsiPassThruGetNextTargetLun (
   IN OUT UINT8                        **Target,\r
   IN OUT UINT64                       *Lun\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.\r
-\r
-Arguments:\r
-\r
-  This   - The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance..\r
-  Target - On input, a pointer to the Target ID of a SCSI device present on the\r
-           SCSI channel.  On output, a pointer to the Target ID of the next SCSI\r
-           device present on a SCSI channel.  An input value of 0xFFFFFFFF\r
-           retrieves the Target ID of the first SCSI device present on a SCSI channel.\r
-  Lun    - On input, a pointer to the LUN of a SCSI device present on the SCSI\r
-           channel. On output, a pointer to the LUN of the next SCSI device present on \r
-           a SCSI channel.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The Target ID and Lun of the next SCSI device \r
-                          on the SCSI channel was returned in Target and Lun.\r
-  EFI_NOT_FOUND         - There are no more SCSI devices on this SCSI channel.\r
-  EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r
-                           returned on a previous call to GetNextDevice().\r
-\r
---*/\r
 {\r
   ISCSI_DRIVER_DATA           *Private;\r
   ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;\r
@@ -119,6 +134,33 @@ Returns:
   return EFI_INVALID_PARAMETER;\r
 }\r
 \r
+/**\r
+  Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
+\r
+  @param[in]      This        A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param[in]      Target      The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
+                              Target ID of the SCSI device for which a device path node is to be\r
+                              allocated and built. Transport drivers may chose to utilize a subset of\r
+                              this size to suit the representation of targets. For example, a Fibre\r
+                              Channel driver may use only 8 bytes (WWN) in the array to represent a\r
+                              FC target.\r
+  @param[in]       Lun        The LUN of the SCSI device for which a device path node is to be\r
+                              allocated and built.\r
+  @param[in, out]  DevicePath A pointer to a single device path node that describes the SCSI device\r
+                              specified by Target and Lun. This function is responsible for\r
+                              allocating the buffer DevicePath with the boot service\r
+                              AllocatePool(). It is the caller's responsibility to free\r
+                              DevicePath when the caller is finished with DevicePath.\r
+\r
+  @retval EFI_SUCCESS           The device path node that describes the SCSI device specified by\r
+                                Target and Lun was allocated and returned in\r
+                                DevicePath.\r
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+  @retval EFI_NOT_FOUND         The SCSI devices specified by Target and Lun does not exist\r
+                                on the SCSI channel.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate DevicePath.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruBuildDevicePath (\r
@@ -127,39 +169,6 @@ IScsiExtScsiPassThruBuildDevicePath (
   IN UINT64                           Lun,\r
   IN OUT EFI_DEVICE_PATH_PROTOCOL     **DevicePath\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Allocate and build a device path node for a SCSI device on a SCSI channel.\r
-\r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-  Target                - The Target ID of the SCSI device for which\r
-                          a device path node is to be allocated and built.\r
-  Lun                   - The LUN of the SCSI device for which a device \r
-                          path node is to be allocated and built.\r
-  DevicePath            - A pointer to a single device path node that \r
-                          describes the SCSI device specified by \r
-                          Target and Lun. This function is responsible \r
-                          for allocating the buffer DevicePath with the boot\r
-                          service AllocatePool().  It is the caller's \r
-                          responsibility to free DevicePath when the caller\r
-                          is finished with DevicePath.    \r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The device path node that describes the SCSI device\r
-                          specified by Target and Lun was allocated and \r
-                          returned in DevicePath.\r
-  EFI_NOT_FOUND         - The SCSI devices specified by Target and Lun does\r
-                          not exist on the SCSI channel.\r
-  EFI_INVALID_PARAMETER - DevicePath is NULL.\r
-  EFI_OUT_OF_RESOURCES  - There are not enough resources to allocate \r
-                          DevicePath.\r
-\r
---*/\r
 {\r
   ISCSI_DRIVER_DATA             *Private;\r
   ISCSI_SESSION                 *Session;\r
@@ -193,7 +202,7 @@ Returns:
 \r
   Node->DevPath.Type    = MESSAGING_DEVICE_PATH;\r
   Node->DevPath.SubType = MSG_ISCSI_DP;\r
-  SetDevicePathNodeLength (&Node->DevPath, DevPathNodeLen);\r
+  SetDevicePathNodeLength (&Node->DevPath, (UINT16)DevPathNodeLen);\r
 \r
   //\r
   // 0 for TCP, others are reserved.\r
@@ -223,6 +232,24 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Used to translate a device path node to a Target ID and LUN.\r
+\r
+  @param[in]  This       A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param[in]  DevicePath A pointer to a single device path node that describes the SCSI device\r
+                         on the SCSI channel.\r
+  @param[out] Target     A pointer to the Target Array which represents the ID of a SCSI device\r
+                         on the SCSI channel.\r
+  @param[out]  Lun       A pointer to the LUN of a SCSI device on the SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           DevicePath was successfully translated to a Target ID and\r
+                                LUN, and they were returned in Target and Lun.\r
+  @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
+  @retval EFI_NOT_FOUND         A valid translation from DevicePath to a Target ID and LUN\r
+                                does not exist.Currently not implemented.\r
+  @retval EFI_UNSUPPORTED       This driver does not support the device path node type in\r
+                                DevicePath.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruGetTargetLun (\r
@@ -231,33 +258,6 @@ IScsiExtScsiPassThruGetTargetLun (
   OUT UINT8                           **Target,\r
   OUT UINT64                          *Lun\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Translate a device path node to a Target ID and LUN.\r
-\r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-  DevicePath            - A pointer to the device path node that \r
-                          describes a SCSI device on the SCSI channel.\r
-  Target                - A pointer to the Target ID of a SCSI device \r
-                          on the SCSI channel. \r
-  Lun                   - A pointer to the LUN of a SCSI device on \r
-                          the SCSI channel.    \r
-Returns:\r
-\r
-  EFI_SUCCESS           - DevicePath was successfully translated to a \r
-                          Target ID and LUN, and they were returned \r
-                          in Target and Lun.\r
-  EFI_INVALID_PARAMETER - DevicePath/Target/Lun is NULL.\r
-  EFI_UNSUPPORTED       - This driver does not support the device path \r
-                          node type in DevicePath.\r
-  EFI_NOT_FOUND         - A valid translation from DevicePath to a \r
-                          Target ID and LUN does not exist.\r
-\r
---*/\r
 {\r
   ISCSI_DRIVER_DATA           *Private;\r
   ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;\r
@@ -287,31 +287,45 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
+  Currently not implemented.\r
+  \r
+  @param[in]  This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS      The SCSI channel was reset.\r
+  @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
+  @retval EFI_TIMEOUT      A timeout occurred while attempting to reset the SCSI channel.\r
+  @retval EFI_UNSUPPORTED  The SCSI channel does not support a channel reset operation.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruResetChannel (\r
   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL  *This\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Resets a SCSI channel.This operation resets all the SCSI devices connected to\r
-  the SCSI channel.\r
-\r
-Arguments:\r
-\r
-  This            - Protocol instance pointer.\r
-\r
-Returns:\r
-\r
-  EFI_UNSUPPORTED - It's not supported.\r
-\r
---*/\r
 {\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
+/**\r
+  Resets a SCSI logical unit that is connected to a SCSI channel. Currently not implemented.\r
+\r
+  @param[in]  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param[in]  Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
+                     target port ID of the SCSI device containing the SCSI logical unit to\r
+                     reset. Transport drivers may chose to utilize a subset of this array to suit\r
+                     the representation of their targets.\r
+  @param[in]  Lun    The LUN of the SCSI device to reset.\r
+\r
+  @retval EFI_SUCCESS           The SCSI device specified by Target and Lun was reset.\r
+  @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
+  @retval EFI_TIMEOUT           A timeout occurred while attempting to reset the SCSI device\r
+                                specified by Target and Lun.\r
+  @retval EFI_UNSUPPORTED       The SCSI channel does not support a target reset operation.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to reset the SCSI device\r
+                                specified by Target and Lun.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruResetTargetLun (\r
@@ -319,61 +333,38 @@ IScsiExtScsiPassThruResetTargetLun (
   IN UINT8                            *Target,\r
   IN UINT64                           Lun\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Resets a SCSI device that is connected to a SCSI channel.\r
-\r
-Arguments:\r
-\r
-  This            - Protocol instance pointer.\r
-  Target          - The Target ID of the SCSI device to reset. \r
-  Lun             - The LUN of the SCSI device to reset.\r
-    \r
-Returns:\r
-\r
-  EFI_UNSUPPORTED - It's not supported.\r
-\r
---*/\r
 {\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
+/**\r
+  Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either     \r
+  be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
+  for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to     \r
+  see if a SCSI device is actually present at that location on the SCSI channel.                         \r
+\r
+  @param[in]       This    A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param[in, out]  Target  (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
+                           On output, a pointer to the Target ID (an array of\r
+                           TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
+                           channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
+                           Target array retrieves the Target ID of the first SCSI device present on a\r
+                           SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           The Target ID of the next SCSI device on the SCSI\r
+                                channel was returned in Target.\r
+  @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
+  @retval EFI_TIMEOUT           Target array is not all 0xF, and Target were not\r
+                                returned on a previous call to GetNextTarget().\r
+                                Currently not implemented.\r
+  @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiExtScsiPassThruGetNextTarget (\r
   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL  *This,\r
   IN OUT UINT8                        **Target\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.\r
-\r
-Arguments:\r
-  This                  - Protocol instance pointer.\r
-  Target                - On input, a pointer to the Target ID of a SCSI \r
-                          device present on the SCSI channel.  On output, \r
-                          a pointer to the Target ID of the next SCSI device\r
-                           present on a SCSI channel.  An input value of \r
-                           0xFFFFFFFF retrieves the Target ID of the first \r
-                           SCSI device present on a SCSI channel.\r
-  Lun                   - On input, a pointer to the LUN of a SCSI device\r
-                          present on the SCSI channel. On output, a pointer\r
-                          to the LUN of the next SCSI device present on \r
-                          a SCSI channel.\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS           - The Target ID and Lun of the next SCSI device \r
-                          on the SCSI channel was returned in Target and Lun.\r
-  EFI_NOT_FOUND         - There are no more SCSI devices on this SCSI channel.\r
-  EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r
-                          returned on a previous call to GetNextDevice().\r
-\r
---*/\r
 {\r
   UINT8 TargetId[TARGET_MAX_BYTES];\r
 \r