1*e8c872c0Srillig.\" $NetBSD: scsictl.8,v 1.34 2024/11/09 12:45:39 rillig Exp $ 2c9a47c22Sthorpej.\" 30683880eSthorpej.\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. 4c9a47c22Sthorpej.\" All rights reserved. 5c9a47c22Sthorpej.\" 6c9a47c22Sthorpej.\" This code is derived from software contributed to The NetBSD Foundation 7c9a47c22Sthorpej.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8c9a47c22Sthorpej.\" NASA Ames Research Center. 9c9a47c22Sthorpej.\" 10c9a47c22Sthorpej.\" Redistribution and use in source and binary forms, with or without 11c9a47c22Sthorpej.\" modification, are permitted provided that the following conditions 12c9a47c22Sthorpej.\" are met: 13c9a47c22Sthorpej.\" 1. Redistributions of source code must retain the above copyright 14c9a47c22Sthorpej.\" notice, this list of conditions and the following disclaimer. 15c9a47c22Sthorpej.\" 2. Redistributions in binary form must reproduce the above copyright 16c9a47c22Sthorpej.\" notice, this list of conditions and the following disclaimer in the 17c9a47c22Sthorpej.\" documentation and/or other materials provided with the distribution. 18c9a47c22Sthorpej.\" 19c9a47c22Sthorpej.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20c9a47c22Sthorpej.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21c9a47c22Sthorpej.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22c9a47c22Sthorpej.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23c9a47c22Sthorpej.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24c9a47c22Sthorpej.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25c9a47c22Sthorpej.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26c9a47c22Sthorpej.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27c9a47c22Sthorpej.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28c9a47c22Sthorpej.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29c9a47c22Sthorpej.\" POSSIBILITY OF SUCH DAMAGE. 30c9a47c22Sthorpej.\" 31*e8c872c0Srillig.Dd November 9, 2024 32c9a47c22Sthorpej.Dt SCSICTL 8 3373f545bbSwiz.Os 34c9a47c22Sthorpej.Sh NAME 35c9a47c22Sthorpej.Nm scsictl 36*e8c872c0Srillig.Nd manipulate SCSI devices and busses 37c9a47c22Sthorpej.Sh SYNOPSIS 38c9a47c22Sthorpej.Nm 39c9a47c22Sthorpej.Ar device 40c9a47c22Sthorpej.Ar command 41*e8c872c0Srillig.Op Ar arg ... 42c9a47c22Sthorpej.Sh DESCRIPTION 43c9a47c22Sthorpej.Nm 44c9a47c22Sthorpejallows a user or system administrator to issue commands to and otherwise 4509cbac4eSwizcontrol SCSI devices and busses. 4609cbac4eSwizIt is used by specifying a device or bus to manipulate, 4709cbac4eSwizthe command to perform, and any arguments the command may require. 48c9a47c22Sthorpej.Nm 49c9a47c22Sthorpejdetermines if the specified device is an actual device or a SCSI bus 50c9a47c22Sthorpejautomatically, and selects the appropriate command set. 51c9a47c22Sthorpej.Pp 52c9a47c22SthorpejFor commands which 53c9a47c22Sthorpej.Nm 54c9a47c22Sthorpejissues a SCSI command to the device directly, any returned sense information 55c9a47c22Sthorpejwill be decoded by 56c9a47c22Sthorpej.Nm 57c9a47c22Sthorpejand displayed to the standard output. 58c9a47c22Sthorpej.Sh DEVICE COMMANDS 59c9a47c22SthorpejThe following commands are supported for SCSI devices: 6039a1754cSwiz.Bl -tag -width flushcacheXX 6139a1754cSwiz.It Cm debug Ar level 62f27e0a25SchristosSet the debugging level for the given device; the following flags are 63f27e0a25Schristossupported: 64f27e0a25Schristos.Pp 65f27e0a25Schristos.Bl -tag -compact -width xx -offset indent 66f27e0a25Schristos.It Ar 1 67f27e0a25SchristosShow scsi commands, errors, data. 68f27e0a25Schristos.It Ar 2 69f27e0a25SchristosRoutine flow tracking. 70f27e0a25Schristos.It Ar 4 71f27e0a25SchristosInternal info from routine flows. 72f27e0a25Schristos.It Ar 8 73f27e0a25SchristosDevice specific debugging. 74f27e0a25Schristos.El 75f27e0a25Schristos.Pp 76f27e0a25SchristosThis option is only supported with kernels compiled with 77f27e0a25Schristos.Dv SCSIPI_DEBUG . 78*e8c872c0Srillig.It Cm defects Oo Ar primary Oc Oo Ar grown Oc Oo Cm block Ns No | Ns Cm byte Ns No | Ns Cm physical Oc 7938b227d1SwizRead the primary and/or grown defect lists from the specified device 8038b227d1Swizin block, byte from index, or physical sector format. 8138b227d1SwizThe default is to return both the primary and grown defect lists 8238b227d1Swizin physical sector format. 8338b227d1SwizThis command is only supported on direct access devices. 84*e8c872c0Srillig.It Cm format Op Ar blocksize Op Cm immediate 8509cbac4eSwiz(Low level) format the named device. 8609cbac4eSwizIf the optional 8741194c0eSmjacob.Li blocksize 8841194c0eSmjacobparameter is provided, the device geometry will be modified to 8941194c0eSmjacobuse the specified 9041194c0eSmjacob.Li blocksize . 9141194c0eSmjacobIf this parameter is different form the Current or Default Mode Page 3 9241194c0eSmjacobparameters, the device will update Mode Page 3 at the successful 9309cbac4eSwizcompletion of the Format. 9409cbac4eSwizDevice geometry may change as a result of using a new device 9541194c0eSmjacob.Li blocksize . 9641194c0eSmjacobWhen the optional 9741194c0eSmjacob.Li blocksize 9841194c0eSmjacobparameter is specified, the Defect List on the drive will revert to 9941194c0eSmjacobthe original primary defect list created at the time of manufacture 10009cbac4eSwizif available. 10109cbac4eSwizThe drive will usually recertify itself during the Format 10209cbac4eSwizand add any other defective blocks to the new Defect List. 10309cbac4eSwizSome disks may not support the ability to change the blocksize and 10409cbac4eSwizmay enter a Degraded Mode when fed a Format command of this type. 10509cbac4eSwizIf this happens the standard recovery for the drive requires issuing 10609cbac4eSwiza correct Format command, i.e. one without the blocksize parameter. 10741194c0eSmjacob.Pp 10841194c0eSmjacobWhen the 10941194c0eSmjacob.Li immediate 11041194c0eSmjacobparameter is also specified, the disk is instructed to return from the 11109cbac4eSwizformat command right away. 11209cbac4eSwizIt continues to format, and every ten seconds 11341194c0eSmjacob.Nm 11409cbac4eSwizissues a TEST UNIT READY command to check the associated sense data. 11509cbac4eSwizThis associated sense data has a progress indicator which indicates 11609cbac4eSwizhow far the format is progressing. 11709cbac4eSwizNote well that most SCSI disk drives prior to 11841194c0eSmjacoba few years ago do not support this option. 119*e8c872c0Srillig.It Cm identify Op Ar vpd 120c9a47c22SthorpejIdentify the specified device, displaying the device's SCSI 121c9a47c22Sthorpejbus, target, and lun, as well as the device's vendor, product, 122c9a47c22Sthorpejand revision strings. 123f17194a0Smlelstv.Pp 124f17194a0SmlelstvWhen the optional 125f17194a0Smlelstv.Li vpd 126f17194a0Smlelstvparameter is added, Vital Product Data that identifies 127f17194a0Smlelstvthe device is also queried and displayed. 128*e8c872c0Srillig.It Cm reassign Ar blkno ... 129*e8c872c0SrilligIssue a 130*e8c872c0Srillig.Dq REASSIGN BLOCKS 131c9a47c22Sthorpejcommand to the device, adding the specified blocks to the 13209cbac4eSwizgrown defect list. 13309cbac4eSwizThis command is only supported on direct access devices. 13439a1754cSwiz.It Cm release 1355081d82dSwizSend a 1365081d82dSwiz.Dq RELEASE 1375081d82dSwizcommand to the device to release a reservation on it. 13839a1754cSwiz.It Cm reserve 1395081d82dSwizSend a 1405081d82dSwiz.Dq RESERVE 1415081d82dSwizcommand to the device to place a reservation on it. 14239a1754cSwiz.It Cm reset 14309cbac4eSwizReset the device. 14409cbac4eSwizThis command is only supported for devices which support the 145c9a47c22Sthorpej.Li SCIOCRESET 146c9a47c22Sthorpejioctl. 14739a1754cSwiz.It Cm start 1485081d82dSwizSend a 1495081d82dSwiz.Dq START 15009cbac4eSwizcommand to the device. 15109cbac4eSwizThis is useful typically only for disk devices. 15239a1754cSwiz.It Cm stop 1535081d82dSwizSend a 1545081d82dSwiz.Dq STOP 15509cbac4eSwizcommand to the device. 15609cbac4eSwizThis is useful typically only for disk devices. 15739a1754cSwiz.It Cm tur 1585081d82dSwizSend a 1595081d82dSwiz.Dq TEST UNIT READY 16009cbac4eSwizcommand to the device. 16109cbac4eSwizThis is useful for generating current device status. 16239a1754cSwiz.It Cm getcache 163*e8c872c0SrilligReturn basic cache parameters for the device. 164*e8c872c0Srillig.It Cm setcache Ar Cm none Ns | Ns Cm r Ns | Ns Cm w Ns | Ns Cm rw Op Ar save 16509cbac4eSwizSet basic cache parameters for the device. 16609cbac4eSwizThe cache may be disabled 1670683880eSthorpej.Pq none , 1680683880eSthorpejthe read cache enabled 1690683880eSthorpej.Pq r , 1700683880eSthorpejthe write cache enabled 1710683880eSthorpej.Pq w , 1720683880eSthorpejor both read and write cache enabled 1730683880eSthorpej.Pq rw . 1740683880eSthorpejIf the drive's cache parameters are savable, specifying 1750683880eSthorpej.Ar save 1760683880eSthorpejafter the cache enable state will cause the parameters to be saved in 1770683880eSthorpejnon-volatile storage. 17839a1754cSwiz.It Cm flushcache 179*e8c872c0SrilligExplicitly flush the write cache. 18039a1754cSwiz.It Cm setspeed Ar speed 181e47fe82aSbouyerSet the highest speed that the optical drive should use for reading 182e47fe82aSbouyerdata. 183e47fe82aSbouyerThe units are multiples of a single speed CDROM (150 KB/s). 184e47fe82aSbouyerSpecify 0 to use the drive's fastest speed. 18539a1754cSwiz.It Cm getrealloc 186*e8c872c0SrilligReturn automatic reallocation parameters for the device. 187*e8c872c0Srillig.It Cm setrealloc Ar Cm none Ns | Ns Cm r Ns | Ns Cm w Ns | Ns Cm rw Op Ar save 188b0be1b67SflxdSet automatic reallocation parameters for the device. 189b0be1b67SflxdAutomatic reallocation may be disabled 190b0be1b67Sflxd.Pq none , 191b0be1b67Sflxdthe automatic read reallocation enabled 192b0be1b67Sflxd.Pq r , 193b0be1b67Sflxdthe automatic write reallocation enabled 194b0be1b67Sflxd.Pq w , 195b0be1b67Sflxdor both automatic read and write reallocation enabled 196b0be1b67Sflxd.Pq rw . 197b0be1b67SflxdIf the drive's automatic reallocation parameters are savable, specifying 198b0be1b67Sflxd.Ar save 199b0be1b67Sflxdafter the automatic reallocation enable state will cause the parameters to be 200b0be1b67Sflxdsaved in non-volatile storage. 201*e8c872c0Srillig.It Cm reportluns Ar Cm normal Ns | Ns Cm wellknown Ns | Ns Cm all Ns | Ns Ar # 202100b2229SmlelstvReport Logical Units provided by the drive. 203100b2229Smlelstv.Bl -hang -compact 204100b2229Smlelstv.It normal 205100b2229Smlelstvreport all but well-known logical units. 206100b2229SmlelstvThis is also the default. 207100b2229Smlelstv.It wellknown 208100b2229Smlelstvreport the well known logical units instead. E.g., 209100b2229Smlelstv.Bl -inset -compact 210100b2229Smlelstv.It 0xc101h 211100b2229SmlelstvAddressable objects 212100b2229Smlelstv.It 0xc102h 213100b2229SmlelstvAddressable objects associations 214100b2229Smlelstv.It 0xc103h 215100b2229SmlelstvSCSI target device identification 216100b2229Smlelstv.El 217100b2229Smlelstv.It all 218100b2229Smlelstvreport all logical units. 219100b2229Smlelstv.It # 220100b2229SmlelstvUse the given numeric select report value (0-255). 221100b2229Smlelstv.El 22239a1754cSwiz.El 223c9a47c22Sthorpej.Sh BUS COMMANDS 224c9a47c22SthorpejThe following commands are supported for SCSI busses: 22539a1754cSwiz.Bl -tag width scanXtargetXlunXX 22639a1754cSwiz.It Cm reset 22709cbac4eSwizReset the SCSI bus. 22809cbac4eSwizThis command is only supported if the host adapter supports the 229c9a47c22Sthorpej.Li SCBUSIORESET 230c9a47c22Sthorpejioctl. 23139a1754cSwiz.It Cm scan Ar target Ar lun 23209cbac4eSwizScan the SCSI bus for devices. 23309cbac4eSwizThis is useful if a device was not connected or powered 23409cbac4eSwizon when the system was booted. 23509cbac4eSwizThe 236d9371462Sthorpej.Ar target 237d9371462Sthorpejand 238d9371462Sthorpej.Ar lun 239d9371462Sthorpejarguments specify which SCSI target and lun on the bus is to be scanned. 2402829eb17SadEither may be wildcarded by specifying the keyword 2412829eb17Sad.Dq any 2422829eb17Sador 2432829eb17Sad.Dq all . 24439a1754cSwiz.It Cm detach Ar target Ar lun 24509cbac4eSwizDetach the specified device from the bus. 24609cbac4eSwizUseful if a device is powered down after use. 24709cbac4eSwizThe 24803fd5e67Sbouyer.Ar target 24903fd5e67Sbouyerand 25003fd5e67Sbouyer.Ar lun 25103fd5e67Sbouyerarguments have the same meaning as for the 25239a1754cSwiz.Cm scan 25303fd5e67Sbouyercommand, and may also be wildcarded. 25439a1754cSwiz.El 2555aa5c9faSjdolecek.Sh NOTES 256e6b54222SwizWhen scanning the SCSI bus, information about newly recognized devices 25709cbac4eSwizis printed to console. 25809cbac4eSwizNo information is printed for already probed devices. 259958ed46fShubertf.Sh FILES 260141d2190Skleink.Pa /dev/scsibus* 261141d2190Skleink- for commands operating on SCSI busses 262c9a47c22Sthorpej.Sh SEE ALSO 263c9a47c22Sthorpej.Xr ioctl 2 , 264c9a47c22Sthorpej.Xr cd 4 , 265c9a47c22Sthorpej.Xr ch 4 , 26634aff945Swiz.Xr scsi 4 , 267c9a47c22Sthorpej.Xr sd 4 , 2684fe147ddSjdolecek.Xr se 4 , 269c9a47c22Sthorpej.Xr ss 4 , 270c9a47c22Sthorpej.Xr st 4 , 2714ed261aeSerh.Xr uk 4 , 2724ed261aeSerh.Xr atactl 8 , 2734ed261aeSerh.Xr dkctl 8 274c9a47c22Sthorpej.Sh HISTORY 275c9a47c22SthorpejThe 276c9a47c22Sthorpej.Nm 277c9a47c22Sthorpejcommand first appeared in 278c9a47c22Sthorpej.Nx 1.4 . 279875bfce8Swiz.Sh AUTHORS 28039a1754cSwiz.An -nosplit 281875bfce8SwizThe 282875bfce8Swiz.Nm 28339a1754cSwizcommand was written by 28439a1754cSwiz.An Jason R. Thorpe 28539a1754cSwizof the Numerical Aerospace Simulation Facility, NASA Ames Research Center. 286