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.
This commit is contained in:
parent
93fc678965
commit
9600aa31aa
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user