SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations
ufs.h File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include "reg/reg-ufs.h"
#include "blk.h"
#include "scsi.h"
Include dependency graph for ufs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ufs_pa_layer_attr
 
struct  ufs_pwr_mode_info
 
struct  ufshcd_sg_entry
 
struct  utp_transfer_cmd_desc
 
struct  request_desc_header
 struct request_desc_header - Descriptor Header common to both UTRD and UTMRD @dword0: Descriptor Header DW0 @dword1: Descriptor Header DW1 @dword2: Descriptor Header DW2 @dword3: Descriptor Header DW3 More...
 
struct  utp_transfer_req_desc
 struct utp_transfer_req_desc - UTRD structure @header: UTRD header DW-0 to DW-3 @command_desc_base_addr_lo: UCD base address low DW-4 @command_desc_base_addr_hi: UCD base address high DW-5 @response_upiu_length: response UPIU length DW-6 @response_upiu_offset: response UPIU offset DW-6 @prd_table_length: Physical region descriptor length DW-7 @prd_table_offset: Physical region descriptor offset DW-7 More...
 
struct  utp_upiu_header
 struct utp_upiu_header - UPIU header structure @dword_0: UPIU header DW-0 @dword_1: UPIU header DW-1 @dword_2: UPIU header DW-2 More...
 
struct  utp_upiu_query
 struct utp_upiu_query - upiu request buffer structure for query request. More...
 
struct  utp_upiu_cmd
 struct utp_upiu_cmd - Command UPIU structure @data_transfer_len: Data Transfer Length DW-3 @cdb: Command Descriptor Block CDB DW-4 to DW-7 More...
 
struct  utp_task_req_desc
 
struct  utp_upiu_req
 struct utp_upiu_req - general upiu request structure @header:UPIU header structure DW-0 to DW-2 @sc: fields structure for scsi command DW-3 to DW-7 @qr: fields structure for query request DW-3 to DW-7 More...
 
struct  utp_cmd_rsp
 struct utp_cmd_rsp - Response UPIU structure @residual_transfer_count: Residual transfer count DW-3 @reserved: Reserved double words DW-4 to DW-7 @sense_data_len: Sense data length DW-8 U16 @sense_data: Sense data field DW-8 to DW-12 More...
 
struct  utp_upiu_rsp
 struct utp_upiu_rsp - general upiu response structure @header: UPIU header structure DW-0 to DW-2 @sr: fields structure for scsi command DW-3 to DW-12 @qr: fields structure for query request DW-3 to DW-7 More...
 
struct  ufs_dev_desc
 ufs_dev_desc - ufs device details from the device descriptor More...
 
struct  uic_command
 struct uic_command - UIC command structure @command: UIC command @argument1: UIC command argument 1 @argument2: UIC command argument 2 @argument3: UIC command argument 3 @cmd_active: Indicate if UIC command is outstanding More...
 
struct  ufs_query_req
 struct ufs_query_req - parameters for building a query request @query_func: UPIU header query function @upiu_req: the query request data More...
 
struct  ufs_query_res
 struct ufs_query_resp - UPIU QUERY @response: device response code @upiu_res: query response data More...
 
struct  ufs_query
 struct ufs_query - holds relevant data structures for query request @request: request upiu and function @descriptor: buffer for sending/receiving descriptor @response: response upiu and response More...
 
struct  ufs_dev_cmd
 struct ufs_dev_cmd - all assosiated fields with device management commands @type: device management command type - Query, NOP OUT @tag_wq: wait queue until free command slot is available More...
 
struct  ufs_desc_size
 
struct  ufs_basic_info
 
struct  ufs_hba
 
struct  ufs_device
 

Macros

#define UFS_CDB_SIZE   16
 
#define RESPONSE_UPIU_SENSE_DATA_LENGTH   18
 
#define UFS_MAX_LUNS   0x7F
 
#define UFSHCD_QUIRK_BROKEN_LCC   0x1
 
#define UPIU_COMMAND_TYPE_OFFSET   28
 
#define UPIU_RSP_CODE_OFFSET   8
 
#define UPIU_RSP_CODE_OFFSET   8
 
#define MASK_UIC_COMMAND_RESULT   0xFF
 
#define MAX_BUFF   (16 * 4)
 
#define MAX_MODEL_LEN   16
 
#define GENERAL_UPIU_REQUEST_SIZE   (sizeof(utp_upiu_req_t))
 
#define QUERY_DESC_MAX_SIZE   255
 
#define QUERY_DESC_MIN_SIZE   2
 
#define QUERY_DESC_HDR_SIZE   2
 
#define QUERY_OSF_SIZE   (GENERAL_UPIU_REQUEST_SIZE - (sizeof(utp_upiu_header_t)))
 
#define RESPONSE_UPIU_SENSE_DATA_LENGTH   18
 
#define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)   cpu_to_be32((byte3 << 24) | (byte2 << 16) | (byte1 << 8) | (byte0))
 
#define UIC_ARG_MPHY_TX_GEN_SEL_INDEX(lane)   (lane)
 
#define UIC_ARG_MPHY_RX_GEN_SEL_INDEX(lane)   (PA_MAXDATALANES + (lane))
 
#define UIC_ARG_MIB_SEL(attr, sel)   ((((((uint32_t) attr)) & 0xFFFF) << 16) | ((sel) &0xFFFF))
 
#define UIC_ARG_MIB(attr)   UIC_ARG_MIB_SEL(((uint32_t) attr), 0)
 
#define UIC_ARG_ATTR_TYPE(t)   (((t) &0xFF) << 16)
 
#define UIC_GET_ATTR_ID(v)   (((v) >> 16) & 0xFFFF)
 
#define DME_LOCAL   0
 
#define DME_PEER   1
 
#define ATTR_SET_NOR   0 /* NORMAL */
 
#define ATTR_SET_ST   1 /* STATIC */
 

Typedefs

typedef struct ufs_pa_layer_attr ufs_pa_layer_attr_t
 
typedef struct ufs_pwr_mode_info ufs_pwr_mode_info_t
 
typedef struct ufshcd_sg_entry ufshcd_sg_entry_t
 
