]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ncr5380: Use DMA hooks for PDMA
authorFinn Thain <fthain@telegraphics.com.au>
Wed, 23 Mar 2016 10:10:17 +0000 (21:10 +1100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 11 Apr 2016 20:57:09 +0000 (16:57 -0400)
Those wrapper drivers which use DMA define the REAL_DMA macro and
those which use pseudo DMA define PSEUDO_DMA. These macros need to be
removed for a number of reasons, not least of which is to have drivers
share more code.

Redefine the PDMA send and receive hooks as DMA setup hooks, so that the
DMA code can be shared by all 5380 wrapper drivers. This will help to
reunify the forked core driver.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
13 files changed:
drivers/scsi/NCR5380.c
drivers/scsi/arm/cumana_1.c
drivers/scsi/arm/oak.c
drivers/scsi/dmx3191d.c
drivers/scsi/dtc.c
drivers/scsi/dtc.h
drivers/scsi/g_NCR5380.c
drivers/scsi/g_NCR5380.h
drivers/scsi/mac_scsi.c
drivers/scsi/pas16.c
drivers/scsi/pas16.h
drivers/scsi/t128.c
drivers/scsi/t128.h

index 014a01f6875fc5bd539b87edacf6fec3e868aa94..b3e5b6b57d836247abde946782adc8dee574c347 100644 (file)
  * specific implementation of the NCR5380
  *
  * Either real DMA *or* pseudo DMA may be implemented
- * Note that the DMA setup functions should return the number of bytes
- * that they were able to program the controller for.
  *
  * NCR5380_dma_write_setup(instance, src, count) - initialize
  * NCR5380_dma_read_setup(instance, dst, count) - initialize
  * NCR5380_dma_residual(instance); - residual count
  *
- * PSEUDO functions :
- * NCR5380_pwrite(instance, src, count)
- * NCR5380_pread(instance, dst, count);
- *
  * The generic driver is initialized by calling NCR5380_init(instance),
  * after setting the appropriate host specific fields and ID.  If the
  * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance,
@@ -1511,7 +1505,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
  */
 
        if (p & SR_IO) {
-               foo = NCR5380_pread(instance, d,
+               foo = NCR5380_dma_recv_setup(instance, d,
                        hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c);
                if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) {
                        /*
@@ -1542,7 +1536,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
                        d[c - 1] = NCR5380_read(INPUT_DATA_REG);
                }
        } else {
-               foo = NCR5380_pwrite(instance, d, c);
+               foo = NCR5380_dma_send_setup(instance, d, c);
                if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) {
                        /*
                         * Wait for the last byte to be sent.  If REQ is being asserted for
index 6e9de19fc3c2cf9e25a4f62dd6421ea2115bc433..7bcb66893059a720920f69bde3080a9763b5da5d 100644 (file)
@@ -18,6 +18,8 @@
 #define NCR5380_write(reg, value)      cumanascsi_write(instance, reg, value)
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase)     (cmd->transfersize)
+#define NCR5380_dma_recv_setup         cumanascsi_pread
+#define NCR5380_dma_send_setup         cumanascsi_pwrite
 
 #define NCR5380_intr                   cumanascsi_intr
 #define NCR5380_queue_command          cumanascsi_queue_command
@@ -39,8 +41,8 @@ void cumanascsi_setup(char *str, int *ints)
 #define L(v)   (((v)<<16)|((v) & 0x0000ffff))
 #define H(v)   (((v)>>16)|((v) & 0xffff0000))
 
-static inline int
-NCR5380_pwrite(struct Scsi_Host *host, unsigned char *addr, int len)
+static inline int cumanascsi_pwrite(struct Scsi_Host *host,
+                                    unsigned char *addr, int len)
 {
   unsigned long *laddr;
   void __iomem *dma = priv(host)->dma + 0x2000;
@@ -102,8 +104,8 @@ NCR5380_pwrite(struct Scsi_Host *host, unsigned char *addr, int len)
   return len;
 }
 
-static inline int
-NCR5380_pread(struct Scsi_Host *host, unsigned char *addr, int len)
+static inline int cumanascsi_pread(struct Scsi_Host *host,
+                                   unsigned char *addr, int len)
 {
   unsigned long *laddr;
   void __iomem *dma = priv(host)->dma + 0x2000;
index 63abd6b248a62d349203aa3b31d2e8389ae23da5..5d6e0e590638494dbea04d15812da30d403502e7 100644 (file)
@@ -24,6 +24,8 @@
        writeb(value, priv(instance)->base + ((reg) << 2))
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase)     (0)
+#define NCR5380_dma_recv_setup         oakscsi_pread
+#define NCR5380_dma_send_setup         oakscsi_pwrite
 
 #define NCR5380_queue_command          oakscsi_queue_command
 #define NCR5380_info                   oakscsi_info
@@ -39,8 +41,8 @@
 #define STAT   ((128 + 16) << 2)
 #define DATA   ((128 + 8) << 2)
 
-static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *addr,
-              int len)
+static inline int oakscsi_pwrite(struct Scsi_Host *instance,
+                                 unsigned char *addr, int len)
 {
   void __iomem *base = priv(instance)->base;
 
@@ -54,8 +56,8 @@ printk("writing %p len %d\n",addr, len);
   }
 }
 
-static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *addr,
-              int len)
+static inline int oakscsi_pread(struct Scsi_Host *instance,
+                                unsigned char *addr, int len)
 {
   void __iomem *base = priv(instance)->base;
 printk("reading %p len %d\n", addr, len);
index 929bc1b618f89b7addfe901b3e25196ba2882aa2..4b58fa0c16fe7c91238a77d0041855941b5208fe 100644 (file)
@@ -40,8 +40,8 @@
 #define NCR5380_write(reg, value)      outb(value, instance->io_port + reg)
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase)     (0)
-#define NCR5380_pread(instance, dst, len)              (0)
-#define NCR5380_pwrite(instance, src, len)             (0)
+#define NCR5380_dma_recv_setup(instance, dst, len)     (0)
+#define NCR5380_dma_send_setup(instance, src, len)     (0)
 
 #define NCR5380_implementation_fields  /* none */
 
index 30d3e73f70ca6a6539650e9f687914852c1d1f0b..df17904bbe1244014dff9ebaee4c223fb06f36e6 100644 (file)
@@ -322,7 +322,8 @@ static int dtc_biosparam(struct scsi_device *sdev, struct block_device *dev,
  *     timeout.
 */
 
-static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
+static inline int dtc_pread(struct Scsi_Host *instance,
+                            unsigned char *dst, int len)
 {
        unsigned char *d = dst;
        int i;                  /* For counting time spent in the poll-loop */
@@ -367,7 +368,8 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
  *     timeout.
 */
 
-static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
+static inline int dtc_pwrite(struct Scsi_Host *instance,
+                             unsigned char *src, int len)
 {
        int i;
        struct NCR5380_hostdata *hostdata = shost_priv(instance);
index 718f95adcec6fb3e82e88c6fe68f6413e43b41ce..65af89e4340cad753620076cfe47cdf2b16f2543 100644 (file)
@@ -21,6 +21,8 @@
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase) \
         dtc_dma_xfer_len(cmd)
+#define NCR5380_dma_recv_setup         dtc_pread
+#define NCR5380_dma_send_setup         dtc_pwrite
 
 #define NCR5380_intr                   dtc_intr
 #define NCR5380_queue_command          dtc_queue_command
index fc7bcbcf3f43e83c97d9b9dbd5cea46080a42c21..f8c00c96a8377edbe31b8b668a4afff3cb6ba7f7 100644 (file)
@@ -551,7 +551,7 @@ static int generic_NCR5380_release_resources(struct Scsi_Host *instance)
 }
 
 /**
- *     NCR5380_pread           -       pseudo DMA read
+ *     generic_NCR5380_pread - pseudo DMA read
  *     @instance: adapter to read from
  *     @dst: buffer to read into
  *     @len: buffer length
@@ -560,7 +560,8 @@ static int generic_NCR5380_release_resources(struct Scsi_Host *instance)
  *     controller
  */
  
-static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
+static inline int generic_NCR5380_pread(struct Scsi_Host *instance,
+                                        unsigned char *dst, int len)
 {
        struct NCR5380_hostdata *hostdata = shost_priv(instance);
        int blocks = len / 128;
@@ -628,7 +629,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
 }
 
 /**
- *     NCR5380_write           -       pseudo DMA write
+ *     generic_NCR5380_pwrite - pseudo DMA write
  *     @instance: adapter to read from
  *     @dst: buffer to read into
  *     @len: buffer length
@@ -637,7 +638,8 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
  *     controller
  */
 
-static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
+static inline int generic_NCR5380_pwrite(struct Scsi_Host *instance,
+                                         unsigned char *src, int len)
 {
        struct NCR5380_hostdata *hostdata = shost_priv(instance);
        int blocks = len / 128;
index 637740f4c6c799c2c69929b327a5fac9f81c6ce7..7f43087055321bc9e24bb5041038305f73807743 100644 (file)
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase) \
         generic_NCR5380_dma_xfer_len(instance, cmd)
+#define NCR5380_dma_recv_setup         generic_NCR5380_pread
+#define NCR5380_dma_send_setup         generic_NCR5380_pwrite
 
 #define NCR5380_intr generic_NCR5380_intr
 #define NCR5380_queue_command generic_NCR5380_queue_command
 #define NCR5380_abort generic_NCR5380_abort
 #define NCR5380_bus_reset generic_NCR5380_bus_reset
-#define NCR5380_pread generic_NCR5380_pread
-#define NCR5380_pwrite generic_NCR5380_pwrite
 #define NCR5380_info generic_NCR5380_info
 
 #define NCR5380_io_delay(x)            udelay(x)
index 1e0d07ac83a1222518afc541becfb363a5dac07b..99b7bbc3dd94e030f024abd12ad869debbc31cb9 100644 (file)
 #define NCR5380_read(reg)               macscsi_read(instance, reg)
 #define NCR5380_write(reg, value)       macscsi_write(instance, reg, value)
 
-#define NCR5380_pread                   macscsi_pread
-#define NCR5380_pwrite                  macscsi_pwrite
-
 #define NCR5380_dma_xfer_len(instance, cmd, phase) \
         macscsi_dma_xfer_len(instance, cmd)
+#define NCR5380_dma_recv_setup          macscsi_pread
+#define NCR5380_dma_send_setup          macscsi_pwrite
 
 #define NCR5380_intr                    macscsi_intr
 #define NCR5380_queue_command           macscsi_queue_command
index 9c06eb637417188f98a9019645b00db33c24bf66..c8fd2230c792f6ed1a6cb4014371b210968acb66 100644 (file)
@@ -458,7 +458,7 @@ static int pas16_biosparam(struct scsi_device *sdev, struct block_device *dev,
 }
 
 /*
- * Function : int NCR5380_pread (struct Scsi_Host *instance, 
+ * Function : int pas16_pread (struct Scsi_Host *instance,
  *     unsigned char *dst, int len)
  *
  * Purpose : Fast 5380 pseudo-dma read function, transfers len bytes to 
@@ -470,8 +470,9 @@ static int pas16_biosparam(struct scsi_device *sdev, struct block_device *dev,
  *     timeout.
  */
 
-static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
-    int len) {
+static inline int pas16_pread(struct Scsi_Host *instance,
+                              unsigned char *dst, int len)
+{
     register unsigned char  *d = dst;
     register unsigned short reg = (unsigned short) (instance->io_port + 
        P_DATA_REG_OFFSET);
@@ -493,7 +494,7 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
 }
 
 /*
- * Function : int NCR5380_pwrite (struct Scsi_Host *instance, 
+ * Function : int pas16_pwrite (struct Scsi_Host *instance,
  *     unsigned char *src, int len)
  *
  * Purpose : Fast 5380 pseudo-dma write function, transfers len bytes from
@@ -505,8 +506,9 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
  *     timeout.
  */
 
-static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src,
-    int len) {
+static inline int pas16_pwrite(struct Scsi_Host *instance,
+                               unsigned char *src, int len)
+{
     register unsigned char *s = src;
     register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET);
     register int i = len;
index 1695885ce40c9b7cdbe72d09d39d7f2633c761bc..f56f38796bcd7829fa50399656b0432f7f5a0cf3 100644 (file)
 #define NCR5380_write(reg, value) ( outb((value),PAS16_io_port(reg)) )
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase)     (cmd->transfersize)
+#define NCR5380_dma_recv_setup         pas16_pread
+#define NCR5380_dma_send_setup         pas16_pwrite
 
 #define NCR5380_intr pas16_intr
 #define NCR5380_queue_command pas16_queue_command
index ce2395f3fae9a75592aef7b1e5ce3b9d75d57df8..6cc3da8d1d69c3fe5f68e189359160c8d78781a7 100644 (file)
@@ -292,7 +292,7 @@ static int t128_biosparam(struct scsi_device *sdev, struct block_device *bdev,
 }
 
 /*
- * Function : int NCR5380_pread (struct Scsi_Host *instance, 
+ * Function : int t128_pread (struct Scsi_Host *instance,
  *     unsigned char *dst, int len)
  *
  * Purpose : Fast 5380 pseudo-dma read function, transfers len bytes to 
@@ -304,8 +304,8 @@ static int t128_biosparam(struct scsi_device *sdev, struct block_device *bdev,
  *     timeout.
  */
 
-static inline int
-NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
+static inline int t128_pread(struct Scsi_Host *instance,
+                             unsigned char *dst, int len)
 {
        struct NCR5380_hostdata *hostdata = shost_priv(instance);
        void __iomem *reg, *base = hostdata->base;
@@ -338,7 +338,7 @@ NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
 }
 
 /*
- * Function : int NCR5380_pwrite (struct Scsi_Host *instance, 
+ * Function : int t128_pwrite (struct Scsi_Host *instance,
  *     unsigned char *src, int len)
  *
  * Purpose : Fast 5380 pseudo-dma write function, transfers len bytes from
@@ -350,8 +350,8 @@ NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
  *     timeout.
  */
 
-static inline int
-NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
+static inline int t128_pwrite(struct Scsi_Host *instance,
+                              unsigned char *src, int len)
 {
        struct NCR5380_hostdata *hostdata = shost_priv(instance);
        void __iomem *reg, *base = hostdata->base;
index 4caea9d62ac4dea27bdcf65f2c01ec335529655c..b6fe70f0aa4b32246f3926dadb285e34dc4c5f19 100644 (file)
@@ -77,6 +77,8 @@
 #define NCR5380_write(reg, value) writeb((value),(T128_address(reg)))
 
 #define NCR5380_dma_xfer_len(instance, cmd, phase)     (cmd->transfersize)
+#define NCR5380_dma_recv_setup         t128_pread
+#define NCR5380_dma_send_setup         t128_pwrite
 
 #define NCR5380_intr t128_intr
 #define NCR5380_queue_command t128_queue_command