1.\" $NetBSD: scsictl.8,v 1.26 2013/03/29 21:46:32 christos Exp $ 2.\" 3.\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8.\" NASA Ames Research Center. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\" 31.Dd March 29, 2013 32.Dt SCSICTL 8 33.Os 34.Sh NAME 35.Nm scsictl 36.Nd a program to manipulate SCSI devices and busses 37.Sh SYNOPSIS 38.Nm 39.Ar device 40.Ar command 41.Oo 42.Ar arg Oo ... 43.Oc 44.Oc 45.Sh DESCRIPTION 46.Nm 47allows a user or system administrator to issue commands to and otherwise 48control SCSI devices and busses. 49It is used by specifying a device or bus to manipulate, 50the command to perform, and any arguments the command may require. 51.Nm 52determines if the specified device is an actual device or a SCSI bus 53automatically, and selects the appropriate command set. 54.Pp 55For commands which 56.Nm 57issues a SCSI command to the device directly, any returned sense information 58will be decoded by 59.Nm 60and displayed to the standard output. 61.Sh DEVICE COMMANDS 62The following commands are supported for SCSI devices: 63.Pp 64.Nm debug 65.Ar level 66.Pp 67Set the debugging level for the given device; the following flags are 68supported: 69.Pp 70.Bl -tag -compact -width xx -offset indent 71.It Ar 1 72Show scsi commands, errors, data. 73.It Ar 2 74Routine flow tracking. 75.It Ar 4 76Internal info from routine flows. 77.It Ar 8 78Device specific debugging. 79.El 80.Pp 81This option is only supported with kernels compiled with 82.Dv SCSIPI_DEBUG . 83.Pp 84.Nm defects 85.Op primary 86.Op grown 87.Op block|byte|physical 88.Pp 89Read the primary and/or grown defect lists from the specified device 90in block, byte from index, or physical sector format. 91The default is to return both the primary and grown defect lists 92in physical sector format. 93This command is only supported on direct access devices. 94.Pp 95.Nm format 96.Oo blocksize 97.Oo immediate 98.Oc 99.Oc 100.Pp 101(Low level) format the named device. 102If the optional 103.Li blocksize 104parameter is provided, the device geometry will be modified to 105use the specified 106.Li blocksize . 107If this parameter is different form the Current or Default Mode Page 3 108parameters, the device will update Mode Page 3 at the successful 109completion of the Format. 110Device geometry may change as a result of using a new device 111.Li blocksize . 112When the optional 113.Li blocksize 114parameter is specified, the Defect List on the drive will revert to 115the original primary defect list created at the time of manufacture 116if available. 117The drive will usually recertify itself during the Format 118and add any other defective blocks to the new Defect List. 119Some disks may not support the ability to change the blocksize and 120may enter a Degraded Mode when fed a Format command of this type. 121If this happens the standard recovery for the drive requires issuing 122a correct Format command, i.e. one without the blocksize parameter. 123.Pp 124When the 125.Li immediate 126parameter is also specified, the disk is instructed to return from the 127format command right away. 128It continues to format, and every ten seconds 129.Nm 130issues a TEST UNIT READY command to check the associated sense data. 131This associated sense data has a progress indicator which indicates 132how far the format is progressing. 133Note well that most SCSI disk drives prior to 134a few years ago do not support this option. 135.Pp 136.Nm identify 137.Pp 138Identify the specified device, displaying the device's SCSI 139bus, target, and lun, as well as the device's vendor, product, 140and revision strings. 141.Pp 142.Nm reassign 143.Ar blkno 144.Oo blkno Oo ... 145.Oc 146.Oc 147.Pp 148Issues a 149.Li REASSIGN BLOCKS 150command to the device, adding the specified blocks to the 151grown defect list. 152This command is only supported on direct access devices. 153.Pp 154.Nm release 155.Pp 156Send a 157.Dq RELEASE 158command to the device to release a reservation on it. 159.Pp 160.Nm reserve 161.Pp 162Send a 163.Dq RESERVE 164command to the device to place a reservation on it. 165.Pp 166.Nm reset 167.Pp 168Reset the device. 169This command is only supported for devices which support the 170.Li SCIOCRESET 171ioctl. 172.Pp 173.Nm start 174.Pp 175Send a 176.Dq START 177command to the device. 178This is useful typically only for disk devices. 179.Pp 180.Nm stop 181.Pp 182Send a 183.Dq STOP 184command to the device. 185This is useful typically only for disk devices. 186.Pp 187.Nm tur 188.Pp 189Send a 190.Dq TEST UNIT READY 191command to the device. 192This is useful for generating current device status. 193.Pp 194.Nm getcache 195.Pp 196Returns basic cache parameters for the device. 197.Pp 198.Nm setcache 199.Ar none|r|w|rw 200.Op Ar save 201.Pp 202Set basic cache parameters for the device. 203The cache may be disabled 204.Pq none , 205the read cache enabled 206.Pq r , 207the write cache enabled 208.Pq w , 209or both read and write cache enabled 210.Pq rw . 211If the drive's cache parameters are savable, specifying 212.Ar save 213after the cache enable state will cause the parameters to be saved in 214non-volatile storage. 215.Pp 216.Nm flushcache 217.Pp 218Explicitly flushes the write cache. 219.Pp 220.Nm setspeed 221.Ar speed 222.Pp 223Set the highest speed that the optical drive should use for reading 224data. 225The units are multiples of a single speed CDROM (150 KB/s). 226Specify 0 to use the drive's fastest speed. 227.Sh BUS COMMANDS 228The following commands are supported for SCSI busses: 229.Pp 230.Nm reset 231.Pp 232Reset the SCSI bus. 233This command is only supported if the host adapter supports the 234.Li SCBUSIORESET 235ioctl. 236.Pp 237.Nm scan 238.Ar target 239.Ar lun 240.Pp 241Scan the SCSI bus for devices. 242This is useful if a device was not connected or powered 243on when the system was booted. 244The 245.Ar target 246and 247.Ar lun 248arguments specify which SCSI target and lun on the bus is to be scanned. 249Either may be wildcarded by specifying the keyword 250.Dq any 251or 252.Dq all . 253.Pp 254.Nm detach 255.Ar target 256.Ar lun 257.Pp 258Detach the specified device from the bus. 259Useful if a device is powered down after use. 260The 261.Ar target 262and 263.Ar lun 264arguments have the same meaning as for the 265.Nm scan 266command, and may also be wildcarded. 267.Sh NOTES 268When scanning the SCSI bus, information about newly recognized devices 269is printed to console. 270No information is printed for already probed devices. 271.Sh FILES 272.Pa /dev/scsibus* 273- for commands operating on SCSI busses 274.Sh SEE ALSO 275.Xr ioctl 2 , 276.Xr cd 4 , 277.Xr ch 4 , 278.Xr sd 4 , 279.Xr se 4 , 280.Xr ss 4 , 281.Xr st 4 , 282.Xr uk 4 , 283.Xr atactl 8 , 284.Xr dkctl 8 285.Sh HISTORY 286The 287.Nm 288command first appeared in 289.Nx 1.4 . 290.Sh AUTHORS 291The 292.Nm 293command was written by Jason R. Thorpe of the Numerical Aerospace Simulation 294Facility, NASA Ames Research Center. 295