TianoCore EDK2 master
Loading...
Searching...
No Matches
AhciPei.h File Reference

Go to the source code of this file.

Data Structures

struct  DATA_32
 
union  DATA_64
 
struct  EFI_AHCI_RECEIVED_FIS
 
struct  EFI_AHCI_COMMAND_LIST
 
struct  EFI_AHCI_COMMAND_FIS
 
struct  EFI_AHCI_ATAPI_COMMAND
 
struct  EFI_AHCI_COMMAND_PRDT
 
struct  EFI_AHCI_COMMAND_TABLE
 
struct  EFI_AHCI_REGISTERS
 
struct  PEI_AHCI_ATA_DEVICE_DATA
 
struct  _PEI_AHCI_CONTROLLER_PRIVATE_DATA
 

Macros

#define AHCI_BUS_PHY_DETECT_TIMEOUT   15
 
#define AHCI_PEI_RESET_TIMEOUT   10000000
 
#define ATA_TIMEOUT   30000000
 
#define AHCI_MAX_PRDT_NUMBER   8
 
#define AHCI_CAPABILITY_OFFSET   0x0000
 
#define AHCI_CAP_SAM   BIT18
 
#define AHCI_CAP_SSS   BIT27
 
#define AHCI_GHC_OFFSET   0x0004
 
#define AHCI_GHC_RESET   BIT0
 
#define AHCI_GHC_ENABLE   BIT31
 
#define AHCI_IS_OFFSET   0x0008
 
#define AHCI_PI_OFFSET   0x000C
 
#define AHCI_MAX_PORTS   32
 
#define AHCI_ATAPI_SIG_MASK   0xFFFF0000
 
#define AHCI_ATA_DEVICE_SIG   0x00000000
 
#define AHCI_MAX_DATA_PER_PRDT   0x400000
 
#define AHCI_FIS_REGISTER_H2D   0x27
 
#define AHCI_FIS_REGISTER_H2D_LENGTH   20
 
#define AHCI_FIS_REGISTER_D2H   0x34
 
#define AHCI_FIS_PIO_SETUP   0x5F
 
#define AHCI_D2H_FIS_OFFSET   0x40
 
#define AHCI_PIO_FIS_OFFSET   0x20
 
#define AHCI_FIS_TYPE_MASK   0xFF
 
#define AHCI_PORT_START   0x0100
 
#define AHCI_PORT_REG_WIDTH   0x0080
 
#define AHCI_PORT_CLB   0x0000
 
#define AHCI_PORT_CLBU   0x0004
 
#define AHCI_PORT_FB   0x0008
 
#define AHCI_PORT_FBU   0x000C
 
#define AHCI_PORT_IS   0x0010
 
#define AHCI_PORT_IE   0x0014
 
#define AHCI_PORT_CMD   0x0018
 
#define AHCI_PORT_CMD_ST   BIT0
 
#define AHCI_PORT_CMD_SUD   BIT1
 
#define AHCI_PORT_CMD_POD   BIT2
 
#define AHCI_PORT_CMD_CLO   BIT3
 
#define AHCI_PORT_CMD_FRE   BIT4
 
#define AHCI_PORT_CMD_FR   BIT14
 
#define AHCI_PORT_CMD_CR   BIT15
 
#define AHCI_PORT_CMD_CPD   BIT20
 
#define AHCI_PORT_CMD_ATAPI   BIT24
 
#define AHCI_PORT_CMD_DLAE   BIT25
 
#define AHCI_PORT_CMD_ALPE   BIT26
 
#define AHCI_PORT_CMD_ACTIVE   (1 << 28)
 
#define AHCI_PORT_CMD_ICC_MASK   (BIT28 | BIT29 | BIT30 | BIT31)
 
#define AHCI_PORT_TFD   0x0020
 
#define AHCI_PORT_TFD_ERR   BIT0
 
#define AHCI_PORT_TFD_DRQ   BIT3
 
#define AHCI_PORT_TFD_BSY   BIT7
 
#define AHCI_PORT_TFD_MASK   (BIT7 | BIT3 | BIT0)
 
#define AHCI_PORT_SIG   0x0024
 
#define AHCI_PORT_SSTS   0x0028
 
#define AHCI_PORT_SSTS_DET_MASK   0x000F
 
