]> git.karo-electronics.de Git - linux-beck.git/commitdiff
m68k/atari - atari_scsi: change abort/reset return codes
authorMichael Schmitz <schmitzmic@gmail.com>
Fri, 2 May 2014 08:43:01 +0000 (20:43 +1200)
committerChristoph Hellwig <hch@lst.de>
Mon, 19 May 2014 17:12:24 +0000 (19:12 +0200)
[Resend of earlier patch - added equivalent changes to sun3 NCR5380 code]

The abort/reset lowlevel return codes had changed with the new
error SCSI handling - update Atari and Sun3 NCR5380 drivers to reflect this.

Change reset handling for Atari to clear queues only, do not attempt
to call done() on each command aborted by the reset. The EH code
should do that for us. Queues _must_ be cleared, otherwise
atari_scsi_bus_reset will not release the ST-DMA lock, deadlocking
further error recovery.

Update the Sun3 NCR5380 driver as well - the Sun3 driver was
derived from the Atari one. Kudos to Finn Thain for the Sun3 part
and cleaning up the header files. After the header cleanup, the
initio.h include (!) can be dropped from sun3_scsi.h now.

Signed-off-by: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Sam Creasey <sammy@sammy.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: James E.J. Bottomley <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/atari_NCR5380.c
drivers/scsi/atari_scsi.c
drivers/scsi/atari_scsi.h
drivers/scsi/sun3_NCR5380.c
drivers/scsi/sun3_scsi.c

index 0f3cdbc80ba63a47d59c2e7d07a2cbf3ed67c8a9..e4aaf9a51de3ed6f98f992648ce86b0137e2d35a 100644 (file)
@@ -2683,11 +2683,11 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
                        local_irq_restore(flags);
                        cmd->scsi_done(cmd);
                        falcon_release_lock_if_possible(hostdata);
-                       return SCSI_ABORT_SUCCESS;
+                       return SUCCESS;
                } else {
 /*                     local_irq_restore(flags); */
                        printk("scsi%d: abort of connected command failed!\n", HOSTNO);
-                       return SCSI_ABORT_ERROR;
+                       return FAILED;
                }
        }
 #endif
@@ -2711,7 +2711,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
                         * yet... */
                        tmp->scsi_done(tmp);
                        falcon_release_lock_if_possible(hostdata);
-                       return SCSI_ABORT_SUCCESS;
+                       return SUCCESS;
                }
        }
 
@@ -2729,7 +2729,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
        if (hostdata->connected) {
                local_irq_restore(flags);
                ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
-               return SCSI_ABORT_SNOOZE;
+               return FAILED;
        }
 
        /*
@@ -2764,7 +2764,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
                        ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
 
                        if (NCR5380_select(instance, cmd, (int)cmd->tag))
-                               return SCSI_ABORT_BUSY;
+                               return FAILED;
 
                        ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
 
@@ -2791,7 +2791,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
                                        local_irq_restore(flags);
                                        tmp->scsi_done(tmp);
                                        falcon_release_lock_if_possible(hostdata);
-                                       return SCSI_ABORT_SUCCESS;
+                                       return SUCCESS;
                                }
                        }
                }
@@ -2816,7 +2816,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
         */
        falcon_release_lock_if_possible(hostdata);
 
-       return SCSI_ABORT_NOT_RUNNING;
+       return FAILED;
 }
 
 
@@ -2825,7 +2825,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  *
  * Purpose : reset the SCSI bus.
  *
- * Returns : SCSI_RESET_WAKEUP
+ * Returns : SUCCESS or FAILURE
  *
  */
 
@@ -2834,7 +2834,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
        SETUP_HOSTDATA(cmd->device->host);
        int i;
        unsigned long flags;
-#if 1
+#if defined(RESET_RUN_DONE)
        Scsi_Cmnd *connected, *disconnected_queue;
 #endif
 
@@ -2859,7 +2859,14 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
         * through anymore ... */
        (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
 
-#if 1  /* XXX Should now be done by midlevel code, but it's broken XXX */
+       /* MSch 20140115 - looking at the generic NCR5380 driver, all of this
+        * should go.
+        * Catch-22: if we don't clear all queues, the SCSI driver lock will
+        * not be reset by atari_scsi_reset()!
+        */
+
+#if defined(RESET_RUN_DONE)
+       /* XXX Should now be done by midlevel code, but it's broken XXX */
        /* XXX see below                                            XXX */
 
        /* MSch: old-style reset: actually abort all command processing here */
@@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
         * the midlevel code that the reset was SUCCESSFUL, and there is no
         * need to 'wake up' the commands by a request_sense
         */
-       return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
+       return SUCCESS;
 #else /* 1 */
 
        /* MSch: new-style reset handling: let the mid-level do what it can */
@@ -2963,6 +2970,6 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
        local_irq_restore(flags);
 
        /* we did no complete reset of all commands, so a wakeup is required */
-       return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
+       return SUCCESS;
 #endif /* 1 */
 }
index 296c936cc03cc43397ba4905d53ac1fd7b050f89..4ae0c1a29598e1bde7871036c986c8a160fd8338 100644 (file)
@@ -827,7 +827,7 @@ static int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
        } else {
                atari_turnon_irq(IRQ_MFP_FSCSI);
        }
-       if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS)
+       if (rv == SUCCESS)
                falcon_release_lock_if_possible(hostdata);
 
        return rv;
index 11c624bb122dcd47078ac74ac4fd6eafbef9bbb6..ae559f4ea0b4905db4654db62025ace02a151035 100644 (file)
 #define        NCR5380_dma_xfer_len(i,cmd,phase) \
        atari_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
 
