Subject: Re: quick patch for LUNs on SCSI-I devices
To: Justin T. Gibbs <gibbs@freefall.freebsd.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 09/02/1996 11:50:23
[ Taking this from private mail to tech-kern... ]

On Mon, 02 Sep 1996 08:27:10 -0700 
 "Justin T. Gibbs" <gibbs@freefall.freebsd.org> wrote:

 > But NetBSD always probes for multiple LUNs right?  I thought of this too,
 > in that you may be able to "clone" the version from LUN 0 before probing
 > the higher luns so you never set it incorrectly, but I think you might
 > lose on SCSI->SCSI or SCSI->ESDI bridges.

No ... In the case where the device is "ancient", (i.e. version & 
SID_ANSII == 0), LUNs are not checked, or in the case where a NOLUNS 
quirk exists for the device.  In the case of ancient devices that _do_ 
have working LUN support (i.e. the Emulex MD21), we have a FORECELUNS quirk.

Note that in the current model, the LUN won't get set on the first try of 
the device, which will be LUN 0 ... unless the user explicitly 
confgigured a device at lun 1 or something ...

The cases where it breaks are a direct result of scsi_link not being 
right in our autoconfiguration model; it attempts to squish the target 
layer and lun layer (and, in some cases, the adapter layer!) all into 
one.

I'm working on some changes to the SCSI code which will solve the 
maxtarget and the above lun problem in one fell-swoop, in a nice 
(somewhat BSDI-like) manner... essentally, the device tree will look like:

ahc* at pci? dev ? function ?
scsibus* at ahc? channel ?
tg* at scsibus* target ?
sd* at tg? lun ?
st* at tg? lun ?
cd* at tg? lun ?
ch* at tg? lun ?
ss* at tg? lun ?
uk* at tg? lun ?

(Note, this is how the SCSI bus is logically arraned anyhow :-)

Solves maxtarget, because then our autoconfig code does all the dynamic 
allocation, and it's layered properly.  Solves the LUN problem because 
when tg? is attached, only lun 0 will be checked for device existence, 
and the correct SCSI version will be known for the later device at lun ? 
checks.

 -- save the ancient forests - http://www.bayarea.net/~thorpej/forest/ -- 
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939