]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - sbin/camcontrol/camcontrol.8
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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 March 19, 2015
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 N
82 .Op Fl q
83 .Op Fl s
84 .Nm
85 .Ic start
86 .Op device id
87 .Op generic args
88 .Nm
89 .Ic stop
90 .Op device id
91 .Op generic args
92 .Nm
93 .Ic load
94 .Op device id
95 .Op generic args
96 .Nm
97 .Ic eject
98 .Op device id
99 .Op generic args
100 .Nm
101 .Ic rescan
102 .Aq all | bus Ns Op :target:lun
103 .Nm
104 .Ic reset
105 .Aq all | bus Ns Op :target:lun
106 .Nm
107 .Ic defects
108 .Op device id
109 .Op generic args
110 .Aq Fl f Ar format
111 .Op Fl P
112 .Op Fl G
113 .Op Fl q
114 .Op Fl s
115 .Op Fl S Ar offset
116 .Op Fl X
117 .Nm
118 .Ic modepage
119 .Op device id
120 .Op generic args
121 .Aq Fl m Ar page | Fl l
122 .Op Fl P Ar pgctl
123 .Op Fl b | Fl e
124 .Op Fl d
125 .Nm
126 .Ic cmd
127 .Op device id
128 .Op generic args
129 .Aq Fl a Ar cmd Op args
130 .Aq Fl c Ar cmd Op args
131 .Op Fl d
132 .Op Fl f
133 .Op Fl i Ar len Ar fmt
134 .Bk -words
135 .Op Fl o Ar len Ar fmt Op args
136 .Op Fl r Ar fmt
137 .Ek
138 .Nm
139 .Ic smpcmd
140 .Op device id
141 .Op generic args
142 .Aq Fl r Ar len Ar fmt Op args
143 .Aq Fl R Ar len Ar fmt Op args
144 .Nm
145 .Ic smprg
146 .Op device id
147 .Op generic args
148 .Op Fl l
149 .Nm
150 .Ic smppc
151 .Op device id
152 .Op generic args
153 .Aq Fl p Ar phy
154 .Op Fl l
155 .Op Fl o Ar operation
156 .Op Fl d Ar name
157 .Op Fl m Ar rate
158 .Op Fl M Ar rate
159 .Op Fl T Ar pp_timeout
160 .Op Fl a Ar enable|disable
161 .Op Fl A Ar enable|disable
162 .Op Fl s Ar enable|disable
163 .Op Fl S Ar enable|disable
164 .Nm
165 .Ic smpphylist
166 .Op device id
167 .Op generic args
168 .Op Fl l
169 .Op Fl q
170 .Nm
171 .Ic smpmaninfo
172 .Op device id
173 .Op generic args
174 .Op Fl l
175 .Nm
176 .Ic debug
177 .Op Fl I
178 .Op Fl P
179 .Op Fl T
180 .Op Fl S
181 .Op Fl X
182 .Op Fl c
183 .Op Fl p
184 .Aq all|off|bus Ns Op :target Ns Op :lun
185 .Nm
186 .Ic tags
187 .Op device id
188 .Op generic args
189 .Op Fl N Ar tags
190 .Op Fl q
191 .Op Fl v
192 .Nm
193 .Ic negotiate
194 .Op device id
195 .Op generic args
196 .Op Fl c
197 .Op Fl D Ar enable|disable
198 .Op Fl M Ar mode
199 .Op Fl O Ar offset
200 .Op Fl q
201 .Op Fl R Ar syncrate
202 .Op Fl T Ar enable|disable
203 .Op Fl U
204 .Op Fl W Ar bus_width
205 .Op Fl v
206 .Nm
207 .Ic format
208 .Op device id
209 .Op generic args
210 .Op Fl q
211 .Op Fl r
212 .Op Fl w
213 .Op Fl y
214 .Nm
215 .Ic sanitize
216 .Op device id
217 .Op generic args
218 .Aq Fl a Ar overwrite | block | crypto | exitfailure
219 .Op Fl c Ar passes
220 .Op Fl I
221 .Op Fl P Ar pattern
222 .Op Fl q
223 .Op Fl U
224 .Op Fl r
225 .Op Fl w
226 .Op Fl y
227 .Nm
228 .Ic idle
229 .Op device id
230 .Op generic args
231 .Op Fl t Ar time
232 .Nm
233 .Ic standby
234 .Op device id
235 .Op generic args
236 .Op Fl t Ar time
237 .Nm
238 .Ic sleep
239 .Op device id
240 .Op generic args
241 .Nm
242 .Ic apm
243 .Op device id
244 .Op generic args
245 .Op Fl l Ar level
246 .Nm
247 .Ic aam
248 .Op device id
249 .Op generic args
250 .Op Fl l Ar level
251 .Nm
252 .Ic fwdownload
253 .Op device id
254 .Op generic args
255 .Aq Fl f Ar fw_image
256 .Op Fl y
257 .Op Fl s
258 .Nm
259 .Ic security
260 .Op device id
261 .Op generic args
262 .Op Fl d Ar pwd
263 .Op Fl e Ar pwd
264 .Op Fl f
265 .Op Fl h Ar pwd
266 .Op Fl k Ar pwd
267 .Op Fl l Ar high|maximum
268 .Op Fl q
269 .Op Fl s Ar pwd
270 .Op Fl T Ar timeout
271 .Op Fl U Ar user|master
272 .Op Fl y
273 .Nm
274 .Ic hpa
275 .Op device id
276 .Op generic args
277 .Op Fl f
278 .Op Fl l
279 .Op Fl P
280 .Op Fl p Ar pwd
281 .Op Fl q
282 .Op Fl s Ar max_sectors
283 .Op Fl U Ar pwd
284 .Op Fl y
285 .Nm
286 .Ic persist
287 .Op device id
288 .Op generic args
289 .Aq Fl i Ar action | Fl o Ar action
290 .Op Fl a
291 .Op Fl I Ar trans_id
292 .Op Fl k Ar key
293 .Op Fl K Ar sa_key
294 .Op Fl p
295 .Op Fl R Ar rel_tgt_port
296 .Op Fl s Ar scope
297 .Op Fl S
298 .Op Fl T Ar res_type
299 .Op Fl U
300 .Nm
301 .Ic attrib
302 .Op device id
303 .Op generic args
304 .Aq Fl r Ar action | Fl w Ar attrib
305 .Op Fl a Ar attr_num
306 .Op Fl c
307 .Op Fl e Ar elem_addr
308 .Op Fl F Ar form1,form2
309 .Op Fl p Ar part
310 .Op Fl s Ar start_addr
311 .Op Fl T Ar elem_type
312 .Op Fl V Ar lv_num
313 .Nm
314 .Ic help
315 .Sh DESCRIPTION
316 The
317 .Nm
318 utility is designed to provide a way for users to access and control the
319 .Fx
320 CAM subsystem.
321 .Pp
322 The
323 .Nm
324 utility
325 can cause a loss of data and/or system crashes if used improperly.
326 Even
327 expert users are encouraged to exercise caution when using this command.
328 Novice users should stay away from this utility.
329 .Pp
330 The
331 .Nm
332 utility has a number of primary functions, many of which support an optional
333 device identifier.
334 A device identifier can take one of three forms:
335 .Bl -tag -width 14n
336 .It deviceUNIT
337 Specify a device name and unit number combination, like "da5" or "cd3".
338 .It bus:target
339 Specify a bus number and target id.
340 The bus number can be determined from
341 the output of
342 .Dq camcontrol devlist .
343 The lun defaults to 0.
344 .It bus:target:lun
345 Specify the bus, target and lun for a device.
346 (e.g.\& 1:2:0)
347 .El
348 .Pp
349 The device identifier, if it is specified,
350 .Em must
351 come immediately after the function name, and before any generic or
352 function-specific arguments.
353 Note that the
354 .Fl n
355 and
356 .Fl u
357 arguments described below will override any device name or unit number
358 specified beforehand.
359 The
360 .Fl n
361 and
362 .Fl u
363 arguments will
364 .Em not
365 override a specified bus:target or bus:target:lun, however.
366 .Pp
367 Most of the
368 .Nm
369 primary functions support these generic arguments:
370 .Bl -tag -width 14n
371 .It Fl C Ar count
372 SCSI command retry count.
373 In order for this to work, error recovery
374 .Pq Fl E
375 must be turned on.
376 .It Fl E
377 Instruct the kernel to perform generic SCSI error recovery for the given
378 command.
379 This is needed in order for the retry count
380 .Pq Fl C
381 to be honored.
382 Other than retrying commands, the generic error recovery in
383 the code will generally attempt to spin up drives that are not spinning.
384 It may take some other actions, depending upon the sense code returned from
385 the command.
386 .It Fl n Ar dev_name
387 Specify the device type to operate on, e.g.\& "da", "cd".
388 .It Fl t Ar timeout
389 SCSI command timeout in seconds.
390 This overrides the default timeout for
391 any given command.
392 .It Fl u Ar unit_number
393 Specify the device unit number, e.g.\& "1", "5".
394 .It Fl v
395 Be verbose, print out sense information for failed SCSI commands.
396 .El
397 .Pp
398 Primary command functions:
399 .Bl -tag -width periphlist
400 .It Ic devlist
401 List all physical devices (logical units) attached to the CAM subsystem.
402 This also includes a list of peripheral drivers attached to each device.
403 With the
404 .Fl v
405 argument, SCSI bus number, adapter name and unit numbers are printed as
406 well.
407 On the other hand, with the
408 .Fl b
409 argument, only the bus adapter, and unit information will be printed, and
410 device information will be omitted.
411 .It Ic periphlist
412 List all peripheral drivers attached to a given physical device (logical
413 unit).
414 .It Ic tur
415 Send the SCSI test unit ready (0x00) command to the given device.
416 The
417 .Nm
418 utility will report whether the device is ready or not.
419 .It Ic inquiry
420 Send a SCSI inquiry command (0x12) to a device.
421 By default,
422 .Nm
423 will print out the standard inquiry data, device serial number, and
424 transfer rate information.
425 The user can specify that only certain types of
426 inquiry data be printed:
427 .Bl -tag -width 4n
428 .It Fl D
429 Get the standard inquiry data.
430 .It Fl S
431 Print out the serial number.
432 If this flag is the only one specified,
433 .Nm
434 will not print out "Serial Number" before the value returned by the drive.
435 This is to aid in script writing.
436 .It Fl R
437 Print out transfer rate information.
438 .El
439 .It Ic identify
440 Send a ATA identify command (0xec) to a device.
441 .It Ic reportluns
442 Send the SCSI REPORT LUNS (0xA0) command to the given device.
443 By default,
444 .Nm
445 will print out the list of logical units (LUNs) supported by the target device.
446 There are a couple of options to modify the output:
447 .Bl -tag -width 14n
448 .It Fl c
449 Just print out a count of LUNs, not the actual LUN numbers.
450 .It Fl l
451 Just print out the LUNs, and do not print out the count.
452 .It Fl r Ar reporttype
453 Specify the type of report to request from the target:
454 .Bl -tag -width 012345678
455 .It default
456 Return the default report.
457 This is the
458 .Nm
459 default.
460 Most targets will support this report if they support the REPORT LUNS
461 command.
462 .It wellknown
463 Return only well known LUNs.
464 .It all
465 Return all available LUNs.
466 .El
467 .El
468 .Pp
469 .Nm
470 will try to print out LUN numbers in a reasonable format.
471 It can understand the peripheral, flat, LUN and extended LUN formats.
472 .It Ic readcap
473 Send the SCSI READ CAPACITY command to the given device and display
474 the results.
475 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
476 action will be sent to obtain the full size of the device.
477 By default,
478 .Nm
479 will print out the last logical block of the device, and the blocksize of
480 the device in bytes.
481 To modify the output format, use the following options:
482 .Bl -tag -width 5n
483 .It Fl b
484 Just print out the blocksize, not the last block or device size.
485 This cannot be used with
486 .Fl N
487 or
488 .Fl s .
489 .It Fl h
490 Print out the device size in human readable (base 2, 1K == 1024) format.
491 This implies
492 .Fl N
493 and cannot be used with
494 .Fl q
495 or
496 .Fl b .
497 .It Fl H
498 Print out the device size in human readable (base 10, 1K == 1000) format.
499 .It Fl N
500 Print out the number of blocks in the device instead of the last logical
501 block.
502 .It Fl q
503 Quiet, print out the numbers only (separated by a comma if
504 .Fl b
505 or
506 .Fl s
507 are not specified).
508 .It Fl s
509 Print out the last logical block or the size of the device only, and omit
510 the blocksize.
511 .El
512 .It Ic start
513 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
514 start bit set.
515 .It Ic stop
516 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
517 start bit cleared.
518 .It Ic load
519 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
520 start bit set and the load/eject bit set.
521 .It Ic eject
522 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
523 start bit cleared and the load/eject bit set.
524 .It Ic rescan
525 Tell the kernel to scan all busses in the system (with the
526 .Ar all
527 argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
528 (XPT_SCAN_LUN) for new devices or devices that have gone away.
529 The user
530 may specify a scan of all busses, a single bus, or a lun.
531 Scanning all luns
532 on a target is not supported.
533 .It Ic reset
534 Tell the kernel to reset all busses in the system (with the
535 .Ar all
536 argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
537 reset for that bus, or to reset the given bus:target:lun
538 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
539 connecting to that device.
540 Note that this can have a destructive impact
541 on the system.
542 .It Ic defects
543 Send the
544 .Tn SCSI
545 READ DEFECT DATA (10) command (0x37) or the 
546 .Tn SCSI
547 READ DEFECT DATA (12) command (0xB7) to the given device, and
548 print out any combination of: the total number of defects, the primary
549 defect list (PLIST), and the grown defect list (GLIST).
550 .Bl -tag -width 11n
551 .It Fl f Ar format
552 Specify the requested format of the defect list.
553 The format argument is
554 required.
555 Most drives support the physical sector format.
556 Some drives
557 support the logical block format.
558 Many drives, if they do not support the
559 requested format, return the data in an alternate format, along with sense
560 information indicating that the requested data format is not supported.
561 The
562 .Nm
563 utility
564 attempts to detect this, and print out whatever format the drive returns.
565 If the drive uses a non-standard sense code to report that it does not
566 support the requested format,
567 .Nm
568 will probably see the error as a failure to complete the request.
569 .Pp
570 The format options are:
571 .Bl -tag -width 9n
572 .It block
573 Print out the list as logical blocks.
574 This is limited to 32-bit block sizes, and isn't supported by many modern
575 drives.
576 .It longblock
577 Print out the list as logical blocks.
578 This option uses a 64-bit block size.
579 .It bfi 
580 Print out the list in bytes from index format.
581 .It extbfi
582 Print out the list in extended bytes from index format.
583 The extended format allows for ranges of blocks to be printed.
584 .It phys 
585 Print out the list in physical sector format.
586 Most drives support this format.
587 .It extphys
588 Print out the list in extended physical sector format.
589 The extended format allows for ranges of blocks to be printed.
590 .El
591 .Pp
592 .It Fl G
593 Print out the grown defect list.
594 This is a list of bad blocks that have
595 been remapped since the disk left the factory.
596 .It Fl P
597 Print out the primary defect list.
598 This is the list of defects that were present in the factory.
599 .It Fl q
600 When printing status information with
601 .Fl s ,
602 only print the number of defects.
603 .It Fl s
604 Just print the number of defects, not the list of defects.
605 .It Fl S Ar offset
606 Specify the starting offset into the defect list.
607 This implies using the
608 .Tn SCSI
609 READ DEFECT DATA (12) command, as the 10 byte version of the command
610 doesn't support the address descriptor index field.
611 Not all drives support the 12 byte command, and some drives that support
612 the 12 byte command don't support the address descriptor index field.
613 .It Fl X
614 Print out defects in hexadecimal (base 16) form instead of base 10 form.
615 .El
616 .Pp
617 If neither
618 .Fl P
619 nor
620 .Fl G
621 is specified,
622 .Nm
623 will print out the number of defects given in the READ DEFECT DATA header
624 returned from the drive.
625 Some drives will report 0 defects if neither the primary or grown defect
626 lists are requested.
627 .It Ic modepage
628 Allows the user to display and optionally edit a SCSI mode page.
629 The mode
630 page formats are located in
631 .Pa /usr/share/misc/scsi_modes .
632 This can be overridden by specifying a different file in the
633 .Ev SCSI_MODES
634 environment variable.
635 The
636 .Ic modepage
637 command takes several arguments:
638 .Bl -tag -width 12n
639 .It Fl d
640 Disable block descriptors for mode sense.
641 .It Fl b
642 Displays mode page data in binary format.
643 .It Fl e
644 This flag allows the user to edit values in the mode page.
645 The user may
646 either edit mode page values with the text editor pointed to by his
647 .Ev EDITOR
648 environment variable, or supply mode page values via standard input, using
649 the same format that
650 .Nm
651 uses to display mode page values.
652 The editor will be invoked if
653 .Nm
654 detects that standard input is terminal.
655 .It Fl l
656 Lists all available mode pages.
657 .It Fl m Ar mode_page
658 This specifies the number of the mode page the user would like to view
659 and/or edit.
660 This argument is mandatory unless
661 .Fl l
662 is specified.
663 .It Fl P Ar pgctl
664 This allows the user to specify the page control field.
665 Possible values are:
666 .Bl -tag -width xxx -compact
667 .It 0
668 Current values
669 .It 1
670 Changeable values
671 .It 2
672 Default values
673 .It 3
674 Saved values
675 .El
676 .El
677 .It Ic cmd
678 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
679 The
680 .Ic cmd
681 function requires the
682 .Fl c
683 argument to specify SCSI CDB or the
684 .Fl a
685 argument to specify ATA Command Block registers values.
686 Other arguments are optional, depending on
687 the command type.
688 The command and data specification syntax is documented
689 in
690 .Xr cam_cdbparse 3 .
691 NOTE: If the CDB specified causes data to be transferred to or from the
692 SCSI device in question, you MUST specify either
693 .Fl i
694 or
695 .Fl o .
696 .Bl -tag -width 17n
697 .It Fl a Ar cmd Op args
698 This specifies the content of 12 ATA Command Block registers (command,
699 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
700 lba_high_exp, features_exp, sector_count, sector_count_exp).
701 .It Fl c Ar cmd Op args
702 This specifies the SCSI CDB.
703 SCSI CDBs may be 6, 10, 12 or 16 bytes.
704 .It Fl d
705 Specifies DMA protocol to be used for ATA command.
706 .It Fl f
707 Specifies FPDMA (NCQ) protocol to be used for ATA command.
708 .It Fl i Ar len Ar fmt
709 This specifies the amount of data to read, and how it should be displayed.
710 If the format is
711 .Sq - ,
712 .Ar len
713 bytes of data will be read from the device and written to standard output.
714 .It Fl o Ar len Ar fmt Op args
715 This specifies the amount of data to be written to a device, and the data
716 that is to be written.
717 If the format is
718 .Sq - ,
719 .Ar len
720 bytes of data will be read from standard input and written to the device.
721 .It Fl r Ar fmt
722 This specifies that 11 result ATA Command Block registers should be displayed
723 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
724 lba_high_exp, sector_count, sector_count_exp), and how.
725 If the format is
726 .Sq - ,
727 11 result registers will be written to standard output in hex.
728 .El
729 .It Ic smpcmd
730 Allows the user to send an arbitrary Serial
731 Management Protocol (SMP) command to a device.
732 The
733 .Ic smpcmd
734 function requires the
735 .Fl r
736 argument to specify the SMP request to be sent, and the
737 .Fl R
738 argument to specify the format of the SMP response.
739 The syntax for the SMP request and response arguments is documented in
740 .Xr cam_cdbparse 3 .
741 .Pp
742 Note that SAS adapters that support SMP passthrough (at least the currently
743 known adapters) do not accept CRC bytes from the user in the request and do
744 not pass CRC bytes back to the user in the response.
745 Therefore users should not include the CRC bytes in the length of the
746 request and not expect CRC bytes to be returned in the response.
747 .Bl -tag -width 17n
748 .It Fl r Ar len Ar fmt Op args
749 This specifies the size of the SMP request, without the CRC bytes, and the
750 SMP request format.
751 If the format is
752 .Sq - ,
753 .Ar len
754 bytes of data will be read from standard input and written as the SMP
755 request.
756 .It Fl R Ar len Ar fmt Op args
757 This specifies the size of the buffer allocated for the SMP response, and
758 the SMP response format.
759 If the format is
760 .Sq - ,
761 .Ar len
762 bytes of data will be allocated for the response and the response will be
763 written to standard output.
764 .El
765 .It Ic smprg
766 Allows the user to send the Serial Management Protocol (SMP) Report General
767 command to a device.
768 .Nm
769 will display the data returned by the Report General command.
770 If the SMP target supports the long response format, the additional data
771 will be requested and displayed automatically.
772 .Bl -tag -width 8n
773 .It Fl l
774 Request the long response format only.
775 Not all SMP targets support the long response format.
776 This option causes
777 .Nm
778 to skip sending the initial report general request without the long bit set
779 and only issue a report general request with the long bit set.
780 .El
781 .It Ic smppc
782 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
783 command to a device.
784 This function should be used with some caution, as it can render devices
785 inaccessible, and could potentially cause data corruption as well.
786 The
787 .Fl p
788 argument is required to specify the PHY to operate on.
789 .Bl -tag -width 17n
790 .It Fl p Ar phy
791 Specify the PHY to operate on.
792 This argument is required.
793 .It Fl l
794 Request the long request/response format.
795 Not all SMP targets support the long response format.
796 For the PHY Control command, this currently only affects whether the
797 request length is set to a value other than 0.
798 .It Fl o Ar operation
799 Specify a PHY control operation.
800 Only one
801 .Fl o
802 operation may be specified.
803 The operation may be specified numerically (in decimal, hexadecimal, or octal)
804 or one of the following operation names may be specified:
805 .Bl -tag -width 16n
806 .It nop
807 No operation.
808 It is not necessary to specify this argument.
809 .It linkreset
810 Send the LINK RESET command to the phy.
811 .It hardreset
812 Send the HARD RESET command to the phy.
813 .It disable
814 Send the DISABLE command to the phy.
815 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
816 .It clearerrlog
817 Send the CLEAR ERROR LOG command.
818 This clears the error log counters for the specified phy.
819 .It clearaffiliation
820 Send the CLEAR AFFILIATION command.
821 This clears the affiliation from the STP initiator port with the same SAS
822 address as the SMP initiator that requests the clear operation.
823 .It sataportsel
824 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
825 This will cause a SATA port selector to use the given phy as its active phy
826 and make the other phy inactive.
827 .It clearitnl
828 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
829 .It setdevname
830 Send the SET ATTACHED DEVICE NAME command to the PHY.
831 This requires the
832 .Fl d
833 argument to specify the device name.
834 .El
835 .It Fl d Ar name
836 Specify the attached device name.
837 This option is needed with the
838 .Fl o Ar setdevname
839 phy operation.
840 The name is a 64-bit number, and can be specified in decimal, hexadecimal
841 or octal format.
842 .It Fl m Ar rate
843 Set the minimum physical link rate for the phy.
844 This is a numeric argument.
845 Currently known link rates are:
846 .Bl -tag -width 5n
847 .It 0x0
848 Do not change current value.
849 .It 0x8
850 1.5 Gbps
851 .It 0x9
852 3 Gbps
853 .It 0xa
854 6 Gbps
855 .El
856 .Pp
857 Other values may be specified for newer physical link rates.
858 .It Fl M Ar rate
859 Set the maximum physical link rate for the phy.
860 This is a numeric argument.
861 See the
862 .Fl m
863 argument description for known link rate arguments.
864 .It Fl T Ar pp_timeout
865 Set the partial pathway timeout value, in microseconds.
866 See the
867 .Tn ANSI
868 .Tn SAS
869 Protocol Layer (SPL)
870 specification for more information on this field.
871 .It Fl a Ar enable|disable
872 Enable or disable SATA slumber phy power conditions.
873 .It Fl A Ar enable|disable
874 Enable or disable SATA partial power conditions.
875 .It Fl s Ar enable|disable
876 Enable or disable SAS slumber phy power conditions.
877 .It Fl S Ar enable|disable
878 Enable or disable SAS partial phy power conditions.
879 .El
880 .It Ic smpphylist
881 List phys attached to a SAS expander, the address of the end device
882 attached to the phy, and the inquiry data for that device and peripheral
883 devices attached to that device.
884 The inquiry data and peripheral devices are displayed if available.
885 .Bl -tag -width 5n
886 .It Fl l
887 Turn on the long response format for the underlying SMP commands used for
888 this command.
889 .It Fl q
890 Only print out phys that are attached to a device in the CAM EDT (Existing
891 Device Table).
892 .El
893 .It Ic smpmaninfo
894 Send the SMP Report Manufacturer Information command to the device and
895 display the response.
896 .Bl -tag -width 5n
897 .It Fl l
898 Turn on the long response format for the underlying SMP commands used for
899 this command.
900 .El
901 .It Ic debug
902 Turn on CAM debugging printfs in the kernel.
903 This requires options CAMDEBUG
904 in your kernel config file.
905 WARNING: enabling debugging printfs currently
906 causes an EXTREME number of kernel printfs.
907 You may have difficulty
908 turning off the debugging printfs once they start, since the kernel will be
909 busy printing messages and unable to service other requests quickly.
910 The
911 .Ic debug
912 function takes a number of arguments:
913 .Bl -tag -width 18n
914 .It Fl I
915 Enable CAM_DEBUG_INFO printfs.
916 .It Fl P
917 Enable CAM_DEBUG_PERIPH printfs.
918 .It Fl T
919 Enable CAM_DEBUG_TRACE printfs.
920 .It Fl S
921 Enable CAM_DEBUG_SUBTRACE printfs.
922 .It Fl X
923 Enable CAM_DEBUG_XPT printfs.
924 .It Fl c
925 Enable CAM_DEBUG_CDB printfs.
926 This will cause the kernel to print out the
927 SCSI CDBs sent to the specified device(s).
928 .It Fl p
929 Enable CAM_DEBUG_PROBE printfs.
930 .It all
931 Enable debugging for all devices.
932 .It off
933 Turn off debugging for all devices
934 .It bus Ns Op :target Ns Op :lun
935 Turn on debugging for the given bus, target or lun.
936 If the lun or target
937 and lun are not specified, they are wildcarded.
938 (i.e., just specifying a
939 bus turns on debugging printfs for all devices on that bus.)
940 .El
941 .It Ic tags
942 Show or set the number of "tagged openings" or simultaneous transactions
943 we attempt to queue to a particular device.
944 By default, the
945 .Ic tags
946 command, with no command-specific arguments (i.e., only generic arguments)
947 prints out the "soft" maximum number of transactions that can be queued to
948 the device in question.
949 For more detailed information, use the
950 .Fl v
951 argument described below.
952 .Bl -tag -width 7n
953 .It Fl N Ar tags
954 Set the number of tags for the given device.
955 This must be between the
956 minimum and maximum number set in the kernel quirk table.
957 The default for
958 most devices that support tagged queueing is a minimum of 2 and a maximum
959 of 255.
960 The minimum and maximum values for a given device may be
961 determined by using the
962 .Fl v
963 switch.
964 The meaning of the
965 .Fl v
966 switch for this
967 .Nm
968 subcommand is described below.
969 .It Fl q
970 Be quiet, and do not report the number of tags.
971 This is generally used when
972 setting the number of tags.
973 .It Fl v
974 The verbose flag has special functionality for the
975 .Em tags
976 argument.
977 It causes
978 .Nm
979 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
980 .Bl -tag -width 13n
981 .It dev_openings
982 This is the amount of capacity for transactions queued to a given device.
983 .It dev_active
984 This is the number of transactions currently queued to a device.
985 .It devq_openings
986 This is the kernel queue space for transactions.
987 This count usually mirrors
988 dev_openings except during error recovery operations when
989 the device queue is frozen (device is not allowed to receive
990 commands), the number of dev_openings is reduced, or transaction
991 replay is occurring.
992 .It devq_queued
993 This is the number of transactions waiting in the kernel queue for capacity
994 on the device.
995 This number is usually zero unless error recovery is in
996 progress.
997 .It held
998 The held count is the number of CCBs held by peripheral drivers that have
999 either just been completed or are about to be released to the transport
1000 layer for service by a device.
1001 Held CCBs reserve capacity on a given
1002 device.
1003 .It mintags
1004 This is the current "hard" minimum number of transactions that can be
1005 queued to a device at once.
1006 The
1007 .Ar dev_openings
1008 value above cannot go below this number.
1009 The default value for
1010 .Ar mintags
1011 is 2, although it may be set higher or lower for various devices.
1012 .It maxtags
1013 This is the "hard" maximum number of transactions that can be queued to a
1014 device at one time.
1015 The
1016 .Ar dev_openings
1017 value cannot go above this number.
1018 The default value for
1019 .Ar maxtags
1020 is 255, although it may be set higher or lower for various devices.
1021 .El
1022 .El
1023 .It Ic negotiate
1024 Show or negotiate various communication parameters.
1025 Some controllers may
1026 not support setting or changing some of these values.
1027 For instance, the
1028 Adaptec 174x controllers do not support changing a device's sync rate or
1029 offset.
1030 The
1031 .Nm
1032 utility
1033 will not attempt to set the parameter if the controller indicates that it
1034 does not support setting the parameter.
1035 To find out what the controller
1036 supports, use the
1037 .Fl v
1038 flag.
1039 The meaning of the
1040 .Fl v
1041 flag for the
1042 .Ic negotiate
1043 command is described below.
1044 Also, some controller drivers do not support
1045 setting negotiation parameters, even if the underlying controller supports
1046 negotiation changes.
1047 Some controllers, such as the Advansys wide
1048 controllers, support enabling and disabling synchronous negotiation for
1049 a device, but do not support setting the synchronous negotiation rate.
1050 .Bl -tag -width 17n
1051 .It Fl a
1052 Attempt to make the negotiation settings take effect immediately by sending
1053 a Test Unit Ready command to the device.
1054 .It Fl c
1055 Show or set current negotiation settings.
1056 This is the default.
1057 .It Fl D Ar enable|disable
1058 Enable or disable disconnection.
1059 .It Fl M Ar mode
1060 Set ATA mode.
1061 .It Fl O Ar offset
1062 Set the command delay offset.
1063 .It Fl q
1064 Be quiet, do not print anything.
1065 This is generally useful when you want to
1066 set a parameter, but do not want any status information.
1067 .It Fl R Ar syncrate
1068 Change the synchronization rate for a device.
1069 The sync rate is a floating
1070 point value specified in MHz.
1071 So, for instance,
1072 .Sq 20.000
1073 is a legal value, as is
1074 .Sq 20 .
1075 .It Fl T Ar enable|disable
1076 Enable or disable tagged queueing for a device.
1077 .It Fl U
1078 Show or set user negotiation settings.
1079 The default is to show or set
1080 current negotiation settings.
1081 .It Fl v
1082 The verbose switch has special meaning for the
1083 .Ic negotiate
1084 subcommand.
1085 It causes
1086 .Nm
1087 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1088 controller driver.
1089 .It Fl W Ar bus_width
1090 Specify the bus width to negotiate with a device.
1091 The bus width is
1092 specified in bits.
1093 The only useful values to specify are 8, 16, and 32
1094 bits.
1095 The controller must support the bus width in question in order for
1096 the setting to take effect.
1097 .El
1098 .Pp
1099 In general, sync rate and offset settings will not take effect for a
1100 device until a command has been sent to the device.
1101 The
1102 .Fl a
1103 switch above will automatically send a Test Unit Ready to the device so
1104 negotiation parameters will take effect.
1105 .It Ic format
1106 Issue the
1107 .Tn SCSI
1108 FORMAT UNIT command to the named device.
1109 .Pp
1110 .Em WARNING! WARNING! WARNING!
1111 .Pp
1112 Low level formatting a disk will destroy ALL data on the disk.
1113 Use
1114 extreme caution when issuing this command.
1115 Many users low-level format
1116 disks that do not really need to be low-level formatted.
1117 There are
1118 relatively few scenarios that call for low-level formatting a disk.
1119 One reason for
1120 low-level formatting a disk is to initialize the disk after changing
1121 its physical sector size.
1122 Another reason for low-level formatting a disk
1123 is to revive the disk if you are getting "medium format corrupted" errors
1124 from the disk in response to read and write requests.
1125 .Pp
1126 Some disks take longer than others to format.
1127 Users should specify a
1128 timeout long enough to allow the format to complete.
1129 The default format
1130 timeout is 3 hours, which should be long enough for most disks.
1131 Some hard
1132 disks will complete a format operation in a very short period of time
1133 (on the order of 5 minutes or less).
1134 This is often because the drive
1135 does not really support the FORMAT UNIT command -- it just accepts the
1136 command, waits a few minutes and then returns it.
1137 .Pp
1138 The
1139 .Sq format
1140 subcommand takes several arguments that modify its default behavior.
1141 The
1142 .Fl q
1143 and
1144 .Fl y
1145 arguments can be useful for scripts.
1146 .Bl -tag -width 6n
1147 .It Fl q
1148 Be quiet, do not print any status messages.
1149 This option will not disable
1150 the questions, however.
1151 To disable questions, use the
1152 .Fl y
1153 argument, below.
1154 .It Fl r
1155 Run in
1156 .Dq report only
1157 mode.
1158 This will report status on a format that is already running on the drive.
1159 .It Fl w
1160 Issue a non-immediate format command.
1161 By default,
1162 .Nm
1163 issues the FORMAT UNIT command with the immediate bit set.
1164 This tells the
1165 device to immediately return the format command, before the format has
1166 actually completed.
1167 Then,
1168 .Nm
1169 gathers
1170 .Tn SCSI
1171 sense information from the device every second to determine how far along
1172 in the format process it is.
1173 If the
1174 .Fl w
1175 argument is specified,
1176 .Nm
1177 will issue a non-immediate format command, and will be unable to print any
1178 information to let the user know what percentage of the disk has been
1179 formatted.
1180 .It Fl y
1181 Do not ask any questions.
1182 By default,
1183 .Nm
1184 will ask the user if he/she really wants to format the disk in question,
1185 and also if the default format command timeout is acceptable.
1186 The user
1187 will not be asked about the timeout if a timeout is specified on the
1188 command line.
1189 .El
1190 .It Ic sanitize
1191 Issue the
1192 .Tn SCSI
1193 SANITIZE command to the named device.
1194 .Pp
1195 .Em WARNING! WARNING! WARNING!
1196 .Pp
1197 ALL data in the cache and on the disk will be destroyed or made inaccessible.
1198 Recovery of the data is not possible.
1199 Use extreme caution when issuing this command.
1200 .Pp
1201 The
1202 .Sq sanitize
1203 subcommand takes several arguments that modify its default behavior.
1204 The
1205 .Fl q
1206 and
1207 .Fl y
1208 arguments can be useful for scripts.
1209 .Bl -tag -width 6n
1210 .It Fl a Ar operation
1211 Specify the sanitize operation to perform.
1212 .Bl -tag -width 16n
1213 .It overwrite
1214 Perform an overwrite operation by writing a user supplied
1215 data pattern to the device one or more times.
1216 The pattern is given by the
1217 .Fl P
1218 argument.
1219 The number of times is given by the
1220 .Fl c
1221 argument.
1222 .It block
1223 Perform a block erase operation.
1224 All the device's blocks are set to a vendor defined
1225 value, typically zero.
1226 .It crypto
1227 Perform a cryptographic erase operation.
1228 The encryption keys are changed to prevent the decryption
1229 of the data.
1230 .It exitfailure
1231 Exits a previously failed sanitize operation.
1232 A failed sanitize operation can only be exited if it was
1233 run in the unrestricted completion mode, as provided by the
1234 .Fl U
1235 argument.
1236 .El
1237 .It Fl c Ar passes
1238 The number of passes when performing an
1239 .Sq overwrite
1240 operation.
1241 Valid values are between 1 and 31.
1242 The default is 1.
1243 .It Fl I
1244 When performing an
1245 .Sq overwrite
1246 operation, the pattern is inverted between consecutive passes.
1247 .It Fl P Ar pattern
1248 Path to the file containing the pattern to use when
1249 performing an
1250 .Sq overwrite
1251 operation.
1252 The pattern is repeated as needed to fill each block.
1253 .It Fl q
1254 Be quiet, do not print any status messages.
1255 This option will not disable
1256 the questions, however.
1257 To disable questions, use the
1258 .Fl y
1259 argument, below.
1260 .It Fl U
1261 Perform the sanitize in the unrestricted completion mode.
1262 If the operation fails, it can later be exited with the
1263 .Sq exitfailure
1264 operation.
1265 .It Fl r
1266 Run in
1267 .Dq report only
1268 mode.
1269 This will report status on a sanitize that is already running on the drive.
1270 .It Fl w
1271 Issue a non-immediate sanitize command.
1272 By default,
1273 .Nm
1274 issues the SANITIZE command with the immediate bit set.
1275 This tells the
1276 device to immediately return the sanitize command, before
1277 the sanitize has actually completed.
1278 Then,
1279 .Nm
1280 gathers
1281 .Tn SCSI
1282 sense information from the device every second to determine how far along
1283 in the sanitize process it is.
1284 If the
1285 .Fl w
1286 argument is specified,
1287 .Nm
1288 will issue a non-immediate sanitize command, and will be unable to print any
1289 information to let the user know what percentage of the disk has been
1290 sanitized.
1291 .It Fl y
1292 Do not ask any questions.
1293 By default,
1294 .Nm
1295 will ask the user if he/she really wants to sanitize the disk in question,
1296 and also if the default sanitize command timeout is acceptable.
1297 The user
1298 will not be asked about the timeout if a timeout is specified on the
1299 command line.
1300 .El
1301 .It Ic idle
1302 Put ATA device into IDLE state.
1303 Optional parameter
1304 .Pq Fl t
1305 specifies automatic standby timer value in seconds.
1306 Value 0 disables timer.
1307 .It Ic standby
1308 Put ATA device into STANDBY state.
1309 Optional parameter
1310 .Pq Fl t
1311 specifies automatic standby timer value in seconds.
1312 Value 0 disables timer.
1313 .It Ic sleep
1314 Put ATA device into SLEEP state.
1315 Note that the only way get device out of
1316 this state may be reset.
1317 .It Ic apm
1318 It optional parameter
1319 .Pq Fl l
1320 specified, enables and sets advanced power management level, where
1321 1 -- minimum power, 127 -- maximum performance with standby,
1322 128 -- minimum power without standby, 254 -- maximum performance.
1323 If not specified -- APM is disabled.
1324 .It Ic aam
1325 It optional parameter
1326 .Pq Fl l
1327 specified, enables and sets automatic acoustic management level, where
1328 1 -- minimum noise, 254 -- maximum performance.
1329 If not specified -- AAM is disabled.
1330 .It Ic security
1331 Update or report security settings, using an ATA identify command (0xec).
1332 By default,
1333 .Nm
1334 will print out the security support and associated settings of the device.
1335 The
1336 .Ic security
1337 command takes several arguments:
1338 .Bl -tag -width 0n
1339 .It Fl d Ar pwd
1340 .Pp
1341 Disable device security using the given password for the selected user according
1342 to the devices configured security level.
1343 .It Fl e Ar pwd
1344 .Pp
1345 Erase the device using the given password for the selected user.
1346 .Pp
1347 .Em WARNING! WARNING! WARNING!
1348 .Pp
1349 Issuing a secure erase will
1350 .Em ERASE ALL
1351 user data on the device and may take several hours to complete.
1352 .Pp
1353 When this command is used against an SSD drive all its cells will be marked as
1354 empty, restoring it to factory default write performance.
1355 For SSD's this action
1356 usually takes just a few seconds.
1357 .It Fl f
1358 .Pp
1359 Freeze the security configuration of the specified device.
1360 .Pp
1361 After command completion any other commands that update the device lock mode
1362 shall be command aborted.
1363 Frozen mode is disabled by power-off or hardware reset.
1364 .It Fl h Ar pwd
1365 .Pp
1366 Enhanced erase the device using the given password for the selected user.
1367 .Pp
1368 .Em WARNING! WARNING! WARNING!
1369 .Pp
1370 Issuing an enhanced secure erase will
1371 .Em ERASE ALL
1372 user data on the device and may take several hours to complete.
1373 .Pp
1374 An enhanced erase writes predetermined data patterns to all user data areas,
1375 all previously written user data shall be overwritten, including sectors that
1376 are no longer in use due to reallocation.
1377 .It Fl k Ar pwd
1378 .Pp
1379 Unlock the device using the given password for the selected user according to
1380 the devices configured security level.
1381 .It Fl l Ar high|maximum
1382 .Pp
1383 Specifies which security level to set when issuing a
1384 .Fl s Ar pwd
1385 command.
1386 The security level determines device behavior when the master
1387 password is used to unlock the device.
1388 When the security level is set to high
1389 the device requires the unlock command and the master password to unlock.
1390 When the security level is set to maximum the device requires a secure erase
1391 with the master password to unlock.
1392 .Pp
1393 This option must be used in conjunction with one of the security action commands.
1394 .Pp
1395 Defaults to
1396 .Em high
1397 .It Fl q
1398 .Pp
1399 Be quiet, do not print any status messages.
1400 This option will not disable the questions, however.
1401 To disable questions, use the
1402 .Fl y
1403 argument, below.
1404 .It Fl s Ar pwd
1405 .Pp
1406 Password the device (enable security) using the given password for the selected
1407 user.
1408 This option can be combined with other options such as
1409 .Fl e Em pwd
1410 .Pp
1411 A master password may be set in a addition to the user password. The purpose of
1412 the master password is to allow an administrator to establish a password that
1413 is kept secret from the user, and which may be used to unlock the device if the
1414 user password is lost.
1415 .Pp
1416 .Em Note:
1417 Setting the master password does not enable device security.
1418 .Pp
1419 If the master password is set and the drive supports a Master Revision Code
1420 feature the Master Password Revision Code will be decremented.
1421 .It Fl T Ar timeout
1422 .Pp
1423 Overrides the default timeout, specified in seconds, used for both
1424 .Fl e
1425 and
1426 .Fl h
1427 this is useful if your system has problems processing long timeouts correctly.
1428 .Pp
1429 Usually the timeout is calculated from the information stored on the drive if
1430 present, otherwise it defaults to 2 hours.
1431 .It Fl U Ar user|master
1432 .Pp
1433 Specifies which user to set / use for the running action command, valid values
1434 are user or master and defaults to master if not set.
1435 .Pp
1436 This option must be used in conjunction with one of the security action commands.
1437 .Pp
1438 Defaults to
1439 .Em master
1440 .It Fl y
1441 .Pp
1442 Confirm yes to dangerous options such as
1443 .Fl e
1444 without prompting for confirmation.
1445 .Pp
1446 .El
1447 If the password specified for any action commands does not match the configured
1448 password for the specified user the command will fail.
1449 .Pp
1450 The password in all cases is limited to 32 characters, longer passwords will
1451 fail.
1452 .It Ic hpa
1453 Update or report Host Protected Area details.
1454 By default
1455 .Nm
1456 will print out the HPA support and associated settings of the device.
1457 The
1458 .Ic hpa
1459 command takes several optional arguments:
1460 .Bl -tag -width 0n
1461 .It Fl f
1462 .Pp
1463 Freeze the HPA configuration of the specified device.
1464 .Pp
1465 After command completion any other commands that update the HPA configuration
1466 shall be command aborted.
1467 Frozen mode is disabled by power-off or hardware reset.
1468 .It Fl l
1469 .Pp
1470 Lock the HPA configuration of the device until a successful call to unlock or
1471 the next power-on reset occurs.
1472 .It Fl P
1473 .Pp
1474 Make the HPA max sectors persist across power-on reset or a hardware reset.
1475 This must be used in combination with
1476 .Fl s Ar max_sectors
1477 .
1478 .It Fl p Ar pwd
1479 .Pp
1480 Set the HPA configuration password required for unlock calls.
1481 .It Fl q
1482 .Pp
1483 Be quiet, do not print any status messages.
1484 This option will not disable the questions.
1485 To disable questions, use the
1486 .Fl y
1487 argument, below.
1488 .It Fl s Ar max_sectors
1489 .Pp
1490 Configures the maximum user accessible sectors of the device.
1491 This will change the number of sectors the device reports.
1492 .Pp
1493 .Em WARNING! WARNING! WARNING!
1494 .Pp
1495 Changing the max sectors of a device using this option will make the data on
1496 the device beyond the specified value inaccessible.
1497 .Pp
1498 Only one successful
1499 .Fl s Ar max_sectors
1500 call can be made without a power-on reset or a hardware reset of the device.
1501 .It Fl U Ar pwd
1502 .Pp
1503 Unlock the HPA configuration of the specified device using the given password.
1504 If the password specified does not match the password configured via
1505 .Fl p Ar pwd
1506 the command will fail.
1507 .Pp
1508 After 5 failed unlock calls, due to password miss-match, the device will refuse
1509 additional unlock calls until after a power-on reset.
1510 .It Fl y
1511 .Pp
1512 Confirm yes to dangerous options such as
1513 .Fl e
1514 without prompting for confirmation
1515 .Pp
1516 .El
1517 The password for all HPA commands is limited to 32 characters, longer passwords
1518 will fail.
1519 .It Ic fwdownload
1520 Program firmware of the named SCSI device using the image file provided.
1521 .Pp
1522 Current list of supported vendors:
1523 .Bl -bullet -offset indent -compact
1524 .It
1525 HITACHI
1526 .It
1527 HP
1528 .It
1529 IBM
1530 .It
1531 PLEXTOR
1532 .It
1533 QUANTUM
1534 .It
1535 SAMSUNG
1536 .It
1537 SEAGATE
1538 .El
1539 .Pp
1540 .Em WARNING! WARNING! WARNING!
1541 .Pp
1542 Little testing has been done to make sure that different device models from
1543 each vendor work correctly with the fwdownload command.
1544 A vendor name appearing in the supported list means only that firmware of at
1545 least one device type from that vendor has successfully been programmed with
1546 the fwdownload command.
1547 Extra caution should be taken when using this command since there is no
1548 guarantee it will not break a device from the listed vendors.
1549 Ensure that you have a recent backup of the data on the device before
1550 performing a firmware update.
1551 .Bl -tag -width 11n
1552 .It Fl f Ar fw_image
1553 Path to the firmware image file to be downloaded to the specified device.
1554 .It Fl y
1555 Do not ask for confirmation.
1556 .It Fl s
1557 Run in simulation mode.
1558 Packet sizes that will be sent are shown, but no actual packet is sent to the
1559 device.
1560 No confirmation is asked in simulation mode.
1561 .It Fl v
1562 Besides showing sense information in case of a failure, the verbose option
1563 causes
1564 .Nm
1565 to output a line for every firmware segment that is sent to the device by the
1566 fwdownload command
1567 -- the same as the ones shown in simulation mode.
1568 .El
1569 .It Ic persist
1570 Persistent reservation support.
1571 Persistent reservations are a way to reserve a particular
1572 .Tn SCSI
1573 LUN for use by one or more
1574 .Tn SCSI
1575 initiators.
1576 If the
1577 .Fl i
1578 option is specified,
1579 .Nm
1580 will issue the
1581 .Tn SCSI
1582 PERSISTENT RESERVE IN
1583 command using the requested service action.
1584 If the
1585 .Fl o
1586 option is specified,
1587 .Nm
1588 will issue the
1589 .Tn SCSI
1590 PERSISTENT RESERVE OUT
1591 command using the requested service action.
1592 One of those two options is required.
1593 .Pp
1594 Persistent reservations are complex, and fully explaining them is outside
1595 the scope of this manual.
1596 Please visit
1597 http://www.t10.org
1598 and download the latest SPC spec for a full explanation of persistent
1599 reservations.
1600 .Bl -tag -width 8n
1601 .It Fl i Ar mode
1602 Specify the service action for the PERSISTENT RESERVE IN command.
1603 Supported service actions:
1604 .Bl -tag -width 19n
1605 .It read_keys
1606 Report the current persistent reservation generation (PRgeneration) and any
1607 registered keys.
1608 .It read_reservation
1609 Report the persistent reservation, if any.
1610 .It report_capabilities
1611 Report the persistent reservation capabilities of the LUN.
1612 .It read_full_status
1613 Report the full status of persistent reservations on the LUN.
1614 .El
1615 .It Fl o Ar mode
1616 Specify the service action for the PERSISTENT RESERVE OUT command.
1617 For service actions like register that are components of other service
1618 action names, the entire name must be specified.
1619 Otherwise, enough of the service action name must be specified to
1620 distinguish it from other possible service actions.
1621 Supported service actions:
1622 .Bl -tag -width 15n
1623 .It register
1624 Register a reservation key with the LUN or unregister a reservation key.
1625 To register a key, specify the requested key as the Service Action
1626 Reservation Key.
1627 To unregister a key, specify the previously registered key as the
1628 Reservation Key.
1629 To change a key, specify the old key as the Reservation Key and the new
1630 key as the Service Action Reservation Key.
1631 .It register_ignore
1632 This is similar to the register subcommand, except that the Reservation Key
1633 is ignored.
1634 The Service Action Reservation Key will overwrite any previous key
1635 registered for the initiator.
1636 .It reserve
1637 Create a reservation.
1638 A key must be registered with the LUN before the LUN can be reserved, and
1639 it must be specified as the Reservation Key.
1640 The type of reservation must also be specified.
1641 The scope defaults to LUN scope (LU_SCOPE), but may be changed.
1642 .It release
1643 Release a reservation.
1644 The Reservation Key must be specified.
1645 .It clear
1646 Release a reservation and remove all keys from the device.
1647 The Reservation Key must be specified.
1648 .It preempt
1649 Remove a reservation belonging to another initiator.
1650 The Reservation Key must be specified.
1651 The Service Action Reservation Key may be specified, depending on the
1652 operation being performed.
1653 .It preempt_abort
1654 Remove a reservation belonging to another initiator and abort all
1655 outstanding commands from that initiator.
1656 The Reservation Key must be specified.
1657 The Service Action Reservation Key may be specified, depending on the
1658 operation being performed.
1659 .It register_move
1660 Register another initiator with the LUN, and establish a reservation on the
1661 LUN for that initiator.
1662 The Reservation Key and Service Action Reservation Key must be specified.
1663 .It replace_lost
1664 Replace Lost Reservation information.
1665 .El
1666 .It Fl a
1667 Set the All Target Ports (ALL_TG_PT) bit.
1668 This requests that the key registration be applied to all target ports and
1669 not just the particular target port that receives the command.
1670 This only applies to the register and register_ignore actions.
1671 .It Fl I Ar tid
1672 Specify a Transport ID.
1673 This only applies to the Register and Register and Move service actions for
1674 Persistent Reserve Out.
1675 Multiple Transport IDs may be specified with multiple
1676 .Fl I
1677 arguments.
1678 With the Register service action, specifying one or more Transport IDs
1679 implicitly enables the
1680 .Fl S
1681 option which turns on the SPEC_I_PT bit.
1682 Transport IDs generally have the format protocol,id.
1683 .Bl -tag -width 5n
1684 .It SAS
1685 A SAS Transport ID consists of
1686 .Dq sas,
1687 followed by a 64-bit SAS address.
1688 For example:
1689 .Pp
1690 .Dl sas,0x1234567812345678
1691 .It FC
1692 A Fibre Channel Transport ID consists of
1693 .Dq fcp,
1694 followed by a 64-bit Fibre Channel World Wide Name. 
1695 For example:
1696 .Pp
1697 .Dl fcp,0x1234567812345678
1698 .It SPI
1699 A Parallel SCSI address consists of
1700 .Dq spi,
1701 followed by a SCSI target ID and a relative target port identifier.
1702 For example:
1703 .Pp
1704 .Dl spi,4,1
1705 .It 1394
1706 An IEEE 1394 (Firewire) Transport ID consists of
1707 .Dq sbp,
1708 followed by a 64-bit EUI-64 IEEE 1394 node unique identifier.
1709 For example:
1710 .Pp
1711 .Dl sbp,0x1234567812345678
1712 .It RDMA
1713 A SCSI over RDMA Transport ID consists of
1714 .Dq srp,
1715 followed by a 128-bit RDMA initiator port identifier.
1716 The port identifier must be exactly 32 or 34 (if the leading 0x is
1717 included) hexadecimal digits.
1718 Only hexadecimal (base 16) numbers are supported.
1719 For example:
1720 .Pp
1721 .Dl srp,0x12345678123456781234567812345678
1722 .It iSCSI
1723 An iSCSI Transport ID consists an iSCSI name and optionally a separator and
1724 iSCSI session ID.
1725 For example, if only the iSCSI name is specified:
1726 .Pp
1727 .Dl iqn.2012-06.com.example:target0
1728 .Pp
1729 If the iSCSI separator and initiator session ID are specified:
1730 .Pp
1731 .Dl iqn.2012-06.com.example:target0,i,0x123
1732 .It PCIe
1733 A SCSI over PCIe Transport ID consists of
1734 .Dq sop,
1735 followed by a PCIe Routing ID.
1736 The Routing ID consists of a bus, device and function or in the alternate
1737 form, a bus and function.
1738 The bus must be in the range of 0 to 255 inclusive and the device must be
1739 in the range of 0 to 31 inclusive.
1740 The function must be in the range of 0 to 7 inclusive if the standard form
1741 is used, and in the range of 0 to 255 inclusive if the alternate form is
1742 used.
1743 For example, if a bus, device and function are specified for the standard
1744 Routing ID form:
1745 .Pp
1746 .Dl sop,4,5,1
1747 .Pp
1748 If the alternate Routing ID form is used:
1749 .Pp
1750 .Dl sop,4,1
1751 .El
1752 .It Fl k Ar key
1753 Specify the Reservation Key.
1754 This may be in decimal, octal or hexadecimal format.
1755 The value is zero by default if not otherwise specified.
1756 The value must be between 0 and 2^64 - 1, inclusive.
1757 .It Fl K Ar key
1758 Specify the Service Action Reservation Key.
1759 This may be in decimal, octal or hexadecimal format.
1760 The value is zero by default if not otherwise specified.
1761 The value must be between 0 and 2^64 - 1, inclusive.
1762 .It Fl p
1763 Enable the Activate Persist Through Power Loss bit.
1764 This is only used for the register and register_ignore actions.
1765 This requests that the reservation persist across power loss events.
1766 .It Fl s Ar scope
1767 Specify the scope of the reservation.
1768 The scope may be specified by name or by number.
1769 The scope is ignored for register, register_ignore and clear.
1770 If the desired scope isn't available by name, you may specify the number.
1771 .Bl -tag -width 7n
1772 .It lun
1773 LUN scope (0x00).
1774 This encompasses the entire LUN.
1775 .It extent
1776 Extent scope (0x01).
1777 .It element
1778 Element scope (0x02).
1779 .El
1780 .It Fl R Ar rtp
1781 Specify the Relative Target Port.
1782 This only applies to the Register and Move service action of the Persistent
1783 Reserve Out command.
1784 .It Fl S
1785 Enable the SPEC_I_PT bit.
1786 This only applies to the Register service action of Persistent Reserve Out.
1787 You must also specify at least one Transport ID with
1788 .Fl I
1789 if this option is set.
1790 If you specify a Transport ID, this option is automatically set.
1791 It is an error to specify this option for any service action other than
1792 Register.
1793 .It Fl T Ar type
1794 Specify the reservation type.
1795 The reservation type may be specified by name or by number.
1796 If the desired reservation type isn't available by name, you may specify
1797 the number.
1798 Supported reservation type names:
1799 .Bl -tag -width 11n
1800 .It read_shared
1801 Read Shared mode.
1802 .It wr_ex
1803 Write Exclusive mode.
1804 May also be specified as
1805 .Dq write_exclusive .
1806 .It rd_ex
1807 Read Exclusive mode.
1808 May also be specified as
1809 .Dq read_exclusive .
1810 .It ex_ac
1811 Exclusive access mode.
1812 May also be specified as
1813 .Dq exclusive_access .
1814 .It wr_ex_ro
1815 Write Exclusive Registrants Only mode.
1816 May also be specified as 
1817 .Dq write_exclusive_reg_only .
1818 .It ex_ac_ro
1819 Exclusive Access Registrants Only mode.
1820 May also be specified as 
1821 .Dq exclusive_access_reg_only .
1822 .It wr_ex_ar
1823 Write Exclusive All Registrants mode.
1824 May also be specified as
1825 .Dq write_exclusive_all_regs .
1826 .It ex_ac_ar
1827 Exclusive Access All Registrants mode.
1828 May also be specified as 
1829 .Dq exclusive_access_all_regs .
1830 .El
1831 .It Fl U
1832 Specify that the target should unregister the initiator that sent
1833 the Register and Move request.
1834 By default, the target will not unregister the initiator that sends the
1835 Register and Move request.
1836 This option only applies to the Register and Move service action of the
1837 Persistent Reserve Out command.
1838 .El
1839 .It Ic attrib
1840 Issue the
1841 .Tn SCSI
1842 READ or WRITE ATTRIBUTE commands.
1843 These commands are used to read and write attributes in Medium Auxiliary
1844 Memory (MAM).
1845 The most common place Medium Auxiliary Memory is found is small flash chips
1846 included tape cartriges.
1847 For instance,
1848 .Tn LTO
1849 tapes have MAM.
1850 Either the
1851 .Fl r 
1852 option or the
1853 .Fl w 
1854 option must be specified.
1855 .Bl -tag -width 14n
1856 .It Fl r Ar action
1857 Specify the READ ATTRIBUTE service action.
1858 .Bl -tag -width 11n
1859 .It attr_values
1860 Issue the ATTRIBUTE VALUES service action.
1861 Read and decode the available attributes and their values.
1862 .It attr_list
1863 Issue the ATTRIBUTE LIST service action.
1864 List the attributes that are available to read and write.
1865 .It lv_list
1866 Issue the LOGICAL VOLUME LIST service action.
1867 List the available logical volumes in the MAM.
1868 .It part_list
1869 Issue the PARTITION LIST service action.
1870 List the available partitions in the MAM.
1871 .It supp_attr
1872 Issue the SUPPORTED ATTRIBUTES service action.
1873 List attributes that are supported for reading or writing.
1874 These attributes may or may not be currently present in the MAM.
1875 .El
1876 .It Fl w Ar attr
1877 Specify an attribute to write to the MAM.
1878 This option is not yet implemented.
1879 .It Fl a Ar num
1880 Specify the attribute number to display.
1881 This option only works with the attr_values, attr_list and supp_attr
1882 arguments to 
1883 .Fl r .
1884 .It Fl c
1885 Display cached attributes.
1886 If the device supports this flag, it allows displaying attributes for the
1887 last piece of media loaded in the drive.
1888 .It Fl e Ar num
1889 Specify the element address.
1890 This is used for specifying which element number in a medium changer to
1891 access when reading attributes.
1892 The element number could be for a picker, portal, slot or drive.
1893 .It Fl F Ar form1,form2
1894 Specify the output format for the attribute values (attr_val) display as a
1895 comma separated list of options.
1896 The default output is currently set to field_all,nonascii_trim,text_raw.
1897 Once this code is ported to FreeBSD 10, any text fields will be converted
1898 from their codeset to the user's native codeset with 
1899 .Xr iconv 3 .
1900 .Pp
1901 The text options are mutually exclusive; if you specify more than one, you
1902 will get unpredictable results.
1903 The nonascii options are also mutually exclusive.
1904 Most of the field options may be logically ORed together.
1905 .Bl -tag -width 12n
1906 .It text_esc
1907 Print text fields with non-ASCII characters escaped.
1908 .It text_raw
1909 Print text fields natively, with no codeset conversion.
1910 .It nonascii_esc
1911 If any non-ASCII characters occur in fields that are supposed to be ASCII,
1912 escape the non-ASCII characters.
1913 .It nonascii_trim
1914 If any non-ASCII characters occur in fields that are supposed to be ASCII,
1915 omit the non-ASCII characters.
1916 .It nonascii_raw
1917 If any non-ASCII characters occur in fields that are supposed to be ASCII,
1918 print them as they are.
1919 .It field_all
1920 Print all of the prefix fields: description, attribute number, attribute
1921 size, and the attribute's readonly status.
1922 If field_all is specified, specifying any other field options will not have
1923 an effect.
1924 .It field_none
1925 Print none of the prefix fields, and only print out the attribute value.
1926 If field_none is specified, specifying any other field options will result
1927 in those fields being printed.
1928 .It field_desc
1929 Print out the attribute description.
1930 .It field_num
1931 Print out the attribute number.
1932 .It field_size
1933 Print out the attribute size.
1934 .It field_rw
1935 Print out the attribute's readonly status.
1936 .El
1937 .It Fl p Ar part
1938 Specify the partition.
1939 When the media has multiple partitions, specifying different partition
1940 numbers allows seeing the values for each individual partition.
1941 .It Fl s Ar start_num
1942 Specify the starting attribute number.
1943 This requests that the target device return attribute information starting
1944 at the given number.
1945 .It Fl T Ar elem_type
1946 Specify the element type.
1947 For medium changer devices, this allows specifying the type the element
1948 referenced in the element address (
1949 .Fl e ) .
1950 Valid types are:
1951 .Dq all ,
1952 .Dq picker ,
1953 .Dq slot ,
1954 .Dq portal ,
1955 and
1956 .Dq drive .
1957 .El
1958 .It Fl V Ar vol_num
1959 Specify the number of the logical volume to operate on.
1960 If the media has multiple logical volumes, this will allow displaying
1961 or writing attributes on the given logical volume.
1962 .It Ic help
1963 Print out verbose usage information.
1964 .El
1965 .Sh ENVIRONMENT
1966 The
1967 .Ev SCSI_MODES
1968 variable allows the user to specify an alternate mode page format file.
1969 .Pp
1970 The
1971 .Ev EDITOR
1972 variable determines which text editor
1973 .Nm
1974 starts when editing mode pages.
1975 .Sh FILES
1976 .Bl -tag -width /usr/share/misc/scsi_modes -compact
1977 .It Pa /usr/share/misc/scsi_modes
1978 is the SCSI mode format database.
1979 .It Pa /dev/xpt0
1980 is the transport layer device.
1981 .It Pa /dev/pass*
1982 are the CAM application passthrough devices.
1983 .El
1984 .Sh EXAMPLES
1985 .Dl camcontrol eject -n cd -u 1 -v
1986 .Pp
1987 Eject the CD from cd1, and print SCSI sense information if the command
1988 fails.
1989 .Pp
1990 .Dl camcontrol tur da0
1991 .Pp
1992 Send the SCSI test unit ready command to da0.
1993 The
1994 .Nm
1995 utility will report whether the disk is ready, but will not display sense
1996 information if the command fails since the
1997 .Fl v
1998 switch was not specified.
1999 .Bd -literal -offset indent
2000 camcontrol tur da1 -E -C 4 -t 50 -v
2001 .Ed
2002 .Pp
2003 Send a test unit ready command to da1.
2004 Enable kernel error recovery.
2005 Specify a retry count of 4, and a timeout of 50 seconds.
2006 Enable sense
2007 printing (with the
2008 .Fl v
2009 flag) if the command fails.
2010 Since error recovery is turned on, the
2011 disk will be spun up if it is not currently spinning.
2012 The
2013 .Nm
2014 utility will report whether the disk is ready.
2015 .Bd -literal -offset indent
2016 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
2017         -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
2018 .Ed
2019 .Pp
2020 Issue a READ BUFFER command (0x3C) to cd1.
2021 Display the buffer size of cd1,
2022 and display the first 10 bytes from the cache on cd1.
2023 Display SCSI sense
2024 information if the command fails.
2025 .Bd -literal -offset indent
2026 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
2027         -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
2028 .Ed
2029 .Pp
2030 Issue a WRITE BUFFER (0x3B) command to cd1.
2031 Write out 10 bytes of data,
2032 not including the (reserved) 4 byte header.
2033 Print out sense information if
2034 the command fails.
2035 Be very careful with this command, improper use may
2036 cause data corruption.
2037 .Bd -literal -offset indent
2038 camcontrol modepage da3 -m 1 -e -P 3
2039 .Ed
2040 .Pp
2041 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
2042 settings on the drive.
2043 Mode page 1 contains a disk drive's auto read and
2044 write reallocation settings, among other things.
2045 .Pp
2046 .Dl camcontrol rescan all
2047 .Pp
2048 Rescan all SCSI busses in the system for devices that have been added,
2049 removed or changed.
2050 .Pp
2051 .Dl camcontrol rescan 0
2052 .Pp
2053 Rescan SCSI bus 0 for devices that have been added, removed or changed.
2054 .Pp
2055 .Dl camcontrol rescan 0:1:0
2056 .Pp
2057 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
2058 changed.
2059 .Pp
2060 .Dl camcontrol tags da5 -N 24
2061 .Pp
2062 Set the number of concurrent transactions for da5 to 24.
2063 .Bd -literal -offset indent
2064 camcontrol negotiate -n da -u 4 -T disable
2065 .Ed
2066 .Pp
2067 Disable tagged queueing for da4.
2068 .Bd -literal -offset indent
2069 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
2070 .Ed
2071 .Pp
2072 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
2073 Then send a
2074 Test Unit Ready command to make the settings take effect.
2075 .Bd -literal -offset indent
2076 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
2077 .Ed
2078 .Pp
2079 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
2080 it contains.
2081 Display SMP errors if the command fails.
2082 .Bd -literal -offset indent
2083 camcontrol security ada0
2084 .Ed
2085 .Pp
2086 Report security support and settings for ada0
2087 .Bd -literal -offset indent
2088 camcontrol security ada0 -U user -s MyPass
2089 .Ed
2090 .Pp
2091 Enable security on device ada0 with the password MyPass
2092 .Bd -literal -offset indent
2093 camcontrol security ada0 -U user -e MyPass
2094 .Ed
2095 .Pp
2096 Secure erase ada0 which has had security enabled with user password MyPass
2097 .Pp
2098 .Em WARNING! WARNING! WARNING!
2099 .Pp
2100 This will
2101 .Em ERASE ALL
2102 data from the device, so backup your data before using!
2103 .Pp
2104 This command can be used against an SSD drive to restoring it to
2105 factory default write performance.
2106 .Bd -literal -offset indent
2107 camcontrol hpa ada0
2108 .Ed
2109 .Pp
2110 Report HPA support and settings for ada0 (also reported via
2111 identify).
2112 .Bd -literal -offset indent
2113 camcontrol hpa ada0 -s 10240
2114 .Ed
2115 .Pp
2116 Enables HPA on ada0 setting the maximum reported sectors to 10240.
2117 .Pp
2118 .Em WARNING! WARNING! WARNING!
2119 .Pp
2120 This will
2121 .Em PREVENT ACCESS
2122 to all data on the device beyond this limit until HPA is disabled by setting
2123 HPA to native max sectors of the device, which can only be done after a
2124 power-on or hardware reset!
2125 .Pp
2126 .Em DO NOT
2127 use this on a device which has an active filesystem!
2128 .Pp
2129 .Bd -literal -offset indent
2130 camcontrol persist da0 -v -i read_keys
2131 .Ed
2132 .Pp
2133 This will read any persistent reservation keys registered with da0, and
2134 display any errors encountered when sending the PERSISTENT RESERVE IN
2135 .Tn SCSI 
2136 command.
2137 .Bd -literal -offset indent
2138 camcontrol persist da0 -v -o register -a -K 0x12345678
2139 .Ed
2140 .Pp
2141 This will register the persistent reservation key 0x12345678 with da0,
2142 apply that registration to all ports on da0, and display any errors that
2143 occur when sending the PERSISTENT RESERVE OUT command.
2144 .Bd -literal -offset indent
2145 camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
2146 .Ed
2147 .Pp
2148 This will reserve da0 for the exlusive use of the initiator issuing the
2149 command.
2150 The scope of the reservation is the entire LUN.
2151 Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
2152 .Bd -literal -offset indent
2153 camcontrol persist da0 -v -i read_full
2154 .Ed
2155 .Pp
2156 This will display the full status of all reservations on da0 and print out
2157 status if there are any errors.
2158 .Bd -literal -offset indent
2159 camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
2160 .Ed
2161 .Pp
2162 This will release a reservation on da0 of the type ex_ac
2163 (Exclusive Access).
2164 The Reservation Key for this registration is 0x12345678.
2165 Any errors that occur will be displayed.
2166 .Bd -literal -offset indent
2167 camcontrol persist da0 -v -o register -K 0x12345678 -S \e
2168         -I sas,0x1234567812345678 -I sas,0x8765432187654321
2169 .Ed
2170 .Pp
2171 This will register the key 0x12345678 with da0, specifying that it applies
2172 to the SAS initiators with SAS addresses 0x1234567812345678 and
2173 0x8765432187654321.
2174 .Bd -literal -offset indent
2175 camcontrol persist da0 -v -o register_move -k 0x87654321 \e
2176         -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
2177 .Ed
2178 .Pp
2179 This will move the registration from the current initiator, whose
2180 Registration Key is 0x87654321, to the Fibre Channel initiator with the 
2181 Fiber Channel World Wide Node Name 0x1234567812345678.
2182 A new registration key, 0x12345678, will be registered for the initiator 
2183 with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
2184 current initiator will be unregistered from the target.
2185 The reservation will be moved to relative target port 2 on the target
2186 device.
2187 The registration will persist across power losses.
2188 .Pp
2189 .Bd -literal -offset indent
2190 camcontrol attrib sa0 -v -i attr_values -p 1
2191 .Ed
2192 .Pp
2193 This will read and decode the attribute values from partition 1 on the tape
2194 in tape drive sa0, and will display any
2195 .Tn SCSI
2196 errors that result.
2197 .Sh SEE ALSO
2198 .Xr cam 3 ,
2199 .Xr cam_cdbparse 3 ,
2200 .Xr cam 4 ,
2201 .Xr pass 4 ,
2202 .Xr xpt 4
2203 .Sh HISTORY
2204 The
2205 .Nm
2206 utility first appeared in
2207 .Fx 3.0 .
2208 .Pp
2209 The mode page editing code and arbitrary SCSI command code are based upon
2210 code in the old
2211 .Xr scsi 8
2212 utility and
2213 .Xr scsi 3
2214 library, written by Julian Elischer and Peter Dufault.
2215 The
2216 .Xr scsi 8
2217 program first appeared in
2218 .Bx 386 0.1.2.4 ,
2219 and first appeared in
2220 .Fx
2221 in
2222 .Fx 2.0.5 .
2223 .Sh AUTHORS
2224 .An Kenneth Merry Aq ken@FreeBSD.org
2225 .Sh BUGS
2226 The code that parses the generic command line arguments does not know that
2227 some of the subcommands take multiple arguments.
2228 So if, for instance, you
2229 tried something like this:
2230 .Bd -literal -offset indent
2231 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
2232 .Ed
2233 .Pp
2234 The sense information from the test unit ready command would not get
2235 printed out, since the first
2236 .Xr getopt 3
2237 call in
2238 .Nm
2239 bails out when it sees the second argument to
2240 .Fl c
2241 (0x00),
2242 above.
2243 Fixing this behavior would take some gross code, or changes to the
2244 .Xr getopt 3
2245 interface.
2246 The best way to circumvent this problem is to always make sure
2247 to specify generic
2248 .Nm
2249 arguments before any command-specific arguments.