TianoCore EDK2 master
Loading...
Searching...
No Matches
EmmcHci.c File Reference
#include "EmmcBlockIoPei.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI EmmcPeimHcRwMmio (IN UINTN Address, IN BOOLEAN Read, IN UINT8 Count, IN OUT VOID *Data)
 
EFI_STATUS EFIAPI EmmcPeimHcOrMmio (IN UINTN Address, IN UINT8 Count, IN VOID *OrData)
 
EFI_STATUS EFIAPI EmmcPeimHcAndMmio (IN UINTN Address, IN UINT8 Count, IN VOID *AndData)
 
EFI_STATUS EFIAPI EmmcPeimHcCheckMmioSet (IN UINTN Address, IN UINT8 Count, IN UINT64 MaskValue, IN UINT64 TestValue)
 
EFI_STATUS EFIAPI EmmcPeimHcWaitMmioSet (IN UINTN Address, IN UINT8 Count, IN UINT64 MaskValue, IN UINT64 TestValue, IN UINT64 Timeout)
 
EFI_STATUS EmmcPeimHcReset (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcEnableInterrupt (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcGetCapability (IN UINTN Bar, OUT EMMC_HC_SLOT_CAP *Capability)
 
EFI_STATUS EmmcPeimHcCardDetect (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcStopClock (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcClockSupply (IN UINTN Bar, IN UINT64 ClockFreq)
 
EFI_STATUS EmmcPeimHcPowerControl (IN UINTN Bar, IN UINT8 PowerCtrl)
 
EFI_STATUS EmmcPeimHcSetBusWidth (IN UINTN Bar, IN UINT16 BusWidth)
 
EFI_STATUS EmmcPeimHcInitClockFreq (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcInitPowerVoltage (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcInitTimeoutCtrl (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcInitHost (IN UINTN Bar)
 
EFI_STATUS EmmcPeimHcLedOnOff (IN UINTN Bar, IN BOOLEAN On)
 
EFI_STATUS BuildAdmaDescTable (IN EMMC_TRB *Trb)
 
EMMC_TRBEmmcPeimCreateTrb (IN EMMC_PEIM_HC_SLOT *Slot, IN EMMC_COMMAND_PACKET *Packet)
 
VOID EmmcPeimFreeTrb (IN EMMC_TRB *Trb)
 
EFI_STATUS EmmcPeimCheckTrbEnv (IN UINTN Bar, IN EMMC_TRB *Trb)
 
EFI_STATUS EmmcPeimWaitTrbEnv (IN UINTN Bar, IN EMMC_TRB *Trb)
 
EFI_STATUS EmmcPeimExecTrb (IN UINTN Bar, IN EMMC_TRB *Trb)
 
EFI_STATUS EmmcPeimCheckTrbResult (IN UINTN Bar, IN EMMC_TRB *Trb)
 
EFI_STATUS EmmcPeimWaitTrbResult (IN UINTN Bar, IN EMMC_TRB *Trb)
 
EFI_STATUS EFIAPI EmmcPeimExecCmd (IN EMMC_PEIM_HC_SLOT *Slot, IN OUT EMMC_COMMAND_PACKET *Packet)
 
EFI_STATUS EmmcPeimReset (IN EMMC_PEIM_HC_SLOT *Slot)
 
EFI_STATUS EmmcPeimGetOcr (IN EMMC_PEIM_HC_SLOT *Slot, IN OUT UINT32 *Argument)
 
EFI_STATUS EmmcPeimGetAllCid (IN EMMC_PEIM_HC_SLOT *Slot)
 
EFI_STATUS EmmcPeimSetRca (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca)
 
EFI_STATUS EmmcPeimGetCsd (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, OUT EMMC_CSD *Csd)
 
EFI_STATUS EmmcPeimSelect (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca)
 
EFI_STATUS EmmcPeimGetExtCsd (IN EMMC_PEIM_HC_SLOT *Slot, OUT EMMC_EXT_CSD *ExtCsd)
 
EFI_STATUS EmmcPeimSwitch (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT8 Access, IN UINT8 Index, IN UINT8 Value, IN UINT8 CmdSet)
 
EFI_STATUS EmmcPeimSendStatus (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, OUT UINT32 *DevStatus)
 
EFI_STATUS EmmcPeimSetBlkCount (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT16 BlockCount)
 
EFI_STATUS EmmcPeimRwMultiBlocks (IN EMMC_PEIM_HC_SLOT *Slot, IN EFI_LBA Lba, IN UINT32 BlockSize, IN VOID *Buffer, IN UINTN BufferSize, IN BOOLEAN IsRead)
 
EFI_STATUS EmmcPeimSendTuningBlk (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT8 BusWidth)
 
EFI_STATUS EmmcPeimTuningClkForHs200 (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT8 BusWidth)
 
EFI_STATUS EmmcPeimSwitchBusWidth (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN BOOLEAN IsDdr, IN UINT8 BusWidth)
 
EFI_STATUS EmmcPeimSwitchClockFreq (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN UINT8 HsTiming, IN UINT32 ClockFreq)
 
EFI_STATUS EmmcPeimSwitchToHighSpeed (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN UINT32 ClockFreq, IN BOOLEAN IsDdr, IN UINT8 BusWidth)
 
EFI_STATUS EmmcPeimSwitchToHS200 (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN UINT32 ClockFreq, IN UINT8 BusWidth)
 
EFI_STATUS EmmcPeimSwitchToHS400 (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN UINT32 ClockFreq)
 
EFI_STATUS EmmcPeimSetBusMode (IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca)
 
EFI_STATUS EmmcPeimIdentification (IN EMMC_PEIM_HC_SLOT *Slot)
 

Detailed Description

Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file EmmcHci.c.

Function Documentation

◆ BuildAdmaDescTable()

EFI_STATUS BuildAdmaDescTable ( IN EMMC_TRB Trb)

Build ADMA descriptor table for transfer.

Refer to SD Host Controller Simplified spec 3.0 Section 1.13 for details.

Parameters
[in]TrbThe pointer to the EMMC_TRB instance.
Return values
EFI_SUCCESSThe ADMA descriptor table is created successfully.
OthersThe ADMA descriptor table isn't created successfully.

Definition at line 930 of file EmmcHci.c.

◆ EmmcPeimCheckTrbEnv()

EFI_STATUS EmmcPeimCheckTrbEnv ( IN UINTN  Bar,
IN EMMC_TRB Trb 
)

Check if the env is ready for execute specified TRB.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]TrbThe pointer to the EMMC_TRB instance.
Return values
EFI_SUCCESSThe env is ready for TRB execution.
EFI_NOT_READYThe env is not ready for TRB execution.
OthersSome erros happen.

Definition at line 1130 of file EmmcHci.c.

◆ EmmcPeimCheckTrbResult()

EFI_STATUS EmmcPeimCheckTrbResult ( IN UINTN  Bar,
IN EMMC_TRB Trb 
)

Check the TRB execution result.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]TrbThe pointer to the EMMC_TRB instance.
Return values
EFI_SUCCESSThe TRB is executed successfully.
EFI_NOT_READYThe TRB is not completed for execution.
OthersSome erros happen when executing this request.

Definition at line 1403 of file EmmcHci.c.

◆ EmmcPeimCreateTrb()

EMMC_TRB * EmmcPeimCreateTrb ( IN EMMC_PEIM_HC_SLOT Slot,
IN EMMC_COMMAND_PACKET Packet 
)

Create a new TRB for the EMMC cmd request.

Parameters
[in]SlotThe slot number of the EMMC card to send the command to.
[in]PacketA pointer to the SD command data structure.
Returns
Created Trb or NULL.

Definition at line 1003 of file EmmcHci.c.

◆ EmmcPeimExecCmd()

EFI_STATUS EFIAPI EmmcPeimExecCmd ( IN EMMC_PEIM_HC_SLOT Slot,
IN OUT EMMC_COMMAND_PACKET Packet 
)

Sends EMMC command to an EMMC card that is attached to the EMMC controller.

If Packet is successfully sent to the EMMC card, then EFI_SUCCESS is returned.

If a device error occurs while sending the Packet, then EFI_DEVICE_ERROR is returned.

If Slot is not in a valid range for the EMMC controller, then EFI_INVALID_PARAMETER is returned.

If Packet defines a data command but both InDataBuffer and OutDataBuffer are NULL, EFI_INVALID_PARAMETER is returned.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in,out]PacketA pointer to the EMMC command data structure.
Return values
EFI_SUCCESSThe EMMC Command Packet was sent by the host.
EFI_DEVICE_ERRORA device error occurred while attempting to send the SD command Packet.
EFI_INVALID_PARAMETERPacket, Slot, or the contents of the Packet is invalid.
EFI_INVALID_PARAMETERPacket defines a data command but both InDataBuffer and OutDataBuffer are NULL.
EFI_NO_MEDIASD Device not present in the Slot.
EFI_UNSUPPORTEDThe command described by the EMMC Command Packet is not supported by the host controller.
EFI_BAD_BUFFER_SIZEThe InTransferLength or OutTransferLength exceeds the limit supported by EMMC card ( i.e. if the number of bytes exceed the Last LBA).

Definition at line 1694 of file EmmcHci.c.

◆ EmmcPeimExecTrb()

EFI_STATUS EmmcPeimExecTrb ( IN UINTN  Bar,
IN EMMC_TRB Trb 
)

Execute the specified TRB.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]TrbThe pointer to the EMMC_TRB instance.
Return values
EFI_SUCCESSThe TRB is sent to host controller successfully.
OthersSome erros happen when sending this request to the host controller.

Definition at line 1232 of file EmmcHci.c.

◆ EmmcPeimFreeTrb()

VOID EmmcPeimFreeTrb ( IN EMMC_TRB Trb)

Free the resource used by the TRB.

Parameters
[in]TrbThe pointer to the EMMC_TRB instance.

Definition at line 1099 of file EmmcHci.c.

◆ EmmcPeimGetAllCid()

EFI_STATUS EmmcPeimGetAllCid ( IN EMMC_PEIM_HC_SLOT Slot)

Broadcast command ALL_SEND_CID to the bus to ask all the EMMC devices to send the data of their CID registers.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 1845 of file EmmcHci.c.

◆ EmmcPeimGetCsd()

EFI_STATUS EmmcPeimGetCsd ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
OUT EMMC_CSD Csd 
)

Send command SEND_CSD to the EMMC device to get the data of the CSD register.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address of selected device.
[out]CsdThe buffer to store the content of the CSD register. Note the caller should ignore the lowest byte of this buffer as the content of this byte is meaningless even if the operation succeeds.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 1931 of file EmmcHci.c.

◆ EmmcPeimGetExtCsd()

EFI_STATUS EmmcPeimGetExtCsd ( IN EMMC_PEIM_HC_SLOT Slot,
OUT EMMC_EXT_CSD ExtCsd 
)

Send command SEND_EXT_CSD to the EMMC device to get the data of the EXT_CSD register.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[out]ExtCsdThe buffer to store the content of the EXT_CSD register.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2020 of file EmmcHci.c.

◆ EmmcPeimGetOcr()

EFI_STATUS EmmcPeimGetOcr ( IN EMMC_PEIM_HC_SLOT Slot,
IN OUT UINT32 *  Argument 
)

Send command SEND_OP_COND to the EMMC device to get the data of the OCR register.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in,out]ArgumentOn input, the argument of SEND_OP_COND is to send to the device. On output, the argument is the value of OCR register.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 1798 of file EmmcHci.c.

◆ EmmcPeimHcAndMmio()

EFI_STATUS EFIAPI EmmcPeimHcAndMmio ( IN UINTN  Address,
IN UINT8  Count,
IN VOID *  AndData 
)

Do AND operation with the value of the specified EMMC host controller mmio register.

Parameters
[in]AddressThe address of the mmio register to be read/written.
[in]CountThe width of the mmio register in bytes. Must be 1, 2 , 4 or 8 bytes.
[in]AndDataThe pointer to the data used to do AND operation. The caller is responsible for having ownership of the data buffer and ensuring its size not less than Count bytes.
Return values
EFI_INVALID_PARAMETERThe Address or the AndData or the Count is not valid.
EFI_SUCCESSThe AND operation succeeds.
OthersThe AND operation fails.

Definition at line 155 of file EmmcHci.c.

◆ EmmcPeimHcCardDetect()

EFI_STATUS EmmcPeimHcCardDetect ( IN UINTN  Bar)

Detect whether there is a EMMC card attached at the specified EMMC host controller slot.

Refer to SD Host Controller Simplified spec 3.0 Section 3.1 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThere is a EMMC card attached.
EFI_NO_MEDIAThere is not a EMMC card attached.
OthersThe detection fails.

Definition at line 414 of file EmmcHci.c.

◆ EmmcPeimHcCheckMmioSet()

EFI_STATUS EFIAPI EmmcPeimHcCheckMmioSet ( IN UINTN  Address,
IN UINT8  Count,
IN UINT64  MaskValue,
IN UINT64  TestValue 
)

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

Parameters
[in]AddressThe address of the mmio register to be checked.
[in]CountThe width of the mmio register in bytes. Must be 1, 2, 4 or 8 bytes.
[in]MaskValueThe mask value of memory.
[in]TestValueThe test value of memory.
Return values
EFI_NOT_READYThe MMIO register hasn't set to the expected value.
EFI_SUCCESSThe MMIO register has expected value.
OthersThe MMIO operation fails.

Definition at line 204 of file EmmcHci.c.

◆ EmmcPeimHcClockSupply()

EFI_STATUS EmmcPeimHcClockSupply ( IN UINTN  Bar,
IN UINT64  ClockFreq 
)

EMMC card clock supply.

Refer to SD Host Controller Simplified spec 3.0 Section 3.2.1 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]ClockFreqThe max clock frequency to be set. The unit is KHz.
Return values
EFI_SUCCESSThe clock is supplied successfully.
OthersThe clock isn't supplied successfully.

