Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-04-11 Thread Sam Creasey
Acked-by: Sam Creasey sa...@sammy.net

On Thu, Mar 13, 2014 at 01:30:15AM +1100, Finn Thain wrote:
 
 This is a larger version of Michael's patch. It takes care of the header 
 files and comments and it addresses sun3_NCR5380 as well as atari_NCR5380. 
 This means that the initio.h include (!) can be dropped from sun3_scsi.h.
 
 Signed-off-by: Finn Thain fth...@telegraphics.com.au
 
 ---
 
 This version defines RESET_RUN_DONE in sun3_scsi.c, to avoid changing 
 driver behaviour whilst trying to keep sun3_NCR5380.c in sync with 
 atari_NCR5380.c (from which it was originally copied).
 
 
 Index: linux-m68k/drivers/scsi/atari_NCR5380.c
 ===
 --- linux-m68k.orig/drivers/scsi/atari_NCR5380.c  2014-03-13 
 01:12:33.0 +1100
 +++ linux-m68k/drivers/scsi/atari_NCR5380.c   2014-03-13 01:13:55.0 
 +1100
 @@ -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 *
   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 *
* 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 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 belowXXX */
  
   /* MSch: old-style reset: actually abort all command processing here */
 @@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
* 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 *
   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 */
  }
 

Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-03-12 Thread Michael Schmitz

Finn,

nothings' been merged yet, still pending review from the SCSI team. 
Comments below.




This is a larger version of Michael's patch. It takes care of the 
header
files and comments and it addresses sun3_NCR5380 as well as 
atari_NCR5380.
This means that the initio.h include (!) can be dropped from 
sun3_scsi.h.


Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

Michael, I'm assuming that your patch hasn't been merged already (I 
didn't
find it in any of the likely repos). Please go ahead and add your 
sign-off
on this version if it is satisfactory. I didn't test this patch: I 
presume
that sun3_NCR5380 would need the same abort/reset fixes that 
atari_NCR5380

needed...


diff --git a/drivers/scsi/atari_NCR5380.c 
b/drivers/scsi/atari_NCR5380.c

index 0f3cdbc..e4aaf9a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -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()!


Bugger - typo of mine, meant to say 'released' not 'reset'.


+*/
+
+#if defined(RESET_RUN_DONE)
+   /* XXX Should now be done by midlevel code, but it's broken XXX */
/* XXX see belowXXX */

 	/* 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;

Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-03-12 Thread Michael Schmitz

Bugger - forgot to CC Sammy as well.

My only comment of substance is that the reset handling doesn't need to 
be done the same way as on Atari, as there's no special locking to 
account for.


Cheers,

Michael

Am 11.03.2014 um 21:28 schrieb Geert Uytterhoeven:


CC Sammy

On Tue, Mar 11, 2014 at 9:21 AM, Finn Thain 
fth...@telegraphics.com.au wrote:


This is a larger version of Michael's patch. It takes care of the 
header
files and comments and it addresses sun3_NCR5380 as well as 
atari_NCR5380.
This means that the initio.h include (!) can be dropped from 
sun3_scsi.h.


Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

Michael, I'm assuming that your patch hasn't been merged already (I 
didn't
find it in any of the likely repos). Please go ahead and add your 
sign-off
on this version if it is satisfactory. I didn't test this patch: I 
presume
that sun3_NCR5380 would need the same abort/reset fixes that 
atari_NCR5380

needed...


diff --git a/drivers/scsi/atari_NCR5380.c 
b/drivers/scsi/atari_NCR5380.c

index 0f3cdbc..e4aaf9a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -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 */


Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-03-12 Thread Finn Thain

This is a larger version of Michael's patch. It takes care of the header 
files and comments and it addresses sun3_NCR5380 as well as atari_NCR5380. 
This means that the initio.h include (!) can be dropped from sun3_scsi.h.

Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

This version defines RESET_RUN_DONE in sun3_scsi.c, to avoid changing 
driver behaviour whilst trying to keep sun3_NCR5380.c in sync with 
atari_NCR5380.c (from which it was originally copied).


Index: linux-m68k/drivers/scsi/atari_NCR5380.c
===
--- linux-m68k.orig/drivers/scsi/atari_NCR5380.c2014-03-13 
01:12:33.0 +1100
+++ linux-m68k/drivers/scsi/atari_NCR5380.c 2014-03-13 01:13:55.0 
+1100
@@ -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 *
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 *
 * 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 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 belowXXX */
 
/* MSch: old-style reset: actually abort all command processing here */
@@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
 * 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 *
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: linux-m68k/drivers/scsi/atari_scsi.c

Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-03-11 Thread Geert Uytterhoeven
CC Sammy

On Tue, Mar 11, 2014 at 9:21 AM, Finn Thain fth...@telegraphics.com.au wrote:

 This is a larger version of Michael's patch. It takes care of the header
 files and comments and it addresses sun3_NCR5380 as well as atari_NCR5380.
 This means that the initio.h include (!) can be dropped from sun3_scsi.h.

 Signed-off-by: Finn Thain fth...@telegraphics.com.au

 ---

 Michael, I'm assuming that your patch hasn't been merged already (I didn't
 find it in any of the likely repos). Please go ahead and add your sign-off
 on this version if it is satisfactory. I didn't test this patch: I presume
 that sun3_NCR5380 would need the same abort/reset fixes that atari_NCR5380
 needed...


 diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
 index 0f3cdbc..e4aaf9a 100644
 --- a/drivers/scsi/atari_NCR5380.c
 +++ b/drivers/scsi/atari_NCR5380.c
 @@ -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 belowXXX */

 /* 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 
 */
 -   

Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-03-11 Thread Finn Thain

This is a larger version of Michael's patch. It takes care of the header 
files and comments and it addresses sun3_NCR5380 as well as atari_NCR5380. 
This means that the initio.h include (!) can be dropped from sun3_scsi.h.

Signed-off-by: Finn Thain fth...@telegraphics.com.au

--- 

Michael, I'm assuming that your patch hasn't been merged already (I didn't 
find it in any of the likely repos). Please go ahead and add your sign-off 
on this version if it is satisfactory. I didn't test this patch: I presume 
that sun3_NCR5380 would need the same abort/reset fixes that atari_NCR5380 
needed...


diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 0f3cdbc..e4aaf9a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -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 belowXXX */
 
/* 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 */
 }
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index a3e6c8a..3ed39e5