TianoCore EDK2 master
Loading...
Searching...
No Matches
AhciMode.c File Reference
#include "AhciPei.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_SEND   0x5E
 
#define MAX_28BIT_TRANSFER_BLOCK_NUM   0x100
 
#define MAX_48BIT_TRANSFER_BLOCK_NUM   0x800
 
#define MAX_28BIT_ADDRESSING_CAPACITY   0xfffffff
 

Functions

UINT32 AhciReadReg (IN UINTN AhciBar, IN UINT32 Offset)
 
VOID AhciWriteReg (IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 Data)
 
VOID AhciAndReg (IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 AndData)
 
VOID AhciOrReg (IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 OrData)
 
EFI_STATUS EFIAPI AhciWaitMmioSet (IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 MaskValue, IN UINT32 TestValue, IN UINT64 Timeout)
 
EFI_STATUS AhciCheckMemSet (IN UINTN Address, IN UINT32 MaskValue, IN UINT32 TestValue)
 
EFI_STATUS AhciWaitMemSet (IN EFI_PHYSICAL_ADDRESS Address, IN UINT32 MaskValue, IN UINT32 TestValue, IN UINT64 Timeout)
 
VOID AhciClearPortStatus (IN UINTN AhciBar, IN UINT8 Port)
 
EFI_STATUS AhciEnableFisReceive (IN UINTN AhciBar, IN UINT8 Port, IN UINT64 Timeout)
 
EFI_STATUS AhciDisableFisReceive (IN UINTN AhciBar, IN UINT8 Port, IN UINT64 Timeout)
 
VOID AhciBuildCommand (IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN EFI_AHCI_COMMAND_FIS *CommandFis, IN EFI_AHCI_COMMAND_LIST *CommandList, IN UINT8 CommandSlotNumber, IN OUT VOID *DataPhysicalAddr, IN UINT32 DataLength)
 
VOID AhciBuildCommandFis (IN OUT EFI_AHCI_COMMAND_FIS *CmdFis, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock)
 
EFI_STATUS AhciStopCommand (IN UINTN AhciBar, IN UINT8 Port, IN UINT64 Timeout)
 
EFI_STATUS AhciStartCommand (IN UINTN AhciBar, IN UINT8 Port, IN UINT8 CommandSlot, IN UINT64 Timeout)
 
EFI_STATUS AhciPioTransfer (IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN BOOLEAN Read, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN OUT VOID *MemoryAddr, IN UINT32 DataCount, IN UINT64 Timeout)
 
EFI_STATUS AhciNonDataTransfer (IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN UINT64 Timeout)
 
EFI_STATUS AhciReset (IN UINTN AhciBar, IN UINT64 Timeout)
 
EFI_STATUS AhciIdentify (IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN ATA_IDENTIFY_DATA *Buffer)
 
UINT8 AhciGetNumberOfPortsFromMap (IN UINT32 PortBitMap)
 
EFI_STATUS AhciGetPortFromMap (IN UINT32 PortBitMap, IN UINT8 PortIndex, OUT UINT8 *Port)
 
EFI_STATUS AhciCreateTransferDescriptor (IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private)
 
EFI_LBA GetAtapi6Capacity (IN ATA_IDENTIFY_DATA *IdentifyData)
 
EFI_STATUS IdentifyAtaDevice (IN OUT PEI_AHCI_ATA_DEVICE_DATA *DeviceData)
 
EFI_STATUS CreateNewDevice (IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINTN DeviceIndex, IN UINT16 Port, IN UINT16 PortMultiplier, IN UINT8 FisIndex, IN ATA_IDENTIFY_DATA *IdentifyData)
 
EFI_STATUS AhciModeInitialization (IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private)
 
EFI_STATUS TransferAtaDevice (IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData, IN OUT VOID *Buffer, IN EFI_LBA StartLba, IN UINT32 TransferLength, IN BOOLEAN IsWrite)
 
EFI_STATUS TrustTransferAtaDevice (IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData, IN OUT VOID *Buffer, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN TransferLength, IN BOOLEAN IsTrustSend, IN UINT64 Timeout, OUT UINTN *TransferLengthOut)
 

