1525689f1SJustin T. Gibbs.\" 29deea857SKenneth D. Merry.\" Copyright (c) 1998, 1999 Kenneth D. Merry. 3525689f1SJustin T. Gibbs.\" All rights reserved. 4525689f1SJustin T. Gibbs.\" 5525689f1SJustin T. Gibbs.\" Redistribution and use in source and binary forms, with or without 6525689f1SJustin T. Gibbs.\" modification, are permitted provided that the following conditions 7525689f1SJustin T. Gibbs.\" are met: 8525689f1SJustin T. Gibbs.\" 1. Redistributions of source code must retain the above copyright 9525689f1SJustin T. Gibbs.\" notice, this list of conditions and the following disclaimer. 10525689f1SJustin T. Gibbs.\" 2. Redistributions in binary form must reproduce the above copyright 11525689f1SJustin T. Gibbs.\" notice, this list of conditions and the following disclaimer in the 12525689f1SJustin T. Gibbs.\" documentation and/or other materials provided with the distribution. 13525689f1SJustin T. Gibbs.\" 3. The name of the author may not be used to endorse or promote products 14525689f1SJustin T. Gibbs.\" derived from this software without specific prior written permission. 15525689f1SJustin T. Gibbs.\" 16525689f1SJustin T. Gibbs.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17525689f1SJustin T. Gibbs.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18525689f1SJustin T. Gibbs.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19525689f1SJustin T. Gibbs.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20525689f1SJustin T. Gibbs.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21525689f1SJustin T. Gibbs.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22525689f1SJustin T. Gibbs.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23525689f1SJustin T. Gibbs.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24525689f1SJustin T. Gibbs.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25525689f1SJustin T. Gibbs.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26525689f1SJustin T. Gibbs.\" SUCH DAMAGE. 27525689f1SJustin T. Gibbs.\" 289deea857SKenneth D. Merry.\" $Id: camcontrol.8,v 1.10 1999/02/27 07:55:58 ken Exp $ 29525689f1SJustin T. Gibbs.\" 30525689f1SJustin T. Gibbs.Dd September 14, 1998 31525689f1SJustin T. Gibbs.Dt CAMCONTROL 8 32525689f1SJustin T. Gibbs.Os FreeBSD 3.0 33525689f1SJustin T. Gibbs.Sh NAME 34525689f1SJustin T. Gibbs.Nm camcontrol 35525689f1SJustin T. Gibbs.Nd CAM control program 36525689f1SJustin T. Gibbs.Sh SYNOPSIS 37525689f1SJustin T. Gibbs.Nm camcontrol 38525689f1SJustin T. Gibbs.Aq command 39525689f1SJustin T. Gibbs.Op generic args 40525689f1SJustin T. Gibbs.Op command args 41525689f1SJustin T. Gibbs.Nm camcontrol 42525689f1SJustin T. Gibbsdevlist 43525689f1SJustin T. Gibbs.Op Fl v 44525689f1SJustin T. Gibbs.Nm camcontrol 45525689f1SJustin T. Gibbsperiphlist 46525689f1SJustin T. Gibbs.Op Fl n Ar dev_name 47525689f1SJustin T. Gibbs.Op Fl u Ar unit_number 48525689f1SJustin T. Gibbs.Nm camcontrol 49525689f1SJustin T. Gibbstur 50525689f1SJustin T. Gibbs.Op generic args 51525689f1SJustin T. Gibbs.Nm camcontrol 52525689f1SJustin T. Gibbsinquiry 53525689f1SJustin T. Gibbs.Op generic args 54525689f1SJustin T. Gibbs.Op Fl D 55525689f1SJustin T. Gibbs.Op Fl S 56525689f1SJustin T. Gibbs.Op Fl R 57525689f1SJustin T. Gibbs.Nm camcontrol 58525689f1SJustin T. Gibbsstart 59525689f1SJustin T. Gibbs.Op generic args 60525689f1SJustin T. Gibbs.Nm camcontrol 61525689f1SJustin T. Gibbsstop 62525689f1SJustin T. Gibbs.Op generic args 63525689f1SJustin T. Gibbs.Nm camcontrol 64525689f1SJustin T. Gibbseject 65525689f1SJustin T. Gibbs.Op generic args 66525689f1SJustin T. Gibbs.Nm camcontrol 67525689f1SJustin T. Gibbsrescan 68525689f1SJustin T. Gibbs.Aq bus Ns Op :target:lun 69525689f1SJustin T. Gibbs.Nm camcontrol 70a2a44836SMatt Jacobreset 71a2a44836SMatt Jacob.Aq bus Ns Op :target:lun 72a2a44836SMatt Jacob.Nm camcontrol 73525689f1SJustin T. Gibbsdefects 74525689f1SJustin T. Gibbs.Op generic args 75525689f1SJustin T. Gibbs.Aq Fl f Ar format 76525689f1SJustin T. Gibbs.Op Fl P 77525689f1SJustin T. Gibbs.Op Fl G 78525689f1SJustin T. Gibbs.Nm camcontrol 79525689f1SJustin T. Gibbsmodepage 80525689f1SJustin T. Gibbs.Op generic args 81525689f1SJustin T. Gibbs.Aq Fl m Ar page 821ac2383cSBill Fumerola.Op Fl P Ar pgctl 83525689f1SJustin T. Gibbs.Op Fl e 84525689f1SJustin T. Gibbs.Op Fl d 85525689f1SJustin T. Gibbs.Nm camcontrol 86525689f1SJustin T. Gibbscmd 87525689f1SJustin T. Gibbs.Op generic args 88525689f1SJustin T. Gibbs.Aq Fl c Ar cmd Op args 89525689f1SJustin T. Gibbs.Op Fl i Ar len Ar fmt 90525689f1SJustin T. Gibbs.Bk -words 91525689f1SJustin T. Gibbs.Op Fl o Ar len Ar fmt Op args 92525689f1SJustin T. Gibbs.Ek 93525689f1SJustin T. Gibbs.Nm camcontrol 94525689f1SJustin T. Gibbsdebug 95525689f1SJustin T. Gibbs.Op Fl I 96525689f1SJustin T. Gibbs.Op Fl T 97525689f1SJustin T. Gibbs.Op Fl S 9894d09127SKenneth D. Merry.Op Fl c 99525689f1SJustin T. Gibbs.Aq all|off|bus Ns Op :target Ns Op :lun 1009deea857SKenneth D. Merry.Nm camcontrol 1019deea857SKenneth D. Merrytags 1029deea857SKenneth D. Merry.Op generic args 1039deea857SKenneth D. Merry.Op Fl N Ar tags 1049deea857SKenneth D. Merry.Op Fl q 1059deea857SKenneth D. Merry.Op Fl v 1069deea857SKenneth D. Merry.Nm camcontrol 1079deea857SKenneth D. Merrynegotiate 1089deea857SKenneth D. Merry.Op generic args 1099deea857SKenneth D. Merry.Op Fl c 1109deea857SKenneth D. Merry.Op Fl D Ar enable|disable 1119deea857SKenneth D. Merry.Op Fl O Ar offset 1129deea857SKenneth D. Merry.Op Fl q 1139deea857SKenneth D. Merry.Op Fl R Ar syncrate 1149deea857SKenneth D. Merry.Op Fl T Ar enable|disable 1159deea857SKenneth D. Merry.Op Fl U 1169deea857SKenneth D. Merry.Op Fl W Ar bus_width 1179deea857SKenneth D. Merry.Op Fl v 118525689f1SJustin T. Gibbs.Sh DESCRIPTION 119525689f1SJustin T. Gibbs.Nm camcontrol 120525689f1SJustin T. Gibbsis a utility designed to provide a way for users to access and control the 121525689f1SJustin T. Gibbs.Tn FreeBSD 122525689f1SJustin T. GibbsCAM subsystem. 123525689f1SJustin T. Gibbs.Pp 124525689f1SJustin T. Gibbs.Nm camcontrol 125525689f1SJustin T. Gibbscan cause a loss of data and/or system crashes if used improperly. Even 1269deea857SKenneth D. Merryexpert users are encouraged to exercise caution when using this command. 127525689f1SJustin T. GibbsNovice users should stay away from this utility. 128525689f1SJustin T. Gibbs.Pp 129525689f1SJustin T. Gibbs.Nm camcontrol 130525689f1SJustin T. Gibbshas a number of primary functions, most of which take some generic 131525689f1SJustin T. Gibbsarguments: 132525689f1SJustin T. Gibbs.Bl -tag -width 01234567890123 133525689f1SJustin T. Gibbs.It Fl C Ar count 134525689f1SJustin T. GibbsSCSI command retry count. In order for this to work, error recovery 135525689f1SJustin T. Gibbs.Po 136525689f1SJustin T. Gibbs.Fl E 137525689f1SJustin T. Gibbs.Pc 138525689f1SJustin T. Gibbsmust be turned on. 139525689f1SJustin T. Gibbs.It Fl E 140525689f1SJustin T. GibbsInstruct the kernel to perform generic SCSI error recovery for the given 141525689f1SJustin T. Gibbscommand. This is needed in order for the retry count 142525689f1SJustin T. Gibbs.Po 143525689f1SJustin T. Gibbs.Fl C 144525689f1SJustin T. Gibbs.Pc 145525689f1SJustin T. Gibbsto be honored. Other than retrying commands, the generic error recovery in 146525689f1SJustin T. Gibbsthe code will generally attempt to spin up drives that are not spinning. 147525689f1SJustin T. GibbsIt may take some other actions, depending upon the sense code returned from 148525689f1SJustin T. Gibbsthe command. 149525689f1SJustin T. Gibbs.It Fl n Ar dev_name 150525689f1SJustin T. GibbsSpecify the device type to operate on. The default is 151525689f1SJustin T. Gibbs.Em da . 152525689f1SJustin T. Gibbs.It Fl t Ar timeout 153525689f1SJustin T. GibbsSCSI command timeout in seconds. This overrides the default timeout for 154525689f1SJustin T. Gibbsany given command. 155525689f1SJustin T. Gibbs.It Fl u Ar unit_number 156525689f1SJustin T. GibbsSpecify the device unit number. The default is 0. 157525689f1SJustin T. Gibbs.It Fl v 158525689f1SJustin T. GibbsBe verbose, print out sense information for failed SCSI commands. 159525689f1SJustin T. Gibbs.El 160525689f1SJustin T. Gibbs.Pp 161d13d1cd2SKenneth D. MerryPrimary command functions: 162525689f1SJustin T. Gibbs.Bl -tag -width periphlist 163525689f1SJustin T. Gibbs.It devlist 164525689f1SJustin T. GibbsList all physical devices (logical units) attached to the CAM subsystem. 165525689f1SJustin T. GibbsThis also includes a list of peripheral drivers attached to each device. 166525689f1SJustin T. GibbsWith the 167525689f1SJustin T. Gibbs.Fl v 168525689f1SJustin T. Gibbsargument, SCSI bus number, adapter name and unit numbers are printed as 169525689f1SJustin T. Gibbswell. 170525689f1SJustin T. Gibbs.It periphlist 171525689f1SJustin T. GibbsList all peripheral drivers attached to a given physical device (logical 172525689f1SJustin T. Gibbsunit). 173525689f1SJustin T. Gibbs.It tur 174525689f1SJustin T. GibbsSend the SCSI test unit ready (0x00) command to the given device. 175525689f1SJustin T. Gibbs.Nm camcontrol 176525689f1SJustin T. Gibbswill report whether the device is ready or not. 177525689f1SJustin T. Gibbs.It inquiry 178525689f1SJustin T. GibbsSend a SCSI inquiry command (0x12) to a device. By default, 179525689f1SJustin T. Gibbs.Nm camcontrol 180525689f1SJustin T. Gibbswill print out the standard inquiry data, device serial number, and 181525689f1SJustin T. Gibbstransfer rate information. The user can specify that only certain types of 182525689f1SJustin T. Gibbsinquiry data be printed: 183525689f1SJustin T. Gibbs.Bl -tag -width 1234 184525689f1SJustin T. Gibbs.It Fl D 185525689f1SJustin T. GibbsGet the standard inquiry data. 186525689f1SJustin T. Gibbs.It Fl S 187525689f1SJustin T. GibbsPrint out the serial number. If this flag is the only one specified, 188525689f1SJustin T. Gibbs.Nm camcontrol 189525689f1SJustin T. Gibbswill not print out "Serial Number" before the value returned by the drive. 190525689f1SJustin T. GibbsThis is to aid in script writing. 191525689f1SJustin T. Gibbs.It Fl R 192525689f1SJustin T. GibbsPrint out transfer rate information. 193525689f1SJustin T. Gibbs.El 194525689f1SJustin T. Gibbs.It start 195525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 196525689f1SJustin T. Gibbsstart bit set. 197525689f1SJustin T. Gibbs.It stop 198525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 199525689f1SJustin T. Gibbsstart bit cleared. 200525689f1SJustin T. Gibbs.It eject 201525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 202525689f1SJustin T. Gibbsstart bit cleared and the eject bit set. 203525689f1SJustin T. Gibbs.It rescan 204525689f1SJustin T. GibbsTell the kernel to scan the given bus (XPT_SCAN_BUS), or bus:target:lun 205525689f1SJustin T. Gibbs(XPT_SCAN_LUN) for new devices or devices that have gone away. The user 206525689f1SJustin T. Gibbsmay only specify a bus to scan, or a lun. Scanning all luns on a target 207525689f1SJustin T. Gibbsisn't supported. 208a2a44836SMatt Jacob.It reset 209a2a44836SMatt JacobTell the kernel to reset the given bus (XPT_RESET_BUS) by issuing a SCSI bus 210a2a44836SMatt Jacobreset for that bus, or to reset the given bus:target:lun 211a2a44836SMatt Jacob(XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after 212a2a44836SMatt Jacobconnecting to that device. Note that this can have a destructive impact 213a2a44836SMatt Jacobon the system. 214525689f1SJustin T. Gibbs.It defects 215525689f1SJustin T. GibbsSend the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and 216525689f1SJustin T. Gibbsprint out any combination of: the total number of defects, the primary 217525689f1SJustin T. Gibbsdefect list (PLIST), and the grown defect list (GLIST). 218525689f1SJustin T. Gibbs.Bl -tag -width 01234567890 219525689f1SJustin T. Gibbs.It Fl f Ar format 220525689f1SJustin T. GibbsThe three format options are: 221525689f1SJustin T. Gibbs.Em block , 222525689f1SJustin T. Gibbsto print out the list as logical blocks, 223525689f1SJustin T. Gibbs.Em bfi , 224525689f1SJustin T. Gibbsto print out the list in bytes from index format, and 225525689f1SJustin T. Gibbs.Em phys , 226525689f1SJustin T. Gibbsto print out the list in physical sector format. The format argument is 227525689f1SJustin T. Gibbsrequired. Most drives support the physical sector format. Some drives 228525689f1SJustin T. Gibbssupport the logical block format. Many drives, if they don't support the 229525689f1SJustin T. Gibbsrequested format, return the data in an alternate format, along with sense 230525689f1SJustin T. Gibbsinformation indicating that the requested data format isn't supported. 231525689f1SJustin T. Gibbs.Nm camcontrol 232525689f1SJustin T. Gibbsattempts to detect this, and print out whatever format the drive returns. 233525689f1SJustin T. GibbsIf the drive uses a non-standard sense code to report that it doesn't 234525689f1SJustin T. Gibbssupport the requested format, 235525689f1SJustin T. Gibbs.Nm camcontrol 236525689f1SJustin T. Gibbswill probably see the error as a failure to complete the request. 237525689f1SJustin T. Gibbs.It Fl G 238525689f1SJustin T. GibbsPrint out the grown defect list. This is a list of bad blocks that have 239525689f1SJustin T. Gibbsbeen remapped since the disk left the factory. 240525689f1SJustin T. Gibbs.It Fl P 241525689f1SJustin T. GibbsPrint out the primary defect list. 242525689f1SJustin T. Gibbs.El 243525689f1SJustin T. Gibbs.Pp 244525689f1SJustin T. GibbsIf neither 245525689f1SJustin T. Gibbs.Fl P 246525689f1SJustin T. Gibbsnor 247525689f1SJustin T. Gibbs.Fl G 248525689f1SJustin T. Gibbsis specified, 249525689f1SJustin T. Gibbs.Nm camcontrol 250525689f1SJustin T. Gibbswill print out the number of defects given in the READ DEFECT DATA header 251525689f1SJustin T. Gibbsreturned from the drive. 252525689f1SJustin T. Gibbs.It modepage 253525689f1SJustin T. GibbsAllows the user to display and optionally edit a SCSI mode page. The mode 254525689f1SJustin T. Gibbspage formats are located in 255525689f1SJustin T. Gibbs.Pa /usr/share/misc/scsi_modes . 256525689f1SJustin T. GibbsThis can be overridden by specifying a different file in the 257525689f1SJustin T. Gibbs.Ev SCSI_MODES 258525689f1SJustin T. Gibbsenvironment variable. The modepage command takes several arguments: 259525689f1SJustin T. Gibbs.Bl -tag -width 012345678901 2609deea857SKenneth D. Merry.It Fl d 261525689f1SJustin T. GibbsDisable block descriptors for mode sense. 262525689f1SJustin T. Gibbs.It Fl e 263525689f1SJustin T. GibbsThis flag allows the user to edit values in the mode page. 264525689f1SJustin T. Gibbs.It Fl m Ar mode_page 265525689f1SJustin T. GibbsThis specifies the number of the mode page the user would like to view 266525689f1SJustin T. Gibbsand/or edit. This argument is mandatory. 2671ac2383cSBill Fumerola.It Fl P Ar pgctl 268525689f1SJustin T. GibbsThis allows the user to specify the page control field. Possible values are: 269525689f1SJustin T. Gibbs.Bl -tag -width xxx -compact 27046a1f3b4SKenneth D. Merry.It 0 271525689f1SJustin T. GibbsCurrent values 27246a1f3b4SKenneth D. Merry.It 1 273525689f1SJustin T. GibbsChangeable values 27446a1f3b4SKenneth D. Merry.It 2 275525689f1SJustin T. GibbsDefault values 27646a1f3b4SKenneth D. Merry.It 3 277525689f1SJustin T. GibbsSaved values 278525689f1SJustin T. Gibbs.El 279525689f1SJustin T. Gibbs.El 280525689f1SJustin T. Gibbs.It cmd 281525689f1SJustin T. GibbsAllows the user to send an arbitrary SCSI CDB to any device. The cmd 282525689f1SJustin T. Gibbsfunction requires the 283525689f1SJustin T. Gibbs.Fl c 284525689f1SJustin T. Gibbsargument to specify the CDB. Other arguments are optional, depending on 285525689f1SJustin T. Gibbsthe command type. The command and data specification syntax is documented 286525689f1SJustin T. Gibbsin 287525689f1SJustin T. Gibbs.Xr cam 3 . 288525689f1SJustin T. GibbsNOTE: If the CDB specified causes data to be transfered to or from the 289525689f1SJustin T. GibbsSCSI device in question, you MUST specify either 290525689f1SJustin T. Gibbs.Fl i 291525689f1SJustin T. Gibbsor 292525689f1SJustin T. Gibbs.Fl o . 293525689f1SJustin T. Gibbs.Bl -tag -width 01234567890123456 294525689f1SJustin T. Gibbs.It Fl c Ar cmd Op args 295525689f1SJustin T. GibbsThis specifies the SCSI CDB. CDBs may be 6, 10, 12 or 16 bytes. 296525689f1SJustin T. Gibbs.It Fl i Ar len Ar fmt 297525689f1SJustin T. GibbsThis specifies the amount of data to read, and how it should be displayed. 298525689f1SJustin T. GibbsIf the format is 299525689f1SJustin T. Gibbs.Sq - , 300525689f1SJustin T. Gibbs.Ar len 301525689f1SJustin T. Gibbsbytes of data will be read from the device and written to standard output. 302525689f1SJustin T. Gibbs.It Fl o Ar len Ar fmt Op args 303525689f1SJustin T. GibbsThis specifies the amount of data to be written to a device, and the data 304525689f1SJustin T. Gibbsthat is to be written. If the format is 305525689f1SJustin T. Gibbs.Sq - , 306525689f1SJustin T. Gibbs.Ar len 307525689f1SJustin T. Gibbsbytes of data will be read from standard input and written to the device. 308525689f1SJustin T. Gibbs.El 309525689f1SJustin T. Gibbs.It debug 310525689f1SJustin T. GibbsTurn on CAM debugging printfs in the kernel. This requires options CAMDEBUG 311525689f1SJustin T. Gibbsin your kernel config file. WARNING: enabling debugging printfs currently 312525689f1SJustin T. Gibbscauses an EXTREME number of kernel printfs. You may have difficulty 313525689f1SJustin T. Gibbsturning off the debugging printfs once they start, since the kernel will be 314525689f1SJustin T. Gibbsbusy printing messages and unable to service other requests quickly. 315525689f1SJustin T. GibbsThe debug function takes a number of arguments: 316525689f1SJustin T. Gibbs.Bl -tag -width 012345678901234567 317525689f1SJustin T. Gibbs.It Fl I 318525689f1SJustin T. GibbsEnable CAM_DEBUG_INFO printfs. 319525689f1SJustin T. Gibbs.It Fl T 320525689f1SJustin T. GibbsEnable CAM_DEBUG_TRACE printfs. 321525689f1SJustin T. Gibbs.It Fl S 322525689f1SJustin T. GibbsEnable CAM_DEBUG_SUBTRACE printfs. 323d05caa00SKenneth D. Merry.It Fl c 324d05caa00SKenneth D. MerryEnable CAM_DEBUG_CDB printfs. This will cause the kernel to print out the 325d05caa00SKenneth D. MerrySCSI CDBs sent to the specified device(s). 326525689f1SJustin T. Gibbs.It all 327525689f1SJustin T. GibbsEnable debugging for all devices. 328525689f1SJustin T. Gibbs.It off 329525689f1SJustin T. GibbsTurn off debugging for all devices 330525689f1SJustin T. Gibbs.It bus Ns Op :target Ns Op :lun 331525689f1SJustin T. GibbsTurn on debugging for the given bus, target or lun. If the lun or target 332525689f1SJustin T. Gibbsand lun are not specified, they are wildcarded. (i.e., just specifying a 333525689f1SJustin T. Gibbsbus turns on debugging printfs for all devices on that bus.) 334525689f1SJustin T. Gibbs.El 3359deea857SKenneth D. Merry.It tags 3369deea857SKenneth D. MerryShow or set the number of "tagged openings" or simultaneous transactions 3379deea857SKenneth D. Merrywe attempt to queue to a particular device. By default, the 3389deea857SKenneth D. Merry.Sq tags 3399deea857SKenneth D. Merrycommand, with no command-specific arguments (i.e. only generic arguments) 3409deea857SKenneth D. Merryprints out the "soft" maximum number of transactions that can be queued to 3419deea857SKenneth D. Merrythe device in question. For more detailed information, use the 3429deea857SKenneth D. Merry.Fl v 3439deea857SKenneth D. Merryargument described below. 3449deea857SKenneth D. Merry.Bl -tag -width 0123456 3459deea857SKenneth D. Merry.It Fl N Ar tags 3469deea857SKenneth D. MerrySet the number of tags for the given device. This must be between the 3479deea857SKenneth D. Merryminimum and maximum number set in the kernel quirk table. The default for 3489deea857SKenneth D. Merrymost devices that support tagged queueing is a minimum of 2 and a maximum 3499deea857SKenneth D. Merryof 255. The minimum and maximum values for a given device may be 3509deea857SKenneth D. Merrydetermined by using the 3519deea857SKenneth D. Merry.Fl v 3529deea857SKenneth D. Merryswitch. The meaning of the 3539deea857SKenneth D. Merry.Fl v 3549deea857SKenneth D. Merryswitch for this 3559deea857SKenneth D. Merry.Nm camcontrol 3569deea857SKenneth D. Merrysubcommand is described below. 3579deea857SKenneth D. Merry.It Fl q 3589deea857SKenneth D. MerryBe quiet, and don't report the number of tags. This is generally used when 3599deea857SKenneth D. Merrysetting the number of tags. 3609deea857SKenneth D. Merry.It Fl v 3619deea857SKenneth D. MerryThe verbose flag has special functionality for the 3629deea857SKenneth D. Merry.Em tags 3639deea857SKenneth D. Merryargument. It causes 3649deea857SKenneth D. Merry.Nm camcontrol 3659deea857SKenneth D. Merryto print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB: 3669deea857SKenneth D. Merry.Bl -tag -width 0123456789012 3679deea857SKenneth D. Merry.It dev_openings 3689deea857SKenneth D. MerryThis is the amount of capacity for transactions queued to a given device. 3699deea857SKenneth D. Merry.It dev_active 3709deea857SKenneth D. MerryThis is the number of transactions currently queued to a device. 3719deea857SKenneth D. Merry.It devq_openings 3729deea857SKenneth D. MerryThis is the kernel queue space for transactions. This count usually mirrors 3739deea857SKenneth D. Merrydev_openings except during error recovery operations when 3749deea857SKenneth D. Merrythe device queue is frozen (device is not allowed to receive 3759deea857SKenneth D. Merrycommands), the number of dev_openings is reduced, or transaction 3769deea857SKenneth D. Merryreplay is occurring. 3779deea857SKenneth D. Merry.It devq_queued 3789deea857SKenneth D. MerryThis is the number of transactions waiting in the kernel queue for capacity 3799deea857SKenneth D. Merryon the device. This number is usually zero unless error recovery is in 3809deea857SKenneth D. Merryprogress. 3819deea857SKenneth D. Merry.It held 3829deea857SKenneth D. MerryThe held count is the number of CCBs held by peripheral drivers that have 3839deea857SKenneth D. Merryeither just been completed or are about to be released to the transport 3849deea857SKenneth D. Merrylayer for service by a device. Held CCBs reserve capacity on a given 3859deea857SKenneth D. Merrydevice. 3869deea857SKenneth D. Merry.It mintags 3879deea857SKenneth D. MerryThis is the current "hard" minimum number of transactions that can be 3889deea857SKenneth D. Merryqueued to a device at once. The 3899deea857SKenneth D. Merry.Ar dev_openings 3909deea857SKenneth D. Merryvalue above cannot go below this number. The default value for 3919deea857SKenneth D. Merry.Ar mintags 3929deea857SKenneth D. Merryis 2, although it may be set higher or lower for various devices. 3939deea857SKenneth D. Merry.It maxtags 3949deea857SKenneth D. MerryThis is the "hard" maximum number of transactions that can be queued to a 3959deea857SKenneth D. Merrydevice at one time. The 3969deea857SKenneth D. Merry.Ar dev_openings 3979deea857SKenneth D. Merryvalue cannot go above this number. The default value for 3989deea857SKenneth D. Merry.Ar maxtags 3999deea857SKenneth D. Merryis 255, although it may be set higher or lower for various devices. 4009deea857SKenneth D. Merry.El 4019deea857SKenneth D. Merry.El 4029deea857SKenneth D. Merry.It negotiate 4039deea857SKenneth D. MerryShow or negotiate various communication parameters. Some controllers may 4049deea857SKenneth D. Merrynot support setting or changing some of these values. For instance, the 4059deea857SKenneth D. MerryAdaptec 174x controllers do not support changing a device's sync rate or 4069deea857SKenneth D. Merryoffset. 4079deea857SKenneth D. Merry.Nm camcontrol 4089deea857SKenneth D. Merrywill not attempt to set the parameter if the controller indicates that it 4099deea857SKenneth D. Merrydoes not support setting the parameter. To find out what the controller 4109deea857SKenneth D. Merrysupports, use the 4119deea857SKenneth D. Merry.Fl v 4129deea857SKenneth D. Merryflag. The meaning of the 4139deea857SKenneth D. Merry.Fl v 4149deea857SKenneth D. Merryflag for the 4159deea857SKenneth D. Merry.Sq negotiate 4169deea857SKenneth D. Merrycommand is described below. Also, some controller drivers don't support 4179deea857SKenneth D. Merrysetting negotiation parameters, even if the underlying controller supports 4189deea857SKenneth D. Merrynegotiation changes. Some controllers, such as the Advansys wide 4199deea857SKenneth D. Merrycontrollers, support enabling and disabling synchronous negotiation for 4209deea857SKenneth D. Merrya device, but do not support setting the synchronous negotiation rate. 4219deea857SKenneth D. Merry.Bl -tag -width 01234567890123456 4229deea857SKenneth D. Merry.It Fl a 4239deea857SKenneth D. MerryAttempt to make the negotiation settings take effect immediately by sending 4249deea857SKenneth D. Merrya Test Unit Ready command to the device. 4259deea857SKenneth D. Merry.It Fl c 4269deea857SKenneth D. MerryShow or set current negotiation settings. This is the default. 4279deea857SKenneth D. Merry.It Fl D Ar enable|disable 4289deea857SKenneth D. MerryEnable or disable disconnection. 4299deea857SKenneth D. Merry.It Fl O Ar offset 4309deea857SKenneth D. MerrySet the command delay offset. 4319deea857SKenneth D. Merry.It Fl q 4329deea857SKenneth D. MerryBe quiet, don't print anything. This is generally useful when you want to 4339deea857SKenneth D. Merryset a parameter, but don't want any status information. 4349deea857SKenneth D. Merry.It Fl R Ar syncrate 4359deea857SKenneth D. MerryChange the synchronization rate for a device. The sync rate is a floating 4369deea857SKenneth D. Merrypoint value specified in MHz. So, for instance, 4379deea857SKenneth D. Merry.Sq 20.000 4389deea857SKenneth D. Merryis a legal value, as is 4399deea857SKenneth D. Merry.Sq 20 . 4409deea857SKenneth D. Merry.It Fl T Ar enable|disable 4419deea857SKenneth D. MerryEnable or disable tagged queueing for a device. 4429deea857SKenneth D. Merry.It Fl U 4439deea857SKenneth D. MerryShow or set user negotiation settings. The default is to show or set 4449deea857SKenneth D. Merrycurrent negotiation settings. 4459deea857SKenneth D. Merry.It Fl v 4469deea857SKenneth D. MerryThe verbose switch has special meaning for the 4479deea857SKenneth D. Merry.Sq negotiate 4489deea857SKenneth D. Merrysubcommand. It causes 4499deea857SKenneth D. Merry.Nm camcontrol 4509deea857SKenneth D. Merryto print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the 4519deea857SKenneth D. Merrycontroller driver. 4529deea857SKenneth D. Merry.It Fl W Ar bus_width 4539deea857SKenneth D. MerrySpecify the bus width to negotiate with a device. The bus width is 4549deea857SKenneth D. Merryspecified in bits. The only useful values to specify are 8, 16, and 32 4559deea857SKenneth D. Merrybits. The controller must support the bus width in question in order for 4569deea857SKenneth D. Merrythe setting to take effect. 4579deea857SKenneth D. Merry.El 4589deea857SKenneth D. Merry.Pp 4599deea857SKenneth D. MerryIn general, sync rate and offset settings will not take effect for a 4609deea857SKenneth D. Merrydevice until a command has been sent to the device. The 4619deea857SKenneth D. Merry.Fl a 4629deea857SKenneth D. Merryswitch above will automatically send a Test Unit Ready to the device so 4639deea857SKenneth D. Merrynegotiation parameters will take effect. 464525689f1SJustin T. Gibbs.El 465525689f1SJustin T. Gibbs.Sh ENVIRONMENT 466525689f1SJustin T. GibbsThe 467525689f1SJustin T. Gibbs.Ev SCSI_MODES 468525689f1SJustin T. Gibbsvariable allows the user to specify an alternate mode page format file. 469525689f1SJustin T. Gibbs.Pp 470525689f1SJustin T. GibbsThe 471525689f1SJustin T. Gibbs.Ev EDITOR 472525689f1SJustin T. Gibbsvariable determines which text editor 473525689f1SJustin T. Gibbs.Nm camcontrol 474525689f1SJustin T. Gibbsstarts when editing mode pages. 475525689f1SJustin T. Gibbs.Sh FILES 476525689f1SJustin T. Gibbs.Bl -tag -width /usr/share/misc/scsi_modes -compact 477525689f1SJustin T. Gibbs.It Pa /usr/share/misc/scsi_modes 478525689f1SJustin T. Gibbsis the SCSI mode format database. 479525689f1SJustin T. Gibbs.It Pa /dev/xpt0 480525689f1SJustin T. Gibbsis the transport layer device. 481525689f1SJustin T. Gibbs.It Pa /dev/pass* 482525689f1SJustin T. Gibbsare the CAM application passthrough devices. 483525689f1SJustin T. Gibbs.El 484525689f1SJustin T. Gibbs.Sh EXAMPLES 485525689f1SJustin T. Gibbs.Dl camcontrol eject -n cd -u 1 -v 486525689f1SJustin T. Gibbs.Pp 487525689f1SJustin T. GibbsEject the CD from cd1, and print SCSI sense information if the command 488525689f1SJustin T. Gibbsfails. 489525689f1SJustin T. Gibbs.Pp 490525689f1SJustin T. Gibbs.Dl camcontrol tur 491525689f1SJustin T. Gibbs.Pp 492525689f1SJustin T. GibbsSend the SCSI test unit ready command to da0. 493525689f1SJustin T. Gibbs.Nm camcontrol 494525689f1SJustin T. Gibbswill report whether the disk is ready, but will not display sense 495525689f1SJustin T. Gibbsinformation if the command fails since the 496525689f1SJustin T. Gibbs.Fl v 497525689f1SJustin T. Gibbsswitch was not specified. 498525689f1SJustin T. Gibbs.Pp 499525689f1SJustin T. Gibbs.Bd -literal -offset foobar 500525689f1SJustin T. Gibbscamcontrol tur -n da -u 1 -E -C 4 -t 50 -v 501525689f1SJustin T. Gibbs.Ed 502525689f1SJustin T. Gibbs.Pp 503525689f1SJustin T. GibbsSend a test unit ready command to da1. Enable kernel error recovery. 504525689f1SJustin T. GibbsSpecify a retry count of 4, and a timeout of 50 seconds. Enable sense 505525689f1SJustin T. Gibbsprinting (with the 506525689f1SJustin T. Gibbs.Fl v 507525689f1SJustin T. Gibbsflag) if the command fails. Since error recovery is turned on, the 508525689f1SJustin T. Gibbsdisk will be spun up if it is not currently spinning. 509525689f1SJustin T. Gibbs.Nm camcontrol 5108ff6dbfcSKenneth D. Merrywill report whether the disk is ready. 511525689f1SJustin T. Gibbs.Bd -literal -offset foobar 512525689f1SJustin T. Gibbscamcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e 513525689f1SJustin T. Gibbs -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1" 514525689f1SJustin T. Gibbs.Ed 515525689f1SJustin T. Gibbs.Pp 516525689f1SJustin T. GibbsIssue a READ BUFFER command (0x3C) to cd1. Display the buffer size of cd1, 517525689f1SJustin T. Gibbsand display the first 10 bytes from the cache on cd1. Display SCSI sense 518525689f1SJustin T. Gibbsinformation if the command fails. 519525689f1SJustin T. Gibbs.Pp 520525689f1SJustin T. Gibbs.Bd -literal -offset foobar 521525689f1SJustin T. Gibbscamcontrol cmd -n cd -u u -v -c "3B 00 00 00 00 00 00 00 0e 00" \e 522525689f1SJustin T. Gibbs -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8 523525689f1SJustin T. Gibbs.Ed 524525689f1SJustin T. Gibbs.Pp 525525689f1SJustin T. GibbsIssue a WRITE BUFFER (0x3B) command to cd1. Write out 10 bytes of data, 526525689f1SJustin T. Gibbsnot including the (reserved) 4 byte header. Print out sense information if 527525689f1SJustin T. Gibbsthe command fails. Be very careful with this command, improper use may 528525689f1SJustin T. Gibbscause data corruption. 529525689f1SJustin T. Gibbs.Pp 53094d09127SKenneth D. Merry.Bd -literal -offset foobar 53194d09127SKenneth D. Merrycamcontrol modepage -n da -u 3 -m 1 -e -P 3 53294d09127SKenneth D. Merry.Ed 533525689f1SJustin T. Gibbs.Pp 534525689f1SJustin T. GibbsEdit mode page 1 (the Read-Write Error Recover page) for da3, and save the 535525689f1SJustin T. Gibbssettings on the drive. Mode page 1 contains a disk drive's auto read and 536525689f1SJustin T. Gibbswrite reallocation settings, among other things. 537525689f1SJustin T. Gibbs.Pp 538525689f1SJustin T. Gibbs.Dl camcontrol rescan 0 539525689f1SJustin T. Gibbs.Pp 540525689f1SJustin T. GibbsRescan SCSI bus 0 for devices that have been added, removed or changed. 541525689f1SJustin T. Gibbs.Pp 542525689f1SJustin T. Gibbs.Dl camcontrol rescan 0:1:0 543525689f1SJustin T. Gibbs.Pp 544525689f1SJustin T. GibbsRescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or 545525689f1SJustin T. Gibbschanged. 5469deea857SKenneth D. Merry.Pp 5479deea857SKenneth D. Merry.Dl camcontrol tags -n da -u 5 -N 24 5489deea857SKenneth D. Merry.Pp 5499deea857SKenneth D. MerrySet the number of concurrent transactions for da5 to 24. 5509deea857SKenneth D. Merry.Pp 5519deea857SKenneth D. Merry.Bd -literal -offset foobar 5529deea857SKenneth D. Merrycamcontrol negotiate -n da -u 4 -T disable 5539deea857SKenneth D. Merry.Ed 5549deea857SKenneth D. Merry.Pp 5559deea857SKenneth D. MerryDisable tagged queueing for da4. 5569deea857SKenneth D. Merry.Pp 5579deea857SKenneth D. Merry.Bd -literal -offset foobar 5589deea857SKenneth D. Merrycamcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a 5599deea857SKenneth D. Merry.Ed 5609deea857SKenneth D. Merry.Pp 5619deea857SKenneth D. MerryNegotiate a sync rate of 20MHz and an offset of 15 with da3. Then send a 5629deea857SKenneth D. MerryTest Unit Ready command to make the settings take effect. 5639deea857SKenneth D. Merry.Pp 5649deea857SKenneth D. Merry.Bd -literal -offset foobar 5659deea857SKenneth D. Merrycamcontrol cmd -n da -u 3 -v -t 7200 -c "4 0 0 0 0 0" 5669deea857SKenneth D. Merry.Ed 5679deea857SKenneth D. Merry.Pp 5689deea857SKenneth D. MerrySend the FORMAT UNIT (0x04) command to da3. This will low-level format the 5699deea857SKenneth D. Merrydisk. Print sense information if the command fails, and set the timeout to 5709deea857SKenneth D. Merrytwo hours (or 7200 seconds). 5719deea857SKenneth D. Merry.Pp 5729deea857SKenneth D. Merry.Em WARNING! WARNING! WARNING! 5739deea857SKenneth D. Merry.Pp 5749deea857SKenneth D. MerryLow level formatting a disk will destroy ALL data on the disk. Use 5759deea857SKenneth D. Merryextreme caution when issuing this command. Many users low-level format 5769deea857SKenneth D. Merrydisks that do not really need to be low-level formatted. There are 5779deea857SKenneth D. Merryrelatively few scenarios that call for low-level formatting a disk. 5789deea857SKenneth D. MerryOne reason for 5799deea857SKenneth D. Merrylow-level formatting a disk is if you want to change the physical sector 5809deea857SKenneth D. Merrysize of the disk. Another reason for low-level formatting a disk is to 5819deea857SKenneth D. Merryrevive the disk if you are getting "medium format corrupted" errors from the 5829deea857SKenneth D. Merrydisk in response to read and write requests. 5839deea857SKenneth D. Merry.Pp 5849deea857SKenneth D. MerrySome disks take longer than others to format. Users should specify a 5859deea857SKenneth D. Merrytimeout long enough to allow the format to complete. Some hard disks 5869deea857SKenneth D. Merrywill complete a format operation in a very short period of time (on the 5879deea857SKenneth D. Merryorder of 5 minutes or less). This is often because the drive doesn't 5889deea857SKenneth D. Merryreally support the FORMAT UNIT command -- it just accepts the command, 5899deea857SKenneth D. Merrywaits a few minutes and then returns it. 590525689f1SJustin T. Gibbs.Sh SEE ALSO 591525689f1SJustin T. Gibbs.Xr cam 3 , 5929deea857SKenneth D. Merry.Xr cam_cdbparse 3 , 593525689f1SJustin T. Gibbs.Xr pass 4 , 594525689f1SJustin T. Gibbs.Xr cam 9 , 595525689f1SJustin T. Gibbs.Xr xpt 9 596525689f1SJustin T. Gibbs.Sh HISTORY 597525689f1SJustin T. GibbsThe 598525689f1SJustin T. Gibbs.Nm camcontrol 599525689f1SJustin T. Gibbscommand first appeared in 600525689f1SJustin T. Gibbs.Fx 3.0 . 601525689f1SJustin T. Gibbs.Pp 602525689f1SJustin T. GibbsThe mode page editing code and arbitrary SCSI command code are based upon 603525689f1SJustin T. Gibbscode in the old 604525689f1SJustin T. Gibbs.Xr scsi 8 605525689f1SJustin T. Gibbsutility and 606525689f1SJustin T. Gibbs.Xr scsi 3 607f9d04512SKenneth D. Merrylibrary, written by Julian Elischer and Peter Dufault. The 608525689f1SJustin T. Gibbs.Xr scsi 8 609de86eff5SKenneth D. Merryprogram first appeared in 386BSD 0.1.2.4, and first appeared in 610525689f1SJustin T. Gibbs.Tn FreeBSD 611525689f1SJustin T. Gibbsin 612525689f1SJustin T. Gibbs.Fx 2.0.5 . 613525689f1SJustin T. Gibbs.Sh AUTHORS 614525689f1SJustin T. Gibbs.An Kenneth Merry Aq ken@FreeBSD.ORG 615525689f1SJustin T. Gibbs.Sh BUGS 616525689f1SJustin T. GibbsMost of the man page cross references don't exist yet. This will be fixed 617525689f1SJustin T. Gibbssoon. 618525689f1SJustin T. Gibbs.Pp 619525689f1SJustin T. GibbsThe code that parses the generic command line arguments doesn't know that 620525689f1SJustin T. Gibbssome of the subcommands take multiple arguments. So if, for instance, you 621525689f1SJustin T. Gibbstried something like this: 622525689f1SJustin T. Gibbs.Bd -literal -offset foobar 623525689f1SJustin T. Gibbscamcontrol -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v 624525689f1SJustin T. Gibbs.Ed 625525689f1SJustin T. Gibbs.Pp 626525689f1SJustin T. GibbsThe sense information from the test unit ready command would not get 627525689f1SJustin T. Gibbsprinted out, since the first 628525689f1SJustin T. Gibbs.Xr getopt 3 629525689f1SJustin T. Gibbscall in 630525689f1SJustin T. Gibbs.Nm camcontrol 631525689f1SJustin T. Gibbsbails out when it sees the second argument to 632525689f1SJustin T. Gibbs.Fl c 633525689f1SJustin T. Gibbs.Po 634525689f1SJustin T. Gibbs0x00 635525689f1SJustin T. Gibbs.Pc , 636525689f1SJustin T. Gibbsabove. Fixing this behavior would take some gross code, or changes to the 637525689f1SJustin T. Gibbs.Xr getopt 3 638525689f1SJustin T. Gibbsinterface. The best way to circumvent this problem is to always make sure 639525689f1SJustin T. Gibbsto specify generic 640525689f1SJustin T. Gibbs.Nm camcontrol 641525689f1SJustin T. Gibbsarguments before any command-specific arguments. 642525689f1SJustin T. Gibbs.Pp 643525689f1SJustin T. GibbsIt might be nice to add a way to allow users to specify devices by 644525689f1SJustin T. Gibbsbus/target/lun or by device string (e.g. "da1"). 645