summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-14 00:23:21 -0400
committerIan Moffett <ian@osmora.org>2024-07-14 00:23:21 -0400
commitce3993db402820f3d908ab630b117d1cf59858b1 (patch)
treee8e6938b8a1f8a3dc7973a1d3acefec57e12f393 /sys/dev
parent65d87c37606fb01b12d7d8271bbc14a94218f0c1 (diff)
kernel: nvme: Use CAP.MQES for qsize
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/nvme.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 4bceffd..984d479 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -169,15 +169,20 @@ nvme_create_ioq(struct nvme_ns *ns, size_t id)
struct nvme_create_iocq_cmd *create_iocq;
struct nvme_create_iosq_cmd *create_iosq;
struct nvme_cmd cmd = {0};
+ uint32_t caps;
+ uint16_t mqes;
int error;
+ caps = mmio_read32(&bar->caps);
+ mqes = CAP_MQES(caps);
+
if ((error = nvme_create_queue(bar, ioq, id)) != 0)
return error;
create_iocq = &cmd.create_iocq;
create_iocq->opcode = NVME_OP_CREATE_IOCQ;
create_iocq->qflags = BIT(0); /* Physically contiguous */
- create_iocq->qsize = ctrl->cqes;
+ create_iocq->qsize = mqes;
create_iocq->qid = id;
create_iocq->prp1 = VIRT_TO_PHYS(ns->ioq.cq);
@@ -187,7 +192,7 @@ nvme_create_ioq(struct nvme_ns *ns, size_t id)
create_iosq = &cmd.create_iosq;
create_iosq->opcode = NVME_OP_CREATE_IOSQ;
create_iosq->qflags = BIT(0); /* Physically contiguous */
- create_iosq->qsize = ctrl->sqes;
+ create_iosq->qsize = mqes;
create_iosq->cqid = id;
create_iosq->sqid = id;
create_iosq->prp1 = VIRT_TO_PHYS(ns->ioq.sq);