Lines Matching refs:task
49 static int pm8001_find_tag(struct sas_task *task, u32 *tag) in pm8001_find_tag() argument
51 if (task->lldd_task) { in pm8001_find_tag()
53 ccb = task->lldd_task; in pm8001_find_tag()
304 u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag) in pm8001_get_ncq_tag() argument
306 struct ata_queued_cmd *qc = task->uldd_task; in pm8001_get_ncq_tag()
380 static int pm8001_task_exec(struct sas_task *task, in pm8001_task_exec() argument
383 struct domain_device *dev = task->dev; in pm8001_task_exec()
387 struct sas_task *t = task; in pm8001_task_exec()
401 pm8001_ha = pm8001_find_ha_by_dev(task->dev); in pm8001_task_exec()
456 ccb->task = t; in pm8001_task_exec()
515 int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags) in pm8001_queue_command() argument
517 return pm8001_task_exec(task, gfp_flags, 0, NULL); in pm8001_queue_command()
528 struct sas_task *task, struct pm8001_ccb_info *ccb, u32 ccb_idx) in pm8001_ccb_task_free() argument
530 if (!ccb->task) in pm8001_ccb_task_free()
532 if (!sas_protocol_ata(task->task_proto)) in pm8001_ccb_task_free()
534 dma_unmap_sg(pm8001_ha->dev, task->scatter, in pm8001_ccb_task_free()
535 task->num_scatter, task->data_dir); in pm8001_ccb_task_free()
537 switch (task->task_proto) { in pm8001_ccb_task_free()
539 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_resp, 1, in pm8001_ccb_task_free()
541 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_req, 1, in pm8001_ccb_task_free()
552 task->lldd_task = NULL; in pm8001_ccb_task_free()
553 ccb->task = NULL; in pm8001_ccb_task_free()
685 void pm8001_task_done(struct sas_task *task) in pm8001_task_done() argument
687 del_timer(&task->slow_task->timer); in pm8001_task_done()
688 complete(&task->slow_task->completion); in pm8001_task_done()
694 struct sas_task *task = slow->task; in pm8001_tmf_timedout() local
697 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_tmf_timedout()
698 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { in pm8001_tmf_timedout()
699 task->task_state_flags |= SAS_TASK_STATE_ABORTED; in pm8001_tmf_timedout()
700 complete(&task->slow_task->completion); in pm8001_tmf_timedout()
702 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_tmf_timedout()
721 struct sas_task *task = NULL; in pm8001_exec_internal_tmf_task() local
727 task = sas_alloc_slow_task(GFP_KERNEL); in pm8001_exec_internal_tmf_task()
728 if (!task) in pm8001_exec_internal_tmf_task()
731 task->dev = dev; in pm8001_exec_internal_tmf_task()
732 task->task_proto = dev->tproto; in pm8001_exec_internal_tmf_task()
733 memcpy(&task->ssp_task, parameter, para_len); in pm8001_exec_internal_tmf_task()
734 task->task_done = pm8001_task_done; in pm8001_exec_internal_tmf_task()
735 task->slow_task->timer.function = pm8001_tmf_timedout; in pm8001_exec_internal_tmf_task()
736 task->slow_task->timer.expires = jiffies + PM8001_TASK_TIMEOUT*HZ; in pm8001_exec_internal_tmf_task()
737 add_timer(&task->slow_task->timer); in pm8001_exec_internal_tmf_task()
739 res = pm8001_task_exec(task, GFP_KERNEL, 1, tmf); in pm8001_exec_internal_tmf_task()
742 del_timer(&task->slow_task->timer); in pm8001_exec_internal_tmf_task()
746 wait_for_completion(&task->slow_task->completion); in pm8001_exec_internal_tmf_task()
755 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { in pm8001_exec_internal_tmf_task()
761 if (task->task_status.resp == SAS_TASK_COMPLETE && in pm8001_exec_internal_tmf_task()
762 task->task_status.stat == SAS_SAM_STAT_GOOD) { in pm8001_exec_internal_tmf_task()
767 if (task->task_status.resp == SAS_TASK_COMPLETE && in pm8001_exec_internal_tmf_task()
768 task->task_status.stat == SAS_DATA_UNDERRUN) { in pm8001_exec_internal_tmf_task()
771 res = task->task_status.residual; in pm8001_exec_internal_tmf_task()
775 if (task->task_status.resp == SAS_TASK_COMPLETE && in pm8001_exec_internal_tmf_task()
776 task->task_status.stat == SAS_DATA_OVERRUN) { in pm8001_exec_internal_tmf_task()
784 task->task_status.resp, in pm8001_exec_internal_tmf_task()
785 task->task_status.stat); in pm8001_exec_internal_tmf_task()
786 sas_free_task(task); in pm8001_exec_internal_tmf_task()
787 task = NULL; in pm8001_exec_internal_tmf_task()
791 BUG_ON(retry == 3 && task != NULL); in pm8001_exec_internal_tmf_task()
792 sas_free_task(task); in pm8001_exec_internal_tmf_task()
804 struct sas_task *task = NULL; in pm8001_exec_internal_task_abort() local
807 task = sas_alloc_slow_task(GFP_KERNEL); in pm8001_exec_internal_task_abort()
808 if (!task) in pm8001_exec_internal_task_abort()
811 task->dev = dev; in pm8001_exec_internal_task_abort()
812 task->task_proto = dev->tproto; in pm8001_exec_internal_task_abort()
813 task->task_done = pm8001_task_done; in pm8001_exec_internal_task_abort()
814 task->slow_task->timer.function = pm8001_tmf_timedout; in pm8001_exec_internal_task_abort()
815 task->slow_task->timer.expires = jiffies + PM8001_TASK_TIMEOUT * HZ; in pm8001_exec_internal_task_abort()
816 add_timer(&task->slow_task->timer); in pm8001_exec_internal_task_abort()
824 ccb->task = task; in pm8001_exec_internal_task_abort()
831 del_timer(&task->slow_task->timer); in pm8001_exec_internal_task_abort()
835 wait_for_completion(&task->slow_task->completion); in pm8001_exec_internal_task_abort()
838 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { in pm8001_exec_internal_task_abort()
843 if (task->task_status.resp == SAS_TASK_COMPLETE && in pm8001_exec_internal_task_abort()
844 task->task_status.stat == SAS_SAM_STAT_GOOD) { in pm8001_exec_internal_task_abort()
852 task->task_status.resp, in pm8001_exec_internal_task_abort()
853 task->task_status.stat); in pm8001_exec_internal_task_abort()
854 sas_free_task(task); in pm8001_exec_internal_task_abort()
855 task = NULL; in pm8001_exec_internal_task_abort()
859 BUG_ON(retry == 3 && task != NULL); in pm8001_exec_internal_task_abort()
860 sas_free_task(task); in pm8001_exec_internal_task_abort()
930 struct sas_task *task; in pm8001_open_reject_retry() local
951 task = ccb->task; in pm8001_open_reject_retry()
952 if (!task || !task->task_done) in pm8001_open_reject_retry()
954 if (task_to_close && (task != task_to_close)) in pm8001_open_reject_retry()
956 ts = &task->task_status; in pm8001_open_reject_retry()
963 spin_lock_irqsave(&task->task_state_lock, flags1); in pm8001_open_reject_retry()
964 task->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_open_reject_retry()
965 task->task_state_flags &= ~SAS_TASK_AT_INITIATOR; in pm8001_open_reject_retry()
966 task->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_open_reject_retry()
967 if (unlikely((task->task_state_flags in pm8001_open_reject_retry()
969 spin_unlock_irqrestore(&task->task_state_lock, in pm8001_open_reject_retry()
971 pm8001_ccb_task_free(pm8001_ha, task, ccb, tag); in pm8001_open_reject_retry()
973 spin_unlock_irqrestore(&task->task_state_lock, in pm8001_open_reject_retry()
975 pm8001_ccb_task_free(pm8001_ha, task, ccb, tag); in pm8001_open_reject_retry()
978 task->task_done(task); in pm8001_open_reject_retry()
1131 int pm8001_query_task(struct sas_task *task) in pm8001_query_task() argument
1137 if (unlikely(!task || !task->lldd_task || !task->dev)) in pm8001_query_task()
1140 if (task->task_proto & SAS_PROTOCOL_SSP) { in pm8001_query_task()
1141 struct scsi_cmnd *cmnd = task->uldd_task; in pm8001_query_task()
1142 struct domain_device *dev = task->dev; in pm8001_query_task()
1147 rc = pm8001_find_tag(task, &tag); in pm8001_query_task()
1176 int pm8001_abort_task(struct sas_task *task) in pm8001_abort_task() argument
1189 if (unlikely(!task || !task->lldd_task || !task->dev)) in pm8001_abort_task()
1192 dev = task->dev; in pm8001_abort_task()
1203 ret = pm8001_find_tag(task, &tag); in pm8001_abort_task()
1205 pm8001_info(pm8001_ha, "no tag for task:%p\n", task); in pm8001_abort_task()
1208 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_abort_task()
1209 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in pm8001_abort_task()
1210 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1213 task->task_state_flags |= SAS_TASK_STATE_ABORTED; in pm8001_abort_task()
1214 if (task->slow_task == NULL) { in pm8001_abort_task()
1216 task->slow_task = &slow_task; in pm8001_abort_task()
1218 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1219 if (task->task_proto & SAS_PROTOCOL_SSP) { in pm8001_abort_task()
1220 struct scsi_cmnd *cmnd = task->uldd_task; in pm8001_abort_task()
1227 } else if (task->task_proto & SAS_PROTOCOL_SATA || in pm8001_abort_task()
1228 task->task_proto & SAS_PROTOCOL_STP) { in pm8001_abort_task()
1299 &task->slow_task->completion, in pm8001_abort_task()
1315 } else if (task->task_proto & SAS_PROTOCOL_SMP) { in pm8001_abort_task()
1322 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_abort_task()
1323 if (task->slow_task == &slow_task) in pm8001_abort_task()
1324 task->slow_task = NULL; in pm8001_abort_task()
1325 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()