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