• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Definitions for the NVM Express ioctl interface
4  * Copyright (c) 2011-2014, Intel Corporation.
5  */
6 
7 #ifndef _UAPI_LINUX_NVME_IOCTL_H
8 #define _UAPI_LINUX_NVME_IOCTL_H
9 
10 #include <linux/types.h>
11 
12 struct nvme_user_io {
13 	__u8	opcode;
14 	__u8	flags;
15 	__u16	control;
16 	__u16	nblocks;
17 	__u16	rsvd;
18 	__u64	metadata;
19 	__u64	addr;
20 	__u64	slba;
21 	__u32	dsmgmt;
22 	__u32	reftag;
23 	__u16	apptag;
24 	__u16	appmask;
25 };
26 
27 struct nvme_passthru_cmd {
28 	__u8	opcode;
29 	__u8	flags;
30 	__u16	rsvd1;
31 	__u32	nsid;
32 	__u32	cdw2;
33 	__u32	cdw3;
34 	__u64	metadata;
35 	__u64	addr;
36 	__u32	metadata_len;
37 	__u32	data_len;
38 	__u32	cdw10;
39 	__u32	cdw11;
40 	__u32	cdw12;
41 	__u32	cdw13;
42 	__u32	cdw14;
43 	__u32	cdw15;
44 	__u32	timeout_ms;
45 	__u32	result;
46 };
47 
48 struct nvme_passthru_cmd64 {
49 	__u8	opcode;
50 	__u8	flags;
51 	__u16	rsvd1;
52 	__u32	nsid;
53 	__u32	cdw2;
54 	__u32	cdw3;
55 	__u64	metadata;
56 	__u64	addr;
57 	__u32	metadata_len;
58 	__u32	data_len;
59 	__u32	cdw10;
60 	__u32	cdw11;
61 	__u32	cdw12;
62 	__u32	cdw13;
63 	__u32	cdw14;
64 	__u32	cdw15;
65 	__u32	timeout_ms;
66 	__u32   rsvd2;
67 	__u64	result;
68 };
69 
70 #define nvme_admin_cmd nvme_passthru_cmd
71 
72 #define NVME_IOCTL_ID		_IO('N', 0x40)
73 #define NVME_IOCTL_ADMIN_CMD	_IOWR('N', 0x41, struct nvme_admin_cmd)
74 #define NVME_IOCTL_SUBMIT_IO	_IOW('N', 0x42, struct nvme_user_io)
75 #define NVME_IOCTL_IO_CMD	_IOWR('N', 0x43, struct nvme_passthru_cmd)
76 #define NVME_IOCTL_RESET	_IO('N', 0x44)
77 #define NVME_IOCTL_SUBSYS_RESET	_IO('N', 0x45)
78 #define NVME_IOCTL_RESCAN	_IO('N', 0x46)
79 #define NVME_IOCTL_ADMIN64_CMD	_IOWR('N', 0x47, struct nvme_passthru_cmd64)
80 #define NVME_IOCTL_IO64_CMD	_IOWR('N', 0x48, struct nvme_passthru_cmd64)
81 
82 #endif /* _UAPI_LINUX_NVME_IOCTL_H */
83