typedef struct utp_transfer_cmd_desc utp_transfer_cmd_desc_t
 
typedef struct request_desc_header request_desc_header_t
 struct request_desc_header - Descriptor Header common to both UTRD and UTMRD @dword0: Descriptor Header DW0 @dword1: Descriptor Header DW1 @dword2: Descriptor Header DW2 @dword3: Descriptor Header DW3
 
typedef struct utp_transfer_req_desc utp_transfer_req_desc_t
 struct utp_transfer_req_desc - UTRD structure @header: UTRD header DW-0 to DW-3 @command_desc_base_addr_lo: UCD base address low DW-4 @command_desc_base_addr_hi: UCD base address high DW-5 @response_upiu_length: response UPIU length DW-6 @response_upiu_offset: response UPIU offset DW-6 @prd_table_length: Physical region descriptor length DW-7 @prd_table_offset: Physical region descriptor offset DW-7
 
typedef struct utp_upiu_header utp_upiu_header_t
 struct utp_upiu_header - UPIU header structure @dword_0: UPIU header DW-0 @dword_1: UPIU header DW-1 @dword_2: UPIU header DW-2
 
typedef struct utp_upiu_query utp_upiu_query_t
 struct utp_upiu_query - upiu request buffer structure for query request.
 
typedef struct utp_upiu_cmd utp_upiu_cmd_t
 struct utp_upiu_cmd - Command UPIU structure @data_transfer_len: Data Transfer Length DW-3 @cdb: Command Descriptor Block CDB DW-4 to DW-7
 
typedef struct utp_task_req_desc utp_task_req_desc_t
 
typedef struct utp_upiu_req utp_upiu_req_t
 struct utp_upiu_req - general upiu request structure @header:UPIU header structure DW-0 to DW-2 @sc: fields structure for scsi command DW-3 to DW-7 @qr: fields structure for query request DW-3 to DW-7
 
typedef struct utp_cmd_rsp utp_cmd_rsp_t
 struct utp_cmd_rsp - Response UPIU structure @residual_transfer_count: Residual transfer count DW-3 @reserved: Reserved double words DW-4 to DW-7 @sense_data_len: Sense data length DW-8 U16 @sense_data: Sense data field DW-8 to DW-12
 
typedef struct utp_upiu_rsp utp_upiu_rsp_t
 struct utp_upiu_rsp - general upiu response structure @header: UPIU header structure DW-0 to DW-2 @sr: fields structure for scsi command DW-3 to DW-12 @qr: fields structure for query request DW-3 to DW-7
 
typedef struct ufs_dev_desc ufs_dev_desc_t
 ufs_dev_desc - ufs device details from the device descriptor
 
typedef struct uic_command uic_command_t
 struct uic_command - UIC command structure @command: UIC command @argument1: UIC command argument 1 @argument2: UIC command argument 2 @argument3: UIC command argument 3 @cmd_active: Indicate if UIC command is outstanding
 
typedef struct ufs_query_req ufs_query_req_t
 struct ufs_query_req - parameters for building a query request @query_func: UPIU header query function @upiu_req: the query request data
 
typedef struct ufs_query_res ufs_query_res_t
 struct ufs_query_resp - UPIU QUERY @response: device response code @upiu_res: query response data
 
typedef struct ufs_query ufs_query_t
 struct ufs_query - holds relevant data structures for query request @request: request upiu and function @descriptor: buffer for sending/receiving descriptor @response: response upiu and response
 
typedef struct ufs_dev_cmd ufs_dev_cmd_t
 struct ufs_dev_cmd - all assosiated fields with device management commands @type: device management command type - Query, NOP OUT @tag_wq: wait queue until free command slot is available
 
typedef struct ufs_desc_size ufs_desc_size_t
 
typedef struct ufs_basic_info ufs_basic_info_t
 
typedef struct ufs_hba ufs_hba_t
 
typedef struct ufs_device ufs_device_t
 

Enumerations

enum  { UFSHCI_VERSION_10 = 0x00010000 , UFSHCI_VERSION_11 = 0x00010100 , UFSHCI_VERSION_20 = 0x00000200 , UFSHCI_VERSION_21 = 0x00000210 }
 
enum  { INTERRUPT_MASK_ALL_VER_10 = 0x30FFF , INTERRUPT_MASK_RW_VER_10 = 0x30000 , INTERRUPT_MASK_ALL_VER_11 = 0x31FFF , INTERRUPT_MASK_ALL_VER_21 = 0x71FFF }
 
enum  {
  PWR_OK = 0x0 , PWR_LOCAL = 0x01 , PWR_REMOTE = 0x02 , PWR_BUSY = 0x03 ,
  PWR_ERROR_CAP = 0x04 , PWR_FATAL_ERROR = 0x05
}
 
enum  { TASK_REQ_UPIU_SIZE_DWORDS = 8 , TASK_RSP_UPIU_SIZE_DWORDS = 8 , ALIGNED_UPIU_SIZE = 512 }
 
enum  { UTP_CMD_TYPE_SCSI = 0x0 , UTP_CMD_TYPE_UFS = 0x1 , UTP_CMD_TYPE_DEV_MANAGE = 0x2 }
 
enum  { UTP_CMD_TYPE_UFS_STORAGE = 0x1 }
 
enum  { UTP_SCSI_COMMAND = 0x00000000 , UTP_NATIVE_UFS_COMMAND = 0x10000000 , UTP_DEVICE_MANAGEMENT_FUNCTION = 0x20000000 , UTP_REQ_DESC_INT_CMD = 0x01000000 }
 
enum  { UTP_NO_DATA_TRANSFER = 0x00000000 , UTP_HOST_TO_DEVICE = 0x02000000 , UTP_DEVICE_TO_HOST = 0x04000000 }
 
enum  {
  OCS_SUCCESS = 0x0 , OCS_INVALID_CMD_TABLE_ATTR = 0x1 , OCS_INVALID_PRDT_ATTR = 0x2 , OCS_MISMATCH_DATA_BUF_SIZE = 0x3 ,
  OCS_MISMATCH_RESP_UPIU_SIZE = 0x4 , OCS_PEER_COMM_FAILURE = 0x5 , OCS_ABORTED = 0x6 , OCS_FATAL_ERROR = 0x7 ,
  OCS_INVALID_COMMAND_STATUS = 0x0F , MASK_OCS = 0x0F
}
 
