TianoCore EDK2 master
Loading...
Searching...
No Matches
UfsHci.c File Reference
#include "UfsBlockIoPei.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI UfsWaitMemSet (IN UINTN Address, IN UINT32 MaskValue, IN UINT32 TestValue, IN UINT64 Timeout)
 
VOID DumpUicCmdExecResult (IN UINT8 UicOpcode, IN UINT8 Result)
 
VOID DumpQueryResponseResult (IN UINT8 Result)
 
VOID SwapLittleEndianToBigEndian (IN OUT UINT8 *Buffer, IN UINT32 BufferSize)
 
VOID UfsFillTsfOfQueryReqUpiu (IN OUT UTP_UPIU_TSF *TsfBase, IN UINT8 Opcode, IN UINT8 DescId OPTIONAL, IN UINT8 Index OPTIONAL, IN UINT8 Selector OPTIONAL, IN UINT16 Length OPTIONAL, IN UINT32 Value OPTIONAL)
 
EFI_STATUS UfsInitCommandUpiu (IN OUT UTP_COMMAND_UPIU *Command, IN UINT8 Lun, IN UINT8 TaskTag, IN UINT8 *Cdb, IN UINT8 CdbLength, IN UFS_DATA_DIRECTION DataDirection, IN UINT32 ExpDataTranLen)
 
EFI_STATUS UfsInitUtpPrdt (IN UTP_TR_PRD *Prdt, IN VOID *Buffer, IN UINT32 BufferSize)
 
EFI_STATUS UfsInitQueryRequestUpiu (IN OUT UTP_QUERY_REQ_UPIU *QueryReq, IN UINT8 TaskTag, IN UINT8 Opcode, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN UINTN DataSize OPTIONAL, IN UINT8 *Data OPTIONAL)
 
EFI_STATUS UfsCreateScsiCommandDesc (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Lun, IN UFS_SCSI_REQUEST_PACKET *Packet, IN UTP_TRD *Trd, OUT VOID **BufferMap)
 
EFI_STATUS UfsCreateDMCommandDesc (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet, IN UTP_TRD *Trd)
 
EFI_STATUS UfsCreateNopCommandDesc (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UTP_TRD *Trd)
 
EFI_STATUS UfsFindAvailableSlotInTrl (IN UFS_PEIM_HC_PRIVATE_DATA *Private, OUT UINT8 *Slot)
 
VOID UfsStartExecCmd (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Slot)
 
VOID UfsStopExecCmd (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Slot)
 
EFI_STATUS UfsGetReturnDataFromQueryResponse (IN OUT UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet, IN UTP_QUERY_RESP_UPIU *QueryResp)
 
EFI_STATUS UfsSendDmRequestRetry (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN OUT UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet)
 
EFI_STATUS UfsSendDmRequest (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN OUT UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet)
 
EFI_STATUS UfsRwDeviceDesc (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT VOID *Descriptor, IN UINT32 DescSize)
 
EFI_STATUS UfsRwAttributes (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 AttrId, IN UINT8 Index, IN UINT8 Selector, IN OUT UINT32 *Attributes)
 
EFI_STATUS UfsRwFlags (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Value)
 
EFI_STATUS UfsSetFlag (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 FlagId)
 
EFI_STATUS UfsReadFlag (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 FlagId, OUT UINT8 *Value)
 