Definition at line 514 of file EmmcHci.c.

◆ EmmcPeimHcEnableInterrupt()

EFI_STATUS EmmcPeimHcEnableInterrupt ( IN UINTN  Bar)

Set all interrupt status bits in Normal and Error Interrupt Status Enable register.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThe operation executes successfully.
OthersThe operation fails.

Definition at line 346 of file EmmcHci.c.

◆ EmmcPeimHcGetCapability()

EFI_STATUS EmmcPeimHcGetCapability ( IN UINTN  Bar,
OUT EMMC_HC_SLOT_CAP Capability 
)

Get the capability data from the specified slot.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[out]CapabilityThe buffer to store the capability data.
Return values
EFI_SUCCESSThe operation executes successfully.
OthersThe operation fails.

Definition at line 382 of file EmmcHci.c.

◆ EmmcPeimHcInitClockFreq()

EFI_STATUS EmmcPeimHcInitClockFreq ( IN UINTN  Bar)

Supply EMMC card with lowest clock frequency at initialization.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThe clock is supplied successfully.
OthersThe clock isn't supplied successfully.

Definition at line 734 of file EmmcHci.c.

◆ EmmcPeimHcInitHost()

EFI_STATUS EmmcPeimHcInitHost ( IN UINTN  Bar)

Initial EMMC host controller with lowest clock frequency, max power and max timeout value at initialization.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThe host controller is initialized successfully.
OthersThe host controller isn't initialized successfully.

