• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Definitions for the NVM Express ioctl interface
3  * Copyright (c) 2011-2014, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14 
15 #ifndef _UAPI_LINUX_NVME_IOCTL_H
16 #define _UAPI_LINUX_NVME_IOCTL_H
17 
18 #include <linux/types.h>
19 
20 struct nvme_user_io {
21 	__u8	opcode;
22 	__u8	flags;
23 	__u16	control;
24 	__u16	nblocks;
25 	__u16	rsvd;
26 	__u64	metadata;
27 	__u64	addr;
28 	__u64	slba;
29 	__u32	dsmgmt;
30 	__u32	reftag;
31 	__u16	apptag;
32 	__u16	appmask;
33 };
34 
35 struct nvme_passthru_cmd {
36 	__u8	opcode;
37 	__u8	flags;
38 	__u16	rsvd1;
39 	__u32	nsid;
40 	__u32	cdw2;
41 	__u32	cdw3;
42 	__u64	metadata;
43 	__u64	addr;
44 	__u32	metadata_len;
45 	__u32	data_len;
46 	__u32	cdw10;
47 	__u32	cdw11;
48 	__u32	cdw12;
49 	__u32	cdw13;
50 	__u32	cdw14;
51 	__u32	cdw15;
52 	__u32	timeout_ms;
53 	__u32	result;
54 };
55 
56 #define nvme_admin_cmd nvme_passthru_cmd
57 
58 #define NVME_IOCTL_ID		_IO('N', 0x40)
59 #define NVME_IOCTL_ADMIN_CMD	_IOWR('N', 0x41, struct nvme_admin_cmd)
60 #define NVME_IOCTL_SUBMIT_IO	_IOW('N', 0x42, struct nvme_user_io)
61 #define NVME_IOCTL_IO_CMD	_IOWR('N', 0x43, struct nvme_passthru_cmd)
62 #define NVME_IOCTL_RESET	_IO('N', 0x44)
63 #define NVME_IOCTL_SUBSYS_RESET	_IO('N', 0x45)
64 #define NVME_IOCTL_RESCAN	_IO('N', 0x46)
65 
66 #endif /* _UAPI_LINUX_NVME_IOCTL_H */
67