EFI_STATUS UfsExecNopCmds (IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 
EFI_STATUS UfsExecScsiCmds (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Lun, IN OUT UFS_SCSI_REQUEST_PACKET *Packet)
 
EFI_STATUS UfsExecUicCommands (IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 UicOpcode, IN UINT32 Arg1, IN UINT32 Arg2, IN UINT32 Arg3)
 
EFI_STATUS UfsEnableHostController (IN EDKII_UFS_HC_PLATFORM_PPI *UfsHcPlatformPpi, IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 
EFI_STATUS UfsDeviceDetection (IN EDKII_UFS_HC_PLATFORM_PPI *UfsHcPlatformPpi, IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 
EFI_STATUS UfsInitTaskManagementRequestList (IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 
EFI_STATUS UfsInitTransferRequestList (IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 
EFI_STATUS UfsControllerInit (IN EDKII_UFS_HC_PLATFORM_PPI *UfsHcPlatformPpi, IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 
EFI_STATUS UfsControllerStop (IN UFS_PEIM_HC_PRIVATE_DATA *Private)
 

Detailed Description

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

Definition in file UfsHci.c.

Function Documentation

◆ DumpQueryResponseResult()

VOID DumpQueryResponseResult ( IN UINT8  Result)

Dump QUERY RESPONSE UPIU result for debugging.

Parameters
[in]ResultThe result to be parsed.

Definition at line 136 of file UfsHci.c.

◆ DumpUicCmdExecResult()

VOID DumpUicCmdExecResult ( IN UINT8  UicOpcode,
IN UINT8  Result 
)

Dump UIC command execution result for debugging.

Parameters
[in]UicOpcodeThe executed UIC opcode.
[in]ResultThe result to be parsed.

Definition at line 72 of file UfsHci.c.

◆ SwapLittleEndianToBigEndian()

VOID SwapLittleEndianToBigEndian ( IN OUT UINT8 *  Buffer,
IN UINT32  BufferSize 
)

Swap little endian to big endian.

Parameters
[in,out]BufferThe data buffer. In input, it contains little endian data. In output, it will become big endian.
[in]BufferSizeThe length of converted data.

Definition at line 186 of file UfsHci.c.

◆ UfsControllerInit()

EFI_STATUS UfsControllerInit ( IN EDKII_UFS_HC_PLATFORM_PPI UfsHcPlatformPpi,
IN UFS_PEIM_HC_PRIVATE_DATA Private 
)

Initialize the UFS host controller.

Parameters
[in]UfsHcPlatformPpiThe pointer to the EDKII_UFS_HC_PLATFORM_PPI data structure. // APTIOV_OVERRIDE
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe Ufs Host Controller is initialized successfully.
OthersA device error occurred while initializing the controller.

Definition at line 1726 of file UfsHci.c.

◆ UfsControllerStop()

EFI_STATUS UfsControllerStop ( IN UFS_PEIM_HC_PRIVATE_DATA Private)

Stop the UFS host controller.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe Ufs Host Controller is stopped successfully.
OthersA device error occurred while stopping the controller.

Definition at line 1781 of file UfsHci.c.

◆ UfsCreateDMCommandDesc()

EFI_STATUS UfsCreateDMCommandDesc ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet,
IN UTP_TRD Trd 
)

Allocate QUERY REQUEST/QUERY RESPONSE UPIU for filling UTP TRD's command descriptor field.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]PacketThe pointer to the UFS_DEVICE_MANAGEMENT_REQUEST_PACKET data structure.
[in]TrdThe pointer to the UTP Transfer Request Descriptor.
Return values
EFI_SUCCESSThe creation succeed.
EFI_DEVICE_ERRORThe creation failed.
EFI_OUT_OF_RESOURCESThe memory resource is insufficient.
EFI_INVALID_PARAMETERThe parameter passed in is invalid.

Definition at line 521 of file UfsHci.c.

◆ UfsCreateNopCommandDesc()

EFI_STATUS UfsCreateNopCommandDesc ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UTP_TRD Trd 
)

Allocate NOP IN and NOP OUT UPIU for filling UTP TRD's command descriptor field.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]TrdThe pointer to the UTP Transfer Request Descriptor.
Return values
EFI_SUCCESSThe creation succeed.
EFI_DEVICE_ERRORThe creation failed.
EFI_OUT_OF_RESOURCESThe memory resource is insufficient.

Definition at line 624 of file UfsHci.c.

◆ UfsCreateScsiCommandDesc()

EFI_STATUS UfsCreateScsiCommandDesc ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  Lun,
IN UFS_SCSI_REQUEST_PACKET Packet,
IN UTP_TRD Trd,
OUT VOID **  BufferMap 
)

Allocate COMMAND/RESPONSE UPIU for filling UTP TRD's command descriptor field.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]LunThe Lun on which the SCSI command is executed.
[in]PacketThe pointer to the UFS_SCSI_REQUEST_PACKET data structure.
[in]TrdThe pointer to the UTP Transfer Request Descriptor.
[out]BufferMapA resulting value, if not NULL, to pass to IoMmuUnmap().
Return values
EFI_SUCCESSThe creation succeed.
EFI_DEVICE_ERRORThe creation failed.
EFI_OUT_OF_RESOURCESThe memory resource is insufficient.

Definition at line 426 of file UfsHci.c.

◆ UfsDeviceDetection()

EFI_STATUS UfsDeviceDetection ( IN EDKII_UFS_HC_PLATFORM_PPI UfsHcPlatformPpi,
IN UFS_PEIM_HC_PRIVATE_DATA Private 
)

Detect if a UFS device attached.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe UFS device detection was executed successfully.
EFI_NOT_FOUNDNot found a UFS device attached.
EFI_DEVICE_ERRORA device error occurred while detecting the UFS device.

Definition at line 1533 of file UfsHci.c.

◆ UfsEnableHostController()

EFI_STATUS UfsEnableHostController ( IN EDKII_UFS_HC_PLATFORM_PPI UfsHcPlatformPpi,
IN UFS_PEIM_HC_PRIVATE_DATA Private 
)

Enable the UFS host controller for accessing.

Parameters
[in]UfsHcPlatformPpiThe pointer to the EDKII_UFS_HC_PLATFORM_PPI data structure
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe UFS host controller enabling was executed successfully.
EFI_DEVICE_ERRORA device error occurred while enabling the UFS host controller.

Definition at line 1461 of file UfsHci.c.

◆ UfsExecNopCmds()

EFI_STATUS UfsExecNopCmds ( IN UFS_PEIM_HC_PRIVATE_DATA Private)

Sends NOP IN cmd to a UFS device for initialization process request. For more details, please refer to UFS 2.0 spec Figure 13.3.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe NOP IN command was sent by the host. The NOP OUT response was received successfully.
EFI_DEVICE_ERRORA device error occurred while attempting to execute NOP IN command.
EFI_OUT_OF_RESOURCESThe resource for transfer is not available.
EFI_TIMEOUTA timeout occurred while waiting for the NOP IN command to execute.

Definition at line 1171 of file UfsHci.c.

◆ UfsExecScsiCmds()

EFI_STATUS UfsExecScsiCmds ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  Lun,
IN OUT UFS_SCSI_REQUEST_PACKET Packet 
)

Sends a UFS-supported SCSI Request Packet to a UFS device that is attached to the UFS host controller.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]LunThe LUN of the UFS device to send the SCSI Request Packet.
[in,out]PacketA pointer to the SCSI Request Packet to send to a specified Lun of the UFS device.
Return values
EFI_SUCCESSThe SCSI Request Packet was sent by the host. For bi-directional commands, InTransferLength bytes were transferred from InDataBuffer. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
EFI_DEVICE_ERRORA device error occurred while attempting to send the SCSI Request Packet.
EFI_OUT_OF_RESOURCESThe resource for transfer is not available.
EFI_TIMEOUTA timeout occurred while waiting for the SCSI Request Packet to execute.

Definition at line 1251 of file UfsHci.c.

◆ UfsExecUicCommands()

EFI_STATUS UfsExecUicCommands ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  UicOpcode,
IN UINT32  Arg1,
IN UINT32  Arg2,
IN UINT32  Arg3 
)

