TianoCore EDK2 master
Loading...
Searching...
No Matches
AhciMode.c File Reference
#include "AtaAtapiPassThru.h"

Go to the source code of this file.

Functions

UINT32 EFIAPI AhciReadReg (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset)
 
VOID EFIAPI AhciWriteReg (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT32 Data)
 
VOID EFIAPI AhciAndReg (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT32 AndData)
 
VOID EFIAPI AhciOrReg (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT32 OrData)
 
EFI_STATUS EFIAPI AhciWaitMmioSet (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINTN Offset, IN UINT32 MaskValue, IN UINT32 TestValue, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciWaitMemSet (IN EFI_PHYSICAL_ADDRESS Address, IN UINT32 MaskValue, IN UINT32 TestValue, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciCheckMemSet (IN UINTN Address, IN UINT32 MaskValue, IN UINT32 TestValue)
 
VOID EFIAPI AhciClearPortStatus (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
 
VOID EFIAPI AhciDumpPortStatus (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
 
EFI_STATUS EFIAPI AhciEnableFisReceive (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciDisableFisReceive (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port, IN UINT64 Timeout)
 
VOID EFIAPI AhciBuildCommand (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_AHCI_COMMAND_FIS *CommandFis, IN EFI_AHCI_COMMAND_LIST *CommandList, IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, IN UINT8 AtapiCommandLength, IN UINT8 CommandSlotNumber, IN OUT VOID *DataPhysicalAddr, IN UINT32 DataLength)
 
VOID EFIAPI AhciBuildCommandFis (IN OUT EFI_AHCI_COMMAND_FIS *CmdFis, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock)
 
EFI_STATUS AhciWaitDeviceReady (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
 
EFI_STATUS AhciResetPort (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
 
EFI_STATUS AhciRecoverPortError (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
 
BOOLEAN AhciShouldCmdBeRetried (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port)
 
EFI_STATUS AhciCheckFisReceived (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port, IN SATA_FIS_TYPE FisType)
 
EFI_STATUS AhciWaitUntilFisReceived (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port, IN UINT64 Timeout, IN SATA_FIS_TYPE FisType)
 
VOID AhciPrintCommandBlock (IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN UINT32 DebugLevel)
 
VOID AhciPrintStatusBlock (IN EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN UINT32 DebugLevel)
 
EFI_STATUS EFIAPI AhciPioTransfer (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, IN UINT8 AtapiCommandLength, IN BOOLEAN Read, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN OUT VOID *MemoryAddr, IN UINT32 DataCount, IN UINT64 Timeout, IN ATA_NONBLOCK_TASK *Task)
 
EFI_STATUS EFIAPI AhciDmaTransfer (IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, IN UINT8 AtapiCommandLength, IN BOOLEAN Read, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN OUT VOID *MemoryAddr, IN UINT32 DataCount, IN UINT64 Timeout, IN ATA_NONBLOCK_TASK *Task)
 
EFI_STATUS EFIAPI AhciNonDataTransfer (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, IN UINT8 AtapiCommandLength, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN UINT64 Timeout, IN ATA_NONBLOCK_TASK *Task)
 
EFI_STATUS EFIAPI AhciStopCommand (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciStartCommand (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Port, IN UINT8 CommandSlot, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciReset (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciAtaSmartReturnStatusCheck (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
 
VOID EFIAPI AhciAtaSmartSupport (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_IDENTIFY_DATA *IdentifyData, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
 
EFI_STATUS EFIAPI AhciIdentify (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN OUT EFI_IDENTIFY_DATA *Buffer)
 
EFI_STATUS EFIAPI AhciIdentifyPacket (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN OUT EFI_IDENTIFY_DATA *Buffer)
 
EFI_STATUS EFIAPI AhciDeviceSetFeature (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT16 Feature, IN UINT32 FeatureSpecificData, IN UINT64 Timeout)
 
EFI_STATUS EFIAPI AhciPacketCommandExecute (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
 
EFI_STATUS EFIAPI AhciCreateTransferDescriptor (IN EFI_PCI_IO_PROTOCOL *PciIo, IN OUT EFI_AHCI_REGISTERS *AhciRegisters)
 
EFI_STATUS AhciReadLogExt (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN OUT UINT8 *Buffer, IN UINT8 LogNumber, IN UINT8 PageNumber)
 
EFI_STATUS AhciEnableDevSlp (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN EFI_IDENTIFY_DATA *IdentifyData)
 
EFI_STATUS AhciSpinUpDisk (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier, IN OUT EFI_IDENTIFY_DATA *IdentifyData)
 
EFI_STATUS AhciPuisEnable (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_AHCI_REGISTERS *AhciRegisters, IN UINT8 Port, IN UINT8 PortMultiplier)
 
EFI_STATUS EFIAPI AhciModeInitialization (IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance)
 

Detailed Description

The file for AHCI mode of ATA host controller.

Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AhciMode.c.

Function Documentation

◆ AhciAndReg()

VOID EFIAPI AhciAndReg ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT32  Offset,
IN UINT32  AndData 
)

Do AND operation with the value of AHCI Operation register.

Parameters
PciIoThe PCI IO protocol instance.
OffsetThe operation register offset.
AndDataThe data used to do AND operation.

Definition at line 86 of file AhciMode.c.

◆ AhciAtaSmartReturnStatusCheck()

EFI_STATUS EFIAPI AhciAtaSmartReturnStatusCheck ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock 
)

Send SMART Return Status command to check if the execution of SMART cmd is successful or not.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe port multiplier port number.
AtaStatusBlockA pointer to EFI_ATA_STATUS_BLOCK data structure.
Return values
EFI_SUCCESSSuccessfully get the return status of S.M.A.R.T command execution.
OthersFail to get return status data.

Definition at line 1729 of file AhciMode.c.

◆ AhciAtaSmartSupport()

VOID EFIAPI AhciAtaSmartSupport ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_IDENTIFY_DATA IdentifyData,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock 
)

Enable SMART command of the disk if supported.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe port multiplier port number.
IdentifyDataA pointer to data buffer which is used to contain IDENTIFY data.
AtaStatusBlockA pointer to EFI_ATA_STATUS_BLOCK data structure.

Definition at line 1825 of file AhciMode.c.

◆ AhciBuildCommand()

VOID EFIAPI AhciBuildCommand ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_AHCI_COMMAND_FIS CommandFis,
IN EFI_AHCI_COMMAND_LIST CommandList,
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand  OPTIONAL,
IN UINT8  AtapiCommandLength,
IN UINT8  CommandSlotNumber,
IN OUT VOID *  DataPhysicalAddr,
IN UINT32  DataLength 
)

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

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe timeout value of stop.
CommandFisThe control fis will be used for the transfer.
CommandListThe command list will be used for the transfer.
AtapiCommandThe atapi command will be used for the transfer.
AtapiCommandLengthThe length of the atapi command.
CommandSlotNumberThe command slot will be used for the transfer.
DataPhysicalAddrThe pointer to the data buffer pci bus master address.
DataLengthThe data count to be transferred.

Definition at line 464 of file AhciMode.c.

◆ AhciBuildCommandFis()

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

Build a command FIS.

Parameters
CmdFisA pointer to the EFI_AHCI_COMMAND_FIS data structure.
AtaCommandBlockA pointer to the AhciBuildCommandFis data structure.

Definition at line 572 of file AhciMode.c.

◆ AhciCheckFisReceived()

EFI_STATUS AhciCheckFisReceived ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port,
IN SATA_FIS_TYPE  FisType 
)

Checks if specified FIS has been received.

Parameters
[in]PciIoPointer to AHCI controller PciIo.
[in]PortSATA port index on which to check.
[in]FisTypeFIS type for which to check.
Return values
EFI_SUCCESSFIS received.
EFI_NOT_READYFIS not received yet.
EFI_DEVICE_ERRORAHCI controller reported an error on port.

Definition at line 814 of file AhciMode.c.

◆ AhciCheckMemSet()

EFI_STATUS EFIAPI 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 258 of file AhciMode.c.

◆ AhciClearPortStatus()

VOID EFIAPI AhciClearPortStatus ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port 
)

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

Parameters
PciIoThe PCI IO protocol instance.
PortThe number of port.

Definition at line 287 of file AhciMode.c.

◆ AhciCreateTransferDescriptor()

EFI_STATUS EFIAPI AhciCreateTransferDescriptor ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN OUT EFI_AHCI_REGISTERS AhciRegisters 
)

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

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.

Definition at line 2212 of file AhciMode.c.

◆ AhciDeviceSetFeature()

EFI_STATUS EFIAPI AhciDeviceSetFeature ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN UINT16  Feature,
IN UINT32  FeatureSpecificData,
IN UINT64  Timeout 
)

Send SET FEATURE cmd on specific device.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe port multiplier port number.
FeatureThe data to send Feature register.
FeatureSpecificDataThe specific data for SET FEATURE cmd.
TimeoutThe timeout value of SET FEATURE cmd, uses 100ns as a unit.
Return values
EFI_DEVICE_ERRORThe cmd abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for executing.
EFI_SUCCESSThe cmd executes successfully.

Definition at line 2068 of file AhciMode.c.

◆ AhciDisableFisReceive()

EFI_STATUS EFIAPI AhciDisableFisReceive ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port,
IN UINT64  Timeout 
)

Disable the FIS running for giving port.

Parameters
PciIoThe PCI IO protocol instance.
PortThe number of port.
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 409 of file AhciMode.c.

◆ AhciDmaTransfer()

EFI_STATUS EFIAPI AhciDmaTransfer ( IN ATA_ATAPI_PASS_THRU_INSTANCE Instance,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand  OPTIONAL,
IN UINT8  AtapiCommandLength,
IN BOOLEAN  Read,
IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock,
IN OUT VOID *  MemoryAddr,
IN UINT32  DataCount,
IN UINT64  Timeout,
IN ATA_NONBLOCK_TASK Task 
)

Start a DMA data transfer on specific port

Parameters
[in]InstanceThe ATA_ATAPI_PASS_THRU_INSTANCE protocol instance.
[in]AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
[in]PortThe number of port.
[in]PortMultiplierThe timeout value of stop.
[in]AtapiCommandThe atapi command will be used for the transfer.
[in]AtapiCommandLengthThe length of the atapi command.
[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 non data transfer, uses 100ns as a unit.
[in]TaskOptional. Pointer to the ATA_NONBLOCK_TASK used by non-blocking mode.
Return values
EFI_DEVICE_ERRORThe DMA data transfer abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for transfer.
EFI_SUCCESSThe DMA data transfer executes successfully.

Definition at line 1158 of file AhciMode.c.

◆ AhciDumpPortStatus()

VOID EFIAPI AhciDumpPortStatus ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock 
)

This function is used to dump the Status Registers and if there is ERR bit set in the Status Register, the Error Register's value is also be dumped.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
AtaStatusBlockA pointer to EFI_ATA_STATUS_BLOCK data structure.

Definition at line 324 of file AhciMode.c.

◆ AhciEnableDevSlp()

EFI_STATUS AhciEnableDevSlp ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_IDENTIFY_DATA IdentifyData 
)

Enable DEVSLP of the disk if supported.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe multiplier of port.
IdentifyDataA pointer to data buffer which is used to contain IDENTIFY data.
Return values
EFI_SUCCESSThe DEVSLP is enabled per policy successfully.
EFI_UNSUPPORTEDThe DEVSLP isn't supported by the controller/device and policy requires to enable it.

Definition at line 2528 of file AhciMode.c.

◆ AhciEnableFisReceive()

EFI_STATUS EFIAPI AhciEnableFisReceive ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port,
IN UINT64  Timeout 
)

Enable the FIS running for giving port.

Parameters
PciIoThe PCI IO protocol instance.
PortThe number of port.
TimeoutThe timeout value of enabling FIS, uses 100ns as a unit.
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 380 of file AhciMode.c.

◆ AhciIdentify()

EFI_STATUS EFIAPI AhciIdentify ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN OUT EFI_IDENTIFY_DATA Buffer 
)

Send Buffer cmd to specific device.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe port multiplier port number.
BufferThe data buffer to store IDENTIFY PACKET data.
Return values
EFI_DEVICE_ERRORThe cmd abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for executing.
EFI_SUCCESSThe cmd executes successfully.

Definition at line 1950 of file AhciMode.c.

◆ AhciIdentifyPacket()

EFI_STATUS EFIAPI AhciIdentifyPacket ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN OUT EFI_IDENTIFY_DATA Buffer 
)

Send Buffer cmd to specific device.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe port multiplier port number.
BufferThe data buffer to store IDENTIFY PACKET data.
Return values
EFI_DEVICE_ERRORThe cmd abort with error occurs.
EFI_TIMEOUTThe operation is time out.
EFI_UNSUPPORTEDThe device is not ready for executing.
EFI_SUCCESSThe cmd executes successfully.

Definition at line 2008 of file AhciMode.c.

◆ AhciModeInitialization()

EFI_STATUS EFIAPI AhciModeInitialization ( IN ATA_ATAPI_PASS_THRU_INSTANCE Instance)

Initialize ATA host controller at AHCI mode.

The function is designed to initialize ATA host controller.

Parameters
[in]InstanceA pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.

Definition at line 2863 of file AhciMode.c.

◆ AhciNonDataTransfer()

EFI_STATUS EFIAPI AhciNonDataTransfer ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand  OPTIONAL,
IN UINT8  AtapiCommandLength,
IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock,
IN UINT64  Timeout,
IN ATA_NONBLOCK_TASK Task 
)

