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