TianoCore EDK2 master
|
#include "AtaBus.h"
Go to the source code of this file.
Macros | |
#define | ATA_CMD_TRUST_NON_DATA 0x5B |
#define | ATA_CMD_TRUST_RECEIVE 0x5C |
#define | ATA_CMD_TRUST_RECEIVE_DMA 0x5D |
#define | ATA_CMD_TRUST_SEND 0x5E |
#define | ATA_CMD_TRUST_SEND_DMA 0x5F |
Variables | |
EFI_ATA_PASS_THRU_CMD_PROTOCOL | mAtaPassThruCmdProtocols [][2] |
UINT8 | mAtaCommands [][2][2] |
UINT8 | mAtaTrustCommands [2][2] |
UINTN | mMaxTransferBlockNumber [] |
This file implements ATA pass through transaction for ATA bus driver.
This file implements the low level execution of ATA pass through transaction. It transforms the high level identity, read/write, reset command to ATA pass through command and protocol.
NOTE: This file also implements the StorageSecurityCommandProtocol(SSP). For input parameter SecurityProtocolSpecificData, ATA spec has no explicitly definition for Security Protocol Specific layout. This implementation uses big endian for Cylinder register.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file AtaPassThruExecute.c.
#define ATA_CMD_TRUST_NON_DATA 0x5B |
Definition at line 22 of file AtaPassThruExecute.c.
#define ATA_CMD_TRUST_RECEIVE 0x5C |
Definition at line 23 of file AtaPassThruExecute.c.
#define ATA_CMD_TRUST_RECEIVE_DMA 0x5D |
Definition at line 24 of file AtaPassThruExecute.c.
#define ATA_CMD_TRUST_SEND 0x5E |
Definition at line 25 of file AtaPassThruExecute.c.
#define ATA_CMD_TRUST_SEND_DMA 0x5F |
Definition at line 26 of file AtaPassThruExecute.c.
EFI_STATUS AccessAtaDevice | ( | IN OUT ATA_DEVICE * | AtaDevice, |
IN OUT UINT8 * | Buffer, | ||
IN EFI_LBA | StartLba, | ||
IN UINTN | NumberOfBlocks, | ||
IN BOOLEAN | IsWrite, | ||
IN OUT EFI_BLOCK_IO2_TOKEN * | Token | ||
) |
Read or write a number of blocks from ATA device.
This function performs ATA pass through transactions to read/write data from/to ATA device. It may separate the read/write request into several ATA pass through transactions.
[in,out] | AtaDevice | The ATA child device involved for the operation. |
[in,out] | Buffer | The pointer to the current transaction buffer. |
[in] | StartLba | The starting logical block address to be accessed. |
[in] | NumberOfBlocks | The block number or sector count of the transfer. |
[in] | IsWrite | Indicates whether it is a write operation. |
[in,out] | Token | A pointer to the token associated with the transaction. |
EFI_SUCCESS | The data transfer is complete successfully. |
Definition at line 765 of file AtaPassThruExecute.c.
EFI_STATUS AtaDevicePassThru | ( | IN OUT ATA_DEVICE * | AtaDevice, |
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *TaskPacket | OPTIONAL, | ||
IN OUT EFI_EVENT Event | OPTIONAL | ||
) |
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.PassThru().
This function wraps the PassThru() invocation for ATA pass through function for an ATA device. It assembles the ATA pass through command packet for ATA transaction.
[in,out] | AtaDevice | The ATA child device involved for the operation. |
[in,out] | TaskPacket | Pointer to a Pass Thru Command Packet. Optional, if it is NULL, blocking mode, and use the packet in AtaDevice. If it is not NULL, non blocking mode, and pass down this Packet. |
[in,out] | Event | If Event is NULL, then blocking I/O is performed. If 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 write request is completed. |
Definition at line 112 of file AtaPassThruExecute.c.
Call back function when the event is signaled.
[in] | Event | The Event this notify function registered to. |
[in] | Context | Pointer to the context data registered to the Event. |
Definition at line 645 of file AtaPassThruExecute.c.
VOID EFIAPI AtaTerminateNonBlockingTask | ( | IN ATA_DEVICE * | AtaDevice | ) |
Terminate any in-flight non-blocking I/O requests by signaling an EFI_ABORTED in the TransactionStatus member of the EFI_BLOCK_IO2_TOKEN for the non-blocking I/O. After that it is safe to free any Token or Buffer data structures that were allocated to initiate the non-blockingI/O requests that were in-flight for this device.
[in] | AtaDevice | The ATA child device involved for the operation. |
Definition at line 590 of file AtaPassThruExecute.c.
EFI_STATUS DiscoverAtaDevice | ( | IN OUT ATA_DEVICE * | AtaDevice | ) |
Discovers whether it is a valid ATA device.
This function issues ATA_CMD_IDENTIFY_DRIVE command to the ATA device to identify it. If the command is executed successfully, it then identifies it and initializes the Media information in Block IO protocol interface.
AtaDevice | The ATA child device involved for the operation. |
EFI_SUCCESS | The device is successfully identified and Media information is correctly initialized. |
Definition at line 394 of file AtaPassThruExecute.c.
VOID EFIAPI FreeAtaSubTask | ( | IN OUT ATA_BUS_ASYN_SUB_TASK * | Task | ) |
Free SubTask.
[in,out] | Task | Pointer to task to be freed. |
Definition at line 563 of file AtaPassThruExecute.c.
EFI_LBA GetAtapi6Capacity | ( | IN ATA_DEVICE * | AtaDevice | ) |
Gets ATA device Capacity according to ATA 6.
This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing.
AtaDevice | The ATA child device involved for the operation. |
Definition at line 242 of file AtaPassThruExecute.c.
EFI_STATUS IdentifyAtaDevice | ( | IN OUT ATA_DEVICE * | AtaDevice | ) |
Identifies ATA device via the Identify data.
This function identifies the ATA device and initializes the Media information in Block IO protocol interface.
AtaDevice | The ATA child device involved for the operation. |
EFI_UNSUPPORTED | The device is not a valid ATA device (hard disk). |
EFI_SUCCESS | The device is successfully identified and Media information is correctly initialized. |
Definition at line 288 of file AtaPassThruExecute.c.
VOID PrintAtaModelName | ( | IN OUT ATA_DEVICE * | AtaDevice | ) |
Prints ATA model name to ATA device structure.
This function converts ATA device model name from ATA identify data to a string in ATA device structure. It needs to change the character order in the original model name string.
AtaDevice | The ATA child device involved for the operation. |
Definition at line 207 of file AtaPassThruExecute.c.
EFI_STATUS ResetAtaDevice | ( | IN ATA_DEVICE * | AtaDevice | ) |
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
This function wraps the ResetDevice() invocation for ATA pass through function for an ATA device.
AtaDevice | The ATA child device involved for the operation. |
Definition at line 172 of file AtaPassThruExecute.c.
EFI_STATUS TransferAtaDevice | ( | IN OUT ATA_DEVICE * | AtaDevice, |
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *TaskPacket | OPTIONAL, | ||
IN OUT VOID * | Buffer, | ||
IN EFI_LBA | StartLba, | ||
IN UINT32 | TransferLength, | ||
IN BOOLEAN | IsWrite, | ||
IN EFI_EVENT Event | OPTIONAL | ||
) |
Transfer data from ATA device.
This function performs one ATA pass through transaction to transfer data from/to ATA device. It chooses the appropriate ATA command and protocol to invoke PassThru interface of ATA pass through.
[in,out] | AtaDevice | The ATA child device involved for the operation. |
[in,out] | TaskPacket | Pointer to a Pass Thru Command Packet. Optional, if it is NULL, blocking mode, and use the packet in AtaDevice. If it is not NULL, non blocking mode, and pass down this Packet. |
[in,out] | Buffer | The pointer to the current transaction buffer. |
[in] | StartLba | The starting logical block address to be accessed. |
[in] | TransferLength | The block number or sector count of the transfer. |
[in] | IsWrite | Indicates whether it is a write operation. |
[in] | Event | If Event is NULL, then blocking I/O is performed. If 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 write request is completed. |
EFI_SUCCESS | The data transfer is complete successfully. |
Definition at line 462 of file AtaPassThruExecute.c.
EFI_STATUS EFIAPI TrustTransferAtaDevice | ( | IN OUT ATA_DEVICE * | AtaDevice, |
IN OUT VOID * | Buffer, | ||
IN UINT8 | SecurityProtocolId, | ||
IN UINT16 | SecurityProtocolSpecificData, | ||
IN UINTN | TransferLength, | ||
IN BOOLEAN | IsTrustSend, | ||
IN UINT64 | Timeout, | ||
OUT UINTN * | TransferLengthOut | ||
) |
Trust transfer data from/to ATA device.
This function performs one ATA pass through transaction to do a trust transfer from/to ATA device. It chooses the appropriate ATA command and protocol to invoke PassThru interface of ATA pass through.
AtaDevice | The ATA child device involved for the operation. |
Buffer | The pointer to the current transaction buffer. |
SecurityProtocolId | The value of the "Security Protocol" parameter of the security protocol command to be sent. |
SecurityProtocolSpecificData | The value of the "Security Protocol Specific" parameter of the security protocol command to be sent. |
TransferLength | The block number or sector count of the transfer. |
IsTrustSend | Indicates whether it is a trust send operation or not. |
Timeout | The timeout, in 100ns units, to use for the execution of the security protocol command. A Timeout value of 0 means that this function will wait indefinitely for the security protocol command to execute. If Timeout is greater than zero, then this function will return EFI_TIMEOUT if the time required to execute the receive data command is greater than Timeout. |
TransferLengthOut | A pointer to a buffer to store the size in bytes of the data written to the buffer. Ignore it when IsTrustSend is TRUE. |
EFI_SUCCESS | The data transfer is complete successfully. |
Definition at line 987 of file AtaPassThruExecute.c.
UINT8 mAtaCommands[][2][2] |
Definition at line 45 of file AtaPassThruExecute.c.
EFI_ATA_PASS_THRU_CMD_PROTOCOL mAtaPassThruCmdProtocols[][2] |
Definition at line 31 of file AtaPassThruExecute.c.
UINT8 mAtaTrustCommands[2][2] |
Definition at line 71 of file AtaPassThruExecute.c.
UINTN mMaxTransferBlockNumber[] |
Definition at line 85 of file AtaPassThruExecute.c.