enum  {
  UFS_ABORT_TASK = 0x01 , UFS_ABORT_TASK_SET = 0x02 , UFS_CLEAR_TASK_SET = 0x04 , UFS_LOGICAL_RESET = 0x08 ,
  UFS_QUERY_TASK = 0x80 , UFS_QUERY_TASK_SET = 0x81
}
 
enum  {
  UPIU_TRANSACTION_NOP_OUT = 0x00 , UPIU_TRANSACTION_COMMAND = 0x01 , UPIU_TRANSACTION_DATA_OUT = 0x02 , UPIU_TRANSACTION_TASK_REQ = 0x04 ,
  UPIU_TRANSACTION_QUERY_REQ = 0x16
}
 
enum  {
  UPIU_TRANSACTION_NOP_IN = 0x20 , UPIU_TRANSACTION_RESPONSE = 0x21 , UPIU_TRANSACTION_DATA_IN = 0x22 , UPIU_TRANSACTION_TASK_RSP = 0x24 ,
  UPIU_TRANSACTION_READY_XFER = 0x31 , UPIU_TRANSACTION_QUERY_RSP = 0x36 , UPIU_TRANSACTION_REJECT_UPIU = 0x3F
}
 
enum  { UPIU_CMD_FLAGS_NONE = 0x00 , UPIU_CMD_FLAGS_WRITE = 0x20 , UPIU_CMD_FLAGS_READ = 0x40 }
 
enum  { UPIU_TASK_ATTR_SIMPLE = 0x00 , UPIU_TASK_ATTR_ORDERED = 0x01 , UPIU_TASK_ATTR_HEADQ = 0x02 , UPIU_TASK_ATTR_ACA = 0x03 }
 
enum  { UPIU_QUERY_FUNC_STANDARD_READ_REQUEST = 0x01 , UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST = 0x81 }
 
enum  {
  MASK_SCSI_STATUS = 0xFF , MASK_TASK_RESPONSE = 0xFF00 , MASK_RSP_UPIU_RESULT = 0xFFFF , MASK_QUERY_DATA_SEG_LEN = 0xFFFF ,
  MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF , MASK_RSP_EXCEPTION_EVENT = 0x10000 , MASK_TM_SERVICE_RESP = 0xFF , MASK_TM_FUNC = 0xFF
}
 
enum  query_opcode {
  UPIU_QUERY_OPCODE_NOP = 0x0 , UPIU_QUERY_OPCODE_READ_DESC = 0x1 , UPIU_QUERY_OPCODE_WRITE_DESC = 0x2 , UPIU_QUERY_OPCODE_READ_ATTR = 0x3 ,
  UPIU_QUERY_OPCODE_WRITE_ATTR = 0x4 , UPIU_QUERY_OPCODE_READ_FLAG = 0x5 , UPIU_QUERY_OPCODE_SET_FLAG = 0x6 , UPIU_QUERY_OPCODE_CLEAR_FLAG = 0x7 ,
  UPIU_QUERY_OPCODE_TOGGLE_FLAG = 0x8
}
 
enum  ufs_ref_clk_freq {
  REF_CLK_FREQ_19_2_MHZ = 0 , REF_CLK_FREQ_26_MHZ = 1 , REF_CLK_FREQ_38_4_MHZ = 2 , REF_CLK_FREQ_52_MHZ = 3 ,
  REF_CLK_FREQ_INVAL = -1
}
 
enum  {
  QUERY_RESULT_SUCCESS = 0x00 , QUERY_RESULT_NOT_READABLE = 0xF6 , QUERY_RESULT_NOT_WRITEABLE = 0xF7 , QUERY_RESULT_ALREADY_WRITTEN = 0xF8 ,
  QUERY_RESULT_INVALID_LENGTH = 0xF9 , QUERY_RESULT_INVALID_VALUE = 0xFA , QUERY_RESULT_INVALID_SELECTOR = 0xFB , QUERY_RESULT_INVALID_INDEX = 0xFC ,
  QUERY_RESULT_INVALID_IDN = 0xFD , QUERY_RESULT_INVALID_OPCODE = 0xFE , QUERY_RESULT_GENERAL_FAILURE = 0xFF
}
 
enum  ufs_dev_pwr_mode { UFS_ACTIVE_PWR_MODE = 1 , UFS_SLEEP_PWR_MODE = 2 , UFS_POWERDOWN_PWR_MODE = 3 }
 
enum  ufs_notify_change_status { PRE_CHANGE , POST_CHANGE }
 
enum  { UPIU_COMMAND_SET_TYPE_SCSI = 0x0 , UPIU_COMMAND_SET_TYPE_UFS = 0x1 , UPIU_COMMAND_SET_TYPE_QUERY = 0x2 }
 
enum  flag_idn {
  QUERY_FLAG_IDN_FDEVICEINIT = 0x01 , QUERY_FLAG_IDN_PERMANENT_WPE = 0x02 , QUERY_FLAG_IDN_PWR_ON_WPE = 0x03 , QUERY_FLAG_IDN_BKOPS_EN = 0x04 ,
  QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE = 0x05 , QUERY_FLAG_IDN_PURGE_ENABLE = 0x06 , QUERY_FLAG_IDN_RESERVED2 = 0x07 , QUERY_FLAG_IDN_FPHYRESOURCEREMOVAL = 0x08 ,
  QUERY_FLAG_IDN_BUSY_RTC = 0x09 , QUERY_FLAG_IDN_RESERVED3 = 0x0A , QUERY_FLAG_IDN_PERMANENTLY_DISABLE_FW_UPDATE = 0x0B
}
 