Sent UIC DME_LINKSTARTUP command to start the link startup procedure.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]UicOpcodeThe opcode of the UIC command.
[in]Arg1The value for 1st argument of the UIC command.
[in]Arg2The value for 2nd argument of the UIC command.
[in]Arg3The value for 3rd argument of the UIC command.
Returns
EFI_SUCCESS Successfully execute this UIC command and detect attached UFS device.
EFI_DEVICE_ERROR Fail to execute this UIC command and detect attached UFS device.
EFI_NOT_FOUND The presence of the UFS device isn't detected.

Definition at line 1376 of file UfsHci.c.

◆ UfsFillTsfOfQueryReqUpiu()

VOID UfsFillTsfOfQueryReqUpiu ( IN OUT UTP_UPIU_TSF TsfBase,
IN UINT8  Opcode,
IN UINT8 DescId  OPTIONAL,
IN UINT8 Index  OPTIONAL,
IN UINT8 Selector  OPTIONAL,
IN UINT16 Length  OPTIONAL,
IN UINT32 Value  OPTIONAL 
)

Fill TSF field of QUERY REQUEST UPIU.

Parameters
[in,out]TsfBaseThe base address of TSF field of QUERY REQUEST UPIU.
[in]OpcodeThe opcode of request.
[in]DescIdThe descriptor ID of request.
[in]IndexThe index of request.
[in]SelectorThe selector of request.
[in]LengthThe length of transferred data. The maximum is 4.
[in]ValueThe value of transferred data.

