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