]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
Introduce tow non-blocking task lists to AtaBus. One maintains the sub-task which...
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaAtapiPassThru / AtaAtapiPassThru.h
index 0987478564ac3d4e4939b48f9ab7d4b95c6d4808..1d50c30d7be6f22e7aa1f02dc986e03f60e36540 100644 (file)
@@ -1,14 +1,14 @@
 /** @file
   Header file for ATA/ATAPI PASS THRU driver.
-  
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-  This program and the accompanying materials                          
-  are licensed and made available under the terms and conditions of the BSD License         
-  which accompanies this distribution.  The full text of the license may be found at        
-  http://opensource.org/licenses/bsd-license.php                                            
 
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 #ifndef __ATA_ATAPI_PASS_THRU_H__
@@ -95,26 +95,26 @@ typedef struct {
 
   EFI_IDE_REGISTERS                 IdeRegisters[EfiIdeMaxChannel];
   EFI_AHCI_REGISTERS                AhciRegisters;
-  
+
   //
   // The attached device list
   //
   LIST_ENTRY                        DeviceList;
   UINT64                            OriginalPciAttributes;
-\r
+
   //
-  // For AtaPassThru protocol, using the following bytes to record the previous call in 
+  // For AtaPassThru protocol, using the following bytes to record the previous call in
   // GetNextPort()/GetNextDevice().
   //
   UINT16                            PreviousPort;
   UINT16                            PreviousPortMultiplier;
   //
-  // For ExtScsiPassThru protocol, using the following bytes to record the previous call in 
+  // For ExtScsiPassThru protocol, using the following bytes to record the previous call in
   // GetNextTarget()/GetNextTargetLun().
   //
   UINT16                            PreviousTargetId;
   UINT64                            PreviousLun;
+
   //
   // For Non-blocking.
   //
@@ -136,7 +136,7 @@ struct _ATA_NONBLOCK_TASK {
   EFI_EVENT                         Event;
   UINT64                            RetryTimes;
   VOID                              *Map; // Pointer to map.
-  VOID                              *TableMap;// Pointer to PRD table map. 
+  VOID                              *TableMap;// Pointer to PRD table map.
   EFI_ATA_DMA_PRD                   *MapBaseAddress; //  Pointer to range Base address for Map.
   UINTN                             PageCount;      //  The page numbers used by PCIO freebuffer.
 };
@@ -275,7 +275,7 @@ AtaAtapiPassThruComponentNameGetDriverName (
                                 driver specified by This was returned in
                                 DriverName.
 
-  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
 
   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
                                 EFI_HANDLE.
@@ -303,33 +303,33 @@ AtaAtapiPassThruComponentNameGetControllerName (
   );
 
 /**
-  Tests to see if this driver supports a given controller. If a child device is provided, 
+  Tests to see if this driver supports a given controller. If a child device is provided,
   it further tests to see if this driver supports creating a handle for the specified child device.
 
-  This function checks to see if the driver specified by This supports the device specified by 
-  ControllerHandle. Drivers will typically use the device path attached to 
-  ControllerHandle and/or the services from the bus I/O abstraction attached to 
-  ControllerHandle to determine if the driver supports ControllerHandle. This function 
-  may be called many times during platform initialization. In order to reduce boot times, the tests 
-  performed by this function must be very small, and take as little time as possible to execute. This 
-  function must not change the state of any hardware devices, and this function must be aware that the 
-  device specified by ControllerHandle may already be managed by the same driver or a 
-  different driver. This function must match its calls to AllocatePages() with FreePages(), 
-  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().  
-  Because ControllerHandle may have been previously started by the same driver, if a protocol is 
-  already in the opened state, then it must not be closed with CloseProtocol(). This is required 
+  This function checks to see if the driver specified by This supports the device specified by
+  ControllerHandle. Drivers will typically use the device path attached to
+  ControllerHandle and/or the services from the bus I/O abstraction attached to
+  ControllerHandle to determine if the driver supports ControllerHandle. This function
+  may be called many times during platform initialization. In order to reduce boot times, the tests
+  performed by this function must be very small, and take as little time as possible to execute. This
+  function must not change the state of any hardware devices, and this function must be aware that the
+  device specified by ControllerHandle may already be managed by the same driver or a
+  different driver. This function must match its calls to AllocatePages() with FreePages(),
+  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
+  Because ControllerHandle may have been previously started by the same driver, if a protocol is
+  already in the opened state, then it must not be closed with CloseProtocol(). This is required
   to guarantee the state of ControllerHandle is not modified by this function.
 
   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
-  @param[in]  ControllerHandle     The handle of the controller to test. This handle 
-                                   must support a protocol interface that supplies 
+  @param[in]  ControllerHandle     The handle of the controller to test. This handle
+                                   must support a protocol interface that supplies
                                    an I/O abstraction to the driver.
-  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This 
-                                   parameter is ignored by device drivers, and is optional for bus 
-                                   drivers. For bus drivers, if this parameter is not NULL, then 
-                                   the bus driver must determine if the bus controller specified 
-                                   by ControllerHandle and the child controller specified 
-                                   by RemainingDevicePath are both supported by this 
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
+                                   parameter is ignored by device drivers, and is optional for bus
+                                   drivers. For bus drivers, if this parameter is not NULL, then
+                                   the bus driver must determine if the bus controller specified
+                                   by ControllerHandle and the child controller specified
+                                   by RemainingDevicePath are both supported by this
                                    bus driver.
 
   @retval EFI_SUCCESS              The device specified by ControllerHandle and
@@ -356,28 +356,28 @@ AtaAtapiPassThruSupported (
   Starts a device controller or a bus controller.
 
   The Start() function is designed to be invoked from the EFI boot service ConnectController().
-  As a result, much of the error checking on the parameters to Start() has been moved into this 
-  common boot service. It is legal to call Start() from other locations, 
+  As a result, much of the error checking on the parameters to Start() has been moved into this
+  common boot service. It is legal to call Start() from other locations,
   but the following calling restrictions must be followed, or the system behavior will not be deterministic.
   1. ControllerHandle must be a valid EFI_HANDLE.
   2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
      EFI_DEVICE_PATH_PROTOCOL.
   3. Prior to calling Start(), the Supported() function for the driver specified by This must
-     have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.  
+     have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
 
   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
-  @param[in]  ControllerHandle     The handle of the controller to start. This handle 
-                                   must support a protocol interface that supplies 
+  @param[in]  ControllerHandle     The handle of the controller to start. This handle
+                                   must support a protocol interface that supplies
                                    an I/O abstraction to the driver.
-  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This 
-                                   parameter is ignored by device drivers, and is optional for bus 
-                                   drivers. For a bus driver, if this parameter is NULL, then handles 
-                                   for all the children of Controller are created by this driver.  
-                                   If this parameter is not NULL and the first Device Path Node is 
-                                   not the End of Device Path Node, then only the handle for the 
-                                   child device specified by the first Device Path Node of 
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
+                                   parameter is ignored by device drivers, and is optional for bus
+                                   drivers. For a bus driver, if this parameter is NULL, then handles
+                                   for all the children of Controller are created by this driver.
+                                   If this parameter is not NULL and the first Device Path Node is
+                                   not the End of Device Path Node, then only the handle for the
+                                   child device specified by the first Device Path Node of
                                    RemainingDevicePath is created by this driver.
-                                   If the first Device Path Node of RemainingDevicePath is 
+                                   If the first Device Path Node of RemainingDevicePath is
                                    the End of Device Path Node, no child handle is created by this
                                    driver.
 
@@ -397,10 +397,10 @@ AtaAtapiPassThruStart (
 
 /**
   Stops a device controller or a bus controller.
-  
-  The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 
-  As a result, much of the error checking on the parameters to Stop() has been moved 
-  into this common boot service. It is legal to call Stop() from other locations, 
+
+  The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
+  As a result, much of the error checking on the parameters to Stop() has been moved
+  into this common boot service. It is legal to call Stop() from other locations,
   but the following calling restrictions must be followed, or the system behavior will not be deterministic.
   1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
      same driver's Start() function.
@@ -408,13 +408,13 @@ AtaAtapiPassThruStart (
      EFI_HANDLE. In addition, all of these handles must have been created in this driver's
      Start() function, and the Start() function must have called OpenProtocol() on
      ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
-  
+
   @param[in]  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
-  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must 
-                                support a bus specific I/O protocol for the driver 
+  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must
+                                support a bus specific I/O protocol for the driver
                                 to use to stop the device.
   @param[in]  NumberOfChildren  The number of child device handles in ChildHandleBuffer.
-  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL 
+  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL
                                 if NumberOfChildren is 0.
 
   @retval EFI_SUCCESS           The device was stopped.
@@ -432,13 +432,13 @@ AtaAtapiPassThruStop (
 
 /**
   Traverse the attached ATA devices list to find out the device to access.
-  
+
   @param[in]  Instance            A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
-  @param[in]  Port                The port number of the ATA device to send the command. 
+  @param[in]  Port                The port number of the ATA device to send the command.
   @param[in]  PortMultiplierPort  The port multiplier port number of the ATA device to send the command.
                                   If there is no port multiplier, then specify 0.
   @param[in]  DeviceType          The device type of the ATA device.
-  
+
   @retval     The pointer to the data structure of the device info to access.
 
 **/