Definition at line 868 of file EmmcHci.c.

◆ EmmcPeimHcInitPowerVoltage()

EFI_STATUS EmmcPeimHcInitPowerVoltage ( IN UINTN  Bar)

Supply EMMC card with maximum voltage at initialization.

Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThe voltage is supplied successfully.
OthersThe voltage isn't supplied successfully.

Definition at line 777 of file EmmcHci.c.

◆ EmmcPeimHcInitTimeoutCtrl()

EFI_STATUS EmmcPeimHcInitTimeoutCtrl ( IN UINTN  Bar)

Initialize the Timeout Control register with most conservative value at initialization.

Refer to SD Host Controller Simplified spec 3.0 Section 2.2.15 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThe timeout control register is configured successfully.
OthersThe timeout control register isn't configured successfully.

Definition at line 844 of file EmmcHci.c.

◆ EmmcPeimHcLedOnOff()

EFI_STATUS EmmcPeimHcLedOnOff ( IN UINTN  Bar,
IN BOOLEAN  On 
)

Turn on/off LED.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]OnThe boolean to turn on/off LED.
Return values
EFI_SUCCESSThe LED is turned on/off successfully.
OthersThe LED isn't turned on/off successfully.

Definition at line 899 of file EmmcHci.c.

◆ EmmcPeimHcOrMmio()

