HP-UX Reference (11i v1 00/12) - 5 Miscellaneous Topics, 7 Device (Special) Files, 9 General Information, Index (vol 9)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man7/!!!intro.7
________________________________________________________________
___ ___
s
scsi_pt(7) scsi_pt(7)
(Series 800 Only)
NAME
scsi_pt - SCSI pass-through device driver for Series 800 NIO based systems
DESCRIPTION
SCSI devices are normally controlled by a device-type-specific driver when the appropriate device-type-
specific driver exists. Device-type-specific drivers, such as those for SCSI direct access (disk) and sequen-
tial access (tape) devices, coordinate device and driver states to accomplish correct logical device behavior.
The SCSI pass-through driver (also called spt) enables use of SCSI devices and commands that are not sup-
ported by these device-type-specific drivers.
A successful scsi_pt open() call requires no device I/O operations. Once open, ioctl() calls can be
used to change SCSI communication parameters, attempt SCSI commands, or other SCSI operations.
Since the SCSI pass-through driver does not attempt to logically understand the target device, read()
and write() calls are not supported. Super-user privileges or device write permissions are required to
use these ioctls. All reserved fields in the data structures associated with these ioctls must be zero-
filled.
Since the SCSI pass-through driver is a separate device driver, the default device-type-specific driver can-
not be used for the same device at the same time as the pass-through driver.
SCSI Commands and Operations
Only two ioctl commands are supported by the NIO SCSI pass through driver; the SIOC_EXCLUSIVE
command and the SIOC_IO command.
The SIOC_EXCLUSIVE ioctl provides a mechanism to prevent other opens of a device. This allows
exclusive access by the locking application. There are two different levels of locks supported; SCSI target
level and SCSI lun level. These levels are specified via the
data field of the ioctl() call:
0 release exclusive access to SCSI lun
1 gain exclusive access to SCSI lun
2 release exclusive access to SCSI target
3 gain exclusive access to SCSI target
For example, to lock the device (SCSI target):
three = 3;
if (err = ioctl(fd, SIOC_EXCLUSIVE, &three)) {
/* Could not lock the device -- check err */
}
NOTE: The corresponding unlock must be made for the acquired lock. An unlock of the SCSI target (data
== 2) will NOT unlock all of the individual SCSI luns (data == 0).
The
SIOC_IO ioctl allows an arbitrary SCSI command to be sent to a device. All details of the SCSI com-
mand protocol are handled automatically. See EXAMPLE mentioned below.
The header file <sys/scsi.h> has useful information for SCSI device control. The following is an
excerpt from it:
/* SCSI device control ioctls */
#define SIOC_IO _IOWR(’S’, 22, struct sctl_io)
#define SIOC_EXCLUSIVE _IOW(’S’, 68, int)
/* Structure for SIOC_IO ioctl */
struct sctl_io
{
unsigned flags;
unsigned char cdb_length;
unsigned char cdb[16];
void *data;
unsigned data_length;
unsigned max_msecs;
unsigned data_xfer;
unsigned cdb_status;
unsigned char sense[256];
unsigned sense_status;
unsigned char sense_xfer;
unsigned reserved[16];
HP-UX Release 11i: December 2000 − 1 − Section 7−−125
___
___