Date: Sat, 31 Jul 2021 00:21:32 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c7064b73eda5 - stable/12 - nvme: use NVME_GONE rather than hard-coded 0xffffffff Message-ID: <202107310021.16V0LWxD052114@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c7064b73eda5984afddd80b3ec518312b5f307b6 commit c7064b73eda5984afddd80b3ec518312b5f307b6 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2021-02-08 20:08:48 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2021-07-31 00:02:53 +0000 nvme: use NVME_GONE rather than hard-coded 0xffffffff Make it clearer that the value 0xfffffff is being used to detect the device is gone. We use it other places in the driver for other meanings. (cherry picked from commit 9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6) --- sys/dev/nvme/nvme_ctrlr.c | 6 +++--- sys/dev/nvme/nvme_private.h | 2 ++ sys/dev/nvme/nvme_qpair.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index efc8fbcdf567..2bc0e1081d2b 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -260,7 +260,7 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) while (1) { csts = nvme_mmio_read_4(ctrlr, csts); - if (csts == 0xffffffff) /* Hot unplug. */ + if (csts == NVME_GONE) /* Hot unplug. */ return (ENXIO); if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) == desired_val) @@ -1483,7 +1483,7 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) * Check whether it is a hot unplug or a clean driver detach. * If device is not there any more, skip any shutdown commands. */ - gone = (nvme_mmio_read_4(ctrlr, csts) == 0xffffffff); + gone = (nvme_mmio_read_4(ctrlr, csts) == NVME_GONE); if (gone) nvme_ctrlr_fail(ctrlr); else @@ -1561,7 +1561,7 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000); while (1) { csts = nvme_mmio_read_4(ctrlr, csts); - if (csts == 0xffffffff) /* Hot unplug. */ + if (csts == NVME_GONE) /* Hot unplug. */ break; if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) break; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 39b5af66501f..f26afbe29542 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -104,6 +104,8 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif +#define NVME_GONE 0xfffffffful + extern int32_t nvme_retry_count; extern bool nvme_verbose_cmd_dump; diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 651eee121be1..e188ef9e3ebd 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -950,7 +950,7 @@ nvme_timeout(void *arg) nvme_abort_complete, tr); } else { nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - (csts == 0xffffffff) ? " and possible hot unplug" : + (csts == NVME_GONE) ? " and possible hot unplug" : (cfs ? " and fatal error status" : "")); nvme_ctrlr_reset(ctrlr); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107310021.16V0LWxD052114>