diff options
Diffstat (limited to 'drivers/scsi/isci/request.h')
-rw-r--r-- | drivers/scsi/isci/request.h | 228 |
1 files changed, 95 insertions, 133 deletions
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index be38933dd6df..057f2378452d 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -182,138 +182,103 @@ static inline struct isci_request *to_ireq(struct isci_stp_request *stp_req) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * enum sci_base_request_states - This enumeration depicts all the states for | 185 | * enum sci_base_request_states - request state machine states |
186 | * the common request state machine. | ||
187 | * | 186 | * |
187 | * @SCI_REQ_INIT: Simply the initial state for the base request state machine. | ||
188 | * | 188 | * |
189 | * @SCI_REQ_CONSTRUCTED: This state indicates that the request has been | ||
190 | * constructed. This state is entered from the INITIAL state. | ||
191 | * | ||
192 | * @SCI_REQ_STARTED: This state indicates that the request has been started. | ||
193 | * This state is entered from the CONSTRUCTED state. | ||
194 | * | ||
195 | * @SCI_REQ_STP_UDMA_WAIT_TC_COMP: | ||
196 | * @SCI_REQ_STP_UDMA_WAIT_D2H: | ||
197 | * @SCI_REQ_STP_NON_DATA_WAIT_H2D: | ||
198 | * @SCI_REQ_STP_NON_DATA_WAIT_D2H: | ||
199 | * | ||
200 | * @SCI_REQ_STP_PIO_WAIT_H2D: While in this state the IO request object is | ||
201 | * waiting for the TC completion notification for the H2D Register FIS | ||
202 | * | ||
203 | * @SCI_REQ_STP_PIO_WAIT_FRAME: While in this state the IO request object is | ||
204 | * waiting for either a PIO Setup FIS or a D2H register FIS. The type of frame | ||
205 | * received is based on the result of the prior frame and line conditions. | ||
206 | * | ||
207 | * @SCI_REQ_STP_PIO_DATA_IN: While in this state the IO request object is | ||
208 | * waiting for a DATA frame from the device. | ||
209 | * | ||
210 | * @SCI_REQ_STP_PIO_DATA_OUT: While in this state the IO request object is | ||
211 | * waiting to transmit the next data frame to the device. | ||
212 | * | ||
213 | * @SCI_REQ_ATAPI_WAIT_H2D: While in this state the IO request object is | ||
214 | * waiting for the TC completion notification for the H2D Register FIS | ||
215 | * | ||
216 | * @SCI_REQ_ATAPI_WAIT_PIO_SETUP: While in this state the IO request object is | ||
217 | * waiting for either a PIO Setup. | ||
218 | * | ||
219 | * @SCI_REQ_ATAPI_WAIT_D2H: The non-data IO transit to this state in this state | ||
220 | * after receiving TC completion. While in this state IO request object is | ||
221 | * waiting for D2H status frame as UF. | ||
222 | * | ||
223 | * @SCI_REQ_ATAPI_WAIT_TC_COMP: When transmitting raw frames hardware reports | ||
224 | * task context completion after every frame submission, so in the | ||
225 | * non-accelerated case we need to expect the completion for the "cdb" frame. | ||
226 | * | ||
227 | * @SCI_REQ_TASK_WAIT_TC_COMP: The AWAIT_TC_COMPLETION sub-state indicates that | ||
228 | * the started raw task management request is waiting for the transmission of | ||
229 | * the initial frame (i.e. command, task, etc.). | ||
230 | * | ||
231 | * @SCI_REQ_TASK_WAIT_TC_RESP: This sub-state indicates that the started task | ||
232 | * management request is waiting for the reception of an unsolicited frame | ||
233 | * (i.e. response IU). | ||
234 | * | ||
235 | * @SCI_REQ_SMP_WAIT_RESP: This sub-state indicates that the started task | ||
236 | * management request is waiting for the reception of an unsolicited frame | ||
237 | * (i.e. response IU). | ||
238 | * | ||
239 | * @SCI_REQ_SMP_WAIT_TC_COMP: The AWAIT_TC_COMPLETION sub-state indicates that | ||
240 | * the started SMP request is waiting for the transmission of the initial frame | ||
241 | * (i.e. command, task, etc.). | ||
242 | * | ||
243 | * @SCI_REQ_COMPLETED: This state indicates that the request has completed. | ||
244 | * This state is entered from the STARTED state. This state is entered from the | ||
245 | * ABORTING state. | ||
246 | * | ||
247 | * @SCI_REQ_ABORTING: This state indicates that the request is in the process | ||
248 | * of being terminated/aborted. This state is entered from the CONSTRUCTED | ||
249 | * state. This state is entered from the STARTED state. | ||
250 | * | ||
251 | * @SCI_REQ_FINAL: Simply the final state for the base request state machine. | ||
189 | */ | 252 | */ |
190 | enum sci_base_request_states { | 253 | #define REQUEST_STATES {\ |
191 | /* | 254 | C(REQ_INIT),\ |
192 | * Simply the initial state for the base request state machine. | 255 | C(REQ_CONSTRUCTED),\ |
193 | */ | 256 | C(REQ_STARTED),\ |
194 | SCI_REQ_INIT, | 257 | C(REQ_STP_UDMA_WAIT_TC_COMP),\ |
195 | 258 | C(REQ_STP_UDMA_WAIT_D2H),\ | |
196 | /* | 259 | C(REQ_STP_NON_DATA_WAIT_H2D),\ |
197 | * This state indicates that the request has been constructed. | 260 | C(REQ_STP_NON_DATA_WAIT_D2H),\ |
198 | * This state is entered from the INITIAL state. | 261 | C(REQ_STP_PIO_WAIT_H2D),\ |
199 | */ | 262 | C(REQ_STP_PIO_WAIT_FRAME),\ |
200 | SCI_REQ_CONSTRUCTED, | 263 | C(REQ_STP_PIO_DATA_IN),\ |
201 | 264 | C(REQ_STP_PIO_DATA_OUT),\ | |
202 | /* | 265 | C(REQ_ATAPI_WAIT_H2D),\ |
203 | * This state indicates that the request has been started. This state | 266 | C(REQ_ATAPI_WAIT_PIO_SETUP),\ |
204 | * is entered from the CONSTRUCTED state. | 267 | C(REQ_ATAPI_WAIT_D2H),\ |
205 | */ | 268 | C(REQ_ATAPI_WAIT_TC_COMP),\ |
206 | SCI_REQ_STARTED, | 269 | C(REQ_TASK_WAIT_TC_COMP),\ |
207 | 270 | C(REQ_TASK_WAIT_TC_RESP),\ | |
208 | SCI_REQ_STP_UDMA_WAIT_TC_COMP, | 271 | C(REQ_SMP_WAIT_RESP),\ |
209 | SCI_REQ_STP_UDMA_WAIT_D2H, | 272 | C(REQ_SMP_WAIT_TC_COMP),\ |
210 | 273 | C(REQ_COMPLETED),\ | |
211 | SCI_REQ_STP_NON_DATA_WAIT_H2D, | 274 | C(REQ_ABORTING),\ |
212 | SCI_REQ_STP_NON_DATA_WAIT_D2H, | 275 | C(REQ_FINAL),\ |
213 | 276 | } | |
214 | SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED, | 277 | #undef C |
215 | SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG, | 278 | #define C(a) SCI_##a |
216 | SCI_REQ_STP_SOFT_RESET_WAIT_D2H, | 279 | enum sci_base_request_states REQUEST_STATES; |
217 | 280 | #undef C | |
218 | /* | 281 | const char *req_state_name(enum sci_base_request_states state); |
219 | * While in this state the IO request object is waiting for the TC | ||
220 | * completion notification for the H2D Register FIS | ||
221 | */ | ||
222 | SCI_REQ_STP_PIO_WAIT_H2D, | ||
223 | |||
224 | /* | ||
225 | * While in this state the IO request object is waiting for either a | ||
226 | * PIO Setup FIS or a D2H register FIS. The type of frame received is | ||
227 | * based on the result of the prior frame and line conditions. | ||
228 | */ | ||
229 | SCI_REQ_STP_PIO_WAIT_FRAME, | ||
230 | |||
231 | /* | ||
232 | * While in this state the IO request object is waiting for a DATA | ||
233 | * frame from the device. | ||
234 | */ | ||
235 | SCI_REQ_STP_PIO_DATA_IN, | ||
236 | |||
237 | /* | ||
238 | * While in this state the IO request object is waiting to transmit | ||
239 | * the next data frame to the device. | ||
240 | */ | ||
241 | SCI_REQ_STP_PIO_DATA_OUT, | ||
242 | |||
243 | /* | ||
244 | * While in this state the IO request object is waiting for the TC | ||
245 | * completion notification for the H2D Register FIS | ||
246 | */ | ||
247 | SCI_REQ_ATAPI_WAIT_H2D, | ||
248 | |||
249 | /* | ||
250 | * While in this state the IO request object is waiting for either a | ||
251 | * PIO Setup. | ||
252 | */ | ||
253 | SCI_REQ_ATAPI_WAIT_PIO_SETUP, | ||
254 | |||
255 | /* | ||
256 | * The non-data IO transit to this state in this state after receiving | ||
257 | * TC completion. While in this state IO request object is waiting for | ||
258 | * D2H status frame as UF. | ||
259 | */ | ||
260 | SCI_REQ_ATAPI_WAIT_D2H, | ||
261 | |||
262 | /* | ||
263 | * When transmitting raw frames hardware reports task context completion | ||
264 | * after every frame submission, so in the non-accelerated case we need | ||
265 | * to expect the completion for the "cdb" frame. | ||
266 | */ | ||
267 | SCI_REQ_ATAPI_WAIT_TC_COMP, | ||
268 | |||
269 | /* | ||
270 | * The AWAIT_TC_COMPLETION sub-state indicates that the started raw | ||
271 | * task management request is waiting for the transmission of the | ||
272 | * initial frame (i.e. command, task, etc.). | ||
273 | */ | ||
274 | SCI_REQ_TASK_WAIT_TC_COMP, | ||
275 | |||
276 | /* | ||
277 | * This sub-state indicates that the started task management request | ||
278 | * is waiting for the reception of an unsolicited frame | ||
279 | * (i.e. response IU). | ||
280 | */ | ||
281 | SCI_REQ_TASK_WAIT_TC_RESP, | ||
282 | |||
283 | /* | ||
284 | * This sub-state indicates that the started task management request | ||
285 | * is waiting for the reception of an unsolicited frame | ||
286 | * (i.e. response IU). | ||
287 | */ | ||
288 | SCI_REQ_SMP_WAIT_RESP, | ||
289 | |||
290 | /* | ||
291 | * The AWAIT_TC_COMPLETION sub-state indicates that the started SMP | ||
292 | * request is waiting for the transmission of the initial frame | ||
293 | * (i.e. command, task, etc.). | ||
294 | */ | ||
295 | SCI_REQ_SMP_WAIT_TC_COMP, | ||
296 | |||
297 | /* | ||
298 | * This state indicates that the request has completed. | ||
299 | * This state is entered from the STARTED state. This state is entered | ||
300 | * from the ABORTING state. | ||
301 | */ | ||
302 | SCI_REQ_COMPLETED, | ||
303 | |||
304 | /* | ||
305 | * This state indicates that the request is in the process of being | ||
306 | * terminated/aborted. | ||
307 | * This state is entered from the CONSTRUCTED state. | ||
308 | * This state is entered from the STARTED state. | ||
309 | */ | ||
310 | SCI_REQ_ABORTING, | ||
311 | |||
312 | /* | ||
313 | * Simply the final state for the base request state machine. | ||
314 | */ | ||
315 | SCI_REQ_FINAL, | ||
316 | }; | ||
317 | 282 | ||
318 | enum sci_status sci_request_start(struct isci_request *ireq); | 283 | enum sci_status sci_request_start(struct isci_request *ireq); |
319 | enum sci_status sci_io_request_terminate(struct isci_request *ireq); | 284 | enum sci_status sci_io_request_terminate(struct isci_request *ireq); |
@@ -446,10 +411,7 @@ sci_task_request_construct(struct isci_host *ihost, | |||
446 | struct isci_remote_device *idev, | 411 | struct isci_remote_device *idev, |
447 | u16 io_tag, | 412 | u16 io_tag, |
448 | struct isci_request *ireq); | 413 | struct isci_request *ireq); |
449 | enum sci_status | 414 | enum sci_status sci_task_request_construct_ssp(struct isci_request *ireq); |
450 | sci_task_request_construct_ssp(struct isci_request *ireq); | ||
451 | enum sci_status | ||
452 | sci_task_request_construct_sata(struct isci_request *ireq); | ||
453 | void sci_smp_request_copy_response(struct isci_request *ireq); | 415 | void sci_smp_request_copy_response(struct isci_request *ireq); |
454 | 416 | ||
455 | static inline int isci_task_is_ncq_recovery(struct sas_task *task) | 417 | static inline int isci_task_is_ncq_recovery(struct sas_task *task) |