]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/eata.c
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / drivers / scsi / eata.c
index b3f9de8f75955f69d7bfa9f0a69c0d22cd8432da..a83e9f150b97f4d0d798b5b2b1d6618c8c3dd2b4 100644 (file)
  *  the driver sets host->wish_block = 1 for all ISA boards.
  */
 
-#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
 #include <linux/ctype.h>
 #include <linux/spinlock.h>
+#include <linux/dma-mapping.h>
 #include <asm/byteorder.h>
 #include <asm/dma.h>
 #include <asm/io.h>
@@ -875,7 +875,7 @@ static unsigned long io_port[] = {
 /* But transfer orientation from the 16 bit data register is Little Endian */
 #define REG2H(x)   le16_to_cpu(x)
 
-static irqreturn_t do_interrupt_handler(int, void *, struct pt_regs *);
+static irqreturn_t do_interrupt_handler(int, void *);
 static void flush_dev(struct scsi_device *, unsigned long, struct hostdata *,
                      unsigned int);
 static int do_trace = 0;
@@ -1221,7 +1221,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
 
        /* Board detected, allocate its IRQ */
        if (request_irq(irq, do_interrupt_handler,
-                       SA_INTERRUPT | ((subversion == ESA) ? SA_SHIRQ : 0),
+                       IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0),
                        driver_name, (void *)&sha[j])) {
                printk("%s: unable to allocate IRQ %u, detaching.\n", name,
                       irq);
@@ -1426,7 +1426,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
 
        if (ha->pdev) {
                pci_set_master(ha->pdev);
-               if (pci_set_dma_mask(ha->pdev, 0xffffffff))
+               if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK))
                        printk("%s: warning, pci_set_dma_mask failed.\n",
                               ha->board_name);
        }
@@ -1609,8 +1609,9 @@ static int eata2x_detect(struct scsi_host_template *tpnt)
 
 static void map_dma(unsigned int i, struct hostdata *ha)
 {
-       unsigned int k, count, pci_dir;
-       struct scatterlist *sgpnt;
+       unsigned int k, pci_dir;
+       int count;
+       struct scatterlist *sg;
        struct mscp *cpp;
        struct scsi_cmnd *SCpnt;
 
@@ -1625,38 +1626,19 @@ static void map_dma(unsigned int i, struct hostdata *ha)
 
        cpp->sense_len = sizeof SCpnt->sense_buffer;
 
-       if (!SCpnt->use_sg) {
-
-               /* If we get here with PCI_DMA_NONE, pci_map_single triggers a BUG() */
-               if (!SCpnt->request_bufflen)
-                       pci_dir = PCI_DMA_BIDIRECTIONAL;
-
-               if (SCpnt->request_buffer)
-                       cpp->data_address = H2DEV(pci_map_single(ha->pdev,
-                                                                SCpnt->
-                                                                request_buffer,
-                                                                SCpnt->
-                                                                request_bufflen,
-                                                                pci_dir));
-
-               cpp->data_len = H2DEV(SCpnt->request_bufflen);
-               return;
-       }
-
-       sgpnt = (struct scatterlist *)SCpnt->request_buffer;
-       count = pci_map_sg(ha->pdev, sgpnt, SCpnt->use_sg, pci_dir);
-
-       for (k = 0; k < count; k++) {
-               cpp->sglist[k].address = H2DEV(sg_dma_address(&sgpnt[k]));
-               cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(&sgpnt[k]));
+       count = scsi_dma_map(SCpnt);
+       BUG_ON(count < 0);
+       scsi_for_each_sg(SCpnt, sg, count, k) {
+               cpp->sglist[k].address = H2DEV(sg_dma_address(sg));
+               cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg));
        }
 
        cpp->sg = 1;
        cpp->data_address = H2DEV(pci_map_single(ha->pdev, cpp->sglist,
-                                                SCpnt->use_sg *
+                                                scsi_sg_count(SCpnt) *
                                                 sizeof(struct sg_list),
                                                 pci_dir));
-       cpp->data_len = H2DEV((SCpnt->use_sg * sizeof(struct sg_list)));
+       cpp->data_len = H2DEV((scsi_sg_count(SCpnt) * sizeof(struct sg_list)));
 }
 
 static void unmap_dma(unsigned int i, struct hostdata *ha)
@@ -1673,9 +1655,7 @@ static void unmap_dma(unsigned int i, struct hostdata *ha)
                pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr),
                                 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
 
-       if (SCpnt->use_sg)
-               pci_unmap_sg(ha->pdev, SCpnt->request_buffer, SCpnt->use_sg,
-                            pci_dir);
+       scsi_dma_unmap(SCpnt);
 
        if (!DEV2H(cpp->data_len))
                pci_dir = PCI_DMA_BIDIRECTIONAL;
@@ -1700,9 +1680,9 @@ static void sync_dma(unsigned int i, struct hostdata *ha)
                                            DEV2H(cpp->sense_len),
                                            PCI_DMA_FROMDEVICE);
 
-       if (SCpnt->use_sg)
-               pci_dma_sync_sg_for_cpu(ha->pdev, SCpnt->request_buffer,
-                                       SCpnt->use_sg, pci_dir);
+       if (scsi_sg_count(SCpnt))
+               pci_dma_sync_sg_for_cpu(ha->pdev, scsi_sglist(SCpnt),
+                                       scsi_sg_count(SCpnt), pci_dir);
 
        if (!DEV2H(cpp->data_len))
                pci_dir = PCI_DMA_BIDIRECTIONAL;
@@ -2555,8 +2535,7 @@ static irqreturn_t ihdlr(int irq, struct Scsi_Host *shost)
        return IRQ_NONE;
 }
 
-static irqreturn_t do_interrupt_handler(int irq, void *shap,
-                                       struct pt_regs *regs)
+static irqreturn_t do_interrupt_handler(int irq, void *shap)
 {
        struct Scsi_Host *shost;
        unsigned int j;