1*c5c0fdbeSDavid 'Digit' Turner /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*c5c0fdbeSDavid 'Digit' Turner /* 3*c5c0fdbeSDavid 'Digit' Turner * Definitions for the NVM Express ioctl interface 4*c5c0fdbeSDavid 'Digit' Turner * Copyright (c) 2011-2014, Intel Corporation. 5*c5c0fdbeSDavid 'Digit' Turner */ 6*c5c0fdbeSDavid 'Digit' Turner 7*c5c0fdbeSDavid 'Digit' Turner #ifndef _LINUX_NVME_IOCTL_H 8*c5c0fdbeSDavid 'Digit' Turner #define _LINUX_NVME_IOCTL_H 9*c5c0fdbeSDavid 'Digit' Turner 10*c5c0fdbeSDavid 'Digit' Turner #include <linux/types.h> 11*c5c0fdbeSDavid 'Digit' Turner 12*c5c0fdbeSDavid 'Digit' Turner struct nvme_user_io { 13*c5c0fdbeSDavid 'Digit' Turner __u8 opcode; 14*c5c0fdbeSDavid 'Digit' Turner __u8 flags; 15*c5c0fdbeSDavid 'Digit' Turner __u16 control; 16*c5c0fdbeSDavid 'Digit' Turner __u16 nblocks; 17*c5c0fdbeSDavid 'Digit' Turner __u16 rsvd; 18*c5c0fdbeSDavid 'Digit' Turner __u64 metadata; 19*c5c0fdbeSDavid 'Digit' Turner __u64 addr; 20*c5c0fdbeSDavid 'Digit' Turner __u64 slba; 21*c5c0fdbeSDavid 'Digit' Turner __u32 dsmgmt; 22*c5c0fdbeSDavid 'Digit' Turner __u32 reftag; 23*c5c0fdbeSDavid 'Digit' Turner __u16 apptag; 24*c5c0fdbeSDavid 'Digit' Turner __u16 appmask; 25*c5c0fdbeSDavid 'Digit' Turner }; 26*c5c0fdbeSDavid 'Digit' Turner 27*c5c0fdbeSDavid 'Digit' Turner struct nvme_passthru_cmd { 28*c5c0fdbeSDavid 'Digit' Turner __u8 opcode; 29*c5c0fdbeSDavid 'Digit' Turner __u8 flags; 30*c5c0fdbeSDavid 'Digit' Turner __u16 rsvd1; 31*c5c0fdbeSDavid 'Digit' Turner __u32 nsid; 32*c5c0fdbeSDavid 'Digit' Turner __u32 cdw2; 33*c5c0fdbeSDavid 'Digit' Turner __u32 cdw3; 34*c5c0fdbeSDavid 'Digit' Turner __u64 metadata; 35*c5c0fdbeSDavid 'Digit' Turner __u64 addr; 36*c5c0fdbeSDavid 'Digit' Turner __u32 metadata_len; 37*c5c0fdbeSDavid 'Digit' Turner __u32 data_len; 38*c5c0fdbeSDavid 'Digit' Turner __u32 cdw10; 39*c5c0fdbeSDavid 'Digit' Turner __u32 cdw11; 40*c5c0fdbeSDavid 'Digit' Turner __u32 cdw12; 41*c5c0fdbeSDavid 'Digit' Turner __u32 cdw13; 42*c5c0fdbeSDavid 'Digit' Turner __u32 cdw14; 43*c5c0fdbeSDavid 'Digit' Turner __u32 cdw15; 44*c5c0fdbeSDavid 'Digit' Turner __u32 timeout_ms; 45*c5c0fdbeSDavid 'Digit' Turner __u32 result; 46*c5c0fdbeSDavid 'Digit' Turner }; 47*c5c0fdbeSDavid 'Digit' Turner 48*c5c0fdbeSDavid 'Digit' Turner struct nvme_passthru_cmd64 { 49*c5c0fdbeSDavid 'Digit' Turner __u8 opcode; 50*c5c0fdbeSDavid 'Digit' Turner __u8 flags; 51*c5c0fdbeSDavid 'Digit' Turner __u16 rsvd1; 52*c5c0fdbeSDavid 'Digit' Turner __u32 nsid; 53*c5c0fdbeSDavid 'Digit' Turner __u32 cdw2; 54*c5c0fdbeSDavid 'Digit' Turner __u32 cdw3; 55*c5c0fdbeSDavid 'Digit' Turner __u64 metadata; 56*c5c0fdbeSDavid 'Digit' Turner __u64 addr; 57*c5c0fdbeSDavid 'Digit' Turner __u32 metadata_len; 58*c5c0fdbeSDavid 'Digit' Turner union { 59*c5c0fdbeSDavid 'Digit' Turner __u32 data_len; /* for non-vectored io */ 60*c5c0fdbeSDavid 'Digit' Turner __u32 vec_cnt; /* for vectored io */ 61*c5c0fdbeSDavid 'Digit' Turner }; 62*c5c0fdbeSDavid 'Digit' Turner __u32 cdw10; 63*c5c0fdbeSDavid 'Digit' Turner __u32 cdw11; 64*c5c0fdbeSDavid 'Digit' Turner __u32 cdw12; 65*c5c0fdbeSDavid 'Digit' Turner __u32 cdw13; 66*c5c0fdbeSDavid 'Digit' Turner __u32 cdw14; 67*c5c0fdbeSDavid 'Digit' Turner __u32 cdw15; 68*c5c0fdbeSDavid 'Digit' Turner __u32 timeout_ms; 69*c5c0fdbeSDavid 'Digit' Turner __u32 rsvd2; 70*c5c0fdbeSDavid 'Digit' Turner __u64 result; 71*c5c0fdbeSDavid 'Digit' Turner }; 72*c5c0fdbeSDavid 'Digit' Turner 73*c5c0fdbeSDavid 'Digit' Turner /* same as struct nvme_passthru_cmd64, minus the 8b result field */ 74*c5c0fdbeSDavid 'Digit' Turner struct nvme_uring_cmd { 75*c5c0fdbeSDavid 'Digit' Turner __u8 opcode; 76*c5c0fdbeSDavid 'Digit' Turner __u8 flags; 77*c5c0fdbeSDavid 'Digit' Turner __u16 rsvd1; 78*c5c0fdbeSDavid 'Digit' Turner __u32 nsid; 79*c5c0fdbeSDavid 'Digit' Turner __u32 cdw2; 80*c5c0fdbeSDavid 'Digit' Turner __u32 cdw3; 81*c5c0fdbeSDavid 'Digit' Turner __u64 metadata; 82*c5c0fdbeSDavid 'Digit' Turner __u64 addr; 83*c5c0fdbeSDavid 'Digit' Turner __u32 metadata_len; 84*c5c0fdbeSDavid 'Digit' Turner __u32 data_len; 85*c5c0fdbeSDavid 'Digit' Turner __u32 cdw10; 86*c5c0fdbeSDavid 'Digit' Turner __u32 cdw11; 87*c5c0fdbeSDavid 'Digit' Turner __u32 cdw12; 88*c5c0fdbeSDavid 'Digit' Turner __u32 cdw13; 89*c5c0fdbeSDavid 'Digit' Turner __u32 cdw14; 90*c5c0fdbeSDavid 'Digit' Turner __u32 cdw15; 91*c5c0fdbeSDavid 'Digit' Turner __u32 timeout_ms; 92*c5c0fdbeSDavid 'Digit' Turner __u32 rsvd2; 93*c5c0fdbeSDavid 'Digit' Turner }; 94*c5c0fdbeSDavid 'Digit' Turner 95*c5c0fdbeSDavid 'Digit' Turner #define nvme_admin_cmd nvme_passthru_cmd 96*c5c0fdbeSDavid 'Digit' Turner 97*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_ID _IO('N', 0x40) 98*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) 99*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) 100*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd) 101*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_RESET _IO('N', 0x44) 102*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) 103*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_RESCAN _IO('N', 0x46) 104*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64) 105*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64) 106*c5c0fdbeSDavid 'Digit' Turner #define NVME_IOCTL_IO64_CMD_VEC _IOWR('N', 0x49, struct nvme_passthru_cmd64) 107*c5c0fdbeSDavid 'Digit' Turner 108*c5c0fdbeSDavid 'Digit' Turner /* io_uring async commands: */ 109*c5c0fdbeSDavid 'Digit' Turner #define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd) 110*c5c0fdbeSDavid 'Digit' Turner #define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd) 111*c5c0fdbeSDavid 'Digit' Turner #define NVME_URING_CMD_ADMIN _IOWR('N', 0x82, struct nvme_uring_cmd) 112*c5c0fdbeSDavid 'Digit' Turner #define NVME_URING_CMD_ADMIN_VEC _IOWR('N', 0x83, struct nvme_uring_cmd) 113*c5c0fdbeSDavid 'Digit' Turner 114*c5c0fdbeSDavid 'Digit' Turner #endif /* _LINUX_NVME_IOCTL_H */ 115