]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
MdeModulePkg/Bus/Ata: Fix various typos
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaBusDxe / AtaBus.h
index 6a4b2576b2d57720550d477644025dc170de77e7..a5a8652099426fb7d0cd617a7a9728558213e279 100644 (file)
@@ -4,14 +4,8 @@
   This file defines common data structures, macro definitions and some module\r
   internal function header files.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -35,6 +29,9 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/TimerLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Atapi.h>\r
 \r
 #define MAX_28BIT_ADDRESSING_CAPACITY     0xfffffff\r
 \r
 //\r
-// The maximum ATA transaction sector count in 28 bit addressing mode. \r
+// The maximum ATA transaction sector count in 28 bit addressing mode.\r
 //\r
 #define MAX_28BIT_TRANSFER_BLOCK_NUM      0x100\r
 \r
 //\r
-// The maximum ATA transaction sector count in 48 bit addressing mode. \r
+// The maximum ATA transaction sector count in 48 bit addressing mode.\r
 //\r
 //#define MAX_48BIT_TRANSFER_BLOCK_NUM      0x10000\r
 \r
 #define MAX_48BIT_TRANSFER_BLOCK_NUM      0xFFFF\r
 \r
 //\r
-// The maximum model name in ATA identify data  \r
+// The maximum model name in ATA identify data\r
 //\r
 #define MAX_MODEL_NAME_LEN                40\r
 \r
 #define ATA_TASK_SIGNATURE                SIGNATURE_32 ('A', 'T', 'S', 'K')\r
 #define ATA_DEVICE_SIGNATURE              SIGNATURE_32 ('A', 'B', 'I', 'D')\r
-\r
+#define ATA_SUB_TASK_SIGNATURE            SIGNATURE_32 ('A', 'S', 'T', 'S')\r
 #define IS_ALIGNED(addr, size)            (((UINTN) (addr) & (size - 1)) == 0)\r
 \r
-//\r
-// Task for the non blocking I/O\r
-//\r
-typedef struct {\r
-  UINT32                            Signature;\r
-  EFI_BLOCK_IO2_TOKEN               *Token;\r
-  UINTN                             *UnsignalledEventCount;\r
-  EFI_ATA_PASS_THRU_COMMAND_PACKET  Packet;\r
-  BOOLEAN                           *IsError;// Indicate whether meeting error during source allocation for new task.\r
-  LIST_ENTRY                        TaskEntry;\r
-} ATA_BUS_ASYN_TASK;\r
-\r
 //\r
 // ATA bus data structure for ATA controller\r
 //\r
@@ -140,13 +125,43 @@ typedef struct {
   CHAR16                                ModelName[MAX_MODEL_NAME_LEN + 1];\r
 \r
   LIST_ENTRY                            AtaTaskList;\r
+  LIST_ENTRY                            AtaSubTaskList;\r
+  BOOLEAN                               Abort;\r
 } ATA_DEVICE;\r
 \r
+//\r
+// Sub-Task for the non blocking I/O\r
+//\r
+typedef struct {\r
+  UINT32                            Signature;\r
+  ATA_DEVICE                        *AtaDevice;\r
+  EFI_BLOCK_IO2_TOKEN               *Token;\r
+  UINTN                             *UnsignalledEventCount;\r
+  EFI_ATA_PASS_THRU_COMMAND_PACKET  Packet;\r
+  BOOLEAN                           *IsError;// Indicate whether meeting error during source allocation for new task.\r
+  LIST_ENTRY                        TaskEntry;\r
+} ATA_BUS_ASYN_SUB_TASK;\r
+\r
+//\r
+// Task for the non blocking I/O\r
+//\r
+typedef struct {\r
+  UINT32                            Signature;\r
+  EFI_BLOCK_IO2_TOKEN               *Token;\r
+  ATA_DEVICE                        *AtaDevice;\r
+  UINT8                             *Buffer;\r
+  EFI_LBA                           StartLba;\r
+  UINTN                             NumberOfBlocks;\r
+  BOOLEAN                           IsWrite;\r
+  LIST_ENTRY                        TaskEntry;\r
+} ATA_BUS_ASYN_TASK;\r
+\r
 #define ATA_DEVICE_FROM_BLOCK_IO(a)         CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)\r
 #define ATA_DEVICE_FROM_BLOCK_IO2(a)        CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)\r
 #define ATA_DEVICE_FROM_DISK_INFO(a)        CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)\r
 #define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)\r