enum  attr_idn {
  QUERY_ATTR_IDN_BOOT_LU_EN = 0x00 , QUERY_ATTR_IDN_RESERVED = 0x01 , QUERY_ATTR_IDN_POWER_MODE = 0x02 , QUERY_ATTR_IDN_ACTIVE_ICC_LVL = 0x03 ,
  QUERY_ATTR_IDN_OOO_DATA_EN = 0x04 , QUERY_ATTR_IDN_BKOPS_STATUS = 0x05 , QUERY_ATTR_IDN_PURGE_STATUS = 0x06 , QUERY_ATTR_IDN_MAX_DATA_IN = 0x07 ,
  QUERY_ATTR_IDN_MAX_DATA_OUT = 0x08 , QUERY_ATTR_IDN_DYN_CAP_NEEDED = 0x09 , QUERY_ATTR_IDN_REF_CLK_FREQ = 0x0A , QUERY_ATTR_IDN_CONF_DESC_LOCK = 0x0B ,
  QUERY_ATTR_IDN_MAX_NUM_OF_RTT = 0x0C , QUERY_ATTR_IDN_EE_CONTROL = 0x0D , QUERY_ATTR_IDN_EE_STATUS = 0x0E , QUERY_ATTR_IDN_SECONDS_PASSED = 0x0F ,
  QUERY_ATTR_IDN_CNTX_CONF = 0x10 , QUERY_ATTR_IDN_CORR_PRG_BLK_NUM = 0x11 , QUERY_ATTR_IDN_RESERVED2 = 0x12 , QUERY_ATTR_IDN_RESERVED3 = 0x13 ,
  QUERY_ATTR_IDN_FFU_STATUS = 0x14 , QUERY_ATTR_IDN_PSA_STATE = 0x15 , QUERY_ATTR_IDN_PSA_DATA_SIZE = 0x16
}
 
enum  desc_idn {
  QUERY_DESC_IDN_DEVICE = 0x0 , QUERY_DESC_IDN_CONFIGURATION = 0x1 , QUERY_DESC_IDN_UNIT = 0x2 , QUERY_DESC_IDN_RFU_0 = 0x3 ,
  QUERY_DESC_IDN_INTERCONNECT = 0x4 , QUERY_DESC_IDN_STRING = 0x5 , QUERY_DESC_IDN_RFU_1 = 0x6 , QUERY_DESC_IDN_GEOMETRY = 0x7 ,
  QUERY_DESC_IDN_POWER = 0x8 , QUERY_DESC_IDN_HEALTH = 0x9 , QUERY_DESC_IDN_MAX
}
 
enum  desc_header_offset { QUERY_DESC_LENGTH_OFFSET = 0x00 , QUERY_DESC_DESC_TYPE_OFFSET = 0x01 }
 
enum  ufs_desc_def_size {
  QUERY_DESC_DEVICE_DEF_SIZE = 0x40 , QUERY_DESC_CONFIGURATION_DEF_SIZE = 0x90 , QUERY_DESC_UNIT_DEF_SIZE = 0x23 , QUERY_DESC_INTERCONNECT_DEF_SIZE = 0x06 ,
  QUERY_DESC_GEOMETRY_DEF_SIZE = 0x48 , QUERY_DESC_POWER_DEF_SIZE = 0x62 , QUERY_DESC_HEALTH_DEF_SIZE = 0x25
}
 
enum  device_desc_param {
  DEVICE_DESC_PARAM_LEN = 0x0 , DEVICE_DESC_PARAM_TYPE = 0x1 , DEVICE_DESC_PARAM_DEVICE_TYPE = 0x2 , DEVICE_DESC_PARAM_DEVICE_CLASS = 0x3 ,
  DEVICE_DESC_PARAM_DEVICE_SUB_CLASS = 0x4 , DEVICE_DESC_PARAM_PRTCL = 0x5 , DEVICE_DESC_PARAM_NUM_LU = 0x6 , DEVICE_DESC_PARAM_NUM_WLU = 0x7 ,
  DEVICE_DESC_PARAM_BOOT_ENBL = 0x8 , DEVICE_DESC_PARAM_DESC_ACCSS_ENBL = 0x9 , DEVICE_DESC_PARAM_INIT_PWR_MODE = 0xA , DEVICE_DESC_PARAM_HIGH_PR_LUN = 0xB ,
  DEVICE_DESC_PARAM_SEC_RMV_TYPE = 0xC , DEVICE_DESC_PARAM_SEC_LU = 0xD , DEVICE_DESC_PARAM_BKOP_TERM_LT = 0xE , DEVICE_DESC_PARAM_ACTVE_ICC_LVL = 0xF ,
  DEVICE_DESC_PARAM_SPEC_VER = 0x10 , DEVICE_DESC_PARAM_MANF_DATE = 0x12 , DEVICE_DESC_PARAM_MANF_NAME = 0x14 , DEVICE_DESC_PARAM_PRDCT_NAME = 0x15 ,
  DEVICE_DESC_PARAM_SN = 0x16 , DEVICE_DESC_PARAM_OEM_ID = 0x17 , DEVICE_DESC_PARAM_MANF_ID = 0x18 , DEVICE_DESC_PARAM_UD_OFFSET = 0x1A ,
  DEVICE_DESC_PARAM_UD_LEN = 0x1B , DEVICE_DESC_PARAM_RTT_CAP = 0x1C , DEVICE_DESC_PARAM_FRQ_RTC = 0x1D , DEVICE_DESC_PARAM_UFS_FEAT = 0x1F ,
  DEVICE_DESC_PARAM_FFU_TMT = 0x20 , DEVICE_DESC_PARAM_Q_DPTH = 0x21 , DEVICE_DESC_PARAM_DEV_VER = 0x22 , DEVICE_DESC_PARAM_NUM_SEC_WPA = 0x24 ,
  DEVICE_DESC_PARAM_PSA_MAX_DATA = 0x25 , DEVICE_DESC_PARAM_PSA_TMT = 0x29 , DEVICE_DESC_PARAM_PRDCT_REV = 0x2A
}
 
enum  { UFSHCD_MAX_CHANNEL = 0 , UFSHCD_MAX_ID = 1 }
 
enum  dev_cmd_type { DEV_CMD_TYPE_NOP = 0x0 , DEV_CMD_TYPE_QUERY = 0x1 }
 
