diff options
Diffstat (limited to 'drivers/scsi/isci/task.h')
-rw-r--r-- | drivers/scsi/isci/task.h | 132 |
1 files changed, 1 insertions, 131 deletions
diff --git a/drivers/scsi/isci/task.h b/drivers/scsi/isci/task.h index 7b6d0e32fd9b..9c06cbad1d26 100644 --- a/drivers/scsi/isci/task.h +++ b/drivers/scsi/isci/task.h | |||
@@ -63,19 +63,6 @@ | |||
63 | struct isci_request; | 63 | struct isci_request; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * enum isci_tmf_cb_state - This enum defines the possible states in which the | ||
67 | * TMF callback function is invoked during the TMF execution process. | ||
68 | * | ||
69 | * | ||
70 | */ | ||
71 | enum isci_tmf_cb_state { | ||
72 | |||
73 | isci_tmf_init_state = 0, | ||
74 | isci_tmf_started, | ||
75 | isci_tmf_timed_out | ||
76 | }; | ||
77 | |||
78 | /** | ||
79 | * enum isci_tmf_function_codes - This enum defines the possible preparations | 66 | * enum isci_tmf_function_codes - This enum defines the possible preparations |
80 | * of task management requests. | 67 | * of task management requests. |
81 | * | 68 | * |
@@ -87,6 +74,7 @@ enum isci_tmf_function_codes { | |||
87 | isci_tmf_ssp_task_abort = TMF_ABORT_TASK, | 74 | isci_tmf_ssp_task_abort = TMF_ABORT_TASK, |
88 | isci_tmf_ssp_lun_reset = TMF_LU_RESET, | 75 | isci_tmf_ssp_lun_reset = TMF_LU_RESET, |
89 | }; | 76 | }; |
77 | |||
90 | /** | 78 | /** |
91 | * struct isci_tmf - This class represents the task management object which | 79 | * struct isci_tmf - This class represents the task management object which |
92 | * acts as an interface to libsas for processing task management requests | 80 | * acts as an interface to libsas for processing task management requests |
@@ -106,15 +94,6 @@ struct isci_tmf { | |||
106 | u16 io_tag; | 94 | u16 io_tag; |
107 | enum isci_tmf_function_codes tmf_code; | 95 | enum isci_tmf_function_codes tmf_code; |
108 | int status; | 96 | int status; |
109 | |||
110 | /* The optional callback function allows the user process to | ||
111 | * track the TMF transmit / timeout conditions. | ||
112 | */ | ||
113 | void (*cb_state_func)( | ||
114 | enum isci_tmf_cb_state, | ||
115 | struct isci_tmf *, void *); | ||
116 | void *cb_data; | ||
117 | |||
118 | }; | 97 | }; |
119 | 98 | ||
120 | static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf) | 99 | static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf) |
@@ -208,113 +187,4 @@ int isci_queuecommand( | |||
208 | struct scsi_cmnd *scsi_cmd, | 187 | struct scsi_cmnd *scsi_cmd, |
209 | void (*donefunc)(struct scsi_cmnd *)); | 188 | void (*donefunc)(struct scsi_cmnd *)); |
210 | 189 | ||
211 | /** | ||
212 | * enum isci_completion_selection - This enum defines the possible actions to | ||
213 | * take with respect to a given request's notification back to libsas. | ||
214 | * | ||
215 | * | ||
216 | */ | ||
217 | enum isci_completion_selection { | ||
218 | |||
219 | isci_perform_normal_io_completion, /* Normal notify (task_done) */ | ||
220 | isci_perform_aborted_io_completion, /* No notification. */ | ||
221 | isci_perform_error_io_completion /* Use sas_task_abort */ | ||
222 | }; | ||
223 | |||
224 | /** | ||
225 | * isci_task_set_completion_status() - This function sets the completion status | ||
226 | * for the request. | ||
227 | * @task: This parameter is the completed request. | ||
228 | * @response: This parameter is the response code for the completed task. | ||
229 | * @status: This parameter is the status code for the completed task. | ||
230 | * | ||
231 | * @return The new notification mode for the request. | ||
232 | */ | ||
233 | static inline enum isci_completion_selection | ||
234 | isci_task_set_completion_status( | ||
235 | struct sas_task *task, | ||
236 | enum service_response response, | ||
237 | enum exec_status status, | ||
238 | enum isci_completion_selection task_notification_selection) | ||
239 | { | ||
240 | unsigned long flags; | ||
241 | |||
242 | spin_lock_irqsave(&task->task_state_lock, flags); | ||
243 | |||
244 | /* If a device reset is being indicated, make sure the I/O | ||
245 | * is in the error path. | ||
246 | */ | ||
247 | if (task->task_state_flags & SAS_TASK_NEED_DEV_RESET) { | ||
248 | /* Fail the I/O to make sure it goes into the error path. */ | ||
249 | response = SAS_TASK_UNDELIVERED; | ||
250 | status = SAM_STAT_TASK_ABORTED; | ||
251 | |||
252 | task_notification_selection = isci_perform_error_io_completion; | ||
253 | } | ||
254 | task->task_status.resp = response; | ||
255 | task->task_status.stat = status; | ||
256 | |||
257 | switch (task->task_proto) { | ||
258 | |||
259 | case SAS_PROTOCOL_SATA: | ||
260 | case SAS_PROTOCOL_STP: | ||
261 | case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: | ||
262 | |||
263 | if (task_notification_selection | ||
264 | == isci_perform_error_io_completion) { | ||
265 | /* SATA/STP I/O has it's own means of scheduling device | ||
266 | * error handling on the normal path. | ||
267 | */ | ||
268 | task_notification_selection | ||
269 | = isci_perform_normal_io_completion; | ||
270 | } | ||
271 | break; | ||
272 | default: | ||
273 | break; | ||
274 | } | ||
275 | |||
276 | switch (task_notification_selection) { | ||
277 | |||
278 | case isci_perform_error_io_completion: | ||
279 | |||
280 | if (task->task_proto == SAS_PROTOCOL_SMP) { | ||
281 | /* There is no error escalation in the SMP case. | ||
282 | * Convert to a normal completion to avoid the | ||
283 | * timeout in the discovery path and to let the | ||
284 | * next action take place quickly. | ||
285 | */ | ||
286 | task_notification_selection | ||
287 | = isci_perform_normal_io_completion; | ||
288 | |||
289 | /* Fall through to the normal case... */ | ||
290 | } else { | ||
291 | /* Use sas_task_abort */ | ||
292 | /* Leave SAS_TASK_STATE_DONE clear | ||
293 | * Leave SAS_TASK_AT_INITIATOR set. | ||
294 | */ | ||
295 | break; | ||
296 | } | ||
297 | |||
298 | case isci_perform_aborted_io_completion: | ||
299 | /* This path can occur with task-managed requests as well as | ||
300 | * requests terminated because of LUN or device resets. | ||
301 | */ | ||
302 | /* Fall through to the normal case... */ | ||
303 | case isci_perform_normal_io_completion: | ||
304 | /* Normal notification (task_done) */ | ||
305 | task->task_state_flags |= SAS_TASK_STATE_DONE; | ||
306 | task->task_state_flags &= ~(SAS_TASK_AT_INITIATOR | | ||
307 | SAS_TASK_STATE_PENDING); | ||
308 | break; | ||
309 | default: | ||
310 | WARN_ONCE(1, "unknown task_notification_selection: %d\n", | ||
311 | task_notification_selection); | ||
312 | break; | ||
313 | } | ||
314 | |||
315 | spin_unlock_irqrestore(&task->task_state_lock, flags); | ||
316 | |||
317 | return task_notification_selection; | ||
318 | |||
319 | } | ||
320 | #endif /* !defined(_SCI_TASK_H_) */ | 190 | #endif /* !defined(_SCI_TASK_H_) */ |