aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-08 23:17:55 -0400
committerIan Moffett <ian@osmora.org>2024-04-08 23:17:55 -0400
commit803b03e1bfe87dc28c387a22b4559423945f2bdd (patch)
tree1e83231ae1a2b2cb572a804730adb6ce71906c5b
parent0afeb373b8404636770904da99d753a7d8d88eed (diff)
kernel: nvme: Move defines to nvmevar.h
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/dev/ic/nvme.c16
-rw-r--r--sys/include/dev/ic/nvmevar.h17
2 files changed, 17 insertions, 16 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 55fbd88..7b79da9 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -42,22 +42,6 @@ __MODULE_NAME("nvme");
__KERNEL_META("$Hyra$: nvme.c, Ian Marco Moffett, "
"NVMe driver");
-#define COMMAND_SIZE 64 /* In bytes (defined by spec) */
-
-#define CAP_MPSMIN(caps) ((caps >> 48) & 0xF)
-#define CAP_MPSMAX(caps) ((caps >> 52) & 0xF)
-#define CAP_TIMEOUT(caps) ((caps >> 24) & 0xFF)
-#define CAP_STRIDE(caps) ((caps >> 32) & 0xF)
-#define CAP_MQES(caps) (caps & 0xFFFF)
-#define CAP_CSS(caps) (caps & 0xFF)
-
-#define STATUS_READY(status) (status & 1)
-
-#define CONFIG_EN __BIT(0)
-#define CONFIG_CSS_SHIFT 4
-#define CONFIG_IOSQES_SHIFT 16
-#define CONFIG_IOCQES_SHIFT 20
-
static struct pci_device *nvme_dev;
static struct timer driver_tmr;
static TAILQ_HEAD(,nvme_ns) namespaces;
diff --git a/sys/include/dev/ic/nvmevar.h b/sys/include/dev/ic/nvmevar.h
index 52fa5ad..4a40071 100644
--- a/sys/include/dev/ic/nvmevar.h
+++ b/sys/include/dev/ic/nvmevar.h
@@ -41,6 +41,23 @@
#define NVME_OP_WRITE 0x01
#define NVME_OP_READ 0x02
+/* Controller Capabilities */
+#define CAP_MPSMIN(caps) ((caps >> 48) & 0xF)
+#define CAP_MPSMAX(caps) ((caps >> 52) & 0xF)
+#define CAP_TIMEOUT(caps) ((caps >> 24) & 0xFF)
+#define CAP_STRIDE(caps) ((caps >> 32) & 0xF)
+#define CAP_MQES(caps) (caps & 0xFFFF)
+#define CAP_CSS(caps) (caps & 0xFF)
+
+/* Controller Configuration */
+#define CONFIG_EN __BIT(0)
+#define CONFIG_CSS_SHIFT 4
+#define CONFIG_IOSQES_SHIFT 16
+#define CONFIG_IOCQES_SHIFT 20
+
+#define COMMAND_SIZE 64 /* In bytes (defined by spec) */
+#define STATUS_READY(status) (status & 1)
+
struct nvme_common_cmd {
uint8_t opcode;
uint8_t flags;