Start a non data transfer on specific port.

Parameters
[in]PciIoThe PCI IO protocol instance.
[in]AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
[in]PortThe number of port.
[in]PortMultiplierThe timeout value of stop.
[in]AtapiCommandThe atapi command will be used for the transfer.
[in]AtapiCommandLengthThe length of the atapi command.
[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.
[in]TaskOptional. Pointer to the ATA_NONBLOCK_TASK used by non-blocking mode.
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 1424 of file AhciMode.c.

◆ AhciOrReg()

VOID EFIAPI AhciOrReg ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT32  Offset,
IN UINT32  OrData 
)

Do OR operation with the value of AHCI Operation register.

Parameters
PciIoThe PCI IO protocol instance.
OffsetThe operation register offset.
OrDataThe data used to do OR operation.

Definition at line 113 of file AhciMode.c.

◆ AhciPacketCommandExecute()

EFI_STATUS EFIAPI AhciPacketCommandExecute ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET Packet 
)

This function is used to send out ATAPI commands conforms to the Packet Command with PIO Protocol.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe number of port multiplier.
PacketA pointer to EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET structure.
Return values
EFI_SUCCESSsend out the ATAPI packet command successfully and device sends data successfully.
EFI_DEVICE_ERRORthe device failed to send data.

Definition at line 2126 of file AhciMode.c.

