]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
update file header
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiProto.c
index 93b7f715e196404698a3c4659098e1d65484adfa..c3ef7818c4021aee14d62cc70e3762047e8de97a 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  The implementation of IScsi protocol based on RFC3720.\r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2008, 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,91 +10,59 @@ 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
-  IScsiProto.c\r
-\r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
 #include "IScsiImpl.h"\r
 \r
-static UINT32 mDataSegPad = 0;\r
+UINT32 mDataSegPad = 0;\r
+\r
+/**\r
+  Attach the iSCSI connection to the iSCSI session. \r
 \r
+  @param[in]  Session The iSCSI session.\r
+  @param[in]  Conn    The iSCSI connection.\r
+**/\r
 VOID\r
 IScsiAttatchConnection (\r
   IN ISCSI_SESSION     *Session,\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Attach the iSCSI connection to the iSCSI session. \r
-\r
-Arguments:\r
-\r
-  Session - The iSCSI session.\r
-  Conn    - The iSCSI connection.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   InsertTailList (&Session->Conns, &Conn->Link);\r
   Conn->Session = Session;\r
   Session->NumConns++;\r
 }\r
 \r
+/**\r
+  Detach the iSCSI connection from the session it belongs to. \r
+\r
+  @param[in]  Conn The iSCSI connection.\r
+**/\r
 VOID\r
 IScsiDetatchConnection (\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Detach the iSCSI connection from the session it belongs to. \r
-\r
-Arguments:\r
-\r
-  Conn - The iSCSI connection.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   RemoveEntryList (&Conn->Link);\r
   Conn->Session->NumConns--;\r
   Conn->Session = NULL;\r
 }\r
 \r
