aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-02-08 20:08:48 +0000
committerWarner Losh <imp@FreeBSD.org>2021-02-08 20:08:48 +0000
commit9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6 (patch)
tree1582127ca03199c7cfa9f6587adaad9487ff820d /sys
parent93fc67896550548f91b307dbe3053f11db5d4a8a (diff)
downloadsrc-9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6.tar.gz
src-9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6.zip
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c6
-rw-r--r--sys/dev/nvme/nvme_private.h2
-rw-r--r--sys/dev/nvme/nvme_qpair.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 2bd7074ee378..c0e6c408ab56 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -261,7 +261,7 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val)
ms_waited = 0;
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)
@@ -1471,7 +1471,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
@@ -1549,7 +1549,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 d44f1989dd71..6c1d293f047d 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 45b1568a4c5a..0726ca248442 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -945,7 +945,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);
}