smartmontools
SVN Rev 5645
Utility to control and monitor storage systems with "S.M.A.R.T."
openbsd_nvme_ioctl.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 Kenneth R Westerback <krw@openbsd.org>
3
*
4
* Permission to use, copy, modify, and distribute this software for any
5
* purpose with or without fee is hereby granted, provided that the above
6
* copyright notice and this permission notice appear in all copies.
7
*
8
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
*/
16
17
#define NVME_PASSTHROUGH_CMD _IOWR('n', 0, struct nvme_pt_cmd)
18
19
struct
nvme_pt_status
{
20
int
ps_dv_unit
;
21
int
ps_nsid
;
22
int
ps_flags
;
23
#define NVME_CQE_SCT(_f) ((_f) & (0x07 << 9))
24
#define NVME_CQE_SCT_GENERIC (0x00 << 9)
25
#define NVME_CQE_SC(_f) ((_f) & (0xff << 1))
26
#define NVME_CQE_SC_SUCCESS (0x00 << 1)
27
uint32_t
ps_csts
;
28
uint32_t
ps_cc
;
29
};
30
31
#define BIO_MSG_COUNT 5
32
#define BIO_MSG_LEN 128
33
34
struct
bio_msg
{
35
int
bm_type
;
36
char
bm_msg
[
BIO_MSG_LEN
];
37
};
38
39
struct
bio_status
{
40
char
bs_controller
[16];
41
int
bs_status
;
42
int
bs_msg_count
;
43
struct
bio_msg
bs_msgs
[
BIO_MSG_COUNT
];
44
};
45
46
struct
bio
{
47
void
*
bio_cookie
;
48
struct
bio_status
bio_status
;
49
};
50
51
struct
nvme_pt_cmd
{
52
/* Commands may arrive via /dev/bio. */
53
struct
bio
pt_bio
;
54
55
/* The sqe fields that the caller may specify. */
56
uint8_t
pt_opcode
;
57
uint32_t
pt_nsid
;
58
uint32_t
pt_cdw10
;
59
uint32_t
pt_cdw11
;
60
uint32_t
pt_cdw12
;
61
uint32_t
pt_cdw13
;
62
uint32_t
pt_cdw14
;
63
uint32_t
pt_cdw15
;
64
65
caddr_t
pt_status
;
66
uint32_t
pt_statuslen
;
67
68
caddr_t
pt_databuf
;
/* User space address. */
69
uint32_t
pt_databuflen
;
/* Length of buffer. */
70
};
71
72
#define nvme_completion_is_error(_flags) \
73
((NVME_CQE_SC(_flags) != NVME_CQE_SC_SUCCESS) \
74
|| (NVME_CQE_SCT(_flags) != NVME_CQE_SCT_GENERIC))
75
BIO_MSG_COUNT
#define BIO_MSG_COUNT
Definition:
openbsd_nvme_ioctl.h:31
BIO_MSG_LEN
#define BIO_MSG_LEN
Definition:
openbsd_nvme_ioctl.h:32
bio_msg
Definition:
openbsd_nvme_ioctl.h:34
bio_msg::bm_msg
char bm_msg[BIO_MSG_LEN]
Definition:
openbsd_nvme_ioctl.h:36
bio_msg::bm_type
int bm_type
Definition:
openbsd_nvme_ioctl.h:35
bio_status
Definition:
openbsd_nvme_ioctl.h:39
bio_status::bs_status
int bs_status
Definition:
openbsd_nvme_ioctl.h:41
bio_status::bs_msg_count
int bs_msg_count
Definition:
openbsd_nvme_ioctl.h:42
bio_status::bs_controller
char bs_controller[16]
Definition:
openbsd_nvme_ioctl.h:40
bio_status::bs_msgs
struct bio_msg bs_msgs[BIO_MSG_COUNT]
Definition:
openbsd_nvme_ioctl.h:43
bio
Definition:
openbsd_nvme_ioctl.h:46
bio::bio_cookie
void * bio_cookie
Definition:
openbsd_nvme_ioctl.h:47
nvme_pt_cmd
Definition:
openbsd_nvme_ioctl.h:51
nvme_pt_cmd::pt_opcode
uint8_t pt_opcode
Definition:
openbsd_nvme_ioctl.h:56
nvme_pt_cmd::pt_bio
struct bio pt_bio
Definition:
openbsd_nvme_ioctl.h:53
nvme_pt_cmd::pt_cdw13
uint32_t pt_cdw13
Definition:
openbsd_nvme_ioctl.h:61
nvme_pt_cmd::pt_databuflen
uint32_t pt_databuflen
Definition:
openbsd_nvme_ioctl.h:69
nvme_pt_cmd::pt_statuslen
uint32_t pt_statuslen
Definition:
openbsd_nvme_ioctl.h:66
nvme_pt_cmd::pt_cdw15
uint32_t pt_cdw15
Definition:
openbsd_nvme_ioctl.h:63
nvme_pt_cmd::pt_cdw12
uint32_t pt_cdw12
Definition:
openbsd_nvme_ioctl.h:60
nvme_pt_cmd::pt_databuf
caddr_t pt_databuf
Definition:
openbsd_nvme_ioctl.h:68
nvme_pt_cmd::pt_cdw11
uint32_t pt_cdw11
Definition:
openbsd_nvme_ioctl.h:59
nvme_pt_cmd::pt_cdw14
uint32_t pt_cdw14
Definition:
openbsd_nvme_ioctl.h:62
nvme_pt_cmd::pt_status
caddr_t pt_status
Definition:
openbsd_nvme_ioctl.h:65
nvme_pt_cmd::pt_nsid
uint32_t pt_nsid
Definition:
openbsd_nvme_ioctl.h:57
nvme_pt_cmd::pt_cdw10
uint32_t pt_cdw10
Definition:
openbsd_nvme_ioctl.h:58
nvme_pt_status
Definition:
openbsd_nvme_ioctl.h:19
nvme_pt_status::ps_flags
int ps_flags
Definition:
openbsd_nvme_ioctl.h:22
nvme_pt_status::ps_dv_unit
int ps_dv_unit
Definition:
openbsd_nvme_ioctl.h:20
nvme_pt_status::ps_csts
uint32_t ps_csts
Definition:
openbsd_nvme_ioctl.h:27
nvme_pt_status::ps_nsid
int ps_nsid
Definition:
openbsd_nvme_ioctl.h:21
nvme_pt_status::ps_cc
uint32_t ps_cc
Definition:
openbsd_nvme_ioctl.h:28
Generated on Tue Dec 10 2024 22:05:02 for smartmontools by
1.9.6