aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-11-03 14:30:39 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:22:40 -0500
commiteb44820c28bc9a042e1157b41c677018a8fdfc74 (patch)
treede027b3cd40533488805ef7ee8156f077cd2b7e5
parent3f48985823001c89c9bd5c5e57cc07530578dfcc (diff)
[SCSI] Add Documentation and integrate into docbook build
Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update lots of kerneldoc comments in drivers/scsi/*. Updated with comments from Stefan Richter, Stephen M. Cameron, James Bottomley and Randy Dunlap. Signed-off-by: Rob Landley <rob@landley.net> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/scsi_midlayer.tmpl409
-rw-r--r--drivers/scsi/constants.c1
-rw-r--r--drivers/scsi/hosts.c4
-rw-r--r--drivers/scsi/scsi.c183
-rw-r--r--drivers/scsi/scsi_devinfo.c34
-rw-r--r--drivers/scsi/scsi_error.c46
-rw-r--r--drivers/scsi/scsi_ioctl.c24
-rw-r--r--drivers/scsi/scsi_lib.c42
-rw-r--r--drivers/scsi/scsi_netlink.c19
-rw-r--r--drivers/scsi/scsi_proc.c110
-rw-r--r--drivers/scsi/scsi_scan.c32
-rw-r--r--drivers/scsi/scsi_transport_fc.c102
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c17
-rw-r--r--drivers/scsi/scsi_transport_sas.c40
-rw-r--r--drivers/scsi/scsi_transport_srp.c10
-rw-r--r--drivers/scsi/scsicam.c35
17 files changed, 821 insertions, 289 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 4953bc258729..c6c5e59daaca 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
11 procfs-guide.xml writing_usb_driver.xml \ 11 procfs-guide.xml writing_usb_driver.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml uio-howto.xml 14 genericirq.xml s390-drivers.xml uio-howto.xml scsi_midlayer.xml
15 15
16### 16###
17# The build process is as follows (targets): 17# The build process is as follows (targets):
diff --git a/Documentation/DocBook/scsi_midlayer.tmpl b/Documentation/DocBook/scsi_midlayer.tmpl
new file mode 100644
index 000000000000..6255930216b3
--- /dev/null
+++ b/Documentation/DocBook/scsi_midlayer.tmpl
@@ -0,0 +1,409 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="scsimid">
6 <bookinfo>
7 <title>SCSI Mid Layer Guide</title>
8
9 <authorgroup>
10 <author>
11 <firstname>James</firstname>
12 <surname>Bottomley</surname>
13 <affiliation>
14 <address>
15 <email>James.Bottomley@steeleye.com</email>
16 </address>
17 </affiliation>
18 </author>
19
20 <author>
21 <firstname>Rob</firstname>
22 <surname>Landley</surname>
23 <affiliation>
24 <address>
25 <email>rob@landley.net</email>
26 </address>
27 </affiliation>
28 </author>
29
30 </authorgroup>
31
32 <copyright>
33 <year>2007</year>
34 <holder>Linux Foundation</holder>
35 </copyright>
36
37 <legalnotice>
38 <para>
39 This documentation is free software; you can redistribute
40 it and/or modify it under the terms of the GNU General Public
41 License version 2.
42 </para>
43
44 <para>
45 This program is distributed in the hope that it will be
46 useful, but WITHOUT ANY WARRANTY; without even the implied
47 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
48 For more details see the file COPYING in the source
49 distribution of Linux.
50 </para>
51 </legalnotice>
52 </bookinfo>
53
54 <toc></toc>
55
56 <chapter id="intro">
57 <title>Introduction</title>
58 <sect1 id="protocol_vs_bus">
59 <title>Protocol vs bus</title>
60 <para>
61 Once upon a time, the Small Computer Systems Interface defined both
62 a parallel I/O bus and a data protocol to connect a wide variety of
63 peripherals (disk drives, tape drives, modems, printers, scanners,
64 optical drives, test equipment, and medical devices) to a host
65 computer.
66 </para>
67 <para>
68 Although the old parallel (fast/wide/ultra) SCSI bus has largely
69 fallen out of use, the SCSI command set is more widely used than ever
70 to communicate with devices over a number of different busses.
71 </para>
72 <para>
73 The <ulink url='http://www.t10.org/scsi-3.htm'>SCSI protocol</ulink>
74 is a big-endian peer-to-peer packet based protocol. SCSI commands
75 are 6, 10, 12, or 16 bytes long, often followed by an associated data
76 payload.
77 </para>
78 <para>
79 SCSI commands can be transported over just about any kind of bus, and
80 are the default protocol for storage devices attached to USB, SATA,
81 SAS, Fibre Channel, FireWire, and ATAPI devices. SCSI packets are
82 also commonly exchanged over Infiniband,
83 <ulink url='http://i2o.shadowconnect.com/faq.php'>I20</ulink>, TCP/IP
84 (<ulink url='http://en.wikipedia.org/wiki/ISCSI'>iSCSI</ulink>), even
85 <ulink url='http://cyberelk.net/tim/parport/parscsi.html'>Parallel
86 ports</ulink>.
87 </para>
88 </sect1>
89 <sect1 id="subsystem_design">
90 <title>Design of the Linux SCSI subsystem</title>
91 <para>
92 The SCSI subsystem uses a three layer design, with upper, mid, and low
93 layers. Every operation involving the SCSI subsystem (such as reading
94 a sector from a disk) uses one driver at each of the 3 levels: one
95 upper layer driver, one lower layer driver, and the scsi midlayer.
96 </para>
97 <para>
98 The SCSI upper layer provides the interface between userspace and the
99 kernel, in the form of block and char device nodes for I/O and
100 ioctl(). The SCSI lower layer contains drivers for specific hardware
101 devices.
102 </para>
103 <para>
104 In between is the SCSI mid-layer, analogous to a network routing
105 layer such as the IPv4 stack. The SCSI mid-layer routes a packet
106 based data protocol between the upper layer's /dev nodes and the
107 corresponding devices in the lower layer. It manages command queues,
108 provides error handling and power management functions, and responds
109 to ioctl() requests.
110 </para>
111 </sect1>
112 </chapter>
113
114 <chapter id="upper_layer">
115 <title>SCSI upper layer</title>
116 <para>
117 The upper layer supports the user-kernel interface by providing
118 device nodes.
119 </para>
120 <sect1 id="sd">
121 <title>sd (SCSI Disk)</title>
122 <para>sd (sd_mod.o)</para>
123<!-- !Idrivers/scsi/sd.c -->
124 </sect1>
125 <sect1 id="sr">
126 <title>sr (SCSI CD-ROM)</title>
127 <para>sr (sr_mod.o)</para>
128 </sect1>
129 <sect1 id="st">
130 <title>st (SCSI Tape)</title>
131 <para>st (st.o)</para>
132 </sect1>
133 <sect1 id="sg">
134 <title>sg (SCSI Generic)</title>
135 <para>sg (sg.o)</para>
136 </sect1>
137 <sect1 id="ch">
138 <title>ch (SCSI Media Changer)</title>
139 <para>ch (ch.c)</para>
140 </sect1>
141 </chapter>
142
143 <chapter id="mid_layer">
144 <title>SCSI mid layer</title>
145
146 <sect1 id="midlayer_implementation">