aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c4
-rw-r--r--drivers/scsi/libsas/sas_discover.c14
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index 6c12c0f19f3..d5d8caba356 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -76,7 +76,7 @@ static inline int asd_map_scatterlist(struct sas_task *task,
/* STP tasks come from libata which has already mapped
* the SG list */
- if (task->task_proto == SAS_PROTOCOL_STP)
+ if (sas_protocol_ata(task->task_proto))
num_sg = task->num_scatter;
else
num_sg = pci_map_sg(asd_ha->pcidev, task->scatter,
@@ -125,7 +125,7 @@ static inline int asd_map_scatterlist(struct sas_task *task,
return 0;
err_unmap:
- if (task->task_proto != SAS_PROTOCOL_STP)
+ if (sas_protocol_ata(task->task_proto))
pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,
task->data_dir);
return res;
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index a18c0f6d666..4d768db1b56 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -110,6 +110,13 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
task->total_xfer_len = size;
task->data_dir = pci_dma_dir;
task->task_done = sas_disc_task_done;
+ if (pci_dma_dir != PCI_DMA_NONE &&
+ sas_protocol_ata(task->task_proto)) {
+ task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev,
+ task->scatter,
+ task->num_scatter,
+ task->data_dir);
+ }
for (retries = 0; retries < 5; retries++) {
task->task_state_flags = SAS_TASK_STATE_PENDING;
@@ -192,8 +199,13 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
}
}
ex_err:
- if (pci_dma_dir != PCI_DMA_NONE)
+ if (pci_dma_dir != PCI_DMA_NONE) {
+ if (sas_protocol_ata(task->task_proto))
+ pci_unmap_sg(task->dev->port->ha->pcidev,
+ task->scatter, task->num_scatter,
+ task->data_dir);
kfree(scatter);
+ }
out:
return res;
}