Variables

EFI_ATA_PASS_THRU_CMD_PROTOCOL mAtaPassThruCmdProtocols [2]
 
UINT8 mAtaCommands [2][2]
 
UINT8 mAtaTrustCommands [2]
 
UINT32 mMaxTransferBlockNumber [2]
 

Detailed Description

The AhciPei driver is used to manage ATA hard disk device working under AHCI mode at PEI phase.

Copyright (c) 2019, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AhciMode.c.

Macro Definition Documentation

◆ ATA_CMD_TRUST_NON_DATA

#define ATA_CMD_TRUST_NON_DATA   0x5B

Definition at line 13 of file AhciMode.c.

◆ ATA_CMD_TRUST_RECEIVE

#define ATA_CMD_TRUST_RECEIVE   0x5C

Definition at line 14 of file AhciMode.c.

◆ ATA_CMD_TRUST_SEND

#define ATA_CMD_TRUST_SEND   0x5E

Definition at line 15 of file AhciMode.c.

◆ MAX_28BIT_ADDRESSING_CAPACITY

#define MAX_28BIT_ADDRESSING_CAPACITY   0xfffffff

Definition at line 67 of file AhciMode.c.

◆ MAX_28BIT_TRANSFER_BLOCK_NUM

#define MAX_28BIT_TRANSFER_BLOCK_NUM   0x100

Definition at line 50 of file AhciMode.c.

◆ MAX_48BIT_TRANSFER_BLOCK_NUM

#define MAX_48BIT_TRANSFER_BLOCK_NUM   0x800

Definition at line 57 of file AhciMode.c.

Function Documentation

◆ AhciAndReg()

VOID AhciAndReg ( IN UINTN  AhciBar,
IN UINT32  Offset,
IN UINT32  AndData 
)

Do AND operation with the value of AHCI Operation register.

Parameters
[in]AhciBarAHCI bar address.
[in]OffsetThe operation register offset.
[in]AndDataThe data used to do AND operation.

Definition at line 119 of file AhciMode.c.

◆ AhciBuildCommand()

VOID AhciBuildCommand ( IN PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN UINT8  FisIndex,
IN EFI_AHCI_COMMAND_FIS CommandFis,
IN EFI_AHCI_COMMAND_LIST CommandList,
IN UINT8  CommandSlotNumber,
IN OUT VOID *  DataPhysicalAddr,
IN UINT32  DataLength 
)

Build the command list, command table and prepare the fis receiver.

Parameters
[in]PrivateThe pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA.
[in]PortThe number of port.
[in]PortMultiplierThe number of port multiplier.
[in]FisIndexThe offset index of the FIS base address.
[in]CommandFisThe control fis will be used for the transfer.
[in]CommandListThe command list will be used for the transfer.
[in]CommandSlotNumberThe command slot will be used for the transfer.
[in,out]DataPhysicalAddrThe pointer to the data buffer pci bus master address.
[in]DataLengthThe data count to be transferred.

Definition at line 422 of file AhciMode.c.

◆ AhciBuildCommandFis()

VOID AhciBuildCommandFis ( IN OUT EFI_AHCI_COMMAND_FIS CmdFis,
IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock 
)

Build a command FIS.

Parameters
[in,out]CmdFisA pointer to the EFI_AHCI_COMMAND_FIS data structure.
[in]AtaCommandBlockA pointer to the EFI_ATA_COMMAND_BLOCK data structure.

Definition at line 529 of file AhciMode.c.

◆ AhciCheckMemSet()

EFI_STATUS AhciCheckMemSet ( IN UINTN  Address,
IN UINT32  MaskValue,
IN UINT32  TestValue 
)

Check the memory status to the test value.

Parameters
[in]AddressThe memory address to test.
[in]MaskValueThe mask value of memory.
[in]TestValueThe test value of memory.
Return values
EFI_NOT_READYThe memory is not set.
EFI_SUCCESSThe memory is correct set.

Definition at line 215 of file AhciMode.c.

◆ AhciClearPortStatus()

