aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2007-07-16 14:41:04 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-18 12:16:14 -0400
commit0f05df8b3b41bc258bdf520b72e8cf7c524048b7 (patch)
treee6fd95f097da4785a1e0fb195044a745de8e89aa /drivers/scsi/libsas
parent3a2755af37b317d47fdc3dd15178adaf5d47263e (diff)
[SCSI] libsas, aic94xx: fix dma mapping cockups with ATA
This one was noticed by Gilbert Wu of Adaptec: The libata core actually does the DMA mapping for you, so there has to be an exception in the device drivers that *don't* do dma mapping for ATA commands. However, since we've already done this, libsas must now dma map any ATA commands that it wishes to issue ... and yes, this is a horrible mess. Additionally, the test in aic94xx for ATA protocols isn't quite right. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r--drivers/scsi/libsas/sas_discover.c14
1 files changed, 13 insertions, 1 deletions
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,
110 task->total_xfer_len = size; 110 task->total_xfer_len = size;
111 task->data_dir = pci_dma_dir; 111 task->data_dir = pci_dma_dir;
112 task->task_done = sas_disc_task_done; 112 task->task_done = sas_disc_task_done;
113 if (pci_dma_dir != PCI_DMA_NONE &&
114 sas_protocol_ata(task->task_proto)) {
115 task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev,
116 task->scatter,
117 task->num_scatter,
118 task->data_dir);
119 }
113 120
114 for (retries = 0; retries < 5; retries++) { 121 for (retries = 0; retries < 5; retries++) {
115 task->task_state_flags = SAS_TASK_STATE_PENDING; 122 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,
192 } 199 }
193 } 200 }
194ex_err: 201ex_err:
195 if (pci_dma_dir != PCI_DMA_NONE) 202 if (pci_dma_dir != PCI_DMA_NONE) {
203 if (sas_protocol_ata(task->task_proto))
204 pci_unmap_sg(task->dev->port->ha->pcidev,
205 task->scatter, task->num_scatter,
206 task->data_dir);
196 kfree(scatter); 207 kfree(scatter);
208 }
197out: 209out:
198 return res; 210 return res;
199} 211}