From ce3993db402820f3d908ab630b117d1cf59858b1 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 14 Jul 2024 00:23:21 -0400 Subject: kernel: nvme: Use CAP.MQES for qsize Signed-off-by: Ian Moffett --- sys/dev/ic/nvme.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys') 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); -- cgit v1.2.3