aboutsummaryrefslogtreecommitdiff
path: root/sys/include/dev
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-13 17:39:10 -0400
committerIan Moffett <ian@osmora.org>2024-07-13 19:25:42 -0400
commita2f8265e5d437e49244ffeb2926b46c056adb9fb (patch)
tree31e3c370d1c8f5c29d05f913e34dc979a69cdb12 /sys/include/dev
parent06f3138dc919df83cbacb880fb68d63698977e44 (diff)
kernel: nvme: Add nvme bdevsw + support for reads
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/dev')
-rw-r--r--sys/include/dev/ic/nvmevar.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/include/dev/ic/nvmevar.h b/sys/include/dev/ic/nvmevar.h
index b16f51d..ee829dc 100644
--- a/sys/include/dev/ic/nvmevar.h
+++ b/sys/include/dev/ic/nvmevar.h
@@ -41,6 +41,10 @@
#define ID_CNS_CTRL 0x01 /* Identify controller */
#define ID_CNS_NSID_LIST 0x07 /* Active NSID list */
+/* I/O commands */
+#define NVME_OP_WRITE 0x01
+#define NVME_OP_READ 0x02
+
struct nvme_identify_cmd {
uint8_t opcode;
uint8_t flags;
@@ -94,11 +98,32 @@ struct nvme_create_iosq_cmd {
uint64_t unused3[2];
};
+/* Read/write */
+struct nvme_rw_cmd {
+ uint8_t opcode;
+ uint8_t flags;
+ uint16_t cid;
+ uint32_t nsid;
+ uint64_t unused;
+ uint64_t metadata;
+ uint64_t prp1;
+ uint64_t prp2;
+ uint64_t slba;
+ uint16_t len;
+ uint16_t control;
+ uint32_t dsmgmt;
+ uint32_t ref;
+ uint16_t apptag;
+ uint16_t appmask;
+};
+
+
struct nvme_cmd {
union {
struct nvme_identify_cmd identify;
struct nvme_create_iocq_cmd create_iocq;
struct nvme_create_iosq_cmd create_iosq;
+ struct nvme_rw_cmd rw;
};
};
@@ -203,6 +228,7 @@ struct nvme_ns {
struct nvme_queue ioq; /* I/O queue */
struct nvme_lbaf lba_fmt; /* LBA format */
struct nvme_ctrl *ctrl; /* NVMe controller */
+ dev_t dev;
TAILQ_ENTRY(nvme_ns) link;
};