EFI_STATUS EFIAPI EmmcPeimHcOrMmio ( IN UINTN  Address,
IN UINT8  Count,
IN VOID *  OrData 
)

Do OR operation with the value of the specified EMMC host controller mmio register.

Parameters
[in]AddressThe address of the mmio register to be read/written.
[in]CountThe width of the mmio register in bytes. Must be 1, 2 , 4 or 8 bytes.
[in]OrDataThe pointer to the data used to do OR operation. The caller is responsible for having ownership of the data buffer and ensuring its size not less than Count bytes.
Return values
EFI_INVALID_PARAMETERThe Address or the OrData or the Count is not valid.
EFI_SUCCESSThe OR operation succeeds.
OthersThe OR operation fails.

Definition at line 104 of file EmmcHci.c.

◆ EmmcPeimHcPowerControl()

EFI_STATUS EmmcPeimHcPowerControl ( IN UINTN  Bar,
IN UINT8  PowerCtrl 
)

EMMC bus power control.

Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]PowerCtrlThe value setting to the power control register.
Return values
TRUEThere is a EMMC card attached.
FALSEThere is no a EMMC card attached.

Definition at line 649 of file EmmcHci.c.

◆ EmmcPeimHcReset()

EFI_STATUS EmmcPeimHcReset ( IN UINTN  Bar)