enum  link_status { UFSHCD_LINK_IS_DOWN = 1 , UFSHCD_LINK_IS_UP = 2 }
 
enum  uic_cmd_dme {
  UIC_CMD_DME_GET = 0x01 , UIC_CMD_DME_SET = 0x02 , UIC_CMD_DME_PEER_GET = 0x03 , UIC_CMD_DME_PEER_SET = 0x04 ,
  UIC_CMD_DME_POWERON = 0x10 , UIC_CMD_DME_POWEROFF = 0x11 , UIC_CMD_DME_ENABLE = 0x12 , UIC_CMD_DME_RESET = 0x14 ,
  UIC_CMD_DME_END_PT_RST = 0x15 , UIC_CMD_DME_LINK_STARTUP = 0x16 , UIC_CMD_DME_HIBER_ENTER = 0x17 , UIC_CMD_DME_HIBER_EXIT = 0x18 ,
  UIC_CMD_DME_TEST_MODE = 0x1A
}
 
enum  {
  UIC_CMD_RESULT_SUCCESS = 0x00 , UIC_CMD_RESULT_INVALID_ATTR = 0x01 , UIC_CMD_RESULT_FAILURE = 0x01 , UIC_CMD_RESULT_INVALID_ATTR_VALUE = 0x02 ,
  UIC_CMD_RESULT_READ_ONLY_ATTR = 0x03 , UIC_CMD_RESULT_WRITE_ONLY_ATTR = 0x04 , UIC_CMD_RESULT_BAD_INDEX = 0x05 , UIC_CMD_RESULT_LOCKED_ATTR = 0x06 ,
  UIC_CMD_RESULT_BAD_TEST_FEATURE_INDEX = 0x07 , UIC_CMD_RESULT_PEER_COMM_FAILURE = 0x08 , UIC_CMD_RESULT_BUSY = 0x09 , UIC_CMD_RESULT_DME_FAILURE = 0x0A
}
 
enum  uic_link_state { UIC_LINK_OFF_STATE = 0 , UIC_LINK_ACTIVE_STATE = 1 , UIC_LINK_HIBERN8_STATE = 2 }
 

Macro Definition Documentation

◆ ATTR_SET_NOR

#define ATTR_SET_NOR   0 /* NORMAL */

◆ ATTR_SET_ST

#define ATTR_SET_ST   1 /* STATIC */

◆ DME_LOCAL

#define DME_LOCAL   0

◆ DME_PEER

#define DME_PEER   1

◆ GENERAL_UPIU_REQUEST_SIZE

#define GENERAL_UPIU_REQUEST_SIZE   (sizeof(utp_upiu_req_t))

◆ MASK_UIC_COMMAND_RESULT

#define MASK_UIC_COMMAND_RESULT   0xFF

◆ MAX_BUFF

#define MAX_BUFF   (16 * 4)

◆ MAX_MODEL_LEN

#define MAX_MODEL_LEN   16

◆ QUERY_DESC_HDR_SIZE

#define QUERY_DESC_HDR_SIZE   2

◆ QUERY_DESC_MAX_SIZE

#define QUERY_DESC_MAX_SIZE   255

◆ QUERY_DESC_MIN_SIZE

#define QUERY_DESC_MIN_SIZE   2

◆ QUERY_OSF_SIZE

#define QUERY_OSF_SIZE   (GENERAL_UPIU_REQUEST_SIZE - (sizeof(utp_upiu_header_t)))

◆ RESPONSE_UPIU_SENSE_DATA_LENGTH [1/2]

#define RESPONSE_UPIU_SENSE_DATA_LENGTH   18

◆ RESPONSE_UPIU_SENSE_DATA_LENGTH [2/2]

#define RESPONSE_UPIU_SENSE_DATA_LENGTH   18

◆ UFS_CDB_SIZE

#define UFS_CDB_SIZE   16

◆ UFS_MAX_LUNS

#define UFS_MAX_LUNS   0x7F

◆ UFSHCD_QUIRK_BROKEN_LCC

#define UFSHCD_QUIRK_BROKEN_LCC   0x1

◆ UIC_ARG_ATTR_TYPE

#define UIC_ARG_ATTR_TYPE (   t)    (((t) &0xFF) << 16)

◆ UIC_ARG_MIB

#define UIC_ARG_MIB (   attr)    UIC_ARG_MIB_SEL(((uint32_t) attr), 0)

◆ UIC_ARG_MIB_SEL

#define UIC_ARG_MIB_SEL (   attr,
  sel 
)    ((((((uint32_t) attr)) & 0xFFFF) << 16) | ((sel) &0xFFFF))

◆ UIC_ARG_MPHY_RX_GEN_SEL_INDEX

#define UIC_ARG_MPHY_RX_GEN_SEL_INDEX (   lane)    (PA_MAXDATALANES + (lane))

◆ UIC_ARG_MPHY_TX_GEN_SEL_INDEX

#define UIC_ARG_MPHY_TX_GEN_SEL_INDEX (   lane)    (lane)

◆ UIC_GET_ATTR_ID

#define UIC_GET_ATTR_ID (   v)    (((v) >> 16) & 0xFFFF)

◆ UPIU_COMMAND_TYPE_OFFSET

#define UPIU_COMMAND_TYPE_OFFSET   28

◆ UPIU_HEADER_DWORD

#define UPIU_HEADER_DWORD (   byte3,
  byte2,
  byte1,
  byte0 
)    cpu_to_be32((byte3 << 24) | (byte2 << 16) | (byte1 << 8) | (byte0))

◆ UPIU_RSP_CODE_OFFSET [1/2]

#define UPIU_RSP_CODE_OFFSET   8

◆ UPIU_RSP_CODE_OFFSET [2/2]

#define UPIU_RSP_CODE_OFFSET   8

Typedef Documentation

◆ request_desc_header_t

struct request_desc_header - Descriptor Header common to both UTRD and UTMRD @dword0: Descriptor Header DW0 @dword1: Descriptor Header DW1 @dword2: Descriptor Header DW2 @dword3: Descriptor Header DW3

◆ ufs_basic_info_t

◆ ufs_desc_size_t

