Lines Matching full:task
46 * pm8001_find_tag - from sas task to find out tag that belongs to this task
47 * @task: the task sent to the LLDD
48 * @tag: the found tag associated with the task
50 static int pm8001_find_tag(struct sas_task *task, u32 *tag) in pm8001_find_tag() argument
52 if (task->lldd_task) { in pm8001_find_tag()
54 ccb = task->lldd_task; in pm8001_find_tag()
64 * @tag: the found tag associated with the task
77 * pm8001_tag_alloc - allocate a empty tag for task used.
298 * pm8001_task_prep_smp - the dispatcher function, prepare data for smp task
300 * @ccb: the ccb which attached to smp task
308 u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag) in pm8001_get_ncq_tag() argument
310 struct ata_queued_cmd *qc = task->uldd_task; in pm8001_get_ncq_tag()
321 * pm8001_task_prep_ata - the dispatcher function, prepare data for sata task
323 * @ccb: the ccb which attached to sata task
333 * for internal abort task
335 * @ccb: the ccb which attached to sata task
344 * pm8001_task_prep_ssp_tm - the dispatcher function, prepare task management data
347 * @tmf: the task management IU
356 * pm8001_task_prep_ssp - the dispatcher function, prepare ssp data for ssp task
358 * @ccb: the ccb which attached to ssp task
390 struct sas_task *task = ccb->task; in pm8001_deliver_command() local
391 enum sas_protocol task_proto = task->task_proto; in pm8001_deliver_command()
392 struct sas_tmf_task *tmf = task->tmf; in pm8001_deliver_command()
418 * @task: the task to be execute.
421 int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags) in pm8001_queue_command() argument
423 struct task_status_struct *ts = &task->task_status; in pm8001_queue_command()
424 enum sas_protocol task_proto = task->task_proto; in pm8001_queue_command()
425 struct domain_device *dev = task->dev; in pm8001_queue_command()
427 bool internal_abort = sas_is_internal_abort(task); in pm8001_queue_command()
439 task->task_done(task); in pm8001_queue_command()
446 task->task_done(task); in pm8001_queue_command()
463 task->task_done(task); in pm8001_queue_command()
466 task->task_done(task); in pm8001_queue_command()
472 ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_dev, task); in pm8001_queue_command()
479 if (task->num_scatter) { in pm8001_queue_command()
480 n_elem = dma_map_sg(pm8001_ha->dev, task->scatter, in pm8001_queue_command()
481 task->num_scatter, task->data_dir); in pm8001_queue_command()
488 n_elem = task->num_scatter; in pm8001_queue_command()
491 task->lldd_task = ccb; in pm8001_queue_command()
500 dma_unmap_sg(pm8001_ha->dev, task->scatter, in pm8001_queue_command()
501 task->num_scatter, task->data_dir); in pm8001_queue_command()
517 * @ccb: the ccb which attached to ssp task to free
522 struct sas_task *task = ccb->task; in pm8001_ccb_task_free() local
526 if (!task) in pm8001_ccb_task_free()
529 if (!sas_protocol_ata(task->task_proto) && ccb->n_elem) in pm8001_ccb_task_free()
530 dma_unmap_sg(pm8001_ha->dev, task->scatter, in pm8001_ccb_task_free()
531 task->num_scatter, task->data_dir); in pm8001_ccb_task_free()
533 switch (task->task_proto) { in pm8001_ccb_task_free()
535 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_resp, 1, in pm8001_ccb_task_free()
537 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_req, 1, in pm8001_ccb_task_free()
549 if (sas_protocol_ata(task->task_proto)) { in pm8001_ccb_task_free()
551 qc = task->uldd_task; in pm8001_ccb_task_free()
560 task->lldd_task = NULL; in pm8001_ccb_task_free()
690 void pm8001_task_done(struct sas_task *task) in pm8001_task_done() argument
692 del_timer(&task->slow_task->timer); in pm8001_task_done()
693 complete(&task->slow_task->completion); in pm8001_task_done()
736 /* retry commands by ha, by task and/or by device */
751 struct sas_task *task; in pm8001_open_reject_retry() local
771 task = ccb->task; in pm8001_open_reject_retry()
772 if (!task || !task->task_done) in pm8001_open_reject_retry()
774 if (task_to_close && (task != task_to_close)) in pm8001_open_reject_retry()
776 ts = &task->task_status; in pm8001_open_reject_retry()
783 spin_lock_irqsave(&task->task_state_lock, flags1); in pm8001_open_reject_retry()
784 task->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_open_reject_retry()
785 task->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_open_reject_retry()
786 if (unlikely((task->task_state_flags in pm8001_open_reject_retry()
788 spin_unlock_irqrestore(&task->task_state_lock, in pm8001_open_reject_retry()
792 spin_unlock_irqrestore(&task->task_state_lock, in pm8001_open_reject_retry()
797 task->task_done(task); in pm8001_open_reject_retry()
842 pm8001_dbg(pm8001_ha, EH, "task abort failed %x\n" in pm8001_I_T_nexus_reset()
918 /* mandatory SAM-3, the task reset the specified LUN*/
944 int pm8001_query_task(struct sas_task *task) in pm8001_query_task() argument
948 if (unlikely(!task || !task->lldd_task || !task->dev)) in pm8001_query_task()
951 if (task->task_proto & SAS_PROTOCOL_SSP) { in pm8001_query_task()
952 struct scsi_cmnd *cmnd = task->uldd_task; in pm8001_query_task()
953 struct domain_device *dev = task->dev; in pm8001_query_task()
957 rc = pm8001_find_tag(task, &tag); in pm8001_query_task()
964 rc = sas_query_task(task, tag); in pm8001_query_task()
966 /* The task is still in Lun, release it then */ in pm8001_query_task()
969 "The task is still in Lun\n"); in pm8001_query_task()
971 /* The task is not in Lun or failed, reset the phy */ in pm8001_query_task()
975 "The task is not in Lun or failed, reset the phy\n"); in pm8001_query_task()
983 /* mandatory SAM-3, still need free task/ccb info, abort the specified task */
984 int pm8001_abort_task(struct sas_task *task) in pm8001_abort_task() argument
995 if (unlikely(!task || !task->lldd_task || !task->dev)) in pm8001_abort_task()
998 dev = task->dev; in pm8001_abort_task()
1005 // abort task will not get a response from the controller in pm8001_abort_task()
1009 ret = pm8001_find_tag(task, &tag); in pm8001_abort_task()
1011 pm8001_info(pm8001_ha, "no tag for task:%p\n", task); in pm8001_abort_task()
1014 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_abort_task()
1015 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in pm8001_abort_task()
1016 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1019 task->task_state_flags |= SAS_TASK_STATE_ABORTED; in pm8001_abort_task()
1020 if (task->slow_task == NULL) { in pm8001_abort_task()
1022 task->slow_task = &slow_task; in pm8001_abort_task()
1024 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1025 if (task->task_proto & SAS_PROTOCOL_SSP) { in pm8001_abort_task()
1026 rc = sas_abort_task(task, tag); in pm8001_abort_task()
1028 } else if (task->task_proto & SAS_PROTOCOL_SATA || in pm8001_abort_task()
1029 task->task_proto & SAS_PROTOCOL_STP) { in pm8001_abort_task()
1061 * leaking the task in libsas or losing the race and in pm8001_abort_task()
1096 * we wait for the task to be aborted so that the task in pm8001_abort_task()
1098 * going to free the task. in pm8001_abort_task()
1104 &task->slow_task->completion, in pm8001_abort_task()
1119 } else if (task->task_proto & SAS_PROTOCOL_SMP) { in pm8001_abort_task()
1125 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_abort_task()
1126 if (task->slow_task == &slow_task) in pm8001_abort_task()
1127 task->slow_task = NULL; in pm8001_abort_task()
1128 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1139 pm8001_dbg(pm8001_ha, EH, "I_T_L_Q clear task set[%x]\n", in pm8001_clear_task_set()
1173 void pm8001_tmf_aborted(struct sas_task *task) in pm8001_tmf_aborted() argument
1175 struct pm8001_ccb_info *ccb = task->lldd_task; in pm8001_tmf_aborted()
1178 ccb->task = NULL; in pm8001_tmf_aborted()