VOID AhciClearPortStatus ( IN UINTN  AhciBar,
IN UINT8  Port 
)

Clear the port interrupt and error status. It will also clear HBA interrupt status.

Parameters
[in]AhciBarAHCI bar address.
[in]PortThe number of port.

Definition at line 302 of file AhciMode.c.

◆ AhciCreateTransferDescriptor()

EFI_STATUS AhciCreateTransferDescriptor ( IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA Private)

Allocate transfer-related data struct which is used at AHCI mode.

Parameters
[in,out]PrivateA pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA instance.
Return values
EFI_SUCCESSData structures are allocated successfully.
OthersData structures are not allocated successfully.

Definition at line 1263 of file AhciMode.c.

◆ AhciDisableFisReceive()

EFI_STATUS AhciDisableFisReceive ( IN UINTN  AhciBar,
IN UINT8  Port,
IN UINT64  Timeout 
)

Disable the FIS running for giving port.

Parameters
[in]AhciBarAHCI bar address.
[in]PortThe number of port.
[in]TimeoutThe timeout value of disabling FIS, uses 100ns as a unit.
Return values
EFI_DEVICE_ERRORThe FIS disable setting fails.
EFI_TIMEOUTThe FIS disable setting is time out.
EFI_UNSUPPORTEDThe port is in running state.
EFI_SUCCESSThe FIS disable successfully.

Definition at line 368 of file AhciMode.c.

◆ AhciEnableFisReceive()

EFI_STATUS AhciEnableFisReceive ( IN UINTN  AhciBar,
IN UINT8  Port,
IN UINT64  Timeout 
)

Enable the FIS running for giving port.

Parameters
[in]AhciBarAHCI bar address.
[in]PortThe number of port.
[in]TimeoutThe timeout, in 100ns units, to enabling FIS.
Return values
EFI_DEVICE_ERRORThe FIS enable setting fails.
EFI_TIMEOUTThe FIS enable setting is time out.
EFI_SUCCESSThe FIS enable successfully.

Definition at line 340 of file AhciMode.c.

◆ AhciGetNumberOfPortsFromMap()

UINT8 AhciGetNumberOfPortsFromMap ( IN UINT32  PortBitMap)

Collect the number of bits set within a port bitmap.

Parameters
[in]PortBitMapA 32-bit wide bit map of ATA AHCI ports.
Return values
Thenumber of bits set in the bitmap.

Definition at line 1190 of file AhciMode.c.

◆ AhciGetPortFromMap()

EFI_STATUS AhciGetPortFromMap ( IN UINT32  PortBitMap,
IN UINT8  PortIndex,
OUT UINT8 *  Port 
)

Get the specified port number from a port bitmap.

Parameters
[in]PortBitMapA 32-bit wide bit map of ATA AHCI ports.
[in]PortIndexThe specified port index.
[out]PortThe port number of the port specified by PortIndex.
Return values
EFI_SUCCESSThe specified port is found and its port number is in Port.
EFI_NOT_FOUNDCannot find the specified port within the port bitmap.

Definition at line 1222 of file AhciMode.c.

◆ AhciIdentify()

EFI_STATUS AhciIdentify ( IN PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN UINT8  FisIndex,
IN ATA_IDENTIFY_DATA Buffer 
)

Send Identify Drive command to a specific device.

Parameters
[in]PrivateThe pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA.
[in]PortThe number of port.
[in]PortMultiplierThe port multiplier port number.
[in]FisIndexThe offset index of the FIS base address.
[in]BufferThe data buffer to store IDENTIFY PACKET data.
Return values
EFI_SUCCESSThe cmd executes successfully.
EFI_INVALID_PARAMETERBuffer is NULL.
EFI_DEVICE_ERRORThe cmd abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for executing.

Definition at line 1143 of file AhciMode.c.

◆ AhciModeInitialization()

EFI_STATUS AhciModeInitialization ( IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA Private)

Initialize ATA host controller at AHCI mode.

The function is designed to initialize ATA host controller.

