SCSIHOSTS Release Notes

Introduction

Scsihosts is a new kernel boot time and module load time option for the Linux SCSI subsystem. It allows users with multiple SCSI adapter cards to exert some control over host and therefore device ordering. Although not directly related to the device pseudo file system ("devfs"), the scsihosts capability was introduced in linux kernel 2.3.46 as part of the devfs patch. There is a section on "SCSI Host Probing Issues" in the devfs documentation at <www.atnf.csiro.au/~rgooch/linux/docs/devfs.html> that describes scsihosts. The scsihosts option didn't work properly in 2.3.46 and a further patch was introduced in 2.4.0-test1-ac9 to make it functional. This page adds some supplementary information.
 

Notes

According to the devfs changelog the original scsihosts patch was written by Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>.

The devfs file system does not need to be selected in the kernel build for the scsihosts option to work.

As a kernel boot time option, scsihosts will appear in a lilo.conf file as something like:
    append="scsihosts=imm:advansys:advansys:aha1542"

As a module load time option it would look like:
    modprobe scsi_mod scsihosts=imm:aha1542

SCSI host adapters are identified by their driver's "procfs" name. That is the name that will appear in the /proc/scsi directory when the driver is recognized. Typically this is the same name as the module name (without the ".o" extension). Note that a driver can control multiple control host adapters which may or may not be the same model. [For example the Advansys driver controls all of that company's SCSI products that Linux can recognize, from ISA cards through to U2W PCI cards.]

The order in which a single SCSI lower level driver introduces multiple host adapters is not addressed by the scsihosts patch. See the lower level driver for options to control this ordering.

Built in drivers are still scanned for in the same order as before (and this is dictated by their relative position in the builtin_scsi_hosts array found in drivers/scsi/hosts.c). Once an adapter is detected the scsihosts list is checked to see if there is a match. If so (and if that position is not already taken) then the host is given that position number (starting from zero) and the host is inserted into the appropriate position in the host list. If there is no match then the next free host number is allocated (starting from the number of entries in the scsihosts list) and the host is appended to the host list. In the case of built in drivers this all happens before any SCSI devices are scanned for. Hence the scsihosts option can change the order in which SCSI devices are mapped to SCSI device names (e.g. /dev/sda).

The same logic applies to loading a lower level driver as a module. So a host position that hasn't been filled because the corresponding driver is not built into kernel may later be taken when that lower level driver is loaded as a module. One difference is that such a host is detected after the existing host buses have been scanned for SCSI devices and they have been mapped to SCSI device names (e.g. /dev/sda). So any SCSI devices found on the newly introduced host will be placed after those SCSI device names that have already been detected (e.g. /dev/sdb). See example in the next section.

Scsihosts does not alter how the boot image is obtained but it may be used to modify where the root and other partitions are mounted from.

One problem I noticed is that lilo and/or linux boot code truncate the arguments given to scsihosts to around 30 bytes. The actual number seems to vary from one boot to the next (quite strange and frustrating).
 

Example


append="scsihosts=imm:advansys:advansys:aha1542"

# above is the scsihosts parameter given to lilo

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: DNES-309170W     Rev: SA30
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 02 Lun: 00
  Vendor: PIONEER  Model: DVD-ROM DVD-303  Rev: 1.10
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 06 Lun: 00
  Vendor: YAMAHA   Model: CRW4416S         Rev: 1.0g
  Type:   CD-ROM                           ANSI SCSI revision: 02

# devices attached during boot shown above: an IBM disk, a Pioneer DVD
# and a Yamaha CD writer

$ cat /proc/scsi/sg/host_strs
<no active host>
AdvanSys SCSI 3.2M: PCI Ultra2-Wide: BIOS C8000/7FFF, IO E800/FF, IRQ 10
AdvanSys SCSI 3.2M: PCI Ultra 240 CDB: IO EC00/F, IRQ 5
<no active host>
SCSI host adapter emulation for IDE ATAPI devices

# "imm" and "aha1542" were not found during boot so their host position
# numbers are left empty. Since the "ide-scsi" driver was not listed
# in the "scsihosts" lilo option then it gets the next available host
# number which is 4

$ modprobe imm
imm: Version 2.03 (for Linux 2.0.0)
imm: Found device at ID 6, Attempting to use EPP 32 bit
imm: Communication established with ID 6 using EPP 32 bit
scsi0 : Iomega VPI2 (imm) interface
scsi : 4 hosts.
  Vendor: IOMEGA    Model: ZIP 100           Rev: P.05
  Type:   Direct-Access                      ANSI SCSI revision: 02
Detected scsi removable disk sdb at scsi0, channel 0, id 6, lun 0
SCSI device sdb: hdwr sector= 512 bytes. Sectors= 196608 [96 MB] [0.1 GB]
sdb: Write Protect is off

# Notice that the imm driver gets host position 0 but its disk gets
# the next available SCSI disk device: /dev/sdb

$ cat /proc/scsi/sg/host_strs
Iomega VPI2 (imm) interface
AdvanSys SCSI 3.2M: PCI Ultra2-Wide: BIOS C8000/7FFF, IO E800/FF, IRQ 10
AdvanSys SCSI 3.2M: PCI Ultra 240 CDB: IO EC00/F, IRQ 5
<no active host>
SCSI host adapter emulation for IDE ATAPI devices

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 06 Lun: 00
  Vendor: IOMEGA   Model: ZIP 100          Rev: P.05
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: DNES-309170W     Rev: SA30
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 02 Lun: 00
  Vendor: PIONEER  Model: DVD-ROM DVD-303  Rev: 1.10
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 06 Lun: 00
  Vendor: YAMAHA   Model: CRW4416S         Rev: 1.0g
  Type:   CD-ROM                           ANSI SCSI revision: 02

# Notice how the zip drive appears before the IBM disk because the
# zip driver belongs to a lower numbered host

$ cat /proc/scsi/sg/device_strs
IBM             DNES-309170W            SA30
PIONEER         DVD-ROM DVD-303         1.10
YAMAHA          CRW4416S                1.0g
IOMEGA          ZIP 100                 P.05

# The above shows that sg allocates /dev/sg3 to zip drive
 

Doug Gilbert
11th June 2000  21:30