ncr5380: Remove PSEUDO_DMA macro
authorFinn Thain <fthain@telegraphics.com.au>
Wed, 23 Mar 2016 10:10:15 +0000 (21:10 +1100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 11 Apr 2016 20:57:09 +0000 (16:57 -0400)
For those wrapper drivers which only implement Programmed IO, have
NCR5380_dma_xfer_len() evaluate to zero. That allows PDMA to be easily
disabled at run-time and so the PSEUDO_DMA macro is no longer needed.

Also remove the spin counters used for debugging pseudo DMA drivers.

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>
14 files changed:
drivers/scsi/NCR5380.c
drivers/scsi/NCR5380.h
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 69c73c36b9235163fa13d602403fe7f98391251f..fc86cde2d28e17256ee0de725be44877df09875f 100644 (file)
@@ -468,35 +468,10 @@ static void prepare_info(struct Scsi_Host *instance)
 #endif
 #ifdef PARITY
                 "PARITY "
-#endif
-#ifdef PSEUDO_DMA
-                "PSEUDO_DMA "
 #endif
                 "");
 }
 
-#ifdef PSEUDO_DMA
-static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
-       char *buffer, int length)
-{
-       struct NCR5380_hostdata *hostdata = shost_priv(instance);
-
-       hostdata->spin_max_r = 0;
-       hostdata->spin_max_w = 0;
-       return 0;
-}
-
-static int __maybe_unused NCR5380_show_info(struct seq_file *m,
-                                            struct Scsi_Host *instance)
-{
-       struct NCR5380_hostdata *hostdata = shost_priv(instance);
-
-       seq_printf(m, "Highwater I/O busy spin counts: write %d, read %d\n",
-               hostdata->spin_max_w, hostdata->spin_max_r);
-       return 0;
-}
-#endif
-
 /**
  * NCR5380_init - initialise an NCR5380
  * @instance: adapter to configure
@@ -1436,7 +1411,6 @@ timeout:
        return -1;
 }
 
-#if defined(PSEUDO_DMA)
 /*
  * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
  * unsigned char *phase, int *count, unsigned char **data)
@@ -1592,7 +1566,6 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
        *phase = NCR5380_read(STATUS_REG) & PHASE_MASK;
        return foo;
 }
-#endif /* PSEUDO_DMA */
 
 /*
  * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
@@ -1683,7 +1656,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                 * in an unconditional loop.
                                 */
 
-#if defined(PSEUDO_DMA)
                                transfersize = 0;
                                if (!cmd->device->borken)
                                        transfersize = NCR5380_dma_xfer_len(instance, cmd, phase);
@@ -1706,9 +1678,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                                /* XXX - need to source or sink data here, as appropriate */
                                        } else
                                                cmd->SCp.this_residual -= transfersize - len;