Definition at line 216 of file UfsHci.c.

◆ UfsFindAvailableSlotInTrl()

EFI_STATUS UfsFindAvailableSlotInTrl ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
OUT UINT8 *  Slot 
)

Find out available slot in transfer list of a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[out]SlotThe available slot.
Return values
EFI_SUCCESSThe available slot was found successfully.

Definition at line 671 of file UfsHci.c.

◆ UfsGetReturnDataFromQueryResponse()

EFI_STATUS UfsGetReturnDataFromQueryResponse ( IN OUT UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet,
IN UTP_QUERY_RESP_UPIU QueryResp 
)

Extracts return data from query response upiu.

Parameters
[in,out]PacketPointer to the UFS_DEVICE_MANAGEMENT_REQUEST_PACKET.
[in]QueryRespPointer to the query response.
Return values
EFI_INVALID_PARAMETERPacket or QueryResp are empty or opcode is invalid.
EFI_DEVICE_ERRORData returned from device is invalid.
EFI_SUCCESSData extracted.

Definition at line 756 of file UfsHci.c.

◆ UfsInitCommandUpiu()

EFI_STATUS UfsInitCommandUpiu ( IN OUT UTP_COMMAND_UPIU Command,
IN UINT8  Lun,
IN UINT8  TaskTag,
IN UINT8 *  Cdb,
IN UINT8  CdbLength,
IN UFS_DATA_DIRECTION  DataDirection,
IN UINT32  ExpDataTranLen 
)

Initialize COMMAND UPIU.

Parameters
[in,out]CommandThe base address of COMMAND UPIU.
[in]LunThe Lun on which the SCSI command is executed.
[in]TaskTagThe task tag of request.
[in]CdbThe cdb buffer containing SCSI command.
[in]CdbLengthThe cdb length.
[in]DataDirectionThe direction of data transfer.
[in]ExpDataTranLenThe expected transfer data length.
Return values
EFI_SUCCESSThe initialization succeed.

Definition at line 262 of file UfsHci.c.

◆ UfsInitQueryRequestUpiu()

EFI_STATUS UfsInitQueryRequestUpiu ( IN OUT UTP_QUERY_REQ_UPIU QueryReq,
IN UINT8  TaskTag,
IN UINT8  Opcode,
IN UINT8  DescId,
IN UINT8  Index,
IN UINT8  Selector,
IN UINTN DataSize  OPTIONAL,
IN UINT8 *Data  OPTIONAL 
)

Initialize QUERY REQUEST UPIU.