◆ AhciPioTransfer()

EFI_STATUS EFIAPI AhciPioTransfer ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand  OPTIONAL,
IN UINT8  AtapiCommandLength,
IN BOOLEAN  Read,
IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock,
IN OUT EFI_ATA_STATUS_BLOCK AtaStatusBlock,
IN OUT VOID *  MemoryAddr,
IN UINT32  DataCount,
IN UINT64  Timeout,
IN ATA_NONBLOCK_TASK Task 
)

Start a PIO data transfer on specific port.

Parameters
[in]PciIoThe PCI IO protocol instance.
[in]AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
[in]PortThe number of port.
[in]PortMultiplierThe timeout value of stop.
[in]AtapiCommandThe atapi command will be used for the transfer.
[in]AtapiCommandLengthThe length of the atapi command.
[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 non data transfer, uses 100ns as a unit.
[in]TaskOptional. Pointer to the ATA_NONBLOCK_TASK used by non-blocking mode.
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_SUCCESSThe PIO data transfer executes successfully.

Definition at line 983 of file AhciMode.c.

◆ AhciPrintCommandBlock()

VOID AhciPrintCommandBlock ( IN EFI_ATA_COMMAND_BLOCK AtaCommandBlock,
IN UINT32  DebugLevel 
)

Prints contents of the ATA command block into the debug port.

Parameters
[in]AtaCommandBlockAtaCommandBlock to print.
[in]DebugLevelDebug level on which to print.

Definition at line 908 of file AhciMode.c.

◆ AhciPrintStatusBlock()

VOID AhciPrintStatusBlock ( IN EFI_ATA_STATUS_BLOCK AtaStatusBlock,
IN UINT32  DebugLevel 
)

Prints contents of the ATA status block into the debug port.

Parameters
[in]AtaStatusBlockAtaStatusBlock to print.
[in]DebugLevelDebug level on which to print.

Definition at line 935 of file AhciMode.c.

◆ AhciPuisEnable()

EFI_STATUS AhciPuisEnable ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier 
)

