9#ifndef _UFS_PASS_THRU_H_
10#define _UFS_PASS_THRU_H_
32#define UFS_PASS_THRU_SIG SIGNATURE_32 ('U', 'F', 'S', 'P')
42#define UFS_MAX_LUNS 12
43#define UFS_WLUN_PREFIX 0xC1
46 UINT8 Lun[UFS_MAX_LUNS];
80#define UFS_PASS_THRU_TRANS_REQ_SIG SIGNATURE_32 ('U', 'F', 'S', 'T')
92 UINTN AlignedDataBufSize;
100#define UFS_PASS_THRU_TRANS_REQ_FROM_THIS(a) \
101 CR(a, UFS_PASS_THRU_TRANS_REQ, TransferList, UFS_PASS_THRU_TRANS_REQ_SIG)
103#define UFS_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)
104#define UFS_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS(1)
106#define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
108#define UFS_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
110 UFS_PASS_THRU_PRIVATE_DATA, \
115#define UFS_PASS_THRU_PRIVATE_DATA_FROM_DEV_CONFIG(a) \
117 UFS_PASS_THRU_PRIVATE_DATA, \
122#define UFS_PASS_THRU_PRIVATE_DATA_FROM_DRIVER_INTF(a) \
124 UFS_PASS_THRU_PRIVATE_DATA, \
125 UfsHcDriverInterface, \
136 UINT32 TransferLength;
320 OUT CHAR16 **DriverName
398 OUT CHAR16 **ControllerName
482 IN OUT UINT8 **Target,
620 IN OUT UINT8 **Target
701 OUT VOID **CmdDescHost,
703 OUT VOID **CmdDescMapping
788 IN OUT VOID *Descriptor,
789 IN OUT UINT32 *DescSize
814 IN OUT UINT32 *Attributes
897 IN OUT UINT8 *Descriptor,
898 IN OUT UINT32 *DescSize
959 IN OUT UINT8 *Attribute,
960 IN OUT UINT32 *AttrSize
UINT64 EFI_PHYSICAL_ADDRESS
EFI_STATUS EFIAPI UfsPassThruGetNextTargetLun(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN OUT UINT8 **Target, IN OUT UINT64 *Lun)
EFI_STATUS EFIAPI UfsPassThruResetTargetLun(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN UINT8 *Target, IN UINT64 Lun)
EFI_STATUS UfsExecScsiCmds(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINT8 Lun, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, IN EFI_EVENT Event OPTIONAL)
EFI_STATUS EFIAPI UfsPassThruPassThru(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN UINT8 *Target, IN UINT64 Lun, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, IN EFI_EVENT Event OPTIONAL)
EFI_STATUS EFIAPI UfsPassThruBuildDevicePath(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN UINT8 *Target, IN UINT64 Lun, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI UfsRwUfsAttribute(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 AttrId, IN UINT8 Index, IN UINT8 Selector, IN OUT UINT8 *Attribute, IN OUT UINT32 *AttrSize)
EFI_STATUS EFIAPI UfsPassThruComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
EFI_STATUS EFIAPI UfsPassThruGetTargetLun(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT8 **Target, OUT UINT64 *Lun)
EFI_STATUS UfsAllocateAlignCommonBuffer(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINTN Size, OUT VOID **CmdDescHost, OUT EFI_PHYSICAL_ADDRESS *CmdDescPhyAddr, OUT VOID **CmdDescMapping)
EFI_STATUS EFIAPI UfsPassThruComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS UfsRwDeviceDesc(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT VOID *Descriptor, IN OUT UINT32 *DescSize)
EFI_STATUS GetUfsHcInfo(IN UFS_PASS_THRU_PRIVATE_DATA *Private)
EFI_STATUS UfsExecNopCmds(IN UFS_PASS_THRU_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI UfsHcDriverInterfaceExecUicCommand(IN EDKII_UFS_HC_DRIVER_INTERFACE *This, IN OUT EDKII_UIC_COMMAND *UicCommand)
EFI_STATUS UfsRwFlags(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Value)
EFI_STATUS UfsReadFlag(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINT8 FlagId, OUT UINT8 *Value)
EFI_STATUS EFIAPI UfsPassThruGetNextTarget(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN OUT UINT8 **Target)
EFI_STATUS EFIAPI UfsPassThruDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
VOID EFIAPI SignalCallerEvent(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UFS_PASS_THRU_TRANS_REQ *TransReq)
EFI_STATUS EFIAPI UfsPassThruResetChannel(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This)
EFI_STATUS EFIAPI UfsPassThruDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS UfsRwAttributes(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 AttrId, IN UINT8 Index, IN UINT8 Selector, IN OUT UINT32 *Attributes)
VOID EFIAPI ProcessAsyncTaskList(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI UfsPassThruDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS UfsControllerStop(IN UFS_PASS_THRU_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI UfsRwUfsFlag(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Flag)
EFI_STATUS EFIAPI UfsRwUfsDescriptor(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT UINT8 *Descriptor, IN OUT UINT32 *DescSize)
EFI_STATUS UfsControllerInit(IN UFS_PASS_THRU_PRIVATE_DATA *Private)
EFI_STATUS UfsSetFlag(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINT8 FlagId)