◆ ufs_dev_cmd_t

typedef struct ufs_dev_cmd ufs_dev_cmd_t

struct ufs_dev_cmd - all assosiated fields with device management commands @type: device management command type - Query, NOP OUT @tag_wq: wait queue until free command slot is available

◆ ufs_dev_desc_t

typedef struct ufs_dev_desc ufs_dev_desc_t

ufs_dev_desc - ufs device details from the device descriptor

@wmanufacturerid: card details @model: card model

◆ ufs_device_t

typedef struct ufs_device ufs_device_t

◆ ufs_hba_t

typedef struct ufs_hba ufs_hba_t

◆ ufs_pa_layer_attr_t

◆ ufs_pwr_mode_info_t

◆ ufs_query_req_t

struct ufs_query_req - parameters for building a query request @query_func: UPIU header query function @upiu_req: the query request data

◆ ufs_query_res_t

struct ufs_query_resp - UPIU QUERY @response: device response code @upiu_res: query response data

◆ ufs_query_t

typedef struct ufs_query ufs_query_t

struct ufs_query - holds relevant data structures for query request @request: request upiu and function @descriptor: buffer for sending/receiving descriptor @response: response upiu and response

◆ ufshcd_sg_entry_t

◆ uic_command_t

typedef struct uic_command uic_command_t

struct uic_command - UIC command structure @command: UIC command @argument1: UIC command argument 1 @argument2: UIC command argument 2 @argument3: UIC command argument 3 @cmd_active: Indicate if UIC command is outstanding

Returns
: UIC command result @done: UIC command completion

◆ utp_cmd_rsp_t

typedef struct utp_cmd_rsp utp_cmd_rsp_t

struct utp_cmd_rsp - Response UPIU structure @residual_transfer_count: Residual transfer count DW-3 @reserved: Reserved double words DW-4 to DW-7 @sense_data_len: Sense data length DW-8 U16 @sense_data: Sense data field DW-8 to DW-12

◆ utp_task_req_desc_t

◆ utp_transfer_cmd_desc_t

◆ utp_transfer_req_desc_t

struct utp_transfer_req_desc - UTRD structure @header: UTRD header DW-0 to DW-3 @command_desc_base_addr_lo: UCD base address low DW-4 @command_desc_base_addr_hi: UCD base address high DW-5 @response_upiu_length: response UPIU length DW-6 @response_upiu_offset: response UPIU offset DW-6 @prd_table_length: Physical region descriptor length DW-7 @prd_table_offset: Physical region descriptor offset DW-7

◆ utp_upiu_cmd_t

typedef struct utp_upiu_cmd utp_upiu_cmd_t

struct utp_upiu_cmd - Command UPIU structure @data_transfer_len: Data Transfer Length DW-3 @cdb: Command Descriptor Block CDB DW-4 to DW-7

◆ utp_upiu_header_t

struct utp_upiu_header - UPIU header structure @dword_0: UPIU header DW-0 @dword_1: UPIU header DW-1 @dword_2: UPIU header DW-2

◆ utp_upiu_query_t

struct utp_upiu_query - upiu request buffer structure for query request.

@opcode: command to perform B-0 @idn: a value that indicates the particular type of data B-1 @index: Index to further identify data B-2 @selector: Index to further identify data B-3 @reserved_osf: spec reserved field B-4,5 @length: number of descriptor bytes to read/write B-6,7 @value: Attribute value to be written DW-5 @reserved: spec reserved DW-6,7

◆ utp_upiu_req_t

typedef struct utp_upiu_req utp_upiu_req_t

struct utp_upiu_req - general upiu request structure @header:UPIU header structure DW-0 to DW-2 @sc: fields structure for scsi command DW-3 to DW-7 @qr: fields structure for query request DW-3 to DW-7

◆ utp_upiu_rsp_t

typedef struct utp_upiu_rsp utp_upiu_rsp_t

struct utp_upiu_rsp - general upiu response structure @header: UPIU header structure DW-0 to DW-2 @sr: fields structure for scsi command DW-3 to DW-12 @qr: fields structure for query request DW-3 to DW-7

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UFSHCI_VERSION_10 
UFSHCI_VERSION_11 
UFSHCI_VERSION_20 
UFSHCI_VERSION_21 

◆ anonymous enum

anonymous enum
Enumerator
INTERRUPT_MASK_ALL_VER_10 
INTERRUPT_MASK_RW_VER_10 
INTERRUPT_MASK_ALL_VER_11 
INTERRUPT_MASK_ALL_VER_21 

◆ anonymous enum

anonymous enum
Enumerator
PWR_OK 
PWR_LOCAL 
PWR_REMOTE 
PWR_BUSY 
PWR_ERROR_CAP 
PWR_FATAL_ERROR 

◆ anonymous enum

anonymous enum
Enumerator
TASK_REQ_UPIU_SIZE_DWORDS 
TASK_RSP_UPIU_SIZE_DWORDS 
ALIGNED_UPIU_SIZE 

◆ anonymous enum

anonymous enum
Enumerator
UTP_CMD_TYPE_SCSI 
UTP_CMD_TYPE_UFS 
UTP_CMD_TYPE_DEV_MANAGE 

◆ anonymous enum

anonymous enum
Enumerator
UTP_CMD_TYPE_UFS_STORAGE 

◆ anonymous enum

anonymous enum
Enumerator
UTP_SCSI_COMMAND 
UTP_NATIVE_UFS_COMMAND 
UTP_DEVICE_MANAGEMENT_FUNCTION 
UTP_REQ_DESC_INT_CMD 

◆ anonymous enum

anonymous enum
Enumerator
UTP_NO_DATA_TRANSFER 
UTP_HOST_TO_DEVICE 
UTP_DEVICE_TO_HOST 

◆ anonymous enum

anonymous enum
Enumerator
OCS_SUCCESS 
OCS_INVALID_CMD_TABLE_ATTR 
OCS_INVALID_PRDT_ATTR 
OCS_MISMATCH_DATA_BUF_SIZE 
OCS_MISMATCH_RESP_UPIU_SIZE 
OCS_PEER_COMM_FAILURE 
OCS_ABORTED 
OCS_FATAL_ERROR 
OCS_INVALID_COMMAND_STATUS 
MASK_OCS 

