1995-01-24 12:07:27 +00:00
|
|
|
.\"
|
|
|
|
.\" Written By Julian ELischer
|
|
|
|
.\" Copyright julian Elischer 1993.
|
|
|
|
.\" Permission is granted to use or redistribute this file in any way as long
|
|
|
|
.\" as this notice remains. Julian Elischer does not guarantee that this file
|
|
|
|
.\" is totally correct for any given task and users of this file must
|
|
|
|
.\" accept responsibility for any damage that occurs from the application of this
|
|
|
|
.\" file.
|
|
|
|
.\"
|
|
|
|
.\" (julian@tfs.com julian@dialix.oz.au)
|
|
|
|
.\" User SCSI hooks added by Peter Dufault:
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1994 HD Associates
|
|
|
|
.\" (contact: dufault@hda.com)
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The name of HD Associates
|
|
|
|
.\" may not be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\"
|
1998-06-03 03:59:00 +00:00
|
|
|
.\" $Id: scsi.8,v 1.16 1998/01/03 10:11:38 brian Exp $
|
1995-01-24 12:07:27 +00:00
|
|
|
.\"
|
|
|
|
.Dd October 11, 1993
|
1995-05-01 12:35:05 +00:00
|
|
|
.Dt SCSI 8
|
1995-01-24 12:07:27 +00:00
|
|
|
.Os BSD 4
|
|
|
|
.Sh NAME
|
|
|
|
.Nm scsi
|
1997-06-18 06:37:23 +00:00
|
|
|
.Nd program to assist with scsi devices
|
1995-01-24 12:07:27 +00:00
|
|
|
.Sh SYNOPSIS
|
1997-03-19 22:42:02 +00:00
|
|
|
.Nm scsi
|
|
|
|
.Fl f Ar device
|
|
|
|
.Fl d Ar debug_level
|
|
|
|
.Nm scsi
|
|
|
|
.Fl f Ar device
|
|
|
|
.Fl z Ar seconds
|
|
|
|
.Op Fl v
|
|
|
|
.Nm scsi
|
|
|
|
.Fl f Ar device
|
|
|
|
.Fl m Ar page
|
|
|
|
.Op Fl P Ar pc
|
|
|
|
.Op Fl e
|
|
|
|
.Nm scsi
|
|
|
|
.Fl f Ar device
|
|
|
|
.Fl p
|
|
|
|
.Op Fl b Ar bus
|
|
|
|
.Op Fl l Ar lun
|
|
|
|
.Nm scsi
|
|
|
|
.Fl f Ar device
|
|
|
|
.Fl r
|
|
|
|
.Op Fl b Ar bus
|
|
|
|
.Op Fl t Ar targ
|
1997-06-18 06:37:23 +00:00
|
|
|
.Op Fl l Ar lun
|
1997-03-19 22:42:02 +00:00
|
|
|
.Nm scsi
|
|
|
|
.Fl f Ar device
|
|
|
|
.Fl c Ar cmd_fmt
|
|
|
|
.Op Ar arg0 ... argn
|
|
|
|
.Op Fl s Ar seconds
|
|
|
|
.Op Fl v
|
|
|
|
.Fl o Ar count out_fmt
|
|
|
|
.Op Ar arg0 ... argn
|
|
|
|
.Fl i Ar count in_fmt
|
1995-01-24 12:07:27 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm scsi
|
|
|
|
program is used to send commands to a scsi device. It is also
|
|
|
|
a sample usage of the user level SCSI commands.
|
|
|
|
.Pp
|
|
|
|
The
|
1997-12-29 15:17:57 +00:00
|
|
|
.Fl f
|
|
|
|
option must be specified, and
|
|
|
|
.Ar device
|
|
|
|
must be the name of a functional SCSI device. If the device is a
|
1998-01-03 10:11:38 +00:00
|
|
|
disk device, it should be the control device,
|
|
|
|
.Pq for example Pa /dev/rsd0.ctl .
|
1997-12-29 15:17:57 +00:00
|
|
|
Use the
|
|
|
|
.Fl p
|
|
|
|
option with the
|
|
|
|
.Sq super scsi
|
|
|
|
device to reprobe a bus where there are currently no valid devices
|
|
|
|
attached.
|
|
|
|
.Pp
|
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl d
|
1995-01-24 12:07:27 +00:00
|
|
|
option sets the SCSI kernel debug level. The kernel must have been compiled
|
|
|
|
with the
|
1997-03-19 22:42:02 +00:00
|
|
|
.Dv SCSIDEBUG
|
1995-01-24 12:07:27 +00:00
|
|
|
option. See
|
1997-03-19 22:42:02 +00:00
|
|
|
.Pa /sys/scsi/scsi_debug.h
|
1995-01-24 12:07:27 +00:00
|
|
|
to figure out what to set the kernel debug level to.
|
|
|
|
.Pp
|
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl z
|
1995-04-28 19:24:39 +00:00
|
|
|
option freezes all activity on all SCSI busses for a given number of
|
|
|
|
seconds. If
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl v
|
1995-04-28 19:24:39 +00:00
|
|
|
is also specified then a BEL character is sent to the standard
|
|
|
|
output at the start and finish of the bus freeze.
|
1997-03-19 22:42:02 +00:00
|
|
|
This requires that the kernel be built with the
|
|
|
|
.Dv SCSI_FREEZE
|
|
|
|
kernel option.
|
1995-04-28 19:24:39 +00:00
|
|
|
This kernel code is not committed yet.
|
|
|
|
.Pp
|
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl m
|
1995-04-28 19:24:39 +00:00
|
|
|
option is used to read a device mode page. The file
|
1997-03-19 22:42:02 +00:00
|
|
|
.Pa /usr/share/misc/scsi_modes
|
1995-04-28 19:24:39 +00:00
|
|
|
is read to look at for how to interpret the mode data. The environment
|
1997-03-19 22:42:02 +00:00
|
|
|
variable
|
|
|
|
.Ev SCSI_MODES
|
|
|
|
can specify a different file to use.
|
1995-05-05 20:42:00 +00:00
|
|
|
.Pp
|
1995-04-28 19:24:39 +00:00
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl P
|
1995-04-28 19:24:39 +00:00
|
|
|
option can be used to specify a page control field. The page control
|
1997-03-19 22:42:02 +00:00
|
|
|
fields are:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width xxxx -indent offset -compact
|
|
|
|
.It 0
|
|
|
|
Current Values
|
|
|
|
.It 1
|
|
|
|
Changeable Values
|
|
|
|
.It 2
|
|
|
|
Default Values
|
|
|
|
.It 3
|
|
|
|
Saved Values
|
|
|
|
.El
|
1995-04-28 19:24:39 +00:00
|
|
|
.Pp
|
1995-05-05 20:42:00 +00:00
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl e
|
1995-05-05 20:42:00 +00:00
|
|
|
option permits you to edit the fields. It will use the editor specified
|
1997-03-19 22:42:02 +00:00
|
|
|
by your
|
|
|
|
.Ev EDITOR
|
|
|
|
environment variable. To store changes permanently,
|
1995-05-05 20:42:00 +00:00
|
|
|
edit page control 3 using the
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl P
|
1997-12-29 15:17:57 +00:00
|
|
|
option.
|
1995-04-28 19:24:39 +00:00
|
|
|
.Pp
|
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl p
|
1997-12-29 15:17:57 +00:00
|
|
|
option can be used against the
|
|
|
|
.Sq super scsi
|
|
|
|
device
|
1997-12-19 14:14:26 +00:00
|
|
|
.Pa /dev/ssc
|
1995-01-24 12:07:27 +00:00
|
|
|
to probe all devices with a given SCSI lun on a given SCSI bus.
|
1997-06-18 06:37:23 +00:00
|
|
|
The bus can be selected with the
|
|
|
|
.Fl b
|
|
|
|
option and the default is 0.
|
|
|
|
The lun can be selected with the
|
|
|
|
.Fl l
|
|
|
|
option and the default is 0.
|
1995-01-24 12:07:27 +00:00
|
|
|
.Pp
|
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl r
|
1998-01-03 10:11:38 +00:00
|
|
|
option can be used to reprobe all SCSI devices on all SCSI busses that
|
|
|
|
were present at boot-time. See
|
1995-01-24 12:07:27 +00:00
|
|
|
.Xr scsi 4
|
|
|
|
for a description of fixed scsi devices.
|
|
|
|
.Pp
|
|
|
|
The
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl c
|
1995-01-24 12:07:27 +00:00
|
|
|
option permits you to send user level SCSI commands specified on
|
|
|
|
the command line to a
|
1997-03-19 22:42:02 +00:00
|
|
|
device. The command is sent using the
|
|
|
|
.Dv SCIOCCOMMAND
|
|
|
|
ioctl, so the
|
1995-01-24 12:07:27 +00:00
|
|
|
device you are accessing must permit this ioctl. See
|
|
|
|
.Xr scsi 4
|
|
|
|
for full details of which minor devices permit the ioctl, and
|
|
|
|
.Xr scsi 3
|
|
|
|
for the full details on how to build up the commands and data phases
|
|
|
|
using the format arguments.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl v
|
1995-01-24 12:07:27 +00:00
|
|
|
turns on more verbose information.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl s
|
1995-05-01 12:35:05 +00:00
|
|
|
sets the command timeout in seconds. The default is two seconds.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl c Ar cmd_fmt
|
1995-01-24 12:07:27 +00:00
|
|
|
specifies the command as described in
|
|
|
|
.Xr scsi 3 "."
|
|
|
|
The additional arguments provide values for any variables
|
1997-08-24 08:50:25 +00:00
|
|
|
specified in the command format. Note that the arguments to the
|
|
|
|
.Fl c
|
|
|
|
option are hexadecimal numbers, while all normal arguments on the
|
|
|
|
command-line are subject to the common
|
|
|
|
.Dq C
|
|
|
|
number notation.
|
1995-01-24 12:07:27 +00:00
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl o
|
|
|
|
.Ar count
|
|
|
|
.Ar out_fmt
|
|
|
|
.Op Ar arg0 ... argn
|
1995-01-24 12:07:27 +00:00
|
|
|
indicates that this is a data out command (i.e., data will be sent from
|
|
|
|
the system to the device) with
|
|
|
|
.Fr count
|
|
|
|
bytes of data. The data out is built up using the facilities described in
|
|
|
|
.Xr scsi 3
|
|
|
|
using the provided arguments to fill in any integer variables.
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ar out_fmt
|
1995-01-24 12:07:27 +00:00
|
|
|
can be specified as a hyphen ("-") to indicate that the
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ar count
|
1995-01-24 12:07:27 +00:00
|
|
|
bytes of data should be read from the standard input.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
.Fl i Ar count Ar in_fmt
|
1995-01-24 12:07:27 +00:00
|
|
|
indicates that this is a data in command (i.e., data will be read from
|
|
|
|
the device into the system) with
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ar count
|
1995-01-24 12:07:27 +00:00
|
|
|
bytes of data read in. The information is extracted according to
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ar in_fmt
|
1995-01-24 12:07:27 +00:00
|
|
|
using the facilities described in
|
|
|
|
.Xr scsi 3
|
|
|
|
and displayed on the standard output.
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ar in_fmt
|
1995-01-24 12:07:27 +00:00
|
|
|
can be specified as a hyphen ("-") to indicate that the
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ar count
|
1995-01-24 12:07:27 +00:00
|
|
|
bytes of data input should be written to the standard output.
|
|
|
|
.Sh EXAMPLES
|
1997-08-24 08:50:25 +00:00
|
|
|
To verify that the device type for the disk
|
|
|
|
.Pa /dev/rsd0c
|
|
|
|
is 0 (direct access device):
|
1997-12-29 21:08:33 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
root# scsi -f /dev/rsd0c -c "12 0 0 0 40 0" -i 64 "*b3 b5" 0
|
1995-01-24 12:07:27 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
1997-08-24 08:50:25 +00:00
|
|
|
To do an inquiry to
|
|
|
|
.Pa /dev/rsd2c :
|
1997-12-29 21:08:33 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
root# scsi -f /dev/rsd2c -c "12 0 0 0 v 0" 0x40 -i 64 \e
|
1998-06-03 03:59:00 +00:00
|
|
|
"s8 z8 z16 z4"
|
1997-08-24 08:50:25 +00:00
|
|
|
.Ed
|
1995-05-05 20:42:00 +00:00
|
|
|
.Pp
|
1997-08-24 08:50:25 +00:00
|
|
|
To edit mode page 1 (the Read-Write Error Recovery Page)
|
|
|
|
on
|
|
|
|
.Pa /dev/rsd2c ,
|
|
|
|
and store it permanently on the
|
1995-05-05 20:42:00 +00:00
|
|
|
drive:
|
1997-12-29 21:08:33 +00:00
|
|
|
.Bd -literal -offset indent
|
1995-05-05 20:42:00 +00:00
|
|
|
root# scsi -f /dev/rsd2c -m 1 -e -P 3
|
1995-01-24 12:07:27 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
1997-12-29 21:08:33 +00:00
|
|
|
To simply re-probe the first scsi bus:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
root# scsi -f /dev/ssc -p
|
|
|
|
.Ed
|
|
|
|
.Pp
|
1995-04-28 19:24:39 +00:00
|
|
|
.Sh ENVIRONMENT
|
1997-03-19 22:42:02 +00:00
|
|
|
The
|
|
|
|
.Ev SU_DEBUG_OUTPUT
|
|
|
|
variable can be set to a file to send debugging
|
1995-04-28 19:24:39 +00:00
|
|
|
output to that file.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
The
|
|
|
|
.Ev SU_DEBUG_LEVEL
|
|
|
|
variable can be set to a non-zero integer to increase
|
1995-04-28 19:24:39 +00:00
|
|
|
the level of debugging. Currently this is a on or off thing; it should
|
|
|
|
perhaps use the ioctl to set the debug level in the kernel and then set
|
|
|
|
it back to zero at program exit.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
The
|
|
|
|
.Ev SU_DEBUG_TRUNCATE
|
|
|
|
variable can be set to an integer to limit the
|
1995-04-28 19:24:39 +00:00
|
|
|
amount of data phase output sent to the debugging file.
|
1995-05-05 20:42:00 +00:00
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
The
|
|
|
|
.Ev EDITOR
|
|
|
|
variable determines the editor to use for the mode editor.
|
1995-01-24 12:07:27 +00:00
|
|
|
.Sh SEE ALSO
|
1997-01-13 00:25:51 +00:00
|
|
|
.Xr scsi 3 ,
|
1997-12-29 21:08:33 +00:00
|
|
|
.Xr scsi 4 ,
|
|
|
|
.Xr ssc 4
|
1995-01-24 12:07:27 +00:00
|
|
|
.Sh BUGS
|
|
|
|
.Pp
|
|
|
|
Some devices respond to an inquiry for all LUNS. This will cause them
|
|
|
|
to come on line to 8 times during reprobe to different logical units.
|
|
|
|
.Pp
|
1997-03-19 22:42:02 +00:00
|
|
|
The
|
|
|
|
.Fl i
|
|
|
|
option to do an inquiry went away in
|
|
|
|
.Fx 2.1 .
|
|
|
|
The new facilities
|
|
|
|
provided by
|
|
|
|
.Fl c
|
|
|
|
supercede that.
|
1995-01-24 12:07:27 +00:00
|
|
|
.Pp
|
|
|
|
Check your permissions carefully.
|
1997-03-19 22:42:02 +00:00
|
|
|
.Ql scsi -f /dev/rsd0c -c "4 0 0 0 0 0
|
|
|
|
permits anyone who can open
|
|
|
|
.Pa /dev/rsd0c
|
|
|
|
to format the disk drive. This must be changed to
|
1995-01-24 12:07:27 +00:00
|
|
|
at least require write access to the drive.
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm scsi
|
1997-03-19 22:42:02 +00:00
|
|
|
command appeared in 386BSD 0.1.2.4 to support the new reprobe
|
|
|
|
and user SCSI commands. It first appeared in
|
|
|
|
.Tn FreeBSD
|
|
|
|
in
|
|
|
|
.Fx 2.0.5 .
|