Lines Matching full:scsi
4 SCSI mid_level - lower_level driver interface
9 This document outlines the interface between the Linux SCSI mid level and
10 SCSI lower level drivers. Lower level drivers (LLDs) are variously called
13 single SCSI initiator port on a SCSI transport. An "initiator" port
14 (SCSI terminology, see SAM-3 at http://www.t10.org) sends SCSI commands
15 to "target" SCSI ports (e.g. disks). There can be many LLDs in a running
17 SCSI HBAs. Some HBAs contain multiple hosts.
19 In some cases the SCSI transport is an external bus that already has
21 SCSI subsystem LLD is a software bridge to the other driver subsystem.
26 For example, the aic7xxx LLD controls Adaptec SCSI parallel interface
34 a SCSI host and a PCI device is common but not required (e.g. with
37 The SCSI mid level isolates an LLD from other layers such as the SCSI
44 There is a SCSI documentation directory within the kernel source tree,
45 typically Documentation/scsi . Most documents are in plain
48 at http://web.archive.org/web/20070107183357rn_1/sg.torque.net/scsi/.
49 Many LLDs are documented there (e.g. aic7xxx.txt). The SCSI mid-level is
50 briefly described in scsi.txt which contains a url to a document
51 describing the SCSI subsystem in the lk 2.4 series. Two upper level
52 drivers have documents in that directory: st.txt (SCSI tape driver) and
53 scsi-generic.txt (for the sg driver).
62 Traditionally an LLD for the SCSI subsystem has been at least two files in
63 the drivers/scsi directory. For example, a driver called "xyz" has a header
69 their own directory under the drivers/scsi directory.
72 drivers/scsi directory) will need some attention: Makefile and Kconfig .
83 preferred as it can handle both traditional SCSI equipment that is
84 permanently connected as well as modern "SCSI" devices (e.g. USB or
88 An LLD interfaces to the SCSI subsystem several ways:
125 In this model an LLD controls when SCSI hosts are introduced and removed
126 from the SCSI subsystem. Hosts can be introduced as early as driver
131 with the SCSI mid level.
137 registered with sysfs at this point. The SCSI mid level first becomes
143 scsi devices of which only the first 2 respond::
145 HBA PROBE: assume 2 SCSI devices found in scan
162 *** For scsi devices that the mid level tries to scan but do not
174 HBA REMOVE: assume 2 SCSI devices attached
188 Hot unplugging an HBA that controls a disk which is processing SCSI
194 The hotplug concept may be extended to SCSI devices. Currently, when an
195 HBA is added, the scsi_scan_host() function causes a scan for SCSI devices
196 attached to the HBA's SCSI transport. On newer SCSI transports the HBA
197 may become aware of a new SCSI device _after_ the scan has completed.
198 An LLD can use this sequence to make the mid level aware of a SCSI device::
200 SCSI DEVICE hotplug
208 In a similar fashion, an LLD may become aware that a SCSI device has been
210 existing SCSI transports (e.g. SPI) may not become aware that a SCSI
211 device has been removed until a subsequent SCSI command fails which will
213 detects the removal of a SCSI device can instigate its removal from
216 SCSI DEVICE hot unplug
233 across the various SCSI layers which use them. Previously such instances
255 across the various SCSI layers which use them. Previously such instances
257 towards the end of include/scsi/scsi_device.h . If an LLD wants to keep
288 These functions are supplied by the SCSI mid level for use by LLDs.
291 arrange for the SCSI mid level to be loaded and initialized before any LLD
297 - scsi_add_device - creates new scsi device (lu) instance
299 - scsi_change_queue_depth - change the queue depth on a SCSI device
305 - scsi_register - create and register a scsi host adapter instance.
306 - scsi_remove_device - detach and remove a SCSI device
307 - scsi_remove_host - detach and remove all SCSI devices owned by host
308 - scsi_report_bus_reset - report scsi _bus_ reset observed
309 - scsi_scan_host - scan SCSI bus
318 * scsi_add_device - creates new scsi device (lu) instance
319 * @shost: pointer to scsi host instance
330 * Notes: This call is usually performed internally during a scsi
332 * should only be called if the HBA becomes aware of a new scsi
337 * Defined in: drivers/scsi/scsi_scan.c
346 * @shost: pointer to scsi host instance
347 * @dev: pointer to struct device of type scsi class
360 * Defined in: drivers/scsi/hosts.c
366 * scsi_change_queue_depth - allow LLD to change queue depth on a SCSI device
367 * @sdev: pointer to SCSI device to change queue depth on
376 * Notes: Can be invoked any time on a SCSI device controlled by this
380 * Defined in: drivers/scsi/scsi.c [see source code for more notes]
396 * Defined in: drivers/scsi/scsicam.c
413 * Defined in: drivers/scsi/scsi_lib.c
419 * scsi_host_alloc - create a scsi host adapter instance and perform basic
421 * @sht: pointer to scsi host template
429 * Notes: When this call returns to the LLD, the SCSI bus scan on
437 * Defined in: drivers/scsi/hosts.c .
453 * Defined in: drivers/scsi/hosts.c
472 * Defined in: drivers/scsi/hosts.c
478 * scsi_register - create and register a scsi host adapter instance.
479 * @sht: pointer to scsi host template
487 * Notes: When this call returns to the LLD, the SCSI bus scan on
492 * Defined in: drivers/scsi/hosts.c .
499 * scsi_remove_device - detach and remove a SCSI device
500 * @sdev: a pointer to a scsi device instance
506 * Notes: If an LLD becomes aware that a scsi device (lu) has
508 * the removal of that scsi device. If successful this call will
512 * Defined in: drivers/scsi/scsi_sysfs.c .
518 * scsi_remove_host - detach and remove all SCSI devices owned by host
519 * @shost: a pointer to a scsi host instance
529 * Defined in: drivers/scsi/hosts.c .
535 * scsi_report_bus_reset - report scsi _bus_ reset observed
536 * @shost: a pointer to a scsi host involved
537 * @channel: channel (within) host on which scsi bus reset occurred
549 * Defined in: drivers/scsi/scsi_error.c .
555 * scsi_scan_host - scan SCSI bus
556 * @shost: a pointer to a scsi host instance
562 * Defined in: drivers/scsi/scsi_scan.c
571 * @sdev: pointer to SCSI device instance
572 * @depth: Current number of outstanding SCSI commands on this device,
585 * Defined in: drivers/scsi/scsi.c .
599 * Defined in: drivers/scsi/scsi_lib.c .
606 * @shp: pointer to scsi host instance to unregister.
617 * Defined in: drivers/scsi/hosts.c .
642 The interface functions are also described in the include/scsi/scsi_host.h
653 - eh_bus_reset_handler - issue SCSI bus reset
654 - eh_device_reset_handler - issue SCSI device reset
658 - proc_info - supports /proc/scsi/{driver_name}/{host_no}
659 - queuecommand - queue scsi command, invoke 'done' on completion
669 * @sdev: pointer to scsi device context (defined in
670 * include/scsi/scsi_device.h)
743 * eh_bus_reset_handler - issue SCSI bus reset
744 * @scp: SCSI bus that contains this device should be reset
761 * eh_device_reset_handler - issue SCSI device reset
762 * @scp: identifies SCSI device to be reset
780 * @scp: SCSI host that contains this device should be reset
846 * Notes: The SCSI subsystem uses a "trickle down" ioctl model.
849 * the 'cmd' then it is passed to the SCSI mid level. If the SCSI
860 * proc_info - supports /proc/scsi/{driver_name}/{host_no}
870 * (e.g. "echo some_string > /proc/scsi/xyz/2")
872 * (e.g. "cat /proc/scsi/xyz/2")
882 * support can now be configured out of the scsi subsystem.
891 * queuecommand - queue scsi command, invoke scp->scsi_done on completion
892 * @shost: pointer to the scsi host object
893 * @scp: pointer to scsi command object
947 * response to a SCSI INQUIRY) the scp->scsi_done callback may be
949 * callback is not invoked within a certain period the SCSI mid
975 * prior to its initial scan. The corresponding scsi device may not
980 * For more details see the include/scsi/scsi_host.h file.
1003 * For more details see the include/scsi/scsi_host.h file.
1049 - name used in "/proc/scsi/<proc_name>/<host_no>" and
1056 SCSI commands into an LLD.
1058 The structure is defined and commented in include/scsi/scsi_host.h
1081 - scsi id of host (scsi initiator) or -1 if not known
1088 in a single SCSI command. The default value of 0 leads
1126 The scsi_host structure is defined in include/scsi/scsi_host.h
1130 Generally, there is one instance of this structure for each SCSI logical unit
1131 on a host. Scsi devices connected to a host are uniquely identified by a
1133 The structure is defined in include/scsi/scsi_device.h
1137 Instances of this structure convey SCSI commands to the LLD and responses
1138 back to the mid level. The SCSI mid level will ensure that no more SCSI
1141 be at least one instance of struct scsi_cmnd available for each SCSI device.
1145 - array containing SCSI command
1147 - length (in bytes) of SCSI command
1165 SCSI command is completed (successfully or otherwise).
1173 data (if any) has been transferred to or from the SCSI
1175 can be viewed as 2 related bytes. The SCSI status value is
1176 in the LSB. See include/scsi/scsi.h status_byte() and
1180 should be written when the SCSI status (LSB of 'result')
1184 contains a valid SCSI sense buffer; otherwise the mid
1185 level will issue a REQUEST_SENSE SCSI command to
1199 interesting case is data transfers from a SCSI target
1209 It is recommended that a LLD set 'resid' on data transfers from a SCSI
1224 The scsi_cmnd structure is defined in include/scsi/scsi_cmnd.h
1242 with the completion of a SCSI command" when a status of CHECK CONDITION
1246 a) instructing the SCSI protocol (e.g. SCSI Parallel Interface (SPI))
1267 one per SCSI host.
1273 In the 2.4 series the SCSI subsystem configuration descriptions were
1276 the SCSI subsystem now has its own (much smaller) drivers/scsi/Kconfig