diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -95,27 +95,6 @@ le32toh(cmd->cdw13), le32toh(cmd->cdw14), le32toh(cmd->cdw15)); } -void -nvme_dump_completion(struct nvme_completion *cpl) -{ - uint8_t p, sc, sct, crd, m, dnr; - uint16_t status; - - status = le16toh(cpl->status); - - p = NVME_STATUS_GET_P(status); - sc = NVME_STATUS_GET_SC(status); - sct = NVME_STATUS_GET_SCT(status); - crd = NVME_STATUS_GET_CRD( status); - m = NVME_STATUS_GET_M(status); - dnr = NVME_STATUS_GET_DNR(status); - - printf("cdw0:%08x sqhd:%04x sqid:%04x " - "cid:%04x p:%x sc:%02x sct:%x crd:%x m:%x dnr:%x\n", - le32toh(cpl->cdw0), le16toh(cpl->sqhd), le16toh(cpl->sqid), - cpl->cid, p, sc, sct, crd, m, dnr); -} - int nvme_attach(device_t dev) { diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -444,7 +444,8 @@ void nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr); void nvme_dump_command(struct nvme_command *cmd); -void nvme_dump_completion(struct nvme_completion *cpl); +void nvme_qpair_print_completion(struct nvme_qpair *qpair, + struct nvme_completion *cpl); int nvme_attach(device_t dev); int nvme_shutdown(device_t dev); diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -341,21 +341,22 @@ return (entry->str); } -static void +void nvme_qpair_print_completion(struct nvme_qpair *qpair, struct nvme_completion *cpl) { - uint8_t sct, sc, crd, m, dnr; + uint8_t sct, sc, crd, m, dnr, p; sct = NVME_STATUS_GET_SCT(cpl->status); sc = NVME_STATUS_GET_SC(cpl->status); crd = NVME_STATUS_GET_CRD(cpl->status); m = NVME_STATUS_GET_M(cpl->status); dnr = NVME_STATUS_GET_DNR(cpl->status); + p = NVME_STATUS_GET_P(cpl->status); - nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x " + nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x p:%d " "sqid:%d cid:%d cdw0:%x\n", - get_status_string(sct, sc), sct, sc, crd, m, dnr, + get_status_string(sct, sc), sct, sc, crd, m, dnr, p, cpl->sqid, cpl->cid, cpl->cdw0); } @@ -654,8 +655,8 @@ nvme_printf(qpair->ctrlr, "cpl (cid = %u) does not map to outstanding cmd\n", cpl.cid); - /* nvme_dump_completion expects device endianess */ - nvme_dump_completion(&qpair->cpl[qpair->cq_head]); + nvme_qpair_print_completion(qpair, + &qpair->cpl[qpair->cq_head]); KASSERT(0, ("received completion for unknown cmd")); } diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -65,7 +65,7 @@ for (i = 0; i < qpair->num_entries; i++) { cpl = &qpair->cpl[i]; printf("%05d: ", i); - nvme_dump_completion(cpl); + nvme_qpair_print_completion(qpair, cpl); } printf("Submission queue:\n");