Enable/disable/skip PUIS of the disk according to policy.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe multiplier of port.

Definition at line 2824 of file AhciMode.c.

◆ AhciReadLogExt()

EFI_STATUS AhciReadLogExt ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN OUT UINT8 *  Buffer,
IN UINT8  LogNumber,
IN UINT8  PageNumber 
)

Read logs from SATA device.

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe multiplier of port.
BufferThe data buffer to store SATA logs.
LogNumberThe address of the log.
PageNumberThe page number of the log.
Return values
EFI_INVALID_PARAMETERPciIo, AhciRegisters or Buffer is NULL.
othersReturn status of AhciPioTransfer().

Read log from device

Definition at line 2469 of file AhciMode.c.

◆ AhciReadReg()

UINT32 EFIAPI AhciReadReg ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT32  Offset 
)

Read AHCI Operation register.

Parameters
PciIoThe PCI IO protocol instance.
OffsetThe operation register offset.
Returns
The register content read.

Definition at line 23 of file AhciMode.c.

◆ AhciRecoverPortError()

EFI_STATUS AhciRecoverPortError ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port 
)

Recovers the SATA port from error condition. This function implements algorithm described in AHCI spec 1.3.1 section 6.2.2

Parameters
[in]PciIoPointer to AHCI controller PciIo.
[in]PortSATA port index on which to check.
Return values
EFI_SUCCESSPort recovered.
OthersFailed to recover port.

