SCSI Driver Extension

A minor weak point of the SCSI Driver interface is the limitation to LUNs 0-7 (SCSI sub-units) per device, even though SCSI-2 and newer (but not ACSI) permit 32 LUNs. With SCSI2Pi, for instance, you can create devices with LUNs > 7.
With a backwards compatible extension for the SCSI Driver interface HDDRIVER 12 removes this LUN restriction.

SCSI Driver Extension

The screenshot shows two SCSI devices with a LUN > 7: The SCSI2Pi host services (ID 4, LUN 15) and a SCSI printer (ID 4, LUN 31).

Technical Details

The bits 8-12 in the flags field of the In and Out calls contain the complete LUN (0-31). Whether a SCSI Driver supports this feature is coded in bit 6 of the bus feature vector for the respective bus. The caller sets bit 6 in the flags field in order to signal that the extended LUN information is available. The SCSI Driver specification explains all data structures and calls in detail. The SCSI2Pi client tools are a usage example.

Listing the available LUNs

For devices with potentially numerous LUNs it is often useful to query the list of available LUNs from the device. This avoids unnecessarily accessing non-existent LUNs. The SCSI command REPORT LUNS can be used for that, see SPC-2 (SCSI Primary Commands) or newer. The SCSI2Pi client tools are a usage example.