#define AHCI_PORT_SSTS_DET   0x0001
 
#define AHCI_PORT_SSTS_DET_PCE   0x0003
 
#define AHCI_PORT_SCTL   0x002C
 
#define AHCI_PORT_SCTL_IPM_INIT   0x0300
 
#define AHCI_PORT_SERR   0x0030
 
#define AHCI_PORT_CI   0x0038
 
#define TIMER_PERIOD_SECONDS(Seconds)   MultU64x32((UINT64)(Seconds), 10000000)
 
#define AHCI_PEI_ATA_DEVICE_DATA_SIGNATURE   SIGNATURE_32 ('A', 'P', 'A', 'D')
 
#define AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS(a)
 
#define AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('A','P','C','P')
 
#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU(a)    CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, AtaPassThruPpi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
 
#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO(a)    CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, BlkIoPpi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
 
#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2(a)    CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, BlkIo2Ppi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
 
#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY(a)    CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, StorageSecurityPpi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
 
#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a)    CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, EndOfPeiNotifyList, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
 

Typedefs

typedef struct _PEI_AHCI_CONTROLLER_PRIVATE_DATA PEI_AHCI_CONTROLLER_PRIVATE_DATA
 

Functions

EFI_STATUS EFIAPI AtaAhciHostControllerPpiInstallationCallback (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
EFI_STATUS EFIAPI AtaAhciPciDevicePpiInstallationCallback (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
EFI_STATUS IoMmuAllocateBuffer (IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
EFI_STATUS IoMmuFreeBuffer (IN UINTN Pages, IN VOID *HostAddress, IN VOID *Mapping)
 
EFI_STATUS IoMmuMap (IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
EFI_STATUS IoMmuUnmap (IN VOID *Mapping)
 
EFI_STATUS EFIAPI AhciPeimEndOfPei (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
UINT8 AhciGetNumberOfPortsFromMap (IN UINT32 PortBitMap)
 
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 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)
 
EFI_STATUS GetDevicePathInstanceSize (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINTN *InstanceSize, OUT BOOLEAN *EntireDevicePathEnd)
 
EFI_STATUS AhciIsHcDevicePathValid (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN DevicePathLength)
 
EFI_STATUS AhciBuildDevicePath (IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
 
UINT8 AhciS3GetEumeratePorts (IN EFI_DEVICE_PATH_PROTOCOL *HcDevicePath, IN UINTN HcDevicePathLength, OUT UINT32 *PortBitMap)
 

Variables

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 AhciPei.h.

Macro Definition Documentation

◆ AHCI_ATA_DEVICE_SIG

#define AHCI_ATA_DEVICE_SIG   0x00000000

Definition at line 89 of file AhciPei.h.

◆ AHCI_ATAPI_SIG_MASK

#define AHCI_ATAPI_SIG_MASK   0xFFFF0000

Definition at line 88 of file AhciPei.h.

◆ AHCI_BUS_PHY_DETECT_TIMEOUT

#define AHCI_BUS_PHY_DETECT_TIMEOUT   15

Definition at line 50 of file AhciPei.h.

◆ AHCI_CAP_SAM

#define AHCI_CAP_SAM   BIT18

Definition at line 66 of file AhciPei.h.

◆ AHCI_CAP_SSS

#define AHCI_CAP_SSS   BIT27

Definition at line 67 of file AhciPei.h.

◆ AHCI_CAPABILITY_OFFSET

#define AHCI_CAPABILITY_OFFSET   0x0000

Definition at line 65 of file AhciPei.h.

◆ AHCI_D2H_FIS_OFFSET

#define AHCI_D2H_FIS_OFFSET   0x40

Definition at line 101 of file AhciPei.h.

◆ AHCI_FIS_PIO_SETUP

#define AHCI_FIS_PIO_SETUP   0x5F

Definition at line 99 of file AhciPei.h.

◆ AHCI_FIS_REGISTER_D2H

#define AHCI_FIS_REGISTER_D2H   0x34

Definition at line 98 of file AhciPei.h.

◆ AHCI_FIS_REGISTER_H2D

#define AHCI_FIS_REGISTER_H2D   0x27

Definition at line 96 of file AhciPei.h.

◆ AHCI_FIS_REGISTER_H2D_LENGTH

#define AHCI_FIS_REGISTER_H2D_LENGTH   20

Definition at line 97 of file AhciPei.h.

◆ AHCI_FIS_TYPE_MASK

#define AHCI_FIS_TYPE_MASK   0xFF

Definition at line 103 of file AhciPei.h.

◆ AHCI_GHC_ENABLE

#define AHCI_GHC_ENABLE   BIT31

Definition at line 71 of file AhciPei.h.

◆ AHCI_GHC_OFFSET

#define AHCI_GHC_OFFSET   0x0004

Definition at line 69 of file AhciPei.h.

◆ AHCI_GHC_RESET

#define AHCI_GHC_RESET   BIT0

Definition at line 70 of file AhciPei.h.

◆ AHCI_IS_OFFSET

#define AHCI_IS_OFFSET   0x0008

Definition at line 73 of file AhciPei.h.

◆ AHCI_MAX_DATA_PER_PRDT

#define AHCI_MAX_DATA_PER_PRDT   0x400000

Definition at line 94 of file AhciPei.h.

◆ AHCI_MAX_PORTS

#define AHCI_MAX_PORTS   32

Definition at line 76 of file AhciPei.h.

◆ AHCI_MAX_PRDT_NUMBER

#define AHCI_MAX_PRDT_NUMBER   8

Definition at line 63 of file AhciPei.h.

◆ AHCI_PEI_ATA_DEVICE_DATA_SIGNATURE

#define AHCI_PEI_ATA_DEVICE_DATA_SIGNATURE   SIGNATURE_32 ('A', 'P', 'A', 'D')

Definition at line 271 of file AhciPei.h.

◆ AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS

#define AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (   a)
Value:
CR (a, \
Link, \
AHCI_PEI_ATA_DEVICE_DATA_SIGNATURE \
);
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:659

Definition at line 294 of file AhciPei.h.

◆ AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE

#define AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('A','P','C','P')

Definition at line 304 of file AhciPei.h.

◆ AHCI_PEI_RESET_TIMEOUT

#define AHCI_PEI_RESET_TIMEOUT   10000000

Definition at line 55 of file AhciPei.h.

◆ AHCI_PI_OFFSET

#define AHCI_PI_OFFSET   0x000C

Definition at line 74 of file AhciPei.h.

◆ AHCI_PIO_FIS_OFFSET

#define AHCI_PIO_FIS_OFFSET   0x20

Definition at line 102 of file AhciPei.h.

◆ AHCI_PORT_CI

#define AHCI_PORT_CI   0x0038

Definition at line 147 of file AhciPei.h.

◆ AHCI_PORT_CLB

#define AHCI_PORT_CLB   0x0000

Definition at line 110 of file AhciPei.h.

◆ AHCI_PORT_CLBU

#define AHCI_PORT_CLBU   0x0004

Definition at line 111 of file AhciPei.h.

◆ AHCI_PORT_CMD

#define AHCI_PORT_CMD   0x0018

Definition at line 116 of file AhciPei.h.

◆ AHCI_PORT_CMD_ACTIVE

#define AHCI_PORT_CMD_ACTIVE   (1 << 28)

Definition at line 128 of file AhciPei.h.

◆ AHCI_PORT_CMD_ALPE

#define AHCI_PORT_CMD_ALPE   BIT26

Definition at line 127 of file AhciPei.h.

◆ AHCI_PORT_CMD_ATAPI

#define AHCI_PORT_CMD_ATAPI   BIT24

Definition at line 125 of file AhciPei.h.

◆ AHCI_PORT_CMD_CLO

#define AHCI_PORT_CMD_CLO   BIT3

Definition at line 120 of file AhciPei.h.

◆ AHCI_PORT_CMD_CPD

#define AHCI_PORT_CMD_CPD   BIT20

Definition at line 124 of file AhciPei.h.

◆ AHCI_PORT_CMD_CR

#define AHCI_PORT_CMD_CR   BIT15

Definition at line 123 of file AhciPei.h.

◆ AHCI_PORT_CMD_DLAE

#define AHCI_PORT_CMD_DLAE   BIT25

Definition at line 126 of file AhciPei.h.

◆ AHCI_PORT_CMD_FR

#define AHCI_PORT_CMD_FR   BIT14

Definition at line 122 of file AhciPei.h.

◆ AHCI_PORT_CMD_FRE

#define AHCI_PORT_CMD_FRE   BIT4

Definition at line 121 of file AhciPei.h.

◆ AHCI_PORT_CMD_ICC_MASK

#define AHCI_PORT_CMD_ICC_MASK   (BIT28 | BIT29 | BIT30 | BIT31)

Definition at line 129 of file AhciPei.h.

◆ AHCI_PORT_CMD_POD

#define AHCI_PORT_CMD_POD   BIT2

Definition at line 119 of file AhciPei.h.

◆ AHCI_PORT_CMD_ST

#define AHCI_PORT_CMD_ST   BIT0

Definition at line 117 of file AhciPei.h.

◆ AHCI_PORT_CMD_SUD

#define AHCI_PORT_CMD_SUD   BIT1

Definition at line 118 of file AhciPei.h.

◆ AHCI_PORT_FB

#define AHCI_PORT_FB   0x0008

Definition at line 112 of file AhciPei.h.

◆ AHCI_PORT_FBU

#define AHCI_PORT_FBU   0x000C

Definition at line 113 of file AhciPei.h.

◆ AHCI_PORT_IE

#define AHCI_PORT_IE   0x0014

Definition at line 115 of file AhciPei.h.

◆ AHCI_PORT_IS

#define AHCI_PORT_IS   0x0010

Definition at line 114 of file AhciPei.h.

◆ AHCI_PORT_REG_WIDTH

#define AHCI_PORT_REG_WIDTH   0x0080

Definition at line 109 of file AhciPei.h.

◆ AHCI_PORT_SCTL

#define AHCI_PORT_SCTL   0x002C

Definition at line 143 of file AhciPei.h.

◆ AHCI_PORT_SCTL_IPM_INIT

#define AHCI_PORT_SCTL_IPM_INIT   0x0300

Definition at line 144 of file AhciPei.h.

◆ AHCI_PORT_SERR

#define AHCI_PORT_SERR   0x0030

Definition at line 146 of file AhciPei.h.

◆ AHCI_PORT_SIG

#define AHCI_PORT_SIG   0x0024

Definition at line 137 of file AhciPei.h.

◆ AHCI_PORT_SSTS

#define AHCI_PORT_SSTS   0x0028

Definition at line 138 of file AhciPei.h.

◆ AHCI_PORT_SSTS_DET

#define AHCI_PORT_SSTS_DET   0x0001

Definition at line 140 of file AhciPei.h.

◆ AHCI_PORT_SSTS_DET_MASK

#define AHCI_PORT_SSTS_DET_MASK   0x000F

Definition at line 139 of file AhciPei.h.

◆ AHCI_PORT_SSTS_DET_PCE

#define AHCI_PORT_SSTS_DET_PCE   0x0003

Definition at line 141 of file AhciPei.h.

◆ AHCI_PORT_START

#define AHCI_PORT_START   0x0100

Definition at line 108 of file AhciPei.h.

◆ AHCI_PORT_TFD

#define AHCI_PORT_TFD   0x0020

Definition at line 131 of file AhciPei.h.

◆ AHCI_PORT_TFD_BSY

#define AHCI_PORT_TFD_BSY   BIT7

Definition at line 134 of file AhciPei.h.

◆ AHCI_PORT_TFD_DRQ

#define AHCI_PORT_TFD_DRQ   BIT3

Definition at line 133 of file AhciPei.h.

◆ AHCI_PORT_TFD_ERR

#define AHCI_PORT_TFD_ERR   BIT0

Definition at line 132 of file AhciPei.h.

◆ AHCI_PORT_TFD_MASK

#define AHCI_PORT_TFD_MASK   (BIT7 | BIT3 | BIT0)

Definition at line 135 of file AhciPei.h.

◆ ATA_TIMEOUT

#define ATA_TIMEOUT   30000000

Definition at line 59 of file AhciPei.h.

◆ GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO

#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (   a)     CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, BlkIoPpi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)

Definition at line 339 of file AhciPei.h.

◆ GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2

#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (   a)     CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, BlkIo2Ppi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)

Definition at line 341 of file AhciPei.h.

◆ GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY

#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY (   a)     CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, EndOfPeiNotifyList, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)

Definition at line 345 of file AhciPei.h.

◆ GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU

#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (   a)     CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, AtaPassThruPpi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)

Definition at line 337 of file AhciPei.h.

◆ GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY

#define GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (   a)     CR (a, PEI_AHCI_CONTROLLER_PRIVATE_DATA, StorageSecurityPpi, AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)

Definition at line 343 of file AhciPei.h.

◆ TIMER_PERIOD_SECONDS

#define TIMER_PERIOD_SECONDS (   Seconds)    MultU64x32((UINT64)(Seconds), 10000000)

Definition at line 149 of file AhciPei.h.

Typedef Documentation

◆ PEI_AHCI_CONTROLLER_PRIVATE_DATA

Function Documentation

◆ AhciBuildDevicePath()

EFI_STATUS AhciBuildDevicePath ( IN PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
OUT UINTN DevicePathLength,
OUT EFI_DEVICE_PATH_PROTOCOL **  DevicePath 
)

Build the device path for an ATA device with given port and port multiplier number.

Parameters
[in]PrivateA pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA data structure.
[in]PortThe given port number.
[in]PortMultiplierPortThe given port multiplier number.
[out]DevicePathLengthThe length of the device path in bytes specified by DevicePath.
[out]DevicePathThe device path of ATA device.
Return values
EFI_SUCCESSThe operation succeeds.
EFI_INVALID_PARAMETERThe parameters are invalid.
EFI_OUT_OF_RESOURCESThe operation fails due to lack of resources.

Definition at line 177 of file DevicePath.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.

◆ AhciIsHcDevicePathValid()

EFI_STATUS AhciIsHcDevicePathValid ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath,
IN UINTN  DevicePathLength 
)

Check the validity of the device path of a ATA AHCI host controller.

Parameters
[in]DevicePathA pointer to the EFI_DEVICE_PATH_PROTOCOL structure.
[in]DevicePathLengthThe length of the device path.
Return values
EFI_SUCCESSThe device path is valid.
EFI_INVALID_PARAMETERThe device path is invalid.

Definition at line 106 of file DevicePath.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.

◆ AhciPeimEndOfPei()

EFI_STATUS EFIAPI AhciPeimEndOfPei ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

One notified function to cleanup the allocated DMA buffers at EndOfPei.

Parameters
[in]PeiServicesPointer to PEI Services Table.
[in]NotifyDescriptorPointer to the descriptor for the Notification event that caused this function to execute.
[in]PpiPointer to the PPI data associated with this function.
Return values
EFI_SUCCESSThe function completes successfully

Definition at line 114 of file AhciPei.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.

◆ AhciS3GetEumeratePorts()

UINT8 AhciS3GetEumeratePorts ( IN EFI_DEVICE_PATH_PROTOCOL HcDevicePath,
IN UINTN  HcDevicePathLength,
OUT UINT32 *  PortBitMap 
)

Collect the ports that need to be enumerated on a controller for S3 phase.

Parameters
[in]HcDevicePathDevice path of the controller.
[in]HcDevicePathLengthLength of the device path specified by HcDevicePath.
[out]PortBitMapBitmap that indicates the ports that need to be enumerated on the controller.
Return values
Thenumber of ports that need to be enumerated.

Definition at line 30 of file AhciPeiS3.c.

◆ AtaAhciHostControllerPpiInstallationCallback()

EFI_STATUS EFIAPI AtaAhciHostControllerPpiInstallationCallback ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

Callback for EDKII_ATA_AHCI_HOST_CONTROLLER_PPI installation.

Parameters
[in]PeiServicesPointer to PEI Services Table.
[in]NotifyDescriptorPointer to the descriptor for the Notification event that caused this function to execute.
[in]PpiPointer to the PPI data associated with this function.
Return values
EFI_SUCCESSThe function completes successfully
OthersCannot initialize AHCI controller from given EDKII_ATA_AHCI_HOST_CONTROLLER_PPI

Definition at line 376 of file AhciPei.c.

◆ AtaAhciPciDevicePpiInstallationCallback()

EFI_STATUS EFIAPI AtaAhciPciDevicePpiInstallationCallback ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

Callback for EDKII_PCI_DEVICE_PPI installation.

Parameters
[in]PeiServicesPointer to PEI Services Table.
[in]NotifyDescriptorPointer to the descriptor for the Notification event that caused this function to execute.
[in]PpiPointer to the PPI data associated with this function.
Return values
EFI_SUCCESSThe function completes successfully
OthersCannot initialize AHCI controller from given PCI_DEVICE_PPI

Definition at line 496 of file AhciPei.c.

◆ GetDevicePathInstanceSize()

EFI_STATUS GetDevicePathInstanceSize ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath,
OUT UINTN InstanceSize,
OUT BOOLEAN *  EntireDevicePathEnd 
)

Get the size of the current device path instance.

Parameters
[in]DevicePathA pointer to the EFI_DEVICE_PATH_PROTOCOL structure.
[out]InstanceSizeThe size of the current device path instance.
[out]EntireDevicePathEndIndicate whether the instance is the last one in the device path strucure.
Return values
EFI_SUCCESSThe size of the current device path instance is fetched.
OthersFails to get the size of the current device path instance.

Definition at line 55 of file DevicePath.c.

◆ IoMmuAllocateBuffer()

EFI_STATUS IoMmuAllocateBuffer ( IN UINTN  Pages,
OUT VOID **  HostAddress,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress,
OUT VOID **  Mapping 
)

Allocates pages that are suitable for an OperationBusMasterCommonBuffer or OperationBusMasterCommonBuffer64 mapping.

Parameters
PagesThe number of pages to allocate.
HostAddressA pointer to store the base system memory address of the allocated range.
DeviceAddressThe resulting map address for the bus master PCI controller to use to access the hosts HostAddress.
MappingA resulting value to pass to Unmap().
Return values
EFI_SUCCESSThe requested memory pages were allocated.
EFI_UNSUPPORTEDAttributes is unsupported. The only legal attribute bits are MEMORY_WRITE_COMBINE and MEMORY_CACHED.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESThe memory pages could not be allocated.

Definition at line 170 of file DmaMem.c.

◆ IoMmuFreeBuffer()

EFI_STATUS IoMmuFreeBuffer ( IN UINTN  Pages,
IN VOID *  HostAddress,
IN VOID *  Mapping 
)

Frees memory that was allocated with AllocateBuffer().

Parameters
PagesThe number of pages to free.
HostAddressThe base system memory address of the allocated range.
MappingThe mapping value returned from Map().
Return values
EFI_SUCCESSThe requested memory pages were freed.
EFI_INVALID_PARAMETERThe memory range specified by HostAddress and Pages was not allocated with AllocateBuffer().

Definition at line 251 of file DmaMem.c.

◆ IoMmuMap()

EFI_STATUS IoMmuMap ( IN EDKII_IOMMU_OPERATION  Operation,
IN VOID *  HostAddress,
IN OUT UINTN NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress,
OUT VOID **  Mapping 
)

Provides the controller-specific addresses required to access system memory from a DMA bus master.

Parameters
OperationIndicates if the bus master is going to read or write to system memory.
HostAddressThe system memory address to map to the PCI controller.
NumberOfBytesOn input the number of bytes to map. On output the number of bytes that were mapped.
DeviceAddressThe resulting map address for the bus master PCI controller to use to access the hosts HostAddress.
MappingA resulting value to pass to Unmap().
Return values
EFI_SUCCESSThe range was mapped for the returned NumberOfBytes.
EFI_UNSUPPORTEDThe HostAddress cannot be mapped as a common buffer.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_DEVICE_ERRORThe system hardware could not map the requested address.

Definition at line 60 of file DmaMem.c.

◆ IoMmuUnmap()

EFI_STATUS IoMmuUnmap ( IN VOID *  Mapping)

Completes the Map() operation and releases any corresponding resources.

Parameters
MappingThe mapping value returned from Map().
Return values
EFI_SUCCESSThe range was unmapped.
EFI_INVALID_PARAMETERMapping is not a value that was returned by Map().
EFI_DEVICE_ERRORThe data was not committed to the target system memory.

Definition at line 132 of file DmaMem.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

◆ mMaxTransferBlockNumber

UINT32 mMaxTransferBlockNumber[2]
extern

Definition at line 59 of file AhciMode.c.