Next | Prev | Up | Top | Contents | Index

User-level SCSI Device Drivers

This section explains how to write a user-level driver for a SCSI device. It describes the SCSI interface routines for the integral SCSI controller and gives a short example.

In IRIX 5.0 and later releases, a SCSI target may, in most cases, be used by more than one driver at a time unless it is opened in exclusive mode (currently, only the tpsc tape driver uses exclusive mode). See "Kernel-level SCSI Device Drivers" for more information.

Note: There have been extensive changes in the kernel SCSI driver interface in the IRIX 5.x releases. In IRIX 5.x, the devscsi interface is available on the wd93, wd95, and VMESCSI (Jaguar) drivers. In prior releases, it was available only on the wd93. IRIX 5.2 and 5.3 remain source compatible, however. To control a SCSI device from a user-level program, you need the routines of the dslib library and a device-special file created for the device. The system comes with device-special files for SCSI adapters in the directory /dev/scsi. These files can be especially useful because they insulate the device driver writer from changes in operating system releases, and they remain valid across all Silicon Graphics platforms, independent of the low-level SCSI driver. Their limitation is that they are created for logical unit 0 only.
(If the logical unit number for your device is not zero, you need to create a device-special file for the device. See "Creating Device-special Files for User-level SCSI Drivers.")

Which special files you use depends on the SCSI ID for the device, a number from 1-7 (wide SCSI is 1-15). The SCSI ID for a device is usually controlled by switch settings or jumpers. (See the device technical specification for details.) For a SCSI device with a SCSI ID of 3 on controller 0, use
/dev/scsi/sc0d3l0; use /dev/scsi/sc0d7l0 for a SCSI device with a SCSI ID of 7, and so on. See the man page for the ds(7M) command for more details on device naming.

The remainder of this chapter assumes that you are familiar with the SCSI interface. For additional information on SCSI-bus operation, see the ANSI Standards X3.131-1986 and X3T9.2/85-52 Rev 4B.


Creating Device-special Files for User-level SCSI Drivers
dsreq - User-level Driver Communication Structure
dslib Routines Description
SCSI Open and Close Driver Routines
SCSI Function-Building Routines - Group 1
SCSI Function-Building Routines - Group 2
Using the dslib Routines

Next | Prev | Up | Top | Contents | Index