8#ifndef _UFS_BLOCK_IO_PEI_H_
9#define _UFS_BLOCK_IO_PEI_H_
34#define UFS_PEIM_HC_SIG SIGNATURE_32 ('U', 'F', 'S', 'H')
36#define UFS_PEIM_MAX_LUNS 8
39 UINT8 Lun[UFS_PEIM_MAX_LUNS];
134#define UFS_TIMEOUT MultU64x32((UINT64)(3), 10000000)
136#define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
138#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
139#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
140#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, UFS_PEIM_HC_SIG)
142#define UFS_SCSI_OP_LENGTH_SIX 0x6
143#define UFS_SCSI_OP_LENGTH_TEN 0xa
144#define UFS_SCSI_OP_LENGTH_SIXTEEN 0x10
154 UINT32 InTransferLength;
155 UINT32 OutTransferLength;
184 IN OUT UINT32 *Attributes
301 IN OUT VOID *Descriptor,
656 IN VOID *HostAddress,
697 OUT VOID **HostAddress,
717 IN VOID *HostAddress,
UINT64 EFI_PHYSICAL_ADDRESS
VOID * UfsPeimAllocateMem(IN UFS_PEIM_MEM_POOL *Pool, IN UINTN Size)
EFI_STATUS EFIAPI UfsBlockIoPeimReadBlocks(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
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 IoMmuUnmap(IN VOID *Mapping)
VOID UfsPeimFreeMem(IN UFS_PEIM_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size)
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 IoMmuAllocateBuffer(IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS UfsPeimFreeMemPool(IN UFS_PEIM_MEM_POOL *Pool)
EFI_STATUS UfsReadFlag(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 FlagId, OUT UINT8 *Value)
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 EFIAPI UfsBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
EFI_STATUS UfsPeimInitMemPool(IN UFS_PEIM_HC_PRIVATE_DATA *Private)
EFI_STATUS UfsExecNopCmds(IN UFS_PEIM_HC_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI UfsEndOfPei(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
EFI_STATUS UfsControllerInit(IN EDKII_UFS_HC_PLATFORM_PPI *UfsHcPlatformPpi, IN UFS_PEIM_HC_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI UfsBlockIoPeimGetMediaInfo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo)
EFI_STATUS UfsControllerStop(IN UFS_PEIM_HC_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI UfsBlockIoPeimGetDeviceNo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
EFI_STATUS EFIAPI UfsBlockIoPeimGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
EFI_STATUS IoMmuFreeBuffer(IN UINTN Pages, IN VOID *HostAddress, IN VOID *Mapping)
EFI_STATUS UfsSetFlag(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 FlagId)
EFI_STATUS EFIAPI UfsBlockIoPeimGetDeviceNo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)
EFI_STATUS UfsExecScsiCmds(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Lun, IN OUT UFS_SCSI_REQUEST_PACKET *Packet)