Date: Fri, 17 Feb 1995 15:13:43 -0800 (PST) From: julian@tfs.com (Julian Elischer) To: dufault@hda.com (Peter Dufault) Cc: freebsd-hackers@freefall.cdrom.com Subject: Re: SCSI and config(8): Done. Message-ID: <m0rfbrr-0003wTC@TFS.COM> In-Reply-To: <199502171257.HAA21778@hda.com> from "Peter Dufault" at Feb 17, 95 07:57:44 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > I've added support to configure the SCSI system using config(8). > I'm going to wait for the "slice" code to settle before committing. this looks good, and I was wondering how to get this information to the system.. There is the question however of: if a device doesn't match what's there, how do we find out, and what do we do? should we have a call in each driver that confirms that it can handle what it sees? What do we do it it DOESN't match.... how can we force a device that reports itself as type B (eroneously) to be handled by the driver for type C (I have devices that report as tape but should be type processor)... > > Here is what I did. > > This config file entry: > > > controller scbus0 at aha0 > > > > disk sd0 at scbus0 target 0 unit 0 > > disk sd1 at scbus0 target 1 > > disk sd2 at scbus0 target 3 > > device cd? at scbus? > > tape st0 at scbus0 target 6 > > Generates this in ioconf.c: > > > #include "scsi/scsiconf.h" > > > > struct scsi_ctlr_config scsi_cinit[] = { > > /* driver unit */ > > { "aha", 0 }, > > { 0, 0 } > > }; > > > > struct scsi_device_config scsi_dinit[] = { > > /* type unit cunit target LUN flags */ > > { T_DIRECT, 0, 0, 0, 0, 0x0 }, > > { T_DIRECT, 1, 0, 1, -1, 0x0 }, > > { T_DIRECT, 2, 0, 3, -1, 0x0 }, > > { T_READONLY, '?', '?', -1, -1, 0x0 }, > > { T_SEQUENTIAL, 0, 0, 6, -1, 0x0 }, > > { -1, 0, 0, 0, 0, 0 } > > }; > > (cunit in scsi_dinit is the controller unit and is the index into > the scsi_cinit table for that device) > > The SCSI bus (scsi_cinit) table is passing in names instead of > "isa_dev's", but I wanted to use the adapter name since I'm not > sure how the PCI stuff wires in. > > When you configure a SCSI controller it looks up its bus number by > driver name and unit number. When there is no match it uses the > lowest unused bus number greater than the highest configured bus > number. for this to really work properly, we need to disable the autonumbering of the adapters, so that if aha- dies, aha1 doesn't suddenly become aha0.. > > (I have to look at how the multiple SCSI bus adapters work - I > suppose both busses have the same driver and adapter unit number, > so this current scheme may not work: I may need driver, unit and > bus in the scsi_cinit table.) controller scbus0 at ahx0 controller scbus1 at ahx0 I guess Every layer in the hierarchy needs some sort of 'subunit' field... in isa it's port-address, in scsi it's target, in adapters it's unit#, similar to wd0 and wd1 I guess it means adding a field to the structure.. We are slowely heading in the direction of NetBSD(& BSDI I think) config, in which the softc structure is allocated by the config routine, and every layer in the hierarchy is defined the same way...... > > When you configure a device it looks through the dinit table for > the unit to use. Each type (T_DIRECT == "sd", etc) is handled > independently and the same approach is used as for the busses: If > there is an exact match then that is used, if there is no match > you use the lowest unused unit number greater than the highest > configured unit number. Unknown LUNS (LUN == -1) are treated as > LUN 0 for matching. > > All information from the config file is stored in the structures > so you can go backwards from the structures to the config if you > want. > > For current config files this approach degenerates into the current > autocounting scheme. > > For new config files this becomes "use assignments when provided, > then autocount beginning after the highest assigned number". yes.... now, what about devices that are turned off and probed later when turned on..? > > Peter > > -- > Peter Dufault Real Time Machine Control and Simulation > HD Associates, Inc. Voice: 508 433 6936 > dufault@hda.com Fax: 508 433 5267 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0rfbrr-0003wTC>