Parameters
[in,out]QueryReqThe base address of QUERY REQUEST UPIU.
[in]TaskTagThe task tag of request.
[in]OpcodeThe opcode of request.
[in]DescIdThe descriptor ID of request.
[in]IndexThe index of request.
[in]SelectorThe selector of request.
[in]DataSizeThe data size to be read or written.
[in]DataThe buffer to be read or written.
Return values
EFI_SUCCESSThe initialization succeed.

Definition at line 372 of file UfsHci.c.

◆ UfsInitTaskManagementRequestList()

EFI_STATUS UfsInitTaskManagementRequestList ( IN UFS_PEIM_HC_PRIVATE_DATA Private)

Initialize UFS task management request list related h/w context.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe UFS task management list was initialzed successfully.
EFI_DEVICE_ERRORThe initialization fails.

Definition at line 1591 of file UfsHci.c.

◆ UfsInitTransferRequestList()

EFI_STATUS UfsInitTransferRequestList ( IN UFS_PEIM_HC_PRIVATE_DATA Private)

Initialize UFS transfer request list related h/w context.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSThe UFS transfer list was initialzed successfully.
EFI_DEVICE_ERRORThe initialization fails.

Definition at line 1658 of file UfsHci.c.

◆ UfsInitUtpPrdt()

EFI_STATUS UfsInitUtpPrdt ( IN UTP_TR_PRD Prdt,
IN VOID *  Buffer,
IN UINT32  BufferSize 
)

Initialize UTP PRDT for data transfer.

Parameters
[in]PrdtThe base address of PRDT.
[in]BufferThe buffer to be read or written.
[in]BufferSizeThe data size to be read or written.
Return values
EFI_SUCCESSThe initialization succeed.

Definition at line 314 of file UfsHci.c.

◆ UfsReadFlag()

EFI_STATUS UfsReadFlag ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  FlagId,
OUT UINT8 *  Value 
)

Read specified flag from a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]FlagIdThe ID of flag to be read.
[out]ValueThe flag's value.
Return values
EFI_SUCCESSThe flag was read successfully.
EFI_DEVICE_ERRORA device error occurred while attempting to read the flag.
EFI_TIMEOUTA timeout occurred while waiting for the completion of reading the flag.

Definition at line 1144 of file UfsHci.c.

◆ UfsRwAttributes()

EFI_STATUS UfsRwAttributes ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN BOOLEAN  Read,
IN UINT8  AttrId,
IN UINT8  Index,
IN UINT8  Selector,
IN OUT UINT32 *  Attributes 
)

Read or write specified attribute of a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.
[in]ReadThe boolean variable to show r/w direction.
[in]AttrIdThe ID of Attribute.
[in]IndexThe Index of Attribute.
[in]SelectorThe Selector of Attribute.
[in,out]AttributesThe value of Attribute to be read or written.
Return values
EFI_SUCCESSThe Attribute was read/written successfully.
EFI_INVALID_PARAMETERAttrId, Index and Selector are invalid combination to point to a type of UFS device descriptor.
EFI_DEVICE_ERRORA device error occurred while attempting to r/w the Attribute.
EFI_TIMEOUTA timeout occurred while waiting for the completion of r/w the Attribute.

Definition at line 1014 of file UfsHci.c.

◆ UfsRwDeviceDesc()

EFI_STATUS UfsRwDeviceDesc ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN BOOLEAN  Read,
IN UINT8  DescId,
IN UINT8  Index,
IN UINT8  Selector,
IN OUT VOID *  Descriptor,
IN UINT32  DescSize 
)

Read or write specified device descriptor of a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]ReadThe boolean variable to show r/w direction.
[in]DescIdThe ID of device descriptor.
[in]IndexThe Index of device descriptor.
[in]SelectorThe Selector of device descriptor.
[in,out]DescriptorThe buffer of device descriptor to be read or written.
[in]DescSizeThe size of device descriptor buffer.
Return values
EFI_SUCCESSThe device descriptor was read/written successfully.
EFI_DEVICE_ERRORA device error occurred while attempting to r/w the device descriptor.
EFI_TIMEOUTA timeout occurred while waiting for the completion of r/w the device descriptor.

