aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 21:09:11 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:13:15 -0400
commit738f2b7b813913e651f39387d007dd961755dee2 (patch)
tree022ca4d144cba51495e6f26a8f55d3046d16c2e3 /drivers/scsi
parent944c67dff7a88f0a775e5b604937f9e30d2de555 (diff)
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 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/jiffies.h> 27#include <linux/jiffies.h>
28#include <linux/dma-mapping.h>
28 29
29#include <asm/byteorder.h> 30#include <asm/byteorder.h>
30 31
@@ -788,22 +789,22 @@ static int __devinit qpti_map_queues(struct qlogicpti *qpti)
788 struct sbus_dev *sdev = qpti->sdev; 789 struct sbus_dev *sdev = qpti->sdev;
789 790
790#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) 791#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
791 qpti->res_cpu = sbus_alloc_consistent(&sdev->ofdev.dev, 792 qpti->res_cpu = dma_alloc_coherent(&sdev->ofdev.dev,
792 QSIZE(RES_QUEUE_LEN), 793 QSIZE(RES_QUEUE_LEN),
793 &qpti->res_dvma); 794 &qpti->res_dvma, GFP_ATOMIC);
794 if (qpti->res_cpu == NULL || 795 if (qpti->res_cpu == NULL ||
795 qpti->res_dvma == 0) { 796 qpti->res_dvma == 0) {
796 printk("QPTI: Cannot map response queue.\n"); 797 printk("QPTI: Cannot map response queue.\n");
797 return -1; 798 return -1;
798 } 799 }
799 800
800 qpti->req_cpu = sbus_alloc_consistent(&sdev->ofdev.dev, 801 qpti->req_cpu = dma_alloc_coherent(&sdev->ofdev.dev,
801 QSIZE(QLOGICPTI_REQ_QUEUE_LEN), 802 QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
802 &qpti->req_dvma); 803 &qpti->req_dvma, GFP_ATOMIC);
803 if (qpti->req_cpu == NULL || 804 if (qpti->req_cpu == NULL ||
804 qpti->req_dvma == 0) { 805 qpti->req_dvma == 0) {
805 sbus_free_consistent(&sdev->ofdev.dev, QSIZE(RES_QUEUE_LEN), 806 dma_free_coherent(&sdev->ofdev.dev, QSIZE(RES_QUEUE_LEN),
806 qpti->res_cpu, qpti->res_dvma); 807 qpti->res_cpu, qpti->res_dvma);
807 printk("QPTI: Cannot map request queue.\n"); 808 printk("QPTI: Cannot map request queue.\n");
808 return -1; 809 return -1;
809 } 810 }
@@ -875,9 +876,9 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
875 int sg_count; 876 int sg_count;
876 877
877 sg = scsi_sglist(Cmnd); 878 sg = scsi_sglist(Cmnd);
878 sg_count = sbus_map_sg(&qpti->sdev->ofdev.dev, sg, 879 sg_count = dma_map_sg(&qpti->sdev->ofdev.dev, sg,
879 scsi_sg_count(Cmnd), 880 scsi_sg_count(Cmnd),
880 Cmnd->sc_data_direction); 881 Cmnd->sc_data_direction);
881 882
882 ds = cmd->dataseg; 883 ds = cmd->dataseg;
883 cmd->segment_cnt = sg_count; 884 cmd->segment_cnt = sg_count;
@@ -1152,9 +1153,9 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
1152 Cmnd->result = DID_ERROR << 16; 1153 Cmnd->result = DID_ERROR << 16;
1153 1154
1154 if (scsi_bufflen(Cmnd)) 1155 if (scsi_bufflen(Cmnd))
1155 sbus_unmap_sg(&qpti->sdev->ofdev.dev, 1156 dma_unmap_sg(&qpti->sdev->ofdev.dev,
1156 scsi_sglist(Cmnd), scsi_sg_count(Cmnd), 1157 scsi_sglist(Cmnd), scsi_sg_count(Cmnd),
1157 Cmnd->sc_data_direction); 1158 Cmnd->sc_data_direction);
1158 1159
1159 qpti->cmd_count[Cmnd->device->id]--; 1160 qpti->cmd_count[Cmnd->device->id]--;
1160 sbus_writew(out_ptr, qpti->qregs + MBOX5); 1161 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
1357 1358
1358fail_unmap_queues: 1359fail_unmap_queues:
1359#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) 1360#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
1360 sbus_free_consistent(&qpti->sdev->ofdev.dev, 1361 dma_free_coherent(&qpti->sdev->ofdev.dev,
1361 QSIZE(RES_QUEUE_LEN), 1362 QSIZE(RES_QUEUE_LEN),
1362 qpti->res_cpu, qpti->res_dvma); 1363 qpti->res_cpu, qpti->res_dvma);
1363 sbus_free_consistent(&qpti->sdev->ofdev.dev, 1364 dma_free_coherent(&qpti->sdev->ofdev.dev,
1364 QSIZE(QLOGICPTI_REQ_QUEUE_LEN), 1365 QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
1365 qpti->req_cpu, qpti->req_dvma); 1366 qpti->req_cpu, qpti->req_dvma);
1366#undef QSIZE 1367#undef QSIZE
1367 1368
1368fail_unmap_regs: 1369fail_unmap_regs:
@@ -1395,12 +1396,12 @@ static int __devexit qpti_sbus_remove(struct of_device *dev)
1395 free_irq(qpti->irq, qpti); 1396 free_irq(qpti->irq, qpti);
1396 1397
1397#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) 1398#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
1398 sbus_free_consistent(&qpti->sdev->ofdev.dev, 1399 dma_free_coherent(&qpti->sdev->ofdev.dev,
1399 QSIZE(RES_QUEUE_LEN), 1400 QSIZE(RES_QUEUE_LEN),
1400 qpti->res_cpu, qpti->res_dvma); 1401 qpti->res_cpu, qpti->res_dvma);
1401 sbus_free_consistent(&qpti->sdev->ofdev.dev, 1402 dma_free_coherent(&qpti->sdev->ofdev.dev,
1402 QSIZE(QLOGICPTI_REQ_QUEUE_LEN), 1403 QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
1403 qpti->req_cpu, qpti->req_dvma); 1404 qpti->req_cpu, qpti->req_dvma);
1404#undef QSIZE 1405#undef QSIZE
1405 1406
1406 sbus_iounmap(qpti->qregs, qpti->sdev->reg_addrs[0].reg_size); 1407 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 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/dma-mapping.h>
12 13
13#include <asm/irq.h> 14#include <asm/irq.h>
14#include <asm/io.h> 15#include <asm/io.h>
@@ -101,8 +102,9 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp)
101{ 102{
102 struct sbus_dev *sdev = esp->dev; 103 struct sbus_dev *sdev = esp->dev;
103 104
104 esp->command_block = sbus_alloc_consistent(&sdev->ofdev.dev, 16, 105 esp->command_block = dma_alloc_coherent(&sdev->ofdev.dev, 16,
105 &esp->command_block_dma); 106 &esp->command_block_dma,
107 GFP_ATOMIC);
106 if (!esp->command_block) 108 if (!esp->command_block)
107 return -ENOMEM; 109 return -ENOMEM;
108 return 0; 110 return 0;
@@ -225,7 +227,7 @@ static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf,
225{ 227{
226 struct sbus_dev *sdev = esp->dev; 228 struct sbus_dev *sdev = esp->dev;
227 229
228 return sbus_map_single(&sdev->ofdev.dev, buf, sz, dir); 230 return dma_map_single(&sdev->ofdev.dev, buf, sz, dir);
229} 231}
230 232
231static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, 233static 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,
233{ 235{
234 struct sbus_dev *sdev = esp->dev; 236 struct sbus_dev *sdev = esp->dev;
235 237
236 return sbus_map_sg(&sdev->ofdev.dev, sg, num_sg, dir); 238 return dma_map_sg(&sdev->ofdev.dev, sg, num_sg, dir);
237} 239}
238 240
239static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, 241static 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,
241{ 243{
242 struct sbus_dev *sdev = esp->dev; 244 struct sbus_dev *sdev = esp->dev;
243 245
244 sbus_unmap_single(&sdev->ofdev.dev, addr, sz, dir); 246 dma_unmap_single(&sdev->ofdev.dev, addr, sz, dir);
245} 247}
246 248
247static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, 249static 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,
249{ 251{
250 struct sbus_dev *sdev = esp->dev; 252 struct sbus_dev *sdev = esp->dev;
251 253
252 sbus_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir); 254 dma_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir);
253} 255}
254 256
255static int sbus_esp_irq_pending(struct esp *esp) 257static int sbus_esp_irq_pending(struct esp *esp)
@@ -558,9 +560,9 @@ static int __devinit esp_sbus_probe_one(struct device *dev,
558fail_free_irq: 560fail_free_irq:
559 free_irq(host->irq, esp); 561 free_irq(host->irq, esp);
560fail_unmap_command_block: 562fail_unmap_command_block:
561 sbus_free_consistent(&esp_dev->ofdev.dev, 16, 563 dma_free_coherent(&esp_dev->ofdev.dev, 16,
562 esp->command_block, 564 esp->command_block,
563 esp->command_block_dma); 565 esp->command_block_dma);
564fail_unmap_regs: 566fail_unmap_regs:
565 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE); 567 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
566fail_unlink: 568fail_unlink:
@@ -609,9 +611,9 @@ static int __devexit esp_sbus_remove(struct of_device *dev)
609 dma_write32(val & ~DMA_INT_ENAB, DMA_CSR); 611 dma_write32(val & ~DMA_INT_ENAB, DMA_CSR);
610 612
611 free_irq(irq, esp); 613 free_irq(irq, esp);
612 sbus_free_consistent(&sdev->ofdev.dev, 16, 614 dma_free_coherent(&sdev->ofdev.dev, 16,
613 esp->command_block, 615 esp->command_block,
614 esp->command_block_dma); 616 esp->command_block_dma);
615 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE); 617 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
616 of_iounmap(&dma_of->resource[0], esp->dma_regs, 618 of_iounmap(&dma_of->resource[0], esp->dma_regs,
617 resource_size(&dma_of->resource[0])); 619 resource_size(&dma_of->resource[0]));