Lines Matching refs: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()
57 sg_arr[0].size = cpu_to_le32(task->total_xfer_len); in asd_map_scatterlist()
64 if (sas_protocol_ata(task->task_proto)) in asd_map_scatterlist()
65 num_sg = task->num_scatter; in asd_map_scatterlist()
67 num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter, in asd_map_scatterlist()
68 task->num_scatter, task->data_dir); in asd_map_scatterlist()
82 for_each_sg(task->scatter, sc, num_sg, i) { in asd_map_scatterlist()
91 for_each_sg(task->scatter, sc, 2, i) { in asd_map_scatterlist()
103 for_each_sg(task->scatter, sc, num_sg, i) { in asd_map_scatterlist()
113 if (sas_protocol_ata(task->task_proto)) in asd_map_scatterlist()
114 dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, in asd_map_scatterlist()
115 task->num_scatter, task->data_dir); in asd_map_scatterlist()
122 struct sas_task *task = ascb->uldd_task; in asd_unmap_scatterlist() local
124 if (task->data_dir == DMA_NONE) in asd_unmap_scatterlist()
127 if (task->num_scatter == 0) { in asd_unmap_scatterlist()
131 task->total_xfer_len, task->data_dir); in asd_unmap_scatterlist()
136 if (task->task_proto != SAS_PROTOCOL_STP) in asd_unmap_scatterlist()
137 dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, in asd_unmap_scatterlist()
138 task->num_scatter, task->data_dir); in asd_unmap_scatterlist()
147 struct sas_task *task = ascb->uldd_task; in asd_get_response_tasklet() local
148 struct task_status_struct *ts = &task->task_status; in asd_get_response_tasklet()
175 if (task->task_proto == SAS_PROTOCOL_SSP) { in asd_get_response_tasklet()
181 sas_ssp_task_response(&asd_ha->pcidev->dev, task, iu); in asd_get_response_tasklet()
200 struct sas_task *task = ascb->uldd_task; in asd_task_tasklet_complete() local
201 struct task_status_struct *ts = &task->task_status; in asd_task_tasklet_complete()
311 switch (task->task_proto) { in asd_task_tasklet_complete()
326 spin_lock_irqsave(&task->task_state_lock, flags); in asd_task_tasklet_complete()
327 task->task_state_flags &= ~SAS_TASK_STATE_PENDING; in asd_task_tasklet_complete()
328 task->task_state_flags |= SAS_TASK_STATE_DONE; in asd_task_tasklet_complete()
329 if (unlikely((task->task_state_flags & SAS_TASK_STATE_ABORTED))) { in asd_task_tasklet_complete()
331 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_task_tasklet_complete()
334 task, opcode, ts->resp, ts->stat); in asd_task_tasklet_complete()
338 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_task_tasklet_complete()
339 task->lldd_task = NULL; in asd_task_tasklet_complete()
342 task->task_done(task); in asd_task_tasklet_complete()
348 static int asd_build_ata_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_ata_ascb() argument
351 struct domain_device *dev = task->dev; in asd_build_ata_ascb()
358 if (unlikely(task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
369 scb->ata_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); in asd_build_ata_ascb()
370 scb->ata_task.fis = task->ata_task.fis; in asd_build_ata_ascb()
371 if (likely(!task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
375 memcpy(scb->ata_task.atapi_packet, task->ata_task.atapi_packet, in asd_build_ata_ascb()
381 if (likely(!task->ata_task.device_control_reg_update)) { in asd_build_ata_ascb()
383 if (task->ata_task.dma_xfer) in asd_build_ata_ascb()
385 if (task->ata_task.use_ncq && in asd_build_ata_ascb()
388 flags |= data_dir_flags[task->data_dir]; in asd_build_ata_ascb()
397 if (likely(!task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
398 res = asd_map_scatterlist(task, scb->ata_task.sg_element, in asd_build_ata_ascb()
411 static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_smp_ascb() argument
415 struct domain_device *dev = task->dev; in asd_build_smp_ascb()
418 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1, in asd_build_smp_ascb()
420 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1, in asd_build_smp_ascb()
430 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req)); in asd_build_smp_ascb()
432 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-4); in asd_build_smp_ascb()
435 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_resp)); in asd_build_smp_ascb()
437 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); in asd_build_smp_ascb()
450 struct sas_task *task = a->uldd_task; in asd_unbuild_smp_ascb() local
452 BUG_ON(!task); in asd_unbuild_smp_ascb()
453 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1, in asd_unbuild_smp_ascb()
455 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1, in asd_unbuild_smp_ascb()
461 static int asd_build_ssp_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_ssp_ascb() argument
464 struct domain_device *dev = task->dev; in asd_build_ssp_ascb()
474 scb->ssp_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); in asd_build_ssp_ascb()
482 memcpy(scb->ssp_task.ssp_cmd.lun, task->ssp_task.LUN, 8); in asd_build_ssp_ascb()
483 scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_attr & 7); in asd_build_ssp_ascb()
484 memcpy(scb->ssp_task.ssp_cmd.cdb, task->ssp_task.cmd->cmnd, in asd_build_ssp_ascb()
485 task->ssp_task.cmd->cmd_len); in asd_build_ssp_ascb()
490 scb->ssp_task.data_dir = data_dir_flags[task->data_dir]; in asd_build_ssp_ascb()
495 res = asd_map_scatterlist(task, scb->ssp_task.sg_element, gfp_flags); in asd_build_ssp_ascb()
522 int asd_execute_task(struct sas_task *task, gfp_t gfp_flags) in asd_execute_task() argument
526 struct sas_task *t = task; in asd_execute_task()
528 struct asd_ha_struct *asd_ha = task->dev->port->ha->lldd_ha; in asd_execute_task()