aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/kernel-api.tmpl10
-rw-r--r--Documentation/DocBook/kernel-locking.tmpl32
-rw-r--r--Documentation/DocBook/rapidio.tmpl6
-rw-r--r--Documentation/DocBook/s390-drivers.tmpl20
-rw-r--r--Documentation/DocBook/scsi.tmpl409
-rw-r--r--Documentation/DocBook/uio-howto.tmpl90
-rw-r--r--Documentation/DocBook/videobook.tmpl9
8 files changed, 485 insertions, 93 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 054a7ecf64c6..6a0ad4715e9f 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 14 genericirq.xml s390-drivers.xml uio-howto.xml scsi.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/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index aa38cc5692a0..059aaf20951a 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -165,6 +165,7 @@ X!Ilib/string.c
165!Emm/vmalloc.c 165!Emm/vmalloc.c
166!Imm/page_alloc.c 166!Imm/page_alloc.c
167!Emm/mempool.c 167!Emm/mempool.c
168!Emm/dmapool.c
168!Emm/page-writeback.c 169!Emm/page-writeback.c
169!Emm/truncate.c 170!Emm/truncate.c
170 </sect1> 171 </sect1>
@@ -371,7 +372,6 @@ X!Iinclude/linux/device.h
371!Edrivers/base/class.c 372!Edrivers/base/class.c
372!Edrivers/base/firmware_class.c 373!Edrivers/base/firmware_class.c
373!Edrivers/base/transport_class.c 374!Edrivers/base/transport_class.c
374!Edrivers/base/dmapool.c
375<!-- Cannot be included, because 375<!-- Cannot be included, because
376 attribute_container_add_class_device_adapter 376 attribute_container_add_class_device_adapter
377 and attribute_container_classdev_to_container 377 and attribute_container_classdev_to_container
@@ -419,7 +419,13 @@ X!Edrivers/pnp/system.c
419 419
420 <chapter id="blkdev"> 420 <chapter id="blkdev">
421 <title>Block Devices</title> 421 <title>Block Devices</title>
422!Eblock/ll_rw_blk.c 422!Eblock/blk-core.c
423!Eblock/blk-map.c
424!Iblock/blk-sysfs.c
425!Eblock/blk-settings.c
426!Eblock/blk-exec.c
427!Eblock/blk-barrier.c
428!Eblock/blk-tag.c
423 </chapter> 429 </chapter>
424 430
425 <chapter id="chrdev"> 431 <chapter id="chrdev">
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
index 01825ee7db64..2e9d6b41f034 100644
--- a/Documentation/DocBook/kernel-locking.tmpl
+++ b/Documentation/DocBook/kernel-locking.tmpl
@@ -717,7 +717,7 @@ used, and when it gets full, throws out the least used one.
717 <para> 717 <para>
718For our first example, we assume that all operations are in user 718For our first example, we assume that all operations are in user
719context (ie. from system calls), so we can sleep. This means we can 719context (ie. from system calls), so we can sleep. This means we can
720use a semaphore to protect the cache and all the objects within 720use a mutex to protect the cache and all the objects within
721it. Here's the code: 721it. Here's the code:
722 </para> 722 </para>
723 723
@@ -725,7 +725,7 @@ it. Here's the code:
725#include &lt;linux/list.h&gt; 725#include &lt;linux/list.h&gt;
726#include &lt;linux/slab.h&gt; 726#include &lt;linux/slab.h&gt;
727#include &lt;linux/string.h&gt; 727#include &lt;linux/string.h&gt;
728#include &lt;asm/semaphore.h&gt; 728#include &lt;linux/mutex.h&gt;
729#include &lt;asm/errno.h&gt; 729#include &lt;asm/errno.h&gt;
730 730
731struct object 731struct object
@@ -737,7 +737,7 @@ struct object
737}; 737};
738 738
739/* Protects the cache, cache_num, and the objects within it */ 739/* Protects the cache, cache_num, and the objects within it */
740static DECLARE_MUTEX(cache_lock); 740static DEFINE_MUTEX(cache_lock);
741static LIST_HEAD(cache); 741static LIST_HEAD(cache);
742static unsigned int cache_num = 0; 742static unsigned int cache_num = 0;
743#define MAX_CACHE_SIZE 10 743#define MAX_CACHE_SIZE 10
@@ -789,17 +789,17 @@ int cache_add(int id, const char *name)
789 obj-&gt;id = id; 789 obj-&gt;id = id;
790 obj-&gt;popularity = 0; 790 obj-&gt;popularity = 0;
791 791
792 down(&amp;cache_lock); 792 mutex_lock(&amp;cache_lock);
793 __cache_add(obj); 793 __cache_add(obj);
794 up(&amp;cache_lock); 794 mutex_unlock(&amp;cache_lock);
795 return 0; 795 return 0;
796} 796}
797 797
798void cache_delete(int id) 798void cache_delete(int id)
799{ 799{
800 down(&amp;cache_lock); 800 mutex_lock(&amp;cache_lock);
801 __cache_delete(__cache_find(id)); 801 __cache_delete(__cache_find(id));
802 up(&amp;cache_lock); 802 mutex_unlock(&amp;cache_lock);
803} 803}
804 804
805int cache_find(int id, char *name) 805int cache_find(int id, char *name)
@@ -807,13 +807,13 @@ int cache_find(int id, char *name)
807 struct object *obj; 807 struct object *obj;
808 int ret = -ENOENT; 808 int ret = -ENOENT;
809 809
810 down(&amp;cache_lock); 810 mutex_lock(&amp;cache_lock);
811 obj = __cache_find(id); 811 obj = __cache_find(id);
812 if (obj) { 812 if (obj) {
813 ret = 0; 813 ret = 0;
814 strcpy(name, obj-&gt;name); 814 strcpy(name, obj-&gt;name);
815 } 815 }
816 up(&amp;cache_lock); 816 mutex_unlock(&amp;cache_lock);
817 return ret; 817 return ret;
818} 818}
819</programlisting> 819</programlisting>
@@ -853,7 +853,7 @@ The change is shown below, in standard patch format: the
853 int popularity; 853 int popularity;
854 }; 854 };
855 855
856-static DECLARE_MUTEX(cache_lock); 856-static DEFINE_MUTEX(cache_lock);
857+static spinlock_t cache_lock = SPIN_LOCK_UNLOCKED; 857+static spinlock_t cache_lock = SPIN_LOCK_UNLOCKED;
858 static LIST_HEAD(cache); 858 static LIST_HEAD(cache);
859 static unsigned int cache_num = 0; 859 static unsigned int cache_num = 0;
@@ -870,22 +870,22 @@ The change is shown below, in standard patch format: the
870 obj-&gt;id = id; 870 obj-&gt;id = id;
871 obj-&gt;popularity = 0; 871 obj-&gt;popularity = 0;
872 872
873- down(&amp;cache_lock); 873- mutex_lock(&amp;cache_lock);
874+ spin_lock_irqsave(&amp;cache_lock, flags); 874+ spin_lock_irqsave(&amp;cache_lock, flags);
875 __cache_add(obj); 875 __cache_add(obj);
876- up(&amp;cache_lock); 876- mutex_unlock(&amp;cache_lock);
877+ spin_unlock_irqrestore(&amp;cache_lock, flags); 877+ spin_unlock_irqrestore(&amp;cache_lock, flags);
878 return 0; 878 return 0;
879 } 879 }
880 880
881 void cache_delete(int id) 881 void cache_delete(int id)
882 { 882 {
883- down(&amp;cache_lock); 883- mutex_lock(&amp;cache_lock);
884+ unsigned long flags; 884+ unsigned long flags;
885+ 885+
886+ spin_lock_irqsave(&amp;cache_lock, flags); 886+ spin_lock_irqsave(&amp;cache_lock, flags);
887 __cache_delete(__cache_find(id)); 887 __cache_delete(__cache_find(id));
888- up(&amp;cache_lock); 888- mutex_unlock(&amp;cache_lock);
889+ spin_unlock_irqrestore(&amp;cache_lock, flags); 889+ spin_unlock_irqrestore(&amp;cache_lock, flags);
890 } 890 }
891 891
@@ -895,14 +895,14 @@ The change is shown below, in standard patch format: the
895 int ret = -ENOENT; 895 int ret = -ENOENT;
896+ unsigned long flags; 896+ unsigned long flags;
897 897
898- down(&amp;cache_lock); 898- mutex_lock(&amp;cache_lock);
899+ spin_lock_irqsave(&amp;cache_lock, flags); 899+ spin_lock_irqsave(&amp;cache_lock, flags);
900 obj = __cache_find(id); 900 obj = __cache_find(id);
901 if (obj) { 901 if (obj) {
902 ret = 0; 902 ret = 0;
903 strcpy(name, obj-&gt;name); 903 strcpy(name, obj-&gt;name);
904 } 904 }
905- up(&amp;cache_lock); 905- mutex_unlock(&amp;cache_lock);
906+ spin_unlock_irqrestore(&amp;cache_lock, flags); 906+ spin_unlock_irqrestore(&amp;cache_lock, flags);
907 return ret; 907 return ret;
908 } 908 }
diff --git a/Documentation/DocBook/rapidio.tmpl b/Documentation/DocBook/rapidio.tmpl
index 1becf27ba27e..a8b88c47e809 100644
--- a/Documentation/DocBook/rapidio.tmpl
+++ b/Documentation/DocBook/rapidio.tmpl
@@ -133,9 +133,9 @@
133!Idrivers/rapidio/rio-sysfs.c 133!Idrivers/rapidio/rio-sysfs.c
134 </sect1> 134 </sect1>
135 <sect1><title>PPC32 support</title> 135 <sect1><title>PPC32 support</title>
136!Iarch/ppc/kernel/rio.c 136!Iarch/powerpc/kernel/rio.c
137!Earch/ppc/syslib/ppc85xx_rio.c 137!Earch/powerpc/sysdev/fsl_rio.c
138!Iarch/ppc/syslib/ppc85xx_rio.c 138!Iarch/powerpc/sysdev/fsl_rio.c
139 </sect1> 139 </sect1>
140 </chapter> 140 </chapter>
141 141
diff --git a/Documentation/DocBook/s390-drivers.tmpl b/Documentation/DocBook/s390-drivers.tmpl
index 254e769282a4..4acc73240a6d 100644
--- a/Documentation/DocBook/s390-drivers.tmpl
+++ b/Documentation/DocBook/s390-drivers.tmpl
@@ -59,7 +59,7 @@
59 <title>Introduction</title> 59 <title>Introduction</title>
60 <para> 60 <para>
61 This document describes the interfaces available for device drivers that 61 This document describes the interfaces available for device drivers that
62 drive s390 based channel attached devices. This includes interfaces for 62 drive s390 based channel attached I/O devices. This includes interfaces for
63 interaction with the hardware and interfaces for interacting with the 63 interaction with the hardware and interfaces for interacting with the
64 common driver core. Those interfaces are provided by the s390 common I/O 64 common driver core. Those interfaces are provided by the s390 common I/O
65 layer. 65 layer.
@@ -86,9 +86,10 @@
86 The ccw bus typically contains the majority of devices available to 86 The ccw bus typically contains the majority of devices available to
87 a s390 system. Named after the channel command word (ccw), the basic 87 a s390 system. Named after the channel command word (ccw), the basic
88 command structure used to address its devices, the ccw bus contains 88 command structure used to address its devices, the ccw bus contains
89 so-called channel attached devices. They are addressed via subchannels, 89 so-called channel attached devices. They are addressed via I/O
90 visible on the css bus. A device driver, however, will never interact 90 subchannels, visible on the css bus. A device driver for
91 with the subchannel directly, but only via the device on the ccw bus, 91 channel-attached devices, however, will never interact with the
92 subchannel directly, but only via the I/O device on the ccw bus,
92 the ccw device. 93 the ccw device.
93 </para> 94 </para>
94 <sect1 id="channelIO"> 95 <sect1 id="channelIO">
@@ -146,4 +147,15 @@
146 </sect1> 147 </sect1>
147 </chapter> 148 </chapter>
148 149
150 <chapter id="genericinterfaces">
151 <title>Generic interfaces</title>
152 <para>
153 Some interfaces are available to other drivers that do not necessarily
154 have anything to do with the busses described above, but still are
155 indirectly using basic infrastructure in the common I/O layer.
156 One example is the support for adapter interrupts.
157 </para>
158!Edrivers/s390/cio/airq.c
159 </chapter>
160
149</book> 161</book>
diff --git a/Documentation/DocBook/scsi.tmpl b/Documentation/DocBook/scsi.tmpl
new file mode 100644
index 000000000000..f299ab182bbe
--- /dev/null
+++ b/Documentation/DocBook/scsi.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 Interfaces 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">
147 <title>SCSI midlayer implementation</title>
148 <sect2 id="scsi_device.h">
149 <title>include/scsi/scsi_device.h</title>
150 <para>
151 </para>
152!Iinclude/scsi/scsi_device.h
153 </sect2>
154
155 <sect2 id="scsi.c">
156 <title>drivers/scsi/scsi.c</title>
157 <para>Main file for the SCSI midlayer.</para>
158!Edrivers/scsi/scsi.c
159 </sect2>
160 <sect2 id="scsicam.c">
161 <title>drivers/scsi/scsicam.c</title>
162 <para>
163 <ulink url='http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf'>SCSI
164 Common Access Method</ulink> support functions, for use with
165 HDIO_GETGEO, etc.
166 </para>
167!Edrivers/scsi/scsicam.c
168 </sect2>
169 <sect2 id="scsi_error.c">
170 <title>drivers/scsi/scsi_error.c</title>
171 <para>Common SCSI error/timeout handling routines.</para>
172!Edrivers/scsi/scsi_error.c
173 </sect2>
174 <sect2 id="scsi_devinfo.c">
175 <title>drivers/scsi/scsi_devinfo.c</title>
176 <para>
177 Manage scsi_dev_info_list, which tracks blacklisted and whitelisted
178 devices.
179 </para>
180!Idrivers/scsi/scsi_devinfo.c
181 </sect2>
182 <sect2 id="scsi_ioctl.c">
183 <title>drivers/scsi/scsi_ioctl.c</title>
184 <para>
185 Handle ioctl() calls for SCSI devices.
186 </para>
187!Edrivers/scsi/scsi_ioctl.c
188 </sect2>
189 <sect2 id="scsi_lib.c">
190 <title>drivers/scsi/scsi_lib.c</title>
191 <para>
192 SCSI queuing library.
193 </para>
194!Edrivers/scsi/scsi_lib.c
195 </sect2>
196 <sect2 id="scsi_lib_dma.c">
197 <title>drivers/scsi/scsi_lib_dma.c</title>
198 <para>
199 SCSI library functions depending on DMA
200 (map and unmap scatter-gather lists).
201 </para>
202!Edrivers/scsi/scsi_lib_dma.c
203 </sect2>
204 <sect2 id="scsi_module.c">
205 <title>drivers/scsi/scsi_module.c</title>
206 <para>
207 The file drivers/scsi/scsi_module.c contains legacy support for
208 old-style host templates. It should never be used by any new driver.
209 </para>
210 </sect2>
211 <sect2 id="scsi_proc.c">
212 <title>drivers/scsi/scsi_proc.c</title>
213 <para>
214 The functions in this file provide an interface between
215 the PROC file system and the SCSI device drivers
216 It is mainly used for debugging, statistics and to pass
217 information directly to the lowlevel driver.
218
219 I.E. plumbing to manage /proc/scsi/*
220 </para>
221!Idrivers/scsi/scsi_proc.c
222 </sect2>
223 <sect2 id="scsi_netlink.c">
224 <title>drivers/scsi/scsi_netlink.c</title>
225 <para>
226 Infrastructure to provide async events from transports to userspace
227 via netlink, using a single NETLINK_SCSITRANSPORT protocol for all
228 transports.
229
230 See <ulink url='http://marc.info/?l=linux-scsi&amp;m=115507374832500&amp;w=2'>the
231 original patch submission</ulink> for more details.
232 </para>
233!Idrivers/scsi/scsi_netlink.c
234 </sect2>
235 <sect2 id="scsi_scan.c">
236 <title>drivers/scsi/scsi_scan.c</title>
237 <para>
238 Scan a host to determine which (if any) devices are attached.
239
240 The general scanning/probing algorithm is as follows, exceptions are
241 made to it depending on device specific flags, compilation options,
242 and global variable (boot or module load time) settings.
243
244 A specific LUN is scanned via an INQUIRY command; if the LUN has a
245 device attached, a scsi_device is allocated and setup for it.
246
247 For every id of every channel on the given host, start by scanning
248 LUN 0. Skip hosts that don't respond at all to a scan of LUN 0.
249 Otherwise, if LUN 0 has a device attached, allocate and setup a
250 scsi_device for it. If target is SCSI-3 or up, issue a REPORT LUN,
251 and scan all of the LUNs returned by the REPORT LUN; else,
252 sequentially scan LUNs up until some maximum is reached, or a LUN is
253 seen that cannot have a device attached to it.
254 </para>
255!Idrivers/scsi/scsi_scan.c
256 </sect2>
257 <sect2 id="scsi_sysctl.c">
258 <title>drivers/scsi/scsi_sysctl.c</title>
259 <para>
260 Set up the sysctl entry: "/dev/scsi/logging_level"
261 (DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level.
262 </para>
263 </sect2>
264 <sect2 id="scsi_sysfs.c">
265 <title>drivers/scsi/scsi_sysfs.c</title>
266 <para>
267 SCSI sysfs interface routines.
268 </para>
269!Edrivers/scsi/scsi_sysfs.c
270 </sect2>
271 <sect2 id="hosts.c">
272 <title>drivers/scsi/hosts.c</title>
273 <para>
274 mid to lowlevel SCSI driver interface
275 </para>
276!Edrivers/scsi/hosts.c
277 </sect2>
278 <sect2 id="constants.c">
279 <title>drivers/scsi/constants.c</title>
280 <para>
281 mid to lowlevel SCSI driver interface
282 </para>
283!Edrivers/scsi/constants.c
284 </sect2>
285 </sect1>
286
287 <sect1 id="Transport_classes">
288 <title>Transport classes</title>
289 <para>
290 Transport classes are service libraries for drivers in the SCSI
291 lower layer, which expose transport attributes in sysfs.
292 </para>
293 <sect2 id="Fibre_Channel_transport">
294 <title>Fibre Channel transport</title>
295 <para>
296 The file drivers/scsi/scsi_transport_fc.c defines transport attributes
297 for Fibre Channel.
298 </para>
299!Edrivers/scsi/scsi_transport_fc.c
300 </sect2>
301 <sect2 id="iSCSI_transport">
302 <title>iSCSI transport class</title>
303 <para>
304 The file drivers/scsi/scsi_transport_iscsi.c defines transport
305 attributes for the iSCSI class, which sends SCSI packets over TCP/IP
306 connections.
307 </para>
308!Edrivers/scsi/scsi_transport_iscsi.c
309 </sect2>
310 <sect2 id="SAS_transport">
311 <title>Serial Attached SCSI (SAS) transport class</title>
312 <para>
313 The file drivers/scsi/scsi_transport_sas.c defines transport
314 attributes for Serial Attached SCSI, a variant of SATA aimed at
315 large high-end systems.
316 </para>
317 <para>
318 The SAS transport class contains common code to deal with SAS HBAs,
319 an aproximated representation of SAS topologies in the driver model,
320 and various sysfs attributes to expose these topologies and managment
321 interfaces to userspace.
322 </para>
323 <para>
324 In addition to the basic SCSI core objects this transport class
325 introduces two additional intermediate objects: The SAS PHY
326 as represented by struct sas_phy defines an "outgoing" PHY on
327 a SAS HBA or Expander, and the SAS remote PHY represented by
328 struct sas_rphy defines an "incoming" PHY on a SAS Expander or
329 end device. Note that this is purely a software concept, the
330 underlying hardware for a PHY and a remote PHY is the exactly
331 the same.
332 </para>
333 <para>
334 There is no concept of a SAS port in this code, users can see
335 what PHYs form a wide port based on the port_identifier attribute,
336 which is the same for all PHYs in a port.
337 </para>
338!Edrivers/scsi/scsi_transport_sas.c
339 </sect2>
340 <sect2 id="SATA_transport">
341 <title>SATA transport class</title>
342 <para>
343 The SATA transport is handled by libata, which has its own book of
344 documentation in this directory.
345 </para>
346 </sect2>
347 <sect2 id="SPI_transport">
348 <title>Parallel SCSI (SPI) transport class</title>
349 <para>
350 The file drivers/scsi/scsi_transport_spi.c defines transport
351 attributes for traditional (fast/wide/ultra) SCSI busses.
352 </para>
353!Edrivers/scsi/scsi_transport_spi.c
354 </sect2>
355 <sect2 id="SRP_transport">
356 <title>SCSI RDMA (SRP) transport class</title>
357 <para>
358 The file drivers/scsi/scsi_transport_srp.c defines transport
359 attributes for SCSI over Remote Direct Memory Access.
360 </para>
361!Edrivers/scsi/scsi_transport_srp.c
362 </sect2>
363 </sect1>
364
365 </chapter>
366
367 <chapter id="lower_layer">
368 <title>SCSI lower layer</title>
369 <sect1 id="hba_drivers">
370 <title>Host Bus Adapter transport types</title>
371 <para>
372 Many modern device controllers use the SCSI command set as a protocol to
373 communicate with their devices through many different types of physical
374 connections.
375 </para>
376 <para>
377 In SCSI language a bus capable of carrying SCSI commands is
378 called a "transport", and a controller connecting to such a bus is
379 called a "host bus adapter" (HBA).
380 </para>
381 <sect2 id="scsi_debug.c">
382 <title>Debug transport</title>
383 <para>
384 The file drivers/scsi/scsi_debug.c simulates a host adapter with a
385 variable number of disks (or disk like devices) attached, sharing a
386 common amount of RAM. Does a lot of checking to make sure that we are
387 not getting blocks mixed up, and panics the kernel if anything out of
388 the ordinary is seen.
389 </para>
390 <para>
391 To be more realistic, the simulated devices have the transport
392 attributes of SAS disks.
393 </para>
394 <para>
395 For documentation see
396 <ulink url='http://www.torque.net/sg/sdebug26.html'>http://www.torque.net/sg/sdebug26.html</ulink>
397 </para>
398<!-- !Edrivers/scsi/scsi_debug.c -->
399 </sect2>
400 <sect2 id="todo">
401 <title>todo</title>
402 <para>Parallel (fast/wide/ultra) SCSI, USB, SATA,
403 SAS, Fibre Channel, FireWire, ATAPI devices, Infiniband,
404 I20, iSCSI, Parallel ports, netlink...
405 </para>
406 </sect2>
407 </sect1>
408 </chapter>
409</book>
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index c119484258b8..fdd7f4f887b7 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -30,6 +30,12 @@
30 30
31<revhistory> 31<revhistory>
32 <revision> 32 <revision>
33 <revnumber>0.4</revnumber>
34 <date>2007-11-26</date>
35 <authorinitials>hjk</authorinitials>
36 <revremark>Removed section about uio_dummy.</revremark>
37 </revision>
38 <revision>
33 <revnumber>0.3</revnumber> 39 <revnumber>0.3</revnumber>
34 <date>2007-04-29</date> 40 <date>2007-04-29</date>
35 <authorinitials>hjk</authorinitials> 41 <authorinitials>hjk</authorinitials>
@@ -94,6 +100,26 @@ interested in translating it, please email me
94 user space. This simplifies development and reduces the risk of 100 user space. This simplifies development and reduces the risk of
95 serious bugs within a kernel module. 101 serious bugs within a kernel module.
96 </para> 102 </para>
103 <para>
104 Please note that UIO is not an universal driver interface. Devices
105 that are already handled well by other kernel subsystems (like
106 networking or serial or USB) are no candidates for an UIO driver.
107 Hardware that is ideally suited for an UIO driver fulfills all of
108 the following:
109 </para>
110<itemizedlist>
111<listitem>
112 <para>The device has memory that can be mapped. The device can be
113 controlled completely by writing to this memory.</para>
114</listitem>
115<listitem>
116 <para>The device usually generates interrupts.</para>
117</listitem>
118<listitem>
119 <para>The device does not fit into one of the standard kernel
120 subsystems.</para>
121</listitem>
122</itemizedlist>
97</sect1> 123</sect1>
98 124
99<sect1 id="thanks"> 125<sect1 id="thanks">
@@ -174,8 +200,9 @@ interested in translating it, please email me
174 For cards that don't generate interrupts but need to be 200 For cards that don't generate interrupts but need to be
175 polled, there is the possibility to set up a timer that 201 polled, there is the possibility to set up a timer that
176 triggers the interrupt handler at configurable time intervals. 202 triggers the interrupt handler at configurable time intervals.
177 See <filename>drivers/uio/uio_dummy.c</filename> for an 203 This interrupt simulation is done by calling
178 example of this technique. 204 <function>uio_event_notify()</function>
205 from the timer's event handler.
179 </para> 206 </para>
180 207
181 <para> 208 <para>
@@ -263,63 +290,11 @@ offset = N * getpagesize();
263</sect1> 290</sect1>
264</chapter> 291</chapter>
265 292
266<chapter id="using-uio_dummy" xreflabel="Using uio_dummy">
267<?dbhtml filename="using-uio_dummy.html"?>
268<title>Using uio_dummy</title>
269 <para>
270 Well, there is no real use for uio_dummy. Its only purpose is
271 to test most parts of the UIO system (everything except
272 hardware interrupts), and to serve as an example for the
273 kernel module that you will have to write yourself.
274 </para>
275
276<sect1 id="what_uio_dummy_does">
277<title>What uio_dummy does</title>
278 <para>
279 The kernel module <filename>uio_dummy.ko</filename> creates a
280 device that uses a timer to generate periodic interrupts. The
281 interrupt handler does nothing but increment a counter. The
282 driver adds two custom attributes, <varname>count</varname>
283 and <varname>freq</varname>, that appear under
284 <filename>/sys/devices/platform/uio_dummy/</filename>.
285 </para>
286
287 <para>
288 The attribute <varname>count</varname> can be read and
289 written. The associated file
290 <filename>/sys/devices/platform/uio_dummy/count</filename>
291 appears as a normal text file and contains the total number of
292 timer interrupts. If you look at it (e.g. using
293 <function>cat</function>), you'll notice it is slowly counting
294 up.
295 </para>
296
297 <para>
298 The attribute <varname>freq</varname> can be read and written.
299 The content of
300 <filename>/sys/devices/platform/uio_dummy/freq</filename>
301 represents the number of system timer ticks between two timer
302 interrupts. The default value of <varname>freq</varname> is
303 the value of the kernel variable <varname>HZ</varname>, which
304 gives you an interval of one second. Lower values will
305 increase the frequency. Try the following:
306 </para>
307<programlisting format="linespecific">
308cd /sys/devices/platform/uio_dummy/
309echo 100 > freq
310</programlisting>
311 <para>
312 Use <function>cat count</function> to see how the interrupt
313 frequency changes.
314 </para>
315</sect1>
316</chapter>
317
318<chapter id="custom_kernel_module" xreflabel="Writing your own kernel module"> 293<chapter id="custom_kernel_module" xreflabel="Writing your own kernel module">
319<?dbhtml filename="custom_kernel_module.html"?> 294<?dbhtml filename="custom_kernel_module.html"?>
320<title>Writing your own kernel module</title> 295<title>Writing your own kernel module</title>
321 <para> 296 <para>
322 Please have a look at <filename>uio_dummy.c</filename> as an 297 Please have a look at <filename>uio_cif.c</filename> as an
323 example. The following paragraphs explain the different 298 example. The following paragraphs explain the different
324 sections of this file. 299 sections of this file.
325 </para> 300 </para>
@@ -354,9 +329,8 @@ See the description below for details.
354interrupt, it's your modules task to determine the irq number during 329interrupt, it's your modules task to determine the irq number during
355initialization. If you don't have a hardware generated interrupt but 330initialization. If you don't have a hardware generated interrupt but
356want to trigger the interrupt handler in some other way, set 331want to trigger the interrupt handler in some other way, set
357<varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>. The 332<varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>.
358uio_dummy module does this as it triggers the event mechanism in a timer 333If you had no interrupt at all, you could set
359routine. If you had no interrupt at all, you could set
360<varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this 334<varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this
361rarely makes sense. 335rarely makes sense.
362</para></listitem> 336</para></listitem>
diff --git a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl
index b629da33951d..b3d93ee27693 100644
--- a/Documentation/DocBook/videobook.tmpl
+++ b/Documentation/DocBook/videobook.tmpl
@@ -96,7 +96,6 @@ static struct video_device my_radio
96{ 96{
97 "My radio", 97 "My radio",
98 VID_TYPE_TUNER, 98 VID_TYPE_TUNER,
99 VID_HARDWARE_MYRADIO,
100 radio_open. 99 radio_open.
101 radio_close, 100 radio_close,
102 NULL, /* no read */ 101 NULL, /* no read */
@@ -119,13 +118,6 @@ static struct video_device my_radio
119 way to change channel so it is tuneable. 118 way to change channel so it is tuneable.
120 </para> 119 </para>
121 <para> 120 <para>
122 The VID_HARDWARE_ types are unique to each device. Numbers are assigned by
123 <email>alan@redhat.com</email> when device drivers are going to be released. Until then you
124 can pull a suitably large number out of your hat and use it. 10000 should be
125 safe for a very long time even allowing for the huge number of vendors
126 making new and different radio cards at the moment.
127 </para>
128 <para>
129 We declare an open and close routine, but we do not need read or write, 121 We declare an open and close routine, but we do not need read or write,
130 which are used to read and write video data to or from the card itself. As 122 which are used to read and write video data to or from the card itself. As
131 we have no read or write there is no poll function. 123 we have no read or write there is no poll function.
@@ -844,7 +836,6 @@ static struct video_device my_camera
844 "My Camera", 836 "My Camera",
845 VID_TYPE_OVERLAY|VID_TYPE_SCALES|\ 837 VID_TYPE_OVERLAY|VID_TYPE_SCALES|\
846 VID_TYPE_CAPTURE|VID_TYPE_CHROMAKEY, 838 VID_TYPE_CAPTURE|VID_TYPE_CHROMAKEY,
847 VID_HARDWARE_MYCAMERA,
848 camera_open. 839 camera_open.
849 camera_close, 840 camera_close,
850 camera_read, /* no read */ 841 camera_read, /* no read */