@@ -454,9 +454,9 @@ SearchDeviceInfoList (
 /**
   Allocate device info data structure to contain device info.
   And insert the data structure to the tail of device list for tracing.
-    
+
   @param[in]  Instance            A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
-  @param[in]  Port                The port number of the ATA device to send the command. 
+  @param[in]  Port                The port number of the ATA device to send the command.
   @param[in]  PortMultiplierPort  The port multiplier port number of the ATA device to send the command.
                                   If there is no port multiplier, then specify 0.
   @param[in]  DeviceType          The device type of the ATA device.
@@ -478,7 +478,7 @@ CreateNewDeviceInfo (
 
 /**
   Destroy all attached ATA devices info.
-  
+
   @param[in]  Instance          A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
 
 **/
@@ -490,21 +490,24 @@ DestroyDeviceInfoList (
 
 /**
   Destroy all pending non blocking tasks.
-  
-  @param[in]  Instance  A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
+
+  @param[in]  Instance    A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
+  @param[in]  IsSigEvent  Indicate whether signal the task event when remove the
+                          task.
 
 **/
 VOID
 EFIAPI
 DestroyAsynTaskList (
-  IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
+  IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
+  IN BOOLEAN                       IsSigEvent
   );
 
 /**
   Enumerate all attached ATA devices at IDE mode or AHCI mode separately.
-  
-  The function is designed to enumerate all attached ATA devices. 
-  
+
+  The function is designed to enumerate all attached ATA devices.
+
   @param[in]  Instance          A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
 
   @retval EFI_SUCCESS           Successfully enumerate attached ATA devices.
@@ -526,9 +529,9 @@ EnumerateAttachedDevice (
 
 **/
 VOID
-EFIAPI 
+EFIAPI
 AsyncNonBlockingTransferRoutine (
-  EFI_EVENT  Event, 
+  EFI_EVENT  Event,
   VOID*      Context
   );
 
@@ -537,8 +540,8 @@ AsyncNonBlockingTransferRoutine (
   supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
   and the non-blocking I/O functionality is optional.
 
-  @param[in]      This               A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. 
-  @param[in]      Port               The port number of the ATA device to send the command. 
+  @param[in]      This               A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
+  @param[in]      Port               The port number of the ATA device to send the command.
   @param[in]      PortMultiplierPort The port multiplier port number of the ATA device to send the command.
                                      If there is no port multiplier, then specify 0.
   @param[in, out] Packet             A pointer to the ATA command to send to the ATA device specified by Port
@@ -548,11 +551,11 @@ AsyncNonBlockingTransferRoutine (
                                      Event is not NULL and non blocking I/O is supported, then non-blocking
                                      I/O is performed, and Event will be signaled when the ATA command completes.
 
-  @retval EFI_SUCCESS                The ATA command was sent by the host. For bi-directional commands, 
+  @retval EFI_SUCCESS                The ATA command was sent by the host. For bi-directional commands,
                                      InTransferLength bytes were transferred from InDataBuffer. For write and
                                      bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
   @retval EFI_BAD_BUFFER_SIZE        The ATA command was not executed. The number of bytes that could be transferred
-                                     is returned in InTransferLength. For write and bi-directional commands, 
+                                     is returned in InTransferLength. For write and bi-directional commands,
                                      OutTransferLength bytes were transferred by OutDataBuffer.
   @retval EFI_NOT_READY              The ATA command could not be sent because there are too many ATA commands
                                      already queued. The caller may retry again later.
@@ -590,7 +593,7 @@ AtaPassThruPassThru (
   If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is
   returned.
 
-  @param[in]      This          A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. 
+  @param[in]      This          A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
   @param[in, out] Port          On input, a pointer to the port number on the ATA controller.
                                 On output, a pointer to the next port number on the ATA
                                 controller. An input value of 0xFFFF retrieves the first port
@@ -610,36 +613,36 @@ AtaPassThruGetNextPort (
   );
 
 /**
-  Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA 
-  controller. These can either be the list of port multiplier ports where ATA devices are actually 
-  present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this 
-  function must probe the port number and port multiplier port number returned to see if an ATA 
+  Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA
+  controller. These can either be the list of port multiplier ports where ATA devices are actually
+  present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this
+  function must probe the port number and port multiplier port number returned to see if an ATA
   device is actually present.
 
-  The GetNextDevice() function retrieves the port multiplier port number of an ATA device 
+  The GetNextDevice() function retrieves the port multiplier port number of an ATA device
   present on a port of an ATA controller.
 
-  If PortMultiplierPort points to a port multiplier port number value that was returned on a 
+  If PortMultiplierPort points to a port multiplier port number value that was returned on a
   previous call to GetNextDevice(), then the port multiplier port number of the next ATA device
   on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is
   returned.
 
-  If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first 
-  ATA device on port of the ATA controller is returned in PortMultiplierPort and 
+  If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first
+  ATA device on port of the ATA controller is returned in PortMultiplierPort and
   EFI_SUCCESS is returned.
 
   If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
   was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
   is returned.
-  
-  If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of 
+
+  If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of
   the ATA controller, then EFI_NOT_FOUND is returned.
 
   @param[in]      This               A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
   @param[in]      Port               The port number present on the ATA controller.
   @param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an
-                                     ATA device present on the ATA controller. 
-                                     If on input a PortMultiplierPort of 0xFFFF is specified, 
+                                     ATA device present on the ATA controller.
+                                     If on input a PortMultiplierPort of 0xFFFF is specified,
                                      then the port multiplier port number of the first ATA device
                                      is returned. On output, a pointer to the port multiplier port
                                      number of the next ATA device present on an ATA controller.
@@ -705,7 +708,7 @@ AtaPassThruBuildDevicePath (
 
   The GetDevice() function determines the port and port multiplier port number associated with
   the ATA device described by DevicePath. If DevicePath is a device path node type that the
-  ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents 
+  ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents
   DevicePath into a port number and port multiplier port number.
 
   If this translation is successful, then that port number and port multiplier port number are returned
@@ -713,11 +716,11 @@ AtaPassThruBuildDevicePath (
 
   If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.
 
-  If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then 
+  If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then
   EFI_UNSUPPORTED is returned.
 
-  If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not 
-  a valid translation from DevicePath to a port number and port multiplier port number, then 
+  If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not
+  a valid translation from DevicePath to a port number and port multiplier port number, then
   EFI_NOT_FOUND is returned.
 
   @param[in]  This                A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
@@ -784,7 +787,7 @@ AtaPassThruResetPort (
   If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is
   returned.
 
-  If Port or PortMultiplierPort are not in a valid range for this ATA controller, then 
+  If Port or PortMultiplierPort are not in a valid range for this ATA controller, then
   EFI_INVALID_PARAMETER is returned.
 
   If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR
@@ -817,9 +820,9 @@ AtaPassThruResetDevice (
   );
 
 /**
-  Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function   
+  Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
   supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
-  nonblocking I/O functionality is optional.                                                             
+  nonblocking I/O functionality is optional.
 
   @param  This    A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
   @param  Target  The Target is an array of size TARGET_MAX_BYTES and it represents
@@ -868,10 +871,10 @@ ExtScsiPassThruPassThru (
   );
 
 /**
-  Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These       
+  Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
   can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
-  Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the       
-  Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI    
+  Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
+  Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
   channel.
 
   @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@@ -1007,13 +1010,13 @@ ExtScsiPassThruResetTargetLun (
   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *This,
   IN UINT8                              *Target,
   IN UINT64                             Lun
-  );     
+  );
 
 /**
-  Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either     
+  Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
   be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
-  for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to     
-  see if a SCSI device is actually present at that location on the SCSI channel.                         
+  for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
+  see if a SCSI device is actually present at that location on the SCSI channel.
 
   @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
   @param  Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
@@ -1040,9 +1043,9 @@ ExtScsiPassThruGetNextTarget (
 
 /**
   Initialize ATA host controller at IDE mode.
-  
-  The function is designed to initialize ATA host controller. 
-  
+
+  The function is designed to initialize ATA host controller.
+
   @param[in]  Instance          A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
 
 **/
@@ -1054,9 +1057,9 @@ IdeModeInitialization (
 
 /**
   Initialize ATA host controller at AHCI mode.
-  
-  The function is designed to initialize ATA host controller. 
-  
+
+  The function is designed to initialize ATA host controller.
+
   @param[in]  Instance          A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
 
 **/
@@ -1068,7 +1071,7 @@ AhciModeInitialization (
 
 /**
   Start a non data transfer on specific port.
-    
+
   @param[in]       PciIo               The PCI IO protocol instance.
   @param[in]       AhciRegisters       The pointer to the EFI_AHCI_REGISTERS.
   @param[in]       Port                The number of port.
@@ -1078,7 +1081,7 @@ AhciModeInitialization (
   @param[in]       AtapiCommandLength  The length of the atapi command.
   @param[in]       AtaCommandBlock     The EFI_ATA_COMMAND_BLOCK data.
   @param[in, out]  AtaStatusBlock      The EFI_ATA_STATUS_BLOCK data.
-  @param[in]       Timeout             The timeout value of non data transfer.
+  @param[in]       Timeout             The timeout value of non data transfer, uses 100ns as a unit.
   @param[in]       Task                Optional. Pointer to the ATA_NONBLOCK_TASK
                                        used by non-blocking mode.
 
@@ -1099,7 +1102,7 @@ AhciNonDataTransfer (
   IN     UINT8                         AtapiCommandLength,
   IN     EFI_ATA_COMMAND_BLOCK         *AtaCommandBlock,
   IN OUT EFI_ATA_STATUS_BLOCK          *AtaStatusBlock,
-  IN     UINT64                        Timeout, 
+  IN     UINT64                        Timeout,
   IN     ATA_NONBLOCK_TASK             *Task
   );
 
@@ -1118,7 +1121,7 @@ AhciNonDataTransfer (
   @param[in, out]  AtaStatusBlock      The EFI_ATA_STATUS_BLOCK data.
   @param[in, out]  MemoryAddr          The pointer to the data buffer.
   @param[in]       DataCount           The data count to be transferred.
-  @param[in]       Timeout             The timeout value of non data transfer.
+  @param[in]       Timeout             The timeout value of non data transfer, uses 100ns as a unit.
   @param[in]       Task                Optional. Pointer to the ATA_NONBLOCK_TASK
                                        used by non-blocking mode.
 
@@ -1131,24 +1134,24 @@ AhciNonDataTransfer (
 EFI_STATUS
 EFIAPI
 AhciDmaTransfer (
-  IN     ATA_ATAPI_PASS_THRU_INSTANCE *Instance, 
+  IN     ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
   IN     EFI_AHCI_REGISTERS           *AhciRegisters,
   IN     UINT8                        Port,
   IN     UINT8                        PortMultiplier,
   IN     EFI_AHCI_ATAPI_COMMAND       *AtapiCommand OPTIONAL,
   IN     UINT8                        AtapiCommandLength,
-  IN     BOOLEAN                      Read,  
+  IN     BOOLEAN                      Read,
   IN     EFI_ATA_COMMAND_BLOCK        *AtaCommandBlock,
   IN OUT EFI_ATA_STATUS_BLOCK         *AtaStatusBlock,
   IN OUT VOID                         *MemoryAddr,
-  IN     UINT                       DataCount,
-  IN     UINT64                       Timeout, 
+  IN     UINT32                       DataCount,
+  IN     UINT64                       Timeout,
   IN     ATA_NONBLOCK_TASK            *Task
   );
 
 /**
   Start a PIO data transfer on specific port.
-    
+
   @param[in]       PciIo               The PCI IO protocol instance.
   @param[in]       AhciRegisters       The pointer to the EFI_AHCI_REGISTERS.
   @param[in]       Port                The number of port.
@@ -1161,7 +1164,7 @@ AhciDmaTransfer (
   @param[in, out]  AtaStatusBlock      The EFI_ATA_STATUS_BLOCK data.
   @param[in, out]  MemoryAddr          The pointer to the data buffer.
   @param[in]       DataCount           The data count to be transferred.
-  @param[in]       Timeout             The timeout value of non data transfer.
+  @param[in]       Timeout             The timeout value of non data transfer, uses 100ns as a unit.
   @param[in]       Task                Optional. Pointer to the ATA_NONBLOCK_TASK
                                        used by non-blocking mode.
 
@@ -1179,13 +1182,13 @@ AhciPioTransfer (
   IN     UINT8                      Port,
   IN     UINT8                      PortMultiplier,
   IN     EFI_AHCI_ATAPI_COMMAND     *AtapiCommand OPTIONAL,
-  IN     UINT8                      AtapiCommandLength,  
-  IN     BOOLEAN                    Read,  
+  IN     UINT8                      AtapiCommandLength,
+  IN     BOOLEAN                    Read,
   IN     EFI_ATA_COMMAND_BLOCK      *AtaCommandBlock,
   IN OUT EFI_ATA_STATUS_BLOCK       *AtaStatusBlock,
   IN OUT VOID                       *MemoryAddr,
   IN     UINT32                     DataCount,
-  IN     UINT64                     Timeout, 
+  IN     UINT64                     Timeout,
   IN     ATA_NONBLOCK_TASK          *Task
   );
 
@@ -1198,7 +1201,7 @@ AhciPioTransfer (
   @param[in]      AtaCommandBlock  A pointer to EFI_ATA_COMMAND_BLOCK data
                                    structure.
   @param[in, out] AtaStatusBlock   A pointer to EFI_ATA_STATUS_BLOCK data structure.
-  @param[in]      Timeout          The time to complete the command.
+  @param[in]      Timeout          The time to complete the command, uses 100ns as a unit.
   @param[in]      Task             Optional. Pointer to the ATA_NONBLOCK_TASK
                                    used by non-blocking mode.
 
@@ -1232,7 +1235,7 @@ AtaNonDataCommandIn (
   @param[in]      DataLength       The length of  the data.
   @param[in]      AtaCommandBlock  A pointer to EFI_ATA_COMMAND_BLOCK data structure.
   @param[in, out] AtaStatusBlock   A pointer to EFI_ATA_STATUS_BLOCK data structure.
-  @param[in]      Timeout          The time to complete the command.
+  @param[in]      Timeout          The time to complete the command, uses 100ns as a unit.
   @param[in]      Task             Optional. Pointer to the ATA_NONBLOCK_TASK
                                    used by non-blocking mode.
 
@@ -1269,11 +1272,11 @@ AtaUdmaInOut (
                                    to host;Read equals 0, means data transferred
                                    from host to device.
   @param[in]      AtaCommandBlock  A pointer to EFI_ATA_COMMAND_BLOCK data structure.
-  @param[in]      AtaStatusBlock   A pointer to EFI_ATA_STATUS_BLOCK data structure.
-  @param[in]      Timeout          The time to complete the command.
+  @param[in, out] AtaStatusBlock   A pointer to EFI_ATA_STATUS_BLOCK data structure.
+  @param[in]      Timeout          The time to complete the command, uses 100ns as a unit.
   @param[in]      Task             Optional. Pointer to the ATA_NONBLOCK_TASK
                                    used by non-blocking mode.
-  
+
   @retval EFI_SUCCESS      send out the ATA command and device send required data successfully.
   @retval EFI_DEVICE_ERROR command sent failed.
 
@@ -1288,7 +1291,7 @@ AtaPioDataInOut (
   IN     BOOLEAN                   Read,
   IN     EFI_ATA_COMMAND_BLOCK     *AtaCommandBlock,
   IN OUT EFI_ATA_STATUS_BLOCK      *AtaStatusBlock,
-  IN     UINT64                    Timeout, 
+  IN     UINT64                    Timeout,
   IN     ATA_NONBLOCK_TASK         *Task
   );