]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/camcontrol/camcontrol.8
camcontrol(8): Fix some warnings spotted by mandoc
[FreeBSD/FreeBSD.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 6, 2019
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 b
45 .Op Fl v
46 .Nm
47 .Ic periphlist
48 .Op device id
49 .Op Fl n Ar dev_name
50 .Op Fl u Ar unit_number
51 .Nm
52 .Ic tur
53 .Op device id
54 .Op generic args
55 .Nm
56 .Ic inquiry
57 .Op device id
58 .Op generic args
59 .Op Fl D
60 .Op Fl S
61 .Op Fl R
62 .Nm
63 .Ic identify
64 .Op device id
65 .Op generic args
66 .Op Fl v
67 .Nm
68 .Ic reportluns
69 .Op device id
70 .Op generic args
71 .Op Fl c
72 .Op Fl l
73 .Op Fl r Ar reporttype
74 .Nm
75 .Ic readcap
76 .Op device id
77 .Op generic args
78 .Op Fl b
79 .Op Fl h
80 .Op Fl H
81 .Op Fl l
82 .Op Fl N
83 .Op Fl q
84 .Op Fl s
85 .Nm
86 .Ic start
87 .Op device id
88 .Op generic args
89 .Nm
90 .Ic stop
91 .Op device id
92 .Op generic args
93 .Nm
94 .Ic load
95 .Op device id
96 .Op generic args
97 .Nm
98 .Ic eject
99 .Op device id
100 .Op generic args
101 .Nm
102 .Ic reprobe
103 .Op device id
104 .Nm
105 .Ic rescan
106 .Aq all | device id | bus Ns Op :target:lun
107 .Nm
108 .Ic reset
109 .Aq all | device id | bus Ns Op :target:lun
110 .Nm
111 .Ic defects
112 .Op device id
113 .Op generic args
114 .Aq Fl f Ar format
115 .Op Fl P
116 .Op Fl G
117 .Op Fl q
118 .Op Fl s
119 .Op Fl S Ar offset
120 .Op Fl X
121 .Nm
122 .Ic modepage
123 .Op device id
124 .Op generic args
125 .Op Fl 6
126 .Aq Fl m Ar page[,subpage] | Fl l
127 .Op Fl P Ar pgctl
128 .Op Fl D
129 .Op Fl L
130 .Op Fl b | Fl e
131 .Op Fl d
132 .Nm
133 .Ic cmd
134 .Op device id
135 .Op generic args
136 .Aq Fl a Ar cmd Op args
137 .Aq Fl c Ar cmd Op args
138 .Op Fl d
139 .Op Fl f
140 .Op Fl i Ar len Ar fmt
141 .Bk -words
142 .Op Fl o Ar len Ar fmt Op args
143 .Op Fl r Ar fmt
144 .Ek
145 .Nm
146 .Ic smpcmd
147 .Op device id
148 .Op generic args
149 .Aq Fl r Ar len Ar fmt Op args
150 .Aq Fl R Ar len Ar fmt Op args
151 .Nm
152 .Ic smprg
153 .Op device id
154 .Op generic args
155 .Op Fl l
156 .Nm
157 .Ic smppc
158 .Op device id
159 .Op generic args
160 .Aq Fl p Ar phy
161 .Op Fl l
162 .Op Fl o Ar operation
163 .Op Fl d Ar name
164 .Op Fl m Ar rate
165 .Op Fl M Ar rate
166 .Op Fl T Ar pp_timeout
167 .Op Fl a Ar enable|disable
168 .Op Fl A Ar enable|disable
169 .Op Fl s Ar enable|disable
170 .Op Fl S Ar enable|disable
171 .Nm
172 .Ic smpphylist
173 .Op device id
174 .Op generic args
175 .Op Fl l
176 .Op Fl q
177 .Nm
178 .Ic smpmaninfo
179 .Op device id
180 .Op generic args
181 .Op Fl l
182 .Nm
183 .Ic debug
184 .Op Fl I
185 .Op Fl P
186 .Op Fl T
187 .Op Fl S
188 .Op Fl X
189 .Op Fl c
190 .Op Fl p
191 .Aq all | off | device id | bus Ns Op :target Ns Op :lun
192 .Nm
193 .Ic tags
194 .Op device id
195 .Op generic args
196 .Op Fl N Ar tags
197 .Op Fl q
198 .Op Fl v
199 .Nm
200 .Ic negotiate
201 .Op device id
202 .Op generic args
203 .Op Fl c
204 .Op Fl D Ar enable|disable
205 .Op Fl M Ar mode
206 .Op Fl O Ar offset
207 .Op Fl q
208 .Op Fl R Ar syncrate
209 .Op Fl T Ar enable|disable
210 .Op Fl U
211 .Op Fl W Ar bus_width
212 .Op Fl v
213 .Nm
214 .Ic format
215 .Op device id
216 .Op generic args
217 .Op Fl q
218 .Op Fl r
219 .Op Fl w
220 .Op Fl y
221 .Nm
222 .Ic sanitize
223 .Op device id
224 .Op generic args
225 .Aq Fl a Ar overwrite | block | crypto | exitfailure
226 .Op Fl c Ar passes
227 .Op Fl I
228 .Op Fl P Ar pattern
229 .Op Fl q
230 .Op Fl U
231 .Op Fl r
232 .Op Fl w
233 .Op Fl y
234 .Nm
235 .Ic idle
236 .Op device id
237 .Op generic args
238 .Op Fl t Ar time
239 .Nm
240 .Ic standby
241 .Op device id
242 .Op generic args
243 .Op Fl t Ar time
244 .Nm
245 .Ic sleep
246 .Op device id
247 .Op generic args
248 .Nm
249 .Ic powermode
250 .Op device id
251 .Op generic args
252 .Nm
253 .Ic apm
254 .Op device id
255 .Op generic args
256 .Op Fl l Ar level
257 .Nm
258 .Ic aam
259 .Op device id
260 .Op generic args
261 .Op Fl l Ar level
262 .Nm
263 .Ic fwdownload
264 .Op device id
265 .Op generic args
266 .Aq Fl f Ar fw_image
267 .Op Fl q
268 .Op Fl s
269 .Op Fl y
270 .Nm
271 .Ic security
272 .Op device id
273 .Op generic args
274 .Op Fl d Ar pwd
275 .Op Fl e Ar pwd
276 .Op Fl f
277 .Op Fl h Ar pwd
278 .Op Fl k Ar pwd
279 .Op Fl l Ar high|maximum
280 .Op Fl q
281 .Op Fl s Ar pwd
282 .Op Fl T Ar timeout
283 .Op Fl U Ar user|master
284 .Op Fl y
285 .Nm
286 .Ic hpa
287 .Op device id
288 .Op generic args
289 .Op Fl f
290 .Op Fl l
291 .Op Fl P
292 .Op Fl p Ar pwd
293 .Op Fl q
294 .Op Fl s Ar max_sectors
295 .Op Fl U Ar pwd
296 .Op Fl y
297 .Nm
298 .Ic ama
299 .Op device id
300 .Op generic args
301 .Op Fl f
302 .Op Fl q
303 .Op Fl s Ar max_sectors
304 .Nm
305 .Ic persist
306 .Op device id
307 .Op generic args
308 .Aq Fl i Ar action | Fl o Ar action
309 .Op Fl a
310 .Op Fl I Ar trans_id
311 .Op Fl k Ar key
312 .Op Fl K Ar sa_key
313 .Op Fl p
314 .Op Fl R Ar rel_tgt_port
315 .Op Fl s Ar scope
316 .Op Fl S
317 .Op Fl T Ar res_type
318 .Op Fl U
319 .Nm
320 .Ic attrib
321 .Op device id
322 .Op generic args
323 .Aq Fl r Ar action | Fl w Ar attrib
324 .Op Fl a Ar attr_num
325 .Op Fl c
326 .Op Fl e Ar elem_addr
327 .Op Fl F Ar form1,form2
328 .Op Fl p Ar part
329 .Op Fl s Ar start_addr
330 .Op Fl T Ar elem_type
331 .Op Fl V Ar lv_num
332 .Nm
333 .Ic opcodes
334 .Op device id
335 .Op generic args
336 .Op Fl o Ar opcode
337 .Op Fl s Ar service_action
338 .Op Fl N
339 .Op Fl T
340 .Nm
341 .Ic zone
342 .Aq Fl c Ar cmd
343 .Op Fl a
344 .Op Fl l Ar lba
345 .Op Fl o Ar rep_opts
346 .Op Fl P Ar print_opts
347 .Nm
348 .Ic epc
349 .Aq Fl c Ar cmd
350 .Op Fl d
351 .Op Fl D
352 .Op Fl e
353 .Op Fl H
354 .Op Fl p Ar power_cond
355 .Op Fl P
356 .Op Fl r Ar restore_src
357 .Op Fl s
358 .Op Fl S Ar power_src
359 .Op Fl T Ar timer
360 .Nm
361 .Ic timestamp
362 .Op device id
363 .Op generic args
364 .Ao Fl r Oo Ns Fl f Ar format | Fl m | Fl U Oc | Fl s Ao Fl f Ar format Fl T Ar time | Fl U Ac Ac
365 .Nm
366 .Ic devtype
367 .Op device id
368 .Nm
369 .Ic help
370 .Sh DESCRIPTION
371 The
372 .Nm
373 utility is designed to provide a way for users to access and control the
374 .Fx
375 CAM subsystem.
376 .Pp
377 The
378 .Nm
379 utility
380 can cause a loss of data and/or system crashes if used improperly.
381 Even
382 expert users are encouraged to exercise caution when using this command.
383 Novice users should stay away from this utility.
384 .Pp
385 The
386 .Nm
387 utility has a number of primary functions, many of which support an optional
388 device identifier.
389 A device identifier can take one of three forms:
390 .Bl -tag -width 14n
391 .It deviceUNIT
392 Specify a device name and unit number combination, like "da5" or "cd3".
393 .It bus:target
394 Specify a bus number and target id.
395 The bus number can be determined from
396 the output of
397 .Dq camcontrol devlist .
398 The lun defaults to 0.
399 .It bus:target:lun
400 Specify the bus, target and lun for a device.
401 (e.g.\& 1:2:0)
402 .El
403 .Pp
404 The device identifier, if it is specified,
405 .Em must
406 come immediately after the function name, and before any generic or
407 function-specific arguments.
408 Note that the
409 .Fl n
410 and
411 .Fl u
412 arguments described below will override any device name or unit number
413 specified beforehand.
414 The
415 .Fl n
416 and
417 .Fl u
418 arguments will
419 .Em not
420 override a specified bus:target or bus:target:lun, however.
421 .Pp
422 Most of the
423 .Nm
424 primary functions support these generic arguments:
425 .Bl -tag -width 14n
426 .It Fl C Ar count
427 SCSI command retry count.
428 In order for this to work, error recovery
429 .Pq Fl E
430 must be turned on.
431 .It Fl E
432 Instruct the kernel to perform generic SCSI error recovery for the given
433 command.
434 This is needed in order for the retry count
435 .Pq Fl C
436 to be honored.
437 Other than retrying commands, the generic error recovery in
438 the code will generally attempt to spin up drives that are not spinning.
439 It may take some other actions, depending upon the sense code returned from
440 the command.
441 .It Fl n Ar dev_name
442 Specify the device type to operate on, e.g.\& "da", "cd".
443 .It Fl Q Ar task_attr
444 .Tn SCSI
445 task attribute for the command, if it is a
446 .Tn SCSI
447 command.
448 This may be ordered, simple, head, or aca.
449 In most cases this is not needed.
450 The default is simple, which works with all
451 .Tn SCSI
452 devices.
453 The task attribute may also be specified numerically.
454 .It Fl t Ar timeout
455 SCSI command timeout in seconds.
456 This overrides the default timeout for
457 any given command.
458 .It Fl u Ar unit_number
459 Specify the device unit number, e.g.\& "1", "5".
460 .It Fl v
461 Be verbose, print out sense information for failed SCSI commands.
462 .El
463 .Pp
464 Primary command functions:
465 .Bl -tag -width periphlist
466 .It Ic devlist
467 List all physical devices (logical units) attached to the CAM subsystem.
468 This also includes a list of peripheral drivers attached to each device.
469 With the
470 .Fl v
471 argument, SCSI bus number, adapter name and unit numbers are printed as
472 well.
473 On the other hand, with the
474 .Fl b
475 argument, only the bus adapter, and unit information will be printed, and
476 device information will be omitted.
477 .It Ic periphlist
478 List all peripheral drivers attached to a given physical device (logical
479 unit).
480 .It Ic tur
481 Send the SCSI test unit ready (0x00) command to the given device.
482 The
483 .Nm
484 utility will report whether the device is ready or not.
485 .It Ic inquiry
486 Send a SCSI inquiry command (0x12) to a device.
487 By default,
488 .Nm
489 will print out the standard inquiry data, device serial number, and
490 transfer rate information.
491 The user can specify that only certain types of
492 inquiry data be printed:
493 .Bl -tag -width 4n
494 .It Fl D
495 Get the standard inquiry data.
496 .It Fl S
497 Print out the serial number.
498 If this flag is the only one specified,
499 .Nm
500 will not print out "Serial Number" before the value returned by the drive.
501 This is to aid in script writing.
502 .It Fl R
503 Print out transfer rate information.
504 .El
505 .It Ic identify
506 Send a ATA identify command (0xec) to a device.
507 .It Ic reportluns
508 Send the SCSI REPORT LUNS (0xA0) command to the given device.
509 By default,
510 .Nm
511 will print out the list of logical units (LUNs) supported by the target device.
512 There are a couple of options to modify the output:
513 .Bl -tag -width 14n
514 .It Fl c
515 Just print out a count of LUNs, not the actual LUN numbers.
516 .It Fl l
517 Just print out the LUNs, and do not print out the count.
518 .It Fl r Ar reporttype
519 Specify the type of report to request from the target:
520 .Bl -tag -width 012345678
521 .It default
522 Return the default report.
523 This is the
524 .Nm
525 default.
526 Most targets will support this report if they support the REPORT LUNS
527 command.
528 .It wellknown
529 Return only well known LUNs.
530 .It all
531 Return all available LUNs.
532 .El
533 .El
534 .Pp
535 .Nm
536 will try to print out LUN numbers in a reasonable format.
537 It can understand the peripheral, flat, LUN and extended LUN formats.
538 .It Ic readcap
539 Send the SCSI READ CAPACITY command to the given device and display
540 the results.
541 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
542 action will be sent to obtain the full size of the device.
543 By default,
544 .Nm
545 will print out the last logical block of the device, and the blocksize of
546 the device in bytes.
547 To modify the output format, use the following options:
548 .Bl -tag -width 5n
549 .It Fl b
550 Just print out the blocksize, not the last block or device size.
551 This cannot be used with
552 .Fl N
553 or
554 .Fl s .
555 .It Fl h
556 Print out the device size in human readable (base 2, 1K == 1024) format.
557 This implies
558 .Fl N
559 and cannot be used with
560 .Fl q
561 or
562 .Fl b .
563 .It Fl H
564 Print out the device size in human readable (base 10, 1K == 1000) format.
565 .It Fl l
566 Skip sending the SCSI READ CAPACITY (10) command.
567 Send only the SCSI READ CAPACITY (16) service action and report
568 its results.
569 When the two do not match, a quirk is needed to resolve the ambiguity.
570 .It Fl N
571 Print out the number of blocks in the device instead of the last logical
572 block.
573 .It Fl q
574 Quiet, print out the numbers only (separated by a comma if
575 .Fl b
576 or
577 .Fl s
578 are not specified).
579 .It Fl s
580 Print out the last logical block or the size of the device only, and omit
581 the blocksize.
582 .El
583 .Pp
584 Note that this command only displays the information, it does not update
585 the kernel data structures.
586 Use the
587 .Nm
588 reprobe subcommand to do that.
589 .It Ic start
590 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
591 start bit set.
592 .It Ic stop
593 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
594 start bit cleared.
595 .It Ic load
596 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
597 start bit set and the load/eject bit set.
598 .It Ic eject
599 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
600 start bit cleared and the load/eject bit set.
601 .It Ic rescan
602 Tell the kernel to scan all buses in the system (with the
603 .Ar all
604 argument), the given bus (XPT_SCAN_BUS), bus:target:lun or device
605 (XPT_SCAN_LUN) for new devices or devices that have gone away.
606 The user
607 may specify a scan of all buses, a single bus, or a lun.
608 Scanning all luns
609 on a target is not supported.
610 .Pp
611 If a device is specified by peripheral name and unit number, for instance
612 da4, it may only be rescanned if that device currently exists in the CAM EDT
613 (Existing Device Table).
614 If the device is no longer there (see
615 .Nm
616 devlist ),
617 you must use the bus:target:lun form to rescan it.
618 .It Ic reprobe
619 Tell the kernel to refresh the information about the device and
620 notify the upper layer,
621 .Xr GEOM 4 .
622 This includes sending the SCSI READ CAPACITY command and updating
623 the disk size visible to the rest of the system.
624 .It Ic reset
625 Tell the kernel to reset all buses in the system (with the
626 .Ar all
627 argument), the given bus (XPT_RESET_BUS) by issuing a SCSI bus
628 reset for that bus, or to reset the given bus:target:lun or device
629 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
630 connecting to that device.
631 Note that this can have a destructive impact
632 on the system.
633 .It Ic defects
634 Send the
635 .Tn SCSI
636 READ DEFECT DATA (10) command (0x37) or the
637 .Tn SCSI
638 READ DEFECT DATA (12) command (0xB7) to the given device, and
639 print out any combination of: the total number of defects, the primary
640 defect list (PLIST), and the grown defect list (GLIST).
641 .Bl -tag -width 11n
642 .It Fl f Ar format
643 Specify the requested format of the defect list.
644 The format argument is
645 required.
646 Most drives support the physical sector format.
647 Some drives
648 support the logical block format.
649 Many drives, if they do not support the
650 requested format, return the data in an alternate format, along with sense
651 information indicating that the requested data format is not supported.
652 The
653 .Nm
654 utility
655 attempts to detect this, and print out whatever format the drive returns.
656 If the drive uses a non-standard sense code to report that it does not
657 support the requested format,
658 .Nm
659 will probably see the error as a failure to complete the request.
660 .Pp
661 The format options are:
662 .Bl -tag -width 9n
663 .It block
664 Print out the list as logical blocks.
665 This is limited to 32-bit block sizes, and isn't supported by many modern
666 drives.
667 .It longblock
668 Print out the list as logical blocks.
669 This option uses a 64-bit block size.
670 .It bfi
671 Print out the list in bytes from index format.
672 .It extbfi
673 Print out the list in extended bytes from index format.
674 The extended format allows for ranges of blocks to be printed.
675 .It phys
676 Print out the list in physical sector format.
677 Most drives support this format.
678 .It extphys
679 Print out the list in extended physical sector format.
680 The extended format allows for ranges of blocks to be printed.
681 .El
682 .It Fl G
683 Print out the grown defect list.
684 This is a list of bad blocks that have
685 been remapped since the disk left the factory.
686 .It Fl P
687 Print out the primary defect list.
688 This is the list of defects that were present in the factory.
689 .It Fl q
690 When printing status information with
691 .Fl s ,
692 only print the number of defects.
693 .It Fl s
694 Just print the number of defects, not the list of defects.
695 .It Fl S Ar offset
696 Specify the starting offset into the defect list.
697 This implies using the
698 .Tn SCSI
699 READ DEFECT DATA (12) command, as the 10 byte version of the command
700 doesn't support the address descriptor index field.
701 Not all drives support the 12 byte command, and some drives that support
702 the 12 byte command don't support the address descriptor index field.
703 .It Fl X
704 Print out defects in hexadecimal (base 16) form instead of base 10 form.
705 .El
706 .Pp
707 If neither
708 .Fl P
709 nor
710 .Fl G
711 is specified,
712 .Nm
713 will print out the number of defects given in the READ DEFECT DATA header
714 returned from the drive.
715 Some drives will report 0 defects if neither the primary or grown defect
716 lists are requested.
717 .It Ic modepage
718 Allows the user to display and optionally edit a SCSI mode page.
719 The mode
720 page formats are located in
721 .Pa /usr/share/misc/scsi_modes .
722 This can be overridden by specifying a different file in the
723 .Ev SCSI_MODES
724 environment variable.
725 The
726 .Ic modepage
727 command takes several arguments:
728 .Bl -tag -width 12n
729 .It Fl 6
730 Use 6 byte MODE commands instead of default 10 byte.
731 Old devices may not support 10 byte MODE commands, while new devices may
732 not be able to report all mode pages with 6 byte commands.
733 If not specified,
734 .Nm
735 starts with 10 byte commands and falls back to 6 byte on error.
736 .It Fl d
737 Disable block descriptors for mode sense.
738 .It Fl D
739 Display/edit block descriptors instead of mode page.
740 .It Fl L
741 Use long LBA block descriptors.
742 Allows number of LBAs bigger then 2^^32.
743 .It Fl b
744 Displays mode page data in binary format.
745 .It Fl e
746 This flag allows the user to edit values in the mode page.
747 The user may
748 either edit mode page values with the text editor pointed to by his
749 .Ev EDITOR
750 environment variable, or supply mode page values via standard input, using
751 the same format that
752 .Nm
753 uses to display mode page values.
754 The editor will be invoked if
755 .Nm
756 detects that standard input is terminal.
757 .It Fl l
758 Lists all available mode pages.
759 If specified more then once, also lists subpages.
760 .It Fl m Ar page[,subpage]
761 This specifies the number of the mode page and optionally subpage the user
762 would like to view and/or edit.
763 This argument is mandatory unless
764 .Fl l
765 is specified.
766 .It Fl P Ar pgctl
767 This allows the user to specify the page control field.
768 Possible values are:
769 .Bl -tag -width xxx -compact
770 .It 0
771 Current values
772 .It 1
773 Changeable values
774 .It 2
775 Default values
776 .It 3
777 Saved values
778 .El
779 .El
780 .It Ic cmd
781 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
782 The
783 .Ic cmd
784 function requires the
785 .Fl c
786 argument to specify SCSI CDB or the
787 .Fl a
788 argument to specify ATA Command Block registers values.
789 Other arguments are optional, depending on
790 the command type.
791 The command and data specification syntax is documented
792 in
793 .Xr cam_cdbparse 3 .
794 NOTE: If the CDB specified causes data to be transferred to or from the
795 SCSI device in question, you MUST specify either
796 .Fl i
797 or
798 .Fl o .
799 .Bl -tag -width 17n
800 .It Fl a Ar cmd Op args
801 This specifies the content of 12 ATA Command Block registers (command,
802 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
803 lba_high_exp, features_exp, sector_count, sector_count_exp).
804 .It Fl c Ar cmd Op args
805 This specifies the SCSI CDB.
806 SCSI CDBs may be 6, 10, 12 or 16 bytes.
807 .It Fl d
808 Specifies DMA protocol to be used for ATA command.
809 .It Fl f
810 Specifies FPDMA (NCQ) protocol to be used for ATA command.
811 .It Fl i Ar len Ar fmt
812 This specifies the amount of data to read, and how it should be displayed.
813 If the format is
814 .Sq - ,
815 .Ar len
816 bytes of data will be read from the device and written to standard output.
817 .It Fl o Ar len Ar fmt Op args
818 This specifies the amount of data to be written to a device, and the data
819 that is to be written.
820 If the format is
821 .Sq - ,
822 .Ar len
823 bytes of data will be read from standard input and written to the device.
824 .It Fl r Ar fmt
825 This specifies that 11 result ATA Command Block registers should be displayed
826 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
827 lba_high_exp, sector_count, sector_count_exp), and how.
828 If the format is
829 .Sq - ,
830 11 result registers will be written to standard output in hex.
831 .El
832 .It Ic smpcmd
833 Allows the user to send an arbitrary Serial
834 Management Protocol (SMP) command to a device.
835 The
836 .Ic smpcmd
837 function requires the
838 .Fl r
839 argument to specify the SMP request to be sent, and the
840 .Fl R
841 argument to specify the format of the SMP response.
842 The syntax for the SMP request and response arguments is documented in
843 .Xr cam_cdbparse 3 .
844 .Pp
845 Note that SAS adapters that support SMP passthrough (at least the currently
846 known adapters) do not accept CRC bytes from the user in the request and do
847 not pass CRC bytes back to the user in the response.
848 Therefore users should not include the CRC bytes in the length of the
849 request and not expect CRC bytes to be returned in the response.
850 .Bl -tag -width 17n
851 .It Fl r Ar len Ar fmt Op args
852 This specifies the size of the SMP request, without the CRC bytes, and the
853 SMP request format.
854 If the format is
855 .Sq - ,
856 .Ar len
857 bytes of data will be read from standard input and written as the SMP
858 request.
859 .It Fl R Ar len Ar fmt Op args
860 This specifies the size of the buffer allocated for the SMP response, and
861 the SMP response format.
862 If the format is
863 .Sq - ,
864 .Ar len
865 bytes of data will be allocated for the response and the response will be
866 written to standard output.
867 .El
868 .It Ic smprg
869 Allows the user to send the Serial Management Protocol (SMP) Report General
870 command to a device.
871 .Nm
872 will display the data returned by the Report General command.
873 If the SMP target supports the long response format, the additional data
874 will be requested and displayed automatically.
875 .Bl -tag -width 8n
876 .It Fl l
877 Request the long response format only.
878 Not all SMP targets support the long response format.
879 This option causes
880 .Nm
881 to skip sending the initial report general request without the long bit set
882 and only issue a report general request with the long bit set.
883 .El
884 .It Ic smppc
885 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
886 command to a device.
887 This function should be used with some caution, as it can render devices
888 inaccessible, and could potentially cause data corruption as well.
889 The
890 .Fl p
891 argument is required to specify the PHY to operate on.
892 .Bl -tag -width 17n
893 .It Fl p Ar phy
894 Specify the PHY to operate on.
895 This argument is required.
896 .It Fl l
897 Request the long request/response format.
898 Not all SMP targets support the long response format.
899 For the PHY Control command, this currently only affects whether the
900 request length is set to a value other than 0.
901 .It Fl o Ar operation
902 Specify a PHY control operation.
903 Only one
904 .Fl o
905 operation may be specified.
906 The operation may be specified numerically (in decimal, hexadecimal, or octal)
907 or one of the following operation names may be specified:
908 .Bl -tag -width 16n
909 .It nop
910 No operation.
911 It is not necessary to specify this argument.
912 .It linkreset
913 Send the LINK RESET command to the phy.
914 .It hardreset
915 Send the HARD RESET command to the phy.
916 .It disable
917 Send the DISABLE command to the phy.
918 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
919 .It clearerrlog
920 Send the CLEAR ERROR LOG command.
921 This clears the error log counters for the specified phy.
922 .It clearaffiliation
923 Send the CLEAR AFFILIATION command.
924 This clears the affiliation from the STP initiator port with the same SAS
925 address as the SMP initiator that requests the clear operation.
926 .It sataportsel
927 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
928 This will cause a SATA port selector to use the given phy as its active phy
929 and make the other phy inactive.
930 .It clearitnl
931 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
932 .It setdevname
933 Send the SET ATTACHED DEVICE NAME command to the PHY.
934 This requires the
935 .Fl d
936 argument to specify the device name.
937 .El
938 .It Fl d Ar name
939 Specify the attached device name.
940 This option is needed with the
941 .Fl o Ar setdevname
942 phy operation.
943 The name is a 64-bit number, and can be specified in decimal, hexadecimal
944 or octal format.
945 .It Fl m Ar rate
946 Set the minimum physical link rate for the phy.
947 This is a numeric argument.
948 Currently known link rates are:
949 .Bl -tag -width 5n
950 .It 0x0
951 Do not change current value.
952 .It 0x8
953 1.5 Gbps
954 .It 0x9
955 3 Gbps
956 .It 0xa
957 6 Gbps
958 .El
959 .Pp
960 Other values may be specified for newer physical link rates.
961 .It Fl M Ar rate
962 Set the maximum physical link rate for the phy.
963 This is a numeric argument.
964 See the
965 .Fl m
966 argument description for known link rate arguments.
967 .It Fl T Ar pp_timeout
968 Set the partial pathway timeout value, in microseconds.
969 See the
970 .Tn ANSI
971 .Tn SAS
972 Protocol Layer (SPL)
973 specification for more information on this field.
974 .It Fl a Ar enable|disable
975 Enable or disable SATA slumber phy power conditions.
976 .It Fl A Ar enable|disable
977 Enable or disable SATA partial power conditions.
978 .It Fl s Ar enable|disable
979 Enable or disable SAS slumber phy power conditions.
980 .It Fl S Ar enable|disable
981 Enable or disable SAS partial phy power conditions.
982 .El
983 .It Ic smpphylist
984 List phys attached to a SAS expander, the address of the end device
985 attached to the phy, and the inquiry data for that device and peripheral
986 devices attached to that device.
987 The inquiry data and peripheral devices are displayed if available.
988 .Bl -tag -width 5n
989 .It Fl l
990 Turn on the long response format for the underlying SMP commands used for
991 this command.
992 .It Fl q
993 Only print out phys that are attached to a device in the CAM EDT (Existing
994 Device Table).
995 .El
996 .It Ic smpmaninfo
997 Send the SMP Report Manufacturer Information command to the device and
998 display the response.
999 .Bl -tag -width 5n
1000 .It Fl l
1001 Turn on the long response format for the underlying SMP commands used for
1002 this command.
1003 .El
1004 .It Ic debug
1005 Turn on CAM debugging printfs in the kernel.
1006 This requires options CAMDEBUG
1007 in your kernel config file.
1008 WARNING: enabling debugging printfs currently
1009 causes an EXTREME number of kernel printfs.
1010 You may have difficulty
1011 turning off the debugging printfs once they start, since the kernel will be
1012 busy printing messages and unable to service other requests quickly.
1013 The
1014 .Ic debug
1015 function takes a number of arguments:
1016 .Bl -tag -width 18n
1017 .It Fl I
1018 Enable CAM_DEBUG_INFO printfs.
1019 .It Fl P
1020 Enable CAM_DEBUG_PERIPH printfs.
1021 .It Fl T
1022 Enable CAM_DEBUG_TRACE printfs.
1023 .It Fl S
1024 Enable CAM_DEBUG_SUBTRACE printfs.
1025 .It Fl X
1026 Enable CAM_DEBUG_XPT printfs.
1027 .It Fl c
1028 Enable CAM_DEBUG_CDB printfs.
1029 This will cause the kernel to print out the
1030 SCSI CDBs sent to the specified device(s).
1031 .It Fl p
1032 Enable CAM_DEBUG_PROBE printfs.
1033 .It all
1034 Enable debugging for all devices.
1035 .It off
1036 Turn off debugging for all devices
1037 .It bus Ns Op :target Ns Op :lun
1038 Turn on debugging for the given bus, target or lun.
1039 If the lun or target
1040 and lun are not specified, they are wildcarded.
1041 (i.e., just specifying a
1042 bus turns on debugging printfs for all devices on that bus.)
1043 .El
1044 .It Ic tags
1045 Show or set the number of "tagged openings" or simultaneous transactions
1046 we attempt to queue to a particular device.
1047 By default, the
1048 .Ic tags
1049 command, with no command-specific arguments (i.e., only generic arguments)
1050 prints out the "soft" maximum number of transactions that can be queued to
1051 the device in question.
1052 For more detailed information, use the
1053 .Fl v
1054 argument described below.
1055 .Bl -tag -width 7n
1056 .It Fl N Ar tags
1057 Set the number of tags for the given device.
1058 This must be between the
1059 minimum and maximum number set in the kernel quirk table.
1060 The default for
1061 most devices that support tagged queueing is a minimum of 2 and a maximum
1062 of 255.
1063 The minimum and maximum values for a given device may be
1064 determined by using the
1065 .Fl v
1066 switch.
1067 The meaning of the
1068 .Fl v
1069 switch for this
1070 .Nm
1071 subcommand is described below.
1072 .It Fl q
1073 Be quiet, and do not report the number of tags.
1074 This is generally used when
1075 setting the number of tags.
1076 .It Fl v
1077 The verbose flag has special functionality for the
1078 .Em tags
1079 argument.
1080 It causes
1081 .Nm
1082 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
1083 .Bl -tag -width 13n
1084 .It dev_openings
1085 This is the amount of capacity for transactions queued to a given device.
1086 .It dev_active
1087 This is the number of transactions currently queued to a device.
1088 .It devq_openings
1089 This is the kernel queue space for transactions.
1090 This count usually mirrors
1091 dev_openings except during error recovery operations when
1092 the device queue is frozen (device is not allowed to receive
1093 commands), the number of dev_openings is reduced, or transaction
1094 replay is occurring.
1095 .It devq_queued
1096 This is the number of transactions waiting in the kernel queue for capacity
1097 on the device.
1098 This number is usually zero unless error recovery is in
1099 progress.
1100 .It held
1101 The held count is the number of CCBs held by peripheral drivers that have
1102 either just been completed or are about to be released to the transport
1103 layer for service by a device.
1104 Held CCBs reserve capacity on a given
1105 device.
1106 .It mintags
1107 This is the current "hard" minimum number of transactions that can be
1108 queued to a device at once.
1109 The
1110 .Ar dev_openings
1111 value above cannot go below this number.
1112 The default value for
1113 .Ar mintags
1114 is 2, although it may be set higher or lower for various devices.
1115 .It maxtags
1116 This is the "hard" maximum number of transactions that can be queued to a
1117 device at one time.
1118 The
1119 .Ar dev_openings
1120 value cannot go above this number.
1121 The default value for
1122 .Ar maxtags
1123 is 255, although it may be set higher or lower for various devices.
1124 .El
1125 .El
1126 .It Ic negotiate
1127 Show or negotiate various communication parameters.
1128 Some controllers may
1129 not support setting or changing some of these values.
1130 For instance, the
1131 Adaptec 174x controllers do not support changing a device's sync rate or
1132 offset.
1133 The
1134 .Nm
1135 utility
1136 will not attempt to set the parameter if the controller indicates that it
1137 does not support setting the parameter.
1138 To find out what the controller
1139 supports, use the
1140 .Fl v
1141 flag.
1142 The meaning of the
1143 .Fl v
1144 flag for the
1145 .Ic negotiate
1146 command is described below.
1147 Also, some controller drivers do not support
1148 setting negotiation parameters, even if the underlying controller supports
1149 negotiation changes.
1150 Some controllers, such as the Advansys wide
1151 controllers, support enabling and disabling synchronous negotiation for
1152 a device, but do not support setting the synchronous negotiation rate.
1153 .Bl -tag -width 17n
1154 .It Fl a
1155 Attempt to make the negotiation settings take effect immediately by sending
1156 a Test Unit Ready command to the device.
1157 .It Fl c
1158 Show or set current negotiation settings.
1159 This is the default.
1160 .It Fl D Ar enable|disable
1161 Enable or disable disconnection.
1162 .It Fl M Ar mode
1163 Set ATA mode.
1164 .It Fl O Ar offset
1165 Set the command delay offset.
1166 .It Fl q
1167 Be quiet, do not print anything.
1168 This is generally useful when you want to
1169 set a parameter, but do not want any status information.
1170 .It Fl R Ar syncrate
1171 Change the synchronization rate for a device.
1172 The sync rate is a floating
1173 point value specified in MHz.
1174 So, for instance,
1175 .Sq 20.000
1176 is a legal value, as is
1177 .Sq 20 .
1178 .It Fl T Ar enable|disable
1179 Enable or disable tagged queueing for a device.
1180 .It Fl U
1181 Show or set user negotiation settings.
1182 The default is to show or set
1183 current negotiation settings.
1184 .It Fl v
1185 The verbose switch has special meaning for the
1186 .Ic negotiate
1187 subcommand.
1188 It causes
1189 .Nm
1190 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1191 controller driver.
1192 .It Fl W Ar bus_width
1193 Specify the bus width to negotiate with a device.
1194 The bus width is
1195 specified in bits.
1196 The only useful values to specify are 8, 16, and 32
1197 bits.
1198 The controller must support the bus width in question in order for
1199 the setting to take effect.
1200 .El
1201 .Pp
1202 In general, sync rate and offset settings will not take effect for a
1203 device until a command has been sent to the device.
1204 The
1205 .Fl a
1206 switch above will automatically send a Test Unit Ready to the device so
1207 negotiation parameters will take effect.
1208 .It Ic format
1209 Issue the
1210 .Tn SCSI
1211 FORMAT UNIT command to the named device.
1212 .Pp
1213 .Em WARNING! WARNING! WARNING!
1214 .Pp
1215 Low level formatting a disk will destroy ALL data on the disk.
1216 Use
1217 extreme caution when issuing this command.
1218 Many users low-level format
1219 disks that do not really need to be low-level formatted.
1220 There are
1221 relatively few scenarios that call for low-level formatting a disk.
1222 One reason for
1223 low-level formatting a disk is to initialize the disk after changing
1224 its physical sector size.
1225 Another reason for low-level formatting a disk
1226 is to revive the disk if you are getting "medium format corrupted" errors
1227 from the disk in response to read and write requests.
1228 .Pp
1229 Some disks take longer than others to format.
1230 Users should specify a
1231 timeout long enough to allow the format to complete.
1232 The default format
1233 timeout is 3 hours, which should be long enough for most disks.
1234 Some hard
1235 disks will complete a format operation in a very short period of time
1236 (on the order of 5 minutes or less).
1237 This is often because the drive
1238 does not really support the FORMAT UNIT command -- it just accepts the
1239 command, waits a few minutes and then returns it.
1240 .Pp
1241 The
1242 .Sq format
1243 subcommand takes several arguments that modify its default behavior.
1244 The
1245 .Fl q
1246 and
1247 .Fl y
1248 arguments can be useful for scripts.
1249 .Bl -tag -width 6n
1250 .It Fl q
1251 Be quiet, do not print any status messages.
1252 This option will not disable
1253 the questions, however.
1254 To disable questions, use the
1255 .Fl y
1256 argument, below.
1257 .It Fl r
1258 Run in
1259 .Dq report only
1260 mode.
1261 This will report status on a format that is already running on the drive.
1262 .It Fl w
1263 Issue a non-immediate format command.
1264 By default,
1265 .Nm
1266 issues the FORMAT UNIT command with the immediate bit set.
1267 This tells the
1268 device to immediately return the format command, before the format has
1269 actually completed.
1270 Then,
1271 .Nm
1272 gathers
1273 .Tn SCSI
1274 sense information from the device every second to determine how far along
1275 in the format process it is.
1276 If the
1277 .Fl w
1278 argument is specified,
1279 .Nm
1280 will issue a non-immediate format command, and will be unable to print any
1281 information to let the user know what percentage of the disk has been
1282 formatted.
1283 .It Fl y
1284 Do not ask any questions.
1285 By default,
1286 .Nm
1287 will ask the user if he/she really wants to format the disk in question,
1288 and also if the default format command timeout is acceptable.
1289 The user
1290 will not be asked about the timeout if a timeout is specified on the
1291 command line.
1292 .El
1293 .It Ic sanitize
1294 Issue the SANITIZE command to the named device.
1295 .Pp
1296 .Em WARNING! WARNING! WARNING!
1297 .Pp
1298 ALL data on the disk will be destroyed or made inaccessible.
1299 Recovery of the data is not possible.
1300 Use extreme caution when issuing this command.
1301 .Pp
1302 The
1303 .Sq sanitize
1304 subcommand takes several arguments that modify its default behavior.
1305 The
1306 .Fl q
1307 and
1308 .Fl y
1309 arguments can be useful for scripts.
1310 .Bl -tag -width 6n
1311 .It Fl a Ar operation
1312 Specify the sanitize operation to perform.
1313 .Bl -tag -width 16n
1314 .It overwrite
1315 Perform an overwrite operation by writing a user supplied
1316 data pattern to the device one or more times.
1317 The pattern is given by the
1318 .Fl P
1319 argument.
1320 The number of times is given by the
1321 .Fl c
1322 argument.
1323 .It block
1324 Perform a block erase operation.
1325 All the device's blocks are set to a vendor defined
1326 value, typically zero.
1327 .It crypto
1328 Perform a cryptographic erase operation.
1329 The encryption keys are changed to prevent the decryption
1330 of the data.
1331 .It exitfailure
1332 Exits a previously failed sanitize operation.
1333 A failed sanitize operation can only be exited if it was
1334 run in the unrestricted completion mode, as provided by the
1335 .Fl U
1336 argument.
1337 .El
1338 .It Fl c Ar passes
1339 The number of passes when performing an
1340 .Sq overwrite
1341 operation.
1342 Valid values are between 1 and 31.
1343 The default is 1.
1344 .It Fl I
1345 When performing an
1346 .Sq overwrite
1347 operation, the pattern is inverted between consecutive passes.
1348 .It Fl P Ar pattern
1349 Path to the file containing the pattern to use when
1350 performing an
1351 .Sq overwrite
1352 operation.
1353 The pattern is repeated as needed to fill each block.
1354 .It Fl q
1355 Be quiet, do not print any status messages.
1356 This option will not disable
1357 the questions, however.
1358 To disable questions, use the
1359 .Fl y
1360 argument, below.
1361 .It Fl U
1362 Perform the sanitize in the unrestricted completion mode.
1363 If the operation fails, it can later be exited with the
1364 .Sq exitfailure
1365 operation.
1366 .It Fl r
1367 Run in
1368 .Dq report only
1369 mode.
1370 This will report status on a sanitize that is already running on the drive.
1371 .It Fl w
1372 Issue a non-immediate sanitize command.
1373 By default,
1374 .Nm
1375 issues the SANITIZE command with the immediate bit set.
1376 This tells the
1377 device to immediately return the sanitize command, before
1378 the sanitize has actually completed.
1379 Then,
1380 .Nm
1381 gathers
1382 .Tn SCSI
1383 sense information from the device every second to determine how far along
1384 in the sanitize process it is.
1385 If the
1386 .Fl w
1387 argument is specified,
1388 .Nm
1389 will issue a non-immediate sanitize command, and will be unable to print any
1390 information to let the user know what percentage of the disk has been
1391 sanitized.
1392 .It Fl y
1393 Do not ask any questions.
1394 By default,
1395 .Nm
1396 will ask the user if he/she really wants to sanitize the disk in question,
1397 and also if the default sanitize command timeout is acceptable.
1398 The user
1399 will not be asked about the timeout if a timeout is specified on the
1400 command line.
1401 .El
1402 .It Ic idle
1403 Put ATA device into IDLE state.
1404 Optional parameter
1405 .Pq Fl t
1406 specifies automatic standby timer value in seconds.
1407 Value 0 disables timer.
1408 .It Ic standby
1409 Put ATA device into STANDBY state.
1410 Optional parameter
1411 .Pq Fl t
1412 specifies automatic standby timer value in seconds.
1413 Value 0 disables timer.
1414 .It Ic sleep
1415 Put ATA device into SLEEP state.
1416 Note that the only way get device out of
1417 this state may be reset.
1418 .It Ic powermode
1419 Report ATA device power mode.
1420 .It Ic apm
1421 It optional parameter
1422 .Pq Fl l
1423 specified, enables and sets advanced power management level, where
1424 1 -- minimum power, 127 -- maximum performance with standby,
1425 128 -- minimum power without standby, 254 -- maximum performance.
1426 If not specified -- APM is disabled.
1427 .It Ic aam
1428 It optional parameter
1429 .Pq Fl l
1430 specified, enables and sets automatic acoustic management level, where
1431 1 -- minimum noise, 254 -- maximum performance.
1432 If not specified -- AAM is disabled.
1433 .It Ic security
1434 Update or report security settings, using an ATA identify command (0xec).
1435 By default,
1436 .Nm
1437 will print out the security support and associated settings of the device.
1438 The
1439 .Ic security
1440 command takes several arguments:
1441 .Bl -tag -width 0n
1442 .It Fl d Ar pwd
1443 .Pp
1444 Disable device security using the given password for the selected user according
1445 to the devices configured security level.
1446 .It Fl e Ar pwd
1447 .Pp
1448 Erase the device using the given password for the selected user.
1449 .Pp
1450 .Em WARNING! WARNING! WARNING!
1451 .Pp
1452 Issuing a secure erase will
1453 .Em ERASE ALL
1454 user data on the device and may take several hours to complete.
1455 .Pp
1456 When this command is used against an SSD drive all its cells will be marked as
1457 empty, restoring it to factory default write performance.
1458 For SSD's this action
1459 usually takes just a few seconds.
1460 .It Fl f
1461 .Pp
1462 Freeze the security configuration of the specified device.
1463 .Pp
1464 After command completion any other commands that update the device lock mode
1465 shall be command aborted.
1466 Frozen mode is disabled by power-off or hardware reset.
1467 .It Fl h Ar pwd
1468 .Pp
1469 Enhanced erase the device using the given password for the selected user.
1470 .Pp
1471 .Em WARNING! WARNING! WARNING!
1472 .Pp
1473 Issuing an enhanced secure erase will
1474 .Em ERASE ALL
1475 user data on the device and may take several hours to complete.
1476 .Pp
1477 An enhanced erase writes predetermined data patterns to all user data areas,
1478 all previously written user data shall be overwritten, including sectors that
1479 are no longer in use due to reallocation.
1480 .It Fl k Ar pwd
1481 .Pp
1482 Unlock the device using the given password for the selected user according to
1483 the devices configured security level.
1484 .It Fl l Ar high|maximum
1485 .Pp
1486 Specifies which security level to set when issuing a
1487 .Fl s Ar pwd
1488 command.
1489 The security level determines device behavior when the master
1490 password is used to unlock the device.
1491 When the security level is set to high
1492 the device requires the unlock command and the master password to unlock.
1493 When the security level is set to maximum the device requires a secure erase
1494 with the master password to unlock.
1495 .Pp
1496 This option must be used in conjunction with one of the security action commands.
1497 .Pp
1498 Defaults to
1499 .Em high
1500 .It Fl q
1501 .Pp
1502 Be quiet, do not print any status messages.
1503 This option will not disable the questions, however.
1504 To disable questions, use the
1505 .Fl y
1506 argument, below.
1507 .It Fl s Ar pwd
1508 .Pp
1509 Password the device (enable security) using the given password for the selected
1510 user.
1511 This option can be combined with other options such as
1512 .Fl e Em pwd
1513 .Pp
1514 A master password may be set in a addition to the user password.
1515 The purpose of the master password is to allow an administrator to establish
1516 a password that is kept secret from the user, and which may be used to unlock
1517 the device if the user password is lost.
1518 .Pp
1519 .Em Note:
1520 Setting the master password does not enable device security.
1521 .Pp
1522 If the master password is set and the drive supports a Master Revision Code
1523 feature the Master Password Revision Code will be decremented.
1524 .It Fl T Ar timeout
1525 .Pp
1526 Overrides the default timeout, specified in seconds, used for both
1527 .Fl e
1528 and
1529 .Fl h
1530 this is useful if your system has problems processing long timeouts correctly.
1531 .Pp
1532 Usually the timeout is calculated from the information stored on the drive if
1533 present, otherwise it defaults to 2 hours.
1534 .It Fl U Ar user|master
1535 .Pp
1536 Specifies which user to set / use for the running action command, valid values
1537 are user or master and defaults to master if not set.
1538 .Pp
1539 This option must be used in conjunction with one of the security action commands.
1540 .Pp
1541 Defaults to
1542 .Em master
1543 .It Fl y
1544 .Pp
1545 Confirm yes to dangerous options such as
1546 .Fl e
1547 without prompting for confirmation.
1548 .El
1549 .Pp
1550 If the password specified for any action commands does not match the configured
1551 password for the specified user the command will fail.
1552 .Pp
1553 The password in all cases is limited to 32 characters, longer passwords will
1554 fail.
1555 .It Ic hpa
1556 Update or report Host Protected Area details.
1557 By default
1558 .Nm
1559 will print out the HPA support and associated settings of the device.
1560 The
1561 .Ic hpa
1562 command takes several optional arguments:
1563 .Bl -tag -width 0n
1564 .It Fl f
1565 .Pp
1566 Freeze the HPA configuration of the specified device.
1567 .Pp
1568 After command completion any other commands that update the HPA configuration
1569 shall be command aborted.
1570 Frozen mode is disabled by power-off or hardware reset.
1571 .It Fl l
1572 .Pp
1573 Lock the HPA configuration of the device until a successful call to unlock or
1574 the next power-on reset occurs.
1575 .It Fl P
1576 .Pp
1577 Make the HPA max sectors persist across power-on reset or a hardware reset.
1578 This must be used in combination with
1579 .Fl s Ar max_sectors
1580 .
1581 .It Fl p Ar pwd
1582 .Pp
1583 Set the HPA configuration password required for unlock calls.
1584 .It Fl q
1585 .Pp
1586 Be quiet, do not print any status messages.
1587 This option will not disable the questions.
1588 To disable questions, use the
1589 .Fl y
1590 argument, below.
1591 .It Fl s Ar max_sectors
1592 .Pp
1593 Configures the maximum user accessible sectors of the device.
1594 This will change the number of sectors the device reports.
1595 .Pp
1596 .Em WARNING! WARNING! WARNING!
1597 .Pp
1598 Changing the max sectors of a device using this option will make the data on
1599 the device beyond the specified value inaccessible.
1600 .Pp
1601 Only one successful
1602 .Fl s Ar max_sectors
1603 call can be made without a power-on reset or a hardware reset of the device.
1604 .It Fl U Ar pwd
1605 .Pp
1606 Unlock the HPA configuration of the specified device using the given password.
1607 If the password specified does not match the password configured via
1608 .Fl p Ar pwd
1609 the command will fail.
1610 .Pp
1611 After 5 failed unlock calls, due to password miss-match, the device will refuse
1612 additional unlock calls until after a power-on reset.
1613 .It Fl y
1614 .Pp
1615 Confirm yes to dangerous options such as
1616 .Fl e
1617 without prompting for confirmation
1618 .El
1619 .Pp
1620 The password for all HPA commands is limited to 32 characters, longer passwords
1621 will fail.
1622 .It Ic ama
1623 Update or report Accessible Max Address Configuration.
1624 By default
1625 .Nm
1626 will print out the Accessible Max Address Configuration support and associated
1627 settings of the device.
1628 The
1629 .Ic ama
1630 command takes several optional arguments:
1631 .Bl -tag -width 0n
1632 .It Fl f
1633 .Pp
1634 Freeze the Accessible Max Address Configuration of the specified device.
1635 .Pp
1636 After command completion any other commands that update the configuration
1637 shall be command aborted.
1638 Frozen mode is disabled by power-off.
1639 .It Fl q
1640 .Pp
1641 Be quiet, do not print any status messages.
1642 .It Fl s Ar max_sectors
1643 .Pp
1644 Configures the maximum user accessible sectors of the device.
1645 This will change the number of sectors the device reports.
1646 .Pp
1647 .Em WARNING! WARNING! WARNING!
1648 .Pp
1649 Changing the max sectors of a device using this option will make the data on
1650 the device beyond the specified value indeterminate.
1651 .Pp
1652 Only one successful
1653 .Fl s Ar max_sectors
1654 call can be made without a power-on reset of the device.
1655 .El
1656 .It Ic fwdownload
1657 Program firmware of the named
1658 .Tn SCSI
1659 or ATA device using the image file provided.
1660 .Pp
1661 If the device is a
1662 .Tn SCSI
1663 device and it provides a recommended timeout for the WRITE BUFFER command
1664 (see the
1665 .Nm
1666 opcodes subcommand), that timeout will be used for the firmware download.
1667 The drive-recommended timeout value may be overridden on the command line
1668 with the
1669 .Fl t
1670 option.
1671 .Pp
1672 Current list of supported vendors for SCSI/SAS drives:
1673 .Bl -tag -width 10n
1674 .It HGST
1675 Tested with 4TB SAS drives, model number HUS724040ALS640.
1676 .It HITACHI
1677 .It HP
1678 .It IBM
1679 Tested with LTO-5 (ULTRIUM-HH5) and LTO-6 (ULTRIUM-HH6) tape drives.
1680 There is a separate table entry for hard drives, because the update method
1681 for hard drives is different than the method for tape drives.
1682 .It PLEXTOR
1683 .It QUALSTAR
1684 .It QUANTUM
1685 .It SAMSUNG
1686 Tested with SM1625 SSDs.
1687 .It SEAGATE
1688 Tested with Constellation ES (ST32000444SS), ES.2 (ST33000651SS) and
1689 ES.3 (ST1000NM0023) drives.
1690 .It SmrtStor
1691 Tested with 400GB Optimus SSDs (TXA2D20400GA6001).
1692 .El
1693 .Pp
1694 .Em WARNING! WARNING! WARNING!
1695 .Pp
1696 Little testing has been done to make sure that different device models from
1697 each vendor work correctly with the fwdownload command.
1698 A vendor name appearing in the supported list means only that firmware of at
1699 least one device type from that vendor has successfully been programmed with
1700 the fwdownload command.
1701 Extra caution should be taken when using this command since there is no
1702 guarantee it will not break a device from the listed vendors.
1703 Ensure that you have a recent backup of the data on the device before
1704 performing a firmware update.
1705 .Pp
1706 Note that unknown
1707 .Tn SCSI
1708 protocol devices will not be programmed, since there is little chance of
1709 the firmware download succeeding.
1710 .Pp
1711 .Nm
1712 will currently attempt a firmware download to any
1713 .Tn ATA
1714 or
1715 .Tn SATA
1716 device, since the standard
1717 .Tn ATA
1718 DOWNLOAD MICROCODE command may work.
1719 Firmware downloads to
1720 .Tn ATA
1721 and
1722 .Tn SATA
1723 devices are supported for devices connected
1724 to standard
1725 .Tn ATA
1726 and
1727 .Tn SATA
1728 controllers, and devices connected to SAS controllers
1729 with
1730 .Tn SCSI
1731 to
1732 .Tn ATA
1733 translation capability.
1734 In the latter case,
1735 .Nm
1736 uses the
1737 .Tn SCSI
1738 .Tn ATA
1739 PASS-THROUGH command to send the
1740 .Tn ATA
1741 DOWNLOAD MICROCODE command to the drive.
1742 Some
1743 .Tn SCSI
1744 to
1745 .Tn ATA
1746 translation implementations don't work fully when translating
1747 .Tn SCSI
1748 WRITE BUFFER commands to
1749 .Tn ATA
1750 DOWNLOAD MICROCODE commands, but do support
1751 .Tn ATA
1752 passthrough well enough to do a firmware download.
1753 .Bl -tag -width 11n
1754 .It Fl f Ar fw_image
1755 Path to the firmware image file to be downloaded to the specified device.
1756 .It Fl q
1757 Do not print informational messages, only print errors.
1758 This option should be used with the
1759 .Fl y
1760 option to suppress all output.
1761 .It Fl s
1762 Run in simulation mode.
1763 Device checks are run and the confirmation dialog is shown, but no firmware
1764 download will occur.
1765 .It Fl v
1766 Show
1767 .Tn SCSI
1768 or
1769 .Tn ATA
1770 errors in the event of a failure.
1771 .Pp
1772 In simulation mode, print out the
1773 .Tn SCSI
1774 CDB
1775 or
1776 .Tn ATA
1777 register values that would be used for the firmware download command.
1778 .It Fl y
1779 Do not ask for confirmation.
1780 .El
1781 .It Ic persist
1782 Persistent reservation support.
1783 Persistent reservations are a way to reserve a particular
1784 .Tn SCSI
1785 LUN for use by one or more
1786 .Tn SCSI
1787 initiators.
1788 If the
1789 .Fl i
1790 option is specified,
1791 .Nm
1792 will issue the
1793 .Tn SCSI
1794 PERSISTENT RESERVE IN
1795 command using the requested service action.
1796 If the
1797 .Fl o
1798 option is specified,
1799 .Nm
1800 will issue the
1801 .Tn SCSI
1802 PERSISTENT RESERVE OUT
1803 command using the requested service action.
1804 One of those two options is required.
1805 .Pp
1806 Persistent reservations are complex, and fully explaining them is outside
1807 the scope of this manual.
1808 Please visit
1809 http://www.t10.org
1810 and download the latest SPC spec for a full explanation of persistent
1811 reservations.
1812 .Bl -tag -width 8n
1813 .It Fl i Ar mode
1814 Specify the service action for the PERSISTENT RESERVE IN command.
1815 Supported service actions:
1816 .Bl -tag -width 19n
1817 .It read_keys
1818 Report the current persistent reservation generation (PRgeneration) and any
1819 registered keys.
1820 .It read_reservation
1821 Report the persistent reservation, if any.
1822 .It report_capabilities
1823 Report the persistent reservation capabilities of the LUN.
1824 .It read_full_status
1825 Report the full status of persistent reservations on the LUN.
1826 .El
1827 .It Fl o Ar mode
1828 Specify the service action for the PERSISTENT RESERVE OUT command.
1829 For service actions like register that are components of other service
1830 action names, the entire name must be specified.
1831 Otherwise, enough of the service action name must be specified to
1832 distinguish it from other possible service actions.
1833 Supported service actions:
1834 .Bl -tag -width 15n
1835 .It register
1836 Register a reservation key with the LUN or unregister a reservation key.
1837 To register a key, specify the requested key as the Service Action
1838 Reservation Key.
1839 To unregister a key, specify the previously registered key as the
1840 Reservation Key.
1841 To change a key, specify the old key as the Reservation Key and the new
1842 key as the Service Action Reservation Key.
1843 .It register_ignore
1844 This is similar to the register subcommand, except that the Reservation Key
1845 is ignored.
1846 The Service Action Reservation Key will overwrite any previous key
1847 registered for the initiator.
1848 .It reserve
1849 Create a reservation.
1850 A key must be registered with the LUN before the LUN can be reserved, and
1851 it must be specified as the Reservation Key.
1852 The type of reservation must also be specified.
1853 The scope defaults to LUN scope (LU_SCOPE), but may be changed.
1854 .It release
1855 Release a reservation.
1856 The Reservation Key must be specified.
1857 .It clear
1858 Release a reservation and remove all keys from the device.
1859 The Reservation Key must be specified.
1860 .It preempt
1861 Remove a reservation belonging to another initiator.
1862 The Reservation Key must be specified.
1863 The Service Action Reservation Key may be specified, depending on the
1864 operation being performed.
1865 .It preempt_abort
1866 Remove a reservation belonging to another initiator and abort all
1867 outstanding commands from that initiator.
1868 The Reservation Key must be specified.
1869 The Service Action Reservation Key may be specified, depending on the
1870 operation being performed.
1871 .It register_move
1872 Register another initiator with the LUN, and establish a reservation on the
1873 LUN for that initiator.
1874 The Reservation Key and Service Action Reservation Key must be specified.
1875 .It replace_lost
1876 Replace Lost Reservation information.
1877 .El
1878 .It Fl a
1879 Set the All Target Ports (ALL_TG_PT) bit.
1880 This requests that the key registration be applied to all target ports and
1881 not just the particular target port that receives the command.
1882 This only applies to the register and register_ignore actions.
1883 .It Fl I Ar tid
1884 Specify a Transport ID.
1885 This only applies to the Register and Register and Move service actions for
1886 Persistent Reserve Out.
1887 Multiple Transport IDs may be specified with multiple
1888 .Fl I
1889 arguments.
1890 With the Register service action, specifying one or more Transport IDs
1891 implicitly enables the
1892 .Fl S
1893 option which turns on the SPEC_I_PT bit.
1894 Transport IDs generally have the format protocol,id.
1895 .Bl -tag -width 5n
1896 .It SAS
1897 A SAS Transport ID consists of
1898 .Dq sas,
1899 followed by a 64-bit SAS address.
1900 For example:
1901 .Pp
1902 .Dl sas,0x1234567812345678
1903 .It FC
1904 A Fibre Channel Transport ID consists of
1905 .Dq fcp,
1906 followed by a 64-bit Fibre Channel World Wide Name.
1907 For example:
1908 .Pp
1909 .Dl fcp,0x1234567812345678
1910 .It SPI
1911 A Parallel SCSI address consists of
1912 .Dq spi,
1913 followed by a SCSI target ID and a relative target port identifier.
1914 For example:
1915 .Pp
1916 .Dl spi,4,1
1917 .It 1394
1918 An IEEE 1394 (Firewire) Transport ID consists of
1919 .Dq sbp,
1920 followed by a 64-bit EUI-64 IEEE 1394 node unique identifier.
1921 For example:
1922 .Pp
1923 .Dl sbp,0x1234567812345678
1924 .It RDMA
1925 A SCSI over RDMA Transport ID consists of
1926 .Dq srp,
1927 followed by a 128-bit RDMA initiator port identifier.
1928 The port identifier must be exactly 32 or 34 (if the leading 0x is
1929 included) hexadecimal digits.
1930 Only hexadecimal (base 16) numbers are supported.
1931 For example:
1932 .Pp
1933 .Dl srp,0x12345678123456781234567812345678
1934 .It iSCSI
1935 An iSCSI Transport ID consists an iSCSI name and optionally a separator and
1936 iSCSI session ID.
1937 For example, if only the iSCSI name is specified:
1938 .Pp
1939 .Dl iqn.2012-06.com.example:target0
1940 .Pp
1941 If the iSCSI separator and initiator session ID are specified:
1942 .Pp
1943 .Dl iqn.2012-06.com.example:target0,i,0x123
1944 .It PCIe
1945 A SCSI over PCIe Transport ID consists of
1946 .Dq sop,
1947 followed by a PCIe Routing ID.
1948 The Routing ID consists of a bus, device and function or in the alternate
1949 form, a bus and function.
1950 The bus must be in the range of 0 to 255 inclusive and the device must be
1951 in the range of 0 to 31 inclusive.
1952 The function must be in the range of 0 to 7 inclusive if the standard form
1953 is used, and in the range of 0 to 255 inclusive if the alternate form is
1954 used.
1955 For example, if a bus, device and function are specified for the standard
1956 Routing ID form:
1957 .Pp
1958 .Dl sop,4,5,1
1959 .Pp
1960 If the alternate Routing ID form is used:
1961 .Pp
1962 .Dl sop,4,1
1963 .El
1964 .It Fl k Ar key
1965 Specify the Reservation Key.
1966 This may be in decimal, octal or hexadecimal format.
1967 The value is zero by default if not otherwise specified.
1968 The value must be between 0 and 2^64 - 1, inclusive.
1969 .It Fl K Ar key
1970 Specify the Service Action Reservation Key.
1971 This may be in decimal, octal or hexadecimal format.
1972 The value is zero by default if not otherwise specified.
1973 The value must be between 0 and 2^64 - 1, inclusive.
1974 .It Fl p
1975 Enable the Activate Persist Through Power Loss bit.
1976 This is only used for the register and register_ignore actions.
1977 This requests that the reservation persist across power loss events.
1978 .It Fl s Ar scope
1979 Specify the scope of the reservation.
1980 The scope may be specified by name or by number.
1981 The scope is ignored for register, register_ignore and clear.
1982 If the desired scope isn't available by name, you may specify the number.
1983 .Bl -tag -width 7n
1984 .It lun
1985 LUN scope (0x00).
1986 This encompasses the entire LUN.
1987 .It extent
1988 Extent scope (0x01).
1989 .It element
1990 Element scope (0x02).
1991 .El
1992 .It Fl R Ar rtp
1993 Specify the Relative Target Port.
1994 This only applies to the Register and Move service action of the Persistent
1995 Reserve Out command.
1996 .It Fl S
1997 Enable the SPEC_I_PT bit.
1998 This only applies to the Register service action of Persistent Reserve Out.
1999 You must also specify at least one Transport ID with
2000 .Fl I
2001 if this option is set.
2002 If you specify a Transport ID, this option is automatically set.
2003 It is an error to specify this option for any service action other than
2004 Register.
2005 .It Fl T Ar type
2006 Specify the reservation type.
2007 The reservation type may be specified by name or by number.
2008 If the desired reservation type isn't available by name, you may specify
2009 the number.
2010 Supported reservation type names:
2011 .Bl -tag -width 11n
2012 .It read_shared
2013 Read Shared mode.
2014 .It wr_ex
2015 Write Exclusive mode.
2016 May also be specified as
2017 .Dq write_exclusive .
2018 .It rd_ex
2019 Read Exclusive mode.
2020 May also be specified as
2021 .Dq read_exclusive .
2022 .It ex_ac
2023 Exclusive access mode.
2024 May also be specified as
2025 .Dq exclusive_access .
2026 .It wr_ex_ro
2027 Write Exclusive Registrants Only mode.
2028 May also be specified as
2029 .Dq write_exclusive_reg_only .
2030 .It ex_ac_ro
2031 Exclusive Access Registrants Only mode.
2032 May also be specified as
2033 .Dq exclusive_access_reg_only .
2034 .It wr_ex_ar
2035 Write Exclusive All Registrants mode.
2036 May also be specified as
2037 .Dq write_exclusive_all_regs .
2038 .It ex_ac_ar
2039 Exclusive Access All Registrants mode.
2040 May also be specified as
2041 .Dq exclusive_access_all_regs .
2042 .El
2043 .It Fl U
2044 Specify that the target should unregister the initiator that sent
2045 the Register and Move request.
2046 By default, the target will not unregister the initiator that sends the
2047 Register and Move request.
2048 This option only applies to the Register and Move service action of the
2049 Persistent Reserve Out command.
2050 .El
2051 .It Ic attrib
2052 Issue the
2053 .Tn SCSI
2054 READ or WRITE ATTRIBUTE commands.
2055 These commands are used to read and write attributes in Medium Auxiliary
2056 Memory (MAM).
2057 The most common place Medium Auxiliary Memory is found is small flash chips
2058 included tape cartriges.
2059 For instance,
2060 .Tn LTO
2061 tapes have MAM.
2062 Either the
2063 .Fl r
2064 option or the
2065 .Fl w
2066 option must be specified.
2067 .Bl -tag -width 14n
2068 .It Fl r Ar action
2069 Specify the READ ATTRIBUTE service action.
2070 .Bl -tag -width 11n
2071 .It attr_values
2072 Issue the ATTRIBUTE VALUES service action.
2073 Read and decode the available attributes and their values.
2074 .It attr_list
2075 Issue the ATTRIBUTE LIST service action.
2076 List the attributes that are available to read and write.
2077 .It lv_list
2078 Issue the LOGICAL VOLUME LIST service action.
2079 List the available logical volumes in the MAM.
2080 .It part_list
2081 Issue the PARTITION LIST service action.
2082 List the available partitions in the MAM.
2083 .It supp_attr
2084 Issue the SUPPORTED ATTRIBUTES service action.
2085 List attributes that are supported for reading or writing.
2086 These attributes may or may not be currently present in the MAM.
2087 .El
2088 .It Fl w Ar attr
2089 Specify an attribute to write to the MAM.
2090 This option is not yet implemented.
2091 .It Fl a Ar num
2092 Specify the attribute number to display.
2093 This option only works with the attr_values, attr_list and supp_attr
2094 arguments to
2095 .Fl r .
2096 .It Fl c
2097 Display cached attributes.
2098 If the device supports this flag, it allows displaying attributes for the
2099 last piece of media loaded in the drive.
2100 .It Fl e Ar num
2101 Specify the element address.
2102 This is used for specifying which element number in a medium changer to
2103 access when reading attributes.
2104 The element number could be for a picker, portal, slot or drive.
2105 .It Fl F Ar form1,form2
2106 Specify the output format for the attribute values (attr_val) display as a
2107 comma separated list of options.
2108 The default output is currently set to field_all,nonascii_trim,text_raw.
2109 Once this code is ported to FreeBSD 10, any text fields will be converted
2110 from their codeset to the user's native codeset with
2111 .Xr iconv 3 .
2112 .Pp
2113 The text options are mutually exclusive; if you specify more than one, you
2114 will get unpredictable results.
2115 The nonascii options are also mutually exclusive.
2116 Most of the field options may be logically ORed together.
2117 .Bl -tag -width 12n
2118 .It text_esc
2119 Print text fields with non-ASCII characters escaped.
2120 .It text_raw
2121 Print text fields natively, with no codeset conversion.
2122 .It nonascii_esc
2123 If any non-ASCII characters occur in fields that are supposed to be ASCII,
2124 escape the non-ASCII characters.
2125 .It nonascii_trim
2126 If any non-ASCII characters occur in fields that are supposed to be ASCII,
2127 omit the non-ASCII characters.
2128 .It nonascii_raw
2129 If any non-ASCII characters occur in fields that are supposed to be ASCII,
2130 print them as they are.
2131 .It field_all
2132 Print all of the prefix fields: description, attribute number, attribute
2133 size, and the attribute's readonly status.
2134 If field_all is specified, specifying any other field options will not have
2135 an effect.
2136 .It field_none
2137 Print none of the prefix fields, and only print out the attribute value.
2138 If field_none is specified, specifying any other field options will result
2139 in those fields being printed.
2140 .It field_desc
2141 Print out the attribute description.
2142 .It field_num
2143 Print out the attribute number.
2144 .It field_size
2145 Print out the attribute size.
2146 .It field_rw
2147 Print out the attribute's readonly status.
2148 .El
2149 .It Fl p Ar part
2150 Specify the partition.
2151 When the media has multiple partitions, specifying different partition
2152 numbers allows seeing the values for each individual partition.
2153 .It Fl s Ar start_num
2154 Specify the starting attribute number.
2155 This requests that the target device return attribute information starting
2156 at the given number.
2157 .It Fl T Ar elem_type
2158 Specify the element type.
2159 For medium changer devices, this allows specifying the type the element
2160 referenced in the element address (
2161 .Fl e ) .
2162 Valid types are:
2163 .Dq all ,
2164 .Dq picker ,
2165 .Dq slot ,
2166 .Dq portal ,
2167 and
2168 .Dq drive .
2169 .It Fl V Ar vol_num
2170 Specify the number of the logical volume to operate on.
2171 If the media has multiple logical volumes, this will allow displaying
2172 or writing attributes on the given logical volume.
2173 .El
2174 .It Ic opcodes
2175 Issue the REPORT SUPPORTED OPCODES service action of the
2176 .Tn SCSI
2177 MAINTENANCE IN
2178 command.
2179 Without arguments, this command will return a list of all
2180 .Tn SCSI
2181 commands supported by the device, including service actions of commands
2182 that support service actions.
2183 It will also include the
2184 .Tn SCSI
2185 CDB (Command Data Block) length for each command, and the description of
2186 each command if it is known.
2187 .Bl -tag -width 18n
2188 .It Fl o Ar opcode
2189 Request information on a specific opcode instead of the list of supported
2190 commands.
2191 If supported, the target will return a CDB-like structure that indicates
2192 the opcode, service action (if any), and a mask of bits that are supported
2193 in that CDB.
2194 .It Fl s Ar service_action
2195 For commands that support a service action, specify the service action to
2196 query.
2197 .It Fl N
2198 If a service action is specified for a given opcode, and the device does
2199 not support the given service action, the device should not return a
2200 .Tn SCSI
2201 error, but rather indicate in the returned parameter data that the command
2202 is not supported.
2203 By default, if a service action is specified for an opcode, and service
2204 actions are not supported for the opcode in question, the device will
2205 return an error.
2206 .It Fl T
2207 Include timeout values.
2208 This option works with the default display, which includes all commands
2209 supported by the device, and with the
2210 .Fl o
2211 and
2212 .Fl s
2213 options, which request information on a specific command and service
2214 action.
2215 This requests that the device report Nominal and Recommended timeout values
2216 for the given command or commands.
2217 The timeout values are in seconds.
2218 The timeout descriptor also includes a command-specific
2219 .El
2220 .It Ic zone
2221 Manage
2222 .Tn SCSI
2223 and
2224 .Tn ATA
2225 Zoned Block devices.
2226 This allows managing devices that conform to the
2227 .Tn SCSI
2228 Zoned Block Commands (ZBC) and
2229 .Tn ATA
2230 Zoned ATA Command Set (ZAC)
2231 specifications.
2232 Devices using these command sets are usually hard drives using Shingled
2233 Magnetic Recording (SMR).
2234 There are three types of SMR drives:
2235 .Bl -tag -width 13n
2236 .It Drive Managed
2237 Drive Managed drives look and act just like a standard random access block
2238 device, but underneath, the drive reads and writes the bulk of its capacity
2239 using SMR zones.
2240 Sequential writes will yield better performance, but writing sequentially
2241 is not required.
2242 .It Host Aware
2243 Host Aware drives expose the underlying zone layout via
2244 .Tn SCSI
2245 or
2246 .Tn ATA
2247 commands and allow the host to manage the zone conditions.
2248 The host is not required to manage the zones on the drive, though.
2249 Sequential writes will yield better performance in Sequential Write
2250 Preferred zones, but the host can write randomly in those zones.
2251 .It Host Managed
2252 Host Managed drives expose the underlying zone layout via
2253 .Tn SCSI
2254 or
2255 .Tn ATA
2256 commands.
2257 The host is required to access the zones according to the rules described
2258 by the zone layout.
2259 Any commands that violate the rules will be returned with an error.
2260 .El
2261 .Pp
2262 SMR drives are divided into zones (typically in the range of 256MB each)
2263 that fall into three general categories:
2264 .Bl -tag -width 20n
2265 .It Conventional
2266 These are also known as Non Write Pointer zones.
2267 These zones can be randomly written without an unexpected performance penalty.
2268 .It Sequential Preferred
2269 These zones should be written sequentially starting at the write pointer
2270 for the zone.
2271 They may be written randomly.
2272 Writes that do not conform to the zone layout may be significantly slower
2273 than expected.
2274 .It Sequential Required
2275 These zones must be written sequentially.
2276 If they are not written sequentially, starting at the write pointer, the
2277 command will fail.
2278 .El
2279 .Bl -tag -width 12n
2280 .It Fl c Ar cmd
2281 Specify the zone subcommand:
2282 .Bl -tag -width 6n
2283 .It rz
2284 Issue the Report Zones command.
2285 All zones are returned by default.
2286 Specify report options with
2287 .Fl o
2288 and printing options with
2289 .Fl P .
2290 Specify the starting LBA with
2291 .Fl l .
2292 Note that
2293 .Dq reportzones
2294 is also accepted as a command argument.
2295 .It open
2296 Explicitly open the zone specified by the starting LBA.
2297 .It close
2298 Close the zone specified by starting LBA.
2299 .It finish
2300 Finish the zone specified by the starting LBA.
2301 .It rwp
2302 Reset the write pointer for the zone specified by the starting LBA.
2303 .El
2304 .It Fl a
2305 For the Open, Close, Finish, and Reset Write Pointer operations, apply the
2306 operation to all zones on the drive.
2307 .It Fl l Ar lba
2308 Specify the starting LBA.
2309 For the Report Zones command, this tells the drive to report starting with
2310 the zone that starts at the given LBA.
2311 For the other commands, this allows the user to identify the zone requested
2312 by its starting LBA.
2313 The LBA may be specified in decimal, hexadecimal or octal notation.
2314 .It Fl o Ar rep_opt
2315 For the Report Zones command, specify a subset of zones to report.
2316 .Bl -tag -width 8n
2317 .It all
2318 Report all zones.
2319 This is the default.
2320 .It emtpy
2321 Report only empty zones.
2322 .It imp_open
2323 Report zones that are implicitly open.
2324 This means that the host has sent a write to the zone without explicitly
2325 opening the zone.
2326 .It exp_open
2327 Report zones that are explicitly open.
2328 .It closed
2329 Report zones that have been closed by the host.
2330 .It full
2331 Report zones that are full.
2332 .It ro
2333 Report zones that are in the read only state.
2334 Note that
2335 .Dq readonly
2336 is also accepted as an argument.
2337 .It offline
2338 Report zones that are in the offline state.
2339 .It reset
2340 Report zones where the device recommends resetting write pointers.
2341 .It nonseq
2342 Report zones that have the Non Sequential Resources Active flag set.
2343 These are zones that are Sequential Write Preferred, but have been written
2344 non-sequentially.
2345 .It nonwp
2346 Report Non Write Pointer zones, also known as Conventional zones.
2347 .El
2348 .It Fl P Ar print_opt
2349 Specify a printing option for Report Zones:
2350 .Bl -tag -width 7n
2351 .It normal
2352 Normal Report Zones output.
2353 This is the default.
2354 The summary and column headings are printed, fields are separated by spaces
2355 and the fields themselves may contain spaces.
2356 .It summary
2357 Just print the summary:  the number of zones, the maximum LBA (LBA of the
2358 last logical block on the drive), and the value of the
2359 .Dq same
2360 field.
2361 The
2362 .Dq same
2363 field describes whether the zones on the drive are all identical, all
2364 different, or whether they are the same except for the last zone, etc.
2365 .It script
2366 Print the zones in a script friendly format.
2367 The summary and column headings are omitted, the fields are separated by
2368 commas, and the fields do not contain spaces.
2369 The fields contain underscores where spaces would normally be used.
2370 .El
2371 .El
2372 .It Ic epc
2373 Issue
2374 .Tn ATA
2375 Extended Power Conditions (EPC) feature set commands.
2376 This only works on
2377 .Tn ATA
2378 protocol drives, and will not work on
2379 .Tn SCSI
2380 protocol drives.
2381 It will work on
2382 .Tn SATA
2383 drives behind a
2384 .Tn SCSI
2385 to
2386 .Tn ATA
2387 translation layer (SAT).
2388 It may be helpful to read the ATA Command Set - 4 (ACS-4) description of
2389 the Extended Power Conditions feature set, available at t13.org, to
2390 understand the details of this particular
2391 .Nm
2392 subcommand.
2393 .Bl -tag -width 6n
2394 .It Fl c Ar cmd
2395 Specify the epc subcommand
2396 .Bl -tag -width 7n
2397 .It restore
2398 Restore drive power condition settings.
2399 .Bl -tag -width 6n
2400 .It Fl r Ar src
2401 Specify the source for the restored power settings, either
2402 .Dq default
2403 or
2404 .Dq saved .
2405 This argument is required.
2406 .It Fl s
2407 Save the settings.
2408 This only makes sense to specify when restoring from defaults.
2409 .El
2410 .It goto
2411 Go to the specified power condition.
2412 .Bl -tag -width 7n
2413 .It Fl p Ar cond
2414 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
2415 This argument is required.
2416 .It Fl D
2417 Specify delayed entry to the power condition.
2418 The drive, if it supports this, can enter the power condition after the
2419 command completes.
2420 .It Fl H
2421 Hold the power condition.
2422 If the drive supports this option, it will hold the power condition and
2423 reject all commands that would normally cause it to exit that power
2424 condition.
2425 .El
2426 .It timer
2427 Set the timer value for a power condition and enable or disable the
2428 condition.
2429 See the
2430 .Dq list
2431 display described below to see what the current timer settings are for each
2432 Idle and Standby mode supported by the drive.
2433 .Bl -tag -width 8n
2434 .It Fl e
2435 Enable the power condition.
2436 One of
2437 .Fl e
2438 or
2439 .Fl d
2440 is required.
2441 .It Fl d
2442 Disable the power condition.
2443 One of
2444 .Fl d
2445 or
2446 .Fl e
2447 is required.
2448 .It Fl T Ar timer
2449 Specify the timer in seconds.
2450 The user may specify a timer as a floating point number with a maximum
2451 supported resolution of tenths of a second.
2452 Drives may or may not support sub-second timer values.
2453 .It Fl p Ar cond
2454 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
2455 This argument is required.
2456 .It Fl s
2457 Save the timer and power condition enable/disable state.
2458 By default, if this option is not specified, only the current values for
2459 this power condition will be affected.
2460 .El
2461 .It state
2462 Enable or disable a particular power condition.
2463 .Bl -tag -width 7n
2464 .It Fl e
2465 Enable the power condition.
2466 One of
2467 .Fl e
2468 or
2469 .Fl d
2470 is required.
2471 .It Fl d
2472 Disable the power condition.
2473 One of
2474 .Fl d
2475 or
2476 .Fl e
2477 is required.
2478 .It Fl p Ar cond
2479 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
2480 This argument is required.
2481 .It Fl s
2482 Save the power condition enable/disable state.
2483 By default, if this option is not specified, only the current values for
2484 this power condition will be affected.
2485 .El
2486 .It enable
2487 Enable the Extended Power Condition (EPC) feature set.
2488 .It disable
2489 Disable the Extended Power Condition (EPC) feature set.
2490 .It source
2491 Specify the EPC power source.
2492 .Bl -tag -width 6n
2493 .It Fl S Ar src
2494 Specify the power source, either
2495 .Dq battery
2496 or
2497 .Dq nonbattery .
2498 .El
2499 .It status
2500 Get the current status of several parameters related to the Extended Power
2501 Condition (EPC) feature set, including whether APM and EPC are supported
2502 and enabled, whether Low Power Standby is supported, whether setting the
2503 EPC power source is supported, whether Low Power Standby is supported and
2504 the current power condition.
2505 .Bl -tag -width 3n
2506 .It Fl P
2507 Only report the current power condition.
2508 Some drives will exit their current power condition if a command other than
2509 the
2510 .Tn ATA
2511 CHECK POWER MODE command is received.
2512 If this flag is specified,
2513 .Nm
2514 will only issue the
2515 .Tn ATA
2516 CHECK POWER MODE command to the drive.
2517 .El
2518 .It list
2519 Display the
2520 .Tn ATA
2521 Power Conditions log (Log Address 0x08).
2522 This shows the list of Idle and Standby power conditions the drive
2523 supports, and a number of parameters about each condition, including
2524 whether it is enabled and what the timer value is.
2525 .El
2526 .El
2527 .It Ic timestamp
2528 Issue REPORT TIMESTAMP or SET TIMESTAMP
2529 .Tn SCSI
2530 commands.
2531 Either the
2532 .Fl r
2533 option or the
2534 .Fl s
2535 option must be specified.
2536 .Bl -tag -width 6n
2537 .It Fl r
2538 Report the device's timestamp.
2539 If no more arguments are specified, the timestamp will be reported using
2540 the national representation of the date and time, followed by the time
2541 zone.
2542 .Bl -tag -width 9n
2543 .It Fl f Ar format
2544 Specify the strftime format string, as documented in strftime(3), to be used
2545 to format the reported timestamp.
2546 .It Fl m
2547 Report the timestamp as milliseconds since the epoch.
2548 .It Fl U
2549 Report the timestamp using the national representation of the date and
2550 time, but override the system time zone and use UTC instead.
2551 .El
2552 .El
2553 .Bl -tag -width 6n
2554 .It Fl s
2555 Set the device's timestamp.
2556 Either the
2557 .Fl f
2558 and
2559 .Fl T
2560 options or the
2561 .Fl U
2562 option must be specified.
2563 .Bl -tag -width 9n
2564 .It Fl f Ar format
2565 Specify the strptime format string, as documented in strptime(3).
2566 The time must also be specified with the
2567 .Fl T
2568 option.
2569 .It Fl T Ar time
2570 Provide the time in the format specified with the
2571 .Fl f
2572 option.
2573 .It Fl U
2574 Set the timestamp to the host system's time in UTC.
2575 .El
2576 .El
2577 .It Ic devtype
2578 Print out the device type for specified device.
2579 .Bl -tag -width 10n
2580 .It ata
2581 An ATA device attached directly to an ATA controller
2582 .It satl
2583 An SATA device attached behind a SAS controller via SCSI-ATA Translation Layer (SATL)
2584 .It scsi
2585 A SCSI device
2586 .It nvme
2587 An directly attached NVMe device
2588 .It mmcsd
2589 An MMC or SD device attached via a mmcsd bus
2590 .It none
2591 No device type reported
2592 .It unknown
2593 Device type is unknown
2594 .It illegal
2595 A programming error occurred
2596 .El
2597 .It Ic help
2598 Print out verbose usage information.
2599 .El
2600 .Sh ENVIRONMENT
2601 The
2602 .Ev SCSI_MODES
2603 variable allows the user to specify an alternate mode page format file.
2604 .Pp
2605 The
2606 .Ev EDITOR
2607 variable determines which text editor
2608 .Nm
2609 starts when editing mode pages.
2610 .Sh FILES
2611 .Bl -tag -width /usr/share/misc/scsi_modes -compact
2612 .It Pa /usr/share/misc/scsi_modes
2613 is the SCSI mode format database.
2614 .It Pa /dev/xpt0
2615 is the transport layer device.
2616 .It Pa /dev/pass*
2617 are the CAM application passthrough devices.
2618 .El
2619 .Sh EXAMPLES
2620 .Dl camcontrol eject -n cd -u 1 -v
2621 .Pp
2622 Eject the CD from cd1, and print SCSI sense information if the command
2623 fails.
2624 .Pp
2625 .Dl camcontrol tur da0
2626 .Pp
2627 Send the SCSI test unit ready command to da0.
2628 The
2629 .Nm
2630 utility will report whether the disk is ready, but will not display sense
2631 information if the command fails since the
2632 .Fl v
2633 switch was not specified.
2634 .Bd -literal -offset indent
2635 camcontrol tur da1 -E -C 4 -t 50 -Q head -v
2636 .Ed
2637 .Pp
2638 Send a test unit ready command to da1.
2639 Enable kernel error recovery.
2640 Specify a retry count of 4, and a timeout of 50 seconds.
2641 Enable sense
2642 printing (with the
2643 .Fl v
2644 flag) if the command fails.
2645 Since error recovery is turned on, the
2646 disk will be spun up if it is not currently spinning.
2647 The
2648 .Tn SCSI
2649 task attribute for the command will be set to Head of Queue.
2650 The
2651 .Nm
2652 utility will report whether the disk is ready.
2653 .Bd -literal -offset indent
2654 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
2655         -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
2656 .Ed
2657 .Pp
2658 Issue a READ BUFFER command (0x3C) to cd1.
2659 Display the buffer size of cd1,
2660 and display the first 10 bytes from the cache on cd1.
2661 Display SCSI sense
2662 information if the command fails.
2663 .Bd -literal -offset indent
2664 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
2665         -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
2666 .Ed
2667 .Pp
2668 Issue a WRITE BUFFER (0x3B) command to cd1.
2669 Write out 10 bytes of data,
2670 not including the (reserved) 4 byte header.
2671 Print out sense information if
2672 the command fails.
2673 Be very careful with this command, improper use may
2674 cause data corruption.
2675 .Bd -literal -offset indent
2676 camcontrol modepage da3 -m 1 -e -P 3
2677 .Ed
2678 .Pp
2679 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
2680 settings on the drive.
2681 Mode page 1 contains a disk drive's auto read and
2682 write reallocation settings, among other things.
2683 .Pp
2684 .Dl camcontrol rescan all
2685 .Pp
2686 Rescan all SCSI buses in the system for devices that have been added,
2687 removed or changed.
2688 .Pp
2689 .Dl camcontrol rescan 0
2690 .Pp
2691 Rescan SCSI bus 0 for devices that have been added, removed or changed.
2692 .Pp
2693 .Dl camcontrol rescan 0:1:0
2694 .Pp
2695 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
2696 changed.
2697 .Pp
2698 .Dl camcontrol tags da5 -N 24
2699 .Pp
2700 Set the number of concurrent transactions for da5 to 24.
2701 .Bd -literal -offset indent
2702 camcontrol negotiate -n da -u 4 -T disable
2703 .Ed
2704 .Pp
2705 Disable tagged queueing for da4.
2706 .Bd -literal -offset indent
2707 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
2708 .Ed
2709 .Pp
2710 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
2711 Then send a
2712 Test Unit Ready command to make the settings take effect.
2713 .Bd -literal -offset indent
2714 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
2715 .Ed
2716 .Pp
2717 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
2718 it contains.
2719 Display SMP errors if the command fails.
2720 .Bd -literal -offset indent
2721 camcontrol security ada0
2722 .Ed
2723 .Pp
2724 Report security support and settings for ada0
2725 .Bd -literal -offset indent
2726 camcontrol security ada0 -U user -s MyPass
2727 .Ed
2728 .Pp
2729 Enable security on device ada0 with the password MyPass
2730 .Bd -literal -offset indent
2731 camcontrol security ada0 -U user -e MyPass
2732 .Ed
2733 .Pp
2734 Secure erase ada0 which has had security enabled with user password MyPass
2735 .Pp
2736 .Em WARNING! WARNING! WARNING!
2737 .Pp
2738 This will
2739 .Em ERASE ALL
2740 data from the device, so backup your data before using!
2741 .Pp
2742 This command can be used against an SSD drive to restoring it to
2743 factory default write performance.
2744 .Bd -literal -offset indent
2745 camcontrol hpa ada0
2746 .Ed
2747 .Pp
2748 Report HPA support and settings for ada0 (also reported via
2749 identify).
2750 .Bd -literal -offset indent
2751 camcontrol hpa ada0 -s 10240
2752 .Ed
2753 .Pp
2754 Enables HPA on ada0 setting the maximum reported sectors to 10240.
2755 .Pp
2756 .Em WARNING! WARNING! WARNING!
2757 .Pp
2758 This will
2759 .Em PREVENT ACCESS
2760 to all data on the device beyond this limit until HPA is disabled by setting
2761 HPA to native max sectors of the device, which can only be done after a
2762 power-on or hardware reset!
2763 .Pp
2764 .Em DO NOT
2765 use this on a device which has an active filesystem!
2766 .Bd -literal -offset indent
2767 camcontrol persist da0 -v -i read_keys
2768 .Ed
2769 .Pp
2770 This will read any persistent reservation keys registered with da0, and
2771 display any errors encountered when sending the PERSISTENT RESERVE IN
2772 .Tn SCSI
2773 command.
2774 .Bd -literal -offset indent
2775 camcontrol persist da0 -v -o register -a -K 0x12345678
2776 .Ed
2777 .Pp
2778 This will register the persistent reservation key 0x12345678 with da0,
2779 apply that registration to all ports on da0, and display any errors that
2780 occur when sending the PERSISTENT RESERVE OUT command.
2781 .Bd -literal -offset indent
2782 camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
2783 .Ed
2784 .Pp
2785 This will reserve da0 for the exlusive use of the initiator issuing the
2786 command.
2787 The scope of the reservation is the entire LUN.
2788 Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
2789 .Bd -literal -offset indent
2790 camcontrol persist da0 -v -i read_full
2791 .Ed
2792 .Pp
2793 This will display the full status of all reservations on da0 and print out
2794 status if there are any errors.
2795 .Bd -literal -offset indent
2796 camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
2797 .Ed
2798 .Pp
2799 This will release a reservation on da0 of the type ex_ac
2800 (Exclusive Access).
2801 The Reservation Key for this registration is 0x12345678.
2802 Any errors that occur will be displayed.
2803 .Bd -literal -offset indent
2804 camcontrol persist da0 -v -o register -K 0x12345678 -S \e
2805         -I sas,0x1234567812345678 -I sas,0x8765432187654321
2806 .Ed
2807 .Pp
2808 This will register the key 0x12345678 with da0, specifying that it applies
2809 to the SAS initiators with SAS addresses 0x1234567812345678 and
2810 0x8765432187654321.
2811 .Bd -literal -offset indent
2812 camcontrol persist da0 -v -o register_move -k 0x87654321 \e
2813         -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
2814 .Ed
2815 .Pp
2816 This will move the registration from the current initiator, whose
2817 Registration Key is 0x87654321, to the Fibre Channel initiator with the
2818 Fiber Channel World Wide Node Name 0x1234567812345678.
2819 A new registration key, 0x12345678, will be registered for the initiator
2820 with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
2821 current initiator will be unregistered from the target.
2822 The reservation will be moved to relative target port 2 on the target
2823 device.
2824 The registration will persist across power losses.
2825 .Bd -literal -offset indent
2826 camcontrol attrib sa0 -v -i attr_values -p 1
2827 .Ed
2828 .Pp
2829 This will read and decode the attribute values from partition 1 on the tape
2830 in tape drive sa0, and will display any
2831 .Tn SCSI
2832 errors that result.
2833 .Bd -literal -offset indent
2834 camcontrol zone da0 -v -c rz -P summary
2835 .Ed
2836 .Pp
2837 This will request the SMR zone list from disk da0, and print out a
2838 summary of the zone parameters, and display any
2839 .Tn SCSI
2840 or
2841 .Tn ATA
2842 errors that result.
2843 .Bd -literal -offset indent
2844 camcontrol zone da0 -v -c rz -o reset
2845 .Ed
2846 .Pp
2847 This will request the list of SMR zones that should have their write
2848 pointer reset from the disk da0, and display any
2849 .Tn SCSI
2850 or
2851 .Tn ATA
2852 errors that result.
2853 .Bd -literal -offset indent
2854 camcontrol zone da0 -v -c rwp -l 0x2c80000
2855 .Ed
2856 .Pp
2857 This will issue the Reset Write Pointer command to disk da0 for the zone
2858 that starts at LBA 0x2c80000 and display any
2859 .Tn SCSI
2860 or
2861 .Tn ATA
2862 errors that result.
2863 .Bd -literal -offset indent
2864 camcontrol epc ada0 -c timer -T 60.1 -p Idle_a -e -s
2865 .Ed
2866 .Pp
2867 Set the timer for the Idle_a power condition on drive
2868 .Pa ada0
2869 to 60.1 seconds, enable that particular power condition, and save the timer
2870 value and the enabled state of the power condition.
2871 .Bd -literal -offset indent
2872 camcontrol epc da4 -c goto -p Standby_z -H
2873 .Ed
2874 .Pp
2875 Tell drive
2876 .Pa da4
2877 to go to the Standby_z power state (which is
2878 the drive's lowest power state) and hold in that state until it is
2879 explicitly released by another
2880 .Cm goto
2881 command.
2882 .Bd -literal -offset indent
2883 camcontrol epc da2 -c status -P
2884 .Ed
2885 .Pp
2886 Report only the power state of
2887 drive
2888 .Pa da2 .
2889 Some drives will power up in response to the commands sent by the
2890 .Pa status
2891 subcommand, and the
2892 .Fl P
2893 option causes
2894 .Nm
2895 to only send the
2896 .Tn ATA
2897 CHECK POWER MODE command, which should not trigger a change in the drive's
2898 power state.
2899 .Bd -literal -offset indent
2900 camcontrol epc ada0 -c list
2901 .Ed
2902 .Pp
2903 Display the ATA Power Conditions log (Log Address 0x08) for
2904 drive
2905 .Pa ada0 .
2906 .Bd -literal -offset indent
2907 camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e
2908         -T "Wed, 26 Oct 2016 21:43:57 -0600"
2909 .Ed
2910 .Pp
2911 Set the timestamp of drive
2912 .Pa sa0
2913 using a
2914 .Xr strptime 3
2915 format string followed by a time string
2916 that was created using this format string.
2917 .Sh SEE ALSO
2918 .Xr cam 3 ,
2919 .Xr cam_cdbparse 3 ,
2920 .Xr cam 4 ,
2921 .Xr pass 4 ,
2922 .Xr xpt 4
2923 .Sh HISTORY
2924 The
2925 .Nm
2926 utility first appeared in
2927 .Fx 3.0 .
2928 .Pp
2929 The mode page editing code and arbitrary SCSI command code are based upon
2930 code in the old
2931 .Xr scsi 8
2932 utility and
2933 .Xr scsi 3
2934 library, written by Julian Elischer and Peter Dufault.
2935 The
2936 .Xr scsi 8
2937 program first appeared in
2938 .Bx 386 0.1.2.4 ,
2939 and first appeared in
2940 .Fx
2941 in
2942 .Fx 2.0.5 .
2943 .Sh AUTHORS
2944 .An Kenneth Merry Aq Mt ken@FreeBSD.org
2945 .Sh BUGS
2946 The code that parses the generic command line arguments does not know that
2947 some of the subcommands take multiple arguments.
2948 So if, for instance, you
2949 tried something like this:
2950 .Bd -literal -offset indent
2951 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
2952 .Ed
2953 .Pp
2954 The sense information from the test unit ready command would not get
2955 printed out, since the first
2956 .Xr getopt 3
2957 call in
2958 .Nm
2959 bails out when it sees the second argument to
2960 .Fl c
2961 (0x00),
2962 above.
2963 Fixing this behavior would take some gross code, or changes to the
2964 .Xr getopt 3
2965 interface.
2966 The best way to circumvent this problem is to always make sure
2967 to specify generic
2968 .Nm
2969 arguments before any command-specific arguments.