|
|
@ -1,4 +1,4 @@ |
|
|
|
.\" $OpenBSD: scsi.3,v 1.8 2003/03/06 20:13:15 jmc Exp $ |
|
|
|
.\" $OpenBSD: scsi.3,v 1.9 2003/05/23 12:31:32 jmc Exp $ |
|
|
|
.\" Copyright (c) 1994 HD Associates (hd@world.std.com) |
|
|
|
.\" All rights reserved. |
|
|
|
.\" |
|
|
@ -140,19 +140,19 @@ builds up a scsireq structure based on the information provided in |
|
|
|
the variable argument list. |
|
|
|
It gracefully handles a NULL pointer passed to it. |
|
|
|
.Pp |
|
|
|
.Fr len |
|
|
|
.Fa len |
|
|
|
is the length of the data phase; the data transfer direction is |
|
|
|
determined by the |
|
|
|
.Ar flags |
|
|
|
argument. |
|
|
|
.Pp |
|
|
|
.Fr buf |
|
|
|
.Fa buf |
|
|
|
is the data buffer used during the SCSI data phase. |
|
|
|
If it is NULL it is allocated via malloc and |
|
|
|
.Ar scsireq->databuf |
|
|
|
is set to point to the newly allocated memory. |
|
|
|
.Pp |
|
|
|
.Fr flags |
|
|
|
.Fa flags |
|
|
|
are the flags defined in |
|
|
|
.Aq Pa sys/scsiio.h : |
|
|
|
.Bd -literal -offset indent |
|
|
@ -163,29 +163,30 @@ are the flags defined in |
|
|
|
#define SCCMD_ESCAPE 0x00000010 |
|
|
|
#define SCCMD_TARGET 0x00000020 |
|
|
|
.Ed |
|
|
|
.Pp |
|
|
|
Only two of these flags are supported in this release of the software: |
|
|
|
.Fr SCCMD_READ |
|
|
|
.Fa SCCMD_READ |
|
|
|
indicates a data in phase (a transfer into the user buffer at |
|
|
|
.Ar scsireg->databuf ) , |
|
|
|
and |
|
|
|
.Fr SCCMD_WRITE |
|
|
|
.Fa SCCMD_WRITE |
|
|
|
indicates a data out phase (a transfer out of the user buffer). |
|
|
|
.Pp |
|
|
|
.Fr fmt |
|
|
|
.Fa fmt |
|
|
|
is a CDB format specifier used to build up the SCSI CDB. |
|
|
|
This text string is made up of a list of field specifiers. |
|
|
|
Field specifiers specify the value for each CDB field (including indicating |
|
|
|
that the value be taken from the next argument in the |
|
|
|
variable argument list), the width |
|
|
|
of the field in bits or bytes, and an optional name. |
|
|
|
White space is ignored, and the pound sign ('#') introduces a comment that |
|
|
|
Whitespace is ignored, and the pound sign ('#') introduces a comment that |
|
|
|
ends at the end of the current line. |
|
|
|
.Pp |
|
|
|
The optional name is the first part of a field specifier and |
|
|
|
is in curly braces. |
|
|
|
The text in curly braces in this example are the names: |
|
|
|
.Bd -literal -offset indent |
|
|
|
.Fr "{PS} v:b1 {Reserved} 0:b1 {Page Code} v:b6 # Mode select page" |
|
|
|
.Em "{PS} v:b1 {Reserved} 0:b1 {Page Code} v:b6 # Mode select page" |
|
|
|
.Ed |
|
|
|
.Pp |
|
|
|
This field specifier has two one bit fields and one six bit field. |
|
|
@ -196,45 +197,45 @@ Multi byte fields are swapped into the SCSI byte order in the |
|
|
|
CDB and whitespace is ignored. |
|
|
|
.Pp |
|
|
|
When the field is a hex value or the letter v, (e.g., |
|
|
|
.Fr "1A" |
|
|
|
.Fa "1A" |
|
|
|
or |
|
|
|
.Fr "v" ) |
|
|
|
.Fa "v" ) |
|
|
|
then a single byte value |
|
|
|
is copied to the next unused byte of the CDB. |
|
|
|
When the letter |
|
|
|
.Fr v |
|
|
|
.Fa v |
|
|
|
is used the next integer argument is taken from the variable argument list |
|
|
|
and that value used. |
|
|
|
.Pp |
|
|
|
A constant hex value followed by a field width specifier or the letter |
|
|
|
.Fr v |
|
|
|
.Fa v |
|
|
|
followed by a field width specifier (e.g., |
|
|
|
.Fr 3:4 , |
|
|
|
.Fr 3:b4 , |
|
|
|
.Fr 3:i3 , |
|
|
|
.FR v:i3 ) |
|
|
|
.Fa 3:4 , |
|
|
|
.Fa 3:b4 , |
|
|
|
.Fa 3:i3 , |
|
|
|
.Fa v:i3 ) |
|
|
|
specifies a field of a given bit or byte width. |
|
|
|
Either the constant value or (for the V specifier) the next integer value from |
|
|
|
the variable argument list is copied to the next unused |
|
|
|
bits or bytes of the CDB. |
|
|
|
.Pp |
|
|
|
A decimal number or the letter |
|
|
|
.Fr b |
|
|
|
.Fa b |
|
|
|
followed by a decimal number field width indicates a bit field of that width. |
|
|
|
The bit fields are packed as tightly as possible beginning with the |
|
|
|
high bit (so that it reads the same as the SCSI spec), and a new byte of |
|
|
|
the CDB is started whenever a byte fills completely or when an |
|
|
|
.Fr i |
|
|
|
.Fa i |
|
|
|
field is encountered. |
|
|
|
.Pp |
|
|
|
A field width specifier consisting of the letter |
|
|
|
.Fr i |
|
|
|
.Fa i |
|
|
|
followed by either |
|
|
|
1, 2, 3 or 4 indicates a 1, 2, 3 or 4 byte integral value that must |
|
|
|
be swapped into SCSI byte order (MSB first). |
|
|
|
.Pp |
|
|
|
For the |
|
|
|
.Fr v |
|
|
|
.Fa v |
|
|
|
field specifier the next integer argument is taken from the variable argument |
|
|
|
list and that value is used swapped into SCSI byte order. |
|
|
|
.Pp |
|
|
@ -246,30 +247,30 @@ The decoding is similar to |
|
|
|
the command specifier processing of |
|
|
|
.Fn scsireq_build |
|
|
|
except that the data is extracted from the data pointed to by |
|
|
|
.Fr scsireq->databuf . |
|
|
|
.Fa scsireq->databuf . |
|
|
|
The stdarg list should be pointers to integers instead of integer |
|
|
|
values. |
|
|
|
A seek field type and a suppression modifier are added. |
|
|
|
The |
|
|
|
.Fr * |
|
|
|
.Fa * |
|
|
|
suppression modifier (e.g., |
|
|
|
.Fr *i3 |
|
|
|
.Fa *i3 |
|
|
|
or |
|
|
|
.Fr *b4 ) |
|
|
|
.Fa *b4 ) |
|
|
|
suppresses assignment from the field and can be used to skip |
|
|
|
over bytes or bits in the data, without having to copy |
|
|
|
them to a dummy variable in the arg list. |
|
|
|
.Pp |
|
|
|
The seek field type |
|
|
|
.Fr s |
|
|
|
.Fa s |
|
|
|
permits you to skip over data. |
|
|
|
This seeks to an absolute position ( |
|
|
|
.Fr s3 ) |
|
|
|
or a relative position ( |
|
|
|
.Fr s+3 ) |
|
|
|
in the data, based on whether or not the presence of the '+' sign. |
|
|
|
This seeks to an absolute position |
|
|
|
.Pq Fa s3 |
|
|
|
or a relative position |
|
|
|
.Pq Fa s+3 |
|
|
|
in the data, based on whether or not the '+' sign is present. |
|
|
|
The seek value can be specified as |
|
|
|
.Fr v |
|
|
|
.Fa v |
|
|
|
and the next integer value from the argument list will be |
|
|
|
used as the seek value. |
|
|
|
.Pp |
|
|
@ -281,7 +282,7 @@ described above in |
|
|
|
.Fn scsireq_encode |
|
|
|
encodes the data phase section of the structure. |
|
|
|
The encoding is handled identically as the encoding of the CDB structure by |
|
|
|
.Fn scsireq_build |
|
|
|
.Fn scsireq_build . |
|
|
|
.Pp |
|
|
|
.Fn scsireq_enter |
|
|
|
submits the built up structure for processing using |
|
|
|