◆ anonymous enum

anonymous enum
Enumerator
UFS_ABORT_TASK 
UFS_ABORT_TASK_SET 
UFS_CLEAR_TASK_SET 
UFS_LOGICAL_RESET 
UFS_QUERY_TASK 
UFS_QUERY_TASK_SET 

◆ anonymous enum

anonymous enum
Enumerator
UPIU_TRANSACTION_NOP_OUT 
UPIU_TRANSACTION_COMMAND 
UPIU_TRANSACTION_DATA_OUT 
UPIU_TRANSACTION_TASK_REQ 
UPIU_TRANSACTION_QUERY_REQ 

◆ anonymous enum

anonymous enum
Enumerator
UPIU_TRANSACTION_NOP_IN 
UPIU_TRANSACTION_RESPONSE 
UPIU_TRANSACTION_DATA_IN 
UPIU_TRANSACTION_TASK_RSP 
UPIU_TRANSACTION_READY_XFER 
UPIU_TRANSACTION_QUERY_RSP 
UPIU_TRANSACTION_REJECT_UPIU 

◆ anonymous enum

anonymous enum
Enumerator
UPIU_CMD_FLAGS_NONE 
UPIU_CMD_FLAGS_WRITE 
UPIU_CMD_FLAGS_READ 

◆ anonymous enum

anonymous enum
Enumerator
UPIU_TASK_ATTR_SIMPLE 
UPIU_TASK_ATTR_ORDERED 
UPIU_TASK_ATTR_HEADQ 
UPIU_TASK_ATTR_ACA 

◆ anonymous enum

anonymous enum
Enumerator
UPIU_QUERY_FUNC_STANDARD_READ_REQUEST 
UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST 

◆ anonymous enum

anonymous enum
Enumerator
MASK_SCSI_STATUS 
MASK_TASK_RESPONSE 
MASK_RSP_UPIU_RESULT 
MASK_QUERY_DATA_SEG_LEN 
MASK_RSP_UPIU_DATA_SEG_LEN 
MASK_RSP_EXCEPTION_EVENT 
MASK_TM_SERVICE_RESP 
MASK_TM_FUNC 

◆ anonymous enum

anonymous enum
Enumerator
QUERY_RESULT_SUCCESS 
QUERY_RESULT_NOT_READABLE 
QUERY_RESULT_NOT_WRITEABLE 
QUERY_RESULT_ALREADY_WRITTEN 
QUERY_RESULT_INVALID_LENGTH 
QUERY_RESULT_INVALID_VALUE 
QUERY_RESULT_INVALID_SELECTOR 
QUERY_RESULT_INVALID_INDEX 
QUERY_RESULT_INVALID_IDN 
QUERY_RESULT_INVALID_OPCODE 
QUERY_RESULT_GENERAL_FAILURE 

◆ anonymous enum

anonymous enum
Enumerator
UPIU_COMMAND_SET_TYPE_SCSI 
UPIU_COMMAND_SET_TYPE_UFS 
UPIU_COMMAND_SET_TYPE_QUERY 

◆ anonymous enum

anonymous enum
Enumerator
UFSHCD_MAX_CHANNEL 
UFSHCD_MAX_ID 

◆ anonymous enum

anonymous enum
Enumerator
UIC_CMD_RESULT_SUCCESS 
UIC_CMD_RESULT_INVALID_ATTR 
UIC_CMD_RESULT_FAILURE 
UIC_CMD_RESULT_INVALID_ATTR_VALUE 
UIC_CMD_RESULT_READ_ONLY_ATTR 
UIC_CMD_RESULT_WRITE_ONLY_ATTR 
UIC_CMD_RESULT_BAD_INDEX 
UIC_CMD_RESULT_LOCKED_ATTR 
UIC_CMD_RESULT_BAD_TEST_FEATURE_INDEX 
UIC_CMD_RESULT_PEER_COMM_FAILURE 
UIC_CMD_RESULT_BUSY 
UIC_CMD_RESULT_DME_FAILURE 

◆ attr_idn

enum attr_idn
Enumerator
QUERY_ATTR_IDN_BOOT_LU_EN 
QUERY_ATTR_IDN_RESERVED 
QUERY_ATTR_IDN_POWER_MODE 
QUERY_ATTR_IDN_ACTIVE_ICC_LVL 
QUERY_ATTR_IDN_OOO_DATA_EN 
QUERY_ATTR_IDN_BKOPS_STATUS 
QUERY_ATTR_IDN_PURGE_STATUS 
QUERY_ATTR_IDN_MAX_DATA_IN 
QUERY_ATTR_IDN_MAX_DATA_OUT 
QUERY_ATTR_IDN_DYN_CAP_NEEDED 
QUERY_ATTR_IDN_REF_CLK_FREQ 
QUERY_ATTR_IDN_CONF_DESC_LOCK 
QUERY_ATTR_IDN_MAX_NUM_OF_RTT 
QUERY_ATTR_IDN_EE_CONTROL 
QUERY_ATTR_IDN_EE_STATUS 
QUERY_ATTR_IDN_SECONDS_PASSED 
QUERY_ATTR_IDN_CNTX_CONF 
QUERY_ATTR_IDN_CORR_PRG_BLK_NUM 
QUERY_ATTR_IDN_RESERVED2 
QUERY_ATTR_IDN_RESERVED3 
QUERY_ATTR_IDN_FFU_STATUS 
QUERY_ATTR_IDN_PSA_STATE 
QUERY_ATTR_IDN_PSA_DATA_SIZE 

◆ desc_header_offset

Enumerator
QUERY_DESC_LENGTH_OFFSET 
QUERY_DESC_DESC_TYPE_OFFSET 

◆ desc_idn

