18#define NVME_RSVD(offset, bytes_size) rt_uint8_t __rsvd##offset[bytes_size]
256#define SGL_DESC_TYPE_DATA_BLOCK 0x0
257#define SGL_DESC_TYPE_BIT_BUCKET 0x1
258#define SGL_DESC_TYPE_SEGMENT 0x2
259#define SGL_DESC_TYPE_LAST_SEGMENT 0x3
260#define SGL_DESC_TYPE_KEYED_DATA_BLOCK 0x4
261#define SGL_DESC_TYPE_VENDOR_SPECIFIC 0xf
280 struct rt_nvme_sgl_desc
sgl;
494#define RT_NVME_CAP_MQES(cap) ((cap) & 0xffff)
495#define RT_NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
496#define RT_NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
497#define RT_NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf)
498#define RT_NVME_CAP_MPSMAX(cap) (((cap) >> 52) & 0xf)
500#define RT_NVME_VS(major, minor) (((major) << 16) | ((minor) << 8))
502#define RT_NVME_AQ_DEPTH 32
503#define RT_NVME_NR_AEN_COMMANDS 1
504#define RT_NVME_AQ_BLK_MQ_DEPTH (RT_NVME_AQ_DEPTH - RT_NVME_NR_AEN_COMMANDS)
505#define RT_NVME_AQ_MQ_TAG_DEPTH (RT_NVME_AQ_BLK_MQ_DEPTH - 1)
565#define RT_NVME_ID_CTRATT_ELBAS 15
566#define RT_NVME_ID_CTRATT_DNVMS 14
567#define RT_NVME_ID_CTRATT_DEG 13
568#define RT_NVME_ID_CTRATT_VCM 12
569#define RT_NVME_ID_CTRATT_FCM 11
570#define RT_NVME_ID_CTRATT_MDS 10
571#define RT_NVME_ID_CTRATT_UUIDL 9
572#define RT_NVME_ID_CTRATT_SQA 8
573#define RT_NVME_ID_CTRATT_NG 7
574#define RT_NVME_ID_CTRATT_TBKAS 6
575#define RT_NVME_ID_CTRATT_PLM 5
576#define RT_NVME_ID_CTRATT_EG 4
577#define RT_NVME_ID_CTRATT_RRL 3
578#define RT_NVME_ID_CTRATT_NVMS 2
579#define RT_NVME_ID_CTRATT_NOPSPM 1
580#define RT_NVME_ID_CTRATT_HIS 0
590#define RT_NVME_ID_NVMSR_NVMEE 1
591#define RT_NVME_ID_NVMSR_NVMESD 0
594#define RT_NVME_ID_VWCI_VWCRV 7
595#define RT_NVME_ID_VWCI_VWCR 0
597#define RT_NVME_ID_MEC_PCIEME 1
598#define RT_NVME_ID_MEC_SMBUSME 0
605#define RT_NVME_ID_FRMW_SMUD 5
606#define RT_NVME_ID_FRMW_FAWR 4
607#define RT_NVME_ID_FRMW_NOFS 1
608#define RT_NVME_ID_FRMW_FFSRO 0
622#define RT_NVME_ID_RPMBS_ASZ 24
623#define RT_NVME_ID_RPMBS_TSZ 16
624#define RT_NVME_ID_RPMBS_AM 3
625#define RT_NVME_ID_RPMBS_NORPMBU 2
634#define RT_NVME_ID_SANICAP_NODMMAS 30
635#define RT_NVME_ID_SANICAP_NDI 29
636#define RT_NVME_ID_SANICAP_OWS 2
637#define RT_NVME_ID_SANICAP_BES 1
638#define RT_NVME_ID_SANICAP_CES 0
669#define RT_NVME_ID_SGL_SUPPORT_MASK 0x3
687 struct rt_nvme_id_power_state psd[32];
850#define RT_USING_NVME_QUEUE (1 + (RT_USING_NVME_IO_QUEUE * RT_CPUS_NR))
878 struct rt_nvme_id_ns
id;
880#define rt_disk_to_nvme_device(disk) rt_container_of(disk, struct rt_nvme_device, parent)
rt_uint32_t __bitwise rt_le32_t
rt_uint64_t __bitwise rt_le64_t
rt_uint16_t __bitwise rt_le16_t
@ RT_NVME_RW_DSM_FREQ_RARE
@ RT_NVME_RW_DSM_FREQ_PREFETCH
@ RT_NVME_RW_DSM_FREQ_WRITES
@ RT_NVME_RW_DSM_FREQ_ONCE
@ RT_NVME_RW_DSM_FREQ_TEMP
@ RT_NVME_RW_DSM_FREQ_TYPICAL
@ RT_NVME_RW_DSM_LATENCY_IDLE
@ RT_NVME_RW_DSM_LATENCY_NONE
@ RT_NVME_RW_DSM_COMPRESSED
@ RT_NVME_RW_PRINFO_PRCHK_GUARD
@ RT_NVME_RW_DSM_LATENCY_NORM
@ RT_NVME_RW_APPEND_PIREMAP
@ RT_NVME_RW_PRINFO_PRCHK_APP
@ RT_NVME_RW_DTYPE_STREAMS
@ RT_NVME_RW_DSM_LATENCY_LOW
@ RT_NVME_RW_PRINFO_PRCHK_REF
@ RT_NVME_RW_PRINFO_PRACT
@ RT_NVME_RW_DSM_FREQ_READS
@ RT_NVME_RW_DSM_FREQ_UNSPEC
@ RT_NVME_PSDT_SGL_MPTR_SGL
@ RT_NVME_PSDT_SGL_MPTR_CONTIGUOUS
@ RT_NVME_FEAT_TEMP_THRESH
@ RT_NVME_FEAT_NUM_QUEUES
@ RT_NVME_FEAT_RESV_PERSIST
@ RT_NVME_FWACT_REPL_ACTV
@ RT_NVME_FEAT_ASYNC_EVENT
@ RT_NVME_FEAT_IRQ_CONFIG
@ RT_NVME_FEAT_IRQ_COALESCE
@ RT_NVME_FEAT_ARBITRATION
@ RT_NVME_FEAT_VOLATILE_WC
@ RT_NVME_FEAT_ERR_RECOVERY
@ RT_NVME_FEAT_SW_PROGRESS
@ RT_NVME_FEAT_WRITE_ATOMIC
@ RT_NVME_FEAT_POWER_MGMT
@ RT_NVME_QUEUE_PHYS_CONTIG
@ RT_NVME_LOG_RESERVATION
@ RT_NVME_CSTS_SHST_CMPLT
@ RT_NVME_CSTS_SHST_OCCUR
@ RT_NVME_CSTS_SHST_NORMAL
@ RT_NVME_SC_PMR_SAN_PROHIBITED
@ RT_NVME_SC_CMD_INTERRUPTED
@ RT_NVME_SC_INVALID_FIELD
@ RT_NVME_SC_ZONE_INVALID_TRANSITION
@ RT_NVME_SC_RESERVATION_CONFLICT
@ RT_NVME_SC_NS_ALREADY_ATTACHED
@ RT_NVME_SC_SEC_CTRL_STATE_INVALID
@ RT_NVME_SC_NS_ID_UNAVAILABLE
@ RT_NVME_SC_SGL_INVALID_TYPE
@ RT_NVME_SC_SGL_INVALID_METADATA
@ RT_NVME_SC_DATA_XFER_ERROR
@ RT_NVME_SC_CMD_NOT_SUP_CMB_QUEUE
@ RT_NVME_SC_FW_NEEDS_MAX_TIME
@ RT_NVME_SC_SGL_INVALID_OFFSET
@ RT_NVME_SC_ANA_INACCESSIBLE
@ RT_NVME_SC_ZONE_TOO_MANY_ACTIVE
@ RT_NVME_SC_NS_WRITE_PROTECTED
@ RT_NVME_SC_FIRMWARE_SLOT
@ RT_NVME_SC_ABORT_MISSING
@ RT_NVME_SC_CTRL_PATH_ERROR
@ RT_NVME_SC_ZONE_OFFLINE
@ RT_NVME_SC_SANITIZE_FAILED
@ RT_NVME_SC_FEATURE_NOT_SAVEABLE
@ RT_NVME_SC_ZONE_READ_ONLY
@ RT_NVME_SC_FEATURE_NOT_PER_NS
@ RT_NVME_SC_BAD_ATTRIBUTES
@ RT_NVME_SC_ZONE_BOUNDARY_ERROR
@ RT_NVME_SC_CONNECT_INVALID_HOST
@ RT_NVME_SC_OVERLAPPING_RANGE
@ RT_NVME_SC_ATOMIC_WU_EXCEEDED
@ RT_NVME_SC_SGL_INVALID_LAST
@ RT_NVME_SC_PRP_INVALID_OFFSET
@ RT_NVME_SC_NS_INSUFFICIENT_CAP
@ RT_NVME_SC_SGL_INVALID_DATA
@ RT_NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY
@ RT_NVME_SC_KA_TIMEOUT_INVALID
@ RT_NVME_SC_FW_NEEDS_CONV_RESET
@ RT_NVME_SC_CMB_INVALID_USE
@ RT_NVME_SC_NS_NOT_READY
@ RT_NVME_SC_BP_WRITE_PROHIBITED
@ RT_NVME_SC_THIN_PROV_NOT_SUPP
@ RT_NVME_SC_FW_NEEDS_RESET
@ RT_NVME_SC_FORMAT_IN_PROGRESS
@ RT_NVME_SC_ONCS_NOT_SUPPORTED
@ RT_NVME_SC_HOST_ABORTED_CMD
@ RT_NVME_SC_ZONE_TOO_MANY_OPEN
@ RT_NVME_SC_CONNECT_RESTART_DISC
@ RT_NVME_SC_HOST_ID_INCONSIST
@ RT_NVME_SC_REFTAG_CHECK
@ RT_NVME_SC_AUTH_REQUIRED
@ RT_NVME_SC_NS_NOT_ATTACHED
@ RT_NVME_SC_SANITIZE_IN_PROGRESS
@ RT_NVME_SC_SGL_INVALID_GRANULARITY
@ RT_NVME_SC_KA_TIMEOUT_EXPIRED
@ RT_NVME_SC_CTRL_RES_NUM_INVALID
@ RT_NVME_SC_COMPARE_FAILED
@ RT_NVME_SC_CONNECT_INVALID_PARAM
@ RT_NVME_SC_HOST_PATH_ERROR
@ RT_NVME_SC_ANA_PERSISTENT_LOSS
@ RT_NVME_SC_ANA_GROUP_ID_INVALID
@ RT_NVME_SC_ANA_TRANSITION
@ RT_NVME_SC_UNWRITTEN_BLOCK
@ RT_NVME_SC_NS_IS_PRIVATE
@ RT_NVME_SC_INVALID_VECTOR
@ RT_NVME_SC_ZONE_INVALID_WRITE
@ RT_NVME_SC_SGL_INVALID_COUNT
@ RT_NVME_SC_CTRL_ID_INVALID
@ RT_NVME_SC_ACCESS_DENIED
@ RT_NVME_SC_ANA_ATTACH_FAILED
@ RT_NVME_SC_CMDID_CONFLICT
@ RT_NVME_SC_FUSED_MISSING
@ RT_NVME_SC_CTRL_LIST_INVALID
@ RT_NVME_SC_CAP_EXCEEDED
@ RT_NVME_SC_INVALID_QUEUE
@ RT_NVME_SC_RES_ID_INVALID
@ RT_NVME_SC_ABORTED_PREEMPT_ABORT
@ RT_NVME_SC_INVALID_LOG_PAGE
@ RT_NVME_SC_INTERNAL_PATH_ERROR
@ RT_NVME_SC_CONNECT_FORMAT
@ RT_NVME_SC_FEATURE_NOT_CHANGEABLE
@ RT_NVME_SC_DISCOVERY_RESTART
@ RT_NVME_SC_APPTAG_CHECK
@ RT_NVME_SC_CONNECT_CTRL_BUSY
@ RT_NVME_SC_INVALID_FORMAT
@ RT_NVME_SC_FIRMWARE_IMAGE
@ RT_NVME_SC_FW_ACTIVATE_PROHIBITED
@ RT_NVME_SC_FW_NEEDS_SUBSYS_RESET
@ RT_NVME_SC_INVALID_OPCODE
@ RT_NVME_SC_INVALID_IO_CMD_SET
@ RT_NVME_SC_SELT_TEST_IN_PROGRESS
@ RT_NVME_SC_CMD_SEQ_ERROR
@ RT_NVME_SC_TRANSIENT_TR_ERR
@ RT_NVME_ADMIN_OPCODE_NVME_MI_RECV
@ RT_NVME_ADMIN_OPCODE_DEV_SELF_TEST
@ RT_NVME_ADMIN_OPCODE_IDENTIFY
@ RT_NVME_ADMIN_OPCODE_KEEP_ALIVE
@ RT_NVME_ADMIN_OPCODE_DIRECTIVE_SEND
@ RT_NVME_ADMIN_OPCODE_DOWNLOAD_FW
@ RT_NVME_ADMIN_OPCODE_DBBUF
@ RT_NVME_ADMIN_OPCODE_VIRTUAL_MGMT
@ RT_NVME_ADMIN_OPCODE_DELETE_SQ
@ RT_NVME_ADMIN_OPCODE_ABORT_CMD
@ RT_NVME_ADMIN_OPCODE_ACTIVATE_FW
@ RT_NVME_ADMIN_OPCODE_VENDOR_START
@ RT_NVME_ADMIN_OPCODE_FORMAT_NVM
@ RT_NVME_ADMIN_OPCODE_CREATE_CQ
@ RT_NVME_ADMIN_OPCODE_GET_FEATURES
@ RT_NVME_ADMIN_OPCODE_ASYNC_EVENT
@ RT_NVME_ADMIN_OPCODE_GET_LOG_PAGE
@ RT_NVME_ADMIN_OPCODE_DIRECTIVE_RECV
@ RT_NVME_ADMIN_OPCODE_SET_FEATURES
@ RT_NVME_ADMIN_OPCODE_NS_MGMT
@ RT_NVME_ADMIN_OPCODE_NVME_MI_SEND
@ RT_NVME_ADMIN_OPCODE_CREATE_SQ
@ RT_NVME_ADMIN_OPCODE_NS_ATTACH
@ RT_NVME_ADMIN_OPCODE_SANITIZE_NVM
@ RT_NVME_ADMIN_OPCODE_SECURITY_RECV
@ RT_NVME_ADMIN_OPCODE_GET_LBA_STATUS
@ RT_NVME_ADMIN_OPCODE_DELETE_CQ
@ RT_NVME_ADMIN_OPCODE_SECURITY_SEND
@ RT_NVME_NS_DPS_PI_TYPE2
@ RT_NVME_NS_DPC_PI_TYPE3
@ RT_NVME_NS_DPS_PI_TYPE3
@ RT_NVME_NS_FLBAS_LBA_SHIFT
@ RT_NVME_NS_DPC_PI_FIRST
@ RT_NVME_LBAF_RP_DEGRADED
@ RT_NVME_NS_FLBAS_LBA_UMASK
@ RT_NVME_NS_FLBAS_LBA_MASK
@ RT_NVME_NS_FLBAS_META_EXT
@ RT_NVME_NS_DPS_PI_TYPE1
@ RT_NVME_NS_DPC_PI_TYPE2
@ RT_NVME_NS_DPC_PI_TYPE1
@ RT_NVME_NS_DPS_PI_FIRST
rt_err_t rt_nvme_controller_unregister(struct rt_nvme_controller *nvme)
@ RT_NVME_CMD_FLAGS_PSDT_SHIFT
@ RT_NVME_CMD_FLAGS_FUSE_SHIFT
@ RT_NVME_CMD_RESV_RELEASE
@ RT_NVME_CMD_WRITE_UNCOR
@ RT_NVME_CMD_ZONE_MGMT_SEND
@ RT_NVME_CMD_RESV_ACQUIRE
@ RT_NVME_CMD_ZONE_MGMT_RECV
@ RT_NVME_CMD_VENDOR_START
@ RT_NVME_CMD_ZONE_APPEND
@ RT_NVME_CMD_RESV_REPORT
@ RT_NVME_CMD_WRITE_ZEROES
@ RT_NVME_CMD_RESV_REGISTER
rt_packed(struct rt_nvme_sgl_desc { rt_le64_t adddress;rt_le32_t length;rt_uint8_t reserved[3];#define SGL_DESC_TYPE_DATA_BLOCK #define SGL_DESC_TYPE_BIT_BUCKET #define SGL_DESC_TYPE_SEGMENT #define SGL_DESC_TYPE_LAST_SEGMENT #define SGL_DESC_TYPE_KEYED_DATA_BLOCK #define SGL_DESC_TYPE_VENDOR_SPECIFIC rt_uint8_t sgl_identify;})
rt_err_t rt_nvme_controller_register(struct rt_nvme_controller *nvme)
#define NVME_RSVD(offset, bytes_size)
@ RT_NVME_CTRL_CTRATT_ENDURANCE_GROUPS
@ RT_NVME_CTRL_OACS_NS_MNGT_SUPP
@ RT_NVME_CTRL_ONCS_COMPARE
@ RT_NVME_CTRL_CTRATT_NVM_SETS
@ RT_NVME_CTRL_CTRATT_128_ID
@ RT_NVME_CTRL_OACS_DIRECTIVES
@ RT_NVME_CTRL_LPA_CMD_EFFECTS_LOG
@ RT_NVME_CTRL_OACS_SEC_SUPP
@ RT_NVME_CTRL_ONCS_WRITE_UNCORRECTABLE
@ RT_NVME_CTRL_VWC_PRESENT
@ RT_NVME_CTRL_ONCS_WRITE_ZEROES
@ RT_NVME_CTRL_ONCS_RESERVATIONS
@ RT_NVME_CTRL_CTRATT_READ_RECV_LVLS
@ RT_NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY
@ RT_NVME_CTRL_CTRATT_PREDICTABLE_LAT
@ RT_NVME_CTRL_OACS_DBBUF_SUPP
@ RT_NVME_CTRL_ONCS_TIMESTAMP
@ RT_NVME_CTRL_CTRATT_NON_OP_PSP
@ RT_NVME_CTRL_CTRATT_UUID_LIST
@ RT_NVME_CTRL_CMIC_MULTI_PORT
@ RT_NVME_CTRL_CMIC_MULTI_CTRL
#define RT_USING_NVME_QUEUE
unsigned short rt_uint16_t
struct rt_list_node rt_list_t
unsigned long long rt_uint64_t
struct rt_nvme_sgl_desc sgl
struct rt_nvme_command_common common
struct rt_nvme_command_create_sq create_sq
struct rt_nvme_command_features features
struct rt_nvme_command_create_cq create_cq
struct rt_nvme_command_rw rw
struct rt_nvme_command_write_zeroes write_zeroes
struct rt_nvme_command_identify identify
struct rt_nvme_command_delete_queue delete_queue
union rt_nvme_completion::@064325341033320317076015147255076375165266057064 result
int irqs[RT_USING_NVME_QUEUE]
const struct rt_nvme_ops * ops
rt_uint32_t max_transfer_shift
struct rt_nvme_queue queue[RT_USING_NVME_QUEUE]
rt_uint32_t volatile_write_cache
volatile rt_atomic_t cmdid
struct rt_nvme_queue io_queues[RT_USING_NVME_IO_QUEUE *RT_CPUS_NR]
rt_uint32_t * doorbell_tbl
struct rt_nvme_queue admin_queue
rt_uint32_t doorbell_stride
volatile rt_atomic_t ioqid[RT_CPUS_NR]
struct rt_nvme_controller * ctrl
struct rt_blk_disk parent
void(* complete_cmd)(struct rt_nvme_queue *queue, struct rt_nvme_command *cmd)
rt_err_t(* setup_queue)(struct rt_nvme_queue *queue)
rt_err_t(* submit_cmd)(struct rt_nvme_queue *queue, struct rt_nvme_command *cmd)
rt_err_t(* cleanup_queue)(struct rt_nvme_queue *queue)
struct rt_completion done
struct rt_nvme_command * sq_cmds
struct rt_nvme_controller * nvme
struct rt_nvme_command * cmd
struct rt_nvme_completion * cq_entry