]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code Scrub:
authorjji4 <jji4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Nov 2008 01:30:58 +0000 (01:30 +0000)
committerjji4 <jji4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Nov 2008 01:30:58 +0000 (01:30 +0000)
MdeModulePkg\Bus\ScsiBusDxe\
MdeModulePkg\Bus\ScsiDisk\

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6465 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Scsi/ScsiBusDxe/ComponentName.c
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf

index 0e18db5800ae0ae9199a42320d32963dfd7e5c3e..59c8b5b671b5ea9c04a374bb2f3ef1cc1e389117 100644 (file)
@@ -13,25 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 \r
-#include <Uefi.h>\r
-\r
-\r
-#include <Protocol/ScsiPassThru.h>\r
-#include <Protocol/ScsiPassThruExt.h>\r
-#include <Protocol/ScsiIo.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Protocol/DevicePath.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/ScsiLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/DevicePathLib.h>\r
-\r
-\r
 #include "ScsiBus.h"\r
 \r
 //\r
@@ -68,10 +49,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[]
   by This does not support the language specified by Language,\r
   then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language. This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -80,7 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[]
                                 to the driver writer. Language is specified\r
                                 in RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 driver specified by This in the language\r
                                 specified by Language.\r
@@ -127,15 +108,15 @@ ScsiBusComponentNameGetDriverName (
   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
   support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
                                 specified by This is managing.  This handle\r
                                 specifies the controller whose name is to be\r
                                 returned.\r
 \r
-  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
                                 the name of.  This is an optional parameter that\r
                                 may be NULL.  It will be NULL for device\r
                                 drivers.  It will also be NULL for a bus drivers\r
@@ -144,7 +125,7 @@ ScsiBusComponentNameGetDriverName (
                                 driver that wishes to retrieve the name of a\r
                                 child controller.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language.  This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -153,7 +134,7 @@ ScsiBusComponentNameGetDriverName (
                                 to the driver writer. Language is specified in\r
                                 RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 controller specified by ControllerHandle and\r
                                 ChildHandle in the language specified by\r
index 4efee5b05baed93ab076074a67ebe6a7394d2fe0..73038c453a5de1b25ec5b35000c8eed592500cb5 100644 (file)
@@ -14,27 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 \r
-#include <Uefi.h>\r
-\r
-\r
-#include <Protocol/ScsiPassThru.h>\r
-#include <Protocol/ScsiPassThruExt.h>\r
-#include <Protocol/ScsiIo.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Protocol/DevicePath.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/ScsiLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/DevicePathLib.h>\r
-\r
 #include "ScsiBus.h"\r
 \r
+\r
 EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {\r
   SCSIBusDriverBindingSupported,\r
   SCSIBusDriverBindingStart,\r
@@ -52,37 +34,59 @@ EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
 //\r
 EFI_GUID  mScsiBusProtocolGuid = EFI_SCSI_BUS_PROTOCOL_GUID;\r
 \r
-VOID  *WorkingBuffer;\r
+VOID  *mWorkingBuffer;\r
+\r
+/**\r
+  Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet.\r
 \r
+  @param  Packet         The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET\r
+  @param  CommandPacket  The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiioToPassThruPacket (\r
   IN      EFI_SCSI_IO_SCSI_REQUEST_PACKET         *Packet,\r
-  IN OUT  EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *CommandPacket\r
+  OUT     EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *CommandPacket\r
   );\r
 \r
+/**\r
+  Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to EFI_SCSI_IO_SCSI_REQUEST_PACKET packet.\r
+\r
+  @param  ScsiPacket  The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
+  @param  Packet      The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PassThruToScsiioPacket (\r
   IN     EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *ScsiPacket,\r
-  IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET         *Packet\r
+  OUT    EFI_SCSI_IO_SCSI_REQUEST_PACKET         *Packet\r
   );\r
+\r
+/**\r
+  Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0\r
+  SCSI IO Packet.\r
+\r
+  @param  Event    The instance of EFI_EVENT.\r
+  @param  Context  The parameter passed in.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 NotifyFunction (\r
-  EFI_EVENT  Event,\r
-  VOID       *Context\r
+  IN  EFI_EVENT  Event,\r
+  IN  VOID       *Context\r
   );\r
 \r
 /**\r
   The user Entry Point for module ScsiBus. The user code starts with this function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
-  @param[in] SystemTable    A pointer to the EFI System Table.\r
+  @param  ImageHandle    The firmware allocated handle for the EFI image.\r
+  @param  SystemTable    A pointer to the EFI System Table.\r
 \r
-  @retval EFI_SUCCESS       The entry point is executed successfully.\r
-  @retval other             Some error occurs when executing this entry point.\r
+  @retval EFI_SUCCESS    The entry point is executed successfully.\r
+  @retval other          Some error occurs when executing this entry point.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -110,6 +114,26 @@ InitializeScsiBus(
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Test to see if this driver supports ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions. If\r
+  any other agent wishes to call Supported() it must also follow these calling\r
+  restrictions.\r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+  @retval other               This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SCSIBusDriverBindingSupported (\r
@@ -117,26 +141,6 @@ SCSIBusDriverBindingSupported (
   IN EFI_HANDLE                   Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
-  that has ExtScsiPassThruProtocol/ScsiPassThruProtocol installed will be supported.\r
-\r
-Arguments:\r
-\r
-  This                - Protocol instance pointer.\r
-  Controller          - Handle of device to test\r
-  RemainingDevicePath - Not used\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS         - This driver supports this device.\r
-  EFI_UNSUPPORTED     - This driver does not support this device.\r
-\r
---*/\r
-\r
 {\r
   EFI_STATUS  Status;\r
   EFI_SCSI_PASS_THRU_PROTOCOL *PassThru;\r
@@ -194,6 +198,26 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions. If\r
+  any other agent wishes to call Start() it must also follow these calling\r
+  restrictions.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SCSIBusDriverBindingStart (\r
@@ -201,22 +225,6 @@ SCSIBusDriverBindingStart (
   IN EFI_HANDLE                   Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Starting the SCSI Bus Driver\r
-\r
-Arguments:\r
-  This                - Protocol instance pointer.\r
-  Controller          - Handle of device to test\r
-  RemainingDevicePath - Not used\r
-\r
-Returns:\r
-  EFI_SUCCESS         - This driver supports this device.\r
-  EFI_UNSUPPORTED     - This driver does not support this device.\r
-  EFI_DEVICE_ERROR    - This driver cannot be started due to device Error\r
-\r
---*/\r
 {\r
   UINT64                                Lun;\r
   UINT8                                 *TargetId;\r
@@ -239,7 +247,7 @@ Returns:
   FromFirstTarget = FALSE;\r
   ExtScsiSupport  = FALSE;\r
   PassThruStatus  = EFI_SUCCESS;\r
-    \r
+  \r
   ScsiTargetId = AllocateZeroPool(sizeof(SCSI_TARGET_ID));\r
   if (ScsiTargetId == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -419,7 +427,7 @@ Returns:
     //\r
     Status = ScsiScanCreateDevice (This, Controller, ScsiTargetId, Lun, ScsiBusDev);\r
   }\r
-  gBS->FreePool (ScsiTargetId);\r
+  FreePool (ScsiTargetId);\r
   return EFI_SUCCESS;\r
   \r
 ErrorExit:\r
@@ -454,6 +462,25 @@ ErrorExit:
   return Status;\r
 }\r
 \r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service DisconnectController().\r
+  In order to make drivers as small as possible, there are a few calling\r
+  restrictions for this service. DisconnectController() must follow these\r
+  calling restrictions. If any other agent wishes to call Stop() it must also\r
+  follow these calling restrictions.\r
+  \r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SCSIBusDriverBindingStop (\r
@@ -462,25 +489,6 @@ SCSIBusDriverBindingStop (
   IN  UINTN                           NumberOfChildren,\r
   IN  EFI_HANDLE                      *ChildHandleBuffer\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Stop this driver on ControllerHandle. Support stoping any child handles\r
-  created by this driver.\r
-\r
-Arguments:\r
-\r
-  This              - Protocol instance pointer.\r
-  Controller        - Handle of device to stop driver on\r
-  NumberOfChildren  - Number of Children in the ChildHandleBuffer\r
-  ChildHandleBuffer - List of handles for the children we need to stop.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS\r
-  Others\r
---*/\r
 {\r
   EFI_STATUS                  Status;\r
   BOOLEAN                     AllChildrenStopped;\r
@@ -627,30 +635,24 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Retrieves the device type information of the SCSI Controller.\r
+\r
+  @param  This          Protocol instance pointer.\r
+  @param  DeviceType    A pointer to the device type information retrieved from\r
+                        the SCSI Controller. \r
+\r
+  @retval EFI_SUCCESS             Retrieves the device type information successfully.\r
+  @retval EFI_INVALID_PARAMETER   The DeviceType is NULL.\r
+  \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiGetDeviceType (\r
   IN  EFI_SCSI_IO_PROTOCOL     *This,\r
   OUT UINT8                    *DeviceType\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Retrieves the device type information of the SCSI Controller.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-  DeviceType            - A pointer to the device type information\r
-                            retrieved from the SCSI Controller. \r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - Retrieves the device type information successfully.\r
-  EFI_INVALID_PARAMETER - The DeviceType is NULL.\r
-  \r
---*/\r
 {\r
   SCSI_IO_DEV *ScsiIoDevice;\r
 \r
@@ -663,6 +665,20 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Retrieves the device location in the SCSI channel.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target A pointer to the Target ID of a SCSI device\r
+                 on the SCSI channel.\r
+  @param  Lun    A pointer to the LUN of the SCSI device on\r
+                 the SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           Retrieves the device location successfully.\r
+  @retval EFI_INVALID_PARAMETER The Target or Lun is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiGetDeviceLocation (\r
@@ -670,26 +686,6 @@ ScsiGetDeviceLocation (
   IN OUT UINT8                **Target,\r
   OUT UINT64                  *Lun\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Retrieves the device location in the SCSI channel.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-  Target                - A pointer to the Target Array which represents ID of a SCSI device \r
-                          on the SCSI channel. \r
-  Lun                   - A pointer to the LUN of the SCSI device on \r
-                          the SCSI channel.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - Retrieves the device location successfully.\r
-  EFI_INVALID_PARAMETER - The Target or Lun is NULL.\r
-\r
---*/\r
 {\r
   SCSI_IO_DEV *ScsiIoDevice;\r
 \r
@@ -706,30 +702,23 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Resets the SCSI Bus that the SCSI Controller is attached to.\r
+\r
+  @param  This  Protocol instance pointer.\r
+\r
+  @retval  EFI_SUCCESS       The SCSI bus is reset successfully.\r
+  @retval  EFI_DEVICE_ERROR  Errors encountered when resetting the SCSI bus.\r
+  @retval  EFI_UNSUPPORTED   The bus reset operation is not supported by the\r
+                             SCSI Host Controller.\r
+  @retval  EFI_TIMEOUT       A timeout occurred while attempting to reset \r
+                             the SCSI bus.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiResetBus (\r
   IN  EFI_SCSI_IO_PROTOCOL     *This\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Resets the SCSI Bus that the SCSI Controller is attached to.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The SCSI bus is reset successfully.\r
-  EFI_DEVICE_ERROR      - Errors encountered when resetting the SCSI bus.\r
-  EFI_UNSUPPORTED       - The bus reset operation is not supported by the\r
-                          SCSI Host Controller.\r
-  EFI_TIMEOUT           - A timeout occurred while attempting to reset \r
-                          the SCSI bus.\r
---*/\r
 {\r
   SCSI_IO_DEV *ScsiIoDevice;\r
 \r
@@ -742,31 +731,23 @@ Returns:
   }\r
 }\r
 \r
+\r
+/**\r
+  Resets the SCSI Controller that the device handle specifies.\r
+\r
+  @param  This  Protocol instance pointer.\r
+\r
+  @retval  EFI_SUCCESS       Reset the SCSI controller successfully.\r
+  @retval  EFI_DEVICE_ERROR  Errors are encountered when resetting the SCSI Controller.\r
+  @retval  EFI_UNSUPPORTED   The SCSI bus does not support a device reset operation.\r
+  @retval  EFI_TIMEOUT       A timeout occurred while attempting to reset the\r
+                             SCSI Controller.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiResetDevice (\r
   IN  EFI_SCSI_IO_PROTOCOL     *This\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Resets the SCSI Controller that the device handle specifies.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS           - Reset the SCSI controller successfully.\r
-  EFI_DEVICE_ERROR      - Errors are encountered when resetting the\r
-                          SCSI Controller.\r
-  EFI_UNSUPPORTED       - The SCSI bus does not support a device \r
-                          reset operation.\r
-  EFI_TIMEOUT           - A timeout occurred while attempting to \r
-                          reset the SCSI Controller.\r
---*/\r
 {\r
   SCSI_IO_DEV  *ScsiIoDevice;\r
   UINT8        Target[TARGET_MAX_BYTES];\r
@@ -790,25 +771,14 @@ Returns:
   }\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-ScsiExecuteSCSICommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL                         *This,\r
-  IN OUT  EFI_SCSI_IO_SCSI_REQUEST_PACKET          *Packet,\r
-  IN EFI_EVENT                                     Event  OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Sends a SCSI Request Packet to the SCSI Controller for execution.\r
-    \r
-Arguments:\r
 \r
-  This                  - Protocol instance pointer.\r
-  Packet                - The SCSI request packet to send to the SCSI \r
+  @param  This            Protocol instance pointer.\r
+  @param  CommandPacket   The SCSI request packet to send to the SCSI \r
                           Controller specified by the device handle.\r
-  Event                 - If the SCSI bus where the SCSI device is attached\r
+  @param  Event           If the SCSI bus where the SCSI device is attached\r
                           does not support non-blocking I/O, then Event is \r
                           ignored, and blocking I/O is performed.  \r
                           If Event is NULL, then blocking I/O is performed.\r
@@ -816,40 +786,46 @@ Arguments:
                           supported, then non-blocking I/O is performed,\r
                           and Event will be signaled when the SCSI Request\r
                           Packet completes.\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The SCSI Request Packet was sent by the host \r
-                          successfully, and TransferLength bytes were \r
-                          transferred to/from DataBuffer.See \r
-                          HostAdapterStatus, TargetStatus, \r
-                          SenseDataLength, and SenseData in that order\r
-                          for additional status information.\r
-  EFI_BAD_BUFFER_SIZE  - The SCSI Request Packet was executed, \r
-                          but the entire DataBuffer could not be transferred.\r
-                          The actual number of bytes transferred is returned\r
-                          in TransferLength. See HostAdapterStatus, \r
-                          TargetStatus, SenseDataLength, and SenseData in \r
-                          that order for additional status information.\r
-  EFI_NOT_READY         - The SCSI Request Packet could not be sent because \r
-                          there are too many SCSI Command Packets already \r
-                          queued.The caller may retry again later.\r
-  EFI_DEVICE_ERROR      - A device error occurred while attempting to send \r
-                          the SCSI Request Packet. See HostAdapterStatus, \r
-                          TargetStatus, SenseDataLength, and SenseData in \r
-                          that order for additional status information.\r
-  EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.  \r
-                          The SCSI Request Packet was not sent, so no \r
-                          additional status information is available.\r
-  EFI_UNSUPPORTED       - The command described by the SCSI Request Packet\r
-                          is not supported by the SCSI initiator(i.e., SCSI \r
-                          Host Controller). The SCSI Request Packet was not\r
-                          sent, so no additional status information is \r
-                          available.\r
-  EFI_TIMEOUT           - A timeout occurred while waiting for the SCSI \r
-                          Request Packet to execute. See HostAdapterStatus,\r
-                          TargetStatus, SenseDataLength, and SenseData in \r
-                          that order for additional status information.\r
---*/\r
+\r
+  @retval EFI_SUCCESS         The SCSI Request Packet was sent by the host \r
+                              successfully, and TransferLength bytes were \r
+                              transferred to/from DataBuffer.See \r
+                              HostAdapterStatus, TargetStatus, \r
+                              SenseDataLength, and SenseData in that order\r
+                              for additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, \r
+                              but the entire DataBuffer could not be transferred.\r
+                              The actual number of bytes transferred is returned\r
+                              in TransferLength. See HostAdapterStatus, \r
+                              TargetStatus, SenseDataLength, and SenseData in \r
+                              that order for additional status information.\r
+  @retval EFI_NOT_READY       The SCSI Request Packet could not be sent because \r
+                              there are too many SCSI Command Packets already \r
+                              queued.The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR    A device error occurred while attempting to send \r
+                              the SCSI Request Packet. See HostAdapterStatus, \r
+                              TargetStatus, SenseDataLength, and SenseData in \r
+                              that order for additional status information.\r
+  @retval EFI_INVALID_PARAMETER  The contents of CommandPacket are invalid.  \r
+                                 The SCSI Request Packet was not sent, so no \r
+                                 additional status information is available.\r
+  @retval EFI_UNSUPPORTED     The command described by the SCSI Request Packet\r
+                              is not supported by the SCSI initiator(i.e., SCSI \r
+                              Host Controller). The SCSI Request Packet was not\r
+                              sent, so no additional status information is \r
+                              available.\r
+  @retval EFI_TIMEOUT         A timeout occurred while waiting for the SCSI \r
+                              Request Packet to execute. See HostAdapterStatus,\r
+                              TargetStatus, SenseDataLength, and SenseData in \r
+                              that order for additional status information.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiExecuteSCSICommand (\r
+  IN     EFI_SCSI_IO_PROTOCOL                     *This,\r
+  IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET          *Packet,\r
+  IN     EFI_EVENT                                Event  OPTIONAL\r
+  )\r
 {\r
   SCSI_IO_DEV                                 *ScsiIoDevice;\r
   EFI_STATUS                                  Status;\r
@@ -881,7 +857,7 @@ Returns:
     Status = gBS->AllocatePool (\r
                      EfiBootServicesData,\r
                      sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET),\r
-                     (VOID**)&WorkingBuffer\r
+                     (VOID**)&mWorkingBuffer\r
                      );\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -891,9 +867,9 @@ Returns:
     //\r
     // Convert package into EFI1.0, EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET.\r
     //\r
-    Status = ScsiioToPassThruPacket(Packet, (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer);\r
+    Status = ScsiioToPassThruPacket(Packet, (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer);\r
     if (EFI_ERROR(Status)) {\r
-      gBS->FreePool(WorkingBuffer);\r
+      FreePool(mWorkingBuffer);\r
       return Status;\r
     }\r
 \r
@@ -911,7 +887,7 @@ Returns:
                        &PacketEvent\r
                        );\r
       if (EFI_ERROR(Status)) {\r
-        gBS->FreePool(WorkingBuffer);\r
+        FreePool(mWorkingBuffer);\r
         return Status;\r
       }\r
 \r
@@ -919,12 +895,12 @@ Returns:
                                           ScsiIoDevice->ScsiPassThru,\r
                                           ScsiIoDevice->Pun.ScsiId.Scsi,\r
                                           ScsiIoDevice->Lun,\r
-                                          WorkingBuffer,\r
+                                          mWorkingBuffer,\r
                                           PacketEvent\r
                                           );\r
 \r
       if (EFI_ERROR(Status)) {\r
-        gBS->FreePool(WorkingBuffer);\r
+        gBS->FreePool(mWorkingBuffer);\r
         gBS->CloseEvent(PacketEvent);\r
         return Status;\r
       }\r
@@ -938,70 +914,59 @@ Returns:
                                           ScsiIoDevice->ScsiPassThru,\r
                                           ScsiIoDevice->Pun.ScsiId.Scsi,\r
                                           ScsiIoDevice->Lun,\r
-                                          WorkingBuffer,\r
+                                          mWorkingBuffer,\r
                                           Event\r
                                           );\r
       if (EFI_ERROR(Status)) {\r
-        gBS->FreePool(WorkingBuffer);\r
+        FreePool(mWorkingBuffer);\r
         return Status;\r
       }\r
 \r
-      PassThruToScsiioPacket((EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer,Packet);\r
+      PassThruToScsiioPacket((EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer,Packet);\r
       //\r
       // After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet,\r
-      // free WorkingBuffer.\r
+      // free mWorkingBuffer.\r
       //\r
-      gBS->FreePool(WorkingBuffer);\r
+      FreePool(mWorkingBuffer);\r
     }\r
   }\r
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-ScsiScanCreateDevice (\r
-  EFI_DRIVER_BINDING_PROTOCOL   *This,\r
-  EFI_HANDLE                    Controller,\r
-  SCSI_TARGET_ID                *TargetId,\r
-  UINT64                        Lun,\r
-  SCSI_BUS_DEVICE               *ScsiBusDev\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.\r
 \r
-Arguments:\r
+  @param  This           Protocol instance pointer\r
+  @param  Controller     Controller handle\r
+  @param  TargetId       Tartget to be scanned\r
+  @param  Lun            The Lun of the SCSI device on the SCSI channel.\r
+  @param  ScsiBusDev     The pointer of SCSI_BUS_DEVICE\r
 \r
-  This              - Protocol instance pointer\r
-  Controller        - Controller handle\r
-  Pun               - The Pun of the SCSI device on the SCSI channel.\r
-  Lun               - The Lun of the SCSI device on the SCSI channel.\r
-  ScsiBusDev        - The pointer of SCSI_BUS_DEVICE\r
+  @retval EFI_SUCCESS           Successfully to discover the device and attach\r
+                                ScsiIoProtocol to it.\r
+  @retval EFI_OUT_OF_RESOURCES  Fail to discover the device.\r
 \r
-Returns:\r
-\r
-  EFI_SUCCESS       - Successfully to discover the device and attach ScsiIoProtocol to it.\r
-  EFI_OUT_OF_RESOURCES - Fail to discover the device.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiScanCreateDevice (\r
+  IN     EFI_DRIVER_BINDING_PROTOCOL   *This,\r
+  IN     EFI_HANDLE                    Controller,\r
+  IN     SCSI_TARGET_ID                *TargetId,\r
+  IN     UINT64                        Lun,\r
+  IN OUT SCSI_BUS_DEVICE               *ScsiBusDev\r
+  )\r
 {\r
   EFI_STATUS                Status;\r
   SCSI_IO_DEV               *ScsiIoDevice;\r
   EFI_DEVICE_PATH_PROTOCOL  *ScsiDevicePath;\r
 \r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  sizeof (SCSI_IO_DEV),\r
-                  (VOID **) &ScsiIoDevice\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
+  ScsiIoDevice = AllocateZeroPool (sizeof (SCSI_IO_DEV));\r
+  if (ScsiIoDevice == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  ZeroMem (ScsiIoDevice, sizeof (SCSI_IO_DEV));\r
-\r
   ScsiIoDevice->Signature                 = SCSI_IO_DEV_SIGNATURE;\r
   CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES);\r
   ScsiIoDevice->Lun                       = Lun;\r
@@ -1025,7 +990,7 @@ Returns:
 \r
 \r
   if (!DiscoverScsiDevice (ScsiIoDevice)) {\r
-    gBS->FreePool (ScsiIoDevice);\r
+    FreePool (ScsiIoDevice);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -1040,7 +1005,7 @@ Returns:
                                           &ScsiDevicePath\r
                                           );\r
     if (Status == EFI_OUT_OF_RESOURCES) {\r
-      gBS->FreePool (ScsiIoDevice);\r
+      FreePool (ScsiIoDevice);\r
       return Status;\r
     }\r
   } else {\r
@@ -1051,7 +1016,7 @@ Returns:
                                           &ScsiDevicePath\r
                                           );\r
     if (Status == EFI_OUT_OF_RESOURCES) {\r
-      gBS->FreePool (ScsiIoDevice);\r
+      FreePool (ScsiIoDevice);\r
       return Status;\r
     }\r
   }\r
@@ -1107,27 +1072,20 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-BOOLEAN\r
-EFIAPI\r
-DiscoverScsiDevice (\r
-  SCSI_IO_DEV   *ScsiIoDevice\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Discovery SCSI Device\r
 \r
-Arguments:\r
-\r
-  ScsiIoDevice    - The pointer of SCSI_IO_DEV\r
-\r
-Returns:\r
+  @param  ScsiIoDevice    The pointer of SCSI_IO_DEV\r
 \r
-  TRUE            - Find SCSI Device and verify it.\r
-  FALSE           - Unable to find SCSI Device.\r
+  @retval  TRUE   Find SCSI Device and verify it.\r
+  @retval  FALSE  Unable to find SCSI Device.\r
 \r
---*/\r
+**/\r
+BOOLEAN\r
+DiscoverScsiDevice (\r
+  IN OUT  SCSI_IO_DEV   *ScsiIoDevice\r
+  )\r
 {\r
   EFI_STATUS            Status;\r
   UINT32                InquiryDataLength;\r
@@ -1157,9 +1115,6 @@ Returns:
             FALSE\r
             );\r
   if (EFI_ERROR (Status)) {\r
-    //\r
-    //    ParseSenseData (&SenseData,SenseDataLength);\r
-    //\r
     return FALSE;\r
   }\r
   //\r
@@ -1198,29 +1153,19 @@ Returns:
 }\r
 \r
 \r
+/**\r
+  Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet.\r
+\r
+  @param  Packet         The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET\r
+  @param  CommandPacket  The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiioToPassThruPacket (\r
   IN      EFI_SCSI_IO_SCSI_REQUEST_PACKET         *Packet,\r
-  IN OUT  EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *CommandPacket\r
+  OUT     EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *CommandPacket\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to\r
-  EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet\r
-\r
-Arguments:\r
-\r
-  Packet            - The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET\r
-  CommandPacket     - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
-\r
-Returns:\r
-\r
-  NONE\r
-\r
---*/\r
 {\r
   //\r
   //EFI 1.10 doesn't support Bi-Direction Command.\r
@@ -1251,29 +1196,19 @@ Returns:
 }\r
 \r
 \r
+/**\r
+  Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to EFI_SCSI_IO_SCSI_REQUEST_PACKET packet.\r
+\r
+  @param  ScsiPacket  The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
+  @param  Packet      The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PassThruToScsiioPacket (\r
   IN     EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *ScsiPacket,\r
-  IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET         *Packet\r
+  OUT    EFI_SCSI_IO_SCSI_REQUEST_PACKET         *Packet\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to\r
-  EFI_SCSI_IO_SCSI_REQUEST_PACKET packet\r
-\r
-Arguments:\r
-\r
-  ScsiPacket        - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
-  Packet            - The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET\r
-\r
-Returns:\r
-\r
-  NONE\r
-\r
---*/\r
 {\r
   Packet->Timeout           = ScsiPacket->Timeout;\r
   Packet->Cdb               = ScsiPacket->Cdb;\r
@@ -1295,31 +1230,20 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0\r
+  SCSI IO Packet.\r
 \r
+  @param  Event    The instance of EFI_EVENT.\r
+  @param  Context  The parameter passed in.\r
 \r
+**/\r
 VOID\r
 EFIAPI\r
 NotifyFunction (\r
-  EFI_EVENT  Event,\r
-  VOID       *Context\r
+  IN  EFI_EVENT  Event,\r
+  IN  VOID       *Context\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0\r
-  SCSI IO Packet.\r
-\r
-Arguments:\r
-\r
-  Event          - The instance of EFI_EVENT.\r
-  Context        - The parameter passed in.\r
-\r
-Returns:\r
-\r
-  NONE\r
-\r
---*/\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET          *Packet;\r
   EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET   *ScsiPacket;\r
@@ -1328,7 +1252,7 @@ Returns:
 \r
   PassData = (SCSI_EVENT_DATA*)Context;\r
   Packet  = (EFI_SCSI_IO_SCSI_REQUEST_PACKET *)PassData->Data1;\r
-  ScsiPacket =  (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer;\r
+  ScsiPacket =  (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer;\r
 \r
   //\r
   // Convert EFI1.0 PassThru packet to UEFI2.0 SCSI IO Packet.\r
@@ -1337,9 +1261,9 @@ Returns:
 \r
   //\r
   // After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet,\r
-  // free WorkingBuffer.\r
+  // free mWorkingBuffer.\r
   //\r
-  gBS->FreePool(WorkingBuffer);\r
+  gBS->FreePool(mWorkingBuffer);\r
 \r
   //\r
   // Signal Event to tell caller to pick up UEFI2.0 SCSI IO Packet.\r
@@ -1348,3 +1272,4 @@ Returns:
   gBS->CloseEvent(Event);\r
   gBS->SignalEvent(CallerEvent);\r
 }\r
+\r
index 62835cffc381fafa558ee8d96d811f9b5edd607f..1d70b2cded97056677cff12142992a8165df9caf 100644 (file)
@@ -12,10 +12,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#ifndef _SCSI_BUS_H\r
-#define _SCSI_BUS_H\r
+#ifndef _SCSI_BUS_H_\r
+#define _SCSI_BUS_H_\r
 \r
 \r
+#include <Uefi.h>\r
+\r
+#include <Protocol/ScsiPassThru.h>\r
+#include <Protocol/ScsiPassThruExt.h>\r
+#include <Protocol/ScsiIo.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/DevicePath.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/ScsiLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DevicePathLib.h>\r
+\r
 #include <IndustryStandard/Scsi.h>\r
 //\r
 // 1000 * 1000 * 10\r
@@ -89,6 +107,25 @@ extern EFI_DRIVER_BINDING_PROTOCOL   gScsiBusDriverBinding;
 extern EFI_COMPONENT_NAME_PROTOCOL   gScsiBusComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL  gScsiBusComponentName2;\r
 \r
+/**\r
+  Test to see if this driver supports ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions. If\r
+  any other agent wishes to call Supported() it must also follow these calling\r
+  restrictions.\r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+  @retval other               This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SCSIBusDriverBindingSupported (\r
@@ -97,6 +134,25 @@ SCSIBusDriverBindingSupported (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   );\r
 \r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions. If\r
+  any other agent wishes to call Start() it must also follow these calling\r
+  restrictions.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SCSIBusDriverBindingStart (\r
@@ -105,6 +161,25 @@ SCSIBusDriverBindingStart (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   );\r
 \r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service DisconnectController().\r
+  In order to make drivers as small as possible, there are a few calling\r
+  restrictions for this service. DisconnectController() must follow these\r
+  calling restrictions. If any other agent wishes to call Stop() it must also\r
+  follow these calling restrictions.\r
+  \r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SCSIBusDriverBindingStop (\r
@@ -127,10 +202,10 @@ SCSIBusDriverBindingStop (
   by This does not support the language specified by Language,\r
   then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language. This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -139,7 +214,7 @@ SCSIBusDriverBindingStop (
                                 to the driver writer. Language is specified\r
                                 in RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 driver specified by This in the language\r
                                 specified by Language.\r
@@ -164,7 +239,6 @@ ScsiBusComponentNameGetDriverName (
   OUT CHAR16                       **DriverName\r
   );\r
 \r
-\r
 /**\r
   Retrieves a Unicode string that is the user readable name of the controller\r
   that is being managed by a driver.\r
@@ -178,15 +252,15 @@ ScsiBusComponentNameGetDriverName (
   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
   support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
                                 specified by This is managing.  This handle\r
                                 specifies the controller whose name is to be\r
                                 returned.\r
 \r
-  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
                                 the name of.  This is an optional parameter that\r
                                 may be NULL.  It will be NULL for device\r
                                 drivers.  It will also be NULL for a bus drivers\r
@@ -195,7 +269,7 @@ ScsiBusComponentNameGetDriverName (
                                 driver that wishes to retrieve the name of a\r
                                 child controller.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language.  This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -204,7 +278,7 @@ ScsiBusComponentNameGetDriverName (
                                 to the driver writer. Language is specified in\r
                                 RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 controller specified by ControllerHandle and\r
                                 ChildHandle in the language specified by\r
@@ -243,107 +317,87 @@ ScsiBusComponentNameGetControllerName (
   OUT CHAR16                                          **ControllerName\r
   );\r
 \r
+/**\r
+  Retrieves the device type information of the SCSI Controller.\r
 \r
+  @param  This          Protocol instance pointer.\r
+  @param  DeviceType    A pointer to the device type information retrieved from\r
+                        the SCSI Controller. \r
+\r
+  @retval EFI_SUCCESS             Retrieves the device type information successfully.\r
+  @retval EFI_INVALID_PARAMETER   The DeviceType is NULL.\r
+  \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiGetDeviceType (\r
   IN  EFI_SCSI_IO_PROTOCOL     *This,\r
   OUT UINT8                    *DeviceType\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Retrieves the device type information of the SCSI Controller.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-  DeviceType            - A pointer to the device type information\r
-                            retrieved from the SCSI Controller. \r
+  );\r
 \r
-Returns:\r
+/**\r
+  Retrieves the device location in the SCSI channel.\r
 \r
-  EFI_SUCCESS           - Retrieves the device type information successfully.\r
-  EFI_INVALID_PARAMETER - The DeviceType is NULL.\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target A pointer to the Target ID of a SCSI device\r
+                 on the SCSI channel.\r
+  @param  Lun    A pointer to the LUN of the SCSI device on\r
+                 the SCSI channel.\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS           Retrieves the device location successfully.\r
+  @retval EFI_INVALID_PARAMETER The Target or Lun is NULL.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-ScsiResetBus (\r
-  IN  EFI_SCSI_IO_PROTOCOL     *This\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+ScsiGetDeviceLocation (\r
+  IN  EFI_SCSI_IO_PROTOCOL    *This,\r
+  IN OUT UINT8                **Target,\r
+  OUT UINT64                  *Lun\r
+  );\r
 \r
+/**\r
   Resets the SCSI Bus that the SCSI Controller is attached to.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
 \r
-Returns:\r
-\r
-  EFI_SUCCESS           - The SCSI bus is reset successfully.\r
-  EFI_DEVICE_ERROR      - Errors encountered when resetting the SCSI bus.\r
-  EFI_UNSUPPORTED       - The bus reset operation is not supported by the\r
-                          SCSI Host Controller.\r
-  EFI_TIMEOUT           - A timeout occurred while attempting to reset \r
-                          the SCSI bus.\r
-\r
---*/\r
-;\r
+  @param  This  Protocol instance pointer.\r
 \r
+  @retval  EFI_SUCCESS       The SCSI bus is reset successfully.\r
+  @retval  EFI_DEVICE_ERROR  Errors encountered when resetting the SCSI bus.\r
+  @retval  EFI_UNSUPPORTED   The bus reset operation is not supported by the\r
+                             SCSI Host Controller.\r
+  @retval  EFI_TIMEOUT       A timeout occurred while attempting to reset \r
+                             the SCSI bus.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-ScsiResetDevice (\r
+ScsiResetBus (\r
   IN  EFI_SCSI_IO_PROTOCOL     *This\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  );\r
 \r
+/**\r
   Resets the SCSI Controller that the device handle specifies.\r
-    \r
-Arguments:\r
-\r
-  This                  - Protocol instance pointer.\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS           - Reset the SCSI controller successfully.\r
-  EFI_DEVICE_ERROR      - Errors are encountered when resetting the\r
-                          SCSI Controller.\r
-  EFI_UNSUPPORTED       - The SCSI bus does not support a device \r
-                          reset operation.\r
-  EFI_TIMEOUT           - A timeout occurred while attempting to \r
-                          reset the SCSI Controller.\r
 \r
---*/\r
-;\r
+  @param  This  Protocol instance pointer.\r
 \r
+  @retval  EFI_SUCCESS       Reset the SCSI controller successfully.\r
+  @retval  EFI_DEVICE_ERROR  Errors are encountered when resetting the SCSI Controller.\r
+  @retval  EFI_UNSUPPORTED   The SCSI bus does not support a device reset operation.\r
+  @retval  EFI_TIMEOUT       A timeout occurred while attempting to reset the\r
+                             SCSI Controller.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-ScsiExecuteSCSICommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL                 *This,\r
-  IN OUT  EFI_SCSI_IO_SCSI_REQUEST_PACKET  *CommandPacket,\r
-  IN  EFI_EVENT                            Event\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+ScsiResetDevice (\r
+  IN  EFI_SCSI_IO_PROTOCOL     *This\r
+  );\r
 \r
+/**\r
   Sends a SCSI Request Packet to the SCSI Controller for execution.\r
-    \r
-Arguments:\r
 \r
-  This                  - Protocol instance pointer.\r
-  Packet                - The SCSI request packet to send to the SCSI \r
+  @param  This            Protocol instance pointer.\r
+  @param  CommandPacket   The SCSI request packet to send to the SCSI \r
                           Controller specified by the device handle.\r
-  Event                 - If the SCSI bus where the SCSI device is attached\r
+  @param  Event           If the SCSI bus where the SCSI device is attached\r
                           does not support non-blocking I/O, then Event is \r
                           ignored, and blocking I/O is performed.  \r
                           If Event is NULL, then blocking I/O is performed.\r
@@ -351,92 +405,83 @@ Arguments:
                           supported, then non-blocking I/O is performed,\r
                           and Event will be signaled when the SCSI Request\r
                           Packet completes.\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The SCSI Request Packet was sent by the host \r
-                          successfully, and TransferLength bytes were \r
-                          transferred to/from DataBuffer.See \r
-                          HostAdapterStatus, TargetStatus, \r
-                          SenseDataLength, and SenseData in that order\r
-                          for additional status information.\r
-  EFI_BAD_BUFFER_SIZE   - The SCSI Request Packet was executed, \r
-                          but the entire DataBuffer could not be transferred.\r
-                          The actual number of bytes transferred is returned\r
-                          in TransferLength. See HostAdapterStatus, \r
-                          TargetStatus, SenseDataLength, and SenseData in \r
-                          that order for additional status information.\r
-  EFI_NOT_READY         - The SCSI Request Packet could not be sent because \r
-                          there are too many SCSI Command Packets already \r
-                          queued.The caller may retry again later.\r
-  EFI_DEVICE_ERROR      - A device error occurred while attempting to send \r
-                          the SCSI Request Packet. See HostAdapterStatus, \r
-                          TargetStatus, SenseDataLength, and SenseData in \r
-                          that order for additional status information.\r
-  EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.  \r
-                          The SCSI Request Packet was not sent, so no \r
-                          additional status information is available.\r
-  EFI_UNSUPPORTED       - The command described by the SCSI Request Packet\r
-                          is not supported by the SCSI initiator(i.e., SCSI \r
-                          Host Controller). The SCSI Request Packet was not\r
-                          sent, so no additional status information is \r
-                          available.\r
-  EFI_TIMEOUT           - A timeout occurred while waiting for the SCSI \r
-                          Request Packet to execute. See HostAdapterStatus,\r
-                          TargetStatus, SenseDataLength, and SenseData in \r
-                          that order for additional status information.\r
-\r
---*/\r
-;\r
 \r
+  @retval EFI_SUCCESS         The SCSI Request Packet was sent by the host \r
+                              successfully, and TransferLength bytes were \r
+                              transferred to/from DataBuffer.See \r
+                              HostAdapterStatus, TargetStatus, \r
+                              SenseDataLength, and SenseData in that order\r
+                              for additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, \r
+                              but the entire DataBuffer could not be transferred.\r
+                              The actual number of bytes transferred is returned\r
+                              in TransferLength. See HostAdapterStatus, \r
+                              TargetStatus, SenseDataLength, and SenseData in \r
+                              that order for additional status information.\r
+  @retval EFI_NOT_READY       The SCSI Request Packet could not be sent because \r
+                              there are too many SCSI Command Packets already \r
+                              queued.The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR    A device error occurred while attempting to send \r
+                              the SCSI Request Packet. See HostAdapterStatus, \r
+                              TargetStatus, SenseDataLength, and SenseData in \r
+                              that order for additional status information.\r
+  @retval EFI_INVALID_PARAMETER  The contents of CommandPacket are invalid.  \r
+                                 The SCSI Request Packet was not sent, so no \r
+                                 additional status information is available.\r
+  @retval EFI_UNSUPPORTED     The command described by the SCSI Request Packet\r
+                              is not supported by the SCSI initiator(i.e., SCSI \r
+                              Host Controller). The SCSI Request Packet was not\r
+                              sent, so no additional status information is \r
+                              available.\r
+  @retval EFI_TIMEOUT         A timeout occurred while waiting for the SCSI \r
+                              Request Packet to execute. See HostAdapterStatus,\r
+                              TargetStatus, SenseDataLength, and SenseData in \r
+                              that order for additional status information.\r
+**/\r
 EFI_STATUS\r
-ScsiScanCreateDevice (\r
-  EFI_DRIVER_BINDING_PROTOCOL   *This,\r
-  EFI_HANDLE                    Controller,\r
-  SCSI_TARGET_ID                *TargetId,\r
-  UINT64                        Lun,\r
-  SCSI_BUS_DEVICE              *ScsiBusDev\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+EFIAPI\r
+ScsiExecuteSCSICommand (\r
+  IN  EFI_SCSI_IO_PROTOCOL                 *This,\r
+  IN OUT  EFI_SCSI_IO_SCSI_REQUEST_PACKET  *CommandPacket,\r
+  IN  EFI_EVENT                            Event  OPTIONAL\r
+  );\r
 \r
+/**\r
   Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.\r
 \r
-Arguments:\r
-\r
-  This              - Protocol instance pointer\r
-  Controller        - Controller handle\r
-  Pun               - The Pun of the SCSI device on the SCSI channel.\r
-  Lun               - The Lun of the SCSI device on the SCSI channel.\r
-  ScsiBusDev        - The pointer of SCSI_BUS_DEVICE\r
-\r
-Returns:\r
+  @param  This           Protocol instance pointer\r
+  @param  Controller     Controller handle\r
+  @param  TargetId       Tartget to be scanned\r
+  @param  Lun            The Lun of the SCSI device on the SCSI channel.\r
+  @param  ScsiBusDev     The pointer of SCSI_BUS_DEVICE\r
 \r
-  EFI_SUCCESS       - Successfully to discover the device and attach ScsiIoProtocol to it.\r
-  EFI_OUT_OF_RESOURCES - Fail to discover the device.\r
+  @retval EFI_SUCCESS           Successfully to discover the device and attach\r
+                                ScsiIoProtocol to it.\r
+  @retval EFI_OUT_OF_RESOURCES  Fail to discover the device.\r
 \r
---*/\r
-;\r
-\r
-BOOLEAN\r
-DiscoverScsiDevice (\r
-  SCSI_IO_DEV   *ScsiIoDevice\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiScanCreateDevice (\r
+  IN     EFI_DRIVER_BINDING_PROTOCOL   *This,\r
+  IN     EFI_HANDLE                    Controller,\r
+  IN     SCSI_TARGET_ID                *TargetId,\r
+  IN     UINT64                        Lun,\r
+  IN OUT SCSI_BUS_DEVICE               *ScsiBusDev\r
+  );\r
 \r
+/**\r
   Discovery SCSI Device\r
 \r
-Arguments:\r
+  @param  ScsiIoDevice    The pointer of SCSI_IO_DEV\r
 \r
-  ScsiIoDevice    - The pointer of SCSI_IO_DEV\r
+  @retval  TRUE   Find SCSI Device and verify it.\r
+  @retval  FALSE  Unable to find SCSI Device.\r
 \r
-Returns:\r
-\r
-  TRUE            - Find SCSI Device and verify it.\r
-  FALSE           - Unable to find SCSI Device.  \r
+**/\r
+BOOLEAN\r
+DiscoverScsiDevice (\r
+  IN  OUT  SCSI_IO_DEV   *ScsiIoDevice\r
+  );\r
 \r
---*/\r
-;\r
 #endif\r
index 12b9b0124487cdc38bc37402fe0ac8554401647f..e0b015535322efd7e6c9f7c3e2c7ad4caab4f0c7 100644 (file)
@@ -32,7 +32,8 @@
 #  VALID_ARCHITECTURES              =  IA32 X64 IPF EBC\r
 #\r
 #  DRIVER_BINDING                =  gSCSIBusDriverBinding                        \r
-#  COMPONENT_NAME                =  gScsiBusComponentName                        \r
+#  COMPONENT_NAME                =  gScsiBusComponentName\r
+#  COMPONENT_NAME2               =  gScsiBusComponentName2\r
 #\r
 \r
 [Sources.common]\r
@@ -62,4 +63,4 @@
   gEfiScsiIoProtocolGuid                        # PROTOCOL BY_START\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL TO_START\r
   gEfiScsiPassThruProtocolGuid                  # PROTOCOL TO_START\r
-  gEfiExtScsiPassThruProtocolGuid\r
+  gEfiExtScsiPassThruProtocolGuid               # PROTOCOL TO_START\r
index eb9c1d487b4f04781d5134ca46d5cf5977aa26d8..3ca2cbb76411c530fd48874fe172dc4cd6a05ee7 100644 (file)
@@ -13,21 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 \r
-#include <Uefi.h>\r
-\r
-\r
-#include <Protocol/ScsiIo.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/BlockIo.h>\r
-#include <Protocol/DriverBinding.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/ScsiLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-\r
 #include "ScsiDisk.h"\r
 \r
 //\r
@@ -64,10 +49,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[
   by This does not support the language specified by Language,\r
   then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language. This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -76,7 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[
                                 to the driver writer. Language is specified\r
                                 in RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 driver specified by This in the language\r
                                 specified by Language.\r
@@ -123,15 +108,15 @@ ScsiDiskComponentNameGetDriverName (
   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
   support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
                                 specified by This is managing.  This handle\r
                                 specifies the controller whose name is to be\r
                                 returned.\r
 \r
-  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
                                 the name of.  This is an optional parameter that\r
                                 may be NULL.  It will be NULL for device\r
                                 drivers.  It will also be NULL for a bus drivers\r
@@ -140,7 +125,7 @@ ScsiDiskComponentNameGetDriverName (
                                 driver that wishes to retrieve the name of a\r
                                 child controller.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language.  This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -149,7 +134,7 @@ ScsiDiskComponentNameGetDriverName (
                                 to the driver writer. Language is specified in\r
                                 RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 controller specified by ControllerHandle and\r
                                 ChildHandle in the language specified by\r
index 07e2f870c0e435620e8d4592230be5882537adba..9451932cfca031f60d956fcbc64c23ffe032c49d 100644 (file)
@@ -12,24 +12,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include <Uefi.h>\r
-\r
-\r
-#include <Protocol/ScsiIo.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/BlockIo.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Protocol/ScsiPassThruExt.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/ScsiLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
 \r
 #include "ScsiDisk.h"\r
 \r
+\r
 EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = {\r
   ScsiDiskDriverBindingSupported,\r
   ScsiDiskDriverBindingStart,\r
@@ -40,10 +26,12 @@ EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = {
 };\r
 \r
 /**\r
-  The user Entry Point for module ScsiDisk. The user code starts with this function.\r
+  The user Entry Point for module ScsiDisk.\r
+\r
+  The user code starts with this function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
-  @param[in] SystemTable    A pointer to the EFI System Table.\r
+  @param  ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param  SystemTable    A pointer to the EFI System Table.\r
   \r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
@@ -75,33 +63,32 @@ InitializeScsiDisk(
   return Status;\r
 }\r
 \r
+/**\r
+  Test to see if this driver supports ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions.\r
+  If any other agent wishes to call Supported() it must also follow these\r
+  calling restrictions.\r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+  @retval other               This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingSupported (\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath   OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
-  that has ScsiIoProtocol installed will be supported.\r
-\r
-Arguments:\r
-\r
-  This                - Protocol instance pointer.\r
-  Controller          - Handle of device to test\r
-  RemainingDevicePath - Not used\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS         - This driver supports this device.\r
-  EFI_UNSUPPORTED     - This driver does not support this device.\r
-  \r
-  \r
---*/\r
 {\r
   EFI_STATUS            Status;\r
   EFI_SCSI_IO_PROTOCOL  *ScsiIo;\r
@@ -137,32 +124,33 @@ Returns:
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions. If\r
+  any other agent wishes to call Start() it must also follow these calling\r
+  restrictions.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingStart (\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath   OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Start SCSI Disk Driver, and attach BlockIoProtocol to it.\r
-  \r
-Arguments:\r
-\r
-  This                - Protocol instance pointer.\r
-  Controller          - Handle of device to test\r
-  RemainingDevicePath - Not used\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS         - This driver supports this device.\r
-  EFI_UNSUPPORTED     - This driver does not support this device.\r
-  \r
-  \r
---*/\r
 {\r
   EFI_STATUS            Status;\r
   EFI_SCSI_IO_PROTOCOL  *ScsiIo;\r
@@ -309,35 +297,34 @@ Returns:
 \r
 }\r
 \r
+\r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service DisconnectController().\r
+  In order to make drivers as small as possible, there are a few calling\r
+  restrictions for this service. DisconnectController() must follow these\r
+  calling restrictions. If any other agent wishes to call Stop() it must\r
+  also follow these calling restrictions.\r
+  \r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingStop (\r
   IN  EFI_DRIVER_BINDING_PROTOCOL     *This,\r
   IN  EFI_HANDLE                      Controller,\r
   IN  UINTN                           NumberOfChildren,\r
-  IN  EFI_HANDLE                      *ChildHandleBuffer\r
+  IN  EFI_HANDLE                      *ChildHandleBuffer   OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-    Stop this driver on ControllerHandle. Support stoping any child handles\r
-    created by this driver.\r
-\r
-Arguments:\r
-\r
-    This              - Protocol instance pointer.\r
-    Controller        - Handle of device to stop driver on\r
-    NumberOfChildren  - Number of Children in the ChildHandleBuffer\r
-    ChildHandleBuffer - List of handles for the children we need to stop.\r
-\r
-Returns:\r
-\r
-    EFI_SUCCESS\r
-    EFI_DEVICE_ERROR\r
-    others\r
-  \r
---*/\r
 {\r
   EFI_BLOCK_IO_PROTOCOL *BlkIo;\r
   SCSI_DISK_DEV         *ScsiDiskDevice;\r
@@ -379,29 +366,25 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Reset SCSI Disk.\r
+\r
 \r
+  @param  This                 The pointer of EFI_BLOCK_IO_PROTOCOL\r
+  @param  ExtendedVerification The flag about if extend verificate\r
+\r
+  @retval EFI_SUCCESS          The device was reset.\r
+  @retval EFI_DEVICE_ERROR     The device is not functioning properly and could\r
+                               not be reset.\r
+  @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReset (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
   IN  BOOLEAN                 ExtendedVerification\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Reset SCSI Disk  \r
-\r
-Arguments:\r
-\r
-  This                  - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-  ExtendedVerification  - The flag about if extend verificate\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-\r
---*/\r
 {\r
   EFI_TPL       OldTpl;\r
   SCSI_DISK_DEV *ScsiDiskDevice;\r
@@ -424,39 +407,32 @@ Done:
   return Status;\r
 }\r
 \r
+/**\r
+  The function is to Read Block from SCSI Disk.\r
+\r
+  @param  This       The pointer of EFI_BLOCK_IO_PROTOCOL.\r
+  @param  MediaId    The Id of Media detected\r
+  @param  Lba        The logic block address\r
+  @param  BufferSize The size of Buffer\r
+  @param  Buffer     The buffer to fill the read out data\r
+\r
+  @retval EFI_SUCCESS           Successfully to read out block.\r
+  @retval EFI_DEVICE_ERROR      Fail to detect media.\r
+  @retval EFI_NO_MEDIA          Media is not present.\r
+  @retval EFI_MEDIA_CHANGED     Media has changed.\r
+  @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
+  @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReadBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
   IN  UINT32                  MediaId,\r
-  IN  EFI_LBA                 LBA,\r
+  IN  EFI_LBA                 Lba,\r
   IN  UINTN                   BufferSize,\r
   OUT VOID                    *Buffer\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The function is to Read Block from SCSI Disk\r
-\r
-Arguments:\r
-\r
-  This        - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-  MediaId     - The Id of Media detected\r
-  LBA         - The logic block address\r
-  BufferSize  - The size of Buffer\r
-  Buffer      - The buffer to fill the read out data\r
-\r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER - Invalid parameter passed in.\r
-  EFI_SUCCESS           - Successfully to read out block.\r
-  EFI_DEVICE_ERROR      - Fail to detect media.\r
-  EFI_NO_MEDIA          - Media is not present.\r
-  EFI_MEDIA_CHANGED     - Media has changed.\r
-  EFI_BAD_BUFFER_SIZE   - The buffer size is not multiple of BlockSize.\r
-\r
---*/\r
 {\r
   SCSI_DISK_DEV       *ScsiDiskDevice;\r
   EFI_BLOCK_IO_MEDIA  *Media;\r
@@ -467,7 +443,7 @@ Returns:
   EFI_TPL             OldTpl;\r
 \r
   MediaChange = FALSE;\r
-  if (!Buffer) {\r
+  if (Buffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -479,7 +455,7 @@ Returns:
 \r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);\r
 \r
-  if (!IsDeviceFixed (ScsiDiskDevice)) {\r
+  if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
     Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange);\r
     if (EFI_ERROR (Status)) {\r
@@ -519,12 +495,12 @@ Returns:
     goto Done;\r
   }\r
 \r
-  if (LBA > Media->LastBlock) {\r
+  if (Lba > Media->LastBlock) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Done;\r
   }\r
 \r
-  if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {\r
+  if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Done;\r
   }\r
@@ -538,46 +514,40 @@ Returns:
   // If all the parameters are valid, then perform read sectors command\r
   // to transfer data from device to host.\r
   //\r
-  Status = ScsiDiskReadSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks);\r
+  Status = ScsiDiskReadSectors (ScsiDiskDevice, Buffer, Lba, NumberOfBlocks);\r
 \r
 Done:\r
   gBS->RestoreTPL (OldTpl);\r
   return Status;\r
 }\r
 \r
+/**\r
+  The function is to Write Block to SCSI Disk.\r
+\r
+  @param  This       The pointer of EFI_BLOCK_IO_PROTOCOL\r
+  @param  MediaId    The Id of Media detected\r
+  @param  Lba        The logic block address\r
+  @param  BufferSize The size of Buffer\r
+  @param  Buffer     The buffer to fill the read out data\r
+\r
+  @retval EFI_SUCCESS           Successfully to read out block.\r
+  @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
+  @retval EFI_DEVICE_ERROR      Fail to detect media.\r
+  @retval EFI_NO_MEDIA          Media is not present.\r
+  @retval EFI_MEDIA_CHNAGED     Media has changed.\r
+  @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
+  @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskWriteBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
   IN  UINT32                  MediaId,\r
-  IN  EFI_LBA                 LBA,\r
+  IN  EFI_LBA                 Lba,\r
   IN  UINTN                   BufferSize,\r
   IN  VOID                    *Buffer\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The function is to Write Block to SCSI Disk\r
-\r
-Arguments:\r
-\r
-  This        - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-  MediaId     - The Id of Media detected\r
-  LBA         - The logic block address\r
-  BufferSize  - The size of Buffer\r
-  Buffer      - The buffer to fill the read out data\r
-\r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER - Invalid parameter passed in.\r
-  EFI_SUCCESS           - Successfully to read out block.\r
-  EFI_DEVICE_ERROR      - Fail to detect media.\r
-  EFI_NO_MEDIA          - Media is not present.\r
-  EFI_MEDIA_CHANGED     - Media has changed.\r
-  EFI_BAD_BUFFER_SIZE   - The buffer size is not multiple of BlockSize.\r
-\r
---*/\r
 {\r
   SCSI_DISK_DEV       *ScsiDiskDevice;\r
   EFI_BLOCK_IO_MEDIA  *Media;\r
@@ -588,7 +558,7 @@ Returns:
   EFI_TPL             OldTpl;\r
 \r
   MediaChange = FALSE;\r
-  if (!Buffer) {\r
+  if (Buffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -600,7 +570,7 @@ Returns:
 \r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);\r
 \r
-  if (!IsDeviceFixed (ScsiDiskDevice)) {\r
+  if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
     Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange);\r
     if (EFI_ERROR (Status)) {\r
@@ -640,12 +610,12 @@ Returns:
     goto Done;\r
   }\r
 \r
-  if (LBA > Media->LastBlock) {\r
+  if (Lba > Media->LastBlock) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Done;\r
   }\r
 \r
-  if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {\r
+  if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Done;\r
   }\r
@@ -658,33 +628,28 @@ Returns:
   // if all the parameters are valid, then perform read sectors command\r
   // to transfer data from device to host.\r
   //\r
-  Status = ScsiDiskWriteSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks);\r
+  Status = ScsiDiskWriteSectors (ScsiDiskDevice, Buffer, Lba, NumberOfBlocks);\r
 \r
 Done:\r
   gBS->RestoreTPL (OldTpl);\r
   return Status;\r
 }\r
 \r
+/**\r
+  Flush Block to Disk.\r
+\r
+  EFI_SUCCESS is returned directly.\r
+\r
+  @param  This              The pointer of EFI_BLOCK_IO_PROTOCOL\r
+\r
+  @retval EFI_SUCCESS       All outstanding data was written to the device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskFlushBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Flush Block to Disk\r
-\r
-Arguments:\r
-\r
-  This  - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS \r
-\r
---*/\r
 {\r
   //\r
   // return directly\r
@@ -692,30 +657,24 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskDetectMedia (\r
-  SCSI_DISK_DEV   *ScsiDiskDevice,\r
-  BOOLEAN         MustReadCapacity,\r
-  BOOLEAN         *MediaChange\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Dectect Device and read out capacity ,if error occurs, parse the sense key.\r
 \r
-Arguments:\r
-\r
-  ScsiDiskDevice     - The pointer of SCSI_DISK_DEV\r
-  MustReadCapacity   - The flag about reading device capacity\r
-  MediaChange        - The pointer of flag indicates if media has changed \r
-\r
-Returns:\r
+  @param  ScsiDiskDevice    The pointer of SCSI_DISK_DEV\r
+  @param  MustReadCapacity  The flag about reading device capacity\r
+  @param  MediaChange       The pointer of flag indicates if media has changed \r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to detect media\r
+  @retval EFI_DEVICE_ERROR  Indicates that error occurs\r
+  @retval EFI_SUCCESS       Successfully to detect media\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskDetectMedia (\r
+  IN   SCSI_DISK_DEV   *ScsiDiskDevice,\r
+  IN   BOOLEAN         MustReadCapacity,\r
+  OUT  BOOLEAN         *MediaChange\r
+  )\r
 {\r
   EFI_STATUS          Status;\r
   EFI_STATUS          ReadCapacityStatus;\r
@@ -885,28 +844,22 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskInquiryDevice (\r
-  SCSI_DISK_DEV   *ScsiDiskDevice,\r
-  BOOLEAN         *NeedRetry\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
-  Send out Inquiry command to Device\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  NeedRetry       - Indicates if needs try again when error happens\r
+/**\r
+  Send out Inquiry command to Device.\r
 \r
-Returns:\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry       Indicates if needs try again when error happens\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to detect media\r
+  @retval  EFI_DEVICE_ERROR  Indicates that error occurs\r
+  @retval  EFI_SUCCESS       Successfully to detect media\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskInquiryDevice (\r
+  IN OUT  SCSI_DISK_DEV   *ScsiDiskDevice,\r
+     OUT  BOOLEAN         *NeedRetry\r
+  )\r
 {\r
   UINT32              InquiryDataLength;\r
   UINT8               SenseDataLength;\r
@@ -1010,34 +963,29 @@ Returns:
   return EFI_DEVICE_ERROR;\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskTestUnitReady (\r
-  SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  BOOLEAN               *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
-  UINTN                 *NumberOfSenseKeys\r
-  )\r
- /*++\r
-\r
-Routine Description:\r
+/**\r
+  To test deivice.\r
 \r
   When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r
   When Test Unit Ready command encounters any error caused by host adapter or\r
   target, return error without retrieving Sense Keys.\r
-  \r
-Arguments:\r
 \r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  NeedRetry       - The pointer of flag indicates try again\r
-  SenseDataArray  - The pointer of an array of sense data\r
-  NumberOfSenseKeys - The pointer of the number of sense data array\r
-  \r
-Returns:\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry          The pointer of flag indicates try again\r
+  @param  SenseDataArray     The pointer of an array of sense data\r
+  @param  NumberOfSenseKeys  The pointer of the number of sense data array\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to test unit\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to test unit\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskTestUnitReady (\r
+  IN  SCSI_DISK_DEV         *ScsiDiskDevice,\r
+  OUT BOOLEAN               *NeedRetry,\r
+  OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
+  OUT UINTN                 *NumberOfSenseKeys\r
+  )\r
 {\r
   EFI_STATUS  Status;\r
   UINT8       SenseDataLength;\r
@@ -1128,32 +1076,25 @@ Returns:
   return EFI_DEVICE_ERROR;\r
 }\r
 \r
-EFI_STATUS\r
-DetectMediaParsingSenseKeys (\r
-  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-  EFI_SCSI_SENSE_DATA     *SenseData,\r
-  UINTN                   NumberOfSenseKeys,\r
-  UINTN                   *Action\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Parsing Sense Keys which got from request sense command.\r
-  \r
-Arguments:\r
 \r
-  ScsiDiskDevice    - The pointer of SCSI_DISK_DEV\r
-  SenseData         - The pointer of EFI_SCSI_SENSE_DATA\r
-  NumberOfSenseKeys - The number of sense key  \r
-  Action            - The pointer of action which indicates what is need to do next\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  SenseData          The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  NumberOfSenseKeys  The number of sense key  \r
+  @param  Action             The pointer of action which indicates what is need to do next\r
 \r
-Returns:\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to complete the parsing\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to complete the parsing\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+DetectMediaParsingSenseKeys (\r
+  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
+  IN   EFI_SCSI_SENSE_DATA     *SenseData,\r
+  IN   UINTN                   NumberOfSenseKeys,\r
+  OUT  UINTN                   *Action\r
+  )\r
 {\r
   BOOLEAN RetryLater;\r
 \r
@@ -1209,32 +1150,26 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskReadCapacity (\r
-  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-  BOOLEAN                 *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
-  UINTN                   *NumberOfSenseKeys\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Send read capacity command to device and get the device parameter\r
-\r
-Arguments:\r
 \r
-  ScsiDiskDevice     -  The pointer of SCSI_DISK_DEV\r
-  NeedRetry          -  The pointer of flag indicates if need a retry\r
-  SenseDataArray     -  The pointer of an array of sense data\r
-  NumberOfSenseKeys  -  The number of sense key\r
+/**\r
+  Send read capacity command to device and get the device parameter.\r
 \r
-Returns:\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry          The pointer of flag indicates if need a retry\r
+  @param  SenseDataArray     The pointer of an array of sense data\r
+  @param  NumberOfSenseKeys  The number of sense key\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to read capacity\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to read capacity\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskReadCapacity (\r
+  IN  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
+      OUT  BOOLEAN                 *NeedRetry,\r
+      OUT  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
+      OUT  UINTN                   *NumberOfSenseKeys\r
+  )\r
 {\r
   EFI_SCSI_DISK_CAPACITY_DATA CapacityData;\r
   UINT32                      DataLength;\r
@@ -1346,28 +1281,21 @@ Returns:
   return EFI_DEVICE_ERROR;\r
 }\r
 \r
-EFI_STATUS\r
-CheckHostAdapterStatus (\r
-  UINT8   HostAdapterStatus\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check the HostAdapter status\r
-  \r
-Arguments:\r
-\r
-  HostAdapterStatus - Host Adapter status\r
+/**\r
+  Check the HostAdapter status and re-interpret it in EFI_STATUS.\r
 \r
-Returns:\r
+  @param  HostAdapterStatus  Host Adapter status\r
 \r
-  EFI_SUCCESS       \r
-  EFI_TIMEOUT       \r
-  EFI_NOT_READY     \r
-  EFI_DEVICE_ERROR  \r
+  @retval  EFI_SUCCESS       Host adapter is OK.\r
+  @retval  EFI_TIMEOUT       Timeout.\r
+  @retval  EFI_NOT_READY     Adapter NOT ready.\r
+  @retval  EFI_DEVICE_ERROR  Adapter device error.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+CheckHostAdapterStatus (\r
+  IN UINT8   HostAdapterStatus\r
+  )\r
 {\r
   switch (HostAdapterStatus) {\r
   case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK:\r
@@ -1394,27 +1322,21 @@ Returns:
   }\r
 }\r
 \r
-EFI_STATUS\r
-CheckTargetStatus (\r
-  UINT8   TargetStatus\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check the target status\r
-  \r
-Arguments:\r
 \r
-  TargetStatus  - Target status\r
+/**\r
+  Check the target status and re-interpret it in EFI_STATUS.\r
 \r
-Returns:\r
+  @param  TargetStatus  Target status\r
 \r
-  EFI_NOT_READY  \r
-  EFI_DEVICE_ERROR \r
-  EFI_SUCCESS\r
+  @retval EFI_NOT_READY       Device is NOT ready.\r
+  @retval EFI_DEVICE_ERROR \r
+  @retval EFI_SUCCESS\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+CheckTargetStatus (\r
+  IN  UINT8   TargetStatus\r
+  )\r
 {\r
   switch (TargetStatus) {\r
   case EFI_EXT_SCSI_STATUS_TARGET_GOOD:\r
@@ -1437,39 +1359,32 @@ Returns:
   }\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskRequestSenseKeys (\r
-  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-  BOOLEAN                 *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
-  UINTN                   *NumberOfSenseKeys,\r
-  BOOLEAN                 AskResetIfError\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Retrieve all sense keys from the device.\r
-  When encountering error during the process,\r
-  if retrieve sense keys before error encounterred,\r
-  return the sense keys with return status set to EFI_SUCCESS,\r
-  and NeedRetry set to FALSE; otherwize, return the proper return\r
-  status.\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice     -  The pointer of SCSI_DISK_DEV\r
-  NeedRetry          -  The pointer of flag indicates if need a retry\r
-  SenseDataArray     -  The pointer of an array of sense data\r
-  NumberOfSenseKeys  -  The number of sense key\r
-  AskResetIfError    -  The flag indicates if need reset when error occurs\r
-  \r
-Returns:\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to request sense key\r
+  When encountering error during the process, if retrieve sense keys before\r
+  error encounterred, it returns the sense keys with return status set to EFI_SUCCESS,\r
+  and NeedRetry set to FALSE; otherwize, return the proper return status.\r
+\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry          The pointer of flag indicates if need a retry\r
+  @param  SenseDataArray     The pointer of an array of sense data\r
+  @param  NumberOfSenseKeys  The number of sense key\r
+  @param  AskResetIfError    The flag indicates if need reset when error occurs\r
+\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to request sense key\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskRequestSenseKeys (\r
+  IN  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
+      OUT  BOOLEAN                 *NeedRetry,\r
+      OUT  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
+      OUT  UINTN                   *NumberOfSenseKeys,\r
+  IN       BOOLEAN                 AskResetIfError\r
+  )\r
 {\r
   EFI_SCSI_SENSE_DATA *PtrSenseData;\r
   UINT8               SenseDataLength;\r
@@ -1543,27 +1458,19 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-VOID\r
-GetMediaInfo (\r
-  SCSI_DISK_DEV                 *ScsiDiskDevice,\r
-  EFI_SCSI_DISK_CAPACITY_DATA   *Capacity\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Get information from media read capacity command\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  Capacity        - The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r
 \r
-Returns:\r
+/**\r
+  Get information from media read capacity command.\r
 \r
-  NONE\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
+  @param  Capacity        The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r
 \r
---*/\r
+**/\r
+VOID\r
+GetMediaInfo (\r
+  IN  OUT  SCSI_DISK_DEV                 *ScsiDiskDevice,\r
+  IN       EFI_SCSI_DISK_CAPACITY_DATA   *Capacity\r
+  )\r
 {\r
   ScsiDiskDevice->BlkIo.Media->LastBlock =  (Capacity->LastLba3 << 24) |\r
                                             (Capacity->LastLba2 << 16) |\r
@@ -1584,57 +1491,40 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+  Parse Inquiry data.\r
+\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
+\r
+**/\r
 VOID\r
 ParseInquiryData (\r
-  SCSI_DISK_DEV   *ScsiDiskDevice\r
+  IN OUT SCSI_DISK_DEV   *ScsiDiskDevice\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Parse Inquiry data\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-\r
-Returns:\r
-\r
-  NONE\r
-\r
---*/\r
 {\r
   ScsiDiskDevice->FixedDevice               = (BOOLEAN) (ScsiDiskDevice->InquiryData.RMB ? 0 : 1);\r
   ScsiDiskDevice->BlkIoMedia.RemovableMedia = (BOOLEAN) (!ScsiDiskDevice->FixedDevice);\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-ScsiDiskReadSectors (\r
-  SCSI_DISK_DEV     *ScsiDiskDevice,\r
-  VOID              *Buffer,\r
-  EFI_LBA           Lba,\r
-  UINTN             NumberOfBlocks\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Read sector from SCSI Disk\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The poiniter of SCSI_DISK_DEV\r
-  Buffer          - The buffer to fill in the read out data\r
-  Lba             - Logic block address\r
-  NumberOfBlocks  - The number of blocks to read\r
+/**\r
+  Read sector from SCSI Disk.\r
 \r
-Returns:\r
+  @param  ScsiDiskDevice  The poiniter of SCSI_DISK_DEV\r
+  @param  Buffer          The buffer to fill in the read out data\r
+  @param  Lba             Logic block address\r
+  @param  NumberOfBlocks  The number of blocks to read\r
 \r
-  EFI_DEVICE_ERROR\r
-  EFI_SUCCESS\r
+  @retval EFI_DEVICE_ERROR  Indicates a device error.\r
+  @retval EFI_SUCCESS       Operation is successful.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskReadSectors (\r
+  IN   SCSI_DISK_DEV     *ScsiDiskDevice,\r
+  OUT  VOID              *Buffer,\r
+  IN   EFI_LBA           Lba,\r
+  IN   UINTN             NumberOfBlocks\r
+  )\r
 {\r
   UINTN               BlocksRemaining;\r
   UINT32              Lba32;\r
@@ -1720,32 +1610,25 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskWriteSectors (\r
-  SCSI_DISK_DEV     *ScsiDiskDevice,\r
-  VOID              *Buffer,\r
-  EFI_LBA           Lba,\r
-  UINTN             NumberOfBlocks\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Write SCSI Disk sectors\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  Buffer          - The data buffer to write sector\r
-  Lba             - Logic block address\r
-  NumberOfBlocks  - The number of blocks to write\r
+/**\r
+  Write sector to SCSI Disk.\r
 \r
-Returns:\r
+  @param  ScsiDiskDevice  The poiniter of SCSI_DISK_DEV\r
+  @param  Buffer          The buffer of data to be written into SCSI Disk\r
+  @param  Lba             Logic block address\r
+  @param  NumberOfBlocks  The number of blocks to read\r
 \r
-  EFI_DEVICE_ERROR \r
-  EFI_SUCCESS\r
+  @retval EFI_DEVICE_ERROR  Indicates a device error.\r
+  @retval EFI_SUCCESS       Operation is successful.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskWriteSectors (\r
+  IN  SCSI_DISK_DEV     *ScsiDiskDevice,\r
+  IN  VOID              *Buffer,\r
+  IN  EFI_LBA           Lba,\r
+  IN  UINTN             NumberOfBlocks\r
+  )\r
 {\r
   UINTN               BlocksRemaining;\r
   UINT32              Lba32;\r
@@ -1827,41 +1710,34 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Sumbmit Read command.\r
+\r
+  @param  ScsiDiskDevice     The pointer of ScsiDiskDevice\r
+  @param  NeedRetry          The pointer of flag indicates if needs retry if error happens\r
+  @param  SenseDataArray     NOT used yet in this function\r
+  @param  NumberOfSenseKeys  The number of sense key\r
+  @param  Timeout            The time to complete the command\r
+  @param  DataBuffer         The buffer to fill with the read out data\r
+  @param  DataLength         The length of buffer\r
+  @param  StartLba           The start logic block address\r
+  @param  SectorSize         The size of sector\r
+\r
+  @return  EFI_STATUS is returned by calling ScsiRead10Command().\r
+**/\r
 EFI_STATUS\r
 ScsiDiskRead10 (\r
-  SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  BOOLEAN               *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
-  UINTN                 *NumberOfSenseKeys,\r
-  UINT64                Timeout,\r
-  UINT8                 *DataBuffer,\r
-  UINT32                *DataLength,\r
-  UINT32                StartLba,\r
-  UINT32                SectorSize\r
+  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
+     OUT BOOLEAN               *NeedRetry,\r
+     OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,   OPTIONAL\r
+     OUT UINTN                 *NumberOfSenseKeys,\r
+  IN     UINT64                Timeout,\r
+     OUT UINT8                 *DataBuffer,\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Sumbmit Read command \r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice    - The pointer of ScsiDiskDevice\r
-  NeedRetry         - The pointer of flag indicates if needs retry if error happens\r
-  SenseDataArray    - The pointer of an array of sense data\r
-  NumberOfSenseKeys - The number of sense key\r
-  Timeout           - The time to complete the command\r
-  DataBuffer        - The buffer to fill with the read out data\r
-  DataLength        - The length of buffer\r
-  StartLba          - The start logic block address\r
-  SectorSize        - The size of sector\r
-\r
-Returns:\r
-\r
-  EFI_STATUS\r
-  \r
---*/\r
 {\r
   UINT8       SenseDataLength;\r
   EFI_STATUS  Status;\r
@@ -1886,41 +1762,35 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-ScsiDiskWrite10 (\r
-  SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  BOOLEAN               *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
-  UINTN                 *NumberOfSenseKeys,\r
-  UINT64                Timeout,\r
-  UINT8                 *DataBuffer,\r
-  UINT32                *DataLength,\r
-  UINT32                StartLba,\r
-  UINT32                SectorSize\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
-  Submit Write Command\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice    - The pointer of ScsiDiskDevice\r
-  NeedRetry         - The pointer of flag indicates if needs retry if error happens\r
-  SenseDataArray    - The pointer of an array of sense data\r
-  NumberOfSenseKeys - The number of sense key\r
-  Timeout           - The time to complete the command\r
-  DataBuffer        - The buffer to fill with the read out data\r
-  DataLength        - The length of buffer\r
-  StartLba          - The start logic block address\r
-  SectorSize        - The size of sector\r
+/**\r
+  Submit Write Command.\r
 \r
-Returns:\r
+  @param  ScsiDiskDevice     The pointer of ScsiDiskDevice\r
+  @param  NeedRetry          The pointer of flag indicates if needs retry if error happens\r
+  @param  SenseDataArray     NOT used yet in this function\r
+  @param  NumberOfSenseKeys  The number of sense key\r
+  @param  Timeout            The time to complete the command\r
+  @param  DataBuffer         The buffer to fill with the read out data\r
+  @param  DataLength         The length of buffer\r
+  @param  StartLba           The start logic block address\r
+  @param  SectorSize         The size of sector\r
 \r
-  EFI_STATUS\r
+  @return  EFI_STATUS is returned by calling ScsiWrite10Command().\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ScsiDiskWrite10 (\r
+  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
+     OUT BOOLEAN               *NeedRetry,\r
+     OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,   OPTIONAL\r
+     OUT UINTN                 *NumberOfSenseKeys,\r
+  IN     UINT64                Timeout,\r
+  IN     UINT8                 *DataBuffer,\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
+  )\r
 {\r
   EFI_STATUS  Status;\r
   UINT8       SenseDataLength;\r
@@ -1945,27 +1815,21 @@ Returns:
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Check sense key to find if media presents.\r
+\r
+  @param  SenseData   The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts The number of sense key\r
+\r
+  @retval TRUE    NOT any media\r
+  @retval FALSE   Media presents\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsNoMedia (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if media presents\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -1989,27 +1853,22 @@ Returns:
   return IsNoMedia;\r
 }\r
 \r
+\r
+/**\r
+  Parse sense key.\r
+\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
+\r
+  @retval TRUE   Error\r
+  @retval FALSE  NOT error\r
+\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsMediaError (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Parse sense key\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -2079,27 +1938,22 @@ Returns:
   return IsError;\r
 }\r
 \r
+\r
+/**\r
+  Check sense key to find if hardware error happens.\r
+\r
+  @param  SenseData     The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts   The number of sense key\r
+\r
+  @retval TRUE  Hardware error exits.\r
+  @retval FALSE NO error.\r
+\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsHardwareError (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if hardware error happens\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -2123,27 +1977,21 @@ Returns:
   return IsError;\r
 }\r
 \r
+\r
+/**\r
+  Check sense key to find if media has changed.\r
+\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
+\r
+  @retval TRUE   Media is changed.\r
+  @retval FALSE  Medit is NOT changed.\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsMediaChange (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Check sense key to find if media has changed\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -2168,27 +2016,21 @@ Returns:
   return IsMediaChanged;\r
 }\r
 \r
+/**\r
+  Check sense key to find if reset happens.\r
+\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
+\r
+  @retval TRUE  It is reset before.\r
+  @retval FALSE It is NOT reset before.\r
+\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsResetBefore (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if reset happens\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -2214,29 +2056,23 @@ Returns:
   return IsResetBefore;\r
 }\r
 \r
+/**\r
+  Check sense key to find if the drive is ready.\r
+\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
+  @param  RetryLater   The flag means if need a retry \r
+\r
+  @retval TRUE  Drive is ready.\r
+  @retval FALSE Drive is NOT ready.\r
+\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsDriveReady (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts,\r
   OUT BOOLEAN               *RetryLater\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if the drive is ready\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-  RetryLater  - The flag means if need a retry \r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -2291,27 +2127,21 @@ Returns:
   return IsReady;\r
 }\r
 \r
+/**\r
+  Check sense key to find if it has sense key.\r
+\r
+  @param  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts - The number of sense key\r
+\r
+  @retval TRUE  It has sense key.\r
+  @retval FALSE It has NOT any sense key.\r
+\r
+**/\r
 BOOLEAN\r
 ScsiDiskHaveSenseKey (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if it has sense key\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
-\r
-  BOOLEAN\r
-\r
---*/\r
 {\r
   EFI_SCSI_SENSE_DATA *SensePtr;\r
   UINTN               Index;\r
@@ -2341,25 +2171,16 @@ Returns:
   return HaveSenseKey;\r
 }\r
 \r
+/**\r
+  Release resource about disk device.\r
+\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
+\r
+**/\r
 VOID\r
 ReleaseScsiDiskDeviceResources (\r
   IN  SCSI_DISK_DEV   *ScsiDiskDevice\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Release resource about disk device\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-\r
-Returns:\r
-\r
-  NONE\r
-\r
---*/\r
 {\r
   if (ScsiDiskDevice == NULL) {\r
     return ;\r
index 64ee905e36900ae387567c4f2fadb225fa2235a1..273c0edc8b3edc94d6a64e5445c6ce605e9a6561 100644 (file)
@@ -12,13 +12,29 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#ifndef _SCSI_DISK_H\r
-#define _SCSI_DISK_H\r
+#ifndef _SCSI_DISK_H_\r
+#define _SCSI_DISK_H_\r
 \r
 \r
+#include <Uefi.h>\r
+\r
+\r
+#include <Protocol/ScsiIo.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/BlockIo.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/ScsiPassThruExt.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/ScsiLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
 #include <IndustryStandard/Scsi.h>\r
 \r
-#define IsDeviceFixed(a)        (a)->FixedDevice ? 1 : 0\r
+#define IS_DEVICE_FIXED(a)        (a)->FixedDevice ? 1 : 0\r
 \r
 #define SCSI_DISK_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'd', 'k')\r
 \r
@@ -57,29 +73,86 @@ extern EFI_COMPONENT_NAME2_PROTOCOL  gScsiDiskComponentName2;
 #define ACTION_READ_CAPACITY        0x01\r
 #define ACTION_RETRY_COMMAND_LATER  0x02\r
 \r
+/**\r
+  Test to see if this driver supports ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions.\r
+  If any other agent wishes to call Supported() it must also follow these\r
+  calling restrictions.\r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+  @retval other               This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingSupported (\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath   OPTIONAL\r
   );\r
 \r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service ConnectController(). In order\r
+  to make drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these calling restrictions. If\r
+  any other agent wishes to call Start() it must also follow these calling\r
+  restrictions.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingStart (\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath   OPTIONAL\r
   );\r
 \r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  This service is called by the EFI boot service DisconnectController().\r
+  In order to make drivers as small as possible, there are a few calling\r
+  restrictions for this service. DisconnectController() must follow these\r
+  calling restrictions. If any other agent wishes to call Stop() it must\r
+  also follow these calling restrictions.\r
+  \r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingStop (\r
   IN  EFI_DRIVER_BINDING_PROTOCOL     *This,\r
   IN  EFI_HANDLE                      Controller,\r
   IN  UINTN                           NumberOfChildren,\r
-  IN  EFI_HANDLE                      *ChildHandleBuffer\r
+  IN  EFI_HANDLE                      *ChildHandleBuffer   OPTIONAL\r
   );\r
 \r
 //\r
@@ -95,10 +168,10 @@ ScsiDiskDriverBindingStop (
   by This does not support the language specified by Language,\r
   then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language. This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -107,7 +180,7 @@ ScsiDiskDriverBindingStop (
                                 to the driver writer. Language is specified\r
                                 in RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 driver specified by This in the language\r
                                 specified by Language.\r
@@ -146,15 +219,15 @@ ScsiDiskComponentNameGetDriverName (
   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
   support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
                                 specified by This is managing.  This handle\r
                                 specifies the controller whose name is to be\r
                                 returned.\r
 \r
-  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
                                 the name of.  This is an optional parameter that\r
                                 may be NULL.  It will be NULL for device\r
                                 drivers.  It will also be NULL for a bus drivers\r
@@ -163,7 +236,7 @@ ScsiDiskComponentNameGetDriverName (
                                 driver that wishes to retrieve the name of a\r
                                 child controller.\r
 \r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language.  This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -172,7 +245,7 @@ ScsiDiskComponentNameGetDriverName (
                                 to the driver writer. Language is specified in\r
                                 RFC 3066 or ISO 639-2 language code format.\r
 \r
-  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 controller specified by ControllerHandle and\r
                                 ChildHandle in the language specified by\r
@@ -211,699 +284,500 @@ ScsiDiskComponentNameGetControllerName (
   OUT CHAR16                                          **ControllerName\r
   );\r
 \r
+/**\r
+  Reset SCSI Disk.\r
+\r
+\r
+  @param  This                 The pointer of EFI_BLOCK_IO_PROTOCOL\r
+  @param  ExtendedVerification The flag about if extend verificate\r
 \r
+  @retval EFI_SUCCESS          The device was reset.\r
+  @retval EFI_DEVICE_ERROR     The device is not functioning properly and could\r
+                               not be reset.\r
+  @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReset (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
   IN  BOOLEAN                 ExtendedVerification\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Reset SCSI Disk  \r
-\r
-Arguments:\r
+  );\r
 \r
-  This                  - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-  ExtendedVerification  - The flag about if extend verificate\r
 \r
-Returns:\r
+/**\r
+  The function is to Read Block from SCSI Disk.\r
 \r
-  EFI_STATUS\r
+  @param  This       The pointer of EFI_BLOCK_IO_PROTOCOL.\r
+  @param  MediaId    The Id of Media detected\r
+  @param  Lba        The logic block address\r
+  @param  BufferSize The size of Buffer\r
+  @param  Buffer     The buffer to fill the read out data\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS           Successfully to read out block.\r
+  @retval EFI_DEVICE_ERROR      Fail to detect media.\r
+  @retval EFI_NO_MEDIA          Media is not present.\r
+  @retval EFI_MEDIA_CHANGED     Media has changed.\r
+  @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
+  @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReadBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
   IN  UINT32                  MediaId,\r
-  IN  EFI_LBA                 LBA,\r
+  IN  EFI_LBA                 Lba,\r
   IN  UINTN                   BufferSize,\r
   OUT VOID                    *Buffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The function is to Read Block from SCSI Disk\r
-\r
-Arguments:\r
-\r
-  This        - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-  MediaId     - The Id of Media detected\r
-  LBA         - The logic block address\r
-  BufferSize  - The size of Buffer\r
-  Buffer      - The buffer to fill the read out data\r
-\r
-Returns:\r
+  );\r
 \r
-  EFI_INVALID_PARAMETER - Invalid parameter passed in.\r
-  EFI_SUCCESS           - Successfully to read out block.\r
-  EFI_DEVICE_ERROR      - Fail to detect media.\r
-  EFI_NO_MEDIA          - Media is not present.\r
-  EFI_MEDIA_CHANGED     - Media has changed.\r
-  EFI_BAD_BUFFER_SIZE   - The buffer size is not multiple of BlockSize.\r
 \r
---*/\r
-;\r
+/**\r
+  The function is to Write Block to SCSI Disk.\r
+\r
+  @param  This       The pointer of EFI_BLOCK_IO_PROTOCOL\r
+  @param  MediaId    The Id of Media detected\r
+  @param  Lba        The logic block address\r
+  @param  BufferSize The size of Buffer\r
+  @param  Buffer     The buffer to fill the read out data\r
+\r
+  @retval EFI_SUCCESS           Successfully to read out block.\r
+  @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
+  @retval EFI_DEVICE_ERROR      Fail to detect media.\r
+  @retval EFI_NO_MEDIA          Media is not present.\r
+  @retval EFI_MEDIA_CHNAGED     Media has changed.\r
+  @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
+  @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskWriteBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
   IN  UINT32                  MediaId,\r
-  IN  EFI_LBA                 LBA,\r
+  IN  EFI_LBA                 Lba,\r
   IN  UINTN                   BufferSize,\r
   IN  VOID                    *Buffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The function is to Write Block to SCSI Disk\r
+  );\r
 \r
-Arguments:\r
 \r
-  This        - The pointer of EFI_BLOCK_IO_PROTOCOL\r
-  MediaId     - The Id of Media detected\r
-  LBA         - The logic block address\r
-  BufferSize  - The size of Buffer\r
-  Buffer      - The buffer to fill the read out data\r
+/**\r
+  Flush Block to Disk.\r
 \r
-Returns:\r
+  EFI_SUCCESS is returned directly.\r
 \r
-  EFI_INVALID_PARAMETER - Invalid parameter passed in.\r
-  EFI_SUCCESS           - Successfully to read out block.\r
-  EFI_DEVICE_ERROR      - Fail to detect media.\r
-  EFI_NO_MEDIA          - Media is not present.\r
-  EFI_MEDIA_CHANGED     - Media has changed.\r
-  EFI_BAD_BUFFER_SIZE   - The buffer size is not multiple of BlockSize.\r
+  @param  This              The pointer of EFI_BLOCK_IO_PROTOCOL\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS       All outstanding data was written to the device\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskFlushBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL   *This\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Flush Block to Disk\r
-\r
-Arguments:\r
-\r
-  This  - The pointer of EFI_BLOCK_IO_PROTOCOL\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Dectect Device and read out capacity ,if error occurs, parse the sense key.\r
 \r
-  EFI_SUCCESS \r
+  @param  ScsiDiskDevice    The pointer of SCSI_DISK_DEV\r
+  @param  MustReadCapacity  The flag about reading device capacity\r
+  @param  MediaChange       The pointer of flag indicates if media has changed \r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR  Indicates that error occurs\r
+  @retval EFI_SUCCESS       Successfully to detect media\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskDetectMedia (\r
-  SCSI_DISK_DEV   *ScsiDiskDevice,\r
-  BOOLEAN         MustReadCap,\r
-  BOOLEAN         *MediaChange\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Dectect Device and read out capacity ,if error occurs, parse the sense key.\r
-\r
-Arguments:\r
+  IN   SCSI_DISK_DEV   *ScsiDiskDevice,\r
+  IN   BOOLEAN         MustReadCapacity,\r
+  OUT  BOOLEAN         *MediaChange\r
+  );\r
 \r
-  ScsiDiskDevice     - The pointer of SCSI_DISK_DEV\r
-  MustReadCapacity   - The flag about reading device capacity\r
-  MediaChange        - The pointer of flag indicates if media has changed \r
+/**\r
+  To test deivice.\r
 \r
-Returns:\r
+  When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r
+  When Test Unit Ready command encounters any error caused by host adapter or\r
+  target, return error without retrieving Sense Keys.\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to detect media\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry          The pointer of flag indicates try again\r
+  @param  SenseDataArray     The pointer of an array of sense data\r
+  @param  NumberOfSenseKeys  The pointer of the number of sense data array\r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to test unit\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskTestUnitReady (\r
-  SCSI_DISK_DEV       *ScsiDiskDevice,\r
-  BOOLEAN             *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA **SenseDataArray,\r
-  UINTN               *NumberOfSenseKeys\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  IN  SCSI_DISK_DEV         *ScsiDiskDevice,\r
+  OUT BOOLEAN               *NeedRetry,\r
+  OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
+  OUT UINTN                 *NumberOfSenseKeys\r
+  );\r
 \r
-  When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r
-  When Test Unit Ready command encounters any error caused by host adapter or\r
-  target, return error without retrieving Sense Keys.\r
-  \r
-Arguments:\r
 \r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  NeedRetry       - The pointer of flag indicates try again\r
-  SenseDataArray  - The pointer of an array of sense data\r
-  NumberOfSenseKeys - The pointer of the number of sense data array\r
-  \r
-Returns:\r
+/**\r
+  Parsing Sense Keys which got from request sense command.\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to test unit\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  SenseData          The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  NumberOfSenseKeys  The number of sense key  \r
+  @param  Action             The pointer of action which indicates what is need to do next\r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to complete the parsing\r
 \r
+**/\r
 EFI_STATUS\r
 DetectMediaParsingSenseKeys (\r
-  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-  EFI_SCSI_SENSE_DATA     *SenseData,\r
-  UINTN                   NumberOfSenseKeys,\r
-  UINTN                   *Action\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Parsing Sense Keys which got from request sense command.\r
-  \r
-Arguments:\r
+  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
+  IN   EFI_SCSI_SENSE_DATA     *SenseData,\r
+  IN   UINTN                   NumberOfSenseKeys,\r
+  OUT  UINTN                   *Action\r
+  );\r
 \r
-  ScsiDiskDevice    - The pointer of SCSI_DISK_DEV\r
-  SenseData         - The pointer of EFI_SCSI_SENSE_DATA\r
-  NumberOfSenseKeys - The number of sense key  \r
-  Action            - The pointer of action which indicates what is need to do next\r
 \r
-Returns:\r
+/**\r
+  Send read capacity command to device and get the device parameter.\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to complete the parsing\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry          The pointer of flag indicates if need a retry\r
+  @param  SenseDataArray     The pointer of an array of sense data\r
+  @param  NumberOfSenseKeys  The number of sense key\r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to read capacity\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskReadCapacity (\r
-  SCSI_DISK_DEV       *ScsiDiskDevice,\r
-  BOOLEAN             *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA **SenseDataArray,\r
-  UINTN               *NumberOfSenseKeys\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Send read capacity command to device and get the device parameter\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice     -  The pointer of SCSI_DISK_DEV\r
-  NeedRetry          -  The pointer of flag indicates if need a retry\r
-  SenseDataArray     -  The pointer of an array of sense data\r
-  NumberOfSenseKeys  -  The number of sense key\r
+  IN  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
+      OUT  BOOLEAN                 *NeedRetry,\r
+      OUT  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
+      OUT  UINTN                   *NumberOfSenseKeys\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Check the HostAdapter status and re-interpret it in EFI_STATUS.\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to read capacity\r
+  @param  HostAdapterStatus  Host Adapter status\r
 \r
---*/\r
-;\r
+  @retval  EFI_SUCCESS       Host adapter is OK.\r
+  @retval  EFI_TIMEOUT       Timeout.\r
+  @retval  EFI_NOT_READY     Adapter NOT ready.\r
+  @retval  EFI_DEVICE_ERROR  Adapter device error.\r
 \r
+**/\r
 EFI_STATUS\r
 CheckHostAdapterStatus (\r
-  UINT8   HostAdapterStatus\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check the HostAdapter status\r
-  \r
-Arguments:\r
+  IN UINT8   HostAdapterStatus\r
+  );\r
 \r
-  HostAdapterStatus - Host Adapter status\r
 \r
-Returns:\r
+/**\r
+  Check the target status and re-interpret it in EFI_STATUS.\r
 \r
-  EFI_SUCCESS       \r
-  EFI_TIMEOUT       \r
-  EFI_NOT_READY     \r
-  EFI_DEVICE_ERROR  \r
+  @param  TargetStatus  Target status\r
 \r
---*/\r
-;\r
+  @retval EFI_NOT_READY       Device is NOT ready.\r
+  @retval EFI_DEVICE_ERROR \r
+  @retval EFI_SUCCESS\r
 \r
+**/\r
 EFI_STATUS\r
 CheckTargetStatus (\r
-  UINT8   TargetStatus\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check the target status\r
-  \r
-Arguments:\r
+  IN  UINT8   TargetStatus\r
+  );\r
 \r
-  TargetStatus  - Target status\r
+/**\r
+  Retrieve all sense keys from the device.\r
 \r
-Returns:\r
+  When encountering error during the process, if retrieve sense keys before\r
+  error encounterred, it returns the sense keys with return status set to EFI_SUCCESS,\r
+  and NeedRetry set to FALSE; otherwize, return the proper return status.\r
 \r
-  EFI_NOT_READY  \r
-  EFI_DEVICE_ERROR \r
-  EFI_SUCCESS\r
+  @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry          The pointer of flag indicates if need a retry\r
+  @param  SenseDataArray     The pointer of an array of sense data\r
+  @param  NumberOfSenseKeys  The number of sense key\r
+  @param  AskResetIfError    The flag indicates if need reset when error occurs\r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
+  @retval EFI_SUCCESS        Successfully to request sense key\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskRequestSenseKeys (\r
-  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-  BOOLEAN                 *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
-  UINTN                   *NumberOfSenseKeys,\r
-  BOOLEAN                 AskResetIfError\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  IN  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
+      OUT  BOOLEAN                 *NeedRetry,\r
+      OUT  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
+      OUT  UINTN                   *NumberOfSenseKeys,\r
+  IN       BOOLEAN                 AskResetIfError\r
+  );\r
 \r
-  Retrieve all sense keys from the device.\r
-  When encountering error during the process,\r
-  if retrieve sense keys before error encounterred,\r
-  return the sense keys with return status set to EFI_SUCCESS,\r
-  and NeedRetry set to FALSE; otherwize, return the proper return\r
-  status.\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice     -  The pointer of SCSI_DISK_DEV\r
-  NeedRetry          -  The pointer of flag indicates if need a retry\r
-  SenseDataArray     -  The pointer of an array of sense data\r
-  NumberOfSenseKeys  -  The number of sense key\r
-  AskResetIfError    -  The flag indicates if need reset when error occurs\r
-  \r
-Returns:\r
+/**\r
+  Send out Inquiry command to Device.\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to request sense key\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
+  @param  NeedRetry       Indicates if needs try again when error happens\r
 \r
---*/\r
-;\r
+  @retval  EFI_DEVICE_ERROR  Indicates that error occurs\r
+  @retval  EFI_SUCCESS       Successfully to detect media\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskInquiryDevice (\r
-  SCSI_DISK_DEV   *ScsiDiskDevice,\r
-  BOOLEAN         *NeedRetry\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Send out Inquiry command to Device\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  NeedRetry       - Indicates if needs try again when error happens\r
-\r
-Returns:\r
+  IN OUT  SCSI_DISK_DEV   *ScsiDiskDevice,\r
+     OUT  BOOLEAN         *NeedRetry\r
+  );\r
 \r
-  EFI_DEVICE_ERROR   - Indicates that error occurs\r
-  EFI_SUCCESS        - Successfully to detect media\r
+/**\r
+  Parse Inquiry data.\r
 \r
---*/\r
-;\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
 \r
+**/\r
 VOID\r
 ParseInquiryData (\r
-  SCSI_DISK_DEV   *ScsiDiskDevice\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Parse Inquiry data\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
+  IN OUT SCSI_DISK_DEV   *ScsiDiskDevice\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Read sector from SCSI Disk.\r
 \r
-  NONE\r
+  @param  ScsiDiskDevice  The poiniter of SCSI_DISK_DEV\r
+  @param  Buffer          The buffer to fill in the read out data\r
+  @param  Lba             Logic block address\r
+  @param  NumberOfBlocks  The number of blocks to read\r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR  Indicates a device error.\r
+  @retval EFI_SUCCESS       Operation is successful.\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskReadSectors (\r
-  SCSI_DISK_DEV     *ScsiDiskDevice,\r
-  VOID              *Buffer,\r
-  EFI_LBA           Lba,\r
-  UINTN             NumberOfBlocks\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Read sector from SCSI Disk\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The poiniter of SCSI_DISK_DEV\r
-  Buffer          - The buffer to fill in the read out data\r
-  Lba             - Logic block address\r
-  NumberOfBlocks  - The number of blocks to read\r
+  IN   SCSI_DISK_DEV     *ScsiDiskDevice,\r
+  OUT  VOID              *Buffer,\r
+  IN   EFI_LBA           Lba,\r
+  IN   UINTN             NumberOfBlocks\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Write sector to SCSI Disk.\r
 \r
-  EFI_DEVICE_ERROR\r
-  EFI_SUCCESS\r
+  @param  ScsiDiskDevice  The poiniter of SCSI_DISK_DEV\r
+  @param  Buffer          The buffer of data to be written into SCSI Disk\r
+  @param  Lba             Logic block address\r
+  @param  NumberOfBlocks  The number of blocks to read\r
 \r
---*/\r
-;\r
+  @retval EFI_DEVICE_ERROR  Indicates a device error.\r
+  @retval EFI_SUCCESS       Operation is successful.\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskWriteSectors (\r
-  SCSI_DISK_DEV     *ScsiDiskDevice,\r
-  VOID              *Buffer,\r
-  EFI_LBA           Lba,\r
-  UINTN             NumberOfBlocks\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Write SCSI Disk sectors\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  Buffer          - The data buffer to write sector\r
-  Lba             - Logic block address\r
-  NumberOfBlocks  - The number of blocks to write\r
-\r
-Returns:\r
-\r
-  EFI_DEVICE_ERROR \r
-  EFI_SUCCESS\r
-\r
---*/\r
-;\r
+  IN  SCSI_DISK_DEV     *ScsiDiskDevice,\r
+  IN  VOID              *Buffer,\r
+  IN  EFI_LBA           Lba,\r
+  IN  UINTN             NumberOfBlocks\r
+  );\r
 \r
+/**\r
+  Sumbmit Read command.\r
+\r
+  @param  ScsiDiskDevice     The pointer of ScsiDiskDevice\r
+  @param  NeedRetry          The pointer of flag indicates if needs retry if error happens\r
+  @param  SenseDataArray     NOT used yet in this function\r
+  @param  NumberOfSenseKeys  The number of sense key\r
+  @param  Timeout            The time to complete the command\r
+  @param  DataBuffer         The buffer to fill with the read out data\r
+  @param  DataLength         The length of buffer\r
+  @param  StartLba           The start logic block address\r
+  @param  SectorSize         The size of sector\r
+\r
+  @return  EFI_STATUS is returned by calling ScsiRead10Command().\r
+**/\r
 EFI_STATUS\r
 ScsiDiskRead10 (\r
-  SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  BOOLEAN               *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
-  UINTN                 *NumberOfSenseKeys,\r
-  UINT64                Timeout,\r
-  UINT8                 *DataBuffer,\r
-  UINT32                *DataLength,\r
-  UINT32                StartLba,\r
-  UINT32                SectorSize\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Sumbmit Read command \r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice    - The pointer of ScsiDiskDevice\r
-  NeedRetry         - The pointer of flag indicates if needs retry if error happens\r
-  SenseDataArray    - The pointer of an array of sense data\r
-  NumberOfSenseKeys - The number of sense key\r
-  Timeout           - The time to complete the command\r
-  DataBuffer        - The buffer to fill with the read out data\r
-  DataLength        - The length of buffer\r
-  StartLba          - The start logic block address\r
-  SectorSize        - The size of sector\r
+  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
+     OUT BOOLEAN               *NeedRetry,\r
+     OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,   OPTIONAL\r
+     OUT UINTN                 *NumberOfSenseKeys,\r
+  IN     UINT64                Timeout,\r
+     OUT UINT8                 *DataBuffer,\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Submit Write Command.\r
 \r
-  EFI_STATUS\r
+  @param  ScsiDiskDevice     The pointer of ScsiDiskDevice\r
+  @param  NeedRetry          The pointer of flag indicates if needs retry if error happens\r
+  @param  SenseDataArray     NOT used yet in this function\r
+  @param  NumberOfSenseKeys  The number of sense key\r
+  @param  Timeout            The time to complete the command\r
+  @param  DataBuffer         The buffer to fill with the read out data\r
+  @param  DataLength         The length of buffer\r
+  @param  StartLba           The start logic block address\r
+  @param  SectorSize         The size of sector\r
 \r
---*/\r
-;\r
+  @return  EFI_STATUS is returned by calling ScsiWrite10Command().\r
 \r
+**/\r
 EFI_STATUS\r
 ScsiDiskWrite10 (\r
-  SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  BOOLEAN               *NeedRetry,\r
-  EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
-  UINTN                 *NumberOfSenseKeys,\r
-  UINT64                Timeout,\r
-  UINT8                 *DataBuffer,\r
-  UINT32                *DataLength,\r
-  UINT32                StartLba,\r
-  UINT32                SectorSize\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Submit Write Command\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice    - The pointer of ScsiDiskDevice\r
-  NeedRetry         - The pointer of flag indicates if needs retry if error happens\r
-  SenseDataArray    - The pointer of an array of sense data\r
-  NumberOfSenseKeys - The number of sense key\r
-  Timeout           - The time to complete the command\r
-  DataBuffer        - The buffer to fill with the read out data\r
-  DataLength        - The length of buffer\r
-  StartLba          - The start logic block address\r
-  SectorSize        - The size of sector\r
-\r
-Returns:\r
+  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
+     OUT BOOLEAN               *NeedRetry,\r
+     OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,   OPTIONAL\r
+     OUT UINTN                 *NumberOfSenseKeys,\r
+  IN     UINT64                Timeout,\r
+  IN     UINT8                 *DataBuffer,\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
+  );\r
 \r
-  EFI_STATUS\r
+/**\r
+  Get information from media read capacity command.\r
 \r
---*/\r
-;\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
+  @param  Capacity        The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r
 \r
+**/\r
 VOID\r
 GetMediaInfo (\r
-  SCSI_DISK_DEV                 *ScsiDiskDevice,\r
-  EFI_SCSI_DISK_CAPACITY_DATA   *Capacity\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Get information from media read capacity command\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-  Capacity        - The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r
-\r
-Returns:\r
+  IN  OUT  SCSI_DISK_DEV                 *ScsiDiskDevice,\r
+  IN       EFI_SCSI_DISK_CAPACITY_DATA   *Capacity\r
+  );\r
 \r
-  NONE\r
+/**\r
+  Check sense key to find if media presents.\r
 \r
---*/\r
-;\r
+  @param  SenseData   The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts The number of sense key\r
 \r
+  @retval TRUE    NOT any media\r
+  @retval FALSE   Media presents\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsNoMedia (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if media presents\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Parse sense key.\r
 \r
-  BOOLEAN\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
 \r
---*/\r
-;\r
+  @retval TRUE   Error\r
+  @retval FALSE  NOT error\r
 \r
+**/\r
 BOOLEAN\r
 ScsiDiskIsMediaError (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Parse sense key\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Check sense key to find if hardware error happens.\r
 \r
-  BOOLEAN\r
+  @param  SenseData     The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts   The number of sense key\r
 \r
---*/\r
-;\r
+  @retval TRUE  Hardware error exits.\r
+  @retval FALSE NO error.\r
 \r
+**/\r
 BOOLEAN\r
 ScsiDiskIsHardwareError (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if hardware error happens\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
+  );\r
 \r
-  BOOLEAN\r
+/**\r
+  Check sense key to find if media has changed.\r
 \r
---*/\r
-;\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
 \r
+  @retval TRUE   Media is changed.\r
+  @retval FALSE  Medit is NOT changed.\r
+**/\r
 BOOLEAN\r
 ScsiDiskIsMediaChange (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Routine Description:\r
-\r
- Check sense key to find if media has changed\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Check sense key to find if reset happens.\r
 \r
-  BOOLEAN\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
 \r
---*/\r
-;\r
+  @retval TRUE  It is reset before.\r
+  @retval FALSE It is NOT reset before.\r
 \r
+**/\r
 BOOLEAN\r
 ScsiDiskIsResetBefore (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if reset happens\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Check sense key to find if the drive is ready.\r
 \r
-  BOOLEAN\r
+  @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts  The number of sense key\r
+  @param  RetryLater   The flag means if need a retry \r
 \r
---*/\r
-;\r
+  @retval TRUE  Drive is ready.\r
+  @retval FALSE Drive is NOT ready.\r
 \r
+**/\r
 BOOLEAN\r
 ScsiDiskIsDriveReady (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts,\r
-  OUT BOOLEAN               *NeedRetry\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if the drive is ready\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-  RetryLater  - The flag means if need a retry \r
+  OUT BOOLEAN               *RetryLater\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Check sense key to find if it has sense key.\r
 \r
-  BOOLEAN\r
+  @param  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
+  @param  SenseCounts - The number of sense key\r
 \r
---*/\r
-;\r
+  @retval TRUE  It has sense key.\r
+  @retval FALSE It has NOT any sense key.\r
 \r
+**/\r
 BOOLEAN\r
 ScsiDiskHaveSenseKey (\r
   IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
   IN  UINTN                 SenseCounts\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check sense key to find if it has sense key\r
-\r
-Arguments:\r
-\r
-  SenseData   - The pointer of EFI_SCSI_SENSE_DATA\r
-  SenseCounts - The number of sense key\r
-\r
-Returns:\r
+  );\r
 \r
-  BOOLEAN\r
+/**\r
+  Release resource about disk device.\r
 \r
---*/\r
-;\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
 \r
+**/\r
 VOID\r
 ReleaseScsiDiskDeviceResources (\r
   IN  SCSI_DISK_DEV   *ScsiDiskDevice\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Release resource about disk device\r
-\r
-Arguments:\r
-\r
-  ScsiDiskDevice  - The pointer of SCSI_DISK_DEV\r
-\r
-Returns:\r
-\r
-  NONE\r
-\r
---*/\r
-;\r
+  );\r
 \r
 #endif\r
index aea9646a98a210302b2c89cf0573a72321f9e2c5..3316862d0a9e721df24bec40cff94e2bdc8a4ba4 100644 (file)
@@ -1,6 +1,6 @@
 #/** @file\r
 #  \r
-#    Component description file for Scsi Disk module.\r
+#   Component description file for Scsi Disk module.\r
 #  \r
 #   Scsi Disk driver. This driver detected the Scsi disk media and export block io protocol\r
 #  \r
@@ -32,7 +32,8 @@
 #  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
 #\r
 #  DRIVER_BINDING                =  gScsiDiskDriverBinding                       \r
-#  COMPONENT_NAME                =  gScsiDiskComponentName                       \r
+#  COMPONENT_NAME                =  gScsiDiskComponentName\r
+#  COMPONENT_NAME2               =  gScsiDiskComponentName2\r
 #\r
 \r
 [Sources.common]\r