]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - sbin/camcontrol/camcontrol.8
MFstable/10 r249373:
[FreeBSD/stable/9.git] / sbin / camcontrol / camcontrol.8
1 .\"
2 .\" Copyright (c) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Kenneth D. Merry.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. The name of the author may not be used to endorse or promote products
14 .\"    derived from this software without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd August 31, 2014
31 .Dt CAMCONTROL 8
32 .Os
33 .Sh NAME
34 .Nm camcontrol
35 .Nd CAM control program
36 .Sh SYNOPSIS
37 .Nm
38 .Aq Ar command
39 .Op device id
40 .Op generic args
41 .Op command args
42 .Nm
43 .Ic devlist
44 .Op Fl v
45 .Nm
46 .Ic periphlist
47 .Op device id
48 .Op Fl n Ar dev_name
49 .Op Fl u Ar unit_number
50 .Nm
51 .Ic tur
52 .Op device id
53 .Op generic args
54 .Nm
55 .Ic inquiry
56 .Op device id
57 .Op generic args
58 .Op Fl D
59 .Op Fl S
60 .Op Fl R
61 .Nm
62 .Ic identify
63 .Op device id
64 .Op generic args
65 .Op Fl v
66 .Nm
67 .Ic reportluns
68 .Op device id
69 .Op generic args
70 .Op Fl c
71 .Op Fl l
72 .Op Fl r Ar reporttype
73 .Nm
74 .Ic readcap
75 .Op device id
76 .Op generic args
77 .Op Fl b
78 .Op Fl h
79 .Op Fl H
80 .Op Fl N
81 .Op Fl q
82 .Op Fl s
83 .Nm
84 .Ic start
85 .Op device id
86 .Op generic args
87 .Nm
88 .Ic stop
89 .Op device id
90 .Op generic args
91 .Nm
92 .Ic load
93 .Op device id
94 .Op generic args
95 .Nm
96 .Ic eject
97 .Op device id
98 .Op generic args
99 .Nm
100 .Ic rescan
101 .Aq all | bus Ns Op :target:lun
102 .Nm
103 .Ic reset
104 .Aq all | bus Ns Op :target:lun
105 .Nm
106 .Ic defects
107 .Op device id
108 .Op generic args
109 .Aq Fl f Ar format
110 .Op Fl P
111 .Op Fl G
112 .Nm
113 .Ic modepage
114 .Op device id
115 .Op generic args
116 .Aq Fl m Ar page | Fl l
117 .Op Fl P Ar pgctl
118 .Op Fl b | Fl e
119 .Op Fl d
120 .Nm
121 .Ic cmd
122 .Op device id
123 .Op generic args
124 .Aq Fl a Ar cmd Op args
125 .Aq Fl c Ar cmd Op args
126 .Op Fl d
127 .Op Fl f
128 .Op Fl i Ar len Ar fmt
129 .Bk -words
130 .Op Fl o Ar len Ar fmt Op args
131 .Op Fl r Ar fmt
132 .Ek
133 .Nm
134 .Ic smpcmd
135 .Op device id
136 .Op generic args
137 .Aq Fl r Ar len Ar fmt Op args
138 .Aq Fl R Ar len Ar fmt Op args
139 .Nm
140 .Ic smprg
141 .Op device id
142 .Op generic args
143 .Op Fl l
144 .Nm
145 .Ic smppc
146 .Op device id
147 .Op generic args
148 .Aq Fl p Ar phy
149 .Op Fl l
150 .Op Fl o Ar operation
151 .Op Fl d Ar name
152 .Op Fl m Ar rate
153 .Op Fl M Ar rate
154 .Op Fl T Ar pp_timeout
155 .Op Fl a Ar enable|disable
156 .Op Fl A Ar enable|disable
157 .Op Fl s Ar enable|disable
158 .Op Fl S Ar enable|disable
159 .Nm
160 .Ic smpphylist
161 .Op device id
162 .Op generic args
163 .Op Fl l
164 .Op Fl q
165 .Nm
166 .Ic smpmaninfo
167 .Op device id
168 .Op generic args
169 .Op Fl l
170 .Nm
171 .Ic debug
172 .Op Fl I
173 .Op Fl P
174 .Op Fl T
175 .Op Fl S
176 .Op Fl X
177 .Op Fl c
178 .Op Fl p
179 .Aq all|off|bus Ns Op :target Ns Op :lun
180 .Nm
181 .Ic tags
182 .Op device id
183 .Op generic args
184 .Op Fl N Ar tags
185 .Op Fl q
186 .Op Fl v
187 .Nm
188 .Ic negotiate
189 .Op device id
190 .Op generic args
191 .Op Fl c
192 .Op Fl D Ar enable|disable
193 .Op Fl M Ar mode
194 .Op Fl O Ar offset
195 .Op Fl q
196 .Op Fl R Ar syncrate
197 .Op Fl T Ar enable|disable
198 .Op Fl U
199 .Op Fl W Ar bus_width
200 .Op Fl v
201 .Nm
202 .Ic format
203 .Op device id
204 .Op generic args
205 .Op Fl q
206 .Op Fl r
207 .Op Fl w
208 .Op Fl y
209 .Nm
210 .Ic sanitize
211 .Op device id
212 .Op generic args
213 .Aq Fl a Ar overwrite | block | crypto | exitfailure
214 .Op Fl c Ar passes
215 .Op Fl I
216 .Op Fl P Ar pattern
217 .Op Fl q
218 .Op Fl U
219 .Op Fl r
220 .Op Fl w
221 .Op Fl y
222 .Nm
223 .Ic idle
224 .Op device id
225 .Op generic args
226 .Op Fl t Ar time
227 .Nm
228 .Ic standby
229 .Op device id
230 .Op generic args
231 .Op Fl t Ar time
232 .Nm
233 .Ic sleep
234 .Op device id
235 .Op generic args
236 .Nm
237 .Ic fwdownload
238 .Op device id
239 .Op generic args
240 .Aq Fl f Ar fw_image
241 .Op Fl y
242 .Op Fl s
243 .Nm
244 .Ic security
245 .Op device id
246 .Op generic args
247 .Op Fl d Ar pwd
248 .Op Fl e Ar pwd
249 .Op Fl f
250 .Op Fl h Ar pwd
251 .Op Fl k Ar pwd
252 .Op Fl l Ar high|maximum
253 .Op Fl q
254 .Op Fl s Ar pwd
255 .Op Fl T Ar timeout
256 .Op Fl U Ar user|master
257 .Op Fl y
258 .Nm
259 .Ic hpa
260 .Op device id
261 .Op generic args
262 .Op Fl f
263 .Op Fl l
264 .Op Fl P
265 .Op Fl p Ar pwd
266 .Op Fl q
267 .Op Fl s Ar max_sectors
268 .Op Fl U Ar pwd
269 .Op Fl y
270 .Nm
271 .Ic help
272 .Sh DESCRIPTION
273 The
274 .Nm
275 utility is designed to provide a way for users to access and control the
276 .Fx
277 CAM subsystem.
278 .Pp
279 The
280 .Nm
281 utility
282 can cause a loss of data and/or system crashes if used improperly.
283 Even
284 expert users are encouraged to exercise caution when using this command.
285 Novice users should stay away from this utility.
286 .Pp
287 The
288 .Nm
289 utility has a number of primary functions, many of which support an optional
290 device identifier.
291 A device identifier can take one of three forms:
292 .Bl -tag -width 14n
293 .It deviceUNIT
294 Specify a device name and unit number combination, like "da5" or "cd3".
295 .It bus:target
296 Specify a bus number and target id.
297 The bus number can be determined from
298 the output of
299 .Dq camcontrol devlist .
300 The lun defaults to 0.
301 .It bus:target:lun
302 Specify the bus, target and lun for a device.
303 (e.g.\& 1:2:0)
304 .El
305 .Pp
306 The device identifier, if it is specified,
307 .Em must
308 come immediately after the function name, and before any generic or
309 function-specific arguments.
310 Note that the
311 .Fl n
312 and
313 .Fl u
314 arguments described below will override any device name or unit number
315 specified beforehand.
316 The
317 .Fl n
318 and
319 .Fl u
320 arguments will
321 .Em not
322 override a specified bus:target or bus:target:lun, however.
323 .Pp
324 Most of the
325 .Nm
326 primary functions support these generic arguments:
327 .Bl -tag -width 14n
328 .It Fl C Ar count
329 SCSI command retry count.
330 In order for this to work, error recovery
331 .Pq Fl E
332 must be turned on.
333 .It Fl E
334 Instruct the kernel to perform generic SCSI error recovery for the given
335 command.
336 This is needed in order for the retry count
337 .Pq Fl C
338 to be honored.
339 Other than retrying commands, the generic error recovery in
340 the code will generally attempt to spin up drives that are not spinning.
341 It may take some other actions, depending upon the sense code returned from
342 the command.
343 .It Fl n Ar dev_name
344 Specify the device type to operate on, e.g.\& "da", "cd".
345 .It Fl t Ar timeout
346 SCSI command timeout in seconds.
347 This overrides the default timeout for
348 any given command.
349 .It Fl u Ar unit_number
350 Specify the device unit number, e.g.\& "1", "5".
351 .It Fl v
352 Be verbose, print out sense information for failed SCSI commands.
353 .El
354 .Pp
355 Primary command functions:
356 .Bl -tag -width periphlist
357 .It Ic devlist
358 List all physical devices (logical units) attached to the CAM subsystem.
359 This also includes a list of peripheral drivers attached to each device.
360 With the
361 .Fl v
362 argument, SCSI bus number, adapter name and unit numbers are printed as
363 well.
364 .It Ic periphlist
365 List all peripheral drivers attached to a given physical device (logical
366 unit).
367 .It Ic tur
368 Send the SCSI test unit ready (0x00) command to the given device.
369 The
370 .Nm
371 utility will report whether the device is ready or not.
372 .It Ic inquiry
373 Send a SCSI inquiry command (0x12) to a device.
374 By default,
375 .Nm
376 will print out the standard inquiry data, device serial number, and
377 transfer rate information.
378 The user can specify that only certain types of
379 inquiry data be printed:
380 .Bl -tag -width 4n
381 .It Fl D
382 Get the standard inquiry data.
383 .It Fl S
384 Print out the serial number.
385 If this flag is the only one specified,
386 .Nm
387 will not print out "Serial Number" before the value returned by the drive.
388 This is to aid in script writing.
389 .It Fl R
390 Print out transfer rate information.
391 .El
392 .It Ic identify
393 Send a ATA identify command (0xec) to a device.
394 .It Ic reportluns
395 Send the SCSI REPORT LUNS (0xA0) command to the given device.
396 By default,
397 .Nm
398 will print out the list of logical units (LUNs) supported by the target device.
399 There are a couple of options to modify the output:
400 .Bl -tag -width 14n
401 .It Fl c
402 Just print out a count of LUNs, not the actual LUN numbers.
403 .It Fl l
404 Just print out the LUNs, and do not print out the count.
405 .It Fl r Ar reporttype
406 Specify the type of report to request from the target:
407 .Bl -tag -width 012345678
408 .It default
409 Return the default report.
410 This is the
411 .Nm
412 default.
413 Most targets will support this report if they support the REPORT LUNS
414 command.
415 .It wellknown
416 Return only well known LUNs.
417 .It all
418 Return all available LUNs.
419 .El
420 .El
421 .Pp
422 .Nm
423 will try to print out LUN numbers in a reasonable format.
424 It can understand the peripheral, flat, LUN and extended LUN formats.
425 .It Ic readcap
426 Send the SCSI READ CAPACITY command to the given device and display
427 the results.
428 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
429 action will be sent to obtain the full size of the device.
430 By default,
431 .Nm
432 will print out the last logical block of the device, and the blocksize of
433 the device in bytes.
434 To modify the output format, use the following options:
435 .Bl -tag -width 5n
436 .It Fl b
437 Just print out the blocksize, not the last block or device size.
438 This cannot be used with
439 .Fl N
440 or
441 .Fl s .
442 .It Fl h
443 Print out the device size in human readable (base 2, 1K == 1024) format.
444 This implies
445 .Fl N
446 and cannot be used with
447 .Fl q
448 or
449 .Fl b .
450 .It Fl H
451 Print out the device size in human readable (base 10, 1K == 1000) format.
452 .It Fl N
453 Print out the number of blocks in the device instead of the last logical
454 block.
455 .It Fl q
456 Quiet, print out the numbers only (separated by a comma if
457 .Fl b
458 or
459 .Fl s
460 are not specified).
461 .It Fl s
462 Print out the last logical block or the size of the device only, and omit
463 the blocksize.
464 .El
465 .It Ic start
466 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
467 start bit set.
468 .It Ic stop
469 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
470 start bit cleared.
471 .It Ic load
472 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
473 start bit set and the load/eject bit set.
474 .It Ic eject
475 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
476 start bit cleared and the load/eject bit set.
477 .It Ic rescan
478 Tell the kernel to scan all busses in the system (with the
479 .Ar all
480 argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
481 (XPT_SCAN_LUN) for new devices or devices that have gone away.
482 The user
483 may specify a scan of all busses, a single bus, or a lun.
484 Scanning all luns
485 on a target is not supported.
486 .It Ic reset
487 Tell the kernel to reset all busses in the system (with the
488 .Ar all
489 argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
490 reset for that bus, or to reset the given bus:target:lun
491 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
492 connecting to that device.
493 Note that this can have a destructive impact
494 on the system.
495 .It Ic defects
496 Send the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
497 print out any combination of: the total number of defects, the primary
498 defect list (PLIST), and the grown defect list (GLIST).
499 .Bl -tag -width 11n
500 .It Fl f Ar format
501 The three format options are:
502 .Em block ,
503 to print out the list as logical blocks,
504 .Em bfi ,
505 to print out the list in bytes from index format, and
506 .Em phys ,
507 to print out the list in physical sector format.
508 The format argument is
509 required.
510 Most drives support the physical sector format.
511 Some drives
512 support the logical block format.
513 Many drives, if they do not support the
514 requested format, return the data in an alternate format, along with sense
515 information indicating that the requested data format is not supported.
516 The
517 .Nm
518 utility
519 attempts to detect this, and print out whatever format the drive returns.
520 If the drive uses a non-standard sense code to report that it does not
521 support the requested format,
522 .Nm
523 will probably see the error as a failure to complete the request.
524 .It Fl G
525 Print out the grown defect list.
526 This is a list of bad blocks that have
527 been remapped since the disk left the factory.
528 .It Fl P
529 Print out the primary defect list.
530 .El
531 .Pp
532 If neither
533 .Fl P
534 nor
535 .Fl G
536 is specified,
537 .Nm
538 will print out the number of defects given in the READ DEFECT DATA header
539 returned from the drive.
540 Some drives will report 0 defects if neither the primary or grown defect
541 lists are requested.
542 .It Ic modepage
543 Allows the user to display and optionally edit a SCSI mode page.
544 The mode
545 page formats are located in
546 .Pa /usr/share/misc/scsi_modes .
547 This can be overridden by specifying a different file in the
548 .Ev SCSI_MODES
549 environment variable.
550 The
551 .Ic modepage
552 command takes several arguments:
553 .Bl -tag -width 12n
554 .It Fl d
555 Disable block descriptors for mode sense.
556 .It Fl b
557 Displays mode page data in binary format.
558 .It Fl e
559 This flag allows the user to edit values in the mode page.
560 The user may
561 either edit mode page values with the text editor pointed to by his
562 .Ev EDITOR
563 environment variable, or supply mode page values via standard input, using
564 the same format that
565 .Nm
566 uses to display mode page values.
567 The editor will be invoked if
568 .Nm
569 detects that standard input is terminal.
570 .It Fl l
571 Lists all available mode pages.
572 .It Fl m Ar mode_page
573 This specifies the number of the mode page the user would like to view
574 and/or edit.
575 This argument is mandatory unless
576 .Fl l
577 is specified.
578 .It Fl P Ar pgctl
579 This allows the user to specify the page control field.
580 Possible values are:
581 .Bl -tag -width xxx -compact
582 .It 0
583 Current values
584 .It 1
585 Changeable values
586 .It 2
587 Default values
588 .It 3
589 Saved values
590 .El
591 .El
592 .It Ic cmd
593 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
594 The
595 .Ic cmd
596 function requires the
597 .Fl c
598 argument to specify SCSI CDB or the
599 .Fl a
600 argument to specify ATA Command Block registers values.
601 Other arguments are optional, depending on
602 the command type.
603 The command and data specification syntax is documented
604 in
605 .Xr cam_cdbparse 3 .
606 NOTE: If the CDB specified causes data to be transferred to or from the
607 SCSI device in question, you MUST specify either
608 .Fl i
609 or
610 .Fl o .
611 .Bl -tag -width 17n
612 .It Fl a Ar cmd Op args
613 This specifies the content of 12 ATA Command Block registers (command,
614 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
615 lba_high_exp, features_exp, sector_count, sector_count_exp).
616 .It Fl c Ar cmd Op args
617 This specifies the SCSI CDB.
618 SCSI CDBs may be 6, 10, 12 or 16 bytes.
619 .It Fl d
620 Specifies DMA protocol to be used for ATA command.
621 .It Fl f
622 Specifies FPDMA (NCQ) protocol to be used for ATA command.
623 .It Fl i Ar len Ar fmt
624 This specifies the amount of data to read, and how it should be displayed.
625 If the format is
626 .Sq - ,
627 .Ar len
628 bytes of data will be read from the device and written to standard output.
629 .It Fl o Ar len Ar fmt Op args
630 This specifies the amount of data to be written to a device, and the data
631 that is to be written.
632 If the format is
633 .Sq - ,
634 .Ar len
635 bytes of data will be read from standard input and written to the device.
636 .It Fl r Ar fmt
637 This specifies that 11 result ATA Command Block registers should be displayed
638 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
639 lba_high_exp, sector_count, sector_count_exp), and how.
640 If the format is
641 .Sq - ,
642 11 result registers will be written to standard output in hex.
643 .El
644 .It Ic smpcmd
645 Allows the user to send an arbitrary Serial
646 Management Protocol (SMP) command to a device.
647 The
648 .Ic smpcmd
649 function requires the
650 .Fl r
651 argument to specify the SMP request to be sent, and the
652 .Fl R
653 argument to specify the format of the SMP response.
654 The syntax for the SMP request and response arguments is documented in
655 .Xr cam_cdbparse 3 .
656 .Pp
657 Note that SAS adapters that support SMP passthrough (at least the currently
658 known adapters) do not accept CRC bytes from the user in the request and do
659 not pass CRC bytes back to the user in the response.
660 Therefore users should not include the CRC bytes in the length of the
661 request and not expect CRC bytes to be returned in the response.
662 .Bl -tag -width 17n
663 .It Fl r Ar len Ar fmt Op args
664 This specifies the size of the SMP request, without the CRC bytes, and the
665 SMP request format.  If the format is
666 .Sq - ,
667 .Ar len
668 bytes of data will be read from standard input and written as the SMP
669 request.
670 .It Fl R Ar len Ar fmt Op args
671 This specifies the size of the buffer allocated for the SMP response, and
672 the SMP response format.
673 If the format is
674 .Sq - ,
675 .Ar len
676 bytes of data will be allocated for the response and the response will be
677 written to standard output.
678 .El
679 .It Ic smprg
680 Allows the user to send the Serial Management Protocol (SMP) Report General
681 command to a device.
682 .Nm
683 will display the data returned by the Report General command.
684 If the SMP target supports the long response format, the additional data
685 will be requested and displayed automatically.
686 .Bl -tag -width 8n
687 .It Fl l
688 Request the long response format only.
689 Not all SMP targets support the long response format.
690 This option causes
691 .Nm
692 to skip sending the initial report general request without the long bit set
693 and only issue a report general request with the long bit set.
694 .El
695 .It Ic smppc
696 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
697 command to a device.
698 This function should be used with some caution, as it can render devices
699 inaccessible, and could potentially cause data corruption as well.
700 The
701 .Fl p
702 argument is required to specify the PHY to operate on.
703 .Bl -tag -width 17n
704 .It Fl p Ar phy
705 Specify the PHY to operate on.
706 This argument is required.
707 .It Fl l
708 Request the long request/response format.
709 Not all SMP targets support the long response format.
710 For the PHY Control command, this currently only affects whether the
711 request length is set to a value other than 0.
712 .It Fl o Ar operation
713 Specify a PHY control operation.
714 Only one
715 .Fl o
716 operation may be specified.
717 The operation may be specified numerically (in decimal, hexadecimal, or octal)
718 or one of the following operation names may be specified:
719 .Bl -tag -width 16n
720 .It nop
721 No operation.
722 It is not necessary to specify this argument.
723 .It linkreset
724 Send the LINK RESET command to the phy.
725 .It hardreset
726 Send the HARD RESET command to the phy.
727 .It disable
728 Send the DISABLE command to the phy.
729 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
730 .It clearerrlog
731 Send the CLEAR ERROR LOG command.
732 This clears the error log counters for the specified phy.
733 .It clearaffiliation
734 Send the CLEAR AFFILIATION command.
735 This clears the affiliation from the STP initiator port with the same SAS
736 address as the SMP initiator that requests the clear operation.
737 .It sataportsel
738 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
739 This will cause a SATA port selector to use the given phy as its active phy
740 and make the other phy inactive.
741 .It clearitnl
742 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
743 .It setdevname
744 Send the SET ATTACHED DEVICE NAME command to the PHY.
745 This requires the
746 .Fl d
747 argument to specify the device name.
748 .El
749 .It Fl d Ar name
750 Specify the attached device name.
751 This option is needed with the
752 .Fl o Ar setdevname
753 phy operation.
754 The name is a 64-bit number, and can be specified in decimal, hexadecimal
755 or octal format.
756 .It Fl m Ar rate
757 Set the minimum physical link rate for the phy.
758 This is a numeric argument.
759 Currently known link rates are:
760 .Bl -tag -width 5n
761 .It 0x0
762 Do not change current value.
763 .It 0x8
764 1.5 Gbps
765 .It 0x9
766 3 Gbps
767 .It 0xa
768 6 Gbps
769 .El
770 .Pp
771 Other values may be specified for newer physical link rates.
772 .It Fl M Ar rate
773 Set the maximum physical link rate for the phy.
774 This is a numeric argument.
775 See the
776 .Fl m
777 argument description for known link rate arguments.
778 .It Fl T Ar pp_timeout
779 Set the partial pathway timeout value, in microseconds.
780 See the
781 .Tn ANSI
782 .Tn SAS
783 Protocol Layer (SPL)
784 specification for more information on this field.
785 .It Fl a Ar enable|disable
786 Enable or disable SATA slumber phy power conditions.
787 .It Fl A Ar enable|disable
788 Enable or disable SATA partial power conditions.
789 .It Fl s Ar enable|disable
790 Enable or disable SAS slumber phy power conditions.
791 .It Fl S Ar enable|disable
792 Enable or disable SAS partial phy power conditions.
793 .El
794 .It Ic smpphylist
795 List phys attached to a SAS expander, the address of the end device
796 attached to the phy, and the inquiry data for that device and peripheral
797 devices attached to that device.
798 The inquiry data and peripheral devices are displayed if available.
799 .Bl -tag -width 5n
800 .It Fl l
801 Turn on the long response format for the underlying SMP commands used for
802 this command.
803 .It Fl q
804 Only print out phys that are attached to a device in the CAM EDT (Existing
805 Device Table).
806 .El
807 .It Ic smpmaninfo
808 Send the SMP Report Manufacturer Information command to the device and
809 display the response.
810 .Bl -tag -width 5n
811 .It Fl l
812 Turn on the long response format for the underlying SMP commands used for
813 this command.
814 .El
815 .It Ic debug
816 Turn on CAM debugging printfs in the kernel.
817 This requires options CAMDEBUG
818 in your kernel config file.
819 WARNING: enabling debugging printfs currently
820 causes an EXTREME number of kernel printfs.
821 You may have difficulty
822 turning off the debugging printfs once they start, since the kernel will be
823 busy printing messages and unable to service other requests quickly.
824 The
825 .Ic debug
826 function takes a number of arguments:
827 .Bl -tag -width 18n
828 .It Fl I
829 Enable CAM_DEBUG_INFO printfs.
830 .It Fl P
831 Enable CAM_DEBUG_PERIPH printfs.
832 .It Fl T
833 Enable CAM_DEBUG_TRACE printfs.
834 .It Fl S
835 Enable CAM_DEBUG_SUBTRACE printfs.
836 .It Fl X
837 Enable CAM_DEBUG_XPT printfs.
838 .It Fl c
839 Enable CAM_DEBUG_CDB printfs.
840 This will cause the kernel to print out the
841 SCSI CDBs sent to the specified device(s).
842 .It Fl p
843 Enable CAM_DEBUG_PROBE printfs.
844 .It all
845 Enable debugging for all devices.
846 .It off
847 Turn off debugging for all devices
848 .It bus Ns Op :target Ns Op :lun
849 Turn on debugging for the given bus, target or lun.
850 If the lun or target
851 and lun are not specified, they are wildcarded.
852 (i.e., just specifying a
853 bus turns on debugging printfs for all devices on that bus.)
854 .El
855 .It Ic tags
856 Show or set the number of "tagged openings" or simultaneous transactions
857 we attempt to queue to a particular device.
858 By default, the
859 .Ic tags
860 command, with no command-specific arguments (i.e., only generic arguments)
861 prints out the "soft" maximum number of transactions that can be queued to
862 the device in question.
863 For more detailed information, use the
864 .Fl v
865 argument described below.
866 .Bl -tag -width 7n
867 .It Fl N Ar tags
868 Set the number of tags for the given device.
869 This must be between the
870 minimum and maximum number set in the kernel quirk table.
871 The default for
872 most devices that support tagged queueing is a minimum of 2 and a maximum
873 of 255.
874 The minimum and maximum values for a given device may be
875 determined by using the
876 .Fl v
877 switch.
878 The meaning of the
879 .Fl v
880 switch for this
881 .Nm
882 subcommand is described below.
883 .It Fl q
884 Be quiet, and do not report the number of tags.
885 This is generally used when
886 setting the number of tags.
887 .It Fl v
888 The verbose flag has special functionality for the
889 .Em tags
890 argument.
891 It causes
892 .Nm
893 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
894 .Bl -tag -width 13n
895 .It dev_openings
896 This is the amount of capacity for transactions queued to a given device.
897 .It dev_active
898 This is the number of transactions currently queued to a device.
899 .It devq_openings
900 This is the kernel queue space for transactions.
901 This count usually mirrors
902 dev_openings except during error recovery operations when
903 the device queue is frozen (device is not allowed to receive
904 commands), the number of dev_openings is reduced, or transaction
905 replay is occurring.
906 .It devq_queued
907 This is the number of transactions waiting in the kernel queue for capacity
908 on the device.
909 This number is usually zero unless error recovery is in
910 progress.
911 .It held
912 The held count is the number of CCBs held by peripheral drivers that have
913 either just been completed or are about to be released to the transport
914 layer for service by a device.
915 Held CCBs reserve capacity on a given
916 device.
917 .It mintags
918 This is the current "hard" minimum number of transactions that can be
919 queued to a device at once.
920 The
921 .Ar dev_openings
922 value above cannot go below this number.
923 The default value for
924 .Ar mintags
925 is 2, although it may be set higher or lower for various devices.
926 .It maxtags
927 This is the "hard" maximum number of transactions that can be queued to a
928 device at one time.
929 The
930 .Ar dev_openings
931 value cannot go above this number.
932 The default value for
933 .Ar maxtags
934 is 255, although it may be set higher or lower for various devices.
935 .El
936 .El
937 .It Ic negotiate
938 Show or negotiate various communication parameters.
939 Some controllers may
940 not support setting or changing some of these values.
941 For instance, the
942 Adaptec 174x controllers do not support changing a device's sync rate or
943 offset.
944 The
945 .Nm
946 utility
947 will not attempt to set the parameter if the controller indicates that it
948 does not support setting the parameter.
949 To find out what the controller
950 supports, use the
951 .Fl v
952 flag.
953 The meaning of the
954 .Fl v
955 flag for the
956 .Ic negotiate
957 command is described below.
958 Also, some controller drivers do not support
959 setting negotiation parameters, even if the underlying controller supports
960 negotiation changes.
961 Some controllers, such as the Advansys wide
962 controllers, support enabling and disabling synchronous negotiation for
963 a device, but do not support setting the synchronous negotiation rate.
964 .Bl -tag -width 17n
965 .It Fl a
966 Attempt to make the negotiation settings take effect immediately by sending
967 a Test Unit Ready command to the device.
968 .It Fl c
969 Show or set current negotiation settings.
970 This is the default.
971 .It Fl D Ar enable|disable
972 Enable or disable disconnection.
973 .It Fl M Ar mode
974 Set ATA mode.
975 .It Fl O Ar offset
976 Set the command delay offset.
977 .It Fl q
978 Be quiet, do not print anything.
979 This is generally useful when you want to
980 set a parameter, but do not want any status information.
981 .It Fl R Ar syncrate
982 Change the synchronization rate for a device.
983 The sync rate is a floating
984 point value specified in MHz.
985 So, for instance,
986 .Sq 20.000
987 is a legal value, as is
988 .Sq 20 .
989 .It Fl T Ar enable|disable
990 Enable or disable tagged queueing for a device.
991 .It Fl U
992 Show or set user negotiation settings.
993 The default is to show or set
994 current negotiation settings.
995 .It Fl v
996 The verbose switch has special meaning for the
997 .Ic negotiate
998 subcommand.
999 It causes
1000 .Nm
1001 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1002 controller driver.
1003 .It Fl W Ar bus_width
1004 Specify the bus width to negotiate with a device.
1005 The bus width is
1006 specified in bits.
1007 The only useful values to specify are 8, 16, and 32
1008 bits.
1009 The controller must support the bus width in question in order for
1010 the setting to take effect.
1011 .El
1012 .Pp
1013 In general, sync rate and offset settings will not take effect for a
1014 device until a command has been sent to the device.
1015 The
1016 .Fl a
1017 switch above will automatically send a Test Unit Ready to the device so
1018 negotiation parameters will take effect.
1019 .It Ic format
1020 Issue the
1021 .Tn SCSI
1022 FORMAT UNIT command to the named device.
1023 .Pp
1024 .Em WARNING! WARNING! WARNING!
1025 .Pp
1026 Low level formatting a disk will destroy ALL data on the disk.
1027 Use
1028 extreme caution when issuing this command.
1029 Many users low-level format
1030 disks that do not really need to be low-level formatted.
1031 There are
1032 relatively few scenarios that call for low-level formatting a disk.
1033 One reason for
1034 low-level formatting a disk is to initialize the disk after changing
1035 its physical sector size.
1036 Another reason for low-level formatting a disk
1037 is to revive the disk if you are getting "medium format corrupted" errors
1038 from the disk in response to read and write requests.
1039 .Pp
1040 Some disks take longer than others to format.
1041 Users should specify a
1042 timeout long enough to allow the format to complete.
1043 The default format
1044 timeout is 3 hours, which should be long enough for most disks.
1045 Some hard
1046 disks will complete a format operation in a very short period of time
1047 (on the order of 5 minutes or less).
1048 This is often because the drive
1049 does not really support the FORMAT UNIT command -- it just accepts the
1050 command, waits a few minutes and then returns it.
1051 .Pp
1052 The
1053 .Sq format
1054 subcommand takes several arguments that modify its default behavior.
1055 The
1056 .Fl q
1057 and
1058 .Fl y
1059 arguments can be useful for scripts.
1060 .Bl -tag -width 6n
1061 .It Fl q
1062 Be quiet, do not print any status messages.
1063 This option will not disable
1064 the questions, however.
1065 To disable questions, use the
1066 .Fl y
1067 argument, below.
1068 .It Fl r
1069 Run in
1070 .Dq report only
1071 mode.
1072 This will report status on a format that is already running on the drive.
1073 .It Fl w
1074 Issue a non-immediate format command.
1075 By default,
1076 .Nm
1077 issues the FORMAT UNIT command with the immediate bit set.
1078 This tells the
1079 device to immediately return the format command, before the format has
1080 actually completed.
1081 Then,
1082 .Nm
1083 gathers
1084 .Tn SCSI
1085 sense information from the device every second to determine how far along
1086 in the format process it is.
1087 If the
1088 .Fl w
1089 argument is specified,
1090 .Nm
1091 will issue a non-immediate format command, and will be unable to print any
1092 information to let the user know what percentage of the disk has been
1093 formatted.
1094 .It Fl y
1095 Do not ask any questions.
1096 By default,
1097 .Nm
1098 will ask the user if he/she really wants to format the disk in question,
1099 and also if the default format command timeout is acceptable.
1100 The user
1101 will not be asked about the timeout if a timeout is specified on the
1102 command line.
1103 .El
1104 .It Ic sanitize
1105 Issue the
1106 .Tn SCSI
1107 SANITIZE command to the named device.
1108 .Pp
1109 .Em WARNING! WARNING! WARNING!
1110 .Pp
1111 ALL data in the cache and on the disk will be destroyed or made inaccessible.
1112 Recovery of the data is not possible.
1113 Use extreme caution when issuing this command.
1114 .Pp
1115 The
1116 .Sq sanitize
1117 subcommand takes several arguments that modify its default behavior.
1118 The
1119 .Fl q
1120 and
1121 .Fl y
1122 arguments can be useful for scripts.
1123 .Bl -tag -width 6n
1124 .It Fl a Ar operation
1125 Specify the sanitize operation to perform.
1126 .Bl -tag -width 16n
1127 .It overwrite
1128 Perform an overwrite operation by writing a user supplied
1129 data pattern to the device one or more times.
1130 The pattern is given by the
1131 .Fl P
1132 argument.
1133 The number of times is given by the
1134 .Fl c
1135 argument.
1136 .It block
1137 Perform a block erase operation.
1138 All the device's blocks are set to a vendor defined
1139 value, typically zero.
1140 .It crypto
1141 Perform a cryptographic erase operation.
1142 The encryption keys are changed to prevent the decryption
1143 of the data.
1144 .It exitfailure
1145 Exits a previously failed sanitize operation.
1146 A failed sanitize operation can only be exited if it was
1147 run in the unrestricted completion mode, as provided by the
1148 .Fl U
1149 argument.
1150 .El
1151 .It Fl c Ar passes
1152 The number of passes when performing an
1153 .Sq overwrite
1154 operation.
1155 Valid values are between 1 and 31. The default is 1.
1156 .It Fl I
1157 When performing an
1158 .Sq overwrite
1159 operation, the pattern is inverted between consecutive passes.
1160 .It Fl P Ar pattern
1161 Path to the file containing the pattern to use when
1162 performing an
1163 .Sq overwrite
1164 operation.
1165 The pattern is repeated as needed to fill each block.
1166 .It Fl q
1167 Be quiet, do not print any status messages.
1168 This option will not disable
1169 the questions, however.
1170 To disable questions, use the
1171 .Fl y
1172 argument, below.
1173 .It Fl U
1174 Perform the sanitize in the unrestricted completion mode.
1175 If the operation fails, it can later be exited with the
1176 .Sq exitfailure
1177 operation.
1178 .It Fl r
1179 Run in
1180 .Dq report only
1181 mode.
1182 This will report status on a sanitize that is already running on the drive.
1183 .It Fl w
1184 Issue a non-immediate sanitize command.
1185 By default,
1186 .Nm
1187 issues the SANITIZE command with the immediate bit set.
1188 This tells the
1189 device to immediately return the sanitize command, before
1190 the sanitize has actually completed.
1191 Then,
1192 .Nm
1193 gathers
1194 .Tn SCSI
1195 sense information from the device every second to determine how far along
1196 in the sanitize process it is.
1197 If the
1198 .Fl w
1199 argument is specified,
1200 .Nm
1201 will issue a non-immediate sanitize command, and will be unable to print any
1202 information to let the user know what percentage of the disk has been
1203 sanitized.
1204 .It Fl y
1205 Do not ask any questions.
1206 By default,
1207 .Nm
1208 will ask the user if he/she really wants to sanitize the disk in question,
1209 and also if the default sanitize command timeout is acceptable.
1210 The user
1211 will not be asked about the timeout if a timeout is specified on the
1212 command line.
1213 .El
1214 .It Ic idle
1215 Put ATA device into IDLE state. Optional parameter
1216 .Pq Fl t
1217 specifies automatic standby timer value in seconds. Value 0 disables timer.
1218 .It Ic standby
1219 Put ATA device into STANDBY state. Optional parameter
1220 .Pq Fl t
1221 specifies automatic standby timer value in seconds. Value 0 disables timer.
1222 .It Ic sleep
1223 Put ATA device into SLEEP state. Note that the only way get device out of
1224 this state may be reset.
1225 .It Ic security
1226 Update or report security settings, using an ATA identify command (0xec).
1227 By default,
1228 .Nm
1229 will print out the security support and associated settings of the device.
1230 The
1231 .Ic security
1232 command takes several arguments:
1233 .Bl -tag -width 0n
1234 .It Fl d Ar pwd
1235 .Pp
1236 Disable device security using the given password for the selected user according
1237 to the devices configured security level.
1238 .It Fl e Ar pwd
1239 .Pp
1240 Erase the device using the given password for the selected user.
1241 .Pp
1242 .Em WARNING! WARNING! WARNING!
1243 .Pp
1244 Issuing a secure erase will
1245 .Em ERASE ALL
1246 user data on the device and may take several hours to complete.
1247 .Pp
1248 When this command is used against an SSD drive all its cells will be marked as
1249 empty, restoring it to factory default write performance. For SSD's this action
1250 usually takes just a few seconds.
1251 .It Fl f
1252 .Pp
1253 Freeze the security configuration of the specified device.
1254 .Pp
1255 After command completion any other commands that update the device lock mode
1256 shall be command aborted. Frozen mode is disabled by power-off or hardware reset. 
1257 .It Fl h Ar pwd
1258 .Pp
1259 Enhanced erase the device using the given password for the selected user.
1260 .Pp
1261 .Em WARNING! WARNING! WARNING!
1262 .Pp
1263 Issuing an enhanced secure erase will 
1264 .Em ERASE ALL
1265 user data on the device and may take several hours to complete.
1266 .Pp
1267 An enhanced erase writes predetermined data patterns to all user data areas,
1268 all previously written user data shall be overwritten, including sectors that
1269 are no longer in use due to reallocation.
1270 .It Fl k Ar pwd
1271 .Pp
1272 Unlock the device using the given password for the selected user according to
1273 the devices configured security level.
1274 .It Fl l Ar high|maximum
1275 .Pp
1276 Specifies which security level to set when issuing a
1277 .Fl s Ar pwd
1278 command. The security level determines device behavior when the master
1279 password is used to unlock the device. When the security level is set to high
1280 the device requires the unlock command and the master password to unlock.
1281 When the security level is set to maximum the device requires a secure erase
1282 with the master password to unlock.
1283 .Pp
1284 This option must be used in conjunction with one of the security action commands.
1285 .Pp
1286 Defaults to
1287 .Em high
1288 .It Fl q
1289 .Pp
1290 Be quiet, do not print any status messages.
1291 This option will not disable the questions, however.
1292 To disable questions, use the
1293 .Fl y
1294 argument, below.
1295 .It Fl s Ar pwd
1296 .Pp
1297 Password the device (enable security) using the given password for the selected
1298 user. This option can be combined with other options such as
1299 .Fl e Em pwd
1300 .Pp
1301 A master password may be set in a addition to the user password. The purpose of
1302 the master password is to allow an administrator to establish a password that
1303 is kept secret from the user, and which may be used to unlock the device if the
1304 user password is lost.
1305 .Pp
1306 .Em Note:
1307 Setting the master password does not enable device security.
1308 .Pp
1309 If the master password is set and the drive supports a Master Revision Code
1310 feature the Master Password Revision Code will be decremented.
1311 .It Fl T Ar timeout
1312 .Pp
1313 Overrides the default timeout, specified in seconds, used for both
1314 .Fl e
1315 and
1316 .Fl h
1317 this is useful if your system has problems processing long timeouts correctly.
1318 .Pp
1319 Usually the timeout is calculated from the information stored on the drive if
1320 present, otherwise it defaults to 2 hours.
1321 .It Fl U Ar user|master
1322 .Pp
1323 Specifies which user to set / use for the running action command, valid values
1324 are user or master and defaults to master if not set.
1325 .Pp
1326 This option must be used in conjunction with one of the security action commands.
1327 .Pp
1328 Defaults to
1329 .Em master
1330 .It Fl y
1331 .Pp
1332 Confirm yes to dangerous options such as
1333 .Fl e
1334 without prompting for confirmation.
1335 .Pp
1336 .El
1337 If the password specified for any action commands doesn't match the configured
1338 password for the specified user the command will fail.
1339 .Pp
1340 The password in all cases is limited to 32 characters, longer passwords will
1341 fail.
1342 .It Ic hpa
1343 Update or report Host Protected Area details.
1344 By default
1345 .Nm
1346 will print out the HPA support and associated settings of the device.
1347 The
1348 .Ic hpa
1349 command takes several optional arguments:
1350 .Bl -tag -width 0n
1351 .It Fl f
1352 .Pp
1353 Freeze the HPA configuration of the specified device.
1354 .Pp
1355 After command completion any other commands that update the HPA configuration
1356 shall be command aborted.
1357 Frozen mode is disabled by power-off or hardware reset.
1358 .It Fl l
1359 .Pp
1360 Lock the HPA configuration of the device until a successful call to unlock or
1361 the next power-on reset occurs.
1362 .It Fl P
1363 .Pp
1364 Make the HPA max sectors persist across power-on reset or a hardware reset.
1365 This must be used in combination with
1366 .Fl s Ar max_sectors
1367 .
1368 .It Fl p Ar pwd
1369 .Pp
1370 Set the HPA configuration password required for unlock calls.
1371 .It Fl q
1372 .Pp
1373 Be quiet, do not print any status messages.
1374 This option will not disable the questions.
1375 To disable questions, use the
1376 .Fl y
1377 argument, below.
1378 .It Fl s Ar max_sectors
1379 .Pp
1380 Configures the maximum user accessible sectors of the device.
1381 This will change the number of sectors the device reports.
1382 .Pp
1383 .Em WARNING! WARNING! WARNING!
1384 .Pp
1385 Changing the max sectors of a device using this option will make the data on
1386 the device beyond the specified value inaccessible.
1387 .Pp
1388 Only one successful
1389 .Fl s Ar max_sectors
1390 call can be made without a power-on reset or a hardware reset of the device.
1391 .It Fl U Ar pwd
1392 .Pp
1393 Unlock the HPA configuration of the specified device using the given password.
1394 If the password specified doesn't match the password configured via
1395 .Fl p Ar pwd
1396 the command will fail.
1397 .Pp
1398 After 5 failed unlock calls, due to password miss-match, the device will refuse
1399 additional unlock calls until after a power-on reset.
1400 .It Fl y
1401 .Pp
1402 Confirm yes to dangerous options such as
1403 .Fl e
1404 without prompting for confirmation
1405 .Pp
1406 .El
1407 The password for all HPA commands is limited to 32 characters, longer passwords
1408 will fail.
1409 .It Ic fwdownload
1410 Program firmware of the named SCSI device using the image file provided.
1411 .Pp
1412 Current list of supported vendors:
1413 .Bl -bullet -offset indent -compact
1414 .It
1415 HITACHI
1416 .It
1417 HP
1418 .It
1419 IBM
1420 .It
1421 PLEXTOR
1422 .It
1423 QUANTUM
1424 .It
1425 SEAGATE
1426 .El
1427 .Pp
1428 .Em WARNING! WARNING! WARNING!
1429 .Pp
1430 Little testing has been done to make sure that different device models from
1431 each vendor work correctly with the fwdownload command.
1432 A vendor name appearing in the supported list means only that firmware of at
1433 least one device type from that vendor has successfully been programmed with
1434 the fwdownload command.
1435 Extra caution should be taken when using this command since there is no
1436 guarantee it will not break a device from the listed vendors.
1437 Ensure that you have a recent backup of the data on the device before
1438 performing a firmware update.
1439 .Bl -tag -width 11n
1440 .It Fl f Ar fw_image
1441 Path to the firmware image file to be downloaded to the specified device.
1442 .It Fl y
1443 Do not ask for confirmation.
1444 .It Fl s
1445 Run in simulation mode.
1446 Packet sizes that will be sent are shown, but no actual packet is sent to the
1447 device.
1448 No confirmation is asked in simulation mode.
1449 .It Fl v
1450 Besides showing sense information in case of a failure, the verbose option
1451 causes
1452 .Nm
1453 to output a line for every firmware segment that is sent to the device by the
1454 fwdownload command
1455 -- the same as the ones shown in simulation mode.
1456 .El
1457 .It Ic help
1458 Print out verbose usage information.
1459 .El
1460 .Sh ENVIRONMENT
1461 The
1462 .Ev SCSI_MODES
1463 variable allows the user to specify an alternate mode page format file.
1464 .Pp
1465 The
1466 .Ev EDITOR
1467 variable determines which text editor
1468 .Nm
1469 starts when editing mode pages.
1470 .Sh FILES
1471 .Bl -tag -width /usr/share/misc/scsi_modes -compact
1472 .It Pa /usr/share/misc/scsi_modes
1473 is the SCSI mode format database.
1474 .It Pa /dev/xpt0
1475 is the transport layer device.
1476 .It Pa /dev/pass*
1477 are the CAM application passthrough devices.
1478 .El
1479 .Sh EXAMPLES
1480 .Dl camcontrol eject -n cd -u 1 -v
1481 .Pp
1482 Eject the CD from cd1, and print SCSI sense information if the command
1483 fails.
1484 .Pp
1485 .Dl camcontrol tur da0
1486 .Pp
1487 Send the SCSI test unit ready command to da0.
1488 The
1489 .Nm
1490 utility will report whether the disk is ready, but will not display sense
1491 information if the command fails since the
1492 .Fl v
1493 switch was not specified.
1494 .Bd -literal -offset indent
1495 camcontrol tur da1 -E -C 4 -t 50 -v
1496 .Ed
1497 .Pp
1498 Send a test unit ready command to da1.
1499 Enable kernel error recovery.
1500 Specify a retry count of 4, and a timeout of 50 seconds.
1501 Enable sense
1502 printing (with the
1503 .Fl v
1504 flag) if the command fails.
1505 Since error recovery is turned on, the
1506 disk will be spun up if it is not currently spinning.
1507 The
1508 .Nm
1509 utility will report whether the disk is ready.
1510 .Bd -literal -offset indent
1511 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
1512         -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
1513 .Ed
1514 .Pp
1515 Issue a READ BUFFER command (0x3C) to cd1.
1516 Display the buffer size of cd1,
1517 and display the first 10 bytes from the cache on cd1.
1518 Display SCSI sense
1519 information if the command fails.
1520 .Bd -literal -offset indent
1521 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
1522         -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
1523 .Ed
1524 .Pp
1525 Issue a WRITE BUFFER (0x3B) command to cd1.
1526 Write out 10 bytes of data,
1527 not including the (reserved) 4 byte header.
1528 Print out sense information if
1529 the command fails.
1530 Be very careful with this command, improper use may
1531 cause data corruption.
1532 .Bd -literal -offset indent
1533 camcontrol modepage da3 -m 1 -e -P 3
1534 .Ed
1535 .Pp
1536 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
1537 settings on the drive.
1538 Mode page 1 contains a disk drive's auto read and
1539 write reallocation settings, among other things.
1540 .Pp
1541 .Dl camcontrol rescan all
1542 .Pp
1543 Rescan all SCSI busses in the system for devices that have been added,
1544 removed or changed.
1545 .Pp
1546 .Dl camcontrol rescan 0
1547 .Pp
1548 Rescan SCSI bus 0 for devices that have been added, removed or changed.
1549 .Pp
1550 .Dl camcontrol rescan 0:1:0
1551 .Pp
1552 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
1553 changed.
1554 .Pp
1555 .Dl camcontrol tags da5 -N 24
1556 .Pp
1557 Set the number of concurrent transactions for da5 to 24.
1558 .Bd -literal -offset indent
1559 camcontrol negotiate -n da -u 4 -T disable
1560 .Ed
1561 .Pp
1562 Disable tagged queueing for da4.
1563 .Bd -literal -offset indent
1564 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
1565 .Ed
1566 .Pp
1567 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
1568 Then send a
1569 Test Unit Ready command to make the settings take effect.
1570 .Bd -literal -offset indent
1571 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
1572 .Ed
1573 .Pp
1574 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
1575 it contains.
1576 Display SMP errors if the command fails.
1577 .Bd -literal -offset indent
1578 camcontrol security ada0
1579 .Ed
1580 .Pp
1581 Report security support and settings for ada0
1582 .Bd -literal -offset indent
1583 camcontrol security ada0 -U user -s MyPass
1584 .Ed
1585 .Pp
1586 Enable security on device ada0 with the password MyPass
1587 .Bd -literal -offset indent
1588 camcontrol security ada0 -U user -e MyPass
1589 .Ed
1590 .Pp
1591 Secure erase ada0 which has had security enabled with user password MyPass
1592 .Pp
1593 .Em WARNING! WARNING! WARNING!
1594 .Pp
1595 This will
1596 .Em ERASE ALL
1597 data from the device, so backup your data before using!
1598 .Pp
1599 This command can be used used against an SSD drive to restoring it to
1600 factory default write performance.
1601 .Bd -literal -offset indent
1602 camcontrol hpa ada0
1603 .Ed
1604 .Pp
1605 Report HPA support and settings for ada0 (also reported via
1606 identify).
1607 .Bd -literal -offset indent
1608 camcontrol hpa ada0 -s 10240
1609 .Ed
1610 .Pp
1611 Enables HPA on ada0 setting the maximum reported sectors to 10240.
1612 .Pp
1613 .Em WARNING! WARNING! WARNING!
1614 .Pp
1615 This will
1616 .Em PREVENT ACCESS
1617 to all data on the device beyond this limit until HPA is disabled by setting
1618 HPA to native max sectors of the device, which can only be done after a
1619 power-on or hardware reset!
1620 .Pp
1621 .Em DO NOT
1622 use this on a device which has an active filesystem!
1623 .Sh SEE ALSO
1624 .Xr cam 3 ,
1625 .Xr cam_cdbparse 3 ,
1626 .Xr cam 4 ,
1627 .Xr pass 4 ,
1628 .Xr xpt 4
1629 .Sh HISTORY
1630 The
1631 .Nm
1632 utility first appeared in
1633 .Fx 3.0 .
1634 .Pp
1635 The mode page editing code and arbitrary SCSI command code are based upon
1636 code in the old
1637 .Xr scsi 8
1638 utility and
1639 .Xr scsi 3
1640 library, written by Julian Elischer and Peter Dufault.
1641 The
1642 .Xr scsi 8
1643 program first appeared in
1644 .Bx 386 0.1.2.4 ,
1645 and first appeared in
1646 .Fx
1647 in
1648 .Fx 2.0.5 .
1649 .Sh AUTHORS
1650 .An Kenneth Merry Aq ken@FreeBSD.org
1651 .Sh BUGS
1652 The code that parses the generic command line arguments does not know that
1653 some of the subcommands take multiple arguments.
1654 So if, for instance, you
1655 tried something like this:
1656 .Bd -literal -offset indent
1657 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
1658 .Ed
1659 .Pp
1660 The sense information from the test unit ready command would not get
1661 printed out, since the first
1662 .Xr getopt 3
1663 call in
1664 .Nm
1665 bails out when it sees the second argument to
1666 .Fl c
1667 (0x00),
1668 above.
1669 Fixing this behavior would take some gross code, or changes to the
1670 .Xr getopt 3
1671 interface.
1672 The best way to circumvent this problem is to always make sure
1673 to specify generic
1674 .Nm
1675 arguments before any command-specific arguments.