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