Software reset the specified EMMC host controller and enable all interrupts.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSThe software reset executes successfully.
OthersThe software reset fails.

Definition at line 300 of file EmmcHci.c.

◆ EmmcPeimHcRwMmio()

EFI_STATUS EFIAPI EmmcPeimHcRwMmio ( IN UINTN  Address,
IN BOOLEAN  Read,
IN UINT8  Count,
IN OUT VOID *  Data 
)

Read/Write specified EMMC host controller mmio register.

Parameters
[in]AddressThe address of the mmio register to be read/written.
[in]ReadA boolean to indicate it's read or write operation.
[in]CountThe width of the mmio register in bytes. Must be 1, 2 , 4 or 8 bytes.
[in,out]DataFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from. The caller is responsible for having ownership of the data buffer and ensuring its size not less than Count bytes.
Return values
EFI_INVALID_PARAMETERThe Address or the Data or the Count is not valid.
EFI_SUCCESSThe read/write operation succeeds.
OthersThe read/write operation fails.

Definition at line 30 of file EmmcHci.c.

◆ EmmcPeimHcSetBusWidth()

EFI_STATUS EmmcPeimHcSetBusWidth ( IN UINTN  Bar,
IN UINT16  BusWidth 
)

Set the EMMC bus width.

Refer to SD Host Controller Simplified spec 3.0 Section 3.4 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]BusWidthThe bus width used by the EMMC device, it must be 1, 4 or 8.
Return values
EFI_SUCCESSThe bus width is set successfully.
OthersThe bus width isn't set successfully.

Definition at line 687 of file EmmcHci.c.

◆ EmmcPeimHcStopClock()

EFI_STATUS EmmcPeimHcStopClock ( IN UINTN  Bar)

Stop EMMC card clock.

Refer to SD Host Controller Simplified spec 3.0 Section 3.2.2 for details.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
Return values
EFI_SUCCESSSucceed to stop EMMC clock.
OthersFail to stop EMMC clock.

Definition at line 468 of file EmmcHci.c.

◆ EmmcPeimHcWaitMmioSet()

EFI_STATUS EFIAPI EmmcPeimHcWaitMmioSet ( IN UINTN  Address,
IN UINT8  Count,
IN UINT64  MaskValue,
IN UINT64  TestValue,
IN UINT64  Timeout 
)

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

Parameters
[in]AddressThe address of the mmio register to wait.
[in]CountThe width of the mmio register in bytes. Must be 1, 2, 4 or 8 bytes.
[in]MaskValueThe mask value of memory.
[in]TestValueThe test value of memory.
[in]TimeoutThe time out value for wait memory set, uses 1 microsecond as a unit.
Return values
EFI_TIMEOUTThe MMIO register hasn't expected value in timeout range.
EFI_SUCCESSThe MMIO register has expected value.
OthersThe MMIO operation fails.