Parameters
[in,out]PrivateA pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA instance.
Return values
EFI_SUCCESSThe ATA AHCI controller is initialized successfully.
EFI_OUT_OF_RESOURCESNot enough resource to complete while initializing the controller.
OthersA device error occurred while initializing the controller.

Definition at line 1664 of file AhciMode.c.

◆ AhciNonDataTransfer()

EFI_STATUS AhciNonDataTransfer ( IN PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN UINT8  FisIndex,
IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock,
IN UINT64  Timeout 
)

Start a non data transfer on specific port.

Parameters
[in]PrivateThe pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA.
[in]PortThe number of port.
[in]PortMultiplierThe number of port multiplier.
[in]FisIndexThe offset index of the FIS base address.
[in]AtaCommandBlockThe EFI_ATA_COMMAND_BLOCK data.
[in,out]AtaStatusBlockThe EFI_ATA_STATUS_BLOCK data.
[in]TimeoutThe timeout value of non data transfer, uses 100ns as a unit.
Return values
EFI_DEVICE_ERRORThe non data transfer abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for transfer.
EFI_SUCCESSThe non data transfer executes successfully.

Definition at line 981 of file AhciMode.c.

◆ AhciOrReg()

VOID AhciOrReg ( IN UINTN  AhciBar,
IN UINT32  Offset,
IN UINT32  OrData 
)

Do OR operation with the Value of AHCI Operation register.

Parameters
[in]AhciBarAHCI bar address.
[in]OffsetThe operation register offset.
[in]OrDataThe Data used to do OR operation.

Definition at line 142 of file AhciMode.c.

◆ AhciPioTransfer()

EFI_STATUS AhciPioTransfer ( IN PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN UINT8  FisIndex,
IN BOOLEAN  Read,
IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock,
IN OUT VOID *  MemoryAddr,
IN UINT32  DataCount,
IN UINT64  Timeout 
)

Start a PIO Data transfer on specific port.

Parameters
[in]PrivateThe pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA.
[in]PortThe number of port.
[in]PortMultiplierThe number of port multiplier.
[in]FisIndexThe offset index of the FIS base address.
[in]ReadThe transfer direction.
[in]AtaCommandBlockThe EFI_ATA_COMMAND_BLOCK data.
[in,out]AtaStatusBlockThe EFI_ATA_STATUS_BLOCK data.
[in,out]MemoryAddrThe pointer to the data buffer.
[in]DataCountThe data count to be transferred.
[in]TimeoutThe timeout value of PIO data transfer, uses 100ns as a unit.
Return values
EFI_DEVICE_ERRORThe PIO data transfer abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for transfer.
EFI_OUT_OF_RESOURCESThe operation fails due to lack of resources.
EFI_SUCCESSThe PIO data transfer executes successfully.

Definition at line 717 of file AhciMode.c.

◆ AhciReadReg()

UINT32 AhciReadReg ( IN UINTN  AhciBar,
IN UINT32  Offset 
)

Read AHCI Operation register.

Parameters
[in]AhciBarAHCI bar address.
[in]OffsetThe operation register offset.
Returns
The register content read.

Definition at line 79 of file AhciMode.c.

◆ AhciReset()

EFI_STATUS AhciReset ( IN UINTN  AhciBar,
IN UINT64  Timeout 
)

Do AHCI HBA reset.

Parameters
[in]AhciBarAHCI bar address.
[in]TimeoutThe timeout, in 100ns units, to reset.
Return values
EFI_DEVICE_ERRORAHCI controller is failed to complete hardware reset.
EFI_TIMEOUTThe reset operation is time out.
EFI_SUCCESSAHCI controller is reset successfully.

Definition at line 1084 of file AhciMode.c.

◆ AhciStartCommand()

EFI_STATUS AhciStartCommand ( IN UINTN  AhciBar,
IN UINT8  Port,
IN UINT8  CommandSlot,
IN UINT64  Timeout 
)

Start command for give slot on specific port.

