aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/remote_device.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-02-10 04:18:44 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-29 17:23:15 -0500
commitd7a0ccdd9bd78b5b74d2963ec7ab67c9d896902a (patch)
tree9fc59d3303e7453006c767b0f4daadbf3d4ed5c1 /drivers/scsi/isci/remote_device.h
parent16d3db1b298529e6aec4a4cf0f56225d9e0bc641 (diff)
[SCSI] isci: debug, provide state-enum-to-string conversions
Debugging the driver requires tracing the state transtions and tracing state names is less work than decoding numbers. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/isci/remote_device.h')
-rw-r--r--drivers/scsi/isci/remote_device.h205
1 files changed, 92 insertions, 113 deletions
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h
index 98c2801ed089..58637ee08f55 100644
--- a/drivers/scsi/isci/remote_device.h
+++ b/drivers/scsi/isci/remote_device.h
@@ -179,122 +179,101 @@ enum sci_status sci_remote_device_reset_complete(
179/** 179/**
180 * enum sci_remote_device_states - This enumeration depicts all the states 180 * enum sci_remote_device_states - This enumeration depicts all the states
181 * for the common remote device state machine. 181 * for the common remote device state machine.
182 * @SCI_DEV_INITIAL: Simply the initial state for the base remote device
183 * state machine.
182 * 184 *
185 * @SCI_DEV_STOPPED: This state indicates that the remote device has
186 * successfully been stopped. In this state no new IO operations are
187 * permitted. This state is entered from the INITIAL state. This state
188 * is entered from the STOPPING state.
183 * 189 *
190 * @SCI_DEV_STARTING: This state indicates the the remote device is in
191 * the process of becoming ready (i.e. starting). In this state no new
192 * IO operations are permitted. This state is entered from the STOPPED
193 * state.
194 *
195 * @SCI_DEV_READY: This state indicates the remote device is now ready.
196 * Thus, the user is able to perform IO operations on the remote device.
197 * This state is entered from the STARTING state.
198 *
199 * @SCI_STP_DEV_IDLE: This is the idle substate for the stp remote
200 * device. When there are no active IO for the device it is is in this
201 * state.
202 *
203 * @SCI_STP_DEV_CMD: This is the command state for for the STP remote
204 * device. This state is entered when the device is processing a
205 * non-NCQ command. The device object will fail any new start IO
206 * requests until this command is complete.
207 *
208 * @SCI_STP_DEV_NCQ: This is the NCQ state for the STP remote device.
209 * This state is entered when the device is processing an NCQ reuqest.
210 * It will remain in this state so long as there is one or more NCQ
211 * requests being processed.
212 *
213 * @SCI_STP_DEV_NCQ_ERROR: This is the NCQ error state for the STP
214 * remote device. This state is entered when an SDB error FIS is
215 * received by the device object while in the NCQ state. The device
216 * object will only accept a READ LOG command while in this state.
217 *
218 * @SCI_STP_DEV_ATAPI_ERROR: This is the ATAPI error state for the STP
219 * ATAPI remote device. This state is entered when ATAPI device sends
220 * error status FIS without data while the device object is in CMD
221 * state. A suspension event is expected in this state. The device
222 * object will resume right away.
223 *
224 * @SCI_STP_DEV_AWAIT_RESET: This is the READY substate indicates the
225 * device is waiting for the RESET task coming to be recovered from
226 * certain hardware specific error.
227 *
228 * @SCI_SMP_DEV_IDLE: This is the ready operational substate for the
229 * remote device. This is the normal operational state for a remote
230 * device.
231 *
232 * @SCI_SMP_DEV_CMD: This is the suspended state for the remote device.
233 * This is the state that the device is placed in when a RNC suspend is
234 * received by the SCU hardware.
235 *
236 * @SCI_DEV_STOPPING: This state indicates that the remote device is in
237 * the process of stopping. In this state no new IO operations are
238 * permitted, but existing IO operations are allowed to complete. This
239 * state is entered from the READY state. This state is entered from
240 * the FAILED state.
241 *
242 * @SCI_DEV_FAILED: This state indicates that the remote device has
243 * failed. In this state no new IO operations are permitted. This
244 * state is entered from the INITIALIZING state. This state is entered
245 * from the READY state.
246 *
247 * @SCI_DEV_RESETTING: This state indicates the device is being reset.
248 * In this state no new IO operations are permitted. This state is
249 * entered from the READY state.
250 *
251 * @SCI_DEV_FINAL: Simply the final state for the base remote device
252 * state machine.
184 */ 253 */
185enum sci_remote_device_states { 254#define REMOTE_DEV_STATES {\
186 /** 255 C(DEV_INITIAL),\
187 * Simply the initial state for the base remote device state machine. 256 C(DEV_STOPPED),\
188 */ 257 C(DEV_STARTING),\
189 SCI_DEV_INITIAL, 258 C(DEV_READY),\
190 259 C(STP_DEV_IDLE),\
191 /** 260 C(STP_DEV_CMD),\
192 * This state indicates that the remote device has successfully been 261 C(STP_DEV_NCQ),\
193 * stopped. In this state no new IO operations are permitted. 262 C(STP_DEV_NCQ_ERROR),\
194 * This state is entered from the INITIAL state. 263 C(STP_DEV_ATAPI_ERROR),\
195 * This state is entered from the STOPPING state. 264 C(STP_DEV_AWAIT_RESET),\
196 */ 265 C(SMP_DEV_IDLE),\
197 SCI_DEV_STOPPED, 266 C(SMP_DEV_CMD),\
198 267 C(DEV_STOPPING),\
199 /** 268 C(DEV_FAILED),\
200 * This state indicates the the remote device is in the process of 269 C(DEV_RESETTING),\
201 * becoming ready (i.e. starting). In this state no new IO operations 270 C(DEV_FINAL),\
202 * are permitted. 271 }
203 * This state is entered from the STOPPED state. 272#undef C
204 */ 273#define C(a) SCI_##a
205 SCI_DEV_STARTING, 274enum sci_remote_device_states REMOTE_DEV_STATES;
206 275#undef C
207 /** 276const char *dev_state_name(enum sci_remote_device_states state);
208 * This state indicates the remote device is now ready. Thus, the user
209 * is able to perform IO operations on the remote device.
210 * This state is entered from the STARTING state.
211 */
212 SCI_DEV_READY,
213
214 /**
215 * This is the idle substate for the stp remote device. When there are no
216 * active IO for the device it is is in this state.
217 */
218 SCI_STP_DEV_IDLE,
219
220 /**
221 * This is the command state for for the STP remote device. This state is
222 * entered when the device is processing a non-NCQ command. The device object
223 * will fail any new start IO requests until this command is complete.
224 */
225 SCI_STP_DEV_CMD,
226
227 /**
228 * This is the NCQ state for the STP remote device. This state is entered
229 * when the device is processing an NCQ reuqest. It will remain in this state
230 * so long as there is one or more NCQ requests being processed.
231 */
232 SCI_STP_DEV_NCQ,
233
234 /**
235 * This is the NCQ error state for the STP remote device. This state is
236 * entered when an SDB error FIS is received by the device object while in the
237 * NCQ state. The device object will only accept a READ LOG command while in
238 * this state.
239 */
240 SCI_STP_DEV_NCQ_ERROR,
241
242 /**
243 * This is the ATAPI error state for the STP ATAPI remote device.
244 * This state is entered when ATAPI device sends error status FIS
245 * without data while the device object is in CMD state.
246 * A suspension event is expected in this state.
247 * The device object will resume right away.
248 */
249 SCI_STP_DEV_ATAPI_ERROR,
250
251 /**
252 * This is the READY substate indicates the device is waiting for the RESET task
253 * coming to be recovered from certain hardware specific error.
254 */
255 SCI_STP_DEV_AWAIT_RESET,
256
257 /**
258 * This is the ready operational substate for the remote device. This is the
259 * normal operational state for a remote device.
260 */
261 SCI_SMP_DEV_IDLE,
262
263 /**
264 * This is the suspended state for the remote device. This is the state that
265 * the device is placed in when a RNC suspend is received by the SCU hardware.
266 */
267 SCI_SMP_DEV_CMD,
268
269 /**
270 * This state indicates that the remote device is in the process of
271 * stopping. In this state no new IO operations are permitted, but
272 * existing IO operations are allowed to complete.
273 * This state is entered from the READY state.
274 * This state is entered from the FAILED state.
275 */
276 SCI_DEV_STOPPING,
277
278 /**
279 * This state indicates that the remote device has failed.
280 * In this state no new IO operations are permitted.
281 * This state is entered from the INITIALIZING state.
282 * This state is entered from the READY state.
283 */
284 SCI_DEV_FAILED,
285
286 /**
287 * This state indicates the device is being reset.
288 * In this state no new IO operations are permitted.
289 * This state is entered from the READY state.
290 */
291 SCI_DEV_RESETTING,
292
293 /**
294 * Simply the final state for the base remote device state machine.
295 */
296 SCI_DEV_FINAL,
297};
298 277
299static inline struct isci_remote_device *rnc_to_dev(struct sci_remote_node_context *rnc) 278static inline struct isci_remote_device *rnc_to_dev(struct sci_remote_node_context *rnc)
300{ 279{