xref: /freebsd/sbin/camcontrol/camcontrol.8 (revision 94d09127cb4ff69ad4536a0744ac100ef7773fba)
1525689f1SJustin T. Gibbs.\"
2525689f1SJustin T. Gibbs.\" Copyright (c) 1998 Kenneth D. Merry.
3525689f1SJustin T. Gibbs.\" All rights reserved.
4525689f1SJustin T. Gibbs.\"
5525689f1SJustin T. Gibbs.\" Redistribution and use in source and binary forms, with or without
6525689f1SJustin T. Gibbs.\" modification, are permitted provided that the following conditions
7525689f1SJustin T. Gibbs.\" are met:
8525689f1SJustin T. Gibbs.\" 1. Redistributions of source code must retain the above copyright
9525689f1SJustin T. Gibbs.\"    notice, this list of conditions and the following disclaimer.
10525689f1SJustin T. Gibbs.\" 2. Redistributions in binary form must reproduce the above copyright
11525689f1SJustin T. Gibbs.\"    notice, this list of conditions and the following disclaimer in the
12525689f1SJustin T. Gibbs.\"    documentation and/or other materials provided with the distribution.
13525689f1SJustin T. Gibbs.\" 3. The name of the author may not be used to endorse or promote products
14525689f1SJustin T. Gibbs.\"    derived from this software without specific prior written permission.
15525689f1SJustin T. Gibbs.\"
16525689f1SJustin T. Gibbs.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17525689f1SJustin T. Gibbs.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18525689f1SJustin T. Gibbs.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19525689f1SJustin T. Gibbs.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20525689f1SJustin T. Gibbs.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21525689f1SJustin T. Gibbs.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22525689f1SJustin T. Gibbs.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23525689f1SJustin T. Gibbs.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24525689f1SJustin T. Gibbs.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25525689f1SJustin T. Gibbs.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26525689f1SJustin T. Gibbs.\" SUCH DAMAGE.
27525689f1SJustin T. Gibbs.\"
2894d09127SKenneth D. Merry.\"	$Id: camcontrol.8,v 1.5 1998/10/02 21:00:38 ken Exp $
29525689f1SJustin T. Gibbs.\"
30525689f1SJustin T. Gibbs.Dd September 14, 1998
31525689f1SJustin T. Gibbs.Dt CAMCONTROL 8
32525689f1SJustin T. Gibbs.Os FreeBSD 3.0
33525689f1SJustin T. Gibbs.Sh NAME
34525689f1SJustin T. Gibbs.Nm camcontrol
35525689f1SJustin T. Gibbs.Nd CAM control program
36525689f1SJustin T. Gibbs.Sh SYNOPSIS
37525689f1SJustin T. Gibbs.Nm camcontrol
38525689f1SJustin T. Gibbs.Aq command
39525689f1SJustin T. Gibbs.Op generic args
40525689f1SJustin T. Gibbs.Op command args
41525689f1SJustin T. Gibbs.Nm camcontrol
42525689f1SJustin T. Gibbsdevlist
43525689f1SJustin T. Gibbs.Op Fl v
44525689f1SJustin T. Gibbs.Nm camcontrol
45525689f1SJustin T. Gibbsperiphlist
46525689f1SJustin T. Gibbs.Op Fl n Ar dev_name
47525689f1SJustin T. Gibbs.Op Fl u Ar unit_number
48525689f1SJustin T. Gibbs.Nm camcontrol
49525689f1SJustin T. Gibbstur
50525689f1SJustin T. Gibbs.Op generic args
51525689f1SJustin T. Gibbs.Nm camcontrol
52525689f1SJustin T. Gibbsinquiry
53525689f1SJustin T. Gibbs.Op generic args
54525689f1SJustin T. Gibbs.Op Fl D
55525689f1SJustin T. Gibbs.Op Fl S
56525689f1SJustin T. Gibbs.Op Fl R
57525689f1SJustin T. Gibbs.Nm camcontrol
58525689f1SJustin T. Gibbsstart
59525689f1SJustin T. Gibbs.Op generic args
60525689f1SJustin T. Gibbs.Nm camcontrol
61525689f1SJustin T. Gibbsstop
62525689f1SJustin T. Gibbs.Op generic args
63525689f1SJustin T. Gibbs.Nm camcontrol
64525689f1SJustin T. Gibbseject
65525689f1SJustin T. Gibbs.Op generic args
66525689f1SJustin T. Gibbs.Nm camcontrol
67525689f1SJustin T. Gibbsrescan
68525689f1SJustin T. Gibbs.Aq bus Ns Op :target:lun
69525689f1SJustin T. Gibbs.Nm camcontrol
70525689f1SJustin T. Gibbsdefects
71525689f1SJustin T. Gibbs.Op generic args
72525689f1SJustin T. Gibbs.Aq Fl f Ar format
73525689f1SJustin T. Gibbs.Op Fl P
74525689f1SJustin T. Gibbs.Op Fl G
75525689f1SJustin T. Gibbs.Nm camcontrol
76525689f1SJustin T. Gibbsmodepage
77525689f1SJustin T. Gibbs.Op generic args
78525689f1SJustin T. Gibbs.Aq Fl m Ar page
79525689f1SJustin T. Gibbs.Op Fl P Ar pagectl
80525689f1SJustin T. Gibbs.Op Fl e
81525689f1SJustin T. Gibbs.Op Fl d
82525689f1SJustin T. Gibbs.Nm camcontrol
83525689f1SJustin T. Gibbscmd
84525689f1SJustin T. Gibbs.Op generic args
85525689f1SJustin T. Gibbs.Aq Fl c Ar cmd Op args
86525689f1SJustin T. Gibbs.Op Fl i Ar len Ar fmt
87525689f1SJustin T. Gibbs.Bk -words
88525689f1SJustin T. Gibbs.Op Fl o Ar len Ar fmt Op args
89525689f1SJustin T. Gibbs.Ek
90525689f1SJustin T. Gibbs.Nm camcontrol
91525689f1SJustin T. Gibbsdebug
92525689f1SJustin T. Gibbs.Op Fl I
93525689f1SJustin T. Gibbs.Op Fl T
94525689f1SJustin T. Gibbs.Op Fl S
9594d09127SKenneth D. Merry.Op Fl c
96525689f1SJustin T. Gibbs.Aq all|off|bus Ns Op :target Ns Op :lun
97525689f1SJustin T. Gibbs.Sh DESCRIPTION
98525689f1SJustin T. Gibbs.Nm camcontrol
99525689f1SJustin T. Gibbsis a utility designed to provide a way for users to access and control the
100525689f1SJustin T. Gibbs.Tn FreeBSD
101525689f1SJustin T. GibbsCAM subsystem.
102525689f1SJustin T. Gibbs.Pp
103525689f1SJustin T. Gibbs.Nm camcontrol
104525689f1SJustin T. Gibbscan cause a loss of data and/or system crashes if used improperly.  Even
105525689f1SJustin T. Gibbsexpert users are encouraged to excercise caution when using this command.
106525689f1SJustin T. GibbsNovice users should stay away from this utility.
107525689f1SJustin T. Gibbs.Pp
108525689f1SJustin T. Gibbs.Nm camcontrol
109525689f1SJustin T. Gibbshas a number of primary functions, most of which take some generic
110525689f1SJustin T. Gibbsarguments:
111525689f1SJustin T. Gibbs.Bl -tag -width 01234567890123
112525689f1SJustin T. Gibbs.It Fl C Ar count
113525689f1SJustin T. GibbsSCSI command retry count.  In order for this to work, error recovery
114525689f1SJustin T. Gibbs.Po
115525689f1SJustin T. Gibbs.Fl E
116525689f1SJustin T. Gibbs.Pc
117525689f1SJustin T. Gibbsmust be turned on.
118525689f1SJustin T. Gibbs.It Fl E
119525689f1SJustin T. GibbsInstruct the kernel to perform generic SCSI error recovery for the given
120525689f1SJustin T. Gibbscommand.  This is needed in order for the retry count
121525689f1SJustin T. Gibbs.Po
122525689f1SJustin T. Gibbs.Fl C
123525689f1SJustin T. Gibbs.Pc
124525689f1SJustin T. Gibbsto be honored.  Other than retrying commands, the generic error recovery in
125525689f1SJustin T. Gibbsthe code will generally attempt to spin up drives that are not spinning.
126525689f1SJustin T. GibbsIt may take some other actions, depending upon the sense code returned from
127525689f1SJustin T. Gibbsthe command.
128525689f1SJustin T. Gibbs.It Fl n Ar dev_name
129525689f1SJustin T. GibbsSpecify the device type to operate on.  The default is
130525689f1SJustin T. Gibbs.Em da .
131525689f1SJustin T. Gibbs.It Fl t Ar timeout
132525689f1SJustin T. GibbsSCSI command timeout in seconds.  This overrides the default timeout for
133525689f1SJustin T. Gibbsany given command.
134525689f1SJustin T. Gibbs.It Fl u Ar unit_number
135525689f1SJustin T. GibbsSpecify the device unit number.  The default is 0.
136525689f1SJustin T. Gibbs.It Fl v
137525689f1SJustin T. GibbsBe verbose, print out sense information for failed SCSI commands.
138525689f1SJustin T. Gibbs.El
139525689f1SJustin T. Gibbs.Pp
140d13d1cd2SKenneth D. MerryPrimary command functions:
141525689f1SJustin T. Gibbs.Bl -tag -width periphlist
142525689f1SJustin T. Gibbs.It devlist
143525689f1SJustin T. GibbsList all physical devices (logical units) attached to the CAM subsystem.
144525689f1SJustin T. GibbsThis also includes a list of peripheral drivers attached to each device.
145525689f1SJustin T. GibbsWith the
146525689f1SJustin T. Gibbs.Fl v
147525689f1SJustin T. Gibbsargument, SCSI bus number, adapter name and unit numbers are printed as
148525689f1SJustin T. Gibbswell.
149525689f1SJustin T. Gibbs.It periphlist
150525689f1SJustin T. GibbsList all peripheral drivers attached to a given physical device (logical
151525689f1SJustin T. Gibbsunit).
152525689f1SJustin T. Gibbs.It tur
153525689f1SJustin T. GibbsSend the SCSI test unit ready (0x00) command to the given device.
154525689f1SJustin T. Gibbs.Nm camcontrol
155525689f1SJustin T. Gibbswill report whether the device is ready or not.
156525689f1SJustin T. Gibbs.It inquiry
157525689f1SJustin T. GibbsSend a SCSI inquiry command (0x12) to a device.  By default,
158525689f1SJustin T. Gibbs.Nm camcontrol
159525689f1SJustin T. Gibbswill print out the standard inquiry data, device serial number, and
160525689f1SJustin T. Gibbstransfer rate information.  The user can specify that only certain types of
161525689f1SJustin T. Gibbsinquiry data be printed:
162525689f1SJustin T. Gibbs.Bl -tag -width 1234
163525689f1SJustin T. Gibbs.It Fl D
164525689f1SJustin T. GibbsGet the standard inquiry data.
165525689f1SJustin T. Gibbs.It Fl S
166525689f1SJustin T. GibbsPrint out the serial number.  If this flag is the only one specified,
167525689f1SJustin T. Gibbs.Nm camcontrol
168525689f1SJustin T. Gibbswill not print out "Serial Number" before the value returned by the drive.
169525689f1SJustin T. GibbsThis is to aid in script writing.
170525689f1SJustin T. Gibbs.It Fl R
171525689f1SJustin T. GibbsPrint out transfer rate information.
172525689f1SJustin T. Gibbs.El
173525689f1SJustin T. Gibbs.It start
174525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
175525689f1SJustin T. Gibbsstart bit set.
176525689f1SJustin T. Gibbs.It stop
177525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
178525689f1SJustin T. Gibbsstart bit cleared.
179525689f1SJustin T. Gibbs.It eject
180525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
181525689f1SJustin T. Gibbsstart bit cleared and the eject bit set.
182525689f1SJustin T. Gibbs.It rescan
183525689f1SJustin T. GibbsTell the kernel to scan the given bus (XPT_SCAN_BUS), or bus:target:lun
184525689f1SJustin T. Gibbs(XPT_SCAN_LUN) for new devices or devices that have gone away.  The user
185525689f1SJustin T. Gibbsmay only specify a bus to scan, or a lun.  Scanning all luns on a target
186525689f1SJustin T. Gibbsisn't supported.
187525689f1SJustin T. Gibbs.It defects
188525689f1SJustin T. GibbsSend the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
189525689f1SJustin T. Gibbsprint out any combination of: the total number of defects, the primary
190525689f1SJustin T. Gibbsdefect list (PLIST), and the grown defect list (GLIST).
191525689f1SJustin T. Gibbs.Bl -tag -width 01234567890
192525689f1SJustin T. Gibbs.It Fl f Ar format
193525689f1SJustin T. GibbsThe three format options are:
194525689f1SJustin T. Gibbs.Em block ,
195525689f1SJustin T. Gibbsto print out the list as logical blocks,
196525689f1SJustin T. Gibbs.Em bfi ,
197525689f1SJustin T. Gibbsto print out the list in bytes from index format, and
198525689f1SJustin T. Gibbs.Em phys ,
199525689f1SJustin T. Gibbsto print out the list in physical sector format.  The format argument is
200525689f1SJustin T. Gibbsrequired.  Most drives support the physical sector format.  Some drives
201525689f1SJustin T. Gibbssupport the logical block format.  Many drives, if they don't support the
202525689f1SJustin T. Gibbsrequested format, return the data in an alternate format, along with sense
203525689f1SJustin T. Gibbsinformation indicating that the requested data format isn't supported.
204525689f1SJustin T. Gibbs.Nm camcontrol
205525689f1SJustin T. Gibbsattempts to detect this, and print out whatever format the drive returns.
206525689f1SJustin T. GibbsIf the drive uses a non-standard sense code to report that it doesn't
207525689f1SJustin T. Gibbssupport the requested format,
208525689f1SJustin T. Gibbs.Nm camcontrol
209525689f1SJustin T. Gibbswill probably see the error as a failure to complete the request.
210525689f1SJustin T. Gibbs.It Fl G
211525689f1SJustin T. GibbsPrint out the grown defect list.  This is a list of bad blocks that have
212525689f1SJustin T. Gibbsbeen remapped since the disk left the factory.
213525689f1SJustin T. Gibbs.It Fl P
214525689f1SJustin T. GibbsPrint out the primary defect list.
215525689f1SJustin T. Gibbs.El
216525689f1SJustin T. Gibbs.Pp
217525689f1SJustin T. GibbsIf neither
218525689f1SJustin T. Gibbs.Fl P
219525689f1SJustin T. Gibbsnor
220525689f1SJustin T. Gibbs.Fl G
221525689f1SJustin T. Gibbsis specified,
222525689f1SJustin T. Gibbs.Nm camcontrol
223525689f1SJustin T. Gibbswill print out the number of defects given in the READ DEFECT DATA header
224525689f1SJustin T. Gibbsreturned from the drive.
225525689f1SJustin T. Gibbs.It modepage
226525689f1SJustin T. GibbsAllows the user to display and optionally edit a SCSI mode page.  The mode
227525689f1SJustin T. Gibbspage formats are located in
228525689f1SJustin T. Gibbs.Pa /usr/share/misc/scsi_modes .
229525689f1SJustin T. GibbsThis can be overridden by specifying a different file in the
230525689f1SJustin T. Gibbs.Ev SCSI_MODES
231525689f1SJustin T. Gibbsenvironment variable.  The modepage command takes several arguments:
232525689f1SJustin T. Gibbs.Bl -tag -width 012345678901
233525689f1SJustin T. Gibbs.It Fl B
234525689f1SJustin T. GibbsDisable block descriptors for mode sense.
235525689f1SJustin T. Gibbs.It Fl e
236525689f1SJustin T. GibbsThis flag allows the user to edit values in the mode page.
237525689f1SJustin T. Gibbs.It Fl m Ar mode_page
238525689f1SJustin T. GibbsThis specifies the number of the mode page the user would like to view
239525689f1SJustin T. Gibbsand/or edit.  This argument is mandatory.
240525689f1SJustin T. Gibbs.It Fl P page_ctl
241525689f1SJustin T. GibbsThis allows the user to specify the page control field.  Possible values are:
242525689f1SJustin T. Gibbs.Bl -tag -width xxx -compact
24346a1f3b4SKenneth D. Merry.It 0
244525689f1SJustin T. GibbsCurrent values
24546a1f3b4SKenneth D. Merry.It 1
246525689f1SJustin T. GibbsChangeable values
24746a1f3b4SKenneth D. Merry.It 2
248525689f1SJustin T. GibbsDefault values
24946a1f3b4SKenneth D. Merry.It 3
250525689f1SJustin T. GibbsSaved values
251525689f1SJustin T. Gibbs.El
252525689f1SJustin T. Gibbs.El
253525689f1SJustin T. Gibbs.It cmd
254525689f1SJustin T. GibbsAllows the user to send an arbitrary SCSI CDB to any device.  The cmd
255525689f1SJustin T. Gibbsfunction requires the
256525689f1SJustin T. Gibbs.Fl c
257525689f1SJustin T. Gibbsargument to specify the CDB.  Other arguments are optional, depending on
258525689f1SJustin T. Gibbsthe command type.  The command and data specification syntax is documented
259525689f1SJustin T. Gibbsin
260525689f1SJustin T. Gibbs.Xr cam 3 .
261525689f1SJustin T. GibbsNOTE:  If the CDB specified causes data to be transfered to or from the
262525689f1SJustin T. GibbsSCSI device in question, you MUST specify either
263525689f1SJustin T. Gibbs.Fl i
264525689f1SJustin T. Gibbsor
265525689f1SJustin T. Gibbs.Fl o .
266525689f1SJustin T. Gibbs.Bl -tag -width 01234567890123456
267525689f1SJustin T. Gibbs.It Fl c Ar cmd Op args
268525689f1SJustin T. GibbsThis specifies the SCSI CDB.  CDBs may be 6, 10, 12 or 16 bytes.
269525689f1SJustin T. Gibbs.It Fl i Ar len Ar fmt
270525689f1SJustin T. GibbsThis specifies the amount of data to read, and how it should be displayed.
271525689f1SJustin T. GibbsIf the format is
272525689f1SJustin T. Gibbs.Sq - ,
273525689f1SJustin T. Gibbs.Ar len
274525689f1SJustin T. Gibbsbytes of data will be read from the device and written to standard output.
275525689f1SJustin T. Gibbs.It Fl o Ar len Ar fmt Op args
276525689f1SJustin T. GibbsThis specifies the amount of data to be written to a device, and the data
277525689f1SJustin T. Gibbsthat is to be written.  If the format is
278525689f1SJustin T. Gibbs.Sq - ,
279525689f1SJustin T. Gibbs.Ar len
280525689f1SJustin T. Gibbsbytes of data will be read from standard input and written to the device.
281525689f1SJustin T. Gibbs.El
282525689f1SJustin T. Gibbs.It debug
283525689f1SJustin T. GibbsTurn on CAM debugging printfs in the kernel.  This requires options CAMDEBUG
284525689f1SJustin T. Gibbsin your kernel config file.  WARNING:  enabling debugging printfs currently
285525689f1SJustin T. Gibbscauses an EXTREME number of kernel printfs.  You may have difficulty
286525689f1SJustin T. Gibbsturning off the debugging printfs once they start, since the kernel will be
287525689f1SJustin T. Gibbsbusy printing messages and unable to service other requests quickly.
288525689f1SJustin T. GibbsThe debug function takes a number of arguments:
289525689f1SJustin T. Gibbs.Bl -tag -width 012345678901234567
290525689f1SJustin T. Gibbs.It Fl I
291525689f1SJustin T. GibbsEnable CAM_DEBUG_INFO printfs.
292525689f1SJustin T. Gibbs.It Fl T
293525689f1SJustin T. GibbsEnable CAM_DEBUG_TRACE printfs.
294525689f1SJustin T. Gibbs.It Fl S
295525689f1SJustin T. GibbsEnable CAM_DEBUG_SUBTRACE printfs.
296d05caa00SKenneth D. Merry.It Fl c
297d05caa00SKenneth D. MerryEnable CAM_DEBUG_CDB printfs.  This will cause the kernel to print out the
298d05caa00SKenneth D. MerrySCSI CDBs sent to the specified device(s).
299525689f1SJustin T. Gibbs.It all
300525689f1SJustin T. GibbsEnable debugging for all devices.
301525689f1SJustin T. Gibbs.It off
302525689f1SJustin T. GibbsTurn off debugging for all devices
303525689f1SJustin T. Gibbs.It bus Ns Op :target Ns Op :lun
304525689f1SJustin T. GibbsTurn on debugging for the given bus, target or lun.  If the lun or target
305525689f1SJustin T. Gibbsand lun are not specified, they are wildcarded.  (i.e., just specifying a
306525689f1SJustin T. Gibbsbus turns on debugging printfs for all devices on that bus.)
307525689f1SJustin T. Gibbs.El
308525689f1SJustin T. Gibbs.El
309525689f1SJustin T. Gibbs.Sh ENVIRONMENT
310525689f1SJustin T. GibbsThe
311525689f1SJustin T. Gibbs.Ev SCSI_MODES
312525689f1SJustin T. Gibbsvariable allows the user to specify an alternate mode page format file.
313525689f1SJustin T. Gibbs.Pp
314525689f1SJustin T. GibbsThe
315525689f1SJustin T. Gibbs.Ev EDITOR
316525689f1SJustin T. Gibbsvariable determines which text editor
317525689f1SJustin T. Gibbs.Nm camcontrol
318525689f1SJustin T. Gibbsstarts when editing mode pages.
319525689f1SJustin T. Gibbs.Sh FILES
320525689f1SJustin T. Gibbs.Bl -tag -width /usr/share/misc/scsi_modes -compact
321525689f1SJustin T. Gibbs.It Pa /usr/share/misc/scsi_modes
322525689f1SJustin T. Gibbsis the SCSI mode format database.
323525689f1SJustin T. Gibbs.It Pa /dev/xpt0
324525689f1SJustin T. Gibbsis the transport layer device.
325525689f1SJustin T. Gibbs.It Pa /dev/pass*
326525689f1SJustin T. Gibbsare the CAM application passthrough devices.
327525689f1SJustin T. Gibbs.El
328525689f1SJustin T. Gibbs.Sh EXAMPLES
329525689f1SJustin T. Gibbs.Dl camcontrol eject -n cd -u 1 -v
330525689f1SJustin T. Gibbs.Pp
331525689f1SJustin T. GibbsEject the CD from cd1, and print SCSI sense information if the command
332525689f1SJustin T. Gibbsfails.
333525689f1SJustin T. Gibbs.Pp
334525689f1SJustin T. Gibbs.Dl camcontrol tur
335525689f1SJustin T. Gibbs.Pp
336525689f1SJustin T. GibbsSend the SCSI test unit ready command to da0.
337525689f1SJustin T. Gibbs.Nm camcontrol
338525689f1SJustin T. Gibbswill report whether the disk is ready, but will not display sense
339525689f1SJustin T. Gibbsinformation if the command fails since the
340525689f1SJustin T. Gibbs.Fl v
341525689f1SJustin T. Gibbsswitch was not specified.
342525689f1SJustin T. Gibbs.Pp
343525689f1SJustin T. Gibbs.Bd -literal -offset foobar
344525689f1SJustin T. Gibbscamcontrol tur -n da -u 1 -E -C 4 -t 50 -v
345525689f1SJustin T. Gibbs.Ed
346525689f1SJustin T. Gibbs.Pp
347525689f1SJustin T. GibbsSend a test unit ready command to da1.  Enable kernel error recovery.
348525689f1SJustin T. GibbsSpecify a retry count of 4, and a timeout of 50 seconds.  Enable sense
349525689f1SJustin T. Gibbsprinting (with the
350525689f1SJustin T. Gibbs.Fl v
351525689f1SJustin T. Gibbsflag) if the command fails.  Since error recovery is turned on, the
352525689f1SJustin T. Gibbsdisk will be spun up if it is not currently spinning.
353525689f1SJustin T. Gibbs.Nm camcontrol
3548ff6dbfcSKenneth D. Merrywill report whether the disk is ready.
355525689f1SJustin T. Gibbs.Bd -literal -offset foobar
356525689f1SJustin T. Gibbscamcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
357525689f1SJustin T. Gibbs	-i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
358525689f1SJustin T. Gibbs.Ed
359525689f1SJustin T. Gibbs.Pp
360525689f1SJustin T. GibbsIssue a READ BUFFER command (0x3C) to cd1.  Display the buffer size of cd1,
361525689f1SJustin T. Gibbsand display the first 10 bytes from the cache on cd1.  Display SCSI sense
362525689f1SJustin T. Gibbsinformation if the command fails.
363525689f1SJustin T. Gibbs.Pp
364525689f1SJustin T. Gibbs.Bd -literal -offset foobar
365525689f1SJustin T. Gibbscamcontrol cmd -n cd -u u -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
366525689f1SJustin T. Gibbs	-o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
367525689f1SJustin T. Gibbs.Ed
368525689f1SJustin T. Gibbs.Pp
369525689f1SJustin T. GibbsIssue a WRITE BUFFER (0x3B) command to cd1.  Write out 10 bytes of data,
370525689f1SJustin T. Gibbsnot including the (reserved) 4 byte header.  Print out sense information if
371525689f1SJustin T. Gibbsthe command fails.  Be very careful with this command, improper use may
372525689f1SJustin T. Gibbscause data corruption.
373525689f1SJustin T. Gibbs.Pp
37494d09127SKenneth D. Merry.Bd -literal -offset foobar
37594d09127SKenneth D. Merrycamcontrol modepage -n da -u 3 -m 1 -e -P 3
37694d09127SKenneth D. Merry.Ed
377525689f1SJustin T. Gibbs.Pp
378525689f1SJustin T. GibbsEdit mode page 1 (the Read-Write Error Recover page) for da3, and save the
379525689f1SJustin T. Gibbssettings on the drive.  Mode page 1 contains a disk drive's auto read and
380525689f1SJustin T. Gibbswrite reallocation settings, among other things.
381525689f1SJustin T. Gibbs.Pp
382525689f1SJustin T. Gibbs.Dl camcontrol rescan 0
383525689f1SJustin T. Gibbs.Pp
384525689f1SJustin T. GibbsRescan SCSI bus 0 for devices that have been added, removed or changed.
385525689f1SJustin T. Gibbs.Pp
386525689f1SJustin T. Gibbs.Dl camcontrol rescan 0:1:0
387525689f1SJustin T. Gibbs.Pp
388525689f1SJustin T. GibbsRescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
389525689f1SJustin T. Gibbschanged.
390525689f1SJustin T. Gibbs.Sh SEE ALSO
391525689f1SJustin T. Gibbs.Xr cam 3 ,
392525689f1SJustin T. Gibbs.Xr pass 4 ,
393525689f1SJustin T. Gibbs.Xr cam 9 ,
394525689f1SJustin T. Gibbs.Xr xpt 9
395525689f1SJustin T. Gibbs.Sh HISTORY
396525689f1SJustin T. GibbsThe
397525689f1SJustin T. Gibbs.Nm camcontrol
398525689f1SJustin T. Gibbscommand first appeared in
399525689f1SJustin T. Gibbs.Fx 3.0 .
400525689f1SJustin T. Gibbs.Pp
401525689f1SJustin T. GibbsThe mode page editing code and arbitrary SCSI command code are based upon
402525689f1SJustin T. Gibbscode in the old
403525689f1SJustin T. Gibbs.Xr scsi 8
404525689f1SJustin T. Gibbsutility and
405525689f1SJustin T. Gibbs.Xr scsi 3
406525689f1SJustin T. Gibbslibrary, written by Julian Ellischer and Peter Dufault.  The
407525689f1SJustin T. Gibbs.Xr scsi 8
408525689f1SJustin T. Gibbsfirst appeared in 386BSD 0.1.2.4, and first appeared in
409525689f1SJustin T. Gibbs.Tn FreeBSD
410525689f1SJustin T. Gibbsin
411525689f1SJustin T. Gibbs.Fx 2.0.5 .
412525689f1SJustin T. Gibbs.Sh AUTHORS
413525689f1SJustin T. Gibbs.An Kenneth Merry Aq ken@FreeBSD.ORG
414525689f1SJustin T. Gibbs.Sh BUGS
415525689f1SJustin T. GibbsMost of the man page cross references don't exist yet.  This will be fixed
416525689f1SJustin T. Gibbssoon.
417525689f1SJustin T. Gibbs.Pp
418525689f1SJustin T. GibbsThe code that parses the generic command line arguments doesn't know that
419525689f1SJustin T. Gibbssome of the subcommands take multiple arguments.  So if, for instance, you
420525689f1SJustin T. Gibbstried something like this:
421525689f1SJustin T. Gibbs.Bd -literal -offset foobar
422525689f1SJustin T. Gibbscamcontrol -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
423525689f1SJustin T. Gibbs.Ed
424525689f1SJustin T. Gibbs.Pp
425525689f1SJustin T. GibbsThe sense information from the test unit ready command would not get
426525689f1SJustin T. Gibbsprinted out, since the first
427525689f1SJustin T. Gibbs.Xr getopt 3
428525689f1SJustin T. Gibbscall in
429525689f1SJustin T. Gibbs.Nm camcontrol
430525689f1SJustin T. Gibbsbails out when it sees the second argument to
431525689f1SJustin T. Gibbs.Fl c
432525689f1SJustin T. Gibbs.Po
433525689f1SJustin T. Gibbs0x00
434525689f1SJustin T. Gibbs.Pc ,
435525689f1SJustin T. Gibbsabove.  Fixing this behavior would take some gross code, or changes to the
436525689f1SJustin T. Gibbs.Xr getopt 3
437525689f1SJustin T. Gibbsinterface.  The best way to circumvent this problem is to always make sure
438525689f1SJustin T. Gibbsto specify generic
439525689f1SJustin T. Gibbs.Nm camcontrol
440525689f1SJustin T. Gibbsarguments before any command-specific arguments.
441525689f1SJustin T. Gibbs.Pp
442525689f1SJustin T. GibbsIt might be nice to add a way to allow users to specify devices by
443525689f1SJustin T. Gibbsbus/target/lun or by device string (e.g. "da1").
444