Definition at line 251 of file EmmcHci.c.

◆ EmmcPeimIdentification()

EFI_STATUS EmmcPeimIdentification ( IN EMMC_PEIM_HC_SLOT Slot)

Execute EMMC device identification procedure.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
Return values
EFI_SUCCESSThere is a EMMC card.
OthersThere is not a EMMC card.

Definition at line 2894 of file EmmcHci.c.

◆ EmmcPeimReset()

EFI_STATUS EmmcPeimReset ( IN EMMC_PEIM_HC_SLOT Slot)

Send command GO_IDLE_STATE (CMD0 with argument of 0x00000000) to the device to make it go to Idle State.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
Return values
EFI_SUCCESSThe EMMC device is reset correctly.
OthersThe device reset fails.

Definition at line 1757 of file EmmcHci.c.

◆ EmmcPeimRwMultiBlocks()

EFI_STATUS EmmcPeimRwMultiBlocks ( IN EMMC_PEIM_HC_SLOT Slot,
IN EFI_LBA  Lba,
IN UINT32  BlockSize,
IN VOID *  Buffer,
IN UINTN  BufferSize,
IN BOOLEAN  IsRead 
)

Send command READ_MULTIPLE_BLOCK/WRITE_MULTIPLE_BLOCK to the addressed EMMC device to read/write the specified number of blocks.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]LbaThe logical block address of starting access.
[in]BlockSizeThe block size of specified EMMC device partition.
[in]BufferThe pointer to the transfer buffer.
[in]BufferSizeThe size of transfer buffer.
[in]IsReadBoolean to show the operation direction.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2204 of file EmmcHci.c.

◆ EmmcPeimSelect()

EFI_STATUS EmmcPeimSelect ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca 
)

Send command SELECT_DESELECT_CARD to the EMMC device to select/deselect it.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address of selected device.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 1979 of file EmmcHci.c.

◆ EmmcPeimSendStatus()

EFI_STATUS EmmcPeimSendStatus ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
OUT UINT32 *  DevStatus 
)

Send command SEND_STATUS to the addressed EMMC device to get its status register.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address of addressed device.
[out]DevStatusThe returned device status.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2112 of file EmmcHci.c.

◆ EmmcPeimSendTuningBlk()

EFI_STATUS EmmcPeimSendTuningBlk ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT8  BusWidth 
)

Send command SEND_TUNING_BLOCK to the EMMC device for HS200 optimal sampling point detection.

It may be sent up to 40 times until the host finishes the tuning procedure.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]BusWidthThe bus width to work.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2276 of file EmmcHci.c.

◆ EmmcPeimSetBlkCount()

EFI_STATUS EmmcPeimSetBlkCount ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT16  BlockCount 
)

Send command SET_BLOCK_COUNT to the addressed EMMC device to set the number of blocks for the following block read/write cmd.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]BlockCountThe number of the logical block to access.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2158 of file EmmcHci.c.

◆ EmmcPeimSetBusMode()

EFI_STATUS EmmcPeimSetBusMode ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca 
)

Switch the high speed timing according to request.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 section Figure 2-29 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2761 of file EmmcHci.c.

◆ EmmcPeimSetRca()

EFI_STATUS EmmcPeimSetRca ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca 
)

Send command SET_RELATIVE_ADDR to the EMMC device to assign a Relative device Address (RCA).

Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 1886 of file EmmcHci.c.

◆ EmmcPeimSwitch()

EFI_STATUS EmmcPeimSwitch ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT8  Access,
IN UINT8  Index,
IN UINT8  Value,
IN UINT8  CmdSet 
)

Send command SWITCH to the EMMC device to switch the mode of operation of the selected Device or modifies the EXT_CSD registers.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]AccessThe access mode of SWITCH command.
[in]IndexThe offset of the field to be access.
[in]ValueThe value to be set to the specified field of EXT_CSD register.
[in]CmdSetThe value of CmdSet field of EXT_CSD register.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2067 of file EmmcHci.c.

