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