Date: Fri, 17 Feb 1995 07:57:44 -0500 (EST) From: Peter Dufault <dufault@hda.com> To: freebsd-hackers@freefall.cdrom.com Subject: SCSI and config(8): Done. Message-ID: <199502171257.HAA21778@hda.com>
next 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.
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.
(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.)
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".
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?199502171257.HAA21778>
