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