Definition at line 701 of file AhciMode.c.

◆ AhciReset()

EFI_STATUS EFIAPI AhciReset ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT64  Timeout 
)

Do AHCI HBA reset.

Parameters
PciIoThe PCI IO protocol instance.
TimeoutThe timeout value of reset, uses 100ns as a unit.
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 1671 of file AhciMode.c.

◆ AhciResetPort()

EFI_STATUS AhciResetPort ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port 
)

Reset the SATA port. Algorithm follows AHCI spec 1.3.1 section 10.4.2

Parameters
[in]PciIoPointer to AHCI controller PciIo.
[in]PortSATA port index on which to reset.
Return values
EFI_SUCCESSPort reset.
OthersFailed to reset the port.

Definition at line 663 of file AhciMode.c.

◆ AhciShouldCmdBeRetried()

BOOLEAN AhciShouldCmdBeRetried ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port 
)

This function will check if the failed command should be retired. Only error conditions which are a result of transient conditions on a link(either to system or to device).

Parameters
[in]PciIoPointer to AHCI controller PciIo.
[in]PortSATA port index on which to check.
Return values
TRUECommand failure was caused by transient condition and should be retried
FALSECommand should not be retried

Definition at line 758 of file AhciMode.c.

◆ AhciSpinUpDisk()

EFI_STATUS AhciSpinUpDisk ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_AHCI_REGISTERS AhciRegisters,
IN UINT8  Port,
IN UINT8  PortMultiplier,
IN OUT EFI_IDENTIFY_DATA IdentifyData 
)

