aboutsummaryrefslogtreecommitdiff
path: root/include/freebsd_nvme_ioctl.h
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-02-28 03:48:11 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2018-02-28 03:48:11 +0000
commit090d6026610616895444792b75d90861b3c968f9 (patch)
tree45519da51f3e6e59487148dda9a40b0c8099c563 /include/freebsd_nvme_ioctl.h
parentd421ee73f7d1eee168b1e87cf14a725f10edf6b9 (diff)
downloadsg3_utils-090d6026610616895444792b75d90861b3c968f9.tar.gz
sg_write_x: add --quiet option; fix sg_if_can2stdxxx problem when es=0; other cleanups
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@757 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'include/freebsd_nvme_ioctl.h')
-rw-r--r--include/freebsd_nvme_ioctl.h215
1 files changed, 114 insertions, 101 deletions
diff --git a/include/freebsd_nvme_ioctl.h b/include/freebsd_nvme_ioctl.h
index f5761430..a7c970b9 100644
--- a/include/freebsd_nvme_ioctl.h
+++ b/include/freebsd_nvme_ioctl.h
@@ -1,3 +1,6 @@
+#ifndef FREEBSD_NVME_IOCTL_H
+#define FREEBSD_NVME_IOCTL_H
+
/*-
* Copyright (C) 2012-2013 Intel Corporation
* All rights reserved.
@@ -25,131 +28,141 @@
*
* $FreeBSD$
*/
-
-
+
+
#include <sys/param.h>
-#define NVME_PASSTHROUGH_CMD _IOWR('n', 0, struct nvme_pt_command)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NVME_PASSTHROUGH_CMD _IOWR('n', 0, struct nvme_pt_command)
#if __FreeBSD_version < 1100110
struct nvme_command
{
- /* dword 0 */
- uint16_t opc : 8; /* opcode */
- uint16_t fuse : 2; /* fused operation */
- uint16_t rsvd1 : 6;
- uint16_t cid; /* command identifier */
-
- /* dword 1 */
- uint32_t nsid; /* namespace identifier */
-
- /* dword 2-3 */
- uint32_t rsvd2;
- uint32_t rsvd3;
-
- /* dword 4-5 */
- uint64_t mptr; /* metadata pointer */
-
- /* dword 6-7 */
- uint64_t prp1; /* prp entry 1 */
-
- /* dword 8-9 */
- uint64_t prp2; /* prp entry 2 */
-
- /* dword 10-15 */
- uint32_t cdw10; /* command-specific */
- uint32_t cdw11; /* command-specific */
- uint32_t cdw12; /* command-specific */
- uint32_t cdw13; /* command-specific */
- uint32_t cdw14; /* command-specific */
- uint32_t cdw15; /* command-specific */
+ /* dword 0 */
+ uint16_t opc : 8; /* opcode */
+ uint16_t fuse : 2; /* fused operation */
+ uint16_t rsvd1 : 6;
+ uint16_t cid; /* command identifier */
+
+ /* dword 1 */
+ uint32_t nsid; /* namespace identifier */
+
+ /* dword 2-3 */
+ uint32_t rsvd2;
+ uint32_t rsvd3;
+
+ /* dword 4-5 */
+ uint64_t mptr; /* metadata pointer */
+
+ /* dword 6-7 */
+ uint64_t prp1; /* prp entry 1 */
+
+ /* dword 8-9 */
+ uint64_t prp2; /* prp entry 2 */
+
+ /* dword 10-15 */
+ uint32_t cdw10; /* command-specific */
+ uint32_t cdw11; /* command-specific */
+ uint32_t cdw12; /* command-specific */
+ uint32_t cdw13; /* command-specific */
+ uint32_t cdw14; /* command-specific */
+ uint32_t cdw15; /* command-specific */
} __packed;
struct nvme_status {
- uint16_t p : 1; /* phase tag */
- uint16_t sc : 8; /* status code */
- uint16_t sct : 3; /* status code type */
- uint16_t rsvd2 : 2;
- uint16_t m : 1; /* more */
- uint16_t dnr : 1; /* do not retry */
+ uint16_t p : 1; /* phase tag */
+ uint16_t sc : 8; /* status code */
+ uint16_t sct : 3; /* status code type */
+ uint16_t rsvd2 : 2;
+ uint16_t m : 1; /* more */
+ uint16_t dnr : 1; /* do not retry */
} __packed;
struct nvme_completion {
- /* dword 0 */
- uint32_t cdw0; /* command-specific */
+ /* dword 0 */
+ uint32_t cdw0; /* command-specific */
- /* dword 1 */
- uint32_t rsvd1;
+ /* dword 1 */
+ uint32_t rsvd1;
- /* dword 2 */
- uint16_t sqhd; /* submission queue head pointer */
- uint16_t sqid; /* submission queue identifier */
+ /* dword 2 */
+ uint16_t sqhd; /* submission queue head pointer */
+ uint16_t sqid; /* submission queue identifier */
- /* dword 3 */
- uint16_t cid; /* command identifier */
- struct nvme_status status;
+ /* dword 3 */
+ uint16_t cid; /* command identifier */
+ struct nvme_status status;
} __packed;
struct nvme_pt_command {
- /*
- * cmd is used to specify a passthrough command to a controller or
- * namespace.
- *
- * The following fields from cmd may be specified by the caller:
- * * opc (opcode)
- * * nsid (namespace id) - for admin commands only
- * * cdw10-cdw15
- *
- * Remaining fields must be set to 0 by the caller.
- */
- struct nvme_command cmd;
-
- /*
- * cpl returns completion status for the passthrough command
- * specified by cmd.
- *
- * The following fields will be filled out by the driver, for
- * consumption by the caller:
- * * cdw0
- * * status (except for phase)
- *
- * Remaining fields will be set to 0 by the driver.
- */
- struct nvme_completion cpl;
-
- /* buf is the data buffer associated with this passthrough command. */
- void * buf;
-
- /*
- * len is the length of the data buffer associated with this
- * passthrough command.
- */
- uint32_t len;
-
- /*
- * is_read = 1 if the passthrough command will read data into the
- * supplied buffer from the controller.
- *
- * is_read = 0 if the passthrough command will write data from the
- * supplied buffer to the controller.
- */
- uint32_t is_read;
-
- /*
- * driver_lock is used by the driver only. It must be set to 0
- * by the caller.
- */
- struct mtx * driver_lock;
+ /*
+ * cmd is used to specify a passthrough command to a controller or
+ * namespace.
+ *
+ * The following fields from cmd may be specified by the caller:
+ * * opc (opcode)
+ * * nsid (namespace id) - for admin commands only
+ * * cdw10-cdw15
+ *
+ * Remaining fields must be set to 0 by the caller.
+ */
+ struct nvme_command cmd;
+
+ /*
+ * cpl returns completion status for the passthrough command
+ * specified by cmd.
+ *
+ * The following fields will be filled out by the driver, for
+ * consumption by the caller:
+ * * cdw0
+ * * status (except for phase)
+ *
+ * Remaining fields will be set to 0 by the driver.
+ */
+ struct nvme_completion cpl;
+
+ /* buf is the data buffer associated with this passthrough command. */
+ void * buf;
+
+ /*
+ * len is the length of the data buffer associated with this
+ * passthrough command.
+ */
+ uint32_t len;
+
+ /*
+ * is_read = 1 if the passthrough command will read data into the
+ * supplied buffer from the controller.
+ *
+ * is_read = 0 if the passthrough command will write data from the
+ * supplied buffer to the controller.
+ */
+ uint32_t is_read;
+
+ /*
+ * driver_lock is used by the driver only. It must be set to 0
+ * by the caller.
+ */
+ struct mtx * driver_lock;
};
#else
#include <dev/nvme/nvme.h>
#endif
-#define nvme_completion_is_error(cpl) \
- ((cpl)->status.sc != 0 || (cpl)->status.sct != 0)
+#define nvme_completion_is_error(cpl) \
+ ((cpl)->status.sc != 0 || (cpl)->status.sct != 0)
+
+#define NVME_CTRLR_PREFIX "/dev/nvme"
+#define NVME_NS_PREFIX "ns"
+
+#ifdef __cplusplus
+}
+#endif
-#define NVME_CTRLR_PREFIX "/dev/nvme"
-#define NVME_NS_PREFIX "ns"
+#endif /* for FREEBSD_NVME_IOCTL_H */