From a12cf26cdd12bd1c9ff4dec8b2f304e1ba3740d3 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 26 May 2021 21:23:17 +0000 Subject: [PATCH] nvme: add NVME_CTRLR_STATE_CHECK_EN We're going to be adding some new states (READ_CAP and READ_VS) in future patches, that we want to come before the current "INIT" state. So we will simply make "INIT" have the same value as this new NVME_CTRLR_STATE_CHECK_EN state for now. That means existing code won't have to change later once we add new states that come before CHECK_EN. Signed-off-by: Jim Harris Change-Id: I07ca92e28ab1cd8d838cdef5c3ff36ba80a224bf Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8075 Reviewed-by: Ziye Yang Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- lib/nvme/nvme_ctrlr.c | 6 +++--- lib/nvme/nvme_internal.h | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 7d319bc24..e9a799fa8 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -1134,8 +1134,8 @@ nvme_ctrlr_state_string(enum nvme_ctrlr_state state) switch (state) { case NVME_CTRLR_STATE_INIT_DELAY: return "delay init"; - case NVME_CTRLR_STATE_INIT: - return "init"; + case NVME_CTRLR_STATE_CHECK_EN: + return "check en"; case NVME_CTRLR_STATE_DISABLE_WAIT_FOR_READY_1: return "disable and wait for CSTS.RDY = 1"; case NVME_CTRLR_STATE_DISABLE_WAIT_FOR_READY_0: @@ -3124,7 +3124,7 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr) } break; - case NVME_CTRLR_STATE_INIT: + case NVME_CTRLR_STATE_CHECK_EN: /* synonymous with NVME_CTRLR_STATE_INIT */ /* Begin the hardware initialization by making sure the controller is disabled. */ if (cc.bits.en) { NVME_CTRLR_DEBUGLOG(ctrlr, "CC.EN = 1\n"); diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index 495ff9424..e3b4ed8db 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -518,9 +518,14 @@ enum nvme_ctrlr_state { NVME_CTRLR_STATE_INIT_DELAY, /** - * Controller has not been initialized yet. + * Check EN to prepare for controller initialization. */ - NVME_CTRLR_STATE_INIT, + NVME_CTRLR_STATE_CHECK_EN, + + /** + * Controller has not started initialized yet. + */ + NVME_CTRLR_STATE_INIT = NVME_CTRLR_STATE_CHECK_EN, /** * Waiting for CSTS.RDY to transition from 0 to 1 so that CC.EN may be set to 0.