-#define ATA_AYNS_TASK_FROM_ENTRY(a)         CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r
+#define ATA_ASYN_SUB_TASK_FROM_ENTRY(a)     CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)\r
+#define ATA_ASYN_TASK_FROM_ENTRY(a)         CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r
 \r
 //\r
 // Global Variables\r
@@ -191,22 +206,22 @@ FreeAlignedBuffer (
   );\r
 \r
 /**\r
-  Free SubTask. \r
+  Free SubTask.\r
 \r
   @param[in, out]  Task      Pointer to task to be freed.\r
\r
+\r
 **/\r
 VOID\r
-EFIAPI \r
+EFIAPI\r
 FreeAtaSubTask (\r
-  IN OUT ATA_BUS_ASYN_TASK  *Task\r
+  IN OUT ATA_BUS_ASYN_SUB_TASK  *Task\r
   );\r
 \r
 /**\r
   Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().\r
 \r
   This function wraps the ResetDevice() invocation for ATA pass through function\r
-  for an ATA device. \r
+  for an ATA device.\r
 \r
   @param  AtaDevice         The ATA child device involved for the operation.\r
 \r
@@ -230,7 +245,7 @@ ResetAtaDevice (
 \r
   @retval EFI_SUCCESS       The device is successfully identified and Media information\r
                             is correctly initialized.\r
-  @return others            Some error occurs when discovering the ATA device. \r
+  @return others            Some error occurs when discovering the ATA device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -253,10 +268,10 @@ DiscoverAtaDevice (
   @param[in, out]  Token           A pointer to the token associated with the transaction.\r
 \r
   @retval EFI_SUCCESS       The data transfer is complete successfully.\r
-  @return others            Some error occurs when transferring data. \r
+  @return others            Some error occurs when transferring data.\r
 \r
 **/\r
