1525689f1SJustin T. Gibbs.\" 2f553b7b3SKenneth D. Merry.\" Copyright (c) 1998, 1999, 2000, 2002, 2005, 2006, 2007 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.\" 287f3dea24SPeter Wemm.\" $FreeBSD$ 29525689f1SJustin T. Gibbs.\" 30*72166fbaSAlexander Motin.Dd July 1, 2010 31525689f1SJustin T. Gibbs.Dt CAMCONTROL 8 3233fab22eSKenneth D. Merry.Os 33525689f1SJustin T. Gibbs.Sh NAME 34525689f1SJustin T. Gibbs.Nm camcontrol 35525689f1SJustin T. Gibbs.Nd CAM control program 36525689f1SJustin T. Gibbs.Sh SYNOPSIS 377c7fb079SRuslan Ermilov.Nm 3833fab22eSKenneth D. Merry.Aq Ar command 39c60e19a8SKenneth D. Merry.Op device id 40525689f1SJustin T. Gibbs.Op generic args 41525689f1SJustin T. Gibbs.Op command args 427c7fb079SRuslan Ermilov.Nm 4333fab22eSKenneth D. Merry.Ic devlist 44525689f1SJustin T. Gibbs.Op Fl v 457c7fb079SRuslan Ermilov.Nm 4633fab22eSKenneth D. Merry.Ic periphlist 47c60e19a8SKenneth D. Merry.Op device id 48525689f1SJustin T. Gibbs.Op Fl n Ar dev_name 49525689f1SJustin T. Gibbs.Op Fl u Ar unit_number 507c7fb079SRuslan Ermilov.Nm 5133fab22eSKenneth D. Merry.Ic tur 52c60e19a8SKenneth D. Merry.Op device id 53525689f1SJustin T. Gibbs.Op generic args 547c7fb079SRuslan Ermilov.Nm 5533fab22eSKenneth D. Merry.Ic inquiry 56c60e19a8SKenneth D. Merry.Op device id 57525689f1SJustin T. Gibbs.Op generic args 58525689f1SJustin T. Gibbs.Op Fl D 59525689f1SJustin T. Gibbs.Op Fl S 60525689f1SJustin T. Gibbs.Op Fl R 617c7fb079SRuslan Ermilov.Nm 6252c9ce25SScott Long.Ic identify 6352c9ce25SScott Long.Op device id 6452c9ce25SScott Long.Op generic args 65757e402dSAlexander Motin.Op Fl v 6652c9ce25SScott Long.Nm 6742cb6a80SKenneth D. Merry.Ic reportluns 6842cb6a80SKenneth D. Merry.Op device id 6942cb6a80SKenneth D. Merry.Op generic args 7042cb6a80SKenneth D. Merry.Op Fl c 7142cb6a80SKenneth D. Merry.Op Fl l 7242cb6a80SKenneth D. Merry.Op Fl r Ar reporttype 7342cb6a80SKenneth D. Merry.Nm 74f553b7b3SKenneth D. Merry.Ic readcap 75f553b7b3SKenneth D. Merry.Op device id 76f553b7b3SKenneth D. Merry.Op generic args 77f553b7b3SKenneth D. Merry.Op Fl b 78f553b7b3SKenneth D. Merry.Op Fl h 79f553b7b3SKenneth D. Merry.Op Fl H 80f553b7b3SKenneth D. Merry.Op Fl N 81f553b7b3SKenneth D. Merry.Op Fl q 82f553b7b3SKenneth D. Merry.Op Fl s 83f553b7b3SKenneth D. Merry.Nm 8433fab22eSKenneth D. Merry.Ic start 85c60e19a8SKenneth D. Merry.Op device id 86525689f1SJustin T. Gibbs.Op generic args 877c7fb079SRuslan Ermilov.Nm 8833fab22eSKenneth D. Merry.Ic stop 89c60e19a8SKenneth D. Merry.Op device id 90525689f1SJustin T. Gibbs.Op generic args 917c7fb079SRuslan Ermilov.Nm 92f9cecca2SMatthew N. Dodd.Ic load 93f9cecca2SMatthew N. Dodd.Op device id 94f9cecca2SMatthew N. Dodd.Op generic args 95f9cecca2SMatthew N. Dodd.Nm 9633fab22eSKenneth D. Merry.Ic eject 97c60e19a8SKenneth D. Merry.Op device id 98525689f1SJustin T. Gibbs.Op generic args 997c7fb079SRuslan Ermilov.Nm 10033fab22eSKenneth D. Merry.Ic rescan 1015710d224SKenneth D. Merry.Aq all | bus Ns Op :target:lun 1027c7fb079SRuslan Ermilov.Nm 10333fab22eSKenneth D. Merry.Ic reset 1045710d224SKenneth D. Merry.Aq all | bus Ns Op :target:lun 1057c7fb079SRuslan Ermilov.Nm 10633fab22eSKenneth D. Merry.Ic defects 107c60e19a8SKenneth D. Merry.Op device id 108525689f1SJustin T. Gibbs.Op generic args 109525689f1SJustin T. Gibbs.Aq Fl f Ar format 110525689f1SJustin T. Gibbs.Op Fl P 111525689f1SJustin T. Gibbs.Op Fl G 1127c7fb079SRuslan Ermilov.Nm 11333fab22eSKenneth D. Merry.Ic modepage 114c60e19a8SKenneth D. Merry.Op device id 115525689f1SJustin T. Gibbs.Op generic args 1169916c5d2SRuslan Ermilov.Aq Fl m Ar page | Fl l 1171ac2383cSBill Fumerola.Op Fl P Ar pgctl 1187e32b20dSKelly Yancey.Op Fl b | Fl e 119525689f1SJustin T. Gibbs.Op Fl d 1207c7fb079SRuslan Ermilov.Nm 12133fab22eSKenneth D. Merry.Ic cmd 122c60e19a8SKenneth D. Merry.Op device id 123525689f1SJustin T. Gibbs.Op generic args 12480976615SAlexander Motin.Aq Fl a Ar cmd Op args 125525689f1SJustin T. Gibbs.Aq Fl c Ar cmd Op args 126f930c0dbSAlexander Motin.Op Fl d 127f930c0dbSAlexander Motin.Op Fl f 128525689f1SJustin T. Gibbs.Op Fl i Ar len Ar fmt 129525689f1SJustin T. Gibbs.Bk -words 130525689f1SJustin T. Gibbs.Op Fl o Ar len Ar fmt Op args 13180976615SAlexander Motin.Op Fl r Ar fmt 132525689f1SJustin T. Gibbs.Ek 1337c7fb079SRuslan Ermilov.Nm 13433fab22eSKenneth D. Merry.Ic debug 135525689f1SJustin T. Gibbs.Op Fl I 136a7e5261eSNate Lawson.Op Fl P 137525689f1SJustin T. Gibbs.Op Fl T 138525689f1SJustin T. Gibbs.Op Fl S 139a7e5261eSNate Lawson.Op Fl X 14094d09127SKenneth D. Merry.Op Fl c 141525689f1SJustin T. Gibbs.Aq all|off|bus Ns Op :target Ns Op :lun 1427c7fb079SRuslan Ermilov.Nm 14333fab22eSKenneth D. Merry.Ic tags 144c60e19a8SKenneth D. Merry.Op device id 1459deea857SKenneth D. Merry.Op generic args 1469deea857SKenneth D. Merry.Op Fl N Ar tags 1479deea857SKenneth D. Merry.Op Fl q 1489deea857SKenneth D. Merry.Op Fl v 1497c7fb079SRuslan Ermilov.Nm 15033fab22eSKenneth D. Merry.Ic negotiate 151c60e19a8SKenneth D. Merry.Op device id 1529deea857SKenneth D. Merry.Op generic args 1539deea857SKenneth D. Merry.Op Fl c 1549deea857SKenneth D. Merry.Op Fl D Ar enable|disable 155b447e682SAlexander Motin.Op Fl M Ar mode 1569deea857SKenneth D. Merry.Op Fl O Ar offset 1579deea857SKenneth D. Merry.Op Fl q 1589deea857SKenneth D. Merry.Op Fl R Ar syncrate 1599deea857SKenneth D. Merry.Op Fl T Ar enable|disable 1609deea857SKenneth D. Merry.Op Fl U 1619deea857SKenneth D. Merry.Op Fl W Ar bus_width 1629deea857SKenneth D. Merry.Op Fl v 1637c7fb079SRuslan Ermilov.Nm 16433fab22eSKenneth D. Merry.Ic format 16596a93c63SKenneth D. Merry.Op device id 16696a93c63SKenneth D. Merry.Op generic args 16796a93c63SKenneth D. Merry.Op Fl q 168e9e4d3e4SKenneth D. Merry.Op Fl r 16996a93c63SKenneth D. Merry.Op Fl w 17096a93c63SKenneth D. Merry.Op Fl y 1717c7fb079SRuslan Ermilov.Nm 17250c9a276SAlexander Motin.Ic idle 17350c9a276SAlexander Motin.Op device id 17450c9a276SAlexander Motin.Op generic args 17550c9a276SAlexander Motin.Op Fl t Ar time 17650c9a276SAlexander Motin.Nm 17750c9a276SAlexander Motin.Ic standby 17850c9a276SAlexander Motin.Op device id 17950c9a276SAlexander Motin.Op generic args 18050c9a276SAlexander Motin.Op Fl t Ar time 18150c9a276SAlexander Motin.Nm 18250c9a276SAlexander Motin.Ic sleep 18350c9a276SAlexander Motin.Op device id 18450c9a276SAlexander Motin.Op generic args 18550c9a276SAlexander Motin.Nm 18633fab22eSKenneth D. Merry.Ic help 187525689f1SJustin T. Gibbs.Sh DESCRIPTION 188e1205e80SPhilippe CharnierThe 1897c7fb079SRuslan Ermilov.Nm 190e1205e80SPhilippe Charnierutility is designed to provide a way for users to access and control the 19133fab22eSKenneth D. Merry.Fx 192525689f1SJustin T. GibbsCAM subsystem. 193525689f1SJustin T. Gibbs.Pp 194e1205e80SPhilippe CharnierThe 1957c7fb079SRuslan Ermilov.Nm 196e1205e80SPhilippe Charnierutility 1979806e231SRuslan Ermilovcan cause a loss of data and/or system crashes if used improperly. 1989806e231SRuslan ErmilovEven 1999deea857SKenneth D. Merryexpert users are encouraged to exercise caution when using this command. 200525689f1SJustin T. GibbsNovice users should stay away from this utility. 201525689f1SJustin T. Gibbs.Pp 202e1205e80SPhilippe CharnierThe 2037c7fb079SRuslan Ermilov.Nm 204e1205e80SPhilippe Charnierutility has a number of primary functions, many of which support an optional 2059806e231SRuslan Ermilovdevice identifier. 2069806e231SRuslan ErmilovA device identifier can take one of three forms: 2071252c1bbSRuslan Ermilov.Bl -tag -width 14n 208c60e19a8SKenneth D. Merry.It deviceUNIT 209c60e19a8SKenneth D. MerrySpecify a device name and unit number combination, like "da5" or "cd3". 2109806e231SRuslan ErmilovNote that character device node names (e.g.\& /dev/da0) are 211c60e19a8SKenneth D. Merry.Em not 212c60e19a8SKenneth D. Merryallowed here. 213c60e19a8SKenneth D. Merry.It bus:target 2149806e231SRuslan ErmilovSpecify a bus number and target id. 2159806e231SRuslan ErmilovThe bus number can be determined from 216c60e19a8SKenneth D. Merrythe output of 217c60e19a8SKenneth D. Merry.Dq camcontrol devlist . 218c60e19a8SKenneth D. MerryThe lun defaults to 0. 219c60e19a8SKenneth D. Merry.It bus:target:lun 2209806e231SRuslan ErmilovSpecify the bus, target and lun for a device. 2219806e231SRuslan Ermilov(e.g.\& 1:2:0) 222c60e19a8SKenneth D. Merry.El 223c60e19a8SKenneth D. Merry.Pp 224c60e19a8SKenneth D. MerryThe device identifier, if it is specified, 225c60e19a8SKenneth D. Merry.Em must 226c60e19a8SKenneth D. Merrycome immediately after the function name, and before any generic or 2279806e231SRuslan Ermilovfunction-specific arguments. 2289806e231SRuslan ErmilovNote that the 229c60e19a8SKenneth D. Merry.Fl n 230c60e19a8SKenneth D. Merryand 231c60e19a8SKenneth D. Merry.Fl u 232c60e19a8SKenneth D. Merryarguments described below will override any device name or unit number 2339806e231SRuslan Ermilovspecified beforehand. 2349806e231SRuslan ErmilovThe 235c60e19a8SKenneth D. Merry.Fl n 236c60e19a8SKenneth D. Merryand 237c60e19a8SKenneth D. Merry.Fl u 238c60e19a8SKenneth D. Merryarguments will 239c60e19a8SKenneth D. Merry.Em not 24096a93c63SKenneth D. Merryoverride a specified bus:target or bus:target:lun, however. 241c60e19a8SKenneth D. Merry.Pp 242c60e19a8SKenneth D. MerryMost of the 2437c7fb079SRuslan Ermilov.Nm 244c60e19a8SKenneth D. Merryprimary functions support these generic arguments: 2451252c1bbSRuslan Ermilov.Bl -tag -width 14n 246525689f1SJustin T. Gibbs.It Fl C Ar count 2479806e231SRuslan ErmilovSCSI command retry count. 2489806e231SRuslan ErmilovIn order for this to work, error recovery 2491252c1bbSRuslan Ermilov.Pq Fl E 250525689f1SJustin T. Gibbsmust be turned on. 251525689f1SJustin T. Gibbs.It Fl E 252525689f1SJustin T. GibbsInstruct the kernel to perform generic SCSI error recovery for the given 2539806e231SRuslan Ermilovcommand. 2549806e231SRuslan ErmilovThis is needed in order for the retry count 2551252c1bbSRuslan Ermilov.Pq Fl C 2569806e231SRuslan Ermilovto be honored. 2579806e231SRuslan ErmilovOther than retrying commands, the generic error recovery in 258525689f1SJustin T. Gibbsthe code will generally attempt to spin up drives that are not spinning. 259525689f1SJustin T. GibbsIt may take some other actions, depending upon the sense code returned from 260525689f1SJustin T. Gibbsthe command. 261525689f1SJustin T. Gibbs.It Fl n Ar dev_name 2629806e231SRuslan ErmilovSpecify the device type to operate on, e.g.\& "da", "cd". 263525689f1SJustin T. Gibbs.It Fl t Ar timeout 2649806e231SRuslan ErmilovSCSI command timeout in seconds. 2659806e231SRuslan ErmilovThis overrides the default timeout for 266525689f1SJustin T. Gibbsany given command. 267525689f1SJustin T. Gibbs.It Fl u Ar unit_number 2689806e231SRuslan ErmilovSpecify the device unit number, e.g.\& "1", "5". 269525689f1SJustin T. Gibbs.It Fl v 270525689f1SJustin T. GibbsBe verbose, print out sense information for failed SCSI commands. 271525689f1SJustin T. Gibbs.El 272525689f1SJustin T. Gibbs.Pp 273d13d1cd2SKenneth D. MerryPrimary command functions: 274525689f1SJustin T. Gibbs.Bl -tag -width periphlist 27533fab22eSKenneth D. Merry.It Ic devlist 276525689f1SJustin T. GibbsList all physical devices (logical units) attached to the CAM subsystem. 277525689f1SJustin T. GibbsThis also includes a list of peripheral drivers attached to each device. 278525689f1SJustin T. GibbsWith the 279525689f1SJustin T. Gibbs.Fl v 280525689f1SJustin T. Gibbsargument, SCSI bus number, adapter name and unit numbers are printed as 281525689f1SJustin T. Gibbswell. 28233fab22eSKenneth D. Merry.It Ic periphlist 283525689f1SJustin T. GibbsList all peripheral drivers attached to a given physical device (logical 284525689f1SJustin T. Gibbsunit). 28533fab22eSKenneth D. Merry.It Ic tur 286525689f1SJustin T. GibbsSend the SCSI test unit ready (0x00) command to the given device. 287e1205e80SPhilippe CharnierThe 2887c7fb079SRuslan Ermilov.Nm 289e1205e80SPhilippe Charnierutility will report whether the device is ready or not. 29033fab22eSKenneth D. Merry.It Ic inquiry 2919806e231SRuslan ErmilovSend a SCSI inquiry command (0x12) to a device. 2929806e231SRuslan ErmilovBy default, 2937c7fb079SRuslan Ermilov.Nm 294525689f1SJustin T. Gibbswill print out the standard inquiry data, device serial number, and 2959806e231SRuslan Ermilovtransfer rate information. 2969806e231SRuslan ErmilovThe user can specify that only certain types of 297525689f1SJustin T. Gibbsinquiry data be printed: 2981252c1bbSRuslan Ermilov.Bl -tag -width 4n 299525689f1SJustin T. Gibbs.It Fl D 300525689f1SJustin T. GibbsGet the standard inquiry data. 301525689f1SJustin T. Gibbs.It Fl S 3029806e231SRuslan ErmilovPrint out the serial number. 3039806e231SRuslan ErmilovIf this flag is the only one specified, 3047c7fb079SRuslan Ermilov.Nm 305525689f1SJustin T. Gibbswill not print out "Serial Number" before the value returned by the drive. 306525689f1SJustin T. GibbsThis is to aid in script writing. 307525689f1SJustin T. Gibbs.It Fl R 308525689f1SJustin T. GibbsPrint out transfer rate information. 309525689f1SJustin T. Gibbs.El 31052c9ce25SScott Long.It Ic identify 31152c9ce25SScott LongSend a ATA identify command (0xec) to a device. 31242cb6a80SKenneth D. Merry.It Ic reportluns 31342cb6a80SKenneth D. MerrySend the SCSI REPORT LUNS (0xA0) command to the given device. 31442cb6a80SKenneth D. MerryBy default, 31542cb6a80SKenneth D. Merry.Nm 31642cb6a80SKenneth D. Merrywill print out the list of logical units (LUNs) supported by the target device. 31742cb6a80SKenneth D. MerryThere are a couple of options to modify the output: 3188266d476SRuslan Ermilov.Bl -tag -width 14n 31942cb6a80SKenneth D. Merry.It Fl c 32042cb6a80SKenneth D. MerryJust print out a count of LUNs, not the actual LUN numbers. 32142cb6a80SKenneth D. Merry.It Fl l 32242cb6a80SKenneth D. MerryJust print out the LUNs, and don't print out the count. 32342cb6a80SKenneth D. Merry.It Fl r Ar reporttype 32442cb6a80SKenneth D. MerrySpecify the type of report to request from the target: 32542cb6a80SKenneth D. Merry.Bl -tag -width 012345678 32642cb6a80SKenneth D. Merry.It default 32742cb6a80SKenneth D. MerryReturn the default report. 32842cb6a80SKenneth D. MerryThis is the 32942cb6a80SKenneth D. Merry.Nm 33042cb6a80SKenneth D. Merrydefault. 33142cb6a80SKenneth D. MerryMost targets will support this report if they support the REPORT LUNS 33242cb6a80SKenneth D. Merrycommand. 33342cb6a80SKenneth D. Merry.It wellknown 33442cb6a80SKenneth D. MerryReturn only well known LUNs. 33542cb6a80SKenneth D. Merry.It all 33642cb6a80SKenneth D. MerryReturn all available LUNs. 33742cb6a80SKenneth D. Merry.El 33842cb6a80SKenneth D. Merry.El 33942cb6a80SKenneth D. Merry.Pp 34042cb6a80SKenneth D. Merry.Nm 34142cb6a80SKenneth D. Merrywill try to print out LUN numbers in a reasonable format. 34242cb6a80SKenneth D. MerryIt can understand the peripheral, flat, LUN and extended LUN formats. 343f553b7b3SKenneth D. Merry.It Ic readcap 344f553b7b3SKenneth D. MerrySend the SCSI READ CAPACITY command to the given device and display 345f553b7b3SKenneth D. Merrythe results. 346f553b7b3SKenneth D. MerryIf the device is larger than 2TB, the SCSI READ CAPACITY (16) service 347f553b7b3SKenneth D. Merryaction will be sent to obtain the full size of the device. 348f553b7b3SKenneth D. MerryBy default, 349f553b7b3SKenneth D. Merry.Nm 350f553b7b3SKenneth D. Merrywill print out the last logical block of the device, and the blocksize of 351f553b7b3SKenneth D. Merrythe device in bytes. 352f553b7b3SKenneth D. MerryTo modify the output format, use the following options: 353f553b7b3SKenneth D. Merry.Bl -tag -width 5n 354f553b7b3SKenneth D. Merry.It Fl b 355f553b7b3SKenneth D. MerryJust print out the blocksize, not the last block or device size. 356f553b7b3SKenneth D. MerryThis cannot be used with 357f553b7b3SKenneth D. Merry.Fl N 358f553b7b3SKenneth D. Merryor 359f553b7b3SKenneth D. Merry.Fl s . 360f553b7b3SKenneth D. Merry.It Fl h 361f553b7b3SKenneth D. MerryPrint out the device size in human readable (base 2, 1K == 1024) format. 362f553b7b3SKenneth D. MerryThis implies 363f553b7b3SKenneth D. Merry.Fl N 364f553b7b3SKenneth D. Merryand cannot be used with 365f553b7b3SKenneth D. Merry.Fl q 366f553b7b3SKenneth D. Merryor 367f553b7b3SKenneth D. Merry.Fl b . 368f553b7b3SKenneth D. Merry.It Fl H 369f553b7b3SKenneth D. MerryPrint out the device size in human readable (base 10, 1K == 1000) format. 370f553b7b3SKenneth D. Merry.It Fl N 371f553b7b3SKenneth D. MerryPrint out the number of blocks in the device instead of the last logical 372f553b7b3SKenneth D. Merryblock. 373f553b7b3SKenneth D. Merry.It Fl q 374f553b7b3SKenneth D. MerryQuiet, print out the numbers only (separated by a comma if 375f553b7b3SKenneth D. Merry.Fl b 376f553b7b3SKenneth D. Merryor 377f553b7b3SKenneth D. Merry.Fl s 378f553b7b3SKenneth D. Merryare not specified). 379f553b7b3SKenneth D. Merry.It Fl s 380f553b7b3SKenneth D. MerryPrint out the last logical block or the size of the device only, and omit 381f553b7b3SKenneth D. Merrythe blocksize. 382f553b7b3SKenneth D. Merry.El 38333fab22eSKenneth D. Merry.It Ic start 384525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 385525689f1SJustin T. Gibbsstart bit set. 38633fab22eSKenneth D. Merry.It Ic stop 387525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 388525689f1SJustin T. Gibbsstart bit cleared. 389f9cecca2SMatthew N. Dodd.It Ic load 390f9cecca2SMatthew N. DoddSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 391f9cecca2SMatthew N. Doddstart bit set and the load/eject bit set. 39233fab22eSKenneth D. Merry.It Ic eject 393525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the 394f9cecca2SMatthew N. Doddstart bit cleared and the load/eject bit set. 39533fab22eSKenneth D. Merry.It Ic rescan 3965710d224SKenneth D. MerryTell the kernel to scan all busses in the system (with the 3975710d224SKenneth D. Merry.Ar all 3985710d224SKenneth D. Merryargument), the given bus (XPT_SCAN_BUS), or bus:target:lun 3999806e231SRuslan Ermilov(XPT_SCAN_LUN) for new devices or devices that have gone away. 4009806e231SRuslan ErmilovThe user 4019806e231SRuslan Ermilovmay specify a scan of all busses, a single bus, or a lun. 4029806e231SRuslan ErmilovScanning all luns 4030227791bSRuslan Ermilovon a target is not supported. 40433fab22eSKenneth D. Merry.It Ic reset 4055710d224SKenneth D. MerryTell the kernel to reset all busses in the system (with the 4065710d224SKenneth D. Merry.Ar all 4075710d224SKenneth D. Merryargument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus 408a2a44836SMatt Jacobreset for that bus, or to reset the given bus:target:lun 409a2a44836SMatt Jacob(XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after 410ef8f7ac9SSheldon Hearnconnecting to that device. 411ef8f7ac9SSheldon HearnNote that this can have a destructive impact 412a2a44836SMatt Jacobon the system. 41333fab22eSKenneth D. Merry.It Ic defects 414525689f1SJustin T. GibbsSend the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and 415525689f1SJustin T. Gibbsprint out any combination of: the total number of defects, the primary 416525689f1SJustin T. Gibbsdefect list (PLIST), and the grown defect list (GLIST). 4171252c1bbSRuslan Ermilov.Bl -tag -width 11n 418525689f1SJustin T. Gibbs.It Fl f Ar format 419525689f1SJustin T. GibbsThe three format options are: 420525689f1SJustin T. Gibbs.Em block , 421525689f1SJustin T. Gibbsto print out the list as logical blocks, 422525689f1SJustin T. Gibbs.Em bfi , 423525689f1SJustin T. Gibbsto print out the list in bytes from index format, and 424525689f1SJustin T. Gibbs.Em phys , 4259806e231SRuslan Ermilovto print out the list in physical sector format. 4269806e231SRuslan ErmilovThe format argument is 4279806e231SRuslan Ermilovrequired. 4289806e231SRuslan ErmilovMost drives support the physical sector format. 4299806e231SRuslan ErmilovSome drives 4309806e231SRuslan Ermilovsupport the logical block format. 4310227791bSRuslan ErmilovMany drives, if they do not support the 432525689f1SJustin T. Gibbsrequested format, return the data in an alternate format, along with sense 4330227791bSRuslan Ermilovinformation indicating that the requested data format is not supported. 434e1205e80SPhilippe CharnierThe 4357c7fb079SRuslan Ermilov.Nm 436e1205e80SPhilippe Charnierutility 437525689f1SJustin T. Gibbsattempts to detect this, and print out whatever format the drive returns. 4380227791bSRuslan ErmilovIf the drive uses a non-standard sense code to report that it does not 439525689f1SJustin T. Gibbssupport the requested format, 4407c7fb079SRuslan Ermilov.Nm 441525689f1SJustin T. Gibbswill probably see the error as a failure to complete the request. 442525689f1SJustin T. Gibbs.It Fl G 4439806e231SRuslan ErmilovPrint out the grown defect list. 4449806e231SRuslan ErmilovThis is a list of bad blocks that have 445525689f1SJustin T. Gibbsbeen remapped since the disk left the factory. 446525689f1SJustin T. Gibbs.It Fl P 447525689f1SJustin T. GibbsPrint out the primary defect list. 448525689f1SJustin T. Gibbs.El 449525689f1SJustin T. Gibbs.Pp 450525689f1SJustin T. GibbsIf neither 451525689f1SJustin T. Gibbs.Fl P 452525689f1SJustin T. Gibbsnor 453525689f1SJustin T. Gibbs.Fl G 454525689f1SJustin T. Gibbsis specified, 4557c7fb079SRuslan Ermilov.Nm 456525689f1SJustin T. Gibbswill print out the number of defects given in the READ DEFECT DATA header 457525689f1SJustin T. Gibbsreturned from the drive. 45833fab22eSKenneth D. Merry.It Ic modepage 4599806e231SRuslan ErmilovAllows the user to display and optionally edit a SCSI mode page. 4609806e231SRuslan ErmilovThe mode 461525689f1SJustin T. Gibbspage formats are located in 462525689f1SJustin T. Gibbs.Pa /usr/share/misc/scsi_modes . 463525689f1SJustin T. GibbsThis can be overridden by specifying a different file in the 464525689f1SJustin T. Gibbs.Ev SCSI_MODES 46533fab22eSKenneth D. Merryenvironment variable. 46633fab22eSKenneth D. MerryThe 46733fab22eSKenneth D. Merry.Ic modepage 46833fab22eSKenneth D. Merrycommand takes several arguments: 4691252c1bbSRuslan Ermilov.Bl -tag -width 12n 4709deea857SKenneth D. Merry.It Fl d 471525689f1SJustin T. GibbsDisable block descriptors for mode sense. 4727e32b20dSKelly Yancey.It Fl b 4737e32b20dSKelly YanceyDisplays mode page data in binary format. 474525689f1SJustin T. Gibbs.It Fl e 4759806e231SRuslan ErmilovThis flag allows the user to edit values in the mode page. 4769806e231SRuslan ErmilovThe user may 4777e32b20dSKelly Yanceyeither edit mode page values with the text editor pointed to by his 4787e32b20dSKelly Yancey.Ev EDITOR 4797e32b20dSKelly Yanceyenvironment variable, or supply mode page values via standard input, using 4807e32b20dSKelly Yanceythe same format that 4817c7fb079SRuslan Ermilov.Nm 4829806e231SRuslan Ermilovuses to display mode page values. 4839806e231SRuslan ErmilovThe editor will be invoked if 4847c7fb079SRuslan Ermilov.Nm 4857e32b20dSKelly Yanceydetects that standard input is terminal. 4867e32b20dSKelly Yancey.It Fl l 4877e32b20dSKelly YanceyLists all available mode pages. 488525689f1SJustin T. Gibbs.It Fl m Ar mode_page 489525689f1SJustin T. GibbsThis specifies the number of the mode page the user would like to view 4909806e231SRuslan Ermilovand/or edit. 4919806e231SRuslan ErmilovThis argument is mandatory unless 4929402dd99SKelly Yancey.Fl l 4939402dd99SKelly Yanceyis specified. 4941ac2383cSBill Fumerola.It Fl P Ar pgctl 4959806e231SRuslan ErmilovThis allows the user to specify the page control field. 4969806e231SRuslan ErmilovPossible values are: 497525689f1SJustin T. Gibbs.Bl -tag -width xxx -compact 49846a1f3b4SKenneth D. Merry.It 0 499525689f1SJustin T. GibbsCurrent values 50046a1f3b4SKenneth D. Merry.It 1 501525689f1SJustin T. GibbsChangeable values 50246a1f3b4SKenneth D. Merry.It 2 503525689f1SJustin T. GibbsDefault values 50446a1f3b4SKenneth D. Merry.It 3 505525689f1SJustin T. GibbsSaved values 506525689f1SJustin T. Gibbs.El 507525689f1SJustin T. Gibbs.El 50833fab22eSKenneth D. Merry.It Ic cmd 50980976615SAlexander MotinAllows the user to send an arbitrary ATA or SCSI CDB to any device. 51033fab22eSKenneth D. MerryThe 51133fab22eSKenneth D. Merry.Ic cmd 512525689f1SJustin T. Gibbsfunction requires the 513525689f1SJustin T. Gibbs.Fl c 51480976615SAlexander Motinargument to specify SCSI CDB or the 51580976615SAlexander Motin.Fl a 51680976615SAlexander Motinargument to specify ATA Command Block registers values. 5179806e231SRuslan ErmilovOther arguments are optional, depending on 5189806e231SRuslan Ermilovthe command type. 5199806e231SRuslan ErmilovThe command and data specification syntax is documented 520525689f1SJustin T. Gibbsin 52196a93c63SKenneth D. Merry.Xr cam_cdbparse 3 . 522525689f1SJustin T. GibbsNOTE: If the CDB specified causes data to be transfered to or from the 523525689f1SJustin T. GibbsSCSI device in question, you MUST specify either 524525689f1SJustin T. Gibbs.Fl i 525525689f1SJustin T. Gibbsor 526525689f1SJustin T. Gibbs.Fl o . 5271252c1bbSRuslan Ermilov.Bl -tag -width 17n 52880976615SAlexander Motin.It Fl a Ar cmd Op args 52980976615SAlexander MotinThis specifies the content of 12 ATA Command Block registers (command, 53080976615SAlexander Motinfeatures, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp. 53180976615SAlexander Motinlba_high_exp, features_exp, sector_count, sector_count_exp). 532525689f1SJustin T. Gibbs.It Fl c Ar cmd Op args 5339806e231SRuslan ErmilovThis specifies the SCSI CDB. 53480976615SAlexander MotinSCSI CDBs may be 6, 10, 12 or 16 bytes. 535f930c0dbSAlexander Motin.It Fl d 536f930c0dbSAlexander MotinSpecifies DMA protocol to be used for ATA command. 537f930c0dbSAlexander Motin.It Fl f 538f930c0dbSAlexander MotinSpecifies FPDMA (NCQ) protocol to be used for ATA command. 539525689f1SJustin T. Gibbs.It Fl i Ar len Ar fmt 540525689f1SJustin T. GibbsThis specifies the amount of data to read, and how it should be displayed. 541525689f1SJustin T. GibbsIf the format is 542525689f1SJustin T. Gibbs.Sq - , 543525689f1SJustin T. Gibbs.Ar len 544525689f1SJustin T. Gibbsbytes of data will be read from the device and written to standard output. 545525689f1SJustin T. Gibbs.It Fl o Ar len Ar fmt Op args 546525689f1SJustin T. GibbsThis specifies the amount of data to be written to a device, and the data 5479806e231SRuslan Ermilovthat is to be written. 5489806e231SRuslan ErmilovIf the format is 549525689f1SJustin T. Gibbs.Sq - , 550525689f1SJustin T. Gibbs.Ar len 551525689f1SJustin T. Gibbsbytes of data will be read from standard input and written to the device. 55280976615SAlexander Motin.It Fl r Ar fmt 55380976615SAlexander MotinThis specifies that 11 result ATA Command Block registers should be displayed 55480976615SAlexander Motin(status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp, 55580976615SAlexander Motinlba_high_exp, sector_count, sector_count_exp), and how. 55680976615SAlexander MotinIf the format is 55780976615SAlexander Motin.Sq - , 55880976615SAlexander Motin11 result registers will be written to standard output in hex. 559525689f1SJustin T. Gibbs.El 56033fab22eSKenneth D. Merry.It Ic debug 5619806e231SRuslan ErmilovTurn on CAM debugging printfs in the kernel. 5629806e231SRuslan ErmilovThis requires options CAMDEBUG 5639806e231SRuslan Ermilovin your kernel config file. 5649806e231SRuslan ErmilovWARNING: enabling debugging printfs currently 5659806e231SRuslan Ermilovcauses an EXTREME number of kernel printfs. 5669806e231SRuslan ErmilovYou may have difficulty 567525689f1SJustin T. Gibbsturning off the debugging printfs once they start, since the kernel will be 568525689f1SJustin T. Gibbsbusy printing messages and unable to service other requests quickly. 56933fab22eSKenneth D. MerryThe 57033fab22eSKenneth D. Merry.Ic debug 57133fab22eSKenneth D. Merryfunction takes a number of arguments: 5721252c1bbSRuslan Ermilov.Bl -tag -width 18n 573525689f1SJustin T. Gibbs.It Fl I 574525689f1SJustin T. GibbsEnable CAM_DEBUG_INFO printfs. 575a7e5261eSNate Lawson.It Fl P 576a7e5261eSNate LawsonEnable CAM_DEBUG_PERIPH printfs. 577525689f1SJustin T. Gibbs.It Fl T 578525689f1SJustin T. GibbsEnable CAM_DEBUG_TRACE printfs. 579525689f1SJustin T. Gibbs.It Fl S 580525689f1SJustin T. GibbsEnable CAM_DEBUG_SUBTRACE printfs. 581a7e5261eSNate Lawson.It Fl X 582a7e5261eSNate LawsonEnable CAM_DEBUG_XPT printfs. 583d05caa00SKenneth D. Merry.It Fl c 5849806e231SRuslan ErmilovEnable CAM_DEBUG_CDB printfs. 5859806e231SRuslan ErmilovThis will cause the kernel to print out the 586d05caa00SKenneth D. MerrySCSI CDBs sent to the specified device(s). 587525689f1SJustin T. Gibbs.It all 588525689f1SJustin T. GibbsEnable debugging for all devices. 589525689f1SJustin T. Gibbs.It off 590525689f1SJustin T. GibbsTurn off debugging for all devices 591525689f1SJustin T. Gibbs.It bus Ns Op :target Ns Op :lun 5929806e231SRuslan ErmilovTurn on debugging for the given bus, target or lun. 5939806e231SRuslan ErmilovIf the lun or target 5949806e231SRuslan Ermilovand lun are not specified, they are wildcarded. 5959806e231SRuslan Ermilov(i.e., just specifying a 596525689f1SJustin T. Gibbsbus turns on debugging printfs for all devices on that bus.) 597525689f1SJustin T. Gibbs.El 59833fab22eSKenneth D. Merry.It Ic tags 5999deea857SKenneth D. MerryShow or set the number of "tagged openings" or simultaneous transactions 6009806e231SRuslan Ermilovwe attempt to queue to a particular device. 6019806e231SRuslan ErmilovBy default, the 60233fab22eSKenneth D. Merry.Ic tags 6039806e231SRuslan Ermilovcommand, with no command-specific arguments (i.e., only generic arguments) 6049deea857SKenneth D. Merryprints out the "soft" maximum number of transactions that can be queued to 6059806e231SRuslan Ermilovthe device in question. 6069806e231SRuslan ErmilovFor more detailed information, use the 6079deea857SKenneth D. Merry.Fl v 6089deea857SKenneth D. Merryargument described below. 6091252c1bbSRuslan Ermilov.Bl -tag -width 7n 6109deea857SKenneth D. Merry.It Fl N Ar tags 6119806e231SRuslan ErmilovSet the number of tags for the given device. 6129806e231SRuslan ErmilovThis must be between the 6139806e231SRuslan Ermilovminimum and maximum number set in the kernel quirk table. 6149806e231SRuslan ErmilovThe default for 6159deea857SKenneth D. Merrymost devices that support tagged queueing is a minimum of 2 and a maximum 6169806e231SRuslan Ermilovof 255. 6179806e231SRuslan ErmilovThe minimum and maximum values for a given device may be 6189deea857SKenneth D. Merrydetermined by using the 6199deea857SKenneth D. Merry.Fl v 6209806e231SRuslan Ermilovswitch. 6219806e231SRuslan ErmilovThe meaning of the 6229deea857SKenneth D. Merry.Fl v 6239deea857SKenneth D. Merryswitch for this 6247c7fb079SRuslan Ermilov.Nm 6259deea857SKenneth D. Merrysubcommand is described below. 6269deea857SKenneth D. Merry.It Fl q 6270227791bSRuslan ErmilovBe quiet, and do not report the number of tags. 6289806e231SRuslan ErmilovThis is generally used when 6299deea857SKenneth D. Merrysetting the number of tags. 6309deea857SKenneth D. Merry.It Fl v 6319deea857SKenneth D. MerryThe verbose flag has special functionality for the 6329deea857SKenneth D. Merry.Em tags 6339806e231SRuslan Ermilovargument. 6349806e231SRuslan ErmilovIt causes 6357c7fb079SRuslan Ermilov.Nm 6369deea857SKenneth D. Merryto print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB: 6371252c1bbSRuslan Ermilov.Bl -tag -width 13n 6389deea857SKenneth D. Merry.It dev_openings 6399deea857SKenneth D. MerryThis is the amount of capacity for transactions queued to a given device. 6409deea857SKenneth D. Merry.It dev_active 6419deea857SKenneth D. MerryThis is the number of transactions currently queued to a device. 6429deea857SKenneth D. Merry.It devq_openings 6439806e231SRuslan ErmilovThis is the kernel queue space for transactions. 6449806e231SRuslan ErmilovThis count usually mirrors 6459deea857SKenneth D. Merrydev_openings except during error recovery operations when 6469deea857SKenneth D. Merrythe device queue is frozen (device is not allowed to receive 6479deea857SKenneth D. Merrycommands), the number of dev_openings is reduced, or transaction 6489deea857SKenneth D. Merryreplay is occurring. 6499deea857SKenneth D. Merry.It devq_queued 6509deea857SKenneth D. MerryThis is the number of transactions waiting in the kernel queue for capacity 6519806e231SRuslan Ermilovon the device. 6529806e231SRuslan ErmilovThis number is usually zero unless error recovery is in 6539deea857SKenneth D. Merryprogress. 6549deea857SKenneth D. Merry.It held 6559deea857SKenneth D. MerryThe held count is the number of CCBs held by peripheral drivers that have 6569deea857SKenneth D. Merryeither just been completed or are about to be released to the transport 6579806e231SRuslan Ermilovlayer for service by a device. 6589806e231SRuslan ErmilovHeld CCBs reserve capacity on a given 6599deea857SKenneth D. Merrydevice. 6609deea857SKenneth D. Merry.It mintags 6619deea857SKenneth D. MerryThis is the current "hard" minimum number of transactions that can be 6629806e231SRuslan Ermilovqueued to a device at once. 6639806e231SRuslan ErmilovThe 6649deea857SKenneth D. Merry.Ar dev_openings 6659806e231SRuslan Ermilovvalue above cannot go below this number. 6669806e231SRuslan ErmilovThe default value for 6679deea857SKenneth D. Merry.Ar mintags 6689deea857SKenneth D. Merryis 2, although it may be set higher or lower for various devices. 6699deea857SKenneth D. Merry.It maxtags 6709deea857SKenneth D. MerryThis is the "hard" maximum number of transactions that can be queued to a 6719806e231SRuslan Ermilovdevice at one time. 6729806e231SRuslan ErmilovThe 6739deea857SKenneth D. Merry.Ar dev_openings 6749806e231SRuslan Ermilovvalue cannot go above this number. 6759806e231SRuslan ErmilovThe default value for 6769deea857SKenneth D. Merry.Ar maxtags 6779deea857SKenneth D. Merryis 255, although it may be set higher or lower for various devices. 6789deea857SKenneth D. Merry.El 6799deea857SKenneth D. Merry.El 68033fab22eSKenneth D. Merry.It Ic negotiate 6819806e231SRuslan ErmilovShow or negotiate various communication parameters. 6829806e231SRuslan ErmilovSome controllers may 6839806e231SRuslan Ermilovnot support setting or changing some of these values. 6849806e231SRuslan ErmilovFor instance, the 6859deea857SKenneth D. MerryAdaptec 174x controllers do not support changing a device's sync rate or 6869deea857SKenneth D. Merryoffset. 687e1205e80SPhilippe CharnierThe 6887c7fb079SRuslan Ermilov.Nm 689e1205e80SPhilippe Charnierutility 6909deea857SKenneth D. Merrywill not attempt to set the parameter if the controller indicates that it 6919806e231SRuslan Ermilovdoes not support setting the parameter. 6929806e231SRuslan ErmilovTo find out what the controller 6939deea857SKenneth D. Merrysupports, use the 6949deea857SKenneth D. Merry.Fl v 6959806e231SRuslan Ermilovflag. 6969806e231SRuslan ErmilovThe meaning of the 6979deea857SKenneth D. Merry.Fl v 6989deea857SKenneth D. Merryflag for the 69933fab22eSKenneth D. Merry.Ic negotiate 7009806e231SRuslan Ermilovcommand is described below. 7010227791bSRuslan ErmilovAlso, some controller drivers do not support 7029deea857SKenneth D. Merrysetting negotiation parameters, even if the underlying controller supports 7039806e231SRuslan Ermilovnegotiation changes. 7049806e231SRuslan ErmilovSome controllers, such as the Advansys wide 7059deea857SKenneth D. Merrycontrollers, support enabling and disabling synchronous negotiation for 7069deea857SKenneth D. Merrya device, but do not support setting the synchronous negotiation rate. 7071252c1bbSRuslan Ermilov.Bl -tag -width 17n 7089deea857SKenneth D. Merry.It Fl a 7099deea857SKenneth D. MerryAttempt to make the negotiation settings take effect immediately by sending 7109deea857SKenneth D. Merrya Test Unit Ready command to the device. 7119deea857SKenneth D. Merry.It Fl c 7129806e231SRuslan ErmilovShow or set current negotiation settings. 7139806e231SRuslan ErmilovThis is the default. 7149deea857SKenneth D. Merry.It Fl D Ar enable|disable 7159deea857SKenneth D. MerryEnable or disable disconnection. 716b447e682SAlexander Motin.It Fl M Ar mode 717b447e682SAlexander MotinSet ATA mode. 7189deea857SKenneth D. Merry.It Fl O Ar offset 7199deea857SKenneth D. MerrySet the command delay offset. 7209deea857SKenneth D. Merry.It Fl q 7210227791bSRuslan ErmilovBe quiet, do not print anything. 7229806e231SRuslan ErmilovThis is generally useful when you want to 7230227791bSRuslan Ermilovset a parameter, but do not want any status information. 7249deea857SKenneth D. Merry.It Fl R Ar syncrate 7259806e231SRuslan ErmilovChange the synchronization rate for a device. 7269806e231SRuslan ErmilovThe sync rate is a floating 7279806e231SRuslan Ermilovpoint value specified in MHz. 7289806e231SRuslan ErmilovSo, for instance, 7299deea857SKenneth D. Merry.Sq 20.000 7309deea857SKenneth D. Merryis a legal value, as is 7319deea857SKenneth D. Merry.Sq 20 . 7329deea857SKenneth D. Merry.It Fl T Ar enable|disable 7339deea857SKenneth D. MerryEnable or disable tagged queueing for a device. 7349deea857SKenneth D. Merry.It Fl U 7359806e231SRuslan ErmilovShow or set user negotiation settings. 7369806e231SRuslan ErmilovThe default is to show or set 7379deea857SKenneth D. Merrycurrent negotiation settings. 7389deea857SKenneth D. Merry.It Fl v 7399deea857SKenneth D. MerryThe verbose switch has special meaning for the 74033fab22eSKenneth D. Merry.Ic negotiate 7419806e231SRuslan Ermilovsubcommand. 7429806e231SRuslan ErmilovIt causes 7437c7fb079SRuslan Ermilov.Nm 7449deea857SKenneth D. Merryto print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the 7459deea857SKenneth D. Merrycontroller driver. 7469deea857SKenneth D. Merry.It Fl W Ar bus_width 7479806e231SRuslan ErmilovSpecify the bus width to negotiate with a device. 7489806e231SRuslan ErmilovThe bus width is 7499806e231SRuslan Ermilovspecified in bits. 7509806e231SRuslan ErmilovThe only useful values to specify are 8, 16, and 32 7519806e231SRuslan Ermilovbits. 7529806e231SRuslan ErmilovThe controller must support the bus width in question in order for 7539deea857SKenneth D. Merrythe setting to take effect. 7549deea857SKenneth D. Merry.El 7559deea857SKenneth D. Merry.Pp 7569deea857SKenneth D. MerryIn general, sync rate and offset settings will not take effect for a 7579806e231SRuslan Ermilovdevice until a command has been sent to the device. 7589806e231SRuslan ErmilovThe 7599deea857SKenneth D. Merry.Fl a 7609deea857SKenneth D. Merryswitch above will automatically send a Test Unit Ready to the device so 7619deea857SKenneth D. Merrynegotiation parameters will take effect. 76233fab22eSKenneth D. Merry.It Ic format 76396a93c63SKenneth D. MerryIssue the 76496a93c63SKenneth D. Merry.Tn SCSI 76596a93c63SKenneth D. MerryFORMAT UNIT command to the named device. 76696a93c63SKenneth D. Merry.Pp 76796a93c63SKenneth D. Merry.Em WARNING! WARNING! WARNING! 76896a93c63SKenneth D. Merry.Pp 7699806e231SRuslan ErmilovLow level formatting a disk will destroy ALL data on the disk. 7709806e231SRuslan ErmilovUse 7719806e231SRuslan Ermilovextreme caution when issuing this command. 7729806e231SRuslan ErmilovMany users low-level format 7739806e231SRuslan Ermilovdisks that do not really need to be low-level formatted. 7749806e231SRuslan ErmilovThere are 77596a93c63SKenneth D. Merryrelatively few scenarios that call for low-level formatting a disk. 77696a93c63SKenneth D. MerryOne reason for 77796a93c63SKenneth D. Merrylow-level formatting a disk is to initialize the disk after changing 7789806e231SRuslan Ermilovits physical sector size. 7799806e231SRuslan ErmilovAnother reason for low-level formatting a disk 78096a93c63SKenneth D. Merryis to revive the disk if you are getting "medium format corrupted" errors 78196a93c63SKenneth D. Merryfrom the disk in response to read and write requests. 78296a93c63SKenneth D. Merry.Pp 7839806e231SRuslan ErmilovSome disks take longer than others to format. 7849806e231SRuslan ErmilovUsers should specify a 7859806e231SRuslan Ermilovtimeout long enough to allow the format to complete. 7869806e231SRuslan ErmilovThe default format 7879806e231SRuslan Ermilovtimeout is 3 hours, which should be long enough for most disks. 7889806e231SRuslan ErmilovSome hard 78996a93c63SKenneth D. Merrydisks will complete a format operation in a very short period of time 7909806e231SRuslan Ermilov(on the order of 5 minutes or less). 7919806e231SRuslan ErmilovThis is often because the drive 7920227791bSRuslan Ermilovdoes not really support the FORMAT UNIT command -- it just accepts the 79396a93c63SKenneth D. Merrycommand, waits a few minutes and then returns it. 79496a93c63SKenneth D. Merry.Pp 79596a93c63SKenneth D. MerryThe 79696a93c63SKenneth D. Merry.Sq format 7979806e231SRuslan Ermilovsubcommand takes several arguments that modify its default behavior. 7989806e231SRuslan ErmilovThe 79996a93c63SKenneth D. Merry.Fl q 80096a93c63SKenneth D. Merryand 80196a93c63SKenneth D. Merry.Fl y 80296a93c63SKenneth D. Merryarguments can be useful for scripts. 80396a93c63SKenneth D. Merry.Pp 8041252c1bbSRuslan Ermilov.Bl -tag -width 6n 80596a93c63SKenneth D. Merry.It Fl q 8060227791bSRuslan ErmilovBe quiet, do not print any status messages. 8079806e231SRuslan ErmilovThis option will not disable 8089806e231SRuslan Ermilovthe questions, however. 8099806e231SRuslan ErmilovTo disable questions, use the 81096a93c63SKenneth D. Merry.Fl y 81196a93c63SKenneth D. Merryargument, below. 812e9e4d3e4SKenneth D. Merry.It Fl r 813e9e4d3e4SKenneth D. MerryRun in 814e9e4d3e4SKenneth D. Merry.Dq report only 815e9e4d3e4SKenneth D. Merrymode. 816e9e4d3e4SKenneth D. MerryThis will report status on a format that is already running on the drive. 81796a93c63SKenneth D. Merry.It Fl w 8189806e231SRuslan ErmilovIssue a non-immediate format command. 8199806e231SRuslan ErmilovBy default, 8207c7fb079SRuslan Ermilov.Nm 8219806e231SRuslan Ermilovissues the FORMAT UNIT command with the immediate bit set. 8229806e231SRuslan ErmilovThis tells the 82396a93c63SKenneth D. Merrydevice to immediately return the format command, before the format has 8249806e231SRuslan Ermilovactually completed. 8259806e231SRuslan ErmilovThen, 8267c7fb079SRuslan Ermilov.Nm 82796a93c63SKenneth D. Merrygathers 82896a93c63SKenneth D. Merry.Tn SCSI 82996a93c63SKenneth D. Merrysense information from the device every second to determine how far along 8309806e231SRuslan Ermilovin the format process it is. 8319806e231SRuslan ErmilovIf the 83296a93c63SKenneth D. Merry.Fl w 83396a93c63SKenneth D. Merryargument is specified, 8347c7fb079SRuslan Ermilov.Nm 83596a93c63SKenneth D. Merrywill issue a non-immediate format command, and will be unable to print any 83696a93c63SKenneth D. Merryinformation to let the user know what percentage of the disk has been 83796a93c63SKenneth D. Merryformatted. 83896a93c63SKenneth D. Merry.It Fl y 8390227791bSRuslan ErmilovDo not ask any questions. 8409806e231SRuslan ErmilovBy default, 8417c7fb079SRuslan Ermilov.Nm 84296a93c63SKenneth D. Merrywill ask the user if he/she really wants to format the disk in question, 8439806e231SRuslan Ermilovand also if the default format command timeout is acceptable. 8449806e231SRuslan ErmilovThe user 84596a93c63SKenneth D. Merrywill not be asked about the timeout if a timeout is specified on the 84696a93c63SKenneth D. Merrycommand line. 84796a93c63SKenneth D. Merry.El 84850c9a276SAlexander Motin.It Ic idle 849*72166fbaSAlexander MotinPut ATA device into IDLE state. Optional parameter 850*72166fbaSAlexander Motin.Pq Fl t 851*72166fbaSAlexander Motinspecifies automatic standby timer value in seconds. Value 0 disables timer. 85250c9a276SAlexander Motin.It Ic standby 853*72166fbaSAlexander MotinPut ATA device into STANDBY state. Optional parameter 854*72166fbaSAlexander Motin.Pq Fl t 855*72166fbaSAlexander Motinspecifies automatic standby timer value in seconds. Value 0 disables timer. 85650c9a276SAlexander Motin.It Ic sleep 85750c9a276SAlexander MotinPut ATA device into SLEEP state. Note that the only way get device out of 85850c9a276SAlexander Motinthis state may be reset. 85933fab22eSKenneth D. Merry.It Ic help 8605a251d70SKenneth D. MerryPrint out verbose usage information. 861525689f1SJustin T. Gibbs.El 862525689f1SJustin T. Gibbs.Sh ENVIRONMENT 863525689f1SJustin T. GibbsThe 864525689f1SJustin T. Gibbs.Ev SCSI_MODES 865525689f1SJustin T. Gibbsvariable allows the user to specify an alternate mode page format file. 866525689f1SJustin T. Gibbs.Pp 867525689f1SJustin T. GibbsThe 868525689f1SJustin T. Gibbs.Ev EDITOR 869525689f1SJustin T. Gibbsvariable determines which text editor 8707c7fb079SRuslan Ermilov.Nm 871525689f1SJustin T. Gibbsstarts when editing mode pages. 872525689f1SJustin T. Gibbs.Sh FILES 873525689f1SJustin T. Gibbs.Bl -tag -width /usr/share/misc/scsi_modes -compact 874525689f1SJustin T. Gibbs.It Pa /usr/share/misc/scsi_modes 875525689f1SJustin T. Gibbsis the SCSI mode format database. 876525689f1SJustin T. Gibbs.It Pa /dev/xpt0 877525689f1SJustin T. Gibbsis the transport layer device. 878525689f1SJustin T. Gibbs.It Pa /dev/pass* 879525689f1SJustin T. Gibbsare the CAM application passthrough devices. 880525689f1SJustin T. Gibbs.El 881525689f1SJustin T. Gibbs.Sh EXAMPLES 882525689f1SJustin T. Gibbs.Dl camcontrol eject -n cd -u 1 -v 883525689f1SJustin T. Gibbs.Pp 884525689f1SJustin T. GibbsEject the CD from cd1, and print SCSI sense information if the command 885525689f1SJustin T. Gibbsfails. 886525689f1SJustin T. Gibbs.Pp 887b3550398SKenneth D. Merry.Dl camcontrol tur da0 888525689f1SJustin T. Gibbs.Pp 889525689f1SJustin T. GibbsSend the SCSI test unit ready command to da0. 890e1205e80SPhilippe CharnierThe 8917c7fb079SRuslan Ermilov.Nm 892e1205e80SPhilippe Charnierutility will report whether the disk is ready, but will not display sense 893525689f1SJustin T. Gibbsinformation if the command fails since the 894525689f1SJustin T. Gibbs.Fl v 895525689f1SJustin T. Gibbsswitch was not specified. 896525689f1SJustin T. Gibbs.Pp 897c7938743SMike Pritchard.Bd -literal -offset indent 898c60e19a8SKenneth D. Merrycamcontrol tur da1 -E -C 4 -t 50 -v 899525689f1SJustin T. Gibbs.Ed 900525689f1SJustin T. Gibbs.Pp 9019806e231SRuslan ErmilovSend a test unit ready command to da1. 9029806e231SRuslan ErmilovEnable kernel error recovery. 9039806e231SRuslan ErmilovSpecify a retry count of 4, and a timeout of 50 seconds. 9049806e231SRuslan ErmilovEnable sense 905525689f1SJustin T. Gibbsprinting (with the 906525689f1SJustin T. Gibbs.Fl v 9079806e231SRuslan Ermilovflag) if the command fails. 9089806e231SRuslan ErmilovSince error recovery is turned on, the 909525689f1SJustin T. Gibbsdisk will be spun up if it is not currently spinning. 910e1205e80SPhilippe CharnierThe 9117c7fb079SRuslan Ermilov.Nm 912e1205e80SPhilippe Charnierutility will report whether the disk is ready. 913c7938743SMike Pritchard.Bd -literal -offset indent 914525689f1SJustin T. Gibbscamcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e 915525689f1SJustin T. Gibbs -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1" 916525689f1SJustin T. Gibbs.Ed 917525689f1SJustin T. Gibbs.Pp 9189806e231SRuslan ErmilovIssue a READ BUFFER command (0x3C) to cd1. 9199806e231SRuslan ErmilovDisplay the buffer size of cd1, 9209806e231SRuslan Ermilovand display the first 10 bytes from the cache on cd1. 9219806e231SRuslan ErmilovDisplay SCSI sense 922525689f1SJustin T. Gibbsinformation if the command fails. 923525689f1SJustin T. Gibbs.Pp 924c7938743SMike Pritchard.Bd -literal -offset indent 9258604fe2eSSADA Kenjicamcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e 926525689f1SJustin T. Gibbs -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8 927525689f1SJustin T. Gibbs.Ed 928525689f1SJustin T. Gibbs.Pp 9299806e231SRuslan ErmilovIssue a WRITE BUFFER (0x3B) command to cd1. 9309806e231SRuslan ErmilovWrite out 10 bytes of data, 9319806e231SRuslan Ermilovnot including the (reserved) 4 byte header. 9329806e231SRuslan ErmilovPrint out sense information if 9339806e231SRuslan Ermilovthe command fails. 9349806e231SRuslan ErmilovBe very careful with this command, improper use may 935525689f1SJustin T. Gibbscause data corruption. 936525689f1SJustin T. Gibbs.Pp 937c7938743SMike Pritchard.Bd -literal -offset indent 938c60e19a8SKenneth D. Merrycamcontrol modepage da3 -m 1 -e -P 3 93994d09127SKenneth D. Merry.Ed 940525689f1SJustin T. Gibbs.Pp 941525689f1SJustin T. GibbsEdit mode page 1 (the Read-Write Error Recover page) for da3, and save the 9429806e231SRuslan Ermilovsettings on the drive. 9439806e231SRuslan ErmilovMode page 1 contains a disk drive's auto read and 944525689f1SJustin T. Gibbswrite reallocation settings, among other things. 945525689f1SJustin T. Gibbs.Pp 9465710d224SKenneth D. Merry.Dl camcontrol rescan all 9475710d224SKenneth D. Merry.Pp 9485710d224SKenneth D. MerryRescan all SCSI busses in the system for devices that have been added, 9495710d224SKenneth D. Merryremoved or changed. 9505710d224SKenneth D. Merry.Pp 951525689f1SJustin T. Gibbs.Dl camcontrol rescan 0 952525689f1SJustin T. Gibbs.Pp 953525689f1SJustin T. GibbsRescan SCSI bus 0 for devices that have been added, removed or changed. 954525689f1SJustin T. Gibbs.Pp 955525689f1SJustin T. Gibbs.Dl camcontrol rescan 0:1:0 956525689f1SJustin T. Gibbs.Pp 957525689f1SJustin T. GibbsRescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or 958525689f1SJustin T. Gibbschanged. 9599deea857SKenneth D. Merry.Pp 960c60e19a8SKenneth D. Merry.Dl camcontrol tags da5 -N 24 9619deea857SKenneth D. Merry.Pp 9629deea857SKenneth D. MerrySet the number of concurrent transactions for da5 to 24. 9639deea857SKenneth D. Merry.Pp 964c7938743SMike Pritchard.Bd -literal -offset indent 9659deea857SKenneth D. Merrycamcontrol negotiate -n da -u 4 -T disable 9669deea857SKenneth D. Merry.Ed 9679deea857SKenneth D. Merry.Pp 9689deea857SKenneth D. MerryDisable tagged queueing for da4. 9699deea857SKenneth D. Merry.Pp 970c7938743SMike Pritchard.Bd -literal -offset indent 9719deea857SKenneth D. Merrycamcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a 9729deea857SKenneth D. Merry.Ed 9739deea857SKenneth D. Merry.Pp 9749806e231SRuslan ErmilovNegotiate a sync rate of 20MHz and an offset of 15 with da3. 9759806e231SRuslan ErmilovThen send a 9769deea857SKenneth D. MerryTest Unit Ready command to make the settings take effect. 977525689f1SJustin T. Gibbs.Sh SEE ALSO 978525689f1SJustin T. Gibbs.Xr cam 3 , 9799deea857SKenneth D. Merry.Xr cam_cdbparse 3 , 980c0bdb22bSMatthew Hunt.Xr cam 4 , 981525689f1SJustin T. Gibbs.Xr pass 4 , 982c0bdb22bSMatthew Hunt.Xr xpt 4 983525689f1SJustin T. Gibbs.Sh HISTORY 984525689f1SJustin T. GibbsThe 9857c7fb079SRuslan Ermilov.Nm 986e1205e80SPhilippe Charnierutility first appeared in 987525689f1SJustin T. Gibbs.Fx 3.0 . 988525689f1SJustin T. Gibbs.Pp 989525689f1SJustin T. GibbsThe mode page editing code and arbitrary SCSI command code are based upon 990525689f1SJustin T. Gibbscode in the old 991525689f1SJustin T. Gibbs.Xr scsi 8 992525689f1SJustin T. Gibbsutility and 993525689f1SJustin T. Gibbs.Xr scsi 3 9949806e231SRuslan Ermilovlibrary, written by Julian Elischer and Peter Dufault. 9959806e231SRuslan ErmilovThe 996525689f1SJustin T. Gibbs.Xr scsi 8 997753d686dSRuslan Ermilovprogram first appeared in 998753d686dSRuslan Ermilov.Bx 386 0.1.2.4 , 999753d686dSRuslan Ermilovand first appeared in 100033fab22eSKenneth D. Merry.Fx 1001525689f1SJustin T. Gibbsin 1002525689f1SJustin T. Gibbs.Fx 2.0.5 . 1003525689f1SJustin T. Gibbs.Sh AUTHORS 1004aa7c9adaSMike Pritchard.An Kenneth Merry Aq ken@FreeBSD.org 1005525689f1SJustin T. Gibbs.Sh BUGS 10060227791bSRuslan ErmilovThe code that parses the generic command line arguments does not know that 10079806e231SRuslan Ermilovsome of the subcommands take multiple arguments. 10089806e231SRuslan ErmilovSo if, for instance, you 1009525689f1SJustin T. Gibbstried something like this: 1010c7938743SMike Pritchard.Bd -literal -offset indent 1011b9e3972aSKenneth D. Merrycamcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v 1012525689f1SJustin T. Gibbs.Ed 1013525689f1SJustin T. Gibbs.Pp 1014525689f1SJustin T. GibbsThe sense information from the test unit ready command would not get 1015525689f1SJustin T. Gibbsprinted out, since the first 1016525689f1SJustin T. Gibbs.Xr getopt 3 1017525689f1SJustin T. Gibbscall in 10187c7fb079SRuslan Ermilov.Nm 1019525689f1SJustin T. Gibbsbails out when it sees the second argument to 1020525689f1SJustin T. Gibbs.Fl c 1021c4d9468eSRuslan Ermilov(0x00), 10229806e231SRuslan Ermilovabove. 10239806e231SRuslan ErmilovFixing this behavior would take some gross code, or changes to the 1024525689f1SJustin T. Gibbs.Xr getopt 3 10259806e231SRuslan Ermilovinterface. 10269806e231SRuslan ErmilovThe best way to circumvent this problem is to always make sure 1027525689f1SJustin T. Gibbsto specify generic 10287c7fb079SRuslan Ermilov.Nm 1029525689f1SJustin T. Gibbsarguments before any command-specific arguments. 1030