-/* former generic SCSI error handling stuff */
-
-#define SCSI_ABORT_SNOOZE 0
-#define SCSI_ABORT_SUCCESS 1
-#define SCSI_ABORT_PENDING 2
-#define SCSI_ABORT_BUSY 3
-#define SCSI_ABORT_NOT_RUNNING 4
-#define SCSI_ABORT_ERROR 5
-
-#define SCSI_RESET_SNOOZE 0
-#define SCSI_RESET_PUNT 1
-#define SCSI_RESET_SUCCESS 2
-#define SCSI_RESET_PENDING 3
-#define SCSI_RESET_WAKEUP 4
-#define SCSI_RESET_NOT_RUNNING 5
-#define SCSI_RESET_ERROR 6
-
-#define SCSI_RESET_SYNCHRONOUS         0x01
-#define SCSI_RESET_ASYNCHRONOUS                0x02
-#define SCSI_RESET_SUGGEST_BUS_RESET   0x04
-#define SCSI_RESET_SUGGEST_HOST_RESET  0x08
-
-#define SCSI_RESET_BUS_RESET 0x100
-#define SCSI_RESET_HOST_RESET 0x200
-#define SCSI_RESET_ACTION   0xff
-
 /* Debugging printk definitions:
  *
  *  ARB  -> arbitration
index 636bbe0ea84cad96705dce323e7a03a0c8859f36..72550bd38efdb46626c3f06f0f9a406c21355db3 100644 (file)
@@ -2664,11 +2664,11 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
 #endif
          local_irq_restore(flags);
          cmd->scsi_done(cmd);
-         return SCSI_ABORT_SUCCESS;
+         return SUCCESS;
        } else {
 /*       local_irq_restore(flags); */
          printk("scsi%d: abort of connected command failed!\n", HOSTNO);
-         return SCSI_ABORT_ERROR;
+         return FAILED;
        } 
    }
 #endif
@@ -2691,7 +2691,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
            /* Tagged queuing note: no tag to free here, hasn't been assigned
             * yet... */
            tmp->scsi_done(tmp);
-           return SCSI_ABORT_SUCCESS;
+           return SUCCESS;
        }
 
 /* 
@@ -2708,7 +2708,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
     if (hostdata->connected) {
        local_irq_restore(flags);
        ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
-        return SCSI_ABORT_SNOOZE;
+        return FAILED;
     }
 
 /*
@@ -2743,7 +2743,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
            ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
   
             if (NCR5380_select (instance, cmd, (int) cmd->tag)) 
-               return SCSI_ABORT_BUSY;
+               return FAILED;
 
            ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
 
@@ -2769,7 +2769,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
 #endif
                    local_irq_restore(flags);
                    tmp->scsi_done(tmp);
-                   return SCSI_ABORT_SUCCESS;
+                   return SUCCESS;
                }
        }
 
@@ -2786,7 +2786,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
     local_irq_restore(flags);
     printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully before abortion\n", HOSTNO); 
 
-    return SCSI_ABORT_NOT_RUNNING;
+    return FAILED;
 }
 
 
@@ -2795,7 +2795,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
  * 
  * Purpose : reset the SCSI bus.
  *
- * Returns : SCSI_RESET_WAKEUP
+ * Returns : SUCCESS or FAILURE
  *
  */ 
 
@@ -2804,7 +2804,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
     SETUP_HOSTDATA(cmd->device->host);
     int           i;
     unsigned long flags;
-#if 1
+#if defined(RESET_RUN_DONE)
     struct scsi_cmnd *connected, *disconnected_queue;
 #endif
 
@@ -2826,8 +2826,15 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
      * through anymore ... */
     (void)NCR5380_read( RESET_PARITY_INTERRUPT_REG );
 
-#if 1 /* XXX Should now be done by midlevel code, but it's broken XXX */
-      /* XXX see below                                            XXX */
+       /* MSch 20140115 - looking at the generic NCR5380 driver, all of this
+        * should go.
+        * Catch-22: if we don't clear all queues, the SCSI driver lock will
+        * not be released by atari_scsi_reset()!
+        */
+
+#if defined(RESET_RUN_DONE)
+       /* XXX Should now be done by midlevel code, but it's broken XXX */
+       /* XXX see below                                            XXX */
 
     /* MSch: old-style reset: actually abort all command processing here */
 
@@ -2876,7 +2883,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
      * the midlevel code that the reset was SUCCESSFUL, and there is no 
      * need to 'wake up' the commands by a request_sense
      */
-    return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
+    return SUCCESS;
 #else /* 1 */
 
     /* MSch: new-style reset handling: let the mid-level do what it can */
@@ -2924,7 +2931,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
     local_irq_restore(flags);
 
     /* we did no complete reset of all commands, so a wakeup is required */
-    return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
+    return SUCCESS;
 #endif /* 1 */
 }
 
index e2c009b033cec84f6ca3b1ceabb2e9d1798a4acb..243c228a6d8c0af6ecfafb72cbc2c2b9141a53e1 100644 (file)
@@ -79,7 +79,6 @@
 #define REAL_DMA
 
 #include "scsi.h"
-#include "initio.h"
 #include <scsi/scsi_host.h>
 #include "sun3_scsi.h"
 
@@ -123,6 +122,8 @@ module_param(setup_hostid, int, 0);
 
 static struct scsi_cmnd *sun3_dma_setup_done = NULL;
 
+#define        RESET_RUN_DONE
+
 #define        AFTER_RESET_DELAY       (HZ/2)
 
 /* ms to wait after hitting dma regs */