-EFI_STATUS \r
+EFI_STATUS\r
 AccessAtaDevice(\r
   IN OUT ATA_DEVICE                 *AtaDevice,\r
   IN OUT UINT8                      *Buffer,\r
@@ -265,6 +280,7 @@ AccessAtaDevice(
   IN BOOLEAN                        IsWrite,\r
   IN OUT EFI_BLOCK_IO2_TOKEN        *Token\r
   );\r
+\r
 /**\r
   Trust transfer data from/to ATA device.\r
 \r
@@ -291,7 +307,7 @@ AccessAtaDevice(
                                        written to the buffer. Ignore it when IsTrustSend is TRUE.\r
 \r
   @retval EFI_SUCCESS       The data transfer is complete successfully.\r
-  @return others            Some error occurs when transferring data. \r
+  @return others            Some error occurs when transferring data.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -311,33 +327,33 @@ TrustTransferAtaDevice (
 // Protocol interface prototypes\r
 //\r
 /**\r
-  Tests to see if this driver supports a given controller. If a child device is provided, \r
+  Tests to see if this driver supports a given controller. If a child device is provided,\r
   it further tests to see if this driver supports creating a handle for the specified child device.\r
 \r
-  This function checks to see if the driver specified by This supports the device specified by \r
-  ControllerHandle. Drivers will typically use the device path attached to \r
-  ControllerHandle and/or the services from the bus I/O abstraction attached to \r
-  ControllerHandle to determine if the driver supports ControllerHandle. This function \r
-  may be called many times during platform initialization. In order to reduce boot times, the tests \r
-  performed by this function must be very small, and take as little time as possible to execute. This \r
-  function must not change the state of any hardware devices, and this function must be aware that the \r
-  device specified by ControllerHandle may already be managed by the same driver or a \r
-  different driver. This function must match its calls to AllocatePages() with FreePages(), \r
-  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().  \r
-  Since ControllerHandle may have been previously started by the same driver, if a protocol is \r
-  already in the opened state, then it must not be closed with CloseProtocol(). This is required \r
+  This function checks to see if the driver specified by This supports the device specified by\r
+  ControllerHandle. Drivers will typically use the device path attached to\r
+  ControllerHandle and/or the services from the bus I/O abstraction attached to\r
+  ControllerHandle to determine if the driver supports ControllerHandle. This function\r
+  may be called many times during platform initialization. In order to reduce boot times, the tests\r
+  performed by this function must be very small, and take as little time as possible to execute. This\r
+  function must not change the state of any hardware devices, and this function must be aware that the\r
+  device specified by ControllerHandle may already be managed by the same driver or a\r
+  different driver. This function must match its calls to AllocatePages() with FreePages(),\r
+  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
+  Since ControllerHandle may have been previously started by the same driver, if a protocol is\r
+  already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
   to guarantee the state of ControllerHandle is not modified by this function.\r
 \r
   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in]  ControllerHandle     The handle of the controller to test. This handle \r
-                                   must support a protocol interface that supplies \r
+  @param[in]  ControllerHandle     The handle of the controller to test. This handle\r
+                                   must support a protocol interface that supplies\r
                                    an I/O abstraction to the driver.\r
-  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This \r
-                                   parameter is ignored by device drivers, and is optional for bus \r
-                                   drivers. For bus drivers, if this parameter is not NULL, then \r
-                                   the bus driver must determine if the bus controller specified \r
-                                   by ControllerHandle and the child controller specified \r
-                                   by RemainingDevicePath are both supported by this \r
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This\r
+                                   parameter is ignored by device drivers, and is optional for bus\r
+                                   drivers. For bus drivers, if this parameter is not NULL, then\r
+                                   the bus driver must determine if the bus controller specified\r
+                                   by ControllerHandle and the child controller specified\r
+                                   by RemainingDevicePath are both supported by this\r
                                    bus driver.\r
 \r
   @retval EFI_SUCCESS              The device specified by ControllerHandle and\r
@@ -364,35 +380,35 @@ AtaBusDriverBindingSupported (
   Starts a device controller or a bus controller.\r
 \r
   The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
-  As a result, much of the error checking on the parameters to Start() has been moved into this \r
-  common boot service. It is legal to call Start() from other locations, \r
+  As a result, much of the error checking on the parameters to Start() has been moved into this\r
+  common boot service. It is legal to call Start() from other locations,\r
   but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
   1. ControllerHandle must be a valid EFI_HANDLE.\r
   2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
      EFI_DEVICE_PATH_PROTOCOL.\r
   3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
-     have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.  \r
+     have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
 \r
   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in]  ControllerHandle     The handle of the controller to start. This handle \r
-                                   must support a protocol interface that supplies \r
+  @param[in]  ControllerHandle     The handle of the controller to start. This handle\r
+                                   must support a protocol interface that supplies\r
                                    an I/O abstraction to the driver.\r
-  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This \r
-                                   parameter is ignored by device drivers, and is optional for bus \r
-                                   drivers. For a bus driver, if this parameter is NULL, then handles \r
-                                   for all the children of Controller are created by this driver.  \r
-                                   If this parameter is not NULL and the first Device Path Node is \r
-                                   not the End of Device Path Node, then only the handle for the \r
-                                   child device specified by the first Device Path Node of \r
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This\r
+                                   parameter is ignored by device drivers, and is optional for bus\r
+                                   drivers. For a bus driver, if this parameter is NULL, then handles\r
+                                   for all the children of Controller are created by this driver.\r
+                                   If this parameter is not NULL and the first Device Path Node is\r
+                                   not the End of Device Path Node, then only the handle for the\r
+                                   child device specified by the first Device Path Node of\r
                                    RemainingDevicePath is created by this driver.\r
-                                   If the first Device Path Node of RemainingDevicePath is \r
+                                   If the first Device Path Node of RemainingDevicePath is\r
                                    the End of Device Path Node, no child handle is created by this\r
                                    driver.\r
 \r
   @retval EFI_SUCCESS              The device was started.\r
   @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.Currently not implemented.\r
   @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.\r
-  @retval Others                   The driver failded to start the device.\r
+  @retval Others                   The driver failed to start the device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -405,10 +421,10 @@ AtaBusDriverBindingStart (
 \r
 /**\r
   Stops a device controller or a bus controller.\r
-  \r
-  The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r
-  As a result, much of the error checking on the parameters to Stop() has been moved \r
-  into this common boot service. It is legal to call Stop() from other locations, \r
+\r
+  The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
+  As a result, much of the error checking on the parameters to Stop() has been moved\r
+  into this common boot service. It is legal to call Stop() from other locations,\r
   but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
   1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
      same driver's Start() function.\r
@@ -416,13 +432,13 @@ AtaBusDriverBindingStart (
      EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
      Start() function, and the Start() function must have called OpenProtocol() on\r
      ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
-  \r
+\r
   @param[in]  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must \r
-                                support a bus specific I/O protocol for the driver \r
+  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must\r
+                                support a bus specific I/O protocol for the driver\r
                                 to use to stop the device.\r
   @param[in]  NumberOfChildren  The number of child device handles in ChildHandleBuffer.\r
-  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL \r
+  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL\r
                                 if NumberOfChildren is 0.\r
 \r
   @retval EFI_SUCCESS           The device was stopped.\r
@@ -598,9 +614,9 @@ AtaBlockIoReset (
   @retval EFI_SUCCESS           The data was read correctly from the device.\r
   @retval EFI_DEVICE_ERROR      The device reported an error while performing the read.\r
   @retval EFI_NO_MEDIA          There is no media in the device.\r
-  @retval EFI_MEDIA_CHANGED     The MediaId does not matched the current device.\r
+  @retval EFI_MEDIA_CHANGED     The MediaId does not match the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
 \r
 **/\r
@@ -629,9 +645,9 @@ AtaBlockIoReadBlocks (
   @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
   @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.\r
   @retval EFI_NO_MEDIA          There is no media in the device.\r
-  @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
+  @retval EFI_MEDIA_CHANGED     The MediaId does not match the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
 \r
 **/\r
@@ -663,7 +679,7 @@ AtaBlockIoFlushBlocks (
   );\r
 \r
 /**\r
-  Reset the Block Device throught Block I/O2 protocol.\r
+  Reset the Block Device through Block I/O2 protocol.\r
 \r
   @param[in]  This                 Indicates a pointer to the calling context.\r
   @param[in]  ExtendedVerification Driver may perform diagnostics on reset.\r
@@ -700,7 +716,7 @@ AtaBlockIoResetEx (
   @retval EFI_MEDIA_CHANGED     The MediaId is not for the current media.\r
   @retval EFI_BAD_BUFFER_SIZE   The BufferSize parameter is not a multiple of the\r
                                 intrinsic block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack\r
                                 of resources.\r
@@ -733,9 +749,9 @@ AtaBlockIoReadBlocksEx (
   @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
   @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.\r
   @retval EFI_NO_MEDIA          There is no media in the device.\r
-  @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
+  @retval EFI_MEDIA_CHANGED     The MediaId does not match the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
 \r
 **/\r
@@ -768,9 +784,25 @@ AtaBlockIoFlushBlocksEx (
   IN OUT EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
+/**\r
+  Terminate any in-flight non-blocking I/O requests by signaling an EFI_ABORTED\r
+  in the TransactionStatus member of the EFI_BLOCK_IO2_TOKEN for the non-blocking\r
+  I/O. After that it is safe to free any Token or Buffer data structures that\r
+  were allocated to initiate the non-blockingI/O requests that were in-flight for\r
+  this device.\r
+\r
+  @param[in]  AtaDevice     The ATA child device involved for the operation.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AtaTerminateNonBlockingTask (\r
+  IN ATA_DEVICE               *AtaDevice\r
+  );\r
+\r
 /**\r
   Provides inquiry information for the controller type.\r
-  \r
+\r
   This function is used by the IDE bus driver to get inquiry data.  Data format\r
   of Identify data is defined by the Interface GUID.\r
 \r
@@ -779,9 +811,9 @@ AtaBlockIoFlushBlocksEx (
   @param[in, out] InquiryDataSize  Pointer to the value for the inquiry data size.\r
 \r
   @retval EFI_SUCCESS            The command was accepted without any errors.\r
-  @retval EFI_NOT_FOUND          Device does not support this data class \r
-  @retval EFI_DEVICE_ERROR       Error reading InquiryData from device \r
-  @retval EFI_BUFFER_TOO_SMALL   InquiryDataSize not big enough \r
+  @retval EFI_NOT_FOUND          Device does not support this data class\r
+  @retval EFI_DEVICE_ERROR       Error reading InquiryData from device\r
+  @retval EFI_BUFFER_TOO_SMALL   InquiryDataSize not big enough\r
 \r
 **/\r
 EFI_STATUS\r
@@ -799,16 +831,16 @@ AtaDiskInfoInquiry (
   This function is used by the IDE bus driver to get identify data.  Data format\r
   of Identify data is defined by the Interface GUID.\r
 \r
-  @param[in]      This              Pointer to the EFI_DISK_INFO_PROTOCOL \r
+  @param[in]      This              Pointer to the EFI_DISK_INFO_PROTOCOL\r
                                     instance.\r
   @param[in, out] IdentifyData      Pointer to a buffer for the identify data.\r
   @param[in, out] IdentifyDataSize  Pointer to the value for the identify data\r
                                     size.\r
 \r
   @retval EFI_SUCCESS            The command was accepted without any errors.\r
-  @retval EFI_NOT_FOUND          Device does not support this data class \r
-  @retval EFI_DEVICE_ERROR       Error reading IdentifyData from device \r
-  @retval EFI_BUFFER_TOO_SMALL   IdentifyDataSize not big enough \r
+  @retval EFI_NOT_FOUND          Device does not support this data class\r
+  @retval EFI_DEVICE_ERROR       Error reading IdentifyData from device\r
+  @retval EFI_BUFFER_TOO_SMALL   IdentifyDataSize not big enough\r
 \r
 **/\r
 EFI_STATUS\r
@@ -822,8 +854,8 @@ AtaDiskInfoIdentify (
 \r
 /**\r
   Provides sense data information for the controller type.\r
-  \r
-  This function is used by the IDE bus driver to get sense data. \r
+\r
+  This function is used by the IDE bus driver to get sense data.\r
   Data format of Sense data is defined by the Interface GUID.\r
 \r
   @param[in]      This             Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
@@ -850,7 +882,7 @@ AtaDiskInfoSenseData (
 /**\r
   This function is used by the IDE bus driver to get controller information.\r
 \r
-  @param[in]  This         Pointer to the EFI_DISK_INFO_PROTOCOL instance. \r
+  @param[in]  This         Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
   @param[out] IdeChannel   Pointer to the Ide Channel number.  Primary or secondary.\r
   @param[out] IdeDevice    Pointer to the Ide Device number.  Master or slave.\r
 \r
@@ -904,20 +936,20 @@ AtaDiskInfoWhichIde (
   return EFI_SUCCESS. If the security protocol command completes with an error, the\r
   function shall return EFI_DEVICE_ERROR.\r
 \r
-  @param  This                              Indicates a pointer to the calling context.\r
-  @param  MediaId                           ID of the medium to receive data from.\r
-  @param  Timeout                                 The timeout, in 100ns units, to use for the execution\r
+  @param  This                         Indicates a pointer to the calling context.\r
+  @param  MediaId                      ID of the medium to receive data from.\r
+  @param  Timeout                      The timeout, in 100ns units, to use for the execution\r
                                        of the security protocol command. A Timeout value of 0\r
                                        means that this function will wait indefinitely for the\r
                                        security protocol command to execute. If Timeout is greater\r
                                        than zero, then this function will return EFI_TIMEOUT\r
-                                                              if the time required to execute the receive data command\r
-                                                              is greater than Timeout.\r
+                                       if the time required to execute the receive data command\r
+                                       is greater than Timeout.\r
   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of\r
                                        the security protocol command to be sent.\r
   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
                                        of the security protocol command to be sent.\r
-  @param  PayloadBufferSize                     Size in bytes of the payload data buffer.\r
+  @param  PayloadBufferSize            Size in bytes of the payload data buffer.\r
   @param  PayloadBuffer                A pointer to a destination buffer to store the security\r
                                        protocol command specific payload data for the security\r
                                        protocol command. The caller is responsible for having\r
@@ -984,20 +1016,20 @@ AtaStorageSecurityReceiveData (
   EFI_SUCCESS. If the security protocol command completes with an error, the function\r
   shall return EFI_DEVICE_ERROR.\r
 \r
-  @param  This                              Indicates a pointer to the calling context.\r
-  @param  MediaId                           ID of the medium to receive data from.\r
-  @param  Timeout                                 The timeout, in 100ns units, to use for the execution\r
+  @param  This                         Indicates a pointer to the calling context.\r
+  @param  MediaId                      ID of the medium to receive data from.\r
+  @param  Timeout                      The timeout, in 100ns units, to use for the execution\r
                                        of the security protocol command. A Timeout value of 0\r
                                        means that this function will wait indefinitely for the\r
                                        security protocol command to execute. If Timeout is greater\r
                                        than zero, then this function will return EFI_TIMEOUT\r
-                                                              if the time required to execute the receive data command\r
-                                                              is greater than Timeout.\r
+                                       if the time required to execute the receive data command\r
+                                       is greater than Timeout.\r
   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of\r
                                        the security protocol command to be sent.\r
   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
                                        of the security protocol command to be sent.\r
-  @param  PayloadBufferSize                     Size in bytes of the payload data buffer.\r
+  @param  PayloadBufferSize            Size in bytes of the payload data buffer.\r
   @param  PayloadBuffer                A pointer to a destination buffer to store the security\r
                                        protocol command specific payload data for the security\r
                                        protocol command.\r
@@ -1024,4 +1056,20 @@ AtaStorageSecuritySendData (
   IN VOID                                     *PayloadBuffer\r
   );\r
 \r
+/**\r
+  Send TPer Reset command to reset eDrive to lock all protected bands.\r
+  Typically, there are 2 mechanism for resetting eDrive. They are:\r
+  1. TPer Reset through IEEE 1667 protocol.\r
+  2. TPer Reset through native TCG protocol.\r
+  This routine will detect what protocol the attached eDrive conform to, TCG or\r
+  IEEE 1667 protocol. Then send out TPer Reset command separately.\r
+\r
+  @param[in] AtaDevice    ATA_DEVICE pointer.\r
+\r
+**/\r
+VOID\r
+InitiateTPerReset (\r
+  IN   ATA_DEVICE       *AtaDevice\r
+  );\r
+\r
 #endif\r