◆ EmmcPeimSwitchBusWidth()

EFI_STATUS EmmcPeimSwitchBusWidth ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
IN BOOLEAN  IsDdr,
IN UINT8  BusWidth 
)

Switch the bus width to specified width.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.9 and SD Host Controller Simplified Spec 3.0 section Figure 3-7 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
[in]IsDdrIf TRUE, use dual data rate data simpling method. Otherwise use single data rate data simpling method.
[in]BusWidthThe bus width to be set, it could be 4 or 8.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2401 of file EmmcHci.c.

◆ EmmcPeimSwitchClockFreq()

EFI_STATUS EmmcPeimSwitchClockFreq ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
IN UINT8  HsTiming,
IN UINT32  ClockFreq 
)

Switch the clock frequency to the specified value.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6 and SD Host Controller Simplified Spec 3.0 section Figure 3-3 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
[in]HsTimingThe value to be written to HS_TIMING field of EXT_CSD register.
[in]ClockFreqThe max clock frequency to be set, the unit is MHz.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2471 of file EmmcHci.c.

◆ EmmcPeimSwitchToHighSpeed()

EFI_STATUS EmmcPeimSwitchToHighSpeed ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
IN UINT32  ClockFreq,
IN BOOLEAN  IsDdr,
IN UINT8  BusWidth 
)

Switch to the High Speed timing according to request.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 section Figure 2-29 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
[in]ClockFreqThe max clock frequency to be set.
[in]IsDdrIf TRUE, use dual data rate data simpling method. Otherwise use single data rate data simpling method.
[in]BusWidthThe bus width to be set, it could be 4 or 8.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2536 of file EmmcHci.c.

◆ EmmcPeimSwitchToHS200()

EFI_STATUS EmmcPeimSwitchToHS200 ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
IN UINT32  ClockFreq,
IN UINT8  BusWidth 
)

Switch to the HS200 timing according to request.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 section Figure 2-29 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
[in]ClockFreqThe max clock frequency to be set.
[in]BusWidthThe bus width to be set, it could be 4 or 8.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2604 of file EmmcHci.c.

◆ EmmcPeimSwitchToHS400()

EFI_STATUS EmmcPeimSwitchToHS400 ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT32  Rca,
IN UINT32  ClockFreq 
)

Switch to the HS400 timing according to request.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 section Figure 2-29 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]RcaThe relative device address to be assigned.
[in]ClockFreqThe max clock frequency to be set.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2694 of file EmmcHci.c.

◆ EmmcPeimTuningClkForHs200()

EFI_STATUS EmmcPeimTuningClkForHs200 ( IN EMMC_PEIM_HC_SLOT Slot,
IN UINT8  BusWidth 
)

Tuning the clock to get HS200 optimal sampling point.

Command SEND_TUNING_BLOCK may be sent up to 40 times until the host finishes the tuning procedure.

Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 section Figure 2-29 for details.

Parameters
[in]SlotThe slot number of the Emmc card to send the command to.
[in]BusWidthThe bus width to work.
Return values
EFI_SUCCESSThe operation is done correctly.
OthersThe operation fails.

Definition at line 2329 of file EmmcHci.c.

◆ EmmcPeimWaitTrbEnv()

EFI_STATUS EmmcPeimWaitTrbEnv ( IN UINTN  Bar,
IN EMMC_TRB Trb 
)

Wait for the env to be ready for execute specified TRB.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]TrbThe pointer to the EMMC_TRB instance.
Return values
EFI_SUCCESSThe env is ready for TRB execution.
EFI_TIMEOUTThe env is not ready for TRB execution in time.
OthersSome erros happen.

Definition at line 1180 of file EmmcHci.c.

◆ EmmcPeimWaitTrbResult()

EFI_STATUS EmmcPeimWaitTrbResult ( IN UINTN  Bar,
IN EMMC_TRB Trb 
)

Wait for the TRB execution result.

Parameters
[in]BarThe mmio base address of the slot to be accessed.
[in]TrbThe pointer to the EMMC_TRB instance.
Return values
EFI_SUCCESSThe TRB is executed successfully.
OthersSome erros happen when executing this request.

Definition at line 1621 of file EmmcHci.c.