Definition at line 960 of file UfsHci.c.

◆ UfsRwFlags()

EFI_STATUS UfsRwFlags ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN BOOLEAN  Read,
IN UINT8  FlagId,
IN OUT UINT8 *  Value 
)

Read or write specified flag of a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]ReadThe boolean variable to show r/w direction.
[in]FlagIdThe ID of flag to be read or written.
[in,out]ValueThe value to set or clear flag.
Return values
EFI_SUCCESSThe flag was read/written successfully.
EFI_DEVICE_ERRORA device error occurred while attempting to r/w the flag.
EFI_TIMEOUTA timeout occurred while waiting for the completion of r/w the flag.

Definition at line 1060 of file UfsHci.c.

◆ UfsSendDmRequest()

EFI_STATUS UfsSendDmRequest ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN OUT UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet 
)

Sends Query Request to the device. Query is sent until device responds correctly or counter runs out.

Parameters
[in]PrivatePointer to the UFS_PEIM_HC_PRIVATE_DATA.
[in,out]PacketPointer to the UFS_DEVICE_MANAGEMENT_REQUEST_PACKET.
Return values
EFI_SUCCESSThe device responded correctly to the Query request.
EFI_INVALID_PARAMETERThe DescId, Index and Selector fields in Packet are invalid combination to point to a type of UFS device descriptor.
EFI_DEVICE_ERRORA device error occurred while waiting for the response from the device.
EFI_TIMEOUTA timeout occurred while waiting for the completion of the operation.

Definition at line 922 of file UfsHci.c.

◆ UfsSendDmRequestRetry()

EFI_STATUS UfsSendDmRequestRetry ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN OUT UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet 
)

Creates Transfer Request descriptor and sends Query Request to the device.

Parameters
[in]PrivatePointer to the UFS_PEIM_HC_PRIVATE_DATA.
[in,out]PacketPointer to the UFS_DEVICE_MANAGEMENT_REQUEST_PACKET.
Return values
EFI_SUCCESSThe device descriptor was read/written successfully.
EFI_INVALID_PARAMETERThe DescId, Index and Selector fields in Packet are invalid combination to point to a type of UFS device descriptor.
EFI_DEVICE_ERRORA device error occurred while attempting to r/w the device descriptor.
EFI_TIMEOUTA timeout occurred while waiting for the completion of r/w the device descriptor.

Definition at line 834 of file UfsHci.c.

◆ UfsSetFlag()

EFI_STATUS UfsSetFlag ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  FlagId 
)

Set specified flag to 1 on a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]FlagIdThe ID of flag to be set.
Return values
EFI_SUCCESSThe flag was set successfully.
EFI_DEVICE_ERRORA device error occurred while attempting to set the flag.
EFI_TIMEOUTA timeout occurred while waiting for the completion of setting the flag.

Definition at line 1117 of file UfsHci.c.

◆ UfsStartExecCmd()

VOID UfsStartExecCmd ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  Slot 
)

Start specified slot in transfer list of a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]SlotThe slot to be started.

Definition at line 695 of file UfsHci.c.

◆ UfsStopExecCmd()

VOID UfsStopExecCmd ( IN UFS_PEIM_HC_PRIVATE_DATA Private,
IN UINT8  Slot 
)

Stop specified slot in transfer list of a UFS device.

Parameters
[in]PrivateThe pointer to the UFS_PEIM_HC_PRIVATE_DATA data structure.
[in]SlotThe slot to be stop.

Definition at line 724 of file UfsHci.c.

◆ UfsWaitMemSet()

EFI_STATUS EFIAPI UfsWaitMemSet ( IN UINTN  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 24 of file UfsHci.c.