summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-28 03:09:11 +0200
committerDavid S. Miller <davem@davemloft.net>2008-08-29 11:13:15 +0200
commit738f2b7b813913e651f39387d007dd961755dee2 (patch)
tree022ca4d144cba51495e6f26a8f55d3046d16c2e3 /drivers/scsi
parentsparc32: Implement more generic dma_*() interfaces. (diff)
downloadlinux-738f2b7b813913e651f39387d007dd961755dee2.tar.xz
linux-738f2b7b813913e651f39387d007dd961755dee2.zip
sparc: Convert all SBUS drivers to dma_*() interfaces.
And all the SBUS dma interfaces are deleted. A private implementation remains inside of the 32-bit sparc port which exists only for the sake of the implementation of dma_*(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qlogicpti.c53
-rw-r--r--drivers/scsi/sun_esp.c26
2 files changed, 41 insertions, 38 deletions
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index f010506af884..1559d455b2b7 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -25,6 +25,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/jiffies.h>
+#include <linux/dma-mapping.h>
#include <asm/byteorder.h>
@@ -788,22 +789,22 @@ static int __devinit qpti_map_queues(struct qlogicpti *qpti)
struct sbus_dev *sdev = qpti->sdev;
#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
- qpti->res_cpu = sbus_alloc_consistent(&sdev->ofdev.dev,
- QSIZE(RES_QUEUE_LEN),
- &qpti->res_dvma);
+ qpti->res_cpu = dma_alloc_coherent(&sdev->ofdev.dev,
+ QSIZE(RES_QUEUE_LEN),
+ &qpti->res_dvma, GFP_ATOMIC);
if (qpti->res_cpu == NULL ||
qpti->res_dvma == 0) {
printk("QPTI: Cannot map response queue.\n");
return -1;
}
- qpti->req_cpu = sbus_alloc_consistent(&sdev->ofdev.dev,
- QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
- &qpti->req_dvma);
+ qpti->req_cpu = dma_alloc_coherent(&sdev->ofdev.dev,
+ QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
+ &qpti->req_dvma, GFP_ATOMIC);
if (qpti->req_cpu == NULL ||
qpti->req_dvma == 0) {
- sbus_free_consistent(&sdev->ofdev.dev, QSIZE(RES_QUEUE_LEN),
- qpti->res_cpu, qpti->res_dvma);
+ dma_free_coherent(&sdev->ofdev.dev, QSIZE(RES_QUEUE_LEN),
+ qpti->res_cpu, qpti->res_dvma);
printk("QPTI: Cannot map request queue.\n");
return -1;
}
@@ -875,9 +876,9 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
int sg_count;
sg = scsi_sglist(Cmnd);
- sg_count = sbus_map_sg(&qpti->sdev->ofdev.dev, sg,
- scsi_sg_count(Cmnd),
- Cmnd->sc_data_direction);
+ sg_count = dma_map_sg(&qpti->sdev->ofdev.dev, sg,
+ scsi_sg_count(Cmnd),
+ Cmnd->sc_data_direction);
ds = cmd->dataseg;
cmd->segment_cnt = sg_count;
@@ -1152,9 +1153,9 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
Cmnd->result = DID_ERROR << 16;
if (scsi_bufflen(Cmnd))
- sbus_unmap_sg(&qpti->sdev->ofdev.dev,
- scsi_sglist(Cmnd), scsi_sg_count(Cmnd),
- Cmnd->sc_data_direction);
+ dma_unmap_sg(&qpti->sdev->ofdev.dev,
+ scsi_sglist(Cmnd), scsi_sg_count(Cmnd),
+ Cmnd->sc_data_direction);
qpti->cmd_count[Cmnd->device->id]--;
sbus_writew(out_ptr, qpti->qregs + MBOX5);
@@ -1357,12 +1358,12 @@ static int __devinit qpti_sbus_probe(struct of_device *dev, const struct of_devi
fail_unmap_queues:
#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
- sbus_free_consistent(&qpti->sdev->ofdev.dev,
- QSIZE(RES_QUEUE_LEN),
- qpti->res_cpu, qpti->res_dvma);
- sbus_free_consistent(&qpti->sdev->ofdev.dev,
- QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
- qpti->req_cpu, qpti->req_dvma);
+ dma_free_coherent(&qpti->sdev->ofdev.dev,
+ QSIZE(RES_QUEUE_LEN),
+ qpti->res_cpu, qpti->res_dvma);
+ dma_free_coherent(&qpti->sdev->ofdev.dev,
+ QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
+ qpti->req_cpu, qpti->req_dvma);
#undef QSIZE
fail_unmap_regs:
@@ -1395,12 +1396,12 @@ static int __devexit qpti_sbus_remove(struct of_device *dev)
free_irq(qpti->irq, qpti);
#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
- sbus_free_consistent(&qpti->sdev->ofdev.dev,
- QSIZE(RES_QUEUE_LEN),
- qpti->res_cpu, qpti->res_dvma);
- sbus_free_consistent(&qpti->sdev->ofdev.dev,
- QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
- qpti->req_cpu, qpti->req_dvma);
+ dma_free_coherent(&qpti->sdev->ofdev.dev,
+ QSIZE(RES_QUEUE_LEN),
+ qpti->res_cpu, qpti->res_dvma);
+ dma_free_coherent(&qpti->sdev->ofdev.dev,
+ QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
+ qpti->req_cpu, qpti->req_dvma);
#undef QSIZE
sbus_iounmap(qpti->qregs, qpti->sdev->reg_addrs[0].reg_size);
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index 35b6e2ccc394..f7508743f705 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/init.h>
+#include <linux/dma-mapping.h>
#include <asm/irq.h>
#include <asm/io.h>
@@ -101,8 +102,9 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp)
{
struct sbus_dev *sdev = esp->dev;
- esp->command_block = sbus_alloc_consistent(&sdev->ofdev.dev, 16,
- &esp->command_block_dma);
+ esp->command_block = dma_alloc_coherent(&sdev->ofdev.dev, 16,
+ &esp->command_block_dma,
+ GFP_ATOMIC);
if (!esp->command_block)
return -ENOMEM;
return 0;
@@ -225,7 +227,7 @@ static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf,
{
struct sbus_dev *sdev = esp->dev;
- return sbus_map_single(&sdev->ofdev.dev, buf, sz, dir);
+ return dma_map_single(&sdev->ofdev.dev, buf, sz, dir);
}
static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg,
@@ -233,7 +235,7 @@ static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg,
{
struct sbus_dev *sdev = esp->dev;
- return sbus_map_sg(&sdev->ofdev.dev, sg, num_sg, dir);
+ return dma_map_sg(&sdev->ofdev.dev, sg, num_sg, dir);
}
static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr,
@@ -241,7 +243,7 @@ static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr,
{
struct sbus_dev *sdev = esp->dev;
- sbus_unmap_single(&sdev->ofdev.dev, addr, sz, dir);
+ dma_unmap_single(&sdev->ofdev.dev, addr, sz, dir);
}
static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
@@ -249,7 +251,7 @@ static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
{
struct sbus_dev *sdev = esp->dev;
- sbus_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir);
+ dma_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir);
}
static int sbus_esp_irq_pending(struct esp *esp)
@@ -558,9 +560,9 @@ static int __devinit esp_sbus_probe_one(struct device *dev,
fail_free_irq:
free_irq(host->irq, esp);
fail_unmap_command_block:
- sbus_free_consistent(&esp_dev->ofdev.dev, 16,
- esp->command_block,
- esp->command_block_dma);
+ dma_free_coherent(&esp_dev->ofdev.dev, 16,
+ esp->command_block,
+ esp->command_block_dma);
fail_unmap_regs:
sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
fail_unlink:
@@ -609,9 +611,9 @@ static int __devexit esp_sbus_remove(struct of_device *dev)
dma_write32(val & ~DMA_INT_ENAB, DMA_CSR);
free_irq(irq, esp);
- sbus_free_consistent(&sdev->ofdev.dev, 16,
- esp->command_block,
- esp->command_block_dma);
+ dma_free_coherent(&sdev->ofdev.dev, 16,
+ esp->command_block,
+ esp->command_block_dma);
sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
of_iounmap(&dma_of->resource[0], esp->dma_regs,
resource_size(&dma_of->resource[0]));