-                               } else
-#endif /* PSEUDO_DMA */
-                               {
+                               } else {
                                        /* Break up transfer into 3 ms chunks,
                                         * presuming 6 accesses per handshake.
                                         */
index 7b488a082462b9494ab593f6ca391ff4849e452d..8adf7377de4cc494bc57275ab39ebf0eac469061 100644 (file)
@@ -256,10 +256,6 @@ struct NCR5380_hostdata {
        struct work_struct main_task;
 #ifdef SUPPORT_TAGS
        struct tag_alloc TagAlloc[8][8];        /* 8 targets and 8 LUNs */
-#endif
-#ifdef PSEUDO_DMA
-       unsigned spin_max_r;
-       unsigned spin_max_w;
 #endif
        struct workqueue_struct *work_q;
        unsigned long accesses_per_ms;  /* chip register accesses per ms */
index 76b2d3364d9fceea4d78dfbb1a27a06b56a922c0..6e9de19fc3c2cf9e25a4f62dd6421ea2115bc433 100644 (file)
@@ -13,8 +13,6 @@
 
 #include <scsi/scsi_host.h>
 
-#define PSEUDO_DMA
-
 #define priv(host)                     ((struct NCR5380_hostdata *)(host)->hostdata)
 #define NCR5380_read(reg)              cumanascsi_read(instance, reg)
 #define NCR5380_write(reg, value)      cumanascsi_write(instance, reg, value)
index 8d8426535e6d19a6ff3548a22ba9f33fa4bb7d5e..63abd6b248a62d349203aa3b31d2e8389ae23da5 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <scsi/scsi_host.h>
 
-/*#define PSEUDO_DMA*/
 #define DONT_USE_INTR
 
 #define priv(host)                     ((struct NCR5380_hostdata *)(host)->hostdata)
@@ -24,7 +23,7 @@
 #define NCR5380_write(reg, value) \
        writeb(value, priv(instance)->base + ((reg) << 2))
 
-#define NCR5380_dma_xfer_len(instance, cmd, phase)     (cmd->transfersize)
+#define NCR5380_dma_xfer_len(instance, cmd, phase)     (0)
 
 #define NCR5380_queue_command          oakscsi_queue_command
 #define NCR5380_info                   oakscsi_info
index e9e96af96104ee3bd2330248791ef9dbdb40412f..929bc1b618f89b7addfe901b3e25196ba2882aa2 100644 (file)
 #define NCR5380_read(reg)              inb(instance->io_port + reg)
 #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_implementation_fields  /* none */
 
 #include "NCR5380.h"
index 30919f42759afcfa2de4697e6793266506cd1963..30d3e73f70ca6a6539650e9f687914852c1d1f0b 100644 (file)
@@ -1,4 +1,3 @@
-#define PSEUDO_DMA
 #define DONT_USE_INTR
 
 /*
@@ -352,8 +351,6 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
        while (!(NCR5380_read(DTC_CONTROL_REG) & D_CR_ACCESS))
                ++i;
        rtrc(0);
-       if (i > hostdata->spin_max_r)
-               hostdata->spin_max_r = i;
        return (0);
 }
 
@@ -400,8 +397,6 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
        rtrc(7);
        /* Check for parity error here. fixme. */
        rtrc(0);
-       if (i > hostdata->spin_max_w)
-               hostdata->spin_max_w = i;
        return (0);
 }
 
@@ -440,8 +435,6 @@ static struct scsi_host_template driver_template = {
        .detect                 = dtc_detect,
        .release                = dtc_release,
        .proc_name              = "dtc3x80",
-       .show_info              = dtc_show_info,
-       .write_info             = dtc_write_info,
        .info                   = dtc_info,
        .queuecommand           = dtc_queue_command,
        .eh_abort_handler       = dtc_abort,
index 56732cba8abad0110f04532239d62fa1b8163c91..1bc638730dda9fca0b18f85426390287b79428b3 100644 (file)
@@ -27,8 +27,6 @@
 #define NCR5380_abort                  dtc_abort
 #define NCR5380_bus_reset              dtc_bus_reset
 #define NCR5380_info                   dtc_info
-#define NCR5380_show_info              dtc_show_info 
-#define NCR5380_write_info             dtc_write_info 
 
 /* 15 12 11 10
    1001 1100 0000 0000 */
index aaeb6b6b4b16f8ee8c0619a11605d6dd8d052bf4..fc7bcbcf3f43e83c97d9b9dbd5cea46080a42c21 100644 (file)
@@ -57,7 +57,6 @@
  */
 
 #define AUTOPROBE_IRQ
-#define PSEUDO_DMA
 
 #include <asm/io.h>
 #include <linux/blkdev.h>
index 3fb0d85294290818a73d17038952bebaed8b897a..a231a8c52d87874d312657ffa803fa1d67436501 100644 (file)
@@ -70,7 +70,6 @@
 #define NCR5380_pread generic_NCR5380_pread
 #define NCR5380_pwrite generic_NCR5380_pwrite
 #define NCR5380_info generic_NCR5380_info
-#define NCR5380_show_info generic_NCR5380_show_info
 
 #define BOARD_NCR5380  0
 #define BOARD_NCR53C400        1
index a8f5433b515eb4b4bcac684af572798965bfe5ad..1e0d07ac83a1222518afc541becfb363a5dac07b 100644 (file)
@@ -28,8 +28,6 @@
 
 /* Definitions for the core NCR5380 driver. */
 
-#define PSEUDO_DMA
-
 #define NCR5380_implementation_fields   unsigned char *pdma_base
 
 #define NCR5380_read(reg)               macscsi_read(instance, reg)
@@ -46,8 +44,6 @@
 #define NCR5380_abort                   macscsi_abort
 #define NCR5380_bus_reset               macscsi_bus_reset
 #define NCR5380_info                    macscsi_info
-#define NCR5380_show_info               macscsi_show_info
-#define NCR5380_write_info              macscsi_write_info
 
 #include "NCR5380.h"
 
@@ -111,7 +107,6 @@ static int __init mac_scsi_setup(char *str)
 __setup("mac5380=", mac_scsi_setup);
 #endif /* !MODULE */
 
-#ifdef PSEUDO_DMA
 /* 
    Pseudo-DMA: (Ove Edlund)
    The code attempts to catch bus errors that occur if one for example
@@ -303,7 +298,6 @@ static int macscsi_pwrite(struct Scsi_Host *instance,
 
        return 0;
 }
-#endif
 
 static int macscsi_dma_xfer_len(struct Scsi_Host *instance,
                                 struct scsi_cmnd *cmd)
@@ -324,8 +318,6 @@ static int macscsi_dma_xfer_len(struct Scsi_Host *instance,
 static struct scsi_host_template mac_scsi_template = {
        .module                 = THIS_MODULE,
        .proc_name              = DRV_MODULE_NAME,
-       .show_info              = macscsi_show_info,
-       .write_info             = macscsi_write_info,
        .name                   = "Macintosh NCR5380 SCSI",
        .info                   = macscsi_info,
        .queuecommand           = macscsi_queue_command,
@@ -351,9 +343,7 @@ static int __init mac_scsi_probe(struct platform_device *pdev)
        if (!pio_mem)
                return -ENODEV;
 
-#ifdef PSEUDO_DMA
        pdma_mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-#endif
 
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
index 7589fea01186765c46b0d33306fe85a78aa9f9ee..9c06eb637417188f98a9019645b00db33c24bf66 100644 (file)
@@ -1,5 +1,3 @@
-#define PSEUDO_DMA
-
 /*
  * This driver adapted from Drew Eckhardt's Trantor T128 driver
  *
@@ -479,7 +477,6 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
        P_DATA_REG_OFFSET);
     register int i = len;
     int ii = 0;
-    struct NCR5380_hostdata *hostdata = shost_priv(instance);
 
     while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) )
         ++ii;
@@ -492,8 +489,6 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
            instance->host_no);
        return -1;
     }
-    if (ii > hostdata->spin_max_r)
-        hostdata->spin_max_r = ii;
     return 0;
 }
 
@@ -516,7 +511,6 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
     register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET);
     register int i = len;
     int ii = 0;
-    struct NCR5380_hostdata *hostdata = shost_priv(instance);
 
     while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) )
         ++ii;
@@ -529,8 +523,6 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
            instance->host_no);
        return -1;
     }
-    if (ii > hostdata->spin_max_w)
-        hostdata->spin_max_w = ii;
     return 0;
 }
 
@@ -550,8 +542,6 @@ static struct scsi_host_template driver_template = {
        .detect                 = pas16_detect,
        .release                = pas16_release,
        .proc_name              = "pas16",
-       .show_info              = pas16_show_info,
-       .write_info             = pas16_write_info,
        .info                   = pas16_info,
        .queuecommand           = pas16_queue_command,
        .eh_abort_handler       = pas16_abort,
index d375277172258391ed84ff1627c060f007e1f188..1695885ce40c9b7cdbe72d09d39d7f2633c761bc 100644 (file)
 #define NCR5380_abort pas16_abort
 #define NCR5380_bus_reset pas16_bus_reset
 #define NCR5380_info pas16_info
-#define NCR5380_show_info pas16_show_info
-#define NCR5380_write_info pas16_write_info
 
 /* 15 14 12 10 7 5 3 
    1101 0100 1010 1000 */
index 6cb8bdd2f4e6de3f597cf4981054c4cf0da5b0c5..ce2395f3fae9a75592aef7b1e5ce3b9d75d57df8 100644 (file)
@@ -1,5 +1,3 @@
-#define PSEUDO_DMA
-
 /*
  * Trantor T128/T128F/T228 driver
  *     Note : architecturally, the T100 and T130 are different and won't 
@@ -394,8 +392,6 @@ static struct scsi_host_template driver_template = {
        .detect                 = t128_detect,
        .release                = t128_release,
        .proc_name              = "t128",
-       .show_info              = t128_show_info,
-       .write_info             = t128_write_info,
        .info                   = t128_info,
        .queuecommand           = t128_queue_command,
        .eh_abort_handler       = t128_abort,
index dd16d85497e168680a5d3467f24baf0cbfe1e05a..c369b50de746717b9c93cc45579ad4a7b6817d7e 100644 (file)
@@ -83,8 +83,6 @@
 #define NCR5380_abort t128_abort
 #define NCR5380_bus_reset t128_bus_reset
 #define NCR5380_info t128_info
-#define NCR5380_show_info t128_show_info
-#define NCR5380_write_info t128_write_info
 
 /* 15 14 12 10 7 5 3
    1101 0100 1010 1000 */