Lines Matching refs: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()
319 u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag) in pm8001_get_ncq_tag() argument
321 struct ata_queued_cmd *qc = task->uldd_task; in pm8001_get_ncq_tag()
401 struct sas_task *task = ccb->task; in pm8001_deliver_command() local
402 enum sas_protocol task_proto = task->task_proto; in pm8001_deliver_command()
403 struct sas_tmf_task *tmf = task->tmf; in pm8001_deliver_command()
432 int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags) in pm8001_queue_command() argument
434 struct task_status_struct *ts = &task->task_status; in pm8001_queue_command()
435 enum sas_protocol task_proto = task->task_proto; in pm8001_queue_command()
436 struct domain_device *dev = task->dev; in pm8001_queue_command()
438 bool internal_abort = sas_is_internal_abort(task); in pm8001_queue_command()
450 task->task_done(task); in pm8001_queue_command()
457 task->task_done(task); in pm8001_queue_command()
474 task->task_done(task); in pm8001_queue_command()
477 task->task_done(task); in pm8001_queue_command()
483 ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_dev, task); in pm8001_queue_command()
490 if (task->num_scatter) { in pm8001_queue_command()
491 n_elem = dma_map_sg(pm8001_ha->dev, task->scatter, in pm8001_queue_command()
492 task->num_scatter, task->data_dir); in pm8001_queue_command()
499 n_elem = task->num_scatter; in pm8001_queue_command()
502 task->lldd_task = ccb; in pm8001_queue_command()
511 dma_unmap_sg(pm8001_ha->dev, task->scatter, in pm8001_queue_command()
512 task->num_scatter, task->data_dir); in pm8001_queue_command()
533 struct sas_task *task = ccb->task; in pm8001_ccb_task_free() local
537 if (!task) in pm8001_ccb_task_free()
540 if (!sas_protocol_ata(task->task_proto) && ccb->n_elem) in pm8001_ccb_task_free()
541 dma_unmap_sg(pm8001_ha->dev, task->scatter, in pm8001_ccb_task_free()
542 task->num_scatter, task->data_dir); in pm8001_ccb_task_free()
544 switch (task->task_proto) { in pm8001_ccb_task_free()
546 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_resp, 1, in pm8001_ccb_task_free()
548 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_req, 1, in pm8001_ccb_task_free()
560 if (sas_protocol_ata(task->task_proto)) { in pm8001_ccb_task_free()
562 qc = task->uldd_task; in pm8001_ccb_task_free()
571 task->lldd_task = NULL; in pm8001_ccb_task_free()
750 struct sas_task *task; in pm8001_open_reject_retry() local
770 task = ccb->task; in pm8001_open_reject_retry()
771 if (!task || !task->task_done) in pm8001_open_reject_retry()
773 if (task_to_close && (task != task_to_close)) in pm8001_open_reject_retry()
775 ts = &task->task_status; in pm8001_open_reject_retry()
782 spin_lock_irqsave(&task->task_state_lock, flags1); in pm8001_open_reject_retry()
783 task->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_open_reject_retry()
784 task->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_open_reject_retry()
785 if (unlikely((task->task_state_flags in pm8001_open_reject_retry()
787 spin_unlock_irqrestore(&task->task_state_lock, in pm8001_open_reject_retry()
791 spin_unlock_irqrestore(&task->task_state_lock, in pm8001_open_reject_retry()
796 task->task_done(task); in pm8001_open_reject_retry()
954 int pm8001_query_task(struct sas_task *task) in pm8001_query_task() argument
958 if (unlikely(!task || !task->lldd_task || !task->dev)) in pm8001_query_task()
961 if (task->task_proto & SAS_PROTOCOL_SSP) { in pm8001_query_task()
962 struct scsi_cmnd *cmnd = task->uldd_task; in pm8001_query_task()
963 struct domain_device *dev = task->dev; in pm8001_query_task()
967 rc = pm8001_find_tag(task, &tag); in pm8001_query_task()
974 rc = sas_query_task(task, tag); in pm8001_query_task()
994 int pm8001_abort_task(struct sas_task *task) in pm8001_abort_task() argument
996 struct pm8001_ccb_info *ccb = task->lldd_task; in pm8001_abort_task()
1006 if (!task->lldd_task || !task->dev) in pm8001_abort_task()
1009 dev = task->dev; in pm8001_abort_task()
1020 ret = pm8001_find_tag(task, &tag); in pm8001_abort_task()
1022 pm8001_info(pm8001_ha, "no tag for task:%p\n", task); in pm8001_abort_task()
1025 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_abort_task()
1026 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in pm8001_abort_task()
1027 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1030 task->task_state_flags |= SAS_TASK_STATE_ABORTED; in pm8001_abort_task()
1031 if (task->slow_task == NULL) { in pm8001_abort_task()
1033 task->slow_task = &slow_task; in pm8001_abort_task()
1035 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1036 if (task->task_proto & SAS_PROTOCOL_SSP) { in pm8001_abort_task()
1037 rc = sas_abort_task(task, tag); in pm8001_abort_task()
1039 } else if (task->task_proto & SAS_PROTOCOL_SATA || in pm8001_abort_task()
1040 task->task_proto & SAS_PROTOCOL_STP) { in pm8001_abort_task()
1115 &task->slow_task->completion, in pm8001_abort_task()
1133 ccb->task = NULL; in pm8001_abort_task()
1137 } else if (task->task_proto & SAS_PROTOCOL_SMP) { in pm8001_abort_task()
1143 spin_lock_irqsave(&task->task_state_lock, flags); in pm8001_abort_task()
1144 if (task->slow_task == &slow_task) in pm8001_abort_task()
1145 task->slow_task = NULL; in pm8001_abort_task()
1146 spin_unlock_irqrestore(&task->task_state_lock, flags); in pm8001_abort_task()
1191 void pm8001_tmf_aborted(struct sas_task *task) in pm8001_tmf_aborted() argument
1193 struct pm8001_ccb_info *ccb = task->lldd_task; in pm8001_tmf_aborted()
1196 ccb->task = NULL; in pm8001_tmf_aborted()