Parameters
[in]AhciBarAHCI bar address.
[in]PortThe number of port.
[in]CommandSlotThe number of Command Slot.
[in]TimeoutThe timeout value, in 100ns units, to start.
Return values
EFI_DEVICE_ERRORThe command start unsuccessfully.
EFI_TIMEOUTThe operation is time out.
EFI_SUCCESSThe command start successfully.

Definition at line 617 of file AhciMode.c.

◆ AhciStopCommand()

EFI_STATUS AhciStopCommand ( IN UINTN  AhciBar,
IN UINT8  Port,
IN UINT64  Timeout 
)

Stop command running for giving port

Parameters
[in]AhciBarAHCI bar address.
[in]PortThe number of port.
[in]TimeoutThe timeout value, in 100ns units, to stop.
Return values
EFI_DEVICE_ERRORThe command stop unsuccessfully.
EFI_TIMEOUTThe operation is time out.
EFI_SUCCESSThe command stop successfully.

Definition at line 574 of file AhciMode.c.

◆ AhciWaitMemSet()

EFI_STATUS AhciWaitMemSet ( IN EFI_PHYSICAL_ADDRESS  Address,
IN UINT32  MaskValue,
IN UINT32  TestValue,
IN UINT64  Timeout 
)

Wait for the value of the specified system memory set to the test value.

Parameters
[in]AddressThe system memory address to test.
[in]MaskValueThe mask value of memory.
[in]TestValueThe test value of memory.
[in]TimeoutThe timeout, in 100ns units, for wait memory set.
Return values
EFI_TIMEOUTThe system memory setting is time out.
EFI_SUCCESSThe system memory is correct set.

Definition at line 246 of file AhciMode.c.

◆ AhciWaitMmioSet()

EFI_STATUS EFIAPI AhciWaitMmioSet ( IN UINTN  AhciBar,
IN UINT32  Offset,
IN UINT32  MaskValue,
IN UINT32  TestValue,
IN UINT64  Timeout 
)

Wait for memory set to the test Value.

Parameters
[in]AhciBarAHCI bar address.
[in]OffsetThe memory offset to test.
[in]MaskValueThe mask Value of memory.
[in]TestValueThe test Value of memory.
[in]TimeoutThe timeout, in 100ns units, for wait memory set.
Return values
EFI_DEVICE_ERRORThe memory is not set.
EFI_TIMEOUTThe memory setting is time out.
EFI_SUCCESSThe memory is correct set.

Definition at line 172 of file AhciMode.c.

◆ AhciWriteReg()

VOID AhciWriteReg ( IN UINTN  AhciBar,
IN UINT32  Offset,
IN UINT32  Data 
)

Write AHCI Operation register.

Parameters
[in]AhciBarAHCI bar address.
[in]OffsetThe operation register offset.
[in]DataThe Data used to write down.

Definition at line 101 of file AhciMode.c.

◆ CreateNewDevice()

EFI_STATUS CreateNewDevice ( IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINTN  DeviceIndex,
IN UINT16  Port,
IN UINT16  PortMultiplier,
IN UINT8  FisIndex,
IN ATA_IDENTIFY_DATA IdentifyData 
)

Allocate device information data structure to contain device information. And insert the data structure to the tail of device list for tracing.

Parameters
[in,out]PrivateA pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA instance.
[in]DeviceIndexThe device index.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
[in]FisIndexThe index of the FIS of the ATA device to send the command.
[in]IdentifyDataThe data buffer to store the output of the IDENTIFY command.
Return values
EFI_SUCCESSSuccessfully insert the ATA device to the tail of device list.
EFI_OUT_OF_RESOURCESNot enough resource.

Definition at line 1602 of file AhciMode.c.

◆ GetAtapi6Capacity()

EFI_LBA GetAtapi6Capacity ( IN ATA_IDENTIFY_DATA IdentifyData)

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.

Parameters
[in]IdentifyDataA pointer to ATA_IDENTIFY_DATA structure.
Returns
The capacity of the ATA device or 0 if the device does not support 48-bit addressing defined in ATA 6.

Definition at line 1415 of file AhciMode.c.

◆ IdentifyAtaDevice()

EFI_STATUS IdentifyAtaDevice ( IN OUT PEI_AHCI_ATA_DEVICE_DATA DeviceData)

