Commit 3a21986f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

scsi: aic94xx: fully convert to the generic DMA API

The driver is currently using an odd mix of legacy PCI DMA API and
generic DMA API calls, switch it over to the generic API entirely.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8c6f803f
...@@ -771,13 +771,8 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -771,13 +771,8 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
goto Err_remove; goto Err_remove;
err = -ENODEV; err = -ENODEV;
if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64)) if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) ||
&& !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64))) dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {
;
else if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32))
&& !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32)))
;
else {
asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
goto Err_remove; goto Err_remove;
} }
......
...@@ -42,13 +42,13 @@ static void asd_can_dequeue(struct asd_ha_struct *asd_ha, int num) ...@@ -42,13 +42,13 @@ static void asd_can_dequeue(struct asd_ha_struct *asd_ha, int num)
spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags);
} }
/* PCI_DMA_... to our direction translation. /* DMA_... to our direction translation.
*/ */
static const u8 data_dir_flags[] = { static const u8 data_dir_flags[] = {
[PCI_DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */ [DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */
[PCI_DMA_TODEVICE] = DATA_DIR_OUT, /* OUTBOUND */ [DMA_TO_DEVICE] = DATA_DIR_OUT, /* OUTBOUND */
[PCI_DMA_FROMDEVICE] = DATA_DIR_IN, /* INBOUND */ [DMA_FROM_DEVICE] = DATA_DIR_IN, /* INBOUND */
[PCI_DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */ [DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */
}; };
static int asd_map_scatterlist(struct sas_task *task, static int asd_map_scatterlist(struct sas_task *task,
...@@ -60,12 +60,12 @@ static int asd_map_scatterlist(struct sas_task *task, ...@@ -60,12 +60,12 @@ static int asd_map_scatterlist(struct sas_task *task,
struct scatterlist *sc; struct scatterlist *sc;
int num_sg, res; int num_sg, res;
if (task->data_dir == PCI_DMA_NONE) if (task->data_dir == DMA_NONE)
return 0; return 0;
if (task->num_scatter == 0) { if (task->num_scatter == 0) {
void *p = task->scatter; void *p = task->scatter;
dma_addr_t dma = pci_map_single(asd_ha->pcidev, p, dma_addr_t dma = dma_map_single(&asd_ha->pcidev->dev, p,
task->total_xfer_len, task->total_xfer_len,
task->data_dir); task->data_dir);
sg_arr[0].bus_addr = cpu_to_le64((u64)dma); sg_arr[0].bus_addr = cpu_to_le64((u64)dma);
...@@ -79,7 +79,7 @@ static int asd_map_scatterlist(struct sas_task *task, ...@@ -79,7 +79,7 @@ static int asd_map_scatterlist(struct sas_task *task,
if (sas_protocol_ata(task->task_proto)) if (sas_protocol_ata(task->task_proto))
num_sg = task->num_scatter; num_sg = task->num_scatter;
else else
num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter,
task->num_scatter, task->data_dir); task->num_scatter, task->data_dir);
if (num_sg == 0) if (num_sg == 0)
return -ENOMEM; return -ENOMEM;
...@@ -126,8 +126,8 @@ static int asd_map_scatterlist(struct sas_task *task, ...@@ -126,8 +126,8 @@ static int asd_map_scatterlist(struct sas_task *task,
return 0; return 0;
err_unmap: err_unmap:
if (sas_protocol_ata(task->task_proto)) if (sas_protocol_ata(task->task_proto))
pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter,
task->data_dir); task->num_scatter, task->data_dir);
return res; return res;
} }
...@@ -136,21 +136,21 @@ static void asd_unmap_scatterlist(struct asd_ascb *ascb) ...@@ -136,21 +136,21 @@ static void asd_unmap_scatterlist(struct asd_ascb *ascb)
struct asd_ha_struct *asd_ha = ascb->ha; struct asd_ha_struct *asd_ha = ascb->ha;
struct sas_task *task = ascb->uldd_task; struct sas_task *task = ascb->uldd_task;
if (task->data_dir == PCI_DMA_NONE) if (task->data_dir == DMA_NONE)
return; return;
if (task->num_scatter == 0) { if (task->num_scatter == 0) {
dma_addr_t dma = (dma_addr_t) dma_addr_t dma = (dma_addr_t)
le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr); le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr);
pci_unmap_single(ascb->ha->pcidev, dma, task->total_xfer_len, dma_unmap_single(&ascb->ha->pcidev->dev, dma,
task->data_dir); task->total_xfer_len, task->data_dir);
return; return;
} }
asd_free_coherent(asd_ha, ascb->sg_arr); asd_free_coherent(asd_ha, ascb->sg_arr);
if (task->task_proto != SAS_PROTOCOL_STP) if (task->task_proto != SAS_PROTOCOL_STP)
pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter,
task->data_dir); task->num_scatter, task->data_dir);
} }
/* ---------- Task complete tasklet ---------- */ /* ---------- Task complete tasklet ---------- */
...@@ -436,10 +436,10 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, ...@@ -436,10 +436,10 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
struct domain_device *dev = task->dev; struct domain_device *dev = task->dev;
struct scb *scb; struct scb *scb;
pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1, dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1,
PCI_DMA_TODEVICE); DMA_TO_DEVICE);
pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1, dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
scb = ascb->scb; scb = ascb->scb;
...@@ -471,10 +471,10 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a) ...@@ -471,10 +471,10 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
struct sas_task *task = a->uldd_task; struct sas_task *task = a->uldd_task;
BUG_ON(!task); BUG_ON(!task);
pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1, dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1,
PCI_DMA_TODEVICE); DMA_TO_DEVICE);
pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1, dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
} }
/* ---------- SSP ---------- */ /* ---------- SSP ---------- */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment