[comp.os.minix] >SCSI & ST01 interface

davep@gapos.bt.co.uk (Dave Parkinson) (12/11/90)

Following my last posting I got a useful message from Mike Irons
(mike.irons@edu.northeatern.lynx) which answered several questions I hadn't
yet asked.  As I result I went back to my ST01 drivers and sorted the problems
out.  My code is spread across two files: scsi.c (loosely based on xt_wini.c)
and scsi_drv.x - the assembley language driver that handles the i/f to
the ST01.

Version 1 was rock solid but SLOW.  'readall' on a 20Mbyte drive took
8mins 12 secs.  Using a 'scope on the SCSI BUS showed that my ADAPTEC
controller took a minimum of 15ms between receiving the command and
starting to return the data - even if the drive was already positioned
on the right track.  What was needed was some way of increasing the
number of sectors transferred per command issued (ie adding buffering).

Version 2 utilises the buffering already provided within FS, and makes a few
assumptions about the SCSI transfer - like once started, a full sector's worth
of data will be passed (that way REP MOVSB can act as pseudo DMA).  FS's
requests to the driver are always(?) SCATTERED_IO requests, where a number
of requests are issued at a time.  The list of BLOCK_SIZE requests are
then handled one-at-a-time by the do_vrdwt() function in misc.c.  I wrote
my own version of do_vrdwt() that examines the list, and combines similar
requests where the blocks are sequential.  To keep my code simple the
scsi_drv.x code was modified to accept a pointer to an array of pointers to
BLOCK_SIZE buffers rather than being passed a single buffer pointer. ie the
data is moved directly to/from FS's BLOCK_SIZE buffers, and not through
any intermediate track and/or sector buffers.  With these changes the
'readall' time dropped to a more realistic 1 min 42 secs and the general
overall performance showed a similar improvement (though I'm still stuck
with the 15ms dead time on every SCSI read command issued!)

If anyone has interest in either (or both) of the files please mail me.
The scsi_drv.x driver has been written and tested with a Seagate ST01
interface card and an elderly ADAPTEC ACB4000 controller card. (1983/4
vintage - it dates from the birth of SCSI out of SASI).  I haven't tried
it with one of today's embedded SCSI drives and can't vouch that it will
work unmodified.

Note: Once you think you've got things right use 'cpdir' to move a 10Mbyte
      file system.  That soon finds a few of the holes!

     Dave Parkinson    davep@gapos.bt.co.uk      

owens@unix1.j6.eucom.mil (Kerry F. Owens) (12/14/90)

Hello Dave

I would be interested in the SCSI modules.

I have an SCSI drive and have wanted to buy an SCSI controler, but
have not had the time to devote to it.

Thank you in advance!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kerry F Owens
American:	Box 453, APO NY 09128
German:		Brand Str 13, 7032 Sindelfingen 7 FRG
Internet:	owens@unix1.j6.eucom.mil