Home | History | Annotate | Download | only in AtaBusDxe
      1 /** @file
      2   Master header file for ATA Bus Driver.
      3 
      4   This file defines common data structures, macro definitions and some module
      5   internal function header files.
      6 
      7   Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
      8   This program and the accompanying materials
      9   are licensed and made available under the terms and conditions of the BSD License
     10   which accompanies this distribution.  The full text of the license may be found at
     11   http://opensource.org/licenses/bsd-license.php
     12 
     13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15 
     16 **/
     17 
     18 #ifndef _ATA_BUS_H_
     19 #define _ATA_BUS_H_
     20 
     21 #include <Uefi.h>
     22 
     23 #include <Protocol/AtaPassThru.h>
     24 #include <Protocol/BlockIo.h>
     25 #include <Protocol/BlockIo2.h>
     26 #include <Protocol/DiskInfo.h>
     27 #include <Protocol/DevicePath.h>
     28 #include <Protocol/StorageSecurityCommand.h>
     29 
     30 #include <Library/DebugLib.h>
     31 #include <Library/UefiDriverEntryPoint.h>
     32 #include <Library/BaseLib.h>
     33 #include <Library/UefiLib.h>
     34 #include <Library/BaseMemoryLib.h>
     35 #include <Library/MemoryAllocationLib.h>
     36 #include <Library/UefiBootServicesTableLib.h>
     37 #include <Library/DevicePathLib.h>
     38 #include <Library/UefiRuntimeServicesTableLib.h>
     39 #include <Library/TimerLib.h>
     40 #include <Library/ReportStatusCodeLib.h>
     41 
     42 #include <IndustryStandard/Atapi.h>
     43 
     44 //
     45 // Time out value for ATA pass through protocol
     46 //
     47 #define ATA_TIMEOUT                       EFI_TIMER_PERIOD_SECONDS (3)
     48 
     49 //
     50 // Maximum number of times to retry ATA command
     51 //
     52 #define MAX_RETRY_TIMES                   3
     53 
     54 //
     55 // The maximum total sectors count in 28 bit addressing mode
     56 //
     57 #define MAX_28BIT_ADDRESSING_CAPACITY     0xfffffff
     58 
     59 //
     60 // The maximum ATA transaction sector count in 28 bit addressing mode.
     61 //
     62 #define MAX_28BIT_TRANSFER_BLOCK_NUM      0x100
     63 
     64 //
     65 // The maximum ATA transaction sector count in 48 bit addressing mode.
     66 //
     67 //#define MAX_48BIT_TRANSFER_BLOCK_NUM      0x10000
     68 
     69 //
     70 // BugBug: if the TransferLength is equal with 0x10000 (the 48bit max length),
     71 // there is a bug that even the register interrupt bit has been sit, the buffer
     72 // seems not ready. Change the Maximum Sector Numbers to 0xFFFF to work round
     73 // this issue.
     74 //
     75 #define MAX_48BIT_TRANSFER_BLOCK_NUM      0xFFFF
     76 
     77 //
     78 // The maximum model name in ATA identify data
     79 //
     80 #define MAX_MODEL_NAME_LEN                40
     81 
     82 #define ATA_TASK_SIGNATURE                SIGNATURE_32 ('A', 'T', 'S', 'K')
     83 #define ATA_DEVICE_SIGNATURE              SIGNATURE_32 ('A', 'B', 'I', 'D')
     84 #define ATA_SUB_TASK_SIGNATURE            SIGNATURE_32 ('A', 'S', 'T', 'S')
     85 #define IS_ALIGNED(addr, size)            (((UINTN) (addr) & (size - 1)) == 0)
     86 
     87 //
     88 // ATA bus data structure for ATA controller
     89 //
     90 typedef struct {
     91   EFI_ATA_PASS_THRU_PROTOCOL  *AtaPassThru;
     92   EFI_HANDLE                  Controller;
     93   EFI_DEVICE_PATH_PROTOCOL    *ParentDevicePath;
     94   EFI_HANDLE                  DriverBindingHandle;
     95 } ATA_BUS_DRIVER_DATA;
     96 
     97 //
     98 // ATA device data structure for each child device
     99 //
    100 typedef struct {
    101   UINT32                                Signature;
    102 
    103   EFI_HANDLE                            Handle;
    104   EFI_BLOCK_IO_PROTOCOL                 BlockIo;
    105   EFI_BLOCK_IO2_PROTOCOL                BlockIo2;
    106   EFI_BLOCK_IO_MEDIA                    BlockMedia;
    107   EFI_DISK_INFO_PROTOCOL                DiskInfo;
    108   EFI_DEVICE_PATH_PROTOCOL              *DevicePath;
    109   EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;
    110 
    111   ATA_BUS_DRIVER_DATA                   *AtaBusDriverData;
    112   UINT16                                Port;
    113   UINT16                                PortMultiplierPort;
    114 
    115   //
    116   // Buffer for the execution of ATA pass through protocol
    117   //
    118   EFI_ATA_PASS_THRU_COMMAND_PACKET      Packet;
    119   EFI_ATA_COMMAND_BLOCK                 Acb;
    120   EFI_ATA_STATUS_BLOCK                  *Asb;
    121 
    122   BOOLEAN                               UdmaValid;
    123   BOOLEAN                               Lba48Bit;
    124 
    125   //
    126   // Cached data for ATA identify data
    127   //
    128   ATA_IDENTIFY_DATA                     *IdentifyData;
    129 
    130   EFI_UNICODE_STRING_TABLE              *ControllerNameTable;
    131   CHAR16                                ModelName[MAX_MODEL_NAME_LEN + 1];
    132 
    133   LIST_ENTRY                            AtaTaskList;
    134   LIST_ENTRY                            AtaSubTaskList;
    135   BOOLEAN                               Abort;
    136 } ATA_DEVICE;
    137 
    138 //
    139 // Sub-Task for the non blocking I/O
    140 //
    141 typedef struct {
    142   UINT32                            Signature;
    143   ATA_DEVICE                        *AtaDevice;
    144   EFI_BLOCK_IO2_TOKEN               *Token;
    145   UINTN                             *UnsignalledEventCount;
    146   EFI_ATA_PASS_THRU_COMMAND_PACKET  Packet;
    147   BOOLEAN                           *IsError;// Indicate whether meeting error during source allocation for new task.
    148   LIST_ENTRY                        TaskEntry;
    149 } ATA_BUS_ASYN_SUB_TASK;
    150 
    151 //
    152 // Task for the non blocking I/O
    153 //
    154 typedef struct {
    155   UINT32                            Signature;
    156   EFI_BLOCK_IO2_TOKEN               *Token;
    157   ATA_DEVICE                        *AtaDevice;
    158   UINT8                             *Buffer;
    159   EFI_LBA                           StartLba;
    160   UINTN                             NumberOfBlocks;
    161   BOOLEAN                           IsWrite;
    162   LIST_ENTRY                        TaskEntry;
    163 } ATA_BUS_ASYN_TASK;
    164 
    165 #define ATA_DEVICE_FROM_BLOCK_IO(a)         CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)
    166 #define ATA_DEVICE_FROM_BLOCK_IO2(a)        CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)
    167 #define ATA_DEVICE_FROM_DISK_INFO(a)        CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)
    168 #define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)
    169 #define ATA_ASYN_SUB_TASK_FROM_ENTRY(a)     CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)
    170 #define ATA_ASYN_TASK_FROM_ENTRY(a)         CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)
    171 
    172 //
    173 // Global Variables
    174 //
    175 extern EFI_DRIVER_BINDING_PROTOCOL        gAtaBusDriverBinding;
    176 extern EFI_COMPONENT_NAME_PROTOCOL        gAtaBusComponentName;
    177 extern EFI_COMPONENT_NAME2_PROTOCOL       gAtaBusComponentName2;
    178 
    179 /**
    180   Allocates an aligned buffer for ATA device.
    181 
    182   This function allocates an aligned buffer for the ATA device to perform
    183   ATA pass through operations. The alignment requirement is from ATA pass
    184   through interface.
    185 
    186   @param  AtaDevice         The ATA child device involved for the operation.
    187   @param  BufferSize        The request buffer size.
    188 
    189   @return A pointer to the aligned buffer or NULL if the allocation fails.
    190 
    191 **/
    192 VOID *
    193 AllocateAlignedBuffer (
    194   IN ATA_DEVICE               *AtaDevice,
    195   IN UINTN                    BufferSize
    196   );
    197 
    198 /**
    199   Frees an aligned buffer for ATA device.
    200 
    201   This function frees an aligned buffer for the ATA device to perform
    202   ATA pass through operations.
    203 
    204   @param  Buffer            The aligned buffer to be freed.
    205   @param  BufferSize        The request buffer size.
    206 
    207 **/
    208 VOID
    209 FreeAlignedBuffer (
    210   IN VOID                     *Buffer,
    211   IN UINTN                    BufferSize
    212   );
    213 
    214 /**
    215   Free SubTask.
    216 
    217   @param[in, out]  Task      Pointer to task to be freed.
    218 
    219 **/
    220 VOID
    221 EFIAPI
    222 FreeAtaSubTask (
    223   IN OUT ATA_BUS_ASYN_SUB_TASK  *Task
    224   );
    225 
    226 /**
    227   Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
    228 
    229   This function wraps the ResetDevice() invocation for ATA pass through function
    230   for an ATA device.
    231 
    232   @param  AtaDevice         The ATA child device involved for the operation.
    233 
    234   @return The return status from EFI_ATA_PASS_THRU_PROTOCOL.PassThru().
    235 
    236 **/
    237 EFI_STATUS
    238 ResetAtaDevice (
    239   IN ATA_DEVICE                           *AtaDevice
    240   );
    241 
    242 
    243 /**
    244   Discovers whether it is a valid ATA device.
    245 
    246   This function issues ATA_CMD_IDENTIFY_DRIVE command to the ATA device to identify it.
    247   If the command is executed successfully, it then identifies it and initializes
    248   the Media information in Block IO protocol interface.
    249 
    250   @param  AtaDevice         The ATA child device involved for the operation.
    251 
    252   @retval EFI_SUCCESS       The device is successfully identified and Media information
    253                             is correctly initialized.
    254   @return others            Some error occurs when discovering the ATA device.
    255 
    256 **/
    257 EFI_STATUS
    258 DiscoverAtaDevice (
    259   IN OUT ATA_DEVICE                 *AtaDevice
    260   );
    261 
    262 /**
    263   Read or write a number of blocks from ATA device.
    264 
    265   This function performs ATA pass through transactions to read/write data from/to
    266   ATA device. It may separate the read/write request into several ATA pass through
    267   transactions.
    268 
    269   @param[in, out]  AtaDevice       The ATA child device involved for the operation.
    270   @param[in, out]  Buffer          The pointer to the current transaction buffer.
    271   @param[in]       StartLba        The starting logical block address to be accessed.
    272   @param[in]       NumberOfBlocks  The block number or sector count of the transfer.
    273   @param[in]       IsWrite         Indicates whether it is a write operation.
    274   @param[in, out]  Token           A pointer to the token associated with the transaction.
    275 
    276   @retval EFI_SUCCESS       The data transfer is complete successfully.
    277   @return others            Some error occurs when transferring data.
    278 
    279 **/
    280 EFI_STATUS
    281 AccessAtaDevice(
    282   IN OUT ATA_DEVICE                 *AtaDevice,
    283   IN OUT UINT8                      *Buffer,
    284   IN EFI_LBA                        StartLba,
    285   IN UINTN                          NumberOfBlocks,
    286   IN BOOLEAN                        IsWrite,
    287   IN OUT EFI_BLOCK_IO2_TOKEN        *Token
    288   );
    289 
    290 /**
    291   Trust transfer data from/to ATA device.
    292 
    293   This function performs one ATA pass through transaction to do a trust transfer from/to
    294   ATA device. It chooses the appropriate ATA command and protocol to invoke PassThru
    295   interface of ATA pass through.
    296 
    297   @param  AtaDevice                    The ATA child device involved for the operation.
    298   @param  Buffer                       The pointer to the current transaction buffer.
    299   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of
    300                                        the security protocol command to be sent.
    301   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
    302                                        of the security protocol command to be sent.
    303   @param  TransferLength               The block number or sector count of the transfer.
    304   @param  IsTrustSend                  Indicates whether it is a trust send operation or not.
    305   @param  Timeout                      The timeout, in 100ns units, to use for the execution
    306                                        of the security protocol command. A Timeout value of 0
    307                                        means that this function will wait indefinitely for the
    308                                        security protocol command to execute. If Timeout is greater
    309                                        than zero, then this function will return EFI_TIMEOUT
    310                                        if the time required to execute the receive data command
    311                                        is greater than Timeout.
    312   @param  TransferLengthOut            A pointer to a buffer to store the size in bytes of the data
    313                                        written to the buffer. Ignore it when IsTrustSend is TRUE.
    314 
    315   @retval EFI_SUCCESS       The data transfer is complete successfully.
    316   @return others            Some error occurs when transferring data.
    317 
    318 **/
    319 EFI_STATUS
    320 EFIAPI
    321 TrustTransferAtaDevice (
    322   IN OUT ATA_DEVICE                 *AtaDevice,
    323   IN OUT VOID                       *Buffer,
    324   IN UINT8                          SecurityProtocolId,
    325   IN UINT16                         SecurityProtocolSpecificData,
    326   IN UINTN                          TransferLength,
    327   IN BOOLEAN                        IsTrustSend,
    328   IN UINT64                         Timeout,
    329   OUT UINTN                         *TransferLengthOut
    330   );
    331 
    332 //
    333 // Protocol interface prototypes
    334 //
    335 /**
    336   Tests to see if this driver supports a given controller. If a child device is provided,
    337   it further tests to see if this driver supports creating a handle for the specified child device.
    338 
    339   This function checks to see if the driver specified by This supports the device specified by
    340   ControllerHandle. Drivers will typically use the device path attached to
    341   ControllerHandle and/or the services from the bus I/O abstraction attached to
    342   ControllerHandle to determine if the driver supports ControllerHandle. This function
    343   may be called many times during platform initialization. In order to reduce boot times, the tests
    344   performed by this function must be very small, and take as little time as possible to execute. This
    345   function must not change the state of any hardware devices, and this function must be aware that the
    346   device specified by ControllerHandle may already be managed by the same driver or a
    347   different driver. This function must match its calls to AllocatePages() with FreePages(),
    348   AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
    349   Since ControllerHandle may have been previously started by the same driver, if a protocol is
    350   already in the opened state, then it must not be closed with CloseProtocol(). This is required
    351   to guarantee the state of ControllerHandle is not modified by this function.
    352 
    353   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
    354   @param[in]  ControllerHandle     The handle of the controller to test. This handle
    355                                    must support a protocol interface that supplies
    356                                    an I/O abstraction to the driver.
    357   @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
    358                                    parameter is ignored by device drivers, and is optional for bus
    359                                    drivers. For bus drivers, if this parameter is not NULL, then
    360                                    the bus driver must determine if the bus controller specified
    361                                    by ControllerHandle and the child controller specified
    362                                    by RemainingDevicePath are both supported by this
    363                                    bus driver.
    364 
    365   @retval EFI_SUCCESS              The device specified by ControllerHandle and
    366                                    RemainingDevicePath is supported by the driver specified by This.
    367   @retval EFI_ALREADY_STARTED      The device specified by ControllerHandle and
    368                                    RemainingDevicePath is already being managed by the driver
    369                                    specified by This.
    370   @retval EFI_ACCESS_DENIED        The device specified by ControllerHandle and
    371                                    RemainingDevicePath is already being managed by a different
    372                                    driver or an application that requires exclusive access.
    373                                    Currently not implemented.
    374   @retval EFI_UNSUPPORTED          The device specified by ControllerHandle and
    375                                    RemainingDevicePath is not supported by the driver specified by This.
    376 **/
    377 EFI_STATUS
    378 EFIAPI
    379 AtaBusDriverBindingSupported (
    380   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
    381   IN EFI_HANDLE                   Controller,
    382   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
    383   );
    384 
    385 /**
    386   Starts a device controller or a bus controller.
    387 
    388   The Start() function is designed to be invoked from the EFI boot service ConnectController().
    389   As a result, much of the error checking on the parameters to Start() has been moved into this
    390   common boot service. It is legal to call Start() from other locations,
    391   but the following calling restrictions must be followed or the system behavior will not be deterministic.
    392   1. ControllerHandle must be a valid EFI_HANDLE.
    393   2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
    394      EFI_DEVICE_PATH_PROTOCOL.
    395   3. Prior to calling Start(), the Supported() function for the driver specified by This must
    396      have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
    397 
    398   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
    399   @param[in]  ControllerHandle     The handle of the controller to start. This handle
    400                                    must support a protocol interface that supplies
    401                                    an I/O abstraction to the driver.
    402   @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
    403                                    parameter is ignored by device drivers, and is optional for bus
    404                                    drivers. For a bus driver, if this parameter is NULL, then handles
    405                                    for all the children of Controller are created by this driver.
    406                                    If this parameter is not NULL and the first Device Path Node is
    407                                    not the End of Device Path Node, then only the handle for the
    408                                    child device specified by the first Device Path Node of
    409                                    RemainingDevicePath is created by this driver.
    410                                    If the first Device Path Node of RemainingDevicePath is
    411                                    the End of Device Path Node, no child handle is created by this
    412                                    driver.
    413 
    414   @retval EFI_SUCCESS              The device was started.
    415   @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.Currently not implemented.
    416   @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.
    417   @retval Others                   The driver failded to start the device.
    418 
    419 **/
    420 EFI_STATUS
    421 EFIAPI
    422 AtaBusDriverBindingStart (
    423   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
    424   IN EFI_HANDLE                   Controller,
    425   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
    426   );
    427 
    428 /**
    429   Stops a device controller or a bus controller.
    430 
    431   The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
    432   As a result, much of the error checking on the parameters to Stop() has been moved
    433   into this common boot service. It is legal to call Stop() from other locations,
    434   but the following calling restrictions must be followed or the system behavior will not be deterministic.
    435   1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
    436      same driver's Start() function.
    437   2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
    438      EFI_HANDLE. In addition, all of these handles must have been created in this driver's
    439      Start() function, and the Start() function must have called OpenProtocol() on
    440      ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
    441 
    442   @param[in]  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
    443   @param[in]  ControllerHandle  A handle to the device being stopped. The handle must
    444                                 support a bus specific I/O protocol for the driver
    445                                 to use to stop the device.
    446   @param[in]  NumberOfChildren  The number of child device handles in ChildHandleBuffer.
    447   @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL
    448                                 if NumberOfChildren is 0.
    449 
    450   @retval EFI_SUCCESS           The device was stopped.
    451   @retval EFI_DEVICE_ERROR      The device could not be stopped due to a device error.
    452 
    453 **/
    454 EFI_STATUS
    455 EFIAPI
    456 AtaBusDriverBindingStop (
    457   IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
    458   IN  EFI_HANDLE                      Controller,
    459   IN  UINTN                           NumberOfChildren,
    460   IN  EFI_HANDLE                      *ChildHandleBuffer
    461   );
    462 
    463 
    464 /**
    465   Retrieves a Unicode string that is the user readable name of the driver.
    466 
    467   This function retrieves the user readable name of a driver in the form of a
    468   Unicode string. If the driver specified by This has a user readable name in
    469   the language specified by Language, then a pointer to the driver name is
    470   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
    471   by This does not support the language specified by Language,
    472   then EFI_UNSUPPORTED is returned.
    473 
    474   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
    475                                 EFI_COMPONENT_NAME_PROTOCOL instance.
    476 
    477   @param  Language[in]          A pointer to a Null-terminated ASCII string
    478                                 array indicating the language. This is the
    479                                 language of the driver name that the caller is
    480                                 requesting, and it must match one of the
    481                                 languages specified in SupportedLanguages. The
    482                                 number of languages supported by a driver is up
    483                                 to the driver writer. Language is specified
    484                                 in RFC 4646 or ISO 639-2 language code format.
    485 
    486   @param  DriverName[out]       A pointer to the Unicode string to return.
    487                                 This Unicode string is the name of the
    488                                 driver specified by This in the language
    489                                 specified by Language.
    490 
    491   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
    492                                 This and the language specified by Language was
    493                                 returned in DriverName.
    494 
    495   @retval EFI_INVALID_PARAMETER Language is NULL.
    496 
    497   @retval EFI_INVALID_PARAMETER DriverName is NULL.
    498 
    499   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    500                                 the language specified by Language.
    501 
    502 **/
    503 EFI_STATUS
    504 EFIAPI
    505 AtaBusComponentNameGetDriverName (
    506   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
    507   IN  CHAR8                        *Language,
    508   OUT CHAR16                       **DriverName
    509   );
    510 
    511 
    512 /**
    513   Retrieves a Unicode string that is the user readable name of the controller
    514   that is being managed by a driver.
    515 
    516   This function retrieves the user readable name of the controller specified by
    517   ControllerHandle and ChildHandle in the form of a Unicode string. If the
    518   driver specified by This has a user readable name in the language specified by
    519   Language, then a pointer to the controller name is returned in ControllerName,
    520   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
    521   managing the controller specified by ControllerHandle and ChildHandle,
    522   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
    523   support the language specified by Language, then EFI_UNSUPPORTED is returned.
    524 
    525   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
    526                                 EFI_COMPONENT_NAME_PROTOCOL instance.
    527 
    528   @param  ControllerHandle[in]  The handle of a controller that the driver
    529                                 specified by This is managing.  This handle
    530                                 specifies the controller whose name is to be
    531                                 returned.
    532 
    533   @param  ChildHandle[in]       The handle of the child controller to retrieve
    534                                 the name of.  This is an optional parameter that
    535                                 may be NULL.  It will be NULL for device
    536                                 drivers.  It will also be NULL for a bus drivers
    537                                 that wish to retrieve the name of the bus
    538                                 controller.  It will not be NULL for a bus
    539                                 driver that wishes to retrieve the name of a
    540                                 child controller.
    541 
    542   @param  Language[in]          A pointer to a Null-terminated ASCII string
    543                                 array indicating the language.  This is the
    544                                 language of the driver name that the caller is
    545                                 requesting, and it must match one of the
    546                                 languages specified in SupportedLanguages. The
    547                                 number of languages supported by a driver is up
    548                                 to the driver writer. Language is specified in
    549                                 RFC 4646 or ISO 639-2 language code format.
    550 
    551   @param  ControllerName[out]   A pointer to the Unicode string to return.
    552                                 This Unicode string is the name of the
    553                                 controller specified by ControllerHandle and
    554                                 ChildHandle in the language specified by
    555                                 Language from the point of view of the driver
    556                                 specified by This.
    557 
    558   @retval EFI_SUCCESS           The Unicode string for the user readable name in
    559                                 the language specified by Language for the
    560                                 driver specified by This was returned in
    561                                 DriverName.
    562 
    563   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
    564 
    565   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
    566                                 EFI_HANDLE.
    567 
    568   @retval EFI_INVALID_PARAMETER Language is NULL.
    569 
    570   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
    571 
    572   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
    573                                 managing the controller specified by
    574                                 ControllerHandle and ChildHandle.
    575 
    576   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    577                                 the language specified by Language.
    578 
    579 **/
    580 EFI_STATUS
    581 EFIAPI
    582 AtaBusComponentNameGetControllerName (
    583   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
    584   IN  EFI_HANDLE                                      ControllerHandle,
    585   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
    586   IN  CHAR8                                           *Language,
    587   OUT CHAR16                                          **ControllerName
    588   );
    589 
    590 
    591 /**
    592   Reset the Block Device.
    593 
    594   @param  This                 Indicates a pointer to the calling context.
    595   @param  ExtendedVerification Driver may perform diagnostics on reset.
    596 
    597   @retval EFI_SUCCESS          The device was reset.
    598   @retval EFI_DEVICE_ERROR     The device is not functioning properly and could
    599                                not be reset.
    600 
    601 **/
    602 EFI_STATUS
    603 EFIAPI
    604 AtaBlockIoReset (
    605   IN  EFI_BLOCK_IO_PROTOCOL   *This,
    606   IN  BOOLEAN                 ExtendedVerification
    607   );
    608 
    609 
    610 /**
    611   Read BufferSize bytes from Lba into Buffer.
    612 
    613   @param  This       Indicates a pointer to the calling context.
    614   @param  MediaId    Id of the media, changes every time the media is replaced.
    615   @param  Lba        The starting Logical Block Address to read from
    616   @param  BufferSize Size of Buffer, must be a multiple of device block size.
    617   @param  Buffer     A pointer to the destination buffer for the data. The caller is
    618                      responsible for either having implicit or explicit ownership of the buffer.
    619 
    620   @retval EFI_SUCCESS           The data was read correctly from the device.
    621   @retval EFI_DEVICE_ERROR      The device reported an error while performing the read.
    622   @retval EFI_NO_MEDIA          There is no media in the device.
    623   @retval EFI_MEDIA_CHANGED     The MediaId does not matched the current device.
    624   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.
    625   @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
    626                                 or the buffer is not on proper alignment.
    627 
    628 **/
    629 EFI_STATUS
    630 EFIAPI
    631 AtaBlockIoReadBlocks (
    632   IN  EFI_BLOCK_IO_PROTOCOL   *This,
    633   IN  UINT32                  MediaId,
    634   IN  EFI_LBA                 Lba,
    635   IN  UINTN                   BufferSize,
    636   OUT VOID                    *Buffer
    637   );
    638 
    639 
    640 /**
    641   Write BufferSize bytes from Lba into Buffer.
    642 
    643   @param  This       Indicates a pointer to the calling context.
    644   @param  MediaId    The media ID that the write request is for.
    645   @param  Lba        The starting logical block address to be written. The caller is
    646                      responsible for writing to only legitimate locations.
    647   @param  BufferSize Size of Buffer, must be a multiple of device block size.
    648   @param  Buffer     A pointer to the source buffer for the data.
    649 
    650   @retval EFI_SUCCESS           The data was written correctly to the device.
    651   @retval EFI_WRITE_PROTECTED   The device can not be written to.
    652   @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.
    653   @retval EFI_NO_MEDIA          There is no media in the device.
    654   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.
    655   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.
    656   @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
    657                                 or the buffer is not on proper alignment.
    658 
    659 **/
    660 EFI_STATUS
    661 EFIAPI
    662 AtaBlockIoWriteBlocks (
    663   IN  EFI_BLOCK_IO_PROTOCOL   *This,
    664   IN  UINT32                  MediaId,
    665   IN  EFI_LBA                 Lba,
    666   IN  UINTN                   BufferSize,
    667   IN  VOID                    *Buffer
    668   );
    669 
    670 
    671 /**
    672   Flush the Block Device.
    673 
    674   @param  This              Indicates a pointer to the calling context.
    675 
    676   @retval EFI_SUCCESS       All outstanding data was written to the device
    677   @retval EFI_DEVICE_ERROR  The device reported an error while writing back the data
    678   @retval EFI_NO_MEDIA      There is no media in the device.
    679 
    680 **/
    681 EFI_STATUS
    682 EFIAPI
    683 AtaBlockIoFlushBlocks (
    684   IN  EFI_BLOCK_IO_PROTOCOL   *This
    685   );
    686 
    687 /**
    688   Reset the Block Device throught Block I/O2 protocol.
    689 
    690   @param[in]  This                 Indicates a pointer to the calling context.
    691   @param[in]  ExtendedVerification Driver may perform diagnostics on reset.
    692 
    693   @retval EFI_SUCCESS          The device was reset.
    694   @retval EFI_DEVICE_ERROR     The device is not functioning properly and could
    695                                not be reset.
    696 
    697 **/
    698 EFI_STATUS
    699 EFIAPI
    700 AtaBlockIoResetEx (
    701   IN  EFI_BLOCK_IO2_PROTOCOL  *This,
    702   IN  BOOLEAN                 ExtendedVerification
    703   );
    704 
    705 /**
    706   Read BufferSize bytes from Lba into Buffer.
    707 
    708   @param[in]       This       Indicates a pointer to the calling context.
    709   @param[in]       MediaId    Id of the media, changes every time the media is replaced.
    710   @param[in]       Lba        The starting Logical Block Address to read from.
    711   @param[in, out]  Token      A pointer to the token associated with the transaction.
    712   @param[in]       BufferSize Size of Buffer, must be a multiple of device block size.
    713   @param[out]      Buffer     A pointer to the destination buffer for the data. The caller is
    714                               responsible for either having implicit or explicit ownership of the buffer.
    715 
    716   @retval EFI_SUCCESS           The read request was queued if Event is not NULL.
    717                                 The data was read correctly from the device if
    718                                 the Event is NULL.
    719   @retval EFI_DEVICE_ERROR      The device reported an error while performing
    720                                 the read.
    721   @retval EFI_NO_MEDIA          There is no media in the device.
    722   @retval EFI_MEDIA_CHANGED     The MediaId is not for the current media.
    723   @retval EFI_BAD_BUFFER_SIZE   The BufferSize parameter is not a multiple of the
    724                                 intrinsic block size of the device.
    725   @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
    726                                 or the buffer is not on proper alignment.
    727   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack
    728                                 of resources.
    729 
    730 **/
    731 EFI_STATUS
    732 EFIAPI
    733 AtaBlockIoReadBlocksEx (
    734   IN  EFI_BLOCK_IO2_PROTOCOL  *This,
    735   IN  UINT32                  MediaId,
    736   IN  EFI_LBA                 Lba,
    737   IN OUT EFI_BLOCK_IO2_TOKEN  *Token,
    738   IN  UINTN                   BufferSize,
    739   OUT VOID                    *Buffer
    740   );
    741 
    742 /**
    743   Write BufferSize bytes from Lba into Buffer.
    744 
    745   @param[in]       This       Indicates a pointer to the calling context.
    746   @param[in]       MediaId    The media ID that the write request is for.
    747   @param[in]       Lba        The starting logical block address to be written. The
    748                               caller is responsible for writing to only legitimate
    749                               locations.
    750   @param[in, out]  Token      A pointer to the token associated with the transaction.
    751   @param[in]       BufferSize Size of Buffer, must be a multiple of device block size.
    752   @param[in]       Buffer     A pointer to the source buffer for the data.
    753 
    754   @retval EFI_SUCCESS           The data was written correctly to the device.
    755   @retval EFI_WRITE_PROTECTED   The device can not be written to.
    756   @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.
    757   @retval EFI_NO_MEDIA          There is no media in the device.
    758   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.
    759   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.
    760   @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
    761                                 or the buffer is not on proper alignment.
    762 
    763 **/
    764 EFI_STATUS
    765 EFIAPI
    766 AtaBlockIoWriteBlocksEx (
    767   IN  EFI_BLOCK_IO2_PROTOCOL  *This,
    768   IN  UINT32                  MediaId,
    769   IN  EFI_LBA                 Lba,
    770   IN OUT EFI_BLOCK_IO2_TOKEN  *Token,
    771   IN  UINTN                   BufferSize,
    772   IN  VOID                    *Buffer
    773   );
    774 
    775 /**
    776   Flush the Block Device.
    777 
    778   @param[in]       This       Indicates a pointer to the calling context.
    779   @param[in, out]  Token      A pointer to the token associated with the transaction.
    780 
    781   @retval EFI_SUCCESS       All outstanding data was written to the device
    782   @retval EFI_DEVICE_ERROR  The device reported an error while writing back the data
    783   @retval EFI_NO_MEDIA      There is no media in the device.
    784 
    785 **/
    786 EFI_STATUS
    787 EFIAPI
    788 AtaBlockIoFlushBlocksEx (
    789   IN  EFI_BLOCK_IO2_PROTOCOL  *This,
    790   IN OUT EFI_BLOCK_IO2_TOKEN  *Token
    791   );
    792 
    793 /**
    794   Terminate any in-flight non-blocking I/O requests by signaling an EFI_ABORTED
    795   in the TransactionStatus member of the EFI_BLOCK_IO2_TOKEN for the non-blocking
    796   I/O. After that it is safe to free any Token or Buffer data structures that
    797   were allocated to initiate the non-blockingI/O requests that were in-flight for
    798   this device.
    799 
    800   @param[in]  AtaDevice     The ATA child device involved for the operation.
    801 
    802 **/
    803 VOID
    804 EFIAPI
    805 AtaTerminateNonBlockingTask (
    806   IN ATA_DEVICE               *AtaDevice
    807   );
    808 
    809 /**
    810   Provides inquiry information for the controller type.
    811 
    812   This function is used by the IDE bus driver to get inquiry data.  Data format
    813   of Identify data is defined by the Interface GUID.
    814 
    815   @param[in]      This             Pointer to the EFI_DISK_INFO_PROTOCOL instance.
    816   @param[in, out] InquiryData      Pointer to a buffer for the inquiry data.
    817   @param[in, out] InquiryDataSize  Pointer to the value for the inquiry data size.
    818 
    819   @retval EFI_SUCCESS            The command was accepted without any errors.
    820   @retval EFI_NOT_FOUND          Device does not support this data class
    821   @retval EFI_DEVICE_ERROR       Error reading InquiryData from device
    822   @retval EFI_BUFFER_TOO_SMALL   InquiryDataSize not big enough
    823 
    824 **/
    825 EFI_STATUS
    826 EFIAPI
    827 AtaDiskInfoInquiry (
    828   IN     EFI_DISK_INFO_PROTOCOL   *This,
    829   IN OUT VOID                     *InquiryData,
    830   IN OUT UINT32                   *InquiryDataSize
    831   );
    832 
    833 
    834 /**
    835   Provides identify information for the controller type.
    836 
    837   This function is used by the IDE bus driver to get identify data.  Data format
    838   of Identify data is defined by the Interface GUID.
    839 
    840   @param[in]      This              Pointer to the EFI_DISK_INFO_PROTOCOL
    841                                     instance.
    842   @param[in, out] IdentifyData      Pointer to a buffer for the identify data.
    843   @param[in, out] IdentifyDataSize  Pointer to the value for the identify data
    844                                     size.
    845 
    846   @retval EFI_SUCCESS            The command was accepted without any errors.
    847   @retval EFI_NOT_FOUND          Device does not support this data class
    848   @retval EFI_DEVICE_ERROR       Error reading IdentifyData from device
    849   @retval EFI_BUFFER_TOO_SMALL   IdentifyDataSize not big enough
    850 
    851 **/
    852 EFI_STATUS
    853 EFIAPI
    854 AtaDiskInfoIdentify (
    855   IN     EFI_DISK_INFO_PROTOCOL   *This,
    856   IN OUT VOID                     *IdentifyData,
    857   IN OUT UINT32                   *IdentifyDataSize
    858   );
    859 
    860 
    861 /**
    862   Provides sense data information for the controller type.
    863 
    864   This function is used by the IDE bus driver to get sense data.
    865   Data format of Sense data is defined by the Interface GUID.
    866 
    867   @param[in]      This             Pointer to the EFI_DISK_INFO_PROTOCOL instance.
    868   @param[in, out] SenseData        Pointer to the SenseData.
    869   @param[in, out] SenseDataSize    Size of SenseData in bytes.
    870   @param[out]     SenseDataNumber  Pointer to the value for the sense data size.
    871 
    872   @retval EFI_SUCCESS            The command was accepted without any errors.
    873   @retval EFI_NOT_FOUND          Device does not support this data class.
    874   @retval EFI_DEVICE_ERROR       Error reading SenseData from device.
    875   @retval EFI_BUFFER_TOO_SMALL   SenseDataSize not big enough.
    876 
    877 **/
    878 EFI_STATUS
    879 EFIAPI
    880 AtaDiskInfoSenseData (
    881   IN     EFI_DISK_INFO_PROTOCOL   *This,
    882   IN OUT VOID                     *SenseData,
    883   IN OUT UINT32                   *SenseDataSize,
    884   OUT    UINT8                    *SenseDataNumber
    885   );
    886 
    887 
    888 /**
    889   This function is used by the IDE bus driver to get controller information.
    890 
    891   @param[in]  This         Pointer to the EFI_DISK_INFO_PROTOCOL instance.
    892   @param[out] IdeChannel   Pointer to the Ide Channel number.  Primary or secondary.
    893   @param[out] IdeDevice    Pointer to the Ide Device number.  Master or slave.
    894 
    895   @retval EFI_SUCCESS       IdeChannel and IdeDevice are valid.
    896   @retval EFI_UNSUPPORTED   This is not an IDE device.
    897 
    898 **/
    899 EFI_STATUS
    900 EFIAPI
    901 AtaDiskInfoWhichIde (
    902   IN  EFI_DISK_INFO_PROTOCOL   *This,
    903   OUT UINT32                   *IdeChannel,
    904   OUT UINT32                   *IdeDevice
    905   );
    906 
    907 /**
    908   Send a security protocol command to a device that receives data and/or the result
    909   of one or more commands sent by SendData.
    910 
    911   The ReceiveData function sends a security protocol command to the given MediaId.
    912   The security protocol command sent is defined by SecurityProtocolId and contains
    913   the security protocol specific data SecurityProtocolSpecificData. The function
    914   returns the data from the security protocol command in PayloadBuffer.
    915 
    916   For devices supporting the SCSI command set, the security protocol command is sent
    917   using the SECURITY PROTOCOL IN command defined in SPC-4.
    918 
    919   For devices supporting the ATA command set, the security protocol command is sent
    920   using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize
    921   is non-zero.
    922 
    923   If the PayloadBufferSize is zero, the security protocol command is sent using the
    924   Trusted Non-Data command defined in ATA8-ACS.
    925 
    926   If PayloadBufferSize is too small to store the available data from the security
    927   protocol command, the function shall copy PayloadBufferSize bytes into the
    928   PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
    929 
    930   If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,
    931   the function shall return EFI_INVALID_PARAMETER.
    932 
    933   If the given MediaId does not support security protocol commands, the function shall
    934   return EFI_UNSUPPORTED. If there is no media in the device, the function returns
    935   EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,
    936   the function returns EFI_MEDIA_CHANGED.
    937 
    938   If the security protocol fails to complete within the Timeout period, the function
    939   shall return EFI_TIMEOUT.
    940 
    941   If the security protocol command completes without an error, the function shall
    942   return EFI_SUCCESS. If the security protocol command completes with an error, the
    943   function shall return EFI_DEVICE_ERROR.
    944 
    945   @param  This                         Indicates a pointer to the calling context.
    946   @param  MediaId                      ID of the medium to receive data from.
    947   @param  Timeout                      The timeout, in 100ns units, to use for the execution
    948                                        of the security protocol command. A Timeout value of 0
    949                                        means that this function will wait indefinitely for the
    950                                        security protocol command to execute. If Timeout is greater
    951                                        than zero, then this function will return EFI_TIMEOUT
    952                                        if the time required to execute the receive data command
    953                                        is greater than Timeout.
    954   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of
    955                                        the security protocol command to be sent.
    956   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
    957                                        of the security protocol command to be sent.
    958   @param  PayloadBufferSize            Size in bytes of the payload data buffer.
    959   @param  PayloadBuffer                A pointer to a destination buffer to store the security
    960                                        protocol command specific payload data for the security
    961                                        protocol command. The caller is responsible for having
    962                                        either implicit or explicit ownership of the buffer.
    963   @param  PayloadTransferSize          A pointer to a buffer to store the size in bytes of the
    964                                        data written to the payload data buffer.
    965 
    966   @retval EFI_SUCCESS                  The security protocol command completed successfully.
    967   @retval EFI_WARN_BUFFER_TOO_SMALL    The PayloadBufferSize was too small to store the available
    968                                        data from the device. The PayloadBuffer contains the truncated data.
    969   @retval EFI_UNSUPPORTED              The given MediaId does not support security protocol commands.
    970   @retval EFI_DEVICE_ERROR             The security protocol command completed with an error.
    971   @retval EFI_NO_MEDIA                 There is no media in the device.
    972   @retval EFI_MEDIA_CHANGED            The MediaId is not for the current media.
    973   @retval EFI_INVALID_PARAMETER        The PayloadBuffer or PayloadTransferSize is NULL and
    974                                        PayloadBufferSize is non-zero.
    975   @retval EFI_TIMEOUT                  A timeout occurred while waiting for the security
    976                                        protocol command to execute.
    977 
    978 **/
    979 EFI_STATUS
    980 EFIAPI
    981 AtaStorageSecurityReceiveData (
    982   IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL    *This,
    983   IN UINT32                                   MediaId,
    984   IN UINT64                                   Timeout,
    985   IN UINT8                                    SecurityProtocolId,
    986   IN UINT16                                   SecurityProtocolSpecificData,
    987   IN UINTN                                    PayloadBufferSize,
    988   OUT VOID                                    *PayloadBuffer,
    989   OUT UINTN                                   *PayloadTransferSize
    990   );
    991 
    992 /**
    993   Send a security protocol command to a device.
    994 
    995   The SendData function sends a security protocol command containing the payload
    996   PayloadBuffer to the given MediaId. The security protocol command sent is
    997   defined by SecurityProtocolId and contains the security protocol specific data
    998   SecurityProtocolSpecificData. If the underlying protocol command requires a
    999   specific padding for the command payload, the SendData function shall add padding
   1000   bytes to the command payload to satisfy the padding requirements.
   1001 
   1002   For devices supporting the SCSI command set, the security protocol command is sent
   1003   using the SECURITY PROTOCOL OUT command defined in SPC-4.
   1004 
   1005   For devices supporting the ATA command set, the security protocol command is sent
   1006   using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize
   1007   is non-zero. If the PayloadBufferSize is zero, the security protocol command is
   1008   sent using the Trusted Non-Data command defined in ATA8-ACS.
   1009 
   1010   If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall
   1011   return EFI_INVALID_PARAMETER.
   1012 
   1013   If the given MediaId does not support security protocol commands, the function
   1014   shall return EFI_UNSUPPORTED. If there is no media in the device, the function
   1015   returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the
   1016   device, the function returns EFI_MEDIA_CHANGED.
   1017 
   1018   If the security protocol fails to complete within the Timeout period, the function
   1019   shall return EFI_TIMEOUT.
   1020 
   1021   If the security protocol command completes without an error, the function shall return
   1022   EFI_SUCCESS. If the security protocol command completes with an error, the function
   1023   shall return EFI_DEVICE_ERROR.
   1024 
   1025   @param  This                         Indicates a pointer to the calling context.
   1026   @param  MediaId                      ID of the medium to receive data from.
   1027   @param  Timeout                      The timeout, in 100ns units, to use for the execution
   1028                                        of the security protocol command. A Timeout value of 0
   1029                                        means that this function will wait indefinitely for the
   1030                                        security protocol command to execute. If Timeout is greater
   1031                                        than zero, then this function will return EFI_TIMEOUT
   1032                                        if the time required to execute the receive data command
   1033                                        is greater than Timeout.
   1034   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of
   1035                                        the security protocol command to be sent.
   1036   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
   1037                                        of the security protocol command to be sent.
   1038   @param  PayloadBufferSize            Size in bytes of the payload data buffer.
   1039   @param  PayloadBuffer                A pointer to a destination buffer to store the security
   1040                                        protocol command specific payload data for the security
   1041                                        protocol command.
   1042 
   1043   @retval EFI_SUCCESS                  The security protocol command completed successfully.
   1044   @retval EFI_UNSUPPORTED              The given MediaId does not support security protocol commands.
   1045   @retval EFI_DEVICE_ERROR             The security protocol command completed with an error.
   1046   @retval EFI_NO_MEDIA                 There is no media in the device.
   1047   @retval EFI_MEDIA_CHANGED            The MediaId is not for the current media.
   1048   @retval EFI_INVALID_PARAMETER        The PayloadBuffer is NULL and PayloadBufferSize is non-zero.
   1049   @retval EFI_TIMEOUT                  A timeout occurred while waiting for the security
   1050                                        protocol command to execute.
   1051 
   1052 **/
   1053 EFI_STATUS
   1054 EFIAPI
   1055 AtaStorageSecuritySendData (
   1056   IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL    *This,
   1057   IN UINT32                                   MediaId,
   1058   IN UINT64                                   Timeout,
   1059   IN UINT8                                    SecurityProtocolId,
   1060   IN UINT16                                   SecurityProtocolSpecificData,
   1061   IN UINTN                                    PayloadBufferSize,
   1062   IN VOID                                     *PayloadBuffer
   1063   );
   1064 
   1065 /**
   1066   Send TPer Reset command to reset eDrive to lock all protected bands.
   1067   Typically, there are 2 mechanism for resetting eDrive. They are:
   1068   1. TPer Reset through IEEE 1667 protocol.
   1069   2. TPer Reset through native TCG protocol.
   1070   This routine will detect what protocol the attached eDrive comform to, TCG or
   1071   IEEE 1667 protocol. Then send out TPer Reset command separately.
   1072 
   1073   @param[in] AtaDevice    ATA_DEVICE pointer.
   1074 
   1075 **/
   1076 VOID
   1077 InitiateTPerReset (
   1078   IN   ATA_DEVICE       *AtaDevice
   1079   );
   1080 
   1081 #endif
   1082