Lines Matching full:task

36 static int asd_map_scatterlist(struct sas_task *task,  in asd_map_scatterlist()  argument
40 struct asd_ascb *ascb = task->lldd_task; in asd_map_scatterlist()
45 if (task->data_dir == DMA_NONE) in asd_map_scatterlist()
48 if (task->num_scatter == 0) { in asd_map_scatterlist()
49 void *p = task->scatter; in asd_map_scatterlist()
51 task->total_xfer_len, in asd_map_scatterlist()
52 task->data_dir); in asd_map_scatterlist()
54 sg_arr[0].size = cpu_to_le32(task->total_xfer_len); in asd_map_scatterlist()
61 if (sas_protocol_ata(task->task_proto)) in asd_map_scatterlist()
62 num_sg = task->num_scatter; in asd_map_scatterlist()
64 num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter, in asd_map_scatterlist()
65 task->num_scatter, task->data_dir); in asd_map_scatterlist()
79 for_each_sg(task->scatter, sc, num_sg, i) { in asd_map_scatterlist()
88 for_each_sg(task->scatter, sc, 2, i) { in asd_map_scatterlist()
100 for_each_sg(task->scatter, sc, num_sg, i) { in asd_map_scatterlist()
110 if (sas_protocol_ata(task->task_proto)) in asd_map_scatterlist()
111 dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, in asd_map_scatterlist()
112 task->num_scatter, task->data_dir); in asd_map_scatterlist()
119 struct sas_task *task = ascb->uldd_task; in asd_unmap_scatterlist() local
121 if (task->data_dir == DMA_NONE) in asd_unmap_scatterlist()
124 if (task->num_scatter == 0) { in asd_unmap_scatterlist()
128 task->total_xfer_len, task->data_dir); in asd_unmap_scatterlist()
133 if (task->task_proto != SAS_PROTOCOL_STP) in asd_unmap_scatterlist()
134 dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, in asd_unmap_scatterlist()
135 task->num_scatter, task->data_dir); in asd_unmap_scatterlist()
138 /* ---------- Task complete tasklet ---------- */
144 struct sas_task *task = ascb->uldd_task; in asd_get_response_tasklet() local
145 struct task_status_struct *ts = &task->task_status; in asd_get_response_tasklet()
172 if (task->task_proto == SAS_PROTOCOL_SSP) { in asd_get_response_tasklet()
178 sas_ssp_task_response(&asd_ha->pcidev->dev, task, iu); in asd_get_response_tasklet()
197 struct sas_task *task = ascb->uldd_task; in asd_task_tasklet_complete() local
198 struct task_status_struct *ts = &task->task_status; in asd_task_tasklet_complete()
308 switch (task->task_proto) { in asd_task_tasklet_complete()
323 spin_lock_irqsave(&task->task_state_lock, flags); in asd_task_tasklet_complete()
324 task->task_state_flags &= ~SAS_TASK_STATE_PENDING; in asd_task_tasklet_complete()
325 task->task_state_flags |= SAS_TASK_STATE_DONE; in asd_task_tasklet_complete()
326 if (unlikely((task->task_state_flags & SAS_TASK_STATE_ABORTED))) { in asd_task_tasklet_complete()
328 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_task_tasklet_complete()
329 ASD_DPRINTK("task 0x%p done with opcode 0x%x resp 0x%x " in asd_task_tasklet_complete()
331 task, opcode, ts->resp, ts->stat); in asd_task_tasklet_complete()
335 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_task_tasklet_complete()
336 task->lldd_task = NULL; in asd_task_tasklet_complete()
339 task->task_done(task); in asd_task_tasklet_complete()
345 static int asd_build_ata_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_ata_ascb() argument
348 struct domain_device *dev = task->dev; in asd_build_ata_ascb()
355 if (unlikely(task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
366 scb->ata_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); in asd_build_ata_ascb()
367 scb->ata_task.fis = task->ata_task.fis; in asd_build_ata_ascb()
368 if (likely(!task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
372 memcpy(scb->ata_task.atapi_packet, task->ata_task.atapi_packet, in asd_build_ata_ascb()
378 if (likely(!task->ata_task.device_control_reg_update)) { in asd_build_ata_ascb()
380 if (task->ata_task.dma_xfer) in asd_build_ata_ascb()
382 if (task->ata_task.use_ncq && in asd_build_ata_ascb()
385 flags |= data_dir_flags[task->data_dir]; in asd_build_ata_ascb()
388 scb->ata_task.retry_count = task->ata_task.retry_count; in asd_build_ata_ascb()
391 if (task->ata_task.set_affil_pol) in asd_build_ata_ascb()
393 if (task->ata_task.stp_affil_pol) in asd_build_ata_ascb()
399 if (likely(!task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
400 res = asd_map_scatterlist(task, scb->ata_task.sg_element, in asd_build_ata_ascb()
413 static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_smp_ascb() argument
417 struct domain_device *dev = task->dev; in asd_build_smp_ascb()
420 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1, in asd_build_smp_ascb()
422 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1, in asd_build_smp_ascb()
432 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req)); in asd_build_smp_ascb()
434 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-4); in asd_build_smp_ascb()
437 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_resp)); in asd_build_smp_ascb()
439 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); in asd_build_smp_ascb()
452 struct sas_task *task = a->uldd_task; in asd_unbuild_smp_ascb() local
454 BUG_ON(!task); in asd_unbuild_smp_ascb()
455 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1, in asd_unbuild_smp_ascb()
457 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1, in asd_unbuild_smp_ascb()
463 static int asd_build_ssp_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_ssp_ascb() argument
466 struct domain_device *dev = task->dev; in asd_build_ssp_ascb()
476 scb->ssp_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); in asd_build_ssp_ascb()
484 memcpy(scb->ssp_task.ssp_cmd.lun, task->ssp_task.LUN, 8); in asd_build_ssp_ascb()
485 if (task->ssp_task.enable_first_burst) in asd_build_ssp_ascb()
487 scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_prio << 3); in asd_build_ssp_ascb()
488 scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_attr & 7); in asd_build_ssp_ascb()
489 memcpy(scb->ssp_task.ssp_cmd.cdb, task->ssp_task.cmd->cmnd, in asd_build_ssp_ascb()
490 task->ssp_task.cmd->cmd_len); in asd_build_ssp_ascb()
495 scb->ssp_task.data_dir = data_dir_flags[task->data_dir]; in asd_build_ssp_ascb()
500 res = asd_map_scatterlist(task, scb->ssp_task.sg_element, gfp_flags); in asd_build_ssp_ascb()
510 /* ---------- Execute Task ---------- */
527 int asd_execute_task(struct sas_task *task, gfp_t gfp_flags) in asd_execute_task() argument
531 struct sas_task *t = task; in asd_execute_task()
533 struct asd_ha_struct *asd_ha = task->dev->port->ha->lldd_ha; in asd_execute_task()