enum desc_idn
Enumerator
QUERY_DESC_IDN_DEVICE 
QUERY_DESC_IDN_CONFIGURATION 
QUERY_DESC_IDN_UNIT 
QUERY_DESC_IDN_RFU_0 
QUERY_DESC_IDN_INTERCONNECT 
QUERY_DESC_IDN_STRING 
QUERY_DESC_IDN_RFU_1 
QUERY_DESC_IDN_GEOMETRY 
QUERY_DESC_IDN_POWER 
QUERY_DESC_IDN_HEALTH 
QUERY_DESC_IDN_MAX 

◆ dev_cmd_type

Enumerator
DEV_CMD_TYPE_NOP 
DEV_CMD_TYPE_QUERY 

◆ device_desc_param

Enumerator
DEVICE_DESC_PARAM_LEN 
DEVICE_DESC_PARAM_TYPE 
DEVICE_DESC_PARAM_DEVICE_TYPE 
DEVICE_DESC_PARAM_DEVICE_CLASS 
DEVICE_DESC_PARAM_DEVICE_SUB_CLASS 
DEVICE_DESC_PARAM_PRTCL 
DEVICE_DESC_PARAM_NUM_LU 
DEVICE_DESC_PARAM_NUM_WLU 
DEVICE_DESC_PARAM_BOOT_ENBL 
DEVICE_DESC_PARAM_DESC_ACCSS_ENBL 
DEVICE_DESC_PARAM_INIT_PWR_MODE 
DEVICE_DESC_PARAM_HIGH_PR_LUN 
DEVICE_DESC_PARAM_SEC_RMV_TYPE 
DEVICE_DESC_PARAM_SEC_LU 
DEVICE_DESC_PARAM_BKOP_TERM_LT 
DEVICE_DESC_PARAM_ACTVE_ICC_LVL 
DEVICE_DESC_PARAM_SPEC_VER 
DEVICE_DESC_PARAM_MANF_DATE 
DEVICE_DESC_PARAM_MANF_NAME 
DEVICE_DESC_PARAM_PRDCT_NAME 
DEVICE_DESC_PARAM_SN 
DEVICE_DESC_PARAM_OEM_ID 
DEVICE_DESC_PARAM_MANF_ID 
DEVICE_DESC_PARAM_UD_OFFSET 
DEVICE_DESC_PARAM_UD_LEN 
DEVICE_DESC_PARAM_RTT_CAP 
DEVICE_DESC_PARAM_FRQ_RTC 
DEVICE_DESC_PARAM_UFS_FEAT 
DEVICE_DESC_PARAM_FFU_TMT 
DEVICE_DESC_PARAM_Q_DPTH 
DEVICE_DESC_PARAM_DEV_VER 
DEVICE_DESC_PARAM_NUM_SEC_WPA 
DEVICE_DESC_PARAM_PSA_MAX_DATA 
DEVICE_DESC_PARAM_PSA_TMT 
DEVICE_DESC_PARAM_PRDCT_REV 

◆ flag_idn

enum flag_idn
Enumerator
QUERY_FLAG_IDN_FDEVICEINIT 
QUERY_FLAG_IDN_PERMANENT_WPE 
QUERY_FLAG_IDN_PWR_ON_WPE 
QUERY_FLAG_IDN_BKOPS_EN 
QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE 
QUERY_FLAG_IDN_PURGE_ENABLE 
QUERY_FLAG_IDN_RESERVED2 
QUERY_FLAG_IDN_FPHYRESOURCEREMOVAL 
QUERY_FLAG_IDN_BUSY_RTC 
QUERY_FLAG_IDN_RESERVED3 
QUERY_FLAG_IDN_PERMANENTLY_DISABLE_FW_UPDATE 

◆ link_status

Enumerator
UFSHCD_LINK_IS_DOWN 
UFSHCD_LINK_IS_UP 

◆ query_opcode

Enumerator
UPIU_QUERY_OPCODE_NOP 
UPIU_QUERY_OPCODE_READ_DESC 
UPIU_QUERY_OPCODE_WRITE_DESC 
UPIU_QUERY_OPCODE_READ_ATTR 
UPIU_QUERY_OPCODE_WRITE_ATTR 
UPIU_QUERY_OPCODE_READ_FLAG 
UPIU_QUERY_OPCODE_SET_FLAG 
UPIU_QUERY_OPCODE_CLEAR_FLAG 
UPIU_QUERY_OPCODE_TOGGLE_FLAG 

◆ ufs_desc_def_size

Enumerator
QUERY_DESC_DEVICE_DEF_SIZE 
QUERY_DESC_CONFIGURATION_DEF_SIZE 
QUERY_DESC_UNIT_DEF_SIZE 
QUERY_DESC_INTERCONNECT_DEF_SIZE 
QUERY_DESC_GEOMETRY_DEF_SIZE 
QUERY_DESC_POWER_DEF_SIZE 
QUERY_DESC_HEALTH_DEF_SIZE 

◆ ufs_dev_pwr_mode

Enumerator
UFS_ACTIVE_PWR_MODE 
UFS_SLEEP_PWR_MODE 
UFS_POWERDOWN_PWR_MODE 

◆ ufs_notify_change_status

Enumerator
PRE_CHANGE 
POST_CHANGE 

◆ ufs_ref_clk_freq

Enumerator
REF_CLK_FREQ_19_2_MHZ 
REF_CLK_FREQ_26_MHZ 
REF_CLK_FREQ_38_4_MHZ 
REF_CLK_FREQ_52_MHZ 
REF_CLK_FREQ_INVAL 

◆ uic_cmd_dme

Enumerator
UIC_CMD_DME_GET 
UIC_CMD_DME_SET 
UIC_CMD_DME_PEER_GET 
UIC_CMD_DME_PEER_SET 
UIC_CMD_DME_POWERON 
UIC_CMD_DME_POWEROFF 
UIC_CMD_DME_ENABLE 
UIC_CMD_DME_RESET 
UIC_CMD_DME_END_PT_RST 
UIC_CMD_DME_LINK_STARTUP 
UIC_CMD_DME_HIBER_ENTER 
UIC_CMD_DME_HIBER_EXIT 
UIC_CMD_DME_TEST_MODE 

◆ uic_link_state

Enumerator
UIC_LINK_OFF_STATE 
UIC_LINK_ACTIVE_STATE 
UIC_LINK_HIBERN8_STATE