xref: /openbsd/sys/dev/ic/nvmeio.h (revision 4e9514d6)
1 /* $OpenBSD: nvmeio.h,v 1.1 2024/05/24 12:04:07 krw Exp $	*/
2 /*
3  * Copyright (c) 2023 Kenneth R Westerback <krw@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #define NVME_PASSTHROUGH_CMD	_IOWR('n', 0, struct nvme_pt_cmd)
19 
20 struct nvme_pt_status {
21 	int			ps_dv_unit;
22 	int			ps_nsid;
23 	int			ps_flags;
24 	uint32_t		ps_csts;
25 	uint32_t		ps_cc;
26 };
27 
28 struct nvme_pt_cmd {
29 	/* Commands may arrive via /dev/bio. */
30 	struct bio		pt_bio;
31 
32 	/* The sqe fields that the caller may specify. */
33 	uint8_t			pt_opcode;
34 	uint32_t		pt_nsid;
35 	uint32_t		pt_cdw10;
36 	uint32_t		pt_cdw11;
37 	uint32_t		pt_cdw12;
38 	uint32_t		pt_cdw13;
39 	uint32_t		pt_cdw14;
40 	uint32_t		pt_cdw15;
41 
42 	caddr_t			pt_status;
43 	uint32_t		pt_statuslen;
44 
45 	caddr_t			pt_databuf;	/* User space address. */
46 	uint32_t		pt_databuflen;	/* Length of buffer. */
47 };
48