Subject: Re: Reorg of Sun3 SCSI driver
To: David Jones <dej@eecg.toronto.edu>
From: Eduardo E. Horvath eeh@btr.com <eeh@btr.btr.com>
List: current-users
Date: 08/08/1995 08:34:15
On Mon, 7 Aug 1995, David Jones wrote:

> I am adding DMA and interrupts to the Sun3 si driver.  As part of this, I am
> incorporating the "machine independent" ncr5380.c file into the Sun3 driver.
> 
> A few things will change.  I'm trying to keep changes minimal so as not to break
> the Sparc port and anything else that may decide to use this driver (Atari ST,
> some Amiga SCSI controllers, ...).  A few of the proposed changes:
> 
> reset_adapter() will become a callback vector in the ncr5380_softc.  Each driver
> will be expected to provide its own version of reset_adapter() (hopefully named
> something a little less generic than "reset_adapter"!)
> 
> Similarly, a bunch of other callbacks will be added to handle DMA.  I haven't
> really decided on the API for these yet, but it will resemble to some extent
> what is done for the Amiga 3393 SCSI drivers.

Since I'm currently working on revamping the 33c93 drivers let me make a 
few suggestions, although I don't know how relevant they are to the ncr 
chip.

You want to have a per-card (DMA controller?) initialization routine, like
the current 33c93 drivers, as well as an initializer for the controller chip
and controller specific part of the driver.  This will allow re-writing the
driver for the controller without touching the card specific drivers.

You will want to separate the DMA start/stop routines from the interrupt 
enable/disable routines.

The initialization routine should be separated from the device reset 
routine, since if something goes catastrophically wrong you may want to 
reset the chip but not lose all of your queued requests.

Try to keep the driver as orthogonal as possible.  Try to have a specific 
routine deal with a specific aspect of the controller.  It will save you 
a lot of grief later if you want to add functionality to your driver.

Eduardo