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()
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()
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_AT_INITIATOR; in asd_task_tasklet_complete()
326 task->task_state_flags |= SAS_TASK_STATE_DONE; in asd_task_tasklet_complete()
327 if (unlikely((task->task_state_flags & SAS_TASK_STATE_ABORTED))) { in asd_task_tasklet_complete()
329 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_task_tasklet_complete()
332 task, opcode, ts->resp, ts->stat); in asd_task_tasklet_complete()
336 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_task_tasklet_complete()
337 task->lldd_task = NULL; in asd_task_tasklet_complete()
340 task->task_done(task); in asd_task_tasklet_complete()
346 static int asd_build_ata_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_ata_ascb() argument
349 struct domain_device *dev = task->dev; in asd_build_ata_ascb()
356 if (unlikely(task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
367 scb->ata_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); in asd_build_ata_ascb()
368 scb->ata_task.fis = task->ata_task.fis; in asd_build_ata_ascb()
369 if (likely(!task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
373 memcpy(scb->ata_task.atapi_packet, task->ata_task.atapi_packet, in asd_build_ata_ascb()
379 if (likely(!task->ata_task.device_control_reg_update)) { in asd_build_ata_ascb()
381 if (task->ata_task.dma_xfer) in asd_build_ata_ascb()
383 if (task->ata_task.use_ncq && in asd_build_ata_ascb()
386 flags |= data_dir_flags[task->data_dir]; in asd_build_ata_ascb()
389 scb->ata_task.retry_count = task->ata_task.retry_count; in asd_build_ata_ascb()
392 if (task->ata_task.set_affil_pol) in asd_build_ata_ascb()
394 if (task->ata_task.stp_affil_pol) in asd_build_ata_ascb()
400 if (likely(!task->ata_task.device_control_reg_update)) in asd_build_ata_ascb()
401 res = asd_map_scatterlist(task, scb->ata_task.sg_element, in asd_build_ata_ascb()
414 static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_smp_ascb() argument
418 struct domain_device *dev = task->dev; in asd_build_smp_ascb()
421 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1, in asd_build_smp_ascb()
423 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1, in asd_build_smp_ascb()
433 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req)); in asd_build_smp_ascb()
435 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-4); in asd_build_smp_ascb()
438 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_resp)); in asd_build_smp_ascb()
440 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); in asd_build_smp_ascb()
453 struct sas_task *task = a->uldd_task; in asd_unbuild_smp_ascb() local
455 BUG_ON(!task); in asd_unbuild_smp_ascb()
456 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1, in asd_unbuild_smp_ascb()
458 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1, in asd_unbuild_smp_ascb()
464 static int asd_build_ssp_ascb(struct asd_ascb *ascb, struct sas_task *task, in asd_build_ssp_ascb() argument
467 struct domain_device *dev = task->dev; in asd_build_ssp_ascb()
477 scb->ssp_task.total_xfer_len = cpu_to_le32(task->total_xfer_len); in asd_build_ssp_ascb()
485 memcpy(scb->ssp_task.ssp_cmd.lun, task->ssp_task.LUN, 8); in asd_build_ssp_ascb()
486 if (task->ssp_task.enable_first_burst) in asd_build_ssp_ascb()
488 scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_prio << 3); in asd_build_ssp_ascb()
489 scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_attr & 7); in asd_build_ssp_ascb()
490 memcpy(scb->ssp_task.ssp_cmd.cdb, task->ssp_task.cmd->cmnd, in asd_build_ssp_ascb()
491 task->ssp_task.cmd->cmd_len); in asd_build_ssp_ascb()
496 scb->ssp_task.data_dir = data_dir_flags[task->data_dir]; in asd_build_ssp_ascb()
501 res = asd_map_scatterlist(task, scb->ssp_task.sg_element, gfp_flags); in asd_build_ssp_ascb()
528 int asd_execute_task(struct sas_task *task, gfp_t gfp_flags) in asd_execute_task() argument
532 struct sas_task *t = task; in asd_execute_task()
534 struct asd_ha_struct *asd_ha = task->dev->port->ha->lldd_ha; in asd_execute_task()