|
@ -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) |
|
|
.\" Copyright (c) 1994 HD Associates (hd@world.std.com) |
|
|
.\" All rights reserved. |
|
|
.\" All rights reserved. |
|
|
.\" |
|
|
.\" |
|
@ -140,19 +140,19 @@ builds up a scsireq structure based on the information provided in |
|
|
the variable argument list. |
|
|
the variable argument list. |
|
|
It gracefully handles a NULL pointer passed to it. |
|
|
It gracefully handles a NULL pointer passed to it. |
|
|
.Pp |
|
|
.Pp |
|
|
.Fr len |
|
|
|
|
|
|
|
|
.Fa len |
|
|
is the length of the data phase; the data transfer direction is |
|
|
is the length of the data phase; the data transfer direction is |
|
|
determined by the |
|
|
determined by the |
|
|
.Ar flags |
|
|
.Ar flags |
|
|
argument. |
|
|
argument. |
|
|
.Pp |
|
|
.Pp |
|
|
.Fr buf |
|
|
|
|
|
|
|
|
.Fa buf |
|
|
is the data buffer used during the SCSI data phase. |
|
|
is the data buffer used during the SCSI data phase. |
|
|
If it is NULL it is allocated via malloc and |
|
|
If it is NULL it is allocated via malloc and |
|
|
.Ar scsireq->databuf |
|
|
.Ar scsireq->databuf |
|
|
is set to point to the newly allocated memory. |
|
|
is set to point to the newly allocated memory. |
|
|
.Pp |
|
|
.Pp |
|
|
.Fr flags |
|
|
|
|
|
|
|
|
.Fa flags |
|
|
are the flags defined in |
|
|
are the flags defined in |
|
|
.Aq Pa sys/scsiio.h : |
|
|
.Aq Pa sys/scsiio.h : |
|
|
.Bd -literal -offset indent |
|
|
.Bd -literal -offset indent |
|
@ -163,29 +163,30 @@ are the flags defined in |
|
|
#define SCCMD_ESCAPE 0x00000010 |
|
|
#define SCCMD_ESCAPE 0x00000010 |
|
|
#define SCCMD_TARGET 0x00000020 |
|
|
#define SCCMD_TARGET 0x00000020 |
|
|
.Ed |
|
|
.Ed |
|
|
|
|
|
.Pp |
|
|
Only two of these flags are supported in this release of the software: |
|
|
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 |
|
|
indicates a data in phase (a transfer into the user buffer at |
|
|
.Ar scsireg->databuf ) , |
|
|
.Ar scsireg->databuf ) , |
|
|
and |
|
|
and |
|
|
.Fr SCCMD_WRITE |
|
|
|
|
|
|
|
|
.Fa SCCMD_WRITE |
|
|
indicates a data out phase (a transfer out of the user buffer). |
|
|
indicates a data out phase (a transfer out of the user buffer). |
|
|
.Pp |
|
|
.Pp |
|
|
.Fr fmt |
|
|
|
|
|
|
|
|
.Fa fmt |
|
|
is a CDB format specifier used to build up the SCSI CDB. |
|
|
is a CDB format specifier used to build up the SCSI CDB. |
|
|
This text string is made up of a list of field specifiers. |
|
|
This text string is made up of a list of field specifiers. |
|
|
Field specifiers specify the value for each CDB field (including indicating |
|
|
Field specifiers specify the value for each CDB field (including indicating |
|
|
that the value be taken from the next argument in the |
|
|
that the value be taken from the next argument in the |
|
|
variable argument list), the width |
|
|
variable argument list), the width |
|
|
of the field in bits or bytes, and an optional name. |
|
|
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. |
|
|
ends at the end of the current line. |
|
|
.Pp |
|
|
.Pp |
|
|
The optional name is the first part of a field specifier and |
|
|
The optional name is the first part of a field specifier and |
|
|
is in curly braces. |
|
|
is in curly braces. |
|
|
The text in curly braces in this example are the names: |
|
|
The text in curly braces in this example are the names: |
|
|
.Bd -literal -offset indent |
|
|
.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 |
|
|
.Ed |
|
|
.Pp |
|
|
.Pp |
|
|
This field specifier has two one bit fields and one six bit field. |
|
|
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. |
|
|
CDB and whitespace is ignored. |
|
|
.Pp |
|
|
.Pp |
|
|
When the field is a hex value or the letter v, (e.g., |
|
|
When the field is a hex value or the letter v, (e.g., |
|
|
.Fr "1A" |
|
|
|
|
|
|
|
|
.Fa "1A" |
|
|
or |
|
|
or |
|
|
.Fr "v" ) |
|
|
|
|
|
|
|
|
.Fa "v" ) |
|
|
then a single byte value |
|
|
then a single byte value |
|
|
is copied to the next unused byte of the CDB. |
|
|
is copied to the next unused byte of the CDB. |
|
|
When the letter |
|
|
When the letter |
|
|
.Fr v |
|
|
|
|
|
|
|
|
.Fa v |
|
|
is used the next integer argument is taken from the variable argument list |
|
|
is used the next integer argument is taken from the variable argument list |
|
|
and that value used. |
|
|
and that value used. |
|
|
.Pp |
|
|
.Pp |
|
|
A constant hex value followed by a field width specifier or the letter |
|
|
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., |
|
|
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. |
|
|
specifies a field of a given bit or byte width. |
|
|
Either the constant value or (for the V specifier) the next integer value from |
|
|
Either the constant value or (for the V specifier) the next integer value from |
|
|
the variable argument list is copied to the next unused |
|
|
the variable argument list is copied to the next unused |
|
|
bits or bytes of the CDB. |
|
|
bits or bytes of the CDB. |
|
|
.Pp |
|
|
.Pp |
|
|
A decimal number or the letter |
|
|
A decimal number or the letter |
|
|
.Fr b |
|
|
|
|
|
|
|
|
.Fa b |
|
|
followed by a decimal number field width indicates a bit field of that width. |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
the CDB is started whenever a byte fills completely or when an |
|
|
.Fr i |
|
|
|
|
|
|
|
|
.Fa i |
|
|
field is encountered. |
|
|
field is encountered. |
|
|
.Pp |
|
|
.Pp |
|
|
A field width specifier consisting of the letter |
|
|
A field width specifier consisting of the letter |
|
|
.Fr i |
|
|
|
|
|
|
|
|
.Fa i |
|
|
followed by either |
|
|
followed by either |
|
|
1, 2, 3 or 4 indicates a 1, 2, 3 or 4 byte integral value that must |
|
|
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). |
|
|
be swapped into SCSI byte order (MSB first). |
|
|
.Pp |
|
|
.Pp |
|
|
For the |
|
|
For the |
|
|
.Fr v |
|
|
|
|
|
|
|
|
.Fa v |
|
|
field specifier the next integer argument is taken from the variable argument |
|
|
field specifier the next integer argument is taken from the variable argument |
|
|
list and that value is used swapped into SCSI byte order. |
|
|
list and that value is used swapped into SCSI byte order. |
|
|
.Pp |
|
|
.Pp |
|
@ -246,30 +247,30 @@ The decoding is similar to |
|
|
the command specifier processing of |
|
|
the command specifier processing of |
|
|
.Fn scsireq_build |
|
|
.Fn scsireq_build |
|
|
except that the data is extracted from the data pointed to by |
|
|
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 |
|
|
The stdarg list should be pointers to integers instead of integer |
|
|
values. |
|
|
values. |
|
|
A seek field type and a suppression modifier are added. |
|
|
A seek field type and a suppression modifier are added. |
|
|
The |
|
|
The |
|
|
.Fr * |
|
|
|
|
|
|
|
|
.Fa * |
|
|
suppression modifier (e.g., |
|
|
suppression modifier (e.g., |
|
|
.Fr *i3 |
|
|
|
|
|
|
|
|
.Fa *i3 |
|
|
or |
|
|
or |
|
|
.Fr *b4 ) |
|
|
|
|
|
|
|
|
.Fa *b4 ) |
|
|
suppresses assignment from the field and can be used to skip |
|
|
suppresses assignment from the field and can be used to skip |
|
|
over bytes or bits in the data, without having to copy |
|
|
over bytes or bits in the data, without having to copy |
|
|
them to a dummy variable in the arg list. |
|
|
them to a dummy variable in the arg list. |
|
|
.Pp |
|
|
.Pp |
|
|
The seek field type |
|
|
The seek field type |
|
|
.Fr s |
|
|
|
|
|
|
|
|
.Fa s |
|
|
permits you to skip over data. |
|
|
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 |
|
|
The seek value can be specified as |
|
|
.Fr v |
|
|
|
|
|
|
|
|
.Fa v |
|
|
and the next integer value from the argument list will be |
|
|
and the next integer value from the argument list will be |
|
|
used as the seek value. |
|
|
used as the seek value. |
|
|
.Pp |
|
|
.Pp |
|
@ -281,7 +282,7 @@ described above in |
|
|
.Fn scsireq_encode |
|
|
.Fn scsireq_encode |
|
|
encodes the data phase section of the structure. |
|
|
encodes the data phase section of the structure. |
|
|
The encoding is handled identically as the encoding of the CDB structure by |
|
|
The encoding is handled identically as the encoding of the CDB structure by |
|
|
.Fn scsireq_build |
|
|
|
|
|
|
|
|
.Fn scsireq_build . |
|
|
.Pp |
|
|
.Pp |
|
|
.Fn scsireq_enter |
|
|
.Fn scsireq_enter |
|
|
submits the built up structure for processing using |
|
|
submits the built up structure for processing using |
|
|