2004-01-06 23:15:00

by Jonathan McDowell

[permalink] [raw]
Subject: Patch for reset in ini9100u [Initio 9100U(W)]

Hi.

I have an IWill 2935UW SCSI controller which uses the ini9100u driver.
This has been working fine under 2.4 but I've recently built up a box of
spare bits including the controller and installed 2.6 on it. The driver
is marked broken in 2.6, apparently because of a lack of reset/abort
functionality as it compiles and runs ok. So I've taken a stab at
getting reset support back. Patch is below and it's received minimal
testing - it boots, removes the callback trace and error message and
doesn't seem to cause problems (the only disk in the machine is on this
card).

-----------
diff -u linux-2.6.1-rc2.orig/drivers/scsi/ini9100u.c linux-2.6.1-rc2/drivers/scsi/ini9100u.c
--- linux-2.6.1-rc2.orig/drivers/scsi/ini9100u.c 2004-01-06 22:56:04.000000000 +0000
+++ linux-2.6.1-rc2/drivers/scsi/ini9100u.c 2004-01-06 22:58:04.000000000 +0000
@@ -106,6 +106,8 @@
* - Changed the assumption that HZ = 100
* 10/17/03 mc - v1.04
* - added new DMA API support
+ * 06/01/04 jmd - v1.04a
+ * - Re-add reset_bus support
**************************************************************************/

#define CVT_LINUX_VERSION(V,P,S) (V * 65536 + P * 256 + S)
@@ -149,6 +151,7 @@
.queuecommand = i91u_queue,
// .abort = i91u_abort,
// .reset = i91u_reset,
+ .eh_bus_reset_handler = i91u_bus_reset,
.bios_param = i91u_biosparam,
.can_queue = 1,
.this_id = 1,
@@ -161,7 +164,7 @@
char *i91uCopyright = "Copyright (C) 1996-98";
char *i91uInitioName = "by Initio Corporation";
char *i91uProductName = "INI-9X00U/UW";
-char *i91uVersion = "v1.04";
+char *i91uVersion = "v1.04a";

#define TULSZ(sz) (sizeof(sz) / sizeof(sz[0]))
#define TUL_RDWORD(x,y) (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) ))
@@ -587,6 +590,15 @@
return tul_device_reset(pHCB, (ULONG) SCpnt, SCpnt->device->id, reset_flags);
}

+int i91u_bus_reset(Scsi_Cmnd * SCpnt)
+{
+ HCS *pHCB;
+
+ pHCB = (HCS *) SCpnt->device->host->base;
+ tul_reset_scsi_bus(pHCB);
+ return SUCCESS;
+}
+
/*
* Return the "logical geometry"
*/
diff -u linux-2.6.1-rc2.orig/drivers/scsi/ini9100u.h linux-2.6.1-rc2/drivers/scsi/ini9100u.h
--- linux-2.6.1-rc2.orig/drivers/scsi/ini9100u.h 2003-12-18 02:58:56.000000000 +0000
+++ linux-2.6.1-rc2/drivers/scsi/ini9100u.h 2004-01-06 22:58:35.000000000 +0000
@@ -82,10 +82,11 @@
extern int i91u_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
extern int i91u_abort(Scsi_Cmnd *);
extern int i91u_reset(Scsi_Cmnd *, unsigned int);
+extern int i91u_bus_reset(Scsi_Cmnd *);
extern int i91u_biosparam(struct scsi_device *, struct block_device *,
sector_t, int *);

-#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.03g"
+#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a"

#define VIRT_TO_BUS(i) (unsigned int) virt_to_bus((void *)(i))
#define ULONG unsigned long
-----------

J.

--
] http://www.earth.li/~noodles/ [] "0 tends to simplify things a bit [
] PGP/GPG Key @ the.earth.li [] when you multiply by it..." -- [
] via keyserver, web or email. [] Bill McColl [
] RSA: 4DC4E7FD / DSA: 5B430367 [] [


2004-01-08 00:56:39

by James Bottomley

[permalink] [raw]
Subject: Re: Patch for reset in ini9100u [Initio 9100U(W)]

On Tue, 2004-01-06 at 17:14, Jonathan McDowell wrote:
> I have an IWill 2935UW SCSI controller which uses the ini9100u driver.
> This has been working fine under 2.4 but I've recently built up a box of
> spare bits including the controller and installed 2.6 on it. The driver
> is marked broken in 2.6, apparently because of a lack of reset/abort
> functionality as it compiles and runs ok. So I've taken a stab at
> getting reset support back. Patch is below and it's received minimal
> testing - it boots, removes the callback trace and error message and
> doesn't seem to cause problems (the only disk in the machine is on this
> card).

I think it's a good beginning. However, there are some things that
could be done to improve it.

> +int i91u_bus_reset(Scsi_Cmnd * SCpnt)
> +{
> + HCS *pHCB;
> +
> + pHCB = (HCS *) SCpnt->device->host->base;
> + tul_reset_scsi_bus(pHCB);

This won't quite do beacuse tul_reset_scsi_bus() has some really nasty
properties

Under the old error handler, the reset routine was responsible for
resetting the bus, waiting the timeout (which tul_reset_scsi_bus() does
with a busy wait) and flushing the queue.

In the new scheme, the eh thread takes care of all of this (including a
nice thread based wait).

I think this may all work correctly if you change this call to:

tul_reset_scsi(pHCB, 0);

instead. That should simply reset the bus and not busy wait at all,
which is really what the error handler is expecting.

James


2004-01-18 21:30:36

by Jonathan McDowell

[permalink] [raw]
Subject: Re: Patch for reset in ini9100u [Initio 9100U(W)]

On Wed, Jan 07, 2004 at 06:56:04PM -0600, James Bottomley wrote:
> On Tue, 2004-01-06 at 17:14, Jonathan McDowell wrote:
> > I have an IWill 2935UW SCSI controller which uses the ini9100u driver.
> > This has been working fine under 2.4 but I've recently built up a box of
> > spare bits including the controller and installed 2.6 on it. The driver
> > is marked broken in 2.6, apparently because of a lack of reset/abort
> > functionality as it compiles and runs ok. So I've taken a stab at
> > getting reset support back. Patch is below and it's received minimal
> > testing - it boots, removes the callback trace and error message and
> > doesn't seem to cause problems (the only disk in the machine is on this
> > card).
> I think it's a good beginning. However, there are some things that
> could be done to improve it.
>
> > +int i91u_bus_reset(Scsi_Cmnd * SCpnt)
> > +{
> > + HCS *pHCB;
> > +
> > + pHCB = (HCS *) SCpnt->device->host->base;
> > + tul_reset_scsi_bus(pHCB);
>
> This won't quite do beacuse tul_reset_scsi_bus() has some really nasty
> properties
>
> Under the old error handler, the reset routine was responsible for
> resetting the bus, waiting the timeout (which tul_reset_scsi_bus() does
> with a busy wait) and flushing the queue.
>
> In the new scheme, the eh thread takes care of all of this (including a
> nice thread based wait).
>
> I think this may all work correctly if you change this call to:
>
> tul_reset_scsi(pHCB, 0);
>
> instead. That should simply reset the bus and not busy wait at all,
> which is really what the error handler is expecting.

Ahhh, cunning. I've changed this over and it seems to work ok. I'm not
sure what sort of testing needs done though. As before it compiles and
boots without problems and I haven't seen any issues in basic use.

J.

--
OK, if we can't have a tour, can | .''`. Debian GNU/Linux Developer
we at least have a look around? | : :' : Happy to accept PGP signed
| `. `' or encrypted mail - RSA +
| `- DSA keys on the keyservers.