COMMONSCSI(7-SysV) RISC/os Reference Manual COMMONSCSI(7-SysV)
NAME
common_scsi - common SCSI disk and tape controller interface
DESCRIPTION
This is the common upper level code for SCSI disk and tape
controllers. The minor device numbers for disks are ``16 *
drive_number + partition''.
Tape devices have two types of operation associated with
each drive. The rewind device will rewind the tape on close
while the no rewind device does not change the tape position
on close. The minor device numbers for tapes are ``16 *
drive_number + no_rewind''. Tape devices are always charac-
ter devices.
The block files access the disk via the system's normal
buffering mechanism and may be read and written without
regard to physical disk records. There is also a "raw"
interface that provides for direct transmission between the
disk and the user's read or write buffer. A single read or
write call results in exactly one I/O operation and there-
fore raw I/O is considerably more efficient when many words
are transmitted.
In raw I/O, buffers should be page aligned for best perfor-
mance and I/O counts should be a multiple of the device
block size (512 bytes for a disk sector) or the exact record
size for variable record devices. Reads of less than the
device block size are allowed if the request begins on a
block address. Writes of less than the device block size
will write undefined data for the remainder of the block.
Likewise seek calls should specify a multiple of the device
block size. Seek calls to a non-block aligned address will
cause the next read to fail.
Disk volumes on MIPS computers systems contain a volume
header that describes the contents of the disk and parame-
ters of the physical disk drive. The volume header is a
block located at the beginning of all disk media. It con-
tains information about physical device parameters and logi-
cal partition information. Refer to dvh(4) for details on
the disk volume header format. Volume headers are created
by formatters and may be manipulated by dvhtool(1M).
Drivers wishing to use the common_scsi interfaces must call
common_scsi_registerme with the information on low-level
routines supplied in the following structure:
struct low_scsi {
void (*low_scsi_init)(); /* init controller dependent device */
void (*low_scsi_setupdma)();/* init dma controller */
int (*low_scsi_startop)();/* have controller start op */
struct scsi_unit *low_scsi_un;/* ptr to unit info structure */
Printed 1/28/91 Page 1
COMMONSCSI(7-SysV) RISC/os Reference Manual COMMONSCSI(7-SysV)
int low_scsi_Ntarget; /* max targets */
int low_scsi_Nlun; /* max logical units / target */
};
The following routines are available:
common_scsi_registerme()
Registers a major device number to a low_scsi structure
to allow multiple drivers to use common_scsi routines.
common_scsi_read()
character device read interface function.
common_scsi_write()
character device write interface function.
common_scsi_attach()
function to get the volume header for a disk device.
common_scsi_intr()
interrupt routine.
common_scsi_slave()
function to determine the existance of a device and
perform inquiry command to determine device type.
common_scsi_timeval()
calculates appropriate timeout values for various SCSI
operations.
common_scsi_size()
returns device partition size.
common_scsi_dump()
performs core dump functions.
common_scsi_spcmd()
performs special commands in either a polled or inter-
rupt mode.
common_scsi_printerr()
prints SCSI error codes in english.
Page 2 Printed 1/28/91
COMMONSCSI(7-SysV) RISC/os Reference Manual COMMONSCSI(7-SysV)
common_scsi_sense_status()
performs request sense processing.
common_scsi_getun()
gets a scsi_un structure pointer from a device number.
common_scsi_open()
performs UNIX open function for disk or tape.
common_scsi_close()
performs UNIX close function for disk or tape.
common_scsi_ioctl()
performs common UNIX ioctl functions for disk or tape.
common_scsi_strategy()
UNIX strategy function.
FILES
/usr/include/sys/scsi.h
SEE ALSO
sd(7), dvhtool(1M), prtvtoc(1M).
dvh(4) in the Programmer's Reference Manual.
DIAGNOSTICS
Many of these diagnostic messages are enabled only if
showconfig is set or if the global variable scsiexterr is
non-zero.
SCSI %dL%d: vendor id is '%s' product id is '%s'
and the revision level is '%s'; device is a %s"
This gives the information returned from the INQUIRY
command to the device.
mode select ERROR
SCSI %dL%d: error in mode select
An error was returned from the device while attempting
to change the mode parameters.
SCSI %dL%d: error in mode sense
An error was returned from the device while attempting
to read the mode parameters.
Printed 1/28/91 Page 3
COMMONSCSI(7-SysV) RISC/os Reference Manual COMMONSCSI(7-SysV)
SENSE DATA:
xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
SENSE key %d; %s
error code %d; %s
Request sense data as returned by the device is
displayed.
SCSI %dL%d: NO volume header found
On opening a disk device there was no valid volume
header.
SCSI %dL%d: scsi hardware ERROR status: %x %s
SCSI %dL%d: not ready; offline or tape not installed
SCSI %dL%d: cannot read block limits
On opening a tape device the attempt to read block lim-
its to determine if the device is a variable record
device failed.
SCSI %dL%d: write protected
An attempt has been made to open for write a device
that is write protected.
SCSI %dL%d: unit attention; media change or drive was reset
SCSI %dL%d: error in writing file marks
SCSI %dL%d: error in backspace file marks
SCSI %dL%d: error in rewinding
SCSI %dL%d: invalid block length request %d
SCSI %dL%d: Could not kern_malloc %d bytes
SCSI %dL%d: DIOCVFYSEC unsupported
SCSI %dL%d: DIOCDIAG unsupported
SCSI %dL%d: DIOCRDEFECTS unsupported
SCSI %dL%d: Unknown ioctl 0x%x
physical block address 0x%x (%d)
error code 0x%x(%d); %s
Page 4 Printed 1/28/91
COMMONSCSI(7-SysV) RISC/os Reference Manual COMMONSCSI(7-SysV)
tape ioctl: error, bp->b_error= 0x%x
SCSI %dL%d: unit is NOT a disk drive
SCSI %dL%d: Formatting........
SCSI %dL%d: Format action %d not supported
SCSI %dL%d: request sense ERROR
SCSI %dL%d: hw status; %s
SCSI %dL%d: sense status
valid =%d
segment =%d
filmrk =%d
eom =%d
ilength =%d
key =0x%x %s
info =0x%x
add_len =%d
Sense status as returned by the device is printed.
SCSI %dL%d: check condition on request sense command
SCSI %dL%d: %s
The sense key as returned by the request sense command
is dispalyed.
SCSI %dL%d: illegal block length %d, actual=%d
A request was made to read a variable length block with
a request size that was smaller than the actual record
length.
SCSI %dL%d: cartridge is not a 600 ft tape (QIC-120)
SCSI %dL%d: physical block address 0x%x (%d)
For disk devices this is the block number where the
error ocurred.
SCSI %dL%d: error code 0x%x(%d); %s
Attempt to reuse scsi map entry major = %d
An attempt was made to map two drivers to the low-level
function table. The major number of the offending
driver is printed.
Printed 1/28/91 Page 5
COMMONSCSI(7-SysV) RISC/os Reference Manual COMMONSCSI(7-SysV)
Page 6 Printed 1/28/91