Spin-up disk if IDD was incomplete or PUIS feature is enabled

Parameters
PciIoThe PCI IO protocol instance.
AhciRegistersThe pointer to the EFI_AHCI_REGISTERS.
PortThe number of port.
PortMultiplierThe multiplier of port.
IdentifyDataA pointer to data buffer which is used to contain IDENTIFY data.

Definition at line 2703 of file AhciMode.c.

◆ AhciStartCommand()

EFI_STATUS EFIAPI AhciStartCommand ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port,
IN UINT8  CommandSlot,
IN UINT64  Timeout 
)

Start command for give slot on specific port.

Parameters
PciIoThe PCI IO protocol instance.
PortThe number of port.
CommandSlotThe number of Command Slot.
TimeoutThe timeout value of start, uses 100ns as a unit.
Return values
EFI_DEVICE_ERRORThe command start unsuccessfully.
EFI_TIMEOUTThe operation is time out.
EFI_SUCCESSThe command start successfully.

Definition at line 1580 of file AhciMode.c.

◆ AhciStopCommand()

EFI_STATUS EFIAPI AhciStopCommand ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port,
IN UINT64  Timeout 
)

Stop command running for giving port

Parameters
PciIoThe PCI IO protocol instance.
PortThe number of port.
TimeoutThe timeout value of stop, uses 100ns as a unit.
Return values
EFI_DEVICE_ERRORThe command stop unsuccessfully.
EFI_TIMEOUTThe operation is time out.
EFI_SUCCESSThe command stop successfully.

Definition at line 1536 of file AhciMode.c.

◆ AhciWaitDeviceReady()

EFI_STATUS AhciWaitDeviceReady ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port 
)

Wait until SATA device reports it is ready for operation.

Parameters
[in]PciIoPointer to AHCI controller PciIo.
[in]PortSATA port index on which to reset.
Return values
EFI_SUCCESSDevice ready for operation.
EFI_TIMEOUTDevice failed to get ready within required period.

Definition at line 614 of file AhciMode.c.

◆ AhciWaitMemSet()

EFI_STATUS EFIAPI 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
AddressThe system memory address to test.
MaskValueThe mask value of memory.
TestValueThe test value of memory.
TimeoutThe time out value for wait memory set, uses 100ns as a unit.
Return values
EFI_TIMEOUTThe system memory setting is time out.
EFI_SUCCESSThe system memory is correct set.

Definition at line 200 of file AhciMode.c.

◆ AhciWaitMmioSet()

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

Wait for the value of the specified MMIO register set to the test value.

Parameters
PciIoThe PCI IO protocol instance.
OffsetThe MMIO address to test.
MaskValueThe mask value of memory.
TestValueThe test value of memory.
TimeoutThe time out value for wait memory set, uses 100ns as a unit.
Return values
EFI_TIMEOUTThe MMIO setting is time out.
EFI_SUCCESSThe MMIO is correct set.

Definition at line 145 of file AhciMode.c.

◆ AhciWaitUntilFisReceived()

EFI_STATUS AhciWaitUntilFisReceived ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT8  Port,
IN UINT64  Timeout,
IN SATA_FIS_TYPE  FisType 
)

Waits until specified FIS has been received.

Parameters
[in]PciIoPointer to AHCI controller PciIo.
[in]PortSATA port index on which to check.
[in]TimeoutTime after which function should stop polling.
[in]FisTypeFIS type for which to check.
Return values
EFI_SUCCESSFIS received.
EFI_TIMEOUTFIS failed to arrive within a specified time period.
EFI_DEVICE_ERRORAHCI controller reported an error on port.

Definition at line 867 of file AhciMode.c.

◆ AhciWriteReg()

VOID EFIAPI AhciWriteReg ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINT32  Offset,
IN UINT32  Data 
)

Write AHCI Operation register.

Parameters
PciIoThe PCI IO protocol instance.
OffsetThe operation register offset.
DataThe data used to write down.

Definition at line 56 of file AhciMode.c.