Identifies ATA device via the Identify data.

This function identifies the ATA device and initializes the media information.

Attention
This is boundary function that may receive untrusted input.
The input is from peripheral hardware device.

The Identify Drive command response data from an ATA device is the peripheral hardware input, so this routine will do basic validation for the Identify Drive command response data.

Parameters
[in,out]DeviceDataA pointer to PEI_AHCI_ATA_DEVICE_DATA structure.
Return values
EFI_SUCCESSThe device is successfully identified and media information is correctly initialized.
EFI_UNSUPPORTEDThe device is not a valid ATA device (hard disk).

Definition at line 1465 of file AhciMode.c.

◆ TransferAtaDevice()

EFI_STATUS TransferAtaDevice ( IN PEI_AHCI_ATA_DEVICE_DATA DeviceData,
IN OUT VOID *  Buffer,
IN EFI_LBA  StartLba,
IN UINT32  TransferLength,
IN BOOLEAN  IsWrite 
)

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.

Parameters
[in]DeviceDataA pointer to PEI_AHCI_ATA_DEVICE_DATA structure.
[in,out]BufferThe pointer to the current transaction buffer.
[in]StartLbaThe starting logical block address to be accessed.
[in]TransferLengthThe block number or sector count of the transfer.
[in]IsWriteIndicates whether it is a write operation.
Return values
EFI_SUCCESSThe data transfer is complete successfully.
Returns
others Some error occurs when transferring data.

Definition at line 1924 of file AhciMode.c.

◆ TrustTransferAtaDevice()

EFI_STATUS TrustTransferAtaDevice ( IN PEI_AHCI_ATA_DEVICE_DATA DeviceData,
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.

Parameters
[in]DeviceDataPointer to PEI_AHCI_ATA_DEVICE_DATA structure.
[in,out]BufferThe pointer to the current transaction buffer.
[in]SecurityProtocolIdThe value of the "Security Protocol" parameter of the security protocol command to be sent.
[in]SecurityProtocolSpecificDataThe value of the "Security Protocol Specific" parameter of the security protocol command to be sent.
[in]TransferLengthThe block number or sector count of the transfer.
[in]IsTrustSendIndicates whether it is a trust send operation or not.
[in]TimeoutThe 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.
[out]TransferLengthOutA pointer to a buffer to store the size in bytes of the data written to the buffer. Ignore it when IsTrustSend is TRUE.
Return values
EFI_SUCCESSThe data transfer is complete successfully.
Returns
others Some error occurs when transferring data.

Definition at line 2063 of file AhciMode.c.

Variable Documentation

◆ mAtaCommands

UINT8 mAtaCommands[2][2]
Initial value:
= {
{
},
{
}
}
#define ATA_CMD_READ_SECTORS
defined from ATA-1
Definition: Atapi.h:544
#define ATA_CMD_WRITE_SECTORS_EXT
defined from ATA-6
Definition: Atapi.h:563
#define ATA_CMD_READ_SECTORS_EXT
defined from ATA-6
Definition: Atapi.h:548
#define ATA_CMD_WRITE_SECTORS
defined from ATA-1
Definition: Atapi.h:558

Definition at line 28 of file AhciMode.c.

◆ mAtaPassThruCmdProtocols

EFI_ATA_PASS_THRU_CMD_PROTOCOL mAtaPassThruCmdProtocols[2]
Initial value:
= {
EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN,
EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_OUT
}

Definition at line 20 of file AhciMode.c.

◆ mAtaTrustCommands

UINT8 mAtaTrustCommands[2]
Initial value:
= {
ATA_CMD_TRUST_RECEIVE,
ATA_CMD_TRUST_SEND
}

Definition at line 42 of file AhciMode.c.

◆ mMaxTransferBlockNumber

UINT32 mMaxTransferBlockNumber[2]
Initial value:
= {
MAX_28BIT_TRANSFER_BLOCK_NUM,
MAX_48BIT_TRANSFER_BLOCK_NUM
}

Definition at line 59 of file AhciMode.c.