+/**\r
+  Check the sequence number according to RFC3720. \r
+\r
+  @param[in]  ExpSN   The currently expected sequence number.\r
+  @param[in]  NewSN  The sequence number to check.\r
+\r
+  @retval EFI_SUCCESS         The check passed and the ExpSN is increased.\r
+  @retval EFI_NOT_READY       Response was sent due to a retransmission request.\r
+  @retval EFI_PROTOCOL_ERROR  Some kind of iSCSI protocol error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiCheckSN (\r
   IN UINT32  *ExpSN,\r
   IN UINT32  NewSN\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check the sequence number according to RFC3720. \r
-\r
-Arguments:\r
-\r
-  ExpSN - The currently expected sequence number.\r
-  NewSN - The sequence number to check.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - The check passed and the ExpSN is increased.\r
-\r
---*/\r
 {\r
   if (!ISCSI_SEQ_EQ (NewSN, *ExpSN)) {\r
     if (ISCSI_SEQ_LT (NewSN, *ExpSN)) {\r
@@ -113,29 +82,19 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+  Update the sequence numbers for the iSCSI command.\r
+\r
+  @param[in]  Session  The iSCSI session.\r
+  @param[in]  MaxCmdSN Maximum CmdSN from the target.\r
+  @param[in]  ExpCmdSN Next expected CmdSN from the target.\r
+**/\r
 VOID\r
 IScsiUpdateCmdSN (\r
   IN ISCSI_SESSION  *Session,\r
   IN UINT32         MaxCmdSN,\r
   IN UINT32         ExpCmdSN\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Update the sequence numbers for the iSCSI command.\r
-\r
-Arguments:\r
-\r
-  Session  - The iSCSI session.\r
-  MaxCmdSN - Maximum CmdSN from the target.\r
-  ExpCmdSN - Next expected CmdSN from the target.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   if (ISCSI_SEQ_LT (MaxCmdSN, ExpCmdSN - 1)) {\r
     return ;\r
@@ -150,27 +109,19 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+  This function does the iSCSI connection login.\r
+\r
+  @param[in]  Conn           The iSCSI connection to login.\r
+\r
+  @retval EFI_SUCCESS        The iSCSI connection is logged into the iSCSI target.\r
+  @retval EFI_TIMEOUT        Timeout happened during the login procedure.\r
+  @retval Others             Some unexpected error happened.  \r
+**/\r
 EFI_STATUS\r
 IScsiConnLogin (\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function does the iSCSI connection login.\r
-\r
-Arguments:\r
-\r
-  Conn - The iSCSI connection to login.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS        - The iSCSI connection is logged into the iSCSI target.\r
-  EFI_TIMEOUT        - Timeout happened during the login procedure.\r
-  EFI_PROTOCOL_ERROR - Some kind of iSCSI protocol error happened.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
 \r
@@ -210,50 +161,32 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Reset the iSCSI connection.\r
+\r
+  @param[in]  Conn The iSCSI connection to reset.\r
+**/\r
 VOID\r
 IScsiConnReset (\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Reset the iSCSI connection.\r
-\r
-Arguments:\r
-\r
-  Conn - The iSCSI connection to reset.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   Tcp4IoReset (&Conn->Tcp4Io);\r
 }\r
 \r
+/**\r
+  Create a TCP connection for the iSCSI session.\r
+\r
+  @param[in]  Private The iSCSI driver data.\r
+  @param[in]  Session Maximum CmdSN from the target.\r
+\r
+  @return The newly created iSCSI connection.\r
+**/\r
 ISCSI_CONNECTION *\r
 IScsiCreateConnection (\r
   IN ISCSI_DRIVER_DATA  *Private,\r
   IN ISCSI_SESSION      *Session\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Create a TCP connection for the iSCSI session.\r
-\r
-Arguments:\r
-\r
-  Private - The iSCSI driver data.\r
-  Session - Maximum CmdSN from the target.\r
-\r
-Returns:\r
-\r
-  The newly created iSCSI connection.\r
-\r
---*/\r
 {\r
   ISCSI_CONNECTION    *Conn;\r
   TCP4_IO_CONFIG_DATA Tcp4IoConfig;\r
@@ -275,7 +208,7 @@ Returns:
   Conn->CID             = Session->NextCID++;\r
 \r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_TIMER,\r
+                  EVT_TIMER,\r
                   TPL_CALLBACK,\r
                   NULL,\r
                   NULL,\r
@@ -320,25 +253,15 @@ Returns:
   return Conn;\r
 }\r
 \r
+/**\r
+  Destroy an iSCSI connection.\r
+\r
+  @param[in]  Conn The connection to destroy.\r
+**/\r
 VOID\r
 IScsiDestroyConnection (\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Destroy an iSCSI connection.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection to destroy.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   Tcp4IoDestroySocket (&Conn->Tcp4Io);\r
   NetbufQueFlush (&Conn->RspQue);\r
@@ -346,27 +269,19 @@ Returns:
   gBS->FreePool (Conn);\r
 }\r
 \r
+/**\r
+  Login the iSCSI session.\r
+\r
+  @param[in]  Private          The iSCSI driver data.\r
+\r
+  @retval EFI_SUCCESS          The iSCSI session login procedure finished.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiSessionLogin (\r
   IN ISCSI_DRIVER_DATA  *Private\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Login the iSCSI session.\r
-\r
-Arguments:\r
-\r
-  Private - The iSCSI driver data.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The iSCSI session login procedure finished.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-  EFI_PROTOCOL_ERROR   - Some kind of iSCSI protocol error happened.\r
-\r
---*/\r
 {\r
   EFI_STATUS        Status;\r
   ISCSI_SESSION     *Session;\r
@@ -409,29 +324,21 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-IScsiSendLoginReq (\r
-  IN ISCSI_CONNECTION  *Conn\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Build and send the iSCSI login request to the iSCSI target according to\r
   the current login stage.\r
 \r
-Arguments:\r
-\r
-  Conn - The connection in the iSCSI login phase.\r
-\r
-Returns:\r
+  @param[in]  Conn             The connection in the iSCSI login phase.\r
 \r
-  EFI_SUCCESS          - The iSCSI login request PDU is built and sent on this\r
-                         connection.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-  EFI_PROTOCOL_ERROR   - Some kind of iSCSI protocol error happened.\r
-\r
---*/\r
+  @retval EFI_SUCCESS          The iSCSI login request PDU is built and sent on this\r
+                               connection.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval EFI_DEVICE_ERROR     Some kind of device error happened.\r
+**/\r
+EFI_STATUS\r
+IScsiSendLoginReq (\r
+  IN ISCSI_CONNECTION  *Conn\r
+  )\r
 {\r
   NET_BUF     *Pdu;\r
   EFI_STATUS  Status;\r
@@ -453,27 +360,18 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Receive and process the iSCSI login response.\r
+\r
+  @param[in]  Conn             The connection in the iSCSI login phase.\r
+  \r
+  @retval EFI_SUCCESS          The iSCSI login response PDU is received and processed.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiReceiveLoginRsp (\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Receive and process the iSCSI login response.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection in the iSCSI login phase.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The iSCSI login response PDU is received and processed.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-  EFI_PROTOCOL_ERROR   - Some kind of iSCSI protocol error happened.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   NET_BUF     *Pdu;\r
@@ -495,34 +393,27 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU.\r
+  The DataSegmentLength and the actual size of the net buffer containing this PDU will be\r
+  updated.\r
+\r
+  @param[in]  Pdu              The iSCSI PDU whose data segment the key-value pair will\r
+                               be added to.\r
+  @param[in]  Key              The key name string.\r
+  @param[in]  Value            The value string.\r
+\r
+  @retval EFI_SUCCESS          The key-valu pair is added to the PDU's datasegment and\r
+                               the correspondence length fields are updated.\r
+  @retval EFI_OUT_OF_RESOURCES There is not enough space in the PDU to add the key-value\r
+                               pair.\r
+**/\r
 EFI_STATUS\r
 IScsiAddKeyValuePair (\r
   IN NET_BUF          *Pdu,\r
   IN CHAR8            *Key,\r
   IN CHAR8            *Value\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU.\r
-  The DataSegmentLength and the actual size of the net buffer containing this PDU will be\r
-  updated.\r
-\r
-Arguments:\r
-\r
-  Pdu   - The iSCSI PDU whose data segment the key-value pair will be added to.\r
-  Key   - The key name string.\r
-  Value - The value string.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The key-valu pair is added to the PDU's datasegment and\r
-                         the correspondence length fields are updated.\r
-  EFI_OUT_OF_RESOURCES - There is not enough space in the PDU to add the key-value\r
-                         pair.\r
-\r
---*/\r
 {\r
   UINT32              DataSegLen;\r
   UINT32              KeyLen;\r
@@ -575,25 +466,18 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Prepare the iSCSI login request to be sent according to the current login status.\r
+\r
+  @param[in]  Conn The connection in the iSCSI login phase.\r
+\r
+  @return The pointer to the net buffer containing the iSCSI login request built.\r
+  @retval Others    Some unexpected error happened.\r
+**/\r
 NET_BUF *\r
 IScsiPrepareLoginReq (\r
   IN ISCSI_CONNECTION  *Conn\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Prepare the iSCSI login request to be sent according to the current login status.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection in the iSCSI login phase.\r
-\r
-Returns:\r
-\r
-  The pointer to the net buffer containing the iSCSI login request built.\r
-\r
---*/\r
 {\r
   ISCSI_SESSION       *Session;\r
   NET_BUF             *Nbuf;\r
@@ -674,28 +558,22 @@ Returns:
   return Nbuf;\r
 }\r
 \r
+/**\r
+  Process the iSCSI Login Response.\r
+\r
+  @param[in]  Conn The connection on which the iSCSI login response is received.\r
+  @param[in]  Pdu  The iSCSI login response PDU.\r
+\r
+  @retval EFI_SUCCESS        The iSCSI login response PDU is processed and all check are passed.\r
+  @retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.\r
+  @retval EFI_MEDIA_CHANGED  Target is redirected.\r
+  @retval Others             Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiProcessLoginRsp (\r
   IN ISCSI_CONNECTION  *Conn,\r
   IN NET_BUF           *Pdu\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Process the iSCSI Login Response.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection on which the iSCSI login response is received.\r
-  Pdu  - The iSCSI login response PDU.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS        - The iSCSI login response PDU is processed and all check are passed.\r
-  EFI_PROTOCOL_ERROR - Some kind of iSCSI protocol error happened.\r
-\r
---*/\r
 {\r
   EFI_STATUS            Status;\r
   ISCSI_SESSION         *Session;\r
@@ -886,32 +764,26 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Updated the target information according the data received in the iSCSI\r
+  login response with an target redirection status.\r
+\r
+  @param[in] Session          The iSCSI session.\r
+  @param[in] Data             The data segment which should contain the\r
+                              TargetAddress key-value list.\r
+  @param[in] Len              Length of the data.\r
+  \r
+  @retval EFI_SUCCESS          The target address is updated.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval EFI_NOT_FOUND        The TargetAddress key is not found.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiUpdateTargetAddress (\r
   IN ISCSI_SESSION  *Session,\r
   IN CHAR8          *Data,\r
   IN UINT32         Len\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Updated the target information according the data received in the iSCSI\r
-  login response with an target redirection status.\r
-\r
-Arguments:\r
-\r
-  Session - The iSCSI session.\r
-  Data    - The data segment which should contain the TargetAddress key-value list.\r
-  Len     - Length of the data.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The target address is updated.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-  EFI_NOT_FOUND        - The TargetAddress key is not found.\r
-\r
---*/\r
 {\r
   LIST_ENTRY      *KeyValueList;\r
   CHAR8           *TargetAddress;\r
@@ -943,7 +815,7 @@ Returns:
 \r
     IpStr = TargetAddress;\r
 \r
-    while (*TargetAddress && (*TargetAddress != ':') && (*TargetAddress != ',')) {\r
+    while ((*TargetAddress != 0) && (*TargetAddress != ':') && (*TargetAddress != ',')) {\r
       //\r
       // NULL, ':' or ',' ends the IPv4 string.\r
       //\r
@@ -989,25 +861,15 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  The callback function to free the net buffer list.\r
+\r
+  @param[in]  Arg The opaque parameter.\r
+**/\r
 VOID\r
 IScsiFreeNbufList (\r
   VOID *Arg\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The callback function to free the net buffer list.\r
-\r
-Arguments:\r
-\r
-  Arg - The opaque parameter.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   ASSERT (Arg != NULL);\r
 \r
@@ -1015,28 +877,37 @@ Returns:
   gBS->FreePool (Arg);\r
 }\r
 \r
+/**\r
+  The callback function called in NetBufFree, it does nothing.\r
+\r
+  @param[in]   Arg  The opaque parameter.\r
+**/\r
 VOID\r
 IScsiNbufExtFree (\r
   VOID *Arg\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The callback function called in NetBufFree, it does nothing.\r
-\r
-Arguments:\r
-\r
-  Arg - The opaque parameter.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
 }\r
 \r
+/**\r
+  Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and\r
+  an optional data segment. The two parts will be put into two blocks of buffers in the\r
+  net buffer. The digest check will be conducted in this function if needed and the digests\r
+  will be trimmed from the PDU buffer.\r
+\r
+  @param[in]   Conn        The iSCSI connection to receive data from.\r
+  @param[out]  Pdu         The received iSCSI pdu.\r
+  @param[in]   Context     The context used to describe information on the caller provided\r
+                           buffer to receive data segment of the iSCSI pdu, it's optional.\r
+  @param[in]  HeaderDigest Whether there will be header digest received.\r
+  @param[in]  DataDigest   Whether there will be data digest.\r
+  @param[in]  TimeoutEvent The timeout event, it's optional.\r
+\r
+  @retval EFI_SUCCESS          An iSCSI pdu is received.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval EFI_PROTOCOL_ERROR   Some kind of iSCSI protocol error happened.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiReceivePdu (\r
   IN ISCSI_CONNECTION                      *Conn,\r
@@ -1046,31 +917,6 @@ IScsiReceivePdu (
   IN BOOLEAN                               DataDigest,\r
   IN EFI_EVENT                             TimeoutEvent OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and\r
-  an optional data segment. The two parts will be put into two blocks of buffers in the\r
-  net buffer. The digest check will be conducted in this function if needed and the digests\r
-  will be trimmed from the PDU buffer.\r
-\r
-Arguments:\r
-\r
-  Conn         - The iSCSI connection to receive data from.\r
-  Pdu          - The received iSCSI pdu.\r
-  Context      - The context used to describe information on the caller provided\r
-                 buffer to receive data segment of the iSCSI pdu, it's optional.\r
-  HeaderDigest - Whether there will be header digest received.\r
-  DataDigest   - Whether there will be data digest.\r
-  TimeoutEvent - The timeout event, it's optional.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - An iSCSI pdu is received.\r
-  EFI_TIMEOUT - Timeout happenend.\r
-\r
---*/\r
 {\r
   LIST_ENTRY      *NbufList;\r
   UINT32          Len;\r
@@ -1242,28 +1088,21 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
+/**\r
+  Check and get the result of the prameter negotiation.\r
+\r
+  @param[in]  Conn          The connection in iSCSI login.\r
+  @param[in]  Transit       Whether need transit.\r
+\r
+  @retval EFI_SUCCESS          The parmeter check is passed and negotiation is finished.\r
+  @retval EFI_PROTOCOL_ERROR   Some kind of iSCSI protocol error happened.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+**/\r
 EFI_STATUS\r
 IScsiCheckOpParams (\r
   IN ISCSI_CONNECTION  *Conn,\r
   IN BOOLEAN           Transit\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check and get the result of the prameter negotiation.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection in iSCSI login.\r
-  Pdu  - The iSCSI response PDU containing the parameter list.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS        - The parmeter check is passed and negotiation is finished.\r
-  EFI_PROTOCOL_ERROR - Some kind of iSCSI protocol error happened.\r
-\r
---*/\r
 {\r
   EFI_STATUS      Status;\r
   LIST_ENTRY      *KeyValueList;\r
@@ -1504,28 +1343,19 @@ ON_ERROR:
   return Status;\r
 }\r
 \r
+/**\r
+  Fill the oprational prameters.\r
+\r
+  @param[in]  Conn            The connection in iSCSI login.\r
+  @param[in]  Pdu             The iSCSI login request PDU to fill the parameters.\r
+\r
+  @retval EFI_SUCCESS          The parmeters are filled into the iSCSI login request PDU.\r
+**/\r
 EFI_STATUS\r
 IScsiFillOpParams (\r
   IN ISCSI_CONNECTION  *Conn,\r
   IN NET_BUF           *Pdu\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Fill the oprational prameters.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection in iSCSI login.\r
-  Pdu  - The iSCSI login request PDU to fill the parameters.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The parmeters are filled into the iSCSI login request PDU.\r
-  EFI_OUT_OF_RESOURCES - There is not enough space in the PDU to hold the parameters.\r
-\r
---*/\r
 {\r
   ISCSI_SESSION *Session;\r
   CHAR8         Value[256];\r
@@ -1577,29 +1407,21 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Pad the iSCSI AHS or data segment to an integer number of 4 byte words.\r
+\r
+  @param[in]   Pdu             The iSCSI pdu which contains segments to pad.\r
+  @param[in]   Len             The length of the last semgnet in the PDU.\r
+\r
+  @retval EFI_SUCCESS          The segment is padded or no need to pad it.\r
+  @retval EFI_OUT_OF_RESOURCES There is not enough remaining free space to add the\r
+                               padding bytes.\r
+**/\r
 EFI_STATUS\r
 IScsiPadSegment (\r
   IN NET_BUF  *Pdu,\r
   IN UINT32   Len\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Pad the iSCSI AHS or data segment to an integer number of 4 byte words.\r
-\r
-Arguments:\r
-\r
-  Pdu - The iSCSI pdu which contains segments to pad.\r
-  Len - The length of the last semgnet in the PDU.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The segment is padded or no need to pad it.\r
-  EFI_OUT_OF_RESOURCES - There is not enough remaining free space to add the\r
-                         padding bytes.\r
-\r
---*/\r
 {\r
   UINT32  PadLen;\r
   UINT8   *Data;\r
@@ -1618,27 +1440,20 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-LIST_ENTRY     *\r
+/**\r
+  Build a key-value list from the data segment.\r
+\r
+  @param[in]  Data The data segment containing the key-value pairs.\r
+  @param[in]  Len  Length of the data segment.\r
+\r
+  @return The key-value list.\r
+  @return NULL Some unexpected error happened.\r
+**/\r
+LIST_ENTRY *\r
 IScsiBuildKeyValueList (\r
   IN CHAR8  *Data,\r
   IN UINT32 Len\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Build a key-value list from the data segment.\r
-\r
-Arguments:\r
-\r
-  Data - The data segment containing the key-value pairs.\r
-  Len  - Length of the data segment.\r
-\r
-Returns:\r
-\r
-  The key-value list.\r
-\r
---*/\r
 {\r
   LIST_ENTRY            *ListHead;\r
   ISCSI_KEY_VALUE_PAIR  *KeyValuePair;\r
@@ -1692,28 +1507,20 @@ ON_ERROR:
   return NULL;\r
 }\r
 \r
+/**\r
+  Get the value string by the key name from the key-value list. If found,\r
+  the key-value entry will be removed from the list.\r
+\r
+  @param[in]  KeyValueList The key-value list.\r
+  @param[in]  Key          The key name to find.\r
+\r
+  @return The value string.\r
+**/\r
 CHAR8 *\r
 IScsiGetValueByKeyFromList (\r
   IN LIST_ENTRY      *KeyValueList,\r
   IN CHAR8           *Key\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Get the value string by the key name from the key-value list. If found,\r
-  the key-value entry will be removed from the list.\r
-\r
-Arguments:\r
-\r
-  KeyValueList - The key-value list.\r
-  Key          - The key name to find.\r
-\r
-Returns:\r
-\r
-  The value string.\r
-\r
---*/\r
 {\r
   LIST_ENTRY            *Entry;\r
   ISCSI_KEY_VALUE_PAIR  *KeyValuePair;\r
@@ -1736,25 +1543,15 @@ Returns:
   return Value;\r
 }\r
 \r
+/**\r
+  Free the key-value list.\r
+\r
+  @param[in]  KeyValueList The key-value list.\r
+**/\r
 VOID\r
 IScsiFreeKeyValueList (\r
   IN LIST_ENTRY      *KeyValueList\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Free the key-value list.\r
-\r
-Arguments:\r
-\r
-  KeyValueList - The key-value list.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   LIST_ENTRY            *Entry;\r
   ISCSI_KEY_VALUE_PAIR  *KeyValuePair;\r
@@ -1769,28 +1566,20 @@ Returns:
   gBS->FreePool (KeyValueList);\r
 }\r
 \r
+/**\r
+  Normalize the iSCSI name according to RFC.\r
+\r
+  @param[in]  Name          The iSCSI name.\r
+  @param[in]  Len           length of the iSCSI name.\r
+\r
+  @retval EFI_SUCCESS        The iSCSI name is valid and normalized.\r
+  @retval EFI_PROTOCOL_ERROR The iSCSI name is mal-formatted or not in the IQN format.\r
+**/\r
 EFI_STATUS\r
 IScsiNormalizeName (\r
   IN CHAR8  *Name,\r
   IN UINTN  Len\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Normalize the iSCSI name according to RFC.\r
-\r
-Arguments:\r
-\r
-  Name - The iSCSI name.\r
-  Len  - length of the iSCSI name.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS        - The iSCSI name is valid and normalized.\r
-  EFI_PROTOCOL_ERROR - The iSCSI name is mal-formatted or not in the IQN format.\r
-\r
---*/\r
 {\r
   UINTN Index;\r
 \r
@@ -1826,28 +1615,21 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Create an iSCSI task control block.\r
+\r
+  @param[in]   Conn           The connection on which the task control block will be created.\r
+  @param[out]  Tcb            The newly created task control block.\r
+\r
+  @retval EFI_SUCCESS          The task control block is created.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval EFI_NOT_READY        The target can not accept new commands.\r
+**/\r
 EFI_STATUS\r
 IScsiNewTcb (\r
   IN  ISCSI_CONNECTION  *Conn,\r
   OUT ISCSI_TCB         **Tcb\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Create an iSCSI task control block.\r
-\r
-Arguments:\r
-\r
-  Conn - The connection on which the task control block will be created.\r
-  Tcb  - The newly created task control block.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The task control block is created.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-\r
---*/\r
 {\r
   ISCSI_SESSION *Session;\r
   ISCSI_TCB     *NewTcb;\r
@@ -1885,52 +1667,34 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Delete the tcb from the connection and destroy it.\r
+\r
+  @param[in]  Tcb The tcb to delete.\r
+**/\r
 VOID\r
 IScsiDelTcb (\r
   IN ISCSI_TCB  *Tcb\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Delete the tcb from the connection and destroy it.\r
-\r
-Arguments:\r
-\r
-  Tcb - The tcb to delete.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   RemoveEntryList (&Tcb->Link);\r
 \r
   gBS->FreePool (Tcb);\r
 }\r
 \r
+/**\r
+  Find the task control block by the initator task tag.\r
+\r
+  @param[in]  TcbList         The tcb list.\r
+  @param[in]  InitiatorTaskTag The initiator task tag.\r
+\r
+  @return The task control block found.\r
+**/\r
 ISCSI_TCB *\r
 IScsiFindTcbByITT (\r
   IN LIST_ENTRY      *TcbList,\r
   IN UINT32          InitiatorTaskTag\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Find the task control block by the initator task tag.\r
-\r
-Arguments:\r
-\r
-  TcbList          - The tcb list.\r
-  InitiatorTaskTag - The initiator task tag.\r
-\r
-Returns:\r
-\r
-  The task control block found.\r
-\r
---*/\r
 {\r
   ISCSI_TCB       *Tcb;\r
   LIST_ENTRY      *Entry;\r
@@ -1950,29 +1714,21 @@ Returns:
   return Tcb;\r
 }\r
 \r
+/**\r
+  Create a data segment, pad it and calculate the CRC if needed.\r
+\r
+  @param[in]  Data       The data to fill into the data segment.\r
+  @param[in]  Len        Length of the data.\r
+  @param[in]  DataDigest Whether to calculate CRC for this data segment.\r
+\r
+  @return The net buffer wrapping the data segment.\r
+**/\r
 NET_BUF *\r
 IScsiNewDataSegment (\r
   IN UINT8    *Data,\r
   IN UINT32   Len,\r
   IN BOOLEAN  DataDigest\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Create a data segment, pad it and calculate the CRC if needed.\r
-\r
-Arguments:\r
-\r
-  Data       - The data to fill into the data segment.\r
-  Len        - Length of the data.\r
-  DataDigest - Whether to calculate CRC for this data segment.\r
-\r
-Returns:\r
-\r
-  The net buffer wrapping the data segment.\r
-\r
---*/\r
 {\r
   NET_FRAGMENT  Fragment[2];\r
   UINT32        FragmentCount;\r
@@ -1997,30 +1753,23 @@ Returns:
   return DataSeg;\r
 }\r
 \r
+/**\r
+  Create a iSCSI SCSI command PDU to encapsulate the command issued\r
+  by SCSI through the EXT SCSI PASS THRU Protocol.\r
+\r
+  @param[in]  Packet The EXT SCSI PASS THRU request packet containing the SCSI command.\r
+  @param[in]  Lun    The LUN.\r
+  @param[in]  Tcb    The tcb assocated with this SCSI command.\r
+\r
+  @return The  created iSCSI SCSI command PDU.\r
+  @return NULL Some unexpected error happened.\r
+**/\r
 NET_BUF *\r
 IScsiNewScsiCmdPdu (\r
   IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
   IN UINT64                                     Lun,\r
   IN ISCSI_TCB                                  *Tcb\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Create a iSCSI SCSI command PDU to encapsulate the command issued\r
-  by SCSI through the EXT SCSI PASS THRU Protocol.\r
-\r
-Arguments:\r
-\r
-  Packet - The EXT SCSI PASS THRU request packet containing the SCSI command.\r
-  Lun    - The LUN.\r
-  Tcb    - The tcb assocated with this SCSI command.\r
-\r
-Returns:\r
-\r
-  The created iSCSI SCSI command PDU.\r
-\r
---*/\r
 {\r
   LIST_ENTRY                      *NbufList;\r
   NET_BUF                         *Pdu;\r
@@ -2177,6 +1926,18 @@ ON_EXIT:
   return Pdu;\r
 }\r
 \r
+/**\r
+  Create a new iSCSI SCSI Data Out PDU.\r
+\r
+  @param[in]  Data   The data to put into the Data Out PDU.\r
+  @param[in]  Len    Length of the data.\r
+  @param[in]  DataSN The DataSN of the Data Out PDU.\r
+  @param[in]  Tcb    The task control block of this Data Out PDU.\r
+  @param[in]  Lun    The LUN.\r
+\r
+  @return The net buffer wrapping the Data Out PDU.\r
+  @return NULL Some unexpected error happened.\r
+**/\r
 NET_BUF *\r
 IScsiNewDataOutPdu (\r
   IN UINT8      *Data,\r
@@ -2185,25 +1946,6 @@ IScsiNewDataOutPdu (
   IN ISCSI_TCB  *Tcb,\r
   IN UINT64     Lun\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Create a new iSCSI SCSI Data Out PDU.\r
-\r
-Arguments:\r
-\r
-  Data   - The data to put into the Data Out PDU.\r
-  Len    - Length of the data.\r
-  DataSN - The DataSN of the Data Out PDU.\r
-  Tcb    - The task control block of this Data Out PDU.\r
-  Lun    - The LUN.\r
-\r
-Returns:\r
-\r
-  The net buffer wrapping the Data Out PDU.\r
-\r
---*/\r
 {\r
   LIST_ENTRY          *NbufList;\r
   NET_BUF             *PduHdr;\r
@@ -2273,29 +2015,22 @@ Returns:
   return Pdu;\r
 }\r
 \r
-LIST_ENTRY     *\r
+/**\r
+  Generate a consecutive sequence of iSCSI SCSI Data Out PDUs.\r
+\r
+  @param[in]  Data The data  which will be carried by the sequence of iSCSI SCSI Data Out PDUs.\r
+  @param[in]  Tcb  The task control block of the data to send out.\r
+  @param[in]  Lun  The LUN the data will be sent to.\r
+\r
+  @return A list of net buffers with each of them wraps an iSCSI SCSI Data Out PDU.\r
+  @return NULL Some unexpected error happened.\r
+**/\r
+LIST_ENTRY *\r
 IScsiGenerateDataOutPduSequence (\r
   IN UINT8      *Data,\r
   IN ISCSI_TCB  *Tcb,\r
   IN UINT64     Lun\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Generate a consecutive sequence of iSCSI SCSI Data Out PDUs.\r
-\r
-Arguments:\r
-\r
-  Data - The data  which will be carried by the sequence of iSCSI SCSI Data Out PDUs.\r
-  Tcb  - The task control block of the data to send out.\r
-  Lun  - The LUN the data will be sent to.\r
-\r
-Returns:\r
-\r
-  A list of net buffers with each of them wraps an iSCSI SCSI Data Out PDU.\r
-\r
---*/\r
 {\r
   LIST_ENTRY          *PduList;\r
   UINT32              DataSN;\r
@@ -2353,30 +2088,23 @@ ON_EXIT:
   return PduList;\r
 }\r
 \r
+/**\r
+  Send the Data in a sequence of Data Out PDUs one by one.\r
+\r
+  @param[in]  Data            The data to carry by Data Out PDUs.\r
+  @param[in]  Lun             The LUN the data will be sent to.\r
+  @param[in]  Tcb             The task control block.\r
+\r
+  @retval EFI_SUCCES           The data is sent out to the LUN.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiSendDataOutPduSequence (\r
   IN UINT8      *Data,\r
   IN UINT64     Lun,\r
   IN ISCSI_TCB  *Tcb\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Send the Data in a sequence of Data Out PDUs one by one.\r
-\r
-Arguments:\r
-\r
-  Data - The data to carry by Data Out PDUs.\r
-  Lun  - The LUN the data will be sent to.\r
-  Tcb  - The task control block.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES           - The data is sent out to the LUN.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-\r
---*/\r
 {\r
   LIST_ENTRY      *DataOutPduList;\r
   LIST_ENTRY      *Entry;\r
@@ -2410,31 +2138,25 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Process the received iSCSI SCSI Data In PDU.\r
+\r
+  @param[in]        Pdu      The Data In PDU received.\r
+  @param[in]        Tcb      The task control block.\r
+  @param[in, out]   Packet   The EXT SCSI PASS THRU request packet.\r
+\r
+  @retval EFI_SUCCES           The check on the Data IN PDU is passed and some update\r
+                               actions are taken.\r
+  @retval EFI_PROTOCOL_ERROR   Some kind of iSCSI protocol errror happened.\r
+  @retval EFI_BAD_BUFFER_SIZEE The buffer was not the proper size for the request.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiOnDataInRcvd (\r
   IN NET_BUF                                         *Pdu,\r
   IN ISCSI_TCB                                       *Tcb,\r
   IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *Packet\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Process the received iSCSI SCSI Data In PDU.\r
-\r
-Arguments:\r
-\r
-  Pdu    - The Data In PDU received.\r
-  Tcb    - The task control block.\r
-  Packet - The EXT SCSI PASS THRU request packet.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES          - The check on the Data IN PDU is passed and some update\r
-                        actions are taken.\r
-  EFI_PROTOCOL_ERROR  - Some kind of iSCSI protocol errror happened.\r
-\r
---*/\r
 {\r
   ISCSI_SCSI_DATA_IN  *DataInHdr;\r
   EFI_STATUS          Status;\r
@@ -2502,6 +2224,18 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Process the received iSCSI R2T PDU.\r
+\r
+  @param[in]       Pdu       The R2T PDU received.\r
+  @param[in]       Tcb       The task control block.\r
+  @param[in]       Lun       The Lun.\r
+  @param[in, out]  Packet    The EXT SCSI PASS THRU request packet.\r
+\r
+  @retval EFI_SUCCES         The R2T PDU is valid and the solicited data is sent out.\r
+  @retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror happened.\r
+  @retval Others             Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiOnR2TRcvd (\r
   IN NET_BUF                                         *Pdu,\r
@@ -2509,25 +2243,6 @@ IScsiOnR2TRcvd (
   IN UINT64                                          Lun,\r
   IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *Packet\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Process the received iSCSI R2T PDU.\r
-\r
-Arguments:\r
-\r
-  Pdu    - The R2T PDU received.\r
-  Tcb    - The task control block.\r
-  Lun    - The Lun.\r
-  Packet - The EXT SCSI PASS THRU request packet.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES          - The R2T PDU is valid and the solicited data is sent out.\r
-  EFI_PROTOCOL_ERROR  - Some kind of iSCSI protocol errror happened.\r
-\r
---*/\r
 {\r
   ISCSI_READY_TO_TRANSFER *R2THdr;\r
   EFI_STATUS              Status;\r
@@ -2573,30 +2288,24 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Process the received iSCSI SCSI Response PDU.\r
+\r
+  @param[in]       Pdu      The Response PDU received.\r
+  @param[in]       Tcb      The task control block.\r
+  @param[in, out]  Packet   The EXT SCSI PASS THRU request packet.\r
+\r
+  @retval EFI_SUCCES         The Response PDU is processed.\r
+  @retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror happened.\r
+  @retval EFI_BAD_BUFFER_SIZEE The buffer was not the proper size for the request.\r
+  @retval Others             Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiOnScsiRspRcvd (\r
   IN NET_BUF                                         *Pdu,\r
   IN ISCSI_TCB                                       *Tcb,\r
   IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *Packet\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Process the received iSCSI SCSI Response PDU.\r
-\r
-Arguments:\r
-\r
-  Pdu    - The Response PDU received.\r
-  Tcb    - The task control block.\r
-  Packet - The EXT SCSI PASS THRU request packet.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES         - The Response PDU is processed.\r
-  EFI_PROTOCOL_ERROR - Some kind of iSCSI protocol errror happened.\r
-\r
---*/\r
 {\r
   SCSI_RESPONSE     *ScsiRspHdr;\r
   ISCSI_SENSE_DATA  *SenseData;\r
@@ -2680,29 +2389,21 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Process the received NOP In PDU.\r
+\r
+  @param[in]  Pdu            The NOP In PDU received.\r
+  @param[in]  Tcb            The task control block.\r
+\r
+  @retval EFI_SUCCES         The NOP In PDU is processed and the related sequence\r
+                             numbers are updated.\r
+  @retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror happened.\r
+**/\r
 EFI_STATUS\r
 IScsiOnNopInRcvd (\r
   IN NET_BUF    *Pdu,\r
   IN ISCSI_TCB  *Tcb\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Process the received NOP In PDU.\r
-\r
-Arguments:\r
-\r
-  Pdu    - The NOP In PDU received.\r
-  Tcb    - The task control block.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES          - The NOP In PDU is processed and the related sequence\r
-                        numbers are updated.\r
-  EFI_PROTOCOL_ERROR  - Some kind of iSCSI protocol errror happened.\r
-\r
---*/\r
 {\r
   ISCSI_NOP_IN  *NopInHdr;\r
   EFI_STATUS    Status;\r
@@ -2729,6 +2430,21 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.\r
+\r
+  @param[in]       PassThru  The EXT SCSI PASS THRU protocol.\r
+  @param[in]       Target    The target ID.\r
+  @param[in]       Lun       The LUN.\r
+  @param[in, out]  Packet    The request packet containing IO request, SCSI command\r
+                             buffer and buffers to read/write.\r
+                             \r
+  @retval EFI_SUCCES           The SCSI command is executed and the result is updated to \r
+                               the Packet.\r
+  @retval EFI_DEVICE_ERROR     Some unexpected error happened.\r
+  @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval Others               Some unexpected error happened.\r
+**/\r
 EFI_STATUS\r
 IScsiExecuteScsiCommand (\r
   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL                 *PassThru,\r
@@ -2736,27 +2452,6 @@ IScsiExecuteScsiCommand (
   IN UINT64                                          Lun,\r
   IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *Packet\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.\r
-\r
-Arguments:\r
-\r
-  PassThru - The EXT SCSI PASS THRU protocol.\r
-  Target   - The target ID.\r
-  Lun      - The LUN.\r
-  Packet   - The request packet containing IO request, SCSI command buffer and\r
-             buffers to read/write.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES       - The SCSI command is executed and the result is updated to \r
-                     the Packet.\r
-  EFI_DEVICE_ERROR - Some unexpected error happened.\r
-\r
---*/\r
 {\r
   EFI_STATUS              Status;\r
   ISCSI_DRIVER_DATA       *Private;\r
@@ -2849,7 +2544,7 @@ Returns:
     //\r
     // Start the timeout timer.\r
     //\r
-    if (Timeout) {\r
+    if (Timeout != 0) {\r
       Status = gBS->SetTimer (Conn->TimeoutEvent, TimerRelative, Timeout);\r
       if (EFI_ERROR (Status)) {\r
         goto ON_EXIT;\r
@@ -2923,26 +2618,18 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
+/**\r
+  Reinstate the session on some error.\r
+\r
+  @param[in]  Private The iSCSI driver data.\r
+\r
+  @retval EFI_SUCCES  The session is reinstated from some error.\r
+  @retval Other       Reinstatement failed.\r
+**/\r
 EFI_STATUS\r
 IScsiSessionReinstatement (\r
   IN ISCSI_DRIVER_DATA  *Private\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Reinstate the session on some error.\r
-\r
-Arguments:\r
-\r
-  Private - The iSCSI driver data.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES - The session is reinstated from some error.\r
-  other      - Reinstatement failed.\r
-\r
---*/\r
 {\r
   ISCSI_SESSION *Session;\r
   EFI_STATUS    Status;\r
@@ -2964,27 +2651,17 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Initialize some session parameters before login.\r
+\r
+  @param[in]  Session  The iSCSI session.\r
+  @param[in]  Recovery Whether the request is from a fresh new start or recovery.\r
+**/\r
 VOID\r
 IScsiSessionInit (\r
   IN ISCSI_SESSION  *Session,\r
   IN BOOLEAN        Recovery\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialize some session parameters before login.\r
-\r
-Arguments:\r
-\r
-  Session  - The iSCSI session.\r
-  Recovery - Whether the request is from a fresh new start or recovery.\r
-\r
-Returns:\r
-\r
-  None.\r
-\r
---*/\r
 {\r
   UINT32  Random;\r
 \r
@@ -3025,26 +2702,18 @@ Returns:
   Session->ErrorRecoveryLevel   = 0;\r
 }\r
 \r
-EFI_STATUS\r
-IScsiSessionAbort (\r
-  IN ISCSI_SESSION  *Session\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Abort the iSCSI session, that is, reset all the connection and free the\r
   resources.\r
 \r
-Arguments:\r
+  @param[in]  Session The iSCSI session.\r
 \r
-  Session - The iSCSI session.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCES - The session is aborted.\r
-\r
---*/\r
+  @retval EFI_SUCCES  The session is aborted.\r
+**/\r
+EFI_STATUS\r
+IScsiSessionAbort (\r
+  IN ISCSI_SESSION  *Session\r
+  )\r
 {\r
   ISCSI_DRIVER_DATA *Private;\r
   ISCSI_CONNECTION  *Conn;\r