aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/sg.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/sg.h')
-rw-r--r--include/scsi/sg.h61
1 files changed, 21 insertions, 40 deletions
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 0a487fe26d4f..519c49a0fc11 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -11,26 +11,10 @@
11Original driver (sg.h): 11Original driver (sg.h):
12* Copyright (C) 1992 Lawrence Foard 12* Copyright (C) 1992 Lawrence Foard
13Version 2 and 3 extensions to driver: 13Version 2 and 3 extensions to driver:
14* Copyright (C) 1998 - 2003 Douglas Gilbert 14* Copyright (C) 1998 - 2006 Douglas Gilbert
15 15
16 Version: 3.5.29 (20030529) 16 Version: 3.5.34 (20060920)
17 This version is for 2.5 series kernels. 17 This version is for 2.6 series kernels.
18
19 Changes since 3.5.28 (20030308)
20 - fix bug introduced in version 3.1.24 (last segment of sgat list)
21 Changes since 3.5.27 (20020812)
22 - remove procfs entries: hosts, host_hdr + host_strs (now in sysfs)
23 - add sysfs sg driver params: def_reserved_size, allow_dio, version
24 - new boot option: "sg_allow_dio" and module parameter: "allow_dio"
25 - multiple internal changes due to scsi subsystem rework
26 Changes since 3.5.26 (20020708)
27 - re-add direct IO using Kai Makisara's work
28 - re-tab to 8, start using C99-isms
29 - simplify memory management
30 Changes since 3.5.25 (20020504)
31 - driverfs additions
32 - copy_to/from_user() fixes [William Stinson]
33 - disable kiobufs support
34 18
35 For a full changelog see http://www.torque.net/sg 19 For a full changelog see http://www.torque.net/sg
36 20
@@ -40,7 +24,7 @@ Map of SG verions to the Linux kernels in which they appear:
40 2.1.40 2.2.20 24 2.1.40 2.2.20
41 3.0.x optional version 3 sg driver for 2.2 series 25 3.0.x optional version 3 sg driver for 2.2 series
42 3.1.17++ 2.4.0++ 26 3.1.17++ 2.4.0++
43 3.5.23++ 2.5.0++ 27 3.5.30++ 2.6.0++
44 28
45Major new features in SG 3.x driver (cf SG 2.x drivers) 29Major new features in SG 3.x driver (cf SG 2.x drivers)
46 - SG_IO ioctl() combines function if write() and read() 30 - SG_IO ioctl() combines function if write() and read()
@@ -51,14 +35,15 @@ Major new features in SG 3.x driver (cf SG 2.x drivers)
51 data into kernel buffers and then use the CPU to copy the data into the 35 data into kernel buffers and then use the CPU to copy the data into the
52 user space (vice versa for writes). That is called "indirect" IO due to 36 user space (vice versa for writes). That is called "indirect" IO due to
53 the double handling of data. There are two methods offered to remove the 37 the double handling of data. There are two methods offered to remove the
54 redundant copy: 1) direct IO which uses the kernel kiobuf mechanism and 38 redundant copy: 1) direct IO and 2) using the mmap() system call to map
55 2) using the mmap() system call to map the reserve buffer (this driver has 39 the reserve buffer (this driver has one reserve buffer per fd) into the
56 one reserve buffer per fd) into the user space. Both have their advantages. 40 user space. Both have their advantages.
57 In terms of absolute speed mmap() is faster. If speed is not a concern, 41 In terms of absolute speed mmap() is faster. If speed is not a concern,
58 indirect IO should be fine. Read the documentation for more information. 42 indirect IO should be fine. Read the documentation for more information.
59 43
60 ** N.B. To use direct IO 'echo 1 > /proc/scsi/sg/allow_dio' may be 44 ** N.B. To use direct IO 'echo 1 > /proc/scsi/sg/allow_dio' or
61 needed. That pseudo file's content is defaulted to 0. ** 45 'echo 1 > /sys/module/sg/parameters/allow_dio' is needed.
46 That attribute is 0 by default. **
62 47
63 Historical note: this SCSI pass-through driver has been known as "sg" for 48 Historical note: this SCSI pass-through driver has been known as "sg" for
64 a decade. In broader kernel discussions "sg" is used to refer to scatter 49 a decade. In broader kernel discussions "sg" is used to refer to scatter
@@ -72,20 +57,17 @@ Major new features in SG 3.x driver (cf SG 2.x drivers)
72 http://www.torque.net/sg/p/sg_v3_ho.html 57 http://www.torque.net/sg/p/sg_v3_ho.html
73 This is a rendering from DocBook source [change the extension to "sgml" 58 This is a rendering from DocBook source [change the extension to "sgml"
74 or "xml"]. There are renderings in "ps", "pdf", "rtf" and "txt" (soon). 59 or "xml"]. There are renderings in "ps", "pdf", "rtf" and "txt" (soon).
60 The SG_IO ioctl is now found in other parts kernel (e.g. the block layer).
61 For more information see http://www.torque.net/sg/sg_io.html
75 62
76 The older, version 2 documents discuss the original sg interface in detail: 63 The older, version 2 documents discuss the original sg interface in detail:
77 http://www.torque.net/sg/p/scsi-generic.txt 64 http://www.torque.net/sg/p/scsi-generic.txt
78 http://www.torque.net/sg/p/scsi-generic_long.txt 65 http://www.torque.net/sg/p/scsi-generic_long.txt
79 A version of this document (potentially out of date) may also be found in 66 Also available: <kernel_source>/Documentation/scsi/scsi-generic.txt
80 the kernel source tree, probably at:
81 Documentation/scsi/scsi-generic.txt .
82 67
83 Utility and test programs are available at the sg web site. They are 68 Utility and test programs are available at the sg web site. They are
84 bundled as sg_utils (for the lk 2.2 series) and sg3_utils (for the 69 packaged as sg3_utils (for the lk 2.4 and 2.6 series) and sg_utils
85 lk 2.4 series). 70 (for the lk 2.2 series).
86
87 There is a HOWTO on the Linux SCSI subsystem in the lk 2.4 series at:
88 http://www.linuxdoc.org/HOWTO/SCSI-2.4-HOWTO
89*/ 71*/
90 72
91 73
@@ -238,13 +220,12 @@ typedef struct sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
238#define SG_GET_ACCESS_COUNT 0x2289 220#define SG_GET_ACCESS_COUNT 0x2289
239 221
240 222
241#define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ 223#define SG_SCATTER_SZ (8 * 4096)
242/* Largest size (in bytes) a single scatter-gather list element can have. 224/* Largest size (in bytes) a single scatter-gather list element can have.
243 The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on 225 The value used by the driver is 'max(SG_SCATTER_SZ, PAGE_SIZE)'.
244 i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported 226 This value should be a power of 2 (and may be rounded up internally).
245 by adapter then this value is the largest data block that can be 227 If scatter-gather is not supported by adapter then this value is the
246 read/written by a single scsi command. The user can find the value of 228 largest data block that can be read/written by a single scsi command. */
247 PAGE_SIZE by calling getpagesize() defined in unistd.h . */
248 229
249#define SG_DEFAULT_RETRIES 0 230#define SG_DEFAULT_RETRIES 0
250 231