Subject: New SCSI code
To: None <current-users@netbsd.org>
From: Charles M. Hannum <mycroft@gnu.ai.mit.edu>
List: current-users
Date: 12/12/1994 02:35:26
I'm looking for suckers^Wvolunteers to alpha-test the SCSI code I'm
working on.  In particular, the NCR 53c8XX driver, the Seagate driver,
and the BusLogic driver all need to be tested.

A brief summary of the most noticable changes so far:

1) Move the config matching code into individual drivers, but provide
a helper function (scsi_inqmatch) to make it easier.  This leverages
off the config system a bit, using priorities to find the `best'
(i.e. most exact) match.  Any semi-matching driver will return at
least 2, except for uk, which returns 1, thus always giving it last
pick.

2) Start to move to explicit sizes for the hardware-defined data.
This is just barely the beginning; much more work needs to be done
here.  Some other type bogosities are also addressed.

3*) Remove `adapter_info' from the adapter switch.  The interface was
archaic, and we already have a reasonable mechanism for returning that
data; namely, poking the `openings' entry in the prototype scsi_link
when attaching the low-level driver.  Also, `adapter_targ' is changed
to `adapter_target' for consistency, and a few other unused (and
seemingly pointless) switch entries are removed.

4) Wait for disks to come ready when opening a cd or sd device.
There's currently a 5-second timeout on this during autoconfig, and 30
seconds (plus `friendly' console messages like some other systems) at
any other time.

5*) Torch SCSI_ERR_OK, and ignore specific errors (currently ILLEGAL
REQUEST for implicit prevent/allow on first open and last close, MEDIA
CHANGE during first open of a device, NOT READY during probe and
prevent on first open before spinning up the disk, and probably
combinations of these at other times).  I don't think there was any
need before for the low-level driver to know about this (though many
of them did), and there definitely isn't now.

6) Retry on an ignored MEDIA CHANGE.

7*) Remove SCSI_NOMASK.  Add SCSI_POLL.  Conceptually, these do almost
the same thing, but there's not really any point in disallowing the
spl calls, all the conditionals slow the code down in the most
frequent cases, and it may be useful some day to use SCSI_POLL where
SCSI_NOMASK wouldn't have been appropriate.

8*) Remove HAD_ERROR.  It was identical to COMPLETE, and I got tired
of seeing silly code that conditionally returned one or the other of
the two.

9*) Remove XS_SWTIMEOUT.  Everything currently uses XS_TIMEOUT for the
purpose XS_SWTIMEOUT was intended.  Add XS_SELTIMEOUT, to allow the
low-level driver to inform the high-level code that the device appears
to be gone.  Returning XS_TIMEOUT in this case is still acceptable,
but not recommended.

10) Fix *numerous* bugs in the 4 original i386 low-level drivers.
Also, make the aha driver handle mailboxes similar to the bt driver,
which among other things means that timeouts should actually work.
Lots of other cleanup of this code too, and make them all look a
little more similar.

11) Make SCIOCCOMMAND actually return the command status, residual,
and sense data.

12) Only clear the `media loaded' flag on MEDIA CHANGE if the device
claims to have removable media.

13) Restructure things a bit so that we have a secondary interface to
the execution engine, to get complete status information from the
scsi_xfer.  This is now used by the code that waits for a disk to spin
up.

14) Actually do aborts when timing out in the 6[23]60 driver.  This
isn't strictly necessary, but it's a good idea.

[Items marked with a `*' correspond to changes that are either
required or strongly recommended in the low-level drivers.  People
working on other ports are encouraged to update their code ASAP.  In
particular, the SPARC driver needs a bunch of work.]


Items not yet dealt with:

scsiconf.c:

* Handle multiple LUNs.

aic6360.c:

* Handle failed REQUEST SENSE better.
* Handle parity errors during MESSAGE IN phase.
* Time out MESSAGE IN and MESSAGE OUT phase if REQ isn't asserted in
some reasonable amount of time, and allow the code to wait for another
interrupt.

seagate.c:

* Lots of stuff.

ultra14f.c:

* Do aborts correctly.


Of course, other people are encouraged to contribute, too.  I'd
especially like to see low-level drivers for other boards.  <hint,
hint>