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)
52 if (task->lldd_task) {
54 ccb = task->lldd_task;
64 * @tag: the found tag associated with the task
80 * pm8001_tag_alloc - allocate a empty tag for task used.
104 static void pm80xx_get_tag_opcodes(struct sas_task *task, int *ata_op,
114 if (!task)
117 spin_lock_irqsave(&task->task_state_lock, flags);
118 if (unlikely((task->task_state_flags & SAS_TASK_STATE_ABORTED)))
120 spin_unlock_irqrestore(&task->task_state_lock, flags);
122 if (task->task_proto == SAS_PROTOCOL_STP) {
125 qc = task->uldd_task;
148 struct sas_task *task = NULL;
160 task = ccb->task;
161 pm80xx_get_tag_opcodes(task, &ata_op, &ata_tag, &task_aborted);
163 "tag %#x, device %#x task %p task aborted %d ata opcode %#x ata tag %d\n",
166 task, task_aborted,
376 * pm8001_task_prep_smp - the dispatcher function, prepare data for smp task
378 * @ccb: the ccb which attached to smp task
386 u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag)
388 struct ata_queued_cmd *qc = task->uldd_task;
399 * pm8001_task_prep_ata - the dispatcher function, prepare data for sata task
401 * @ccb: the ccb which attached to sata task
411 * for internal abort task
413 * @ccb: the ccb which attached to sata task
422 * pm8001_task_prep_ssp_tm - the dispatcher function, prepare task management data
425 * @tmf: the task management IU
434 * pm8001_task_prep_ssp - the dispatcher function, prepare ssp data for ssp task
436 * @ccb: the ccb which attached to ssp task
451 struct sas_task *task = ccb->task;
452 enum sas_protocol task_proto = task->task_proto;
453 struct sas_tmf_task *tmf = task->tmf;
479 * @task: the task to be execute.
482 int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags)
484 struct task_status_struct *ts = &task->task_status;
485 enum sas_protocol task_proto = task->task_proto;
486 struct domain_device *dev = task->dev;
488 bool internal_abort = sas_is_internal_abort(task);
500 task->task_done(task);
507 task->task_done(task);
523 task->task_done(task);
526 task->task_done(task);
532 ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_dev, task);
539 if (task->num_scatter) {
540 n_elem = dma_map_sg(pm8001_ha->dev, task->scatter,
541 task->num_scatter, task->data_dir);
548 n_elem = task->num_scatter;
551 task->lldd_task = ccb;
560 dma_unmap_sg(pm8001_ha->dev, task->scatter,
561 task->num_scatter, task->data_dir);
577 * @ccb: the ccb which attached to ssp task to free
582 struct sas_task *task = ccb->task;
586 if (!task)
589 if (!sas_protocol_ata(task->task_proto) && ccb->n_elem)
590 dma_unmap_sg(pm8001_ha->dev, task->scatter,
591 task->num_scatter, task->data_dir);
593 switch (task->task_proto) {
595 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_resp, 1,
597 dma_unmap_sg(pm8001_ha->dev, &task->smp_task.smp_req, 1,
609 if (sas_protocol_ata(task->task_proto)) {
611 qc = task->uldd_task;
620 task->lldd_task = NULL;
801 /* retry commands by ha, by task and/or by device */
816 struct sas_task *task;
836 task = ccb->task;
837 if (!task || !task->task_done)
839 if (task_to_close && (task != task_to_close))
841 ts = &task->task_status;
848 spin_lock_irqsave(&task->task_state_lock, flags1);
849 task->task_state_flags &= ~SAS_TASK_STATE_PENDING;
850 task->task_state_flags |= SAS_TASK_STATE_DONE;
851 if (unlikely((task->task_state_flags
853 spin_unlock_irqrestore(&task->task_state_lock,
857 spin_unlock_irqrestore(&task->task_state_lock,
862 task->task_done(task);
907 pm8001_dbg(pm8001_ha, EH, "task abort failed %x\n"
983 /* mandatory SAM-3, the task reset the specified LUN*/
1020 int pm8001_query_task(struct sas_task *task)
1024 if (unlikely(!task || !task->lldd_task || !task->dev))
1027 if (task->task_proto & SAS_PROTOCOL_SSP) {
1028 struct scsi_cmnd *cmnd = task->uldd_task;
1029 struct domain_device *dev = task->dev;
1033 rc = pm8001_find_tag(task, &tag);
1040 rc = sas_query_task(task, tag);
1042 /* The task is still in Lun, release it then */
1045 "The task is still in Lun\n");
1047 /* The task is not in Lun or failed, reset the phy */
1051 "The task is not in Lun or failed, reset the phy\n");
1059 /* mandatory SAM-3, still need free task/ccb info, abort the specified task */
1060 int pm8001_abort_task(struct sas_task *task)
1062 struct pm8001_ccb_info *ccb = task->lldd_task;
1072 if (!task->lldd_task || !task->dev)
1075 dev = task->dev;
1081 // abort task will not get a response from the controller
1085 ret = pm8001_find_tag(task, &tag);
1087 pm8001_info(pm8001_ha, "no tag for task:%p\n", task);
1090 spin_lock_irqsave(&task->task_state_lock, flags);
1091 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
1092 spin_unlock_irqrestore(&task->task_state_lock, flags);
1095 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
1096 if (task->slow_task == NULL) {
1098 task->slow_task = &slow_task;
1100 spin_unlock_irqrestore(&task->task_state_lock, flags);
1101 if (task->task_proto & SAS_PROTOCOL_SSP) {
1102 rc = sas_abort_task(task, tag);
1104 } else if (task->task_proto & SAS_PROTOCOL_SATA ||
1105 task->task_proto & SAS_PROTOCOL_STP) {
1138 * leaking the task in libsas or losing the race and
1173 * we wait for the task to be aborted so that the task
1175 * going to free the task.
1181 &task->slow_task->completion,
1195 * associated with the task which we are trying to
1199 ccb->task = NULL;
1203 } else if (task->task_proto & SAS_PROTOCOL_SMP) {
1209 spin_lock_irqsave(&task->task_state_lock, flags);
1210 if (task->slow_task == &slow_task)
1211 task->slow_task = NULL;
1212 spin_unlock_irqrestore(&task->task_state_lock, flags);
1223 pm8001_dbg(pm8001_ha, EH, "I_T_L_Q clear task set[%x]\n",
1257 void pm8001_tmf_aborted(struct sas_task *task)
1259 struct pm8001_ccb_info *ccb = task->lldd_task;
1262 ccb->task = NULL;