diff options
Diffstat (limited to 'Documentation')
73 files changed, 4937 insertions, 916 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 5f7f7d7f77d2..02457ec9c94f 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -184,6 +184,8 @@ mtrr.txt | |||
184 | - how to use PPro Memory Type Range Registers to increase performance. | 184 | - how to use PPro Memory Type Range Registers to increase performance. |
185 | nbd.txt | 185 | nbd.txt |
186 | - info on a TCP implementation of a network block device. | 186 | - info on a TCP implementation of a network block device. |
187 | netlabel/ | ||
188 | - directory with information on the NetLabel subsystem. | ||
187 | networking/ | 189 | networking/ |
188 | - directory with info on various aspects of networking with Linux. | 190 | - directory with info on various aspects of networking with Linux. |
189 | nfsroot.txt | 191 | nfsroot.txt |
diff --git a/Documentation/ABI/obsolete/devfs b/Documentation/ABI/removed/devfs index b8b87399bc8f..8195c4e0d0a1 100644 --- a/Documentation/ABI/obsolete/devfs +++ b/Documentation/ABI/removed/devfs | |||
@@ -1,13 +1,12 @@ | |||
1 | What: devfs | 1 | What: devfs |
2 | Date: July 2005 | 2 | Date: July 2005 (scheduled), finally removed in kernel v2.6.18 |
3 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | 3 | Contact: Greg Kroah-Hartman <gregkh@suse.de> |
4 | Description: | 4 | Description: |
5 | devfs has been unmaintained for a number of years, has unfixable | 5 | devfs has been unmaintained for a number of years, has unfixable |
6 | races, contains a naming policy within the kernel that is | 6 | races, contains a naming policy within the kernel that is |
7 | against the LSB, and can be replaced by using udev. | 7 | against the LSB, and can be replaced by using udev. |
8 | The files fs/devfs/*, include/linux/devfs_fs*.h will be removed, | 8 | The files fs/devfs/*, include/linux/devfs_fs*.h were removed, |
9 | along with the the assorted devfs function calls throughout the | 9 | along with the the assorted devfs function calls throughout the |
10 | kernel tree. | 10 | kernel tree. |
11 | 11 | ||
12 | Users: | 12 | Users: |
13 | |||
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power new file mode 100644 index 000000000000..d882f8093871 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-power | |||
@@ -0,0 +1,88 @@ | |||
1 | What: /sys/power/ | ||
2 | Date: August 2006 | ||
3 | Contact: Rafael J. Wysocki <rjw@sisk.pl> | ||
4 | Description: | ||
5 | The /sys/power directory will contain files that will | ||
6 | provide a unified interface to the power management | ||
7 | subsystem. | ||
8 | |||
9 | What: /sys/power/state | ||
10 | Date: August 2006 | ||
11 | Contact: Rafael J. Wysocki <rjw@sisk.pl> | ||
12 | Description: | ||
13 | The /sys/power/state file controls the system power state. | ||
14 | Reading from this file returns what states are supported, | ||
15 | which is hard-coded to 'standby' (Power-On Suspend), 'mem' | ||
16 | (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). | ||
17 | |||
18 | Writing to this file one of these strings causes the system to | ||
19 | transition into that state. Please see the file | ||
20 | Documentation/power/states.txt for a description of each of | ||
21 | these states. | ||
22 | |||
23 | What: /sys/power/disk | ||
24 | Date: August 2006 | ||
25 | Contact: Rafael J. Wysocki <rjw@sisk.pl> | ||
26 | Description: | ||
27 | The /sys/power/disk file controls the operating mode of the | ||
28 | suspend-to-disk mechanism. Reading from this file returns | ||
29 | the name of the method by which the system will be put to | ||
30 | sleep on the next suspend. There are four methods supported: | ||
31 | 'firmware' - means that the memory image will be saved to disk | ||
32 | by some firmware, in which case we also assume that the | ||
33 | firmware will handle the system suspend. | ||
34 | 'platform' - the memory image will be saved by the kernel and | ||
35 | the system will be put to sleep by the platform driver (e.g. | ||
36 | ACPI or other PM registers). | ||
37 | 'shutdown' - the memory image will be saved by the kernel and | ||
38 | the system will be powered off. | ||
39 | 'reboot' - the memory image will be saved by the kernel and | ||
40 | the system will be rebooted. | ||
41 | |||
42 | The suspend-to-disk method may be chosen by writing to this | ||
43 | file one of the accepted strings: | ||
44 | |||
45 | 'firmware' | ||
46 | 'platform' | ||
47 | 'shutdown' | ||
48 | 'reboot' | ||
49 | |||
50 | It will only change to 'firmware' or 'platform' if the system | ||
51 | supports that. | ||
52 | |||
53 | What: /sys/power/image_size | ||
54 | Date: August 2006 | ||
55 | Contact: Rafael J. Wysocki <rjw@sisk.pl> | ||
56 | Description: | ||
57 | The /sys/power/image_size file controls the size of the image | ||
58 | created by the suspend-to-disk mechanism. It can be written a | ||
59 | string representing a non-negative integer that will be used | ||
60 | as an upper limit of the image size, in bytes. The kernel's | ||
61 | suspend-to-disk code will do its best to ensure the image size | ||
62 | will not exceed this number. However, if it turns out to be | ||
63 | impossible, the kernel will try to suspend anyway using the | ||
64 | smallest image possible. In particular, if "0" is written to | ||
65 | this file, the suspend image will be as small as possible. | ||
66 | |||
67 | Reading from this file will display the current image size | ||
68 | limit, which is set to 500 MB by default. | ||
69 | |||
70 | What: /sys/power/pm_trace | ||
71 | Date: August 2006 | ||
72 | Contact: Rafael J. Wysocki <rjw@sisk.pl> | ||
73 | Description: | ||
74 | The /sys/power/pm_trace file controls the code which saves the | ||
75 | last PM event point in the RTC across reboots, so that you can | ||
76 | debug a machine that just hangs during suspend (or more | ||
77 | commonly, during resume). Namely, the RTC is only used to save | ||
78 | the last PM event point if this file contains '1'. Initially | ||
79 | it contains '0' which may be changed to '1' by writing a | ||
80 | string representing a nonzero integer into it. | ||
81 | |||
82 | To use this debugging feature you should attempt to suspend | ||
83 | the machine, then reboot it and run | ||
84 | |||
85 | dmesg -s 1000000 | grep 'hash matches' | ||
86 | |||
87 | CAUTION: Using it will cause your machine's real-time (CMOS) | ||
88 | clock to be set to a random invalid time after a resume. | ||
diff --git a/Documentation/Changes b/Documentation/Changes index 488272074c36..abee7f58c1ed 100644 --- a/Documentation/Changes +++ b/Documentation/Changes | |||
@@ -37,15 +37,14 @@ o e2fsprogs 1.29 # tune2fs | |||
37 | o jfsutils 1.1.3 # fsck.jfs -V | 37 | o jfsutils 1.1.3 # fsck.jfs -V |
38 | o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs | 38 | o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs |
39 | o xfsprogs 2.6.0 # xfs_db -V | 39 | o xfsprogs 2.6.0 # xfs_db -V |
40 | o pcmciautils 004 | 40 | o pcmciautils 004 # pccardctl -V |
41 | o pcmcia-cs 3.1.21 # cardmgr -V | ||
42 | o quota-tools 3.09 # quota -V | 41 | o quota-tools 3.09 # quota -V |
43 | o PPP 2.4.0 # pppd --version | 42 | o PPP 2.4.0 # pppd --version |
44 | o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version | 43 | o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version |
45 | o nfs-utils 1.0.5 # showmount --version | 44 | o nfs-utils 1.0.5 # showmount --version |
46 | o procps 3.2.0 # ps --version | 45 | o procps 3.2.0 # ps --version |
47 | o oprofile 0.9 # oprofiled --version | 46 | o oprofile 0.9 # oprofiled --version |
48 | o udev 071 # udevinfo -V | 47 | o udev 081 # udevinfo -V |
49 | 48 | ||
50 | Kernel compilation | 49 | Kernel compilation |
51 | ================== | 50 | ================== |
@@ -268,7 +267,7 @@ active clients. | |||
268 | 267 | ||
269 | To enable this new functionality, you need to: | 268 | To enable this new functionality, you need to: |
270 | 269 | ||
271 | mount -t nfsd nfsd /proc/fs/nfs | 270 | mount -t nfsd nfsd /proc/fs/nfsd |
272 | 271 | ||
273 | before running exportfs or mountd. It is recommended that all NFS | 272 | before running exportfs or mountd. It is recommended that all NFS |
274 | services be protected from the internet-at-large by a firewall where | 273 | services be protected from the internet-at-large by a firewall where |
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 6d2412ec91ed..29c18966b050 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -532,6 +532,40 @@ appears outweighs the potential value of the hint that tells gcc to do | |||
532 | something it would have done anyway. | 532 | something it would have done anyway. |
533 | 533 | ||
534 | 534 | ||
535 | Chapter 16: Function return values and names | ||
536 | |||
537 | Functions can return values of many different kinds, and one of the | ||
538 | most common is a value indicating whether the function succeeded or | ||
539 | failed. Such a value can be represented as an error-code integer | ||
540 | (-Exxx = failure, 0 = success) or a "succeeded" boolean (0 = failure, | ||
541 | non-zero = success). | ||
542 | |||
543 | Mixing up these two sorts of representations is a fertile source of | ||
544 | difficult-to-find bugs. If the C language included a strong distinction | ||
545 | between integers and booleans then the compiler would find these mistakes | ||
546 | for us... but it doesn't. To help prevent such bugs, always follow this | ||
547 | convention: | ||
548 | |||
549 | If the name of a function is an action or an imperative command, | ||
550 | the function should return an error-code integer. If the name | ||
551 | is a predicate, the function should return a "succeeded" boolean. | ||
552 | |||
553 | For example, "add work" is a command, and the add_work() function returns 0 | ||
554 | for success or -EBUSY for failure. In the same way, "PCI device present" is | ||
555 | a predicate, and the pci_dev_present() function returns 1 if it succeeds in | ||
556 | finding a matching device or 0 if it doesn't. | ||
557 | |||
558 | All EXPORTed functions must respect this convention, and so should all | ||
559 | public functions. Private (static) functions need not, but it is | ||
560 | recommended that they do. | ||
561 | |||
562 | Functions whose return value is the actual result of a computation, rather | ||
563 | than an indication of whether the computation succeeded, are not subject to | ||
564 | this rule. Generally they indicate failure by returning some out-of-range | ||
565 | result. Typical examples would be functions that return pointers; they use | ||
566 | NULL or the ERR_PTR mechanism to report failure. | ||
567 | |||
568 | |||
535 | 569 | ||
536 | Appendix I: References | 570 | Appendix I: References |
537 | 571 | ||
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index f8fe882e33dc..6d4b1ef5b6f1 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -181,27 +181,6 @@ X!Ilib/string.c | |||
181 | </sect1> | 181 | </sect1> |
182 | </chapter> | 182 | </chapter> |
183 | 183 | ||
184 | <chapter id="proc"> | ||
185 | <title>The proc filesystem</title> | ||
186 | |||
187 | <sect1><title>sysctl interface</title> | ||
188 | !Ekernel/sysctl.c | ||
189 | </sect1> | ||
190 | |||
191 | <sect1><title>proc filesystem interface</title> | ||
192 | !Ifs/proc/base.c | ||
193 | </sect1> | ||
194 | </chapter> | ||
195 | |||
196 | <chapter id="debugfs"> | ||
197 | <title>The debugfs filesystem</title> | ||
198 | |||
199 | <sect1><title>debugfs interface</title> | ||
200 | !Efs/debugfs/inode.c | ||
201 | !Efs/debugfs/file.c | ||
202 | </sect1> | ||
203 | </chapter> | ||
204 | |||
205 | <chapter id="vfs"> | 184 | <chapter id="vfs"> |
206 | <title>The Linux VFS</title> | 185 | <title>The Linux VFS</title> |
207 | <sect1><title>The Filesystem types</title> | 186 | <sect1><title>The Filesystem types</title> |
@@ -234,6 +213,50 @@ X!Ilib/string.c | |||
234 | </sect1> | 213 | </sect1> |
235 | </chapter> | 214 | </chapter> |
236 | 215 | ||
216 | <chapter id="proc"> | ||
217 | <title>The proc filesystem</title> | ||
218 | |||
219 | <sect1><title>sysctl interface</title> | ||
220 | !Ekernel/sysctl.c | ||
221 | </sect1> | ||
222 | |||
223 | <sect1><title>proc filesystem interface</title> | ||
224 | !Ifs/proc/base.c | ||
225 | </sect1> | ||
226 | </chapter> | ||
227 | |||
228 | <chapter id="sysfs"> | ||
229 | <title>The Filesystem for Exporting Kernel Objects</title> | ||
230 | !Efs/sysfs/file.c | ||
231 | !Efs/sysfs/symlink.c | ||
232 | !Efs/sysfs/bin.c | ||
233 | </chapter> | ||
234 | |||
235 | <chapter id="debugfs"> | ||
236 | <title>The debugfs filesystem</title> | ||
237 | |||
238 | <sect1><title>debugfs interface</title> | ||
239 | !Efs/debugfs/inode.c | ||
240 | !Efs/debugfs/file.c | ||
241 | </sect1> | ||
242 | </chapter> | ||
243 | |||
244 | <chapter id="relayfs"> | ||
245 | <title>relay interface support</title> | ||
246 | |||
247 | <para> | ||
248 | Relay interface support | ||
249 | is designed to provide an efficient mechanism for tools and | ||
250 | facilities to relay large amounts of data from kernel space to | ||
251 | user space. | ||
252 | </para> | ||
253 | |||
254 | <sect1><title>relay interface</title> | ||
255 | !Ekernel/relay.c | ||
256 | !Ikernel/relay.c | ||
257 | </sect1> | ||
258 | </chapter> | ||
259 | |||
237 | <chapter id="netcore"> | 260 | <chapter id="netcore"> |
238 | <title>Linux Networking</title> | 261 | <title>Linux Networking</title> |
239 | <sect1><title>Networking Base Types</title> | 262 | <sect1><title>Networking Base Types</title> |
@@ -349,13 +372,6 @@ X!Earch/i386/kernel/mca.c | |||
349 | </sect1> | 372 | </sect1> |
350 | </chapter> | 373 | </chapter> |
351 | 374 | ||
352 | <chapter id="sysfs"> | ||
353 | <title>The Filesystem for Exporting Kernel Objects</title> | ||
354 | !Efs/sysfs/file.c | ||
355 | !Efs/sysfs/symlink.c | ||
356 | !Efs/sysfs/bin.c | ||
357 | </chapter> | ||
358 | |||
359 | <chapter id="security"> | 375 | <chapter id="security"> |
360 | <title>Security Framework</title> | 376 | <title>Security Framework</title> |
361 | !Esecurity/security.c | 377 | !Esecurity/security.c |
@@ -386,6 +402,7 @@ X!Iinclude/linux/device.h | |||
386 | --> | 402 | --> |
387 | !Edrivers/base/driver.c | 403 | !Edrivers/base/driver.c |
388 | !Edrivers/base/core.c | 404 | !Edrivers/base/core.c |
405 | !Edrivers/base/class.c | ||
389 | !Edrivers/base/firmware_class.c | 406 | !Edrivers/base/firmware_class.c |
390 | !Edrivers/base/transport_class.c | 407 | !Edrivers/base/transport_class.c |
391 | !Edrivers/base/dmapool.c | 408 | !Edrivers/base/dmapool.c |
@@ -437,6 +454,11 @@ X!Edrivers/pnp/system.c | |||
437 | !Eblock/ll_rw_blk.c | 454 | !Eblock/ll_rw_blk.c |
438 | </chapter> | 455 | </chapter> |
439 | 456 | ||
457 | <chapter id="chrdev"> | ||
458 | <title>Char devices</title> | ||
459 | !Efs/char_dev.c | ||
460 | </chapter> | ||
461 | |||
440 | <chapter id="miscdev"> | 462 | <chapter id="miscdev"> |
441 | <title>Miscellaneous Devices</title> | 463 | <title>Miscellaneous Devices</title> |
442 | !Edrivers/char/misc.c | 464 | !Edrivers/char/misc.c |
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index e97c32314541..065e8dc23e3a 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl | |||
@@ -868,18 +868,18 @@ and other resources, etc. | |||
868 | 868 | ||
869 | <chapter id="libataExt"> | 869 | <chapter id="libataExt"> |
870 | <title>libata Library</title> | 870 | <title>libata Library</title> |
871 | !Edrivers/scsi/libata-core.c | 871 | !Edrivers/ata/libata-core.c |
872 | </chapter> | 872 | </chapter> |
873 | 873 | ||
874 | <chapter id="libataInt"> | 874 | <chapter id="libataInt"> |
875 | <title>libata Core Internals</title> | 875 | <title>libata Core Internals</title> |
876 | !Idrivers/scsi/libata-core.c | 876 | !Idrivers/ata/libata-core.c |
877 | </chapter> | 877 | </chapter> |
878 | 878 | ||
879 | <chapter id="libataScsiInt"> | 879 | <chapter id="libataScsiInt"> |
880 | <title>libata SCSI translation/emulation</title> | 880 | <title>libata SCSI translation/emulation</title> |
881 | !Edrivers/scsi/libata-scsi.c | 881 | !Edrivers/ata/libata-scsi.c |
882 | !Idrivers/scsi/libata-scsi.c | 882 | !Idrivers/ata/libata-scsi.c |
883 | </chapter> | 883 | </chapter> |
884 | 884 | ||
885 | <chapter id="ataExceptions"> | 885 | <chapter id="ataExceptions"> |
@@ -1600,12 +1600,12 @@ and other resources, etc. | |||
1600 | 1600 | ||
1601 | <chapter id="PiixInt"> | 1601 | <chapter id="PiixInt"> |
1602 | <title>ata_piix Internals</title> | 1602 | <title>ata_piix Internals</title> |
1603 | !Idrivers/scsi/ata_piix.c | 1603 | !Idrivers/ata/ata_piix.c |
1604 | </chapter> | 1604 | </chapter> |
1605 | 1605 | ||
1606 | <chapter id="SILInt"> | 1606 | <chapter id="SILInt"> |
1607 | <title>sata_sil Internals</title> | 1607 | <title>sata_sil Internals</title> |
1608 | !Idrivers/scsi/sata_sil.c | 1608 | !Idrivers/ata/sata_sil.c |
1609 | </chapter> | 1609 | </chapter> |
1610 | 1610 | ||
1611 | <chapter id="libataThanks"> | 1611 | <chapter id="libataThanks"> |
diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl index 320af25de3a2..3608472d7b74 100644 --- a/Documentation/DocBook/usb.tmpl +++ b/Documentation/DocBook/usb.tmpl | |||
@@ -43,59 +43,52 @@ | |||
43 | 43 | ||
44 | <para>A Universal Serial Bus (USB) is used to connect a host, | 44 | <para>A Universal Serial Bus (USB) is used to connect a host, |
45 | such as a PC or workstation, to a number of peripheral | 45 | such as a PC or workstation, to a number of peripheral |
46 | devices. USB uses a tree structure, with the host at the | 46 | devices. USB uses a tree structure, with the host as the |
47 | root (the system's master), hubs as interior nodes, and | 47 | root (the system's master), hubs as interior nodes, and |
48 | peripheral devices as leaves (and slaves). | 48 | peripherals as leaves (and slaves). |
49 | Modern PCs support several such trees of USB devices, usually | 49 | Modern PCs support several such trees of USB devices, usually |
50 | one USB 2.0 tree (480 Mbit/sec each) with | 50 | one USB 2.0 tree (480 Mbit/sec each) with |
51 | a few USB 1.1 trees (12 Mbit/sec each) that are used when you | 51 | a few USB 1.1 trees (12 Mbit/sec each) that are used when you |
52 | connect a USB 1.1 device directly to the machine's "root hub". | 52 | connect a USB 1.1 device directly to the machine's "root hub". |
53 | </para> | 53 | </para> |
54 | 54 | ||
55 | <para>That master/slave asymmetry was designed in part for | 55 | <para>That master/slave asymmetry was designed-in for a number of |
56 | ease of use. It is not physically possible to assemble | 56 | reasons, one being ease of use. It is not physically possible to |
57 | (legal) USB cables incorrectly: all upstream "to-the-host" | 57 | assemble (legal) USB cables incorrectly: all upstream "to the host" |
58 | connectors are the rectangular type, matching the sockets on | 58 | connectors are the rectangular type (matching the sockets on |
59 | root hubs, and the downstream type are the squarish type | 59 | root hubs), and all downstream connectors are the squarish type |
60 | (or they are built in to the peripheral). | 60 | (or they are built into the peripheral). |
61 | Software doesn't need to deal with distributed autoconfiguration | 61 | Also, the host software doesn't need to deal with distributed |
62 | since the pre-designated master node manages all that. | 62 | auto-configuration since the pre-designated master node manages all that. |
63 | At the electrical level, bus protocol overhead is reduced by | 63 | And finally, at the electrical level, bus protocol overhead is reduced by |
64 | eliminating arbitration and moving scheduling into host software. | 64 | eliminating arbitration and moving scheduling into the host software. |
65 | </para> | 65 | </para> |
66 | 66 | ||
67 | <para>USB 1.0 was announced in January 1996, and was revised | 67 | <para>USB 1.0 was announced in January 1996 and was revised |
68 | as USB 1.1 (with improvements in hub specification and | 68 | as USB 1.1 (with improvements in hub specification and |
69 | support for interrupt-out transfers) in September 1998. | 69 | support for interrupt-out transfers) in September 1998. |
70 | USB 2.0 was released in April 2000, including high speed | 70 | USB 2.0 was released in April 2000, adding high-speed |
71 | transfers and transaction translating hubs (used for USB 1.1 | 71 | transfers and transaction-translating hubs (used for USB 1.1 |
72 | and 1.0 backward compatibility). | 72 | and 1.0 backward compatibility). |
73 | </para> | 73 | </para> |
74 | 74 | ||
75 | <para>USB support was added to Linux early in the 2.2 kernel series | 75 | <para>Kernel developers added USB support to Linux early in the 2.2 kernel |
76 | shortly before the 2.3 development forked off. Updates | 76 | series, shortly before 2.3 development forked. Updates from 2.3 were |
77 | from 2.3 were regularly folded back into 2.2 releases, bringing | 77 | regularly folded back into 2.2 releases, which improved reliability and |
78 | new features such as <filename>/sbin/hotplug</filename> support, | 78 | brought <filename>/sbin/hotplug</filename> support as well more drivers. |
79 | more drivers, and more robustness. | 79 | Such improvements were continued in the 2.5 kernel series, where they added |
80 | The 2.5 kernel series continued such improvements, and also | 80 | USB 2.0 support, improved performance, and made the host controller drivers |
81 | worked on USB 2.0 support, | 81 | (HCDs) more consistent. They also simplified the API (to make bugs less |
82 | higher performance, | 82 | likely) and added internal "kerneldoc" documentation. |
83 | better consistency between host controller drivers, | ||
84 | API simplification (to make bugs less likely), | ||
85 | and providing internal "kerneldoc" documentation. | ||
86 | </para> | 83 | </para> |
87 | 84 | ||
88 | <para>Linux can run inside USB devices as well as on | 85 | <para>Linux can run inside USB devices as well as on |
89 | the hosts that control the devices. | 86 | the hosts that control the devices. |
90 | Because the Linux 2.x USB support evolved to support mass market | 87 | But USB device drivers running inside those peripherals |
91 | platforms such as Apple Macintosh or PC-compatible systems, | ||
92 | it didn't address design concerns for those types of USB systems. | ||
93 | So it can't be used inside mass-market PDAs, or other peripherals. | ||
94 | USB device drivers running inside those Linux peripherals | ||
95 | don't do the same things as the ones running inside hosts, | 88 | don't do the same things as the ones running inside hosts, |
96 | and so they've been given a different name: | 89 | so they've been given a different name: |
97 | they're called <emphasis>gadget drivers</emphasis>. | 90 | <emphasis>gadget drivers</emphasis>. |
98 | This document does not present gadget drivers. | 91 | This document does not cover gadget drivers. |
99 | </para> | 92 | </para> |
100 | 93 | ||
101 | </chapter> | 94 | </chapter> |
@@ -103,17 +96,14 @@ | |||
103 | <chapter id="host"> | 96 | <chapter id="host"> |
104 | <title>USB Host-Side API Model</title> | 97 | <title>USB Host-Side API Model</title> |
105 | 98 | ||
106 | <para>Within the kernel, | 99 | <para>Host-side drivers for USB devices talk to the "usbcore" APIs. |
107 | host-side drivers for USB devices talk to the "usbcore" APIs. | 100 | There are two. One is intended for |
108 | There are two types of public "usbcore" APIs, targetted at two different | 101 | <emphasis>general-purpose</emphasis> drivers (exposed through |
109 | layers of USB driver. Those are | 102 | driver frameworks), and the other is for drivers that are |
110 | <emphasis>general purpose</emphasis> drivers, exposed through | 103 | <emphasis>part of the core</emphasis>. |
111 | driver frameworks such as block, character, or network devices; | 104 | Such core drivers include the <emphasis>hub</emphasis> driver |
112 | and drivers that are <emphasis>part of the core</emphasis>, | 105 | (which manages trees of USB devices) and several different kinds |
113 | which are involved in managing a USB bus. | 106 | of <emphasis>host controller drivers</emphasis>, |
114 | Such core drivers include the <emphasis>hub</emphasis> driver, | ||
115 | which manages trees of USB devices, and several different kinds | ||
116 | of <emphasis>host controller driver (HCD)</emphasis>, | ||
117 | which control individual busses. | 107 | which control individual busses. |
118 | </para> | 108 | </para> |
119 | 109 | ||
@@ -122,21 +112,21 @@ | |||
122 | 112 | ||
123 | <itemizedlist> | 113 | <itemizedlist> |
124 | 114 | ||
125 | <listitem><para>USB supports four kinds of data transfer | 115 | <listitem><para>USB supports four kinds of data transfers |
126 | (control, bulk, interrupt, and isochronous). Two transfer | 116 | (control, bulk, interrupt, and isochronous). Two of them (control |
127 | types use bandwidth as it's available (control and bulk), | 117 | and bulk) use bandwidth as it's available, |
128 | while the other two types of transfer (interrupt and isochronous) | 118 | while the other two (interrupt and isochronous) |
129 | are scheduled to provide guaranteed bandwidth. | 119 | are scheduled to provide guaranteed bandwidth. |
130 | </para></listitem> | 120 | </para></listitem> |
131 | 121 | ||
132 | <listitem><para>The device description model includes one or more | 122 | <listitem><para>The device description model includes one or more |
133 | "configurations" per device, only one of which is active at a time. | 123 | "configurations" per device, only one of which is active at a time. |
134 | Devices that are capable of high speed operation must also support | 124 | Devices that are capable of high-speed operation must also support |
135 | full speed configurations, along with a way to ask about the | 125 | full-speed configurations, along with a way to ask about the |
136 | "other speed" configurations that might be used. | 126 | "other speed" configurations which might be used. |
137 | </para></listitem> | 127 | </para></listitem> |
138 | 128 | ||
139 | <listitem><para>Configurations have one or more "interface", each | 129 | <listitem><para>Configurations have one or more "interfaces", each |
140 | of which may have "alternate settings". Interfaces may be | 130 | of which may have "alternate settings". Interfaces may be |
141 | standardized by USB "Class" specifications, or may be specific to | 131 | standardized by USB "Class" specifications, or may be specific to |
142 | a vendor or device.</para> | 132 | a vendor or device.</para> |
@@ -162,7 +152,7 @@ | |||
162 | </para></listitem> | 152 | </para></listitem> |
163 | 153 | ||
164 | <listitem><para>The Linux USB API supports synchronous calls for | 154 | <listitem><para>The Linux USB API supports synchronous calls for |
165 | control and bulk messaging. | 155 | control and bulk messages. |
166 | It also supports asynchnous calls for all kinds of data transfer, | 156 | It also supports asynchnous calls for all kinds of data transfer, |
167 | using request structures called "URBs" (USB Request Blocks). | 157 | using request structures called "URBs" (USB Request Blocks). |
168 | </para></listitem> | 158 | </para></listitem> |
@@ -463,14 +453,25 @@ | |||
463 | file in your Linux kernel sources. | 453 | file in your Linux kernel sources. |
464 | </para> | 454 | </para> |
465 | 455 | ||
466 | <para>Otherwise the main use for this file from programs | 456 | <para>This file, in combination with the poll() system call, can |
467 | is to poll() it to get notifications of usb devices | 457 | also be used to detect when devices are added or removed: |
468 | as they're plugged or unplugged. | 458 | <programlisting>int fd; |
469 | To see what changed, you'd need to read the file and | 459 | struct pollfd pfd; |
470 | compare "before" and "after" contents, scan the filesystem, | 460 | |
471 | or see its hotplug event. | 461 | fd = open("/proc/bus/usb/devices", O_RDONLY); |
462 | pfd = { fd, POLLIN, 0 }; | ||
463 | for (;;) { | ||
464 | /* The first time through, this call will return immediately. */ | ||
465 | poll(&pfd, 1, -1); | ||
466 | |||
467 | /* To see what's changed, compare the file's previous and current | ||
468 | contents or scan the filesystem. (Scanning is more precise.) */ | ||
469 | }</programlisting> | ||
470 | Note that this behavior is intended to be used for informational | ||
471 | and debug purposes. It would be more appropriate to use programs | ||
472 | such as udev or HAL to initialize a device or start a user-mode | ||
473 | helper program, for instance. | ||
472 | </para> | 474 | </para> |
473 | |||
474 | </sect1> | 475 | </sect1> |
475 | 476 | ||
476 | <sect1> | 477 | <sect1> |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 915ae8c986c6..d6f3dd1a3464 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -358,7 +358,8 @@ Here is a list of some of the different kernel trees available: | |||
358 | quilt trees: | 358 | quilt trees: |
359 | - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> | 359 | - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> |
360 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | 360 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ |
361 | 361 | - x86-64, partly i386, Andi Kleen <ak@suse.de> | |
362 | ftp.firstfloor.org:/pub/ak/x86_64/quilt/ | ||
362 | 363 | ||
363 | Bug Reporting | 364 | Bug Reporting |
364 | ------------- | 365 | ------------- |
@@ -374,6 +375,26 @@ of information is needed by the kernel developers to help track down the | |||
374 | problem. | 375 | problem. |
375 | 376 | ||
376 | 377 | ||
378 | Managing bug reports | ||
379 | -------------------- | ||
380 | |||
381 | One of the best ways to put into practice your hacking skills is by fixing | ||
382 | bugs reported by other people. Not only you will help to make the kernel | ||
383 | more stable, you'll learn to fix real world problems and you will improve | ||
384 | your skills, and other developers will be aware of your presence. Fixing | ||
385 | bugs is one of the best ways to earn merit amongst the developers, because | ||
386 | not many people like wasting time fixing other people's bugs. | ||
387 | |||
388 | To work in the already reported bug reports, go to http://bugzilla.kernel.org. | ||
389 | If you want to be advised of the future bug reports, you can subscribe to the | ||
390 | bugme-new mailing list (only new bug reports are mailed here) or to the | ||
391 | bugme-janitor mailing list (every change in the bugzilla is mailed here) | ||
392 | |||
393 | http://lists.osdl.org/mailman/listinfo/bugme-new | ||
394 | http://lists.osdl.org/mailman/listinfo/bugme-janitors | ||
395 | |||
396 | |||
397 | |||
377 | Mailing lists | 398 | Mailing lists |
378 | ------------- | 399 | ------------- |
379 | 400 | ||
diff --git a/Documentation/IPMI.txt b/Documentation/IPMI.txt index 0256805b548f..7756e09ea759 100644 --- a/Documentation/IPMI.txt +++ b/Documentation/IPMI.txt | |||
@@ -326,9 +326,12 @@ for events, they will all receive all events that come in. | |||
326 | 326 | ||
327 | For receiving commands, you have to individually register commands you | 327 | For receiving commands, you have to individually register commands you |
328 | want to receive. Call ipmi_register_for_cmd() and supply the netfn | 328 | want to receive. Call ipmi_register_for_cmd() and supply the netfn |
329 | and command name for each command you want to receive. Only one user | 329 | and command name for each command you want to receive. You also |
330 | may be registered for each netfn/cmd, but different users may register | 330 | specify a bitmask of the channels you want to receive the command from |
331 | for different commands. | 331 | (or use IPMI_CHAN_ALL for all channels if you don't care). Only one |
332 | user may be registered for each netfn/cmd/channel, but different users | ||
333 | may register for different commands, or the same command if the | ||
334 | channel bitmasks do not overlap. | ||
332 | 335 | ||
333 | From userland, equivalent IOCTLs are provided to do these functions. | 336 | From userland, equivalent IOCTLs are provided to do these functions. |
334 | 337 | ||
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index a10bfb6ecd9f..7ac61f60037a 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist | |||
@@ -61,3 +61,8 @@ kernel patches. | |||
61 | Documentation/kernel-parameters.txt. | 61 | Documentation/kernel-parameters.txt. |
62 | 62 | ||
63 | 18: All new module parameters are documented with MODULE_PARM_DESC() | 63 | 18: All new module parameters are documented with MODULE_PARM_DESC() |
64 | |||
65 | 19: All new userspace interfaces are documented in Documentation/ABI/. | ||
66 | See Documentation/ABI/README for more information. | ||
67 | |||
68 | 20: Check that it all passes `make headers_check'. | ||
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers index 6bd30fdd0786..58bead05eabb 100644 --- a/Documentation/SubmittingDrivers +++ b/Documentation/SubmittingDrivers | |||
@@ -59,11 +59,11 @@ Copyright: The copyright owner must agree to use of GPL. | |||
59 | are the same person/entity. If not, the name of | 59 | are the same person/entity. If not, the name of |
60 | the person/entity authorizing use of GPL should be | 60 | the person/entity authorizing use of GPL should be |
61 | listed in case it's necessary to verify the will of | 61 | listed in case it's necessary to verify the will of |
62 | the copright owner. | 62 | the copyright owner. |
63 | 63 | ||
64 | Interfaces: If your driver uses existing interfaces and behaves like | 64 | Interfaces: If your driver uses existing interfaces and behaves like |
65 | other drivers in the same class it will be much more likely | 65 | other drivers in the same class it will be much more likely |
66 | to be accepted than if it invents gratuitous new ones. | 66 | to be accepted than if it invents gratuitous new ones. |
67 | If you need to implement a common API over Linux and NT | 67 | If you need to implement a common API over Linux and NT |
68 | drivers do it in userspace. | 68 | drivers do it in userspace. |
69 | 69 | ||
@@ -88,7 +88,7 @@ Clarity: It helps if anyone can see how to fix the driver. It helps | |||
88 | it will go in the bitbucket. | 88 | it will go in the bitbucket. |
89 | 89 | ||
90 | Control: In general if there is active maintainance of a driver by | 90 | Control: In general if there is active maintainance of a driver by |
91 | the author then patches will be redirected to them unless | 91 | the author then patches will be redirected to them unless |
92 | they are totally obvious and without need of checking. | 92 | they are totally obvious and without need of checking. |
93 | If you want to be the contact and update point for the | 93 | If you want to be the contact and update point for the |
94 | driver it is a good idea to state this in the comments, | 94 | driver it is a good idea to state this in the comments, |
@@ -100,7 +100,7 @@ What Criteria Do Not Determine Acceptance | |||
100 | Vendor: Being the hardware vendor and maintaining the driver is | 100 | Vendor: Being the hardware vendor and maintaining the driver is |
101 | often a good thing. If there is a stable working driver from | 101 | often a good thing. If there is a stable working driver from |
102 | other people already in the tree don't expect 'we are the | 102 | other people already in the tree don't expect 'we are the |
103 | vendor' to get your driver chosen. Ideally work with the | 103 | vendor' to get your driver chosen. Ideally work with the |
104 | existing driver author to build a single perfect driver. | 104 | existing driver author to build a single perfect driver. |
105 | 105 | ||
106 | Author: It doesn't matter if a large Linux company wrote the driver, | 106 | Author: It doesn't matter if a large Linux company wrote the driver, |
@@ -116,17 +116,13 @@ Linux kernel master tree: | |||
116 | ftp.??.kernel.org:/pub/linux/kernel/... | 116 | ftp.??.kernel.org:/pub/linux/kernel/... |
117 | ?? == your country code, such as "us", "uk", "fr", etc. | 117 | ?? == your country code, such as "us", "uk", "fr", etc. |
118 | 118 | ||
119 | Linux kernel mailing list: | 119 | Linux kernel mailing list: |
120 | linux-kernel@vger.kernel.org | 120 | linux-kernel@vger.kernel.org |
121 | [mail majordomo@vger.kernel.org to subscribe] | 121 | [mail majordomo@vger.kernel.org to subscribe] |
122 | 122 | ||
123 | Linux Device Drivers, Third Edition (covers 2.6.10): | 123 | Linux Device Drivers, Third Edition (covers 2.6.10): |
124 | http://lwn.net/Kernel/LDD3/ (free version) | 124 | http://lwn.net/Kernel/LDD3/ (free version) |
125 | 125 | ||
126 | Kernel traffic: | ||
127 | Weekly summary of kernel list activity (much easier to read) | ||
128 | http://www.kerneltraffic.org/kernel-traffic/ | ||
129 | |||
130 | LWN.net: | 126 | LWN.net: |
131 | Weekly summary of kernel development activity - http://lwn.net/ | 127 | Weekly summary of kernel development activity - http://lwn.net/ |
132 | 2.6 API changes: | 128 | 2.6 API changes: |
@@ -145,11 +141,8 @@ KernelNewbies: | |||
145 | Linux USB project: | 141 | Linux USB project: |
146 | http://www.linux-usb.org/ | 142 | http://www.linux-usb.org/ |
147 | 143 | ||
148 | How to NOT write kernel driver by arjanv@redhat.com | 144 | How to NOT write kernel driver by Arjan van de Ven: |
149 | http://people.redhat.com/arjanv/olspaper.pdf | 145 | http://www.fenrus.org/how-to-not-write-a-device-driver-paper.pdf |
150 | 146 | ||
151 | Kernel Janitor: | 147 | Kernel Janitor: |
152 | http://janitor.kernelnewbies.org/ | 148 | http://janitor.kernelnewbies.org/ |
153 | |||
154 | -- | ||
155 | Last updated on 17 Nov 2005. | ||
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index d42ab4c9e893..302d148c2e18 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -173,15 +173,15 @@ For small patches you may want to CC the Trivial Patch Monkey | |||
173 | trivial@kernel.org managed by Adrian Bunk; which collects "trivial" | 173 | trivial@kernel.org managed by Adrian Bunk; which collects "trivial" |
174 | patches. Trivial patches must qualify for one of the following rules: | 174 | patches. Trivial patches must qualify for one of the following rules: |
175 | Spelling fixes in documentation | 175 | Spelling fixes in documentation |
176 | Spelling fixes which could break grep(1). | 176 | Spelling fixes which could break grep(1) |
177 | Warning fixes (cluttering with useless warnings is bad) | 177 | Warning fixes (cluttering with useless warnings is bad) |
178 | Compilation fixes (only if they are actually correct) | 178 | Compilation fixes (only if they are actually correct) |
179 | Runtime fixes (only if they actually fix things) | 179 | Runtime fixes (only if they actually fix things) |
180 | Removing use of deprecated functions/macros (eg. check_region). | 180 | Removing use of deprecated functions/macros (eg. check_region) |
181 | Contact detail and documentation fixes | 181 | Contact detail and documentation fixes |
182 | Non-portable code replaced by portable code (even in arch-specific, | 182 | Non-portable code replaced by portable code (even in arch-specific, |
183 | since people copy, as long as it's trivial) | 183 | since people copy, as long as it's trivial) |
184 | Any fix by the author/maintainer of the file. (ie. patch monkey | 184 | Any fix by the author/maintainer of the file (ie. patch monkey |
185 | in re-transmission mode) | 185 | in re-transmission mode) |
186 | URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/> | 186 | URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/> |
187 | 187 | ||
@@ -209,6 +209,19 @@ Exception: If your mailer is mangling patches then someone may ask | |||
209 | you to re-send them using MIME. | 209 | you to re-send them using MIME. |
210 | 210 | ||
211 | 211 | ||
212 | WARNING: Some mailers like Mozilla send your messages with | ||
213 | ---- message header ---- | ||
214 | Content-Type: text/plain; charset=us-ascii; format=flowed | ||
215 | ---- message header ---- | ||
216 | The problem is that "format=flowed" makes some of the mailers | ||
217 | on receiving side to replace TABs with spaces and do similar | ||
218 | changes. Thus the patches from you can look corrupted. | ||
219 | |||
220 | To fix this just make your mozilla defaults/pref/mailnews.js file to look like: | ||
221 | pref("mailnews.send_plaintext_flowed", false); // RFC 2646======= | ||
222 | pref("mailnews.display.disable_format_flowed_support", true); | ||
223 | |||
224 | |||
212 | 225 | ||
213 | 7) E-mail size. | 226 | 7) E-mail size. |
214 | 227 | ||
@@ -245,13 +258,13 @@ updated change. | |||
245 | It is quite common for Linus to "drop" your patch without comment. | 258 | It is quite common for Linus to "drop" your patch without comment. |
246 | That's the nature of the system. If he drops your patch, it could be | 259 | That's the nature of the system. If he drops your patch, it could be |
247 | due to | 260 | due to |
248 | * Your patch did not apply cleanly to the latest kernel version | 261 | * Your patch did not apply cleanly to the latest kernel version. |
249 | * Your patch was not sufficiently discussed on linux-kernel. | 262 | * Your patch was not sufficiently discussed on linux-kernel. |
250 | * A style issue (see section 2), | 263 | * A style issue (see section 2). |
251 | * An e-mail formatting issue (re-read this section) | 264 | * An e-mail formatting issue (re-read this section). |
252 | * A technical problem with your change | 265 | * A technical problem with your change. |
253 | * He gets tons of e-mail, and yours got lost in the shuffle | 266 | * He gets tons of e-mail, and yours got lost in the shuffle. |
254 | * You are being annoying (See Figure 1) | 267 | * You are being annoying. |
255 | 268 | ||
256 | When in doubt, solicit comments on linux-kernel mailing list. | 269 | When in doubt, solicit comments on linux-kernel mailing list. |
257 | 270 | ||
@@ -476,10 +489,10 @@ SECTION 3 - REFERENCES | |||
476 | Andrew Morton, "The perfect patch" (tpp). | 489 | Andrew Morton, "The perfect patch" (tpp). |
477 | <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> | 490 | <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> |
478 | 491 | ||
479 | Jeff Garzik, "Linux kernel patch submission format." | 492 | Jeff Garzik, "Linux kernel patch submission format". |
480 | <http://linux.yyz.us/patch-format.html> | 493 | <http://linux.yyz.us/patch-format.html> |
481 | 494 | ||
482 | Greg Kroah-Hartman "How to piss off a kernel subsystem maintainer". | 495 | Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". |
483 | <http://www.kroah.com/log/2005/03/31/> | 496 | <http://www.kroah.com/log/2005/03/31/> |
484 | <http://www.kroah.com/log/2005/07/08/> | 497 | <http://www.kroah.com/log/2005/07/08/> |
485 | <http://www.kroah.com/log/2005/10/19/> | 498 | <http://www.kroah.com/log/2005/10/19/> |
@@ -488,9 +501,9 @@ Greg Kroah-Hartman "How to piss off a kernel subsystem maintainer". | |||
488 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! | 501 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! |
489 | <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2> | 502 | <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2> |
490 | 503 | ||
491 | Kernel Documentation/CodingStyle | 504 | Kernel Documentation/CodingStyle: |
492 | <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle> | 505 | <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle> |
493 | 506 | ||
494 | Linus Torvald's mail on the canonical patch format: | 507 | Linus Torvalds's mail on the canonical patch format: |
495 | <http://lkml.org/lkml/2005/4/7/183> | 508 | <http://lkml.org/lkml/2005/4/7/183> |
496 | -- | 509 | -- |
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index 795ca3911cc5..b11792abd6b6 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -285,7 +285,7 @@ int main(int argc, char *argv[]) | |||
285 | if (maskset) { | 285 | if (maskset) { |
286 | rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, | 286 | rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, |
287 | TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, | 287 | TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, |
288 | &cpumask, sizeof(cpumask)); | 288 | &cpumask, strlen(cpumask) + 1); |
289 | PRINTF("Sent register cpumask, retval %d\n", rc); | 289 | PRINTF("Sent register cpumask, retval %d\n", rc); |
290 | if (rc < 0) { | 290 | if (rc < 0) { |
291 | printf("error sending register cpumask\n"); | 291 | printf("error sending register cpumask\n"); |
@@ -315,7 +315,8 @@ int main(int argc, char *argv[]) | |||
315 | } | 315 | } |
316 | if (msg.n.nlmsg_type == NLMSG_ERROR || | 316 | if (msg.n.nlmsg_type == NLMSG_ERROR || |
317 | !NLMSG_OK((&msg.n), rep_len)) { | 317 | !NLMSG_OK((&msg.n), rep_len)) { |
318 | printf("fatal reply error, errno %d\n", errno); | 318 | struct nlmsgerr *err = NLMSG_DATA(&msg); |
319 | printf("fatal reply error, errno %d\n", err->error); | ||
319 | goto done; | 320 | goto done; |
320 | } | 321 | } |
321 | 322 | ||
@@ -383,7 +384,7 @@ done: | |||
383 | if (maskset) { | 384 | if (maskset) { |
384 | rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, | 385 | rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, |
385 | TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, | 386 | TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, |
386 | &cpumask, sizeof(cpumask)); | 387 | &cpumask, strlen(cpumask) + 1); |
387 | printf("Sent deregister mask, retval %d\n", rc); | 388 | printf("Sent deregister mask, retval %d\n", rc); |
388 | if (rc < 0) | 389 | if (rc < 0) |
389 | err(rc, "error sending deregister cpumask\n"); | 390 | err(rc, "error sending deregister cpumask\n"); |
diff --git a/Documentation/accounting/taskstats-struct.txt b/Documentation/accounting/taskstats-struct.txt new file mode 100644 index 000000000000..661c797eaf79 --- /dev/null +++ b/Documentation/accounting/taskstats-struct.txt | |||
@@ -0,0 +1,161 @@ | |||
1 | The struct taskstats | ||
2 | -------------------- | ||
3 | |||
4 | This document contains an explanation of the struct taskstats fields. | ||
5 | |||
6 | There are three different groups of fields in the struct taskstats: | ||
7 | |||
8 | 1) Common and basic accounting fields | ||
9 | If CONFIG_TASKSTATS is set, the taskstats inteface is enabled and | ||
10 | the common fields and basic accounting fields are collected for | ||
11 | delivery at do_exit() of a task. | ||
12 | 2) Delay accounting fields | ||
13 | These fields are placed between | ||
14 | /* Delay accounting fields start */ | ||
15 | and | ||
16 | /* Delay accounting fields end */ | ||
17 | Their values are collected if CONFIG_TASK_DELAY_ACCT is set. | ||
18 | 3) Extended accounting fields | ||
19 | These fields are placed between | ||
20 | /* Extended accounting fields start */ | ||
21 | and | ||
22 | /* Extended accounting fields end */ | ||
23 | Their values are collected if CONFIG_TASK_XACCT is set. | ||
24 | |||
25 | Future extension should add fields to the end of the taskstats struct, and | ||
26 | should not change the relative position of each field within the struct. | ||
27 | |||
28 | |||
29 | struct taskstats { | ||
30 | |||
31 | 1) Common and basic accounting fields: | ||
32 | /* The version number of this struct. This field is always set to | ||
33 | * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>. | ||
34 | * Each time the struct is changed, the value should be incremented. | ||
35 | */ | ||
36 | __u16 version; | ||
37 | |||
38 | /* The exit code of a task. */ | ||
39 | __u32 ac_exitcode; /* Exit status */ | ||
40 | |||
41 | /* The accounting flags of a task as defined in <linux/acct.h> | ||
42 | * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. | ||
43 | */ | ||
44 | __u8 ac_flag; /* Record flags */ | ||
45 | |||
46 | /* The value of task_nice() of a task. */ | ||
47 | __u8 ac_nice; /* task_nice */ | ||
48 | |||
49 | /* The name of the command that started this task. */ | ||
50 | char ac_comm[TS_COMM_LEN]; /* Command name */ | ||
51 | |||
52 | /* The scheduling discipline as set in task->policy field. */ | ||
53 | __u8 ac_sched; /* Scheduling discipline */ | ||
54 | |||
55 | __u8 ac_pad[3]; | ||
56 | __u32 ac_uid; /* User ID */ | ||
57 | __u32 ac_gid; /* Group ID */ | ||
58 | __u32 ac_pid; /* Process ID */ | ||
59 | __u32 ac_ppid; /* Parent process ID */ | ||
60 | |||
61 | /* The time when a task begins, in [secs] since 1970. */ | ||
62 | __u32 ac_btime; /* Begin time [sec since 1970] */ | ||
63 | |||
64 | /* The elapsed time of a task, in [usec]. */ | ||
65 | __u64 ac_etime; /* Elapsed time [usec] */ | ||
66 | |||
67 | /* The user CPU time of a task, in [usec]. */ | ||
68 | __u64 ac_utime; /* User CPU time [usec] */ | ||
69 | |||
70 | /* The system CPU time of a task, in [usec]. */ | ||
71 | __u64 ac_stime; /* System CPU time [usec] */ | ||
72 | |||
73 | /* The minor page fault count of a task, as set in task->min_flt. */ | ||
74 | __u64 ac_minflt; /* Minor Page Fault Count */ | ||
75 | |||
76 | /* The major page fault count of a task, as set in task->maj_flt. */ | ||
77 | __u64 ac_majflt; /* Major Page Fault Count */ | ||
78 | |||
79 | |||
80 | 2) Delay accounting fields: | ||
81 | /* Delay accounting fields start | ||
82 | * | ||
83 | * All values, until the comment "Delay accounting fields end" are | ||
84 | * available only if delay accounting is enabled, even though the last | ||
85 | * few fields are not delays | ||
86 | * | ||
87 | * xxx_count is the number of delay values recorded | ||
88 | * xxx_delay_total is the corresponding cumulative delay in nanoseconds | ||
89 | * | ||
90 | * xxx_delay_total wraps around to zero on overflow | ||
91 | * xxx_count incremented regardless of overflow | ||
92 | */ | ||
93 | |||
94 | /* Delay waiting for cpu, while runnable | ||
95 | * count, delay_total NOT updated atomically | ||
96 | */ | ||
97 | __u64 cpu_count; | ||
98 | __u64 cpu_delay_total; | ||
99 | |||
100 | /* Following four fields atomically updated using task->delays->lock */ | ||
101 | |||
102 | /* Delay waiting for synchronous block I/O to complete | ||
103 | * does not account for delays in I/O submission | ||
104 | */ | ||
105 | __u64 blkio_count; | ||
106 | __u64 blkio_delay_total; | ||
107 | |||
108 | /* Delay waiting for page fault I/O (swap in only) */ | ||
109 | __u64 swapin_count; | ||
110 | __u64 swapin_delay_total; | ||
111 | |||
112 | /* cpu "wall-clock" running time | ||
113 | * On some architectures, value will adjust for cpu time stolen | ||
114 | * from the kernel in involuntary waits due to virtualization. | ||
115 | * Value is cumulative, in nanoseconds, without a corresponding count | ||
116 | * and wraps around to zero silently on overflow | ||
117 | */ | ||
118 | __u64 cpu_run_real_total; | ||
119 | |||
120 | /* cpu "virtual" running time | ||
121 | * Uses time intervals seen by the kernel i.e. no adjustment | ||
122 | * for kernel's involuntary waits due to virtualization. | ||
123 | * Value is cumulative, in nanoseconds, without a corresponding count | ||
124 | * and wraps around to zero silently on overflow | ||
125 | */ | ||
126 | __u64 cpu_run_virtual_total; | ||
127 | /* Delay accounting fields end */ | ||
128 | /* version 1 ends here */ | ||
129 | |||
130 | |||
131 | 3) Extended accounting fields | ||
132 | /* Extended accounting fields start */ | ||
133 | |||
134 | /* Accumulated RSS usage in duration of a task, in MBytes-usecs. | ||
135 | * The current rss usage is added to this counter every time | ||
136 | * a tick is charged to a task's system time. So, at the end we | ||
137 | * will have memory usage multiplied by system time. Thus an | ||
138 | * average usage per system time unit can be calculated. | ||
139 | */ | ||
140 | __u64 coremem; /* accumulated RSS usage in MB-usec */ | ||
141 | |||
142 | /* Accumulated virtual memory usage in duration of a task. | ||
143 | * Same as acct_rss_mem1 above except that we keep track of VM usage. | ||
144 | */ | ||
145 | __u64 virtmem; /* accumulated VM usage in MB-usec */ | ||
146 | |||
147 | /* High watermark of RSS usage in duration of a task, in KBytes. */ | ||
148 | __u64 hiwater_rss; /* High-watermark of RSS usage */ | ||
149 | |||
150 | /* High watermark of VM usage in duration of a task, in KBytes. */ | ||
151 | __u64 hiwater_vm; /* High-water virtual memory usage */ | ||
152 | |||
153 | /* The following four fields are I/O statistics of a task. */ | ||
154 | __u64 read_char; /* bytes read */ | ||
155 | __u64 write_char; /* bytes written */ | ||
156 | __u64 read_syscalls; /* read syscalls */ | ||
157 | __u64 write_syscalls; /* write syscalls */ | ||
158 | |||
159 | /* Extended accounting fields end */ | ||
160 | |||
161 | } | ||
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt index 76b44290c154..842f0d1ab216 100644 --- a/Documentation/cpusets.txt +++ b/Documentation/cpusets.txt | |||
@@ -217,11 +217,11 @@ exclusive cpuset. Also, the use of a Linux virtual file system (vfs) | |||
217 | to represent the cpuset hierarchy provides for a familiar permission | 217 | to represent the cpuset hierarchy provides for a familiar permission |
218 | and name space for cpusets, with a minimum of additional kernel code. | 218 | and name space for cpusets, with a minimum of additional kernel code. |
219 | 219 | ||
220 | The cpus file in the root (top_cpuset) cpuset is read-only. | 220 | The cpus and mems files in the root (top_cpuset) cpuset are |
221 | It automatically tracks the value of cpu_online_map, using a CPU | 221 | read-only. The cpus file automatically tracks the value of |
222 | hotplug notifier. If and when memory nodes can be hotplugged, | 222 | cpu_online_map using a CPU hotplug notifier, and the mems file |
223 | we expect to make the mems file in the root cpuset read-only | 223 | automatically tracks the value of node_online_map using the |
224 | as well, and have it track the value of node_online_map. | 224 | cpuset_track_online_nodes() hook. |
225 | 225 | ||
226 | 226 | ||
227 | 1.4 What are exclusive cpusets ? | 227 | 1.4 What are exclusive cpusets ? |
diff --git a/Documentation/crypto/api-intro.txt b/Documentation/crypto/api-intro.txt index 74dffc68ff9f..5a03a2801d67 100644 --- a/Documentation/crypto/api-intro.txt +++ b/Documentation/crypto/api-intro.txt | |||
@@ -19,15 +19,14 @@ At the lowest level are algorithms, which register dynamically with the | |||
19 | API. | 19 | API. |
20 | 20 | ||
21 | 'Transforms' are user-instantiated objects, which maintain state, handle all | 21 | 'Transforms' are user-instantiated objects, which maintain state, handle all |
22 | of the implementation logic (e.g. manipulating page vectors), provide an | 22 | of the implementation logic (e.g. manipulating page vectors) and provide an |
23 | abstraction to the underlying algorithms, and handle common logical | 23 | abstraction to the underlying algorithms. However, at the user |
24 | operations (e.g. cipher modes, HMAC for digests). However, at the user | ||
25 | level they are very simple. | 24 | level they are very simple. |
26 | 25 | ||
27 | Conceptually, the API layering looks like this: | 26 | Conceptually, the API layering looks like this: |
28 | 27 | ||
29 | [transform api] (user interface) | 28 | [transform api] (user interface) |
30 | [transform ops] (per-type logic glue e.g. cipher.c, digest.c) | 29 | [transform ops] (per-type logic glue e.g. cipher.c, compress.c) |
31 | [algorithm api] (for registering algorithms) | 30 | [algorithm api] (for registering algorithms) |
32 | 31 | ||
33 | The idea is to make the user interface and algorithm registration API | 32 | The idea is to make the user interface and algorithm registration API |
@@ -44,22 +43,27 @@ under development. | |||
44 | Here's an example of how to use the API: | 43 | Here's an example of how to use the API: |
45 | 44 | ||
46 | #include <linux/crypto.h> | 45 | #include <linux/crypto.h> |
46 | #include <linux/err.h> | ||
47 | #include <linux/scatterlist.h> | ||
47 | 48 | ||
48 | struct scatterlist sg[2]; | 49 | struct scatterlist sg[2]; |
49 | char result[128]; | 50 | char result[128]; |
50 | struct crypto_tfm *tfm; | 51 | struct crypto_hash *tfm; |
52 | struct hash_desc desc; | ||
51 | 53 | ||
52 | tfm = crypto_alloc_tfm("md5", 0); | 54 | tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); |
53 | if (tfm == NULL) | 55 | if (IS_ERR(tfm)) |
54 | fail(); | 56 | fail(); |
55 | 57 | ||
56 | /* ... set up the scatterlists ... */ | 58 | /* ... set up the scatterlists ... */ |
59 | |||
60 | desc.tfm = tfm; | ||
61 | desc.flags = 0; | ||
57 | 62 | ||
58 | crypto_digest_init(tfm); | 63 | if (crypto_hash_digest(&desc, &sg, 2, result)) |
59 | crypto_digest_update(tfm, &sg, 2); | 64 | fail(); |
60 | crypto_digest_final(tfm, result); | ||
61 | 65 | ||
62 | crypto_free_tfm(tfm); | 66 | crypto_free_hash(tfm); |
63 | 67 | ||
64 | 68 | ||
65 | Many real examples are available in the regression test module (tcrypt.c). | 69 | Many real examples are available in the regression test module (tcrypt.c). |
@@ -126,7 +130,7 @@ might already be working on. | |||
126 | BUGS | 130 | BUGS |
127 | 131 | ||
128 | Send bug reports to: | 132 | Send bug reports to: |
129 | James Morris <jmorris@redhat.com> | 133 | Herbert Xu <herbert@gondor.apana.org.au> |
130 | Cc: David S. Miller <davem@redhat.com> | 134 | Cc: David S. Miller <davem@redhat.com> |
131 | 135 | ||
132 | 136 | ||
@@ -134,13 +138,14 @@ FURTHER INFORMATION | |||
134 | 138 | ||
135 | For further patches and various updates, including the current TODO | 139 | For further patches and various updates, including the current TODO |
136 | list, see: | 140 | list, see: |
137 | http://samba.org/~jamesm/crypto/ | 141 | http://gondor.apana.org.au/~herbert/crypto/ |
138 | 142 | ||
139 | 143 | ||
140 | AUTHORS | 144 | AUTHORS |
141 | 145 | ||
142 | James Morris | 146 | James Morris |
143 | David S. Miller | 147 | David S. Miller |
148 | Herbert Xu | ||
144 | 149 | ||
145 | 150 | ||
146 | CREDITS | 151 | CREDITS |
@@ -238,8 +243,11 @@ Anubis algorithm contributors: | |||
238 | Tiger algorithm contributors: | 243 | Tiger algorithm contributors: |
239 | Aaron Grothe | 244 | Aaron Grothe |
240 | 245 | ||
246 | VIA PadLock contributors: | ||
247 | Michal Ludvig | ||
248 | |||
241 | Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com> | 249 | Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com> |
242 | 250 | ||
243 | Please send any credits updates or corrections to: | 251 | Please send any credits updates or corrections to: |
244 | James Morris <jmorris@redhat.com> | 252 | Herbert Xu <herbert@gondor.apana.org.au> |
245 | 253 | ||
diff --git a/Documentation/devices.txt b/Documentation/devices.txt index 66c725f530f3..addc67b1d770 100644 --- a/Documentation/devices.txt +++ b/Documentation/devices.txt | |||
@@ -2543,6 +2543,9 @@ Your cooperation is appreciated. | |||
2543 | 64 = /dev/usb/rio500 Diamond Rio 500 | 2543 | 64 = /dev/usb/rio500 Diamond Rio 500 |
2544 | 65 = /dev/usb/usblcd USBLCD Interface (info@usblcd.de) | 2544 | 65 = /dev/usb/usblcd USBLCD Interface (info@usblcd.de) |
2545 | 66 = /dev/usb/cpad0 Synaptics cPad (mouse/LCD) | 2545 | 66 = /dev/usb/cpad0 Synaptics cPad (mouse/LCD) |
2546 | 67 = /dev/usb/adutux0 1st Ontrak ADU device | ||
2547 | ... | ||
2548 | 76 = /dev/usb/adutux10 10th Ontrak ADU device | ||
2546 | 96 = /dev/usb/hiddev0 1st USB HID device | 2549 | 96 = /dev/usb/hiddev0 1st USB HID device |
2547 | ... | 2550 | ... |
2548 | 111 = /dev/usb/hiddev15 16th USB HID device | 2551 | 111 = /dev/usb/hiddev15 16th USB HID device |
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 24adfe9af3ca..63c2d0c55aa2 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -135,6 +135,7 @@ tags | |||
135 | times.h* | 135 | times.h* |
136 | tkparse | 136 | tkparse |
137 | trix_boot.h | 137 | trix_boot.h |
138 | utsrelease.h* | ||
138 | version.h* | 139 | version.h* |
139 | vmlinux | 140 | vmlinux |
140 | vmlinux-* | 141 | vmlinux-* |
diff --git a/Documentation/fb/intelfb.txt b/Documentation/fb/intelfb.txt index c12d39a23c3d..aa0d322db171 100644 --- a/Documentation/fb/intelfb.txt +++ b/Documentation/fb/intelfb.txt | |||
@@ -1,16 +1,19 @@ | |||
1 | Intel 830M/845G/852GM/855GM/865G/915G Framebuffer driver | 1 | Intel 830M/845G/852GM/855GM/865G/915G/945G Framebuffer driver |
2 | ================================================================ | 2 | ================================================================ |
3 | 3 | ||
4 | A. Introduction | 4 | A. Introduction |
5 | This is a framebuffer driver for various Intel 810/815 compatible | 5 | This is a framebuffer driver for various Intel 8xx/9xx compatible |
6 | graphics devices. These would include: | 6 | graphics devices. These would include: |
7 | 7 | ||
8 | Intel 830M | 8 | Intel 830M |
9 | Intel 810E845G | 9 | Intel 845G |
10 | Intel 852GM | 10 | Intel 852GM |
11 | Intel 855GM | 11 | Intel 855GM |
12 | Intel 865G | 12 | Intel 865G |
13 | Intel 915G | 13 | Intel 915G |
14 | Intel 915GM | ||
15 | Intel 945G | ||
16 | Intel 945GM | ||
14 | 17 | ||
15 | B. List of available options | 18 | B. List of available options |
16 | 19 | ||
@@ -78,7 +81,7 @@ C. Kernel booting | |||
78 | Separate each option/option-pair by commas (,) and the option from its value | 81 | Separate each option/option-pair by commas (,) and the option from its value |
79 | with an equals sign (=) as in the following: | 82 | with an equals sign (=) as in the following: |
80 | 83 | ||
81 | video=i810fb:option1,option2=value2 | 84 | video=intelfb:option1,option2=value2 |
82 | 85 | ||
83 | Sample Usage | 86 | Sample Usage |
84 | ------------ | 87 | ------------ |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 552507fe9a7e..9364f47c7116 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -6,6 +6,21 @@ be removed from this file. | |||
6 | 6 | ||
7 | --------------------------- | 7 | --------------------------- |
8 | 8 | ||
9 | What: /sys/devices/.../power/state | ||
10 | dev->power.power_state | ||
11 | dpm_runtime_{suspend,resume)() | ||
12 | When: July 2007 | ||
13 | Why: Broken design for runtime control over driver power states, confusing | ||
14 | driver-internal runtime power management with: mechanisms to support | ||
15 | system-wide sleep state transitions; event codes that distinguish | ||
16 | different phases of swsusp "sleep" transitions; and userspace policy | ||
17 | inputs. This framework was never widely used, and most attempts to | ||
18 | use it were broken. Drivers should instead be exposing domain-specific | ||
19 | interfaces either to kernel or to userspace. | ||
20 | Who: Pavel Machek <pavel@suse.cz> | ||
21 | |||
22 | --------------------------- | ||
23 | |||
9 | What: RAW driver (CONFIG_RAW_DRIVER) | 24 | What: RAW driver (CONFIG_RAW_DRIVER) |
10 | When: December 2005 | 25 | When: December 2005 |
11 | Why: declared obsolete since kernel 2.6.3 | 26 | Why: declared obsolete since kernel 2.6.3 |
@@ -31,17 +46,8 @@ Who: Jody McIntyre <scjody@modernduck.com> | |||
31 | 46 | ||
32 | --------------------------- | 47 | --------------------------- |
33 | 48 | ||
34 | What: sbp2: module parameter "force_inquiry_hack" | ||
35 | When: July 2006 | ||
36 | Why: Superceded by parameter "workarounds". Both parameters are meant to be | ||
37 | used ad-hoc and for single devices only, i.e. not in modprobe.conf, | ||
38 | therefore the impact of this feature replacement should be low. | ||
39 | Who: Stefan Richter <stefanr@s5r6.in-berlin.de> | ||
40 | |||
41 | --------------------------- | ||
42 | |||
43 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. | 49 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. |
44 | When: July 2006 | 50 | When: December 2006 |
45 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 | 51 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 |
46 | series. The old API have lots of drawbacks and don't provide enough | 52 | series. The old API have lots of drawbacks and don't provide enough |
47 | means to work with all video and audio standards. The newer API is | 53 | means to work with all video and audio standards. The newer API is |
@@ -55,6 +61,18 @@ Who: Mauro Carvalho Chehab <mchehab@brturbo.com.br> | |||
55 | 61 | ||
56 | --------------------------- | 62 | --------------------------- |
57 | 63 | ||
64 | What: sys_sysctl | ||
65 | When: January 2007 | ||
66 | Why: The same information is available through /proc/sys and that is the | ||
67 | interface user space prefers to use. And there do not appear to be | ||
68 | any existing user in user space of sys_sysctl. The additional | ||
69 | maintenance overhead of keeping a set of binary names gets | ||
70 | in the way of doing a good job of maintaining this interface. | ||
71 | |||
72 | Who: Eric Biederman <ebiederm@xmission.com> | ||
73 | |||
74 | --------------------------- | ||
75 | |||
58 | What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) | 76 | What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) |
59 | When: November 2005 | 77 | When: November 2005 |
60 | Files: drivers/pcmcia/: pcmcia_ioctl.c | 78 | Files: drivers/pcmcia/: pcmcia_ioctl.c |
@@ -202,14 +220,6 @@ Who: Nick Piggin <npiggin@suse.de> | |||
202 | 220 | ||
203 | --------------------------- | 221 | --------------------------- |
204 | 222 | ||
205 | What: Support for the MIPS EV96100 evaluation board | ||
206 | When: September 2006 | ||
207 | Why: Does no longer build since at least November 15, 2003, apparently | ||
208 | no userbase left. | ||
209 | Who: Ralf Baechle <ralf@linux-mips.org> | ||
210 | |||
211 | --------------------------- | ||
212 | |||
213 | What: Support for the Momentum / PMC-Sierra Jaguar ATX evaluation board | 223 | What: Support for the Momentum / PMC-Sierra Jaguar ATX evaluation board |
214 | When: September 2006 | 224 | When: September 2006 |
215 | Why: Does no longer build since quite some time, and was never popular, | 225 | Why: Does no longer build since quite some time, and was never popular, |
@@ -294,3 +304,24 @@ Why: The frame diverter is included in most distribution kernels, but is | |||
294 | It is not clear if anyone is still using it. | 304 | It is not clear if anyone is still using it. |
295 | Who: Stephen Hemminger <shemminger@osdl.org> | 305 | Who: Stephen Hemminger <shemminger@osdl.org> |
296 | 306 | ||
307 | --------------------------- | ||
308 | |||
309 | |||
310 | What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment | ||
311 | When: Oktober 2008 | ||
312 | Why: The stacking of class devices makes these values misleading and | ||
313 | inconsistent. | ||
314 | Class devices should not carry any of these properties, and bus | ||
315 | devices have SUBSYTEM and DRIVER as a replacement. | ||
316 | Who: Kay Sievers <kay.sievers@suse.de> | ||
317 | |||
318 | --------------------------- | ||
319 | |||
320 | What: i2c-isa | ||
321 | When: December 2006 | ||
322 | Why: i2c-isa is a non-sense and doesn't fit in the device driver | ||
323 | model. Drivers relying on it are better implemented as platform | ||
324 | drivers. | ||
325 | Who: Jean Delvare <khali@linux-fr.org> | ||
326 | |||
327 | --------------------------- | ||
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 247d7f619aa2..eb1a6cad21e6 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -356,10 +356,9 @@ The last two are called only from check_disk_change(). | |||
356 | prototypes: | 356 | prototypes: |
357 | loff_t (*llseek) (struct file *, loff_t, int); | 357 | loff_t (*llseek) (struct file *, loff_t, int); |
358 | ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); | 358 | ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); |
359 | ssize_t (*aio_read) (struct kiocb *, char __user *, size_t, loff_t); | ||
360 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 359 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
361 | ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, | 360 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
362 | loff_t); | 361 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
363 | int (*readdir) (struct file *, void *, filldir_t); | 362 | int (*readdir) (struct file *, void *, filldir_t); |
364 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 363 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
365 | int (*ioctl) (struct inode *, struct file *, unsigned int, | 364 | int (*ioctl) (struct inode *, struct file *, unsigned int, |
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 99902ae6804e..7240ee7515de 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -39,6 +39,8 @@ Table of Contents | |||
39 | 2.9 Appletalk | 39 | 2.9 Appletalk |
40 | 2.10 IPX | 40 | 2.10 IPX |
41 | 2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem | 41 | 2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem |
42 | 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score | ||
43 | 2.13 /proc/<pid>/oom_score - Display current oom-killer score | ||
42 | 44 | ||
43 | ------------------------------------------------------------------------------ | 45 | ------------------------------------------------------------------------------ |
44 | Preface | 46 | Preface |
@@ -1124,11 +1126,15 @@ debugging information is displayed on console. | |||
1124 | NMI switch that most IA32 servers have fires unknown NMI up, for example. | 1126 | NMI switch that most IA32 servers have fires unknown NMI up, for example. |
1125 | If a system hangs up, try pressing the NMI switch. | 1127 | If a system hangs up, try pressing the NMI switch. |
1126 | 1128 | ||
1127 | [NOTE] | 1129 | nmi_watchdog |
1128 | This function and oprofile share a NMI callback. Therefore this function | 1130 | ------------ |
1129 | cannot be enabled when oprofile is activated. | 1131 | |
1130 | And NMI watchdog will be disabled when the value in this file is set to | 1132 | Enables/Disables the NMI watchdog on x86 systems. When the value is non-zero |
1131 | non-zero. | 1133 | the NMI watchdog is enabled and will continuously test all online cpus to |
1134 | determine whether or not they are still functioning properly. | ||
1135 | |||
1136 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI | ||
1137 | watchdog, oprofile may have more registers to utilize. | ||
1132 | 1138 | ||
1133 | 1139 | ||
1134 | 2.4 /proc/sys/vm - The virtual memory subsystem | 1140 | 2.4 /proc/sys/vm - The virtual memory subsystem |
@@ -1958,6 +1964,22 @@ a queue must be less or equal then msg_max. | |||
1958 | maximum message size value (it is every message queue's attribute set during | 1964 | maximum message size value (it is every message queue's attribute set during |
1959 | its creation). | 1965 | its creation). |
1960 | 1966 | ||
1967 | 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score | ||
1968 | ------------------------------------------------------ | ||
1969 | |||
1970 | This file can be used to adjust the score used to select which processes | ||
1971 | should be killed in an out-of-memory situation. Giving it a high score will | ||
1972 | increase the likelihood of this process being killed by the oom-killer. Valid | ||
1973 | values are in the range -16 to +15, plus the special value -17, which disables | ||
1974 | oom-killing altogether for this process. | ||
1975 | |||
1976 | 2.13 /proc/<pid>/oom_score - Display current oom-killer score | ||
1977 | ------------------------------------------------------------- | ||
1978 | |||
1979 | ------------------------------------------------------------------------------ | ||
1980 | This file can be used to check the current score used by the oom-killer is for | ||
1981 | any given <pid>. Use it together with /proc/<pid>/oom_adj to tune which | ||
1982 | process should be killed in an out-of-memory situation. | ||
1961 | 1983 | ||
1962 | ------------------------------------------------------------------------------ | 1984 | ------------------------------------------------------------------------------ |
1963 | Summary | 1985 | Summary |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 1cb7e8be927a..cd07c21b8400 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -699,9 +699,9 @@ This describes how the VFS can manipulate an open file. As of kernel | |||
699 | struct file_operations { | 699 | struct file_operations { |
700 | loff_t (*llseek) (struct file *, loff_t, int); | 700 | loff_t (*llseek) (struct file *, loff_t, int); |
701 | ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); | 701 | ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); |
702 | ssize_t (*aio_read) (struct kiocb *, char __user *, size_t, loff_t); | ||
703 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 702 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
704 | ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, loff_t); | 703 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
704 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | ||
705 | int (*readdir) (struct file *, void *, filldir_t); | 705 | int (*readdir) (struct file *, void *, filldir_t); |
706 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 706 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
707 | int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); | 707 | int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); |
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index 9555be1ed999..e783fd62e308 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -13,12 +13,25 @@ Supported chips: | |||
13 | from Super I/O config space (8 I/O ports) | 13 | from Super I/O config space (8 I/O ports) |
14 | Datasheet: Publicly available at the ITE website | 14 | Datasheet: Publicly available at the ITE website |
15 | http://www.ite.com.tw/ | 15 | http://www.ite.com.tw/ |
16 | * IT8716F | ||
17 | Prefix: 'it8716' | ||
18 | Addresses scanned: from Super I/O config space (8 I/O ports) | ||
19 | Datasheet: Publicly available at the ITE website | ||
20 | http://www.ite.com.tw/product_info/file/pc/IT8716F_V0.3.ZIP | ||
21 | * IT8718F | ||
22 | Prefix: 'it8718' | ||
23 | Addresses scanned: from Super I/O config space (8 I/O ports) | ||
24 | Datasheet: Publicly available at the ITE website | ||
25 | http://www.ite.com.tw/product_info/file/pc/IT8718F_V0.2.zip | ||
26 | http://www.ite.com.tw/product_info/file/pc/IT8718F_V0%203_(for%20C%20version).zip | ||
16 | * SiS950 [clone of IT8705F] | 27 | * SiS950 [clone of IT8705F] |
17 | Prefix: 'it87' | 28 | Prefix: 'it87' |
18 | Addresses scanned: from Super I/O config space (8 I/O ports) | 29 | Addresses scanned: from Super I/O config space (8 I/O ports) |
19 | Datasheet: No longer be available | 30 | Datasheet: No longer be available |
20 | 31 | ||
21 | Author: Christophe Gauthron <chrisg@0-in.com> | 32 | Authors: |
33 | Christophe Gauthron <chrisg@0-in.com> | ||
34 | Jean Delvare <khali@linux-fr.org> | ||
22 | 35 | ||
23 | 36 | ||
24 | Module Parameters | 37 | Module Parameters |
@@ -43,26 +56,46 @@ Module Parameters | |||
43 | Description | 56 | Description |
44 | ----------- | 57 | ----------- |
45 | 58 | ||
46 | This driver implements support for the IT8705F, IT8712F and SiS950 chips. | 59 | This driver implements support for the IT8705F, IT8712F, IT8716F, |
47 | 60 | IT8718F and SiS950 chips. | |
48 | This driver also supports IT8712F, which adds SMBus access, and a VID | ||
49 | input, used to report the Vcore voltage of the Pentium processor. | ||
50 | The IT8712F additionally features VID inputs. | ||
51 | 61 | ||
52 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, | 62 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, |
53 | joysticks and other miscellaneous stuff. For hardware monitoring, they | 63 | joysticks and other miscellaneous stuff. For hardware monitoring, they |
54 | include an 'environment controller' with 3 temperature sensors, 3 fan | 64 | include an 'environment controller' with 3 temperature sensors, 3 fan |
55 | rotation speed sensors, 8 voltage sensors, and associated alarms. | 65 | rotation speed sensors, 8 voltage sensors, and associated alarms. |
56 | 66 | ||
67 | The IT8712F and IT8716F additionally feature VID inputs, used to report | ||
68 | the Vcore voltage of the processor. The early IT8712F have 5 VID pins, | ||
69 | the IT8716F and late IT8712F have 6. They are shared with other functions | ||
70 | though, so the functionality may not be available on a given system. | ||
71 | The driver dumbly assume it is there. | ||
72 | |||
73 | The IT8718F also features VID inputs (up to 8 pins) but the value is | ||
74 | stored in the Super-I/O configuration space. Due to technical limitations, | ||
75 | this value can currently only be read once at initialization time, so | ||
76 | the driver won't notice and report changes in the VID value. The two | ||
77 | upper VID bits share their pins with voltage inputs (in5 and in6) so you | ||
78 | can't have both on a given board. | ||
79 | |||
80 | The IT8716F, IT8718F and later IT8712F revisions have support for | ||
81 | 2 additional fans. They are not yet supported by the driver. | ||
82 | |||
83 | The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional | ||
84 | 16-bit tachometer counters for fans 1 to 3. This is better (no more fan | ||
85 | clock divider mess) but not compatible with the older chips and | ||
86 | revisions. For now, the driver only uses the 16-bit mode on the | ||
87 | IT8716F and IT8718F. | ||
88 | |||
57 | Temperatures are measured in degrees Celsius. An alarm is triggered once | 89 | Temperatures are measured in degrees Celsius. An alarm is triggered once |
58 | when the Overtemperature Shutdown limit is crossed. | 90 | when the Overtemperature Shutdown limit is crossed. |
59 | 91 | ||
60 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is | 92 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is |
61 | triggered if the rotation speed has dropped below a programmable limit. Fan | 93 | triggered if the rotation speed has dropped below a programmable limit. When |
62 | readings can be divided by a programmable divider (1, 2, 4 or 8) to give the | 94 | 16-bit tachometer counters aren't used, fan readings can be divided by |
63 | readings more range or accuracy. Not all RPM values can accurately be | 95 | a programmable divider (1, 2, 4 or 8) to give the readings more range or |
64 | represented, so some rounding is done. With a divider of 2, the lowest | 96 | accuracy. With a divider of 2, the lowest representable value is around |
65 | representable value is around 2600 RPM. | 97 | 2600 RPM. Not all RPM values can accurately be represented, so some rounding |
98 | is done. | ||
66 | 99 | ||
67 | Voltage sensors (also known as IN sensors) report their values in volts. An | 100 | Voltage sensors (also known as IN sensors) report their values in volts. An |
68 | alarm is triggered if the voltage has crossed a programmable minimum or | 101 | alarm is triggered if the voltage has crossed a programmable minimum or |
@@ -71,9 +104,9 @@ zero'; this is important for negative voltage measurements. All voltage | |||
71 | inputs can measure voltages between 0 and 4.08 volts, with a resolution of | 104 | inputs can measure voltages between 0 and 4.08 volts, with a resolution of |
72 | 0.016 volt. The battery voltage in8 does not have limit registers. | 105 | 0.016 volt. The battery voltage in8 does not have limit registers. |
73 | 106 | ||
74 | The VID lines (IT8712F only) encode the core voltage value: the voltage | 107 | The VID lines (IT8712F/IT8716F/IT8718F) encode the core voltage value: |
75 | level your processor should work with. This is hardcoded by the mainboard | 108 | the voltage level your processor should work with. This is hardcoded by |
76 | and/or processor itself. It is a value in volts. | 109 | the mainboard and/or processor itself. It is a value in volts. |
77 | 110 | ||
78 | If an alarm triggers, it will remain triggered until the hardware register | 111 | If an alarm triggers, it will remain triggered until the hardware register |
79 | is read at least once. This means that the cause for the alarm may already | 112 | is read at least once. This means that the cause for the alarm may already |
diff --git a/Documentation/hwmon/k8temp b/Documentation/hwmon/k8temp new file mode 100644 index 000000000000..bab445ab0f52 --- /dev/null +++ b/Documentation/hwmon/k8temp | |||
@@ -0,0 +1,52 @@ | |||
1 | Kernel driver k8temp | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * AMD K8 CPU | ||
6 | Prefix: 'k8temp' | ||
7 | Addresses scanned: PCI space | ||
8 | Datasheet: http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf | ||
9 | |||
10 | Author: Rudolf Marek | ||
11 | Contact: Rudolf Marek <r.marek@sh.cvut.cz> | ||
12 | |||
13 | Description | ||
14 | ----------- | ||
15 | |||
16 | This driver permits reading temperature sensor(s) embedded inside AMD K8 CPUs. | ||
17 | Official documentation says that it works from revision F of K8 core, but | ||
18 | in fact it seems to be implemented for all revisions of K8 except the first | ||
19 | two revisions (SH-B0 and SH-B3). | ||
20 | |||
21 | There can be up to four temperature sensors inside single CPU. The driver | ||
22 | will auto-detect the sensors and will display only temperatures from | ||
23 | implemented sensors. | ||
24 | |||
25 | Mapping of /sys files is as follows: | ||
26 | |||
27 | temp1_input - temperature of Core 0 and "place" 0 | ||
28 | temp2_input - temperature of Core 0 and "place" 1 | ||
29 | temp3_input - temperature of Core 1 and "place" 0 | ||
30 | temp4_input - temperature of Core 1 and "place" 1 | ||
31 | |||
32 | Temperatures are measured in degrees Celsius and measurement resolution is | ||
33 | 1 degree C. It is expected that future CPU will have better resolution. The | ||
34 | temperature is updated once a second. Valid temperatures are from -49 to | ||
35 | 206 degrees C. | ||
36 | |||
37 | Temperature known as TCaseMax was specified for processors up to revision E. | ||
38 | This temperature is defined as temperature between heat-spreader and CPU | ||
39 | case, so the internal CPU temperature supplied by this driver can be higher. | ||
40 | There is no easy way how to measure the temperature which will correlate | ||
41 | with TCaseMax temperature. | ||
42 | |||
43 | For newer revisions of CPU (rev F, socket AM2) there is a mathematically | ||
44 | computed temperature called TControl, which must be lower than TControlMax. | ||
45 | |||
46 | The relationship is following: | ||
47 | |||
48 | temp1_input - TjOffset*2 < TControlMax, | ||
49 | |||
50 | TjOffset is not yet exported by the driver, TControlMax is usually | ||
51 | 70 degrees C. The rule of the thumb -> CPU temperature should not cross | ||
52 | 60 degrees C too much. | ||
diff --git a/Documentation/hwmon/vt1211 b/Documentation/hwmon/vt1211 new file mode 100644 index 000000000000..77fa633b97a8 --- /dev/null +++ b/Documentation/hwmon/vt1211 | |||
@@ -0,0 +1,206 @@ | |||
1 | Kernel driver vt1211 | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * VIA VT1211 | ||
6 | Prefix: 'vt1211' | ||
7 | Addresses scanned: none, address read from Super-I/O config space | ||
8 | Datasheet: Provided by VIA upon request and under NDA | ||
9 | |||
10 | Authors: Juerg Haefliger <juergh@gmail.com> | ||
11 | |||
12 | This driver is based on the driver for kernel 2.4 by Mark D. Studebaker and | ||
13 | its port to kernel 2.6 by Lars Ekman. | ||
14 | |||
15 | Thanks to Joseph Chan and Fiona Gatt from VIA for providing documentation and | ||
16 | technical support. | ||
17 | |||
18 | |||
19 | Module Parameters | ||
20 | ----------------- | ||
21 | |||
22 | * uch_config: int Override the BIOS default universal channel (UCH) | ||
23 | configuration for channels 1-5. | ||
24 | Legal values are in the range of 0-31. Bit 0 maps to | ||
25 | UCH1, bit 1 maps to UCH2 and so on. Setting a bit to 1 | ||
26 | enables the thermal input of that particular UCH and | ||
27 | setting a bit to 0 enables the voltage input. | ||
28 | |||
29 | * int_mode: int Override the BIOS default temperature interrupt mode. | ||
30 | The only possible value is 0 which forces interrupt | ||
31 | mode 0. In this mode, any pending interrupt is cleared | ||
32 | when the status register is read but is regenerated as | ||
33 | long as the temperature stays above the hysteresis | ||
34 | limit. | ||
35 | |||
36 | Be aware that overriding BIOS defaults might cause some unwanted side effects! | ||
37 | |||
38 | |||
39 | Description | ||
40 | ----------- | ||
41 | |||
42 | The VIA VT1211 Super-I/O chip includes complete hardware monitoring | ||
43 | capabilities. It monitors 2 dedicated temperature sensor inputs (temp1 and | ||
44 | temp2), 1 dedicated voltage (in5) and 2 fans. Additionally, the chip | ||
45 | implements 5 universal input channels (UCH1-5) that can be individually | ||
46 | programmed to either monitor a voltage or a temperature. | ||
47 | |||
48 | This chip also provides manual and automatic control of fan speeds (according | ||
49 | to the datasheet). The driver only supports automatic control since the manual | ||
50 | mode doesn't seem to work as advertised in the datasheet. In fact I couldn't | ||
51 | get manual mode to work at all! Be aware that automatic mode hasn't been | ||
52 | tested very well (due to the fact that my EPIA M10000 doesn't have the fans | ||
53 | connected to the PWM outputs of the VT1211 :-(). | ||
54 | |||
55 | The following table shows the relationship between the vt1211 inputs and the | ||
56 | sysfs nodes. | ||
57 | |||
58 | Sensor Voltage Mode Temp Mode Default Use (from the datasheet) | ||
59 | ------ ------------ --------- -------------------------------- | ||
60 | Reading 1 temp1 Intel thermal diode | ||
61 | Reading 3 temp2 Internal thermal diode | ||
62 | UCH1/Reading2 in0 temp3 NTC type thermistor | ||
63 | UCH2 in1 temp4 +2.5V | ||
64 | UCH3 in2 temp5 VccP (processor core) | ||
65 | UCH4 in3 temp6 +5V | ||
66 | UCH5 in4 temp7 +12V | ||
67 | +3.3V in5 Internal VCC (+3.3V) | ||
68 | |||
69 | |||
70 | Voltage Monitoring | ||
71 | ------------------ | ||
72 | |||
73 | Voltages are sampled by an 8-bit ADC with a LSB of ~10mV. The supported input | ||
74 | range is thus from 0 to 2.60V. Voltage values outside of this range need | ||
75 | external scaling resistors. This external scaling needs to be compensated for | ||
76 | via compute lines in sensors.conf, like: | ||
77 | |||
78 | compute inx @*(1+R1/R2), @/(1+R1/R2) | ||
79 | |||
80 | The board level scaling resistors according to VIA's recommendation are as | ||
81 | follows. And this is of course totally dependent on the actual board | ||
82 | implementation :-) You will have to find documentation for your own | ||
83 | motherboard and edit sensors.conf accordingly. | ||
84 | |||
85 | Expected | ||
86 | Voltage R1 R2 Divider Raw Value | ||
87 | ----------------------------------------------- | ||
88 | +2.5V 2K 10K 1.2 2083 mV | ||
89 | VccP --- --- 1.0 1400 mV (1) | ||
90 | +5V 14K 10K 2.4 2083 mV | ||
91 | +12V 47K 10K 5.7 2105 mV | ||
92 | +3.3V (int) 2K 3.4K 1.588 3300 mV (2) | ||
93 | +3.3V (ext) 6.8K 10K 1.68 1964 mV | ||
94 | |||
95 | (1) Depending on the CPU (1.4V is for a VIA C3 Nehemiah). | ||
96 | (2) R1 and R2 for 3.3V (int) are internal to the VT1211 chip and the driver | ||
97 | performs the scaling and returns the properly scaled voltage value. | ||
98 | |||
99 | Each measured voltage has an associated low and high limit which triggers an | ||
100 | alarm when crossed. | ||
101 | |||
102 | |||
103 | Temperature Monitoring | ||
104 | ---------------------- | ||
105 | |||
106 | Temperatures are reported in millidegree Celsius. Each measured temperature | ||
107 | has a high limit which triggers an alarm if crossed. There is an associated | ||
108 | hysteresis value with each temperature below which the temperature has to drop | ||
109 | before the alarm is cleared (this is only true for interrupt mode 0). The | ||
110 | interrupt mode can be forced to 0 in case the BIOS doesn't do it | ||
111 | automatically. See the 'Module Parameters' section for details. | ||
112 | |||
113 | All temperature channels except temp2 are external. Temp2 is the VT1211 | ||
114 | internal thermal diode and the driver does all the scaling for temp2 and | ||
115 | returns the temperature in millidegree Celsius. For the external channels | ||
116 | temp1 and temp3-temp7, scaling depends on the board implementation and needs | ||
117 | to be performed in userspace via sensors.conf. | ||
118 | |||
119 | Temp1 is an Intel-type thermal diode which requires the following formula to | ||
120 | convert between sysfs readings and real temperatures: | ||
121 | |||
122 | compute temp1 (@-Offset)/Gain, (@*Gain)+Offset | ||
123 | |||
124 | According to the VIA VT1211 BIOS porting guide, the following gain and offset | ||
125 | values should be used: | ||
126 | |||
127 | Diode Type Offset Gain | ||
128 | ---------- ------ ---- | ||
129 | Intel CPU 88.638 0.9528 | ||
130 | 65.000 0.9686 *) | ||
131 | VIA C3 Ezra 83.869 0.9528 | ||
132 | VIA C3 Ezra-T 73.869 0.9528 | ||
133 | |||
134 | *) This is the formula from the lm_sensors 2.10.0 sensors.conf file. I don't | ||
135 | know where it comes from or how it was derived, it's just listed here for | ||
136 | completeness. | ||
137 | |||
138 | Temp3-temp7 support NTC thermistors. For these channels, the driver returns | ||
139 | the voltages as seen at the individual pins of UCH1-UCH5. The voltage at the | ||
140 | pin (Vpin) is formed by a voltage divider made of the thermistor (Rth) and a | ||
141 | scaling resistor (Rs): | ||
142 | |||
143 | Vpin = 2200 * Rth / (Rs + Rth) (2200 is the ADC max limit of 2200 mV) | ||
144 | |||
145 | The equation for the thermistor is as follows (google it if you want to know | ||
146 | more about it): | ||
147 | |||
148 | Rth = Ro * exp(B * (1 / T - 1 / To)) (To is 298.15K (25C) and Ro is the | ||
149 | nominal resistance at 25C) | ||
150 | |||
151 | Mingling the above two equations and assuming Rs = Ro and B = 3435 yields the | ||
152 | following formula for sensors.conf: | ||
153 | |||
154 | compute tempx 1 / (1 / 298.15 - (` (2200 / @ - 1)) / 3435) - 273.15, | ||
155 | 2200 / (1 + (^ (3435 / 298.15 - 3435 / (273.15 + @)))) | ||
156 | |||
157 | |||
158 | Fan Speed Control | ||
159 | ----------------- | ||
160 | |||
161 | The VT1211 provides 2 programmable PWM outputs to control the speeds of 2 | ||
162 | fans. Writing a 2 to any of the two pwm[1-2]_enable sysfs nodes will put the | ||
163 | PWM controller in automatic mode. There is only a single controller that | ||
164 | controls both PWM outputs but each PWM output can be individually enabled and | ||
165 | disabled. | ||
166 | |||
167 | Each PWM has 4 associated distinct output duty-cycles: full, high, low and | ||
168 | off. Full and off are internally hard-wired to 255 (100%) and 0 (0%), | ||
169 | respectively. High and low can be programmed via | ||
170 | pwm[1-2]_auto_point[2-3]_pwm. Each PWM output can be associated with a | ||
171 | different thermal input but - and here's the weird part - only one set of | ||
172 | thermal thresholds exist that controls both PWMs output duty-cycles. The | ||
173 | thermal thresholds are accessible via pwm[1-2]_auto_point[1-4]_temp. Note | ||
174 | that even though there are 2 sets of 4 auto points each, they map to the same | ||
175 | registers in the VT1211 and programming one set is sufficient (actually only | ||
176 | the first set pwm1_auto_point[1-4]_temp is writable, the second set is | ||
177 | read-only). | ||
178 | |||
179 | PWM Auto Point PWM Output Duty-Cycle | ||
180 | ------------------------------------------------ | ||
181 | pwm[1-2]_auto_point4_pwm full speed duty-cycle (hard-wired to 255) | ||
182 | pwm[1-2]_auto_point3_pwm high speed duty-cycle | ||
183 | pwm[1-2]_auto_point2_pwm low speed duty-cycle | ||
184 | pwm[1-2]_auto_point1_pwm off duty-cycle (hard-wired to 0) | ||
185 | |||
186 | Temp Auto Point Thermal Threshold | ||
187 | --------------------------------------------- | ||
188 | pwm[1-2]_auto_point4_temp full speed temp | ||
189 | pwm[1-2]_auto_point3_temp high speed temp | ||
190 | pwm[1-2]_auto_point2_temp low speed temp | ||
191 | pwm[1-2]_auto_point1_temp off temp | ||
192 | |||
193 | Long story short, the controller implements the following algorithm to set the | ||
194 | PWM output duty-cycle based on the input temperature: | ||
195 | |||
196 | Thermal Threshold Output Duty-Cycle | ||
197 | (Rising Temp) (Falling Temp) | ||
198 | ---------------------------------------------------------- | ||
199 | full speed duty-cycle full speed duty-cycle | ||
200 | full speed temp | ||
201 | high speed duty-cycle full speed duty-cycle | ||
202 | high speed temp | ||
203 | low speed duty-cycle high speed duty-cycle | ||
204 | low speed temp | ||
205 | off duty-cycle low speed duty-cycle | ||
206 | off temp | ||
diff --git a/Documentation/hwmon/w83627ehf b/Documentation/hwmon/w83627ehf new file mode 100644 index 000000000000..fae3b781d82d --- /dev/null +++ b/Documentation/hwmon/w83627ehf | |||
@@ -0,0 +1,85 @@ | |||
1 | Kernel driver w83627ehf | ||
2 | ======================= | ||
3 | |||
4 | Supported chips: | ||
5 | * Winbond W83627EHF/EHG (ISA access ONLY) | ||
6 | Prefix: 'w83627ehf' | ||
7 | Addresses scanned: ISA address retrieved from Super I/O registers | ||
8 | Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83627EHF_%20W83627EHGb.pdf | ||
9 | |||
10 | Authors: | ||
11 | Jean Delvare <khali@linux-fr.org> | ||
12 | Yuan Mu (Winbond) | ||
13 | Rudolf Marek <r.marek@sh.cvut.cz> | ||
14 | |||
15 | Description | ||
16 | ----------- | ||
17 | |||
18 | This driver implements support for the Winbond W83627EHF and W83627EHG | ||
19 | super I/O chips. We will refer to them collectively as Winbond chips. | ||
20 | |||
21 | The chips implement three temperature sensors, five fan rotation | ||
22 | speed sensors, ten analog voltage sensors, alarms with beep warnings (control | ||
23 | unimplemented), and some automatic fan regulation strategies (plus manual | ||
24 | fan control mode). | ||
25 | |||
26 | Temperatures are measured in degrees Celsius and measurement resolution is 1 | ||
27 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when | ||
28 | the temperature gets higher than high limit; it stays on until the temperature | ||
29 | falls below the Hysteresis value. | ||
30 | |||
31 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is | ||
32 | triggered if the rotation speed has dropped below a programmable limit. Fan | ||
33 | readings can be divided by a programmable divider (1, 2, 4, 8, 16, 32, 64 or | ||
34 | 128) to give the readings more range or accuracy. The driver sets the most | ||
35 | suitable fan divisor itself. Some fans might not be present because they | ||
36 | share pins with other functions. | ||
37 | |||
38 | Voltage sensors (also known as IN sensors) report their values in millivolts. | ||
39 | An alarm is triggered if the voltage has crossed a programmable minimum | ||
40 | or maximum limit. | ||
41 | |||
42 | The driver supports automatic fan control mode known as Thermal Cruise. | ||
43 | In this mode, the chip attempts to keep the measured temperature in a | ||
44 | predefined temperature range. If the temperature goes out of range, fan | ||
45 | is driven slower/faster to reach the predefined range again. | ||
46 | |||
47 | The mode works for fan1-fan4. Mapping of temperatures to pwm outputs is as | ||
48 | follows: | ||
49 | |||
50 | temp1 -> pwm1 | ||
51 | temp2 -> pwm2 | ||
52 | temp3 -> pwm3 | ||
53 | prog -> pwm4 (the programmable setting is not supported by the driver) | ||
54 | |||
55 | /sys files | ||
56 | ---------- | ||
57 | |||
58 | pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range: | ||
59 | 0 (stop) to 255 (full) | ||
60 | |||
61 | pwm[1-4]_enable - this file controls mode of fan/temperature control: | ||
62 | * 1 Manual Mode, write to pwm file any value 0-255 (full speed) | ||
63 | * 2 Thermal Cruise | ||
64 | |||
65 | Thermal Cruise mode | ||
66 | ------------------- | ||
67 | |||
68 | If the temperature is in the range defined by: | ||
69 | |||
70 | pwm[1-4]_target - set target temperature, unit millidegree Celcius | ||
71 | (range 0 - 127000) | ||
72 | pwm[1-4]_tolerance - tolerance, unit millidegree Celcius (range 0 - 15000) | ||
73 | |||
74 | there are no changes to fan speed. Once the temperature leaves the interval, | ||
75 | fan speed increases (temp is higher) or decreases if lower than desired. | ||
76 | There are defined steps and times, but not exported by the driver yet. | ||
77 | |||
78 | pwm[1-4]_min_output - minimum fan speed (range 1 - 255), when the temperature | ||
79 | is below defined range. | ||
80 | pwm[1-4]_stop_time - how many milliseconds [ms] must elapse to switch | ||
81 | corresponding fan off. (when the temperature was below | ||
82 | defined range). | ||
83 | |||
84 | Note: last two functions are influenced by other control bits, not yet exported | ||
85 | by the driver, so a change might not have any effect. | ||
diff --git a/Documentation/hwmon/w83791d b/Documentation/hwmon/w83791d index 83a3836289c2..19b2ed739fa1 100644 --- a/Documentation/hwmon/w83791d +++ b/Documentation/hwmon/w83791d | |||
@@ -5,7 +5,7 @@ Supported chips: | |||
5 | * Winbond W83791D | 5 | * Winbond W83791D |
6 | Prefix: 'w83791d' | 6 | Prefix: 'w83791d' |
7 | Addresses scanned: I2C 0x2c - 0x2f | 7 | Addresses scanned: I2C 0x2c - 0x2f |
8 | Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83791Da.pdf | 8 | Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83791D_W83791Gb.pdf |
9 | 9 | ||
10 | Author: Charles Spirakis <bezaur@gmail.com> | 10 | Author: Charles Spirakis <bezaur@gmail.com> |
11 | 11 | ||
@@ -20,6 +20,9 @@ Credits: | |||
20 | Chunhao Huang <DZShen@Winbond.com.tw>, | 20 | Chunhao Huang <DZShen@Winbond.com.tw>, |
21 | Rudolf Marek <r.marek@sh.cvut.cz> | 21 | Rudolf Marek <r.marek@sh.cvut.cz> |
22 | 22 | ||
23 | Additional contributors: | ||
24 | Sven Anders <anders@anduras.de> | ||
25 | |||
23 | Module Parameters | 26 | Module Parameters |
24 | ----------------- | 27 | ----------------- |
25 | 28 | ||
@@ -46,7 +49,8 @@ Module Parameters | |||
46 | Description | 49 | Description |
47 | ----------- | 50 | ----------- |
48 | 51 | ||
49 | This driver implements support for the Winbond W83791D chip. | 52 | This driver implements support for the Winbond W83791D chip. The W83791G |
53 | chip appears to be the same as the W83791D but is lead free. | ||
50 | 54 | ||
51 | Detection of the chip can sometimes be foiled because it can be in an | 55 | Detection of the chip can sometimes be foiled because it can be in an |
52 | internal state that allows no clean access (Bank with ID register is not | 56 | internal state that allows no clean access (Bank with ID register is not |
@@ -71,34 +75,36 @@ Voltage sensors (also known as IN sensors) report their values in millivolts. | |||
71 | An alarm is triggered if the voltage has crossed a programmable minimum | 75 | An alarm is triggered if the voltage has crossed a programmable minimum |
72 | or maximum limit. | 76 | or maximum limit. |
73 | 77 | ||
74 | Alarms are provided as output from a "realtime status register". The | 78 | The bit ordering for the alarm "realtime status register" and the |
75 | following bits are defined: | 79 | "beep enable registers" are different. |
76 | 80 | ||
77 | bit - alarm on: | 81 | in0 (VCORE) : alarms: 0x000001 beep_enable: 0x000001 |
78 | 0 - Vcore | 82 | in1 (VINR0) : alarms: 0x000002 beep_enable: 0x002000 <== mismatch |
79 | 1 - VINR0 | 83 | in2 (+3.3VIN): alarms: 0x000004 beep_enable: 0x000004 |
80 | 2 - +3.3VIN | 84 | in3 (5VDD) : alarms: 0x000008 beep_enable: 0x000008 |
81 | 3 - 5VDD | 85 | in4 (+12VIN) : alarms: 0x000100 beep_enable: 0x000100 |
82 | 4 - temp1 | 86 | in5 (-12VIN) : alarms: 0x000200 beep_enable: 0x000200 |
83 | 5 - temp2 | 87 | in6 (-5VIN) : alarms: 0x000400 beep_enable: 0x000400 |
84 | 6 - fan1 | 88 | in7 (VSB) : alarms: 0x080000 beep_enable: 0x010000 <== mismatch |
85 | 7 - fan2 | 89 | in8 (VBAT) : alarms: 0x100000 beep_enable: 0x020000 <== mismatch |
86 | 8 - +12VIN | 90 | in9 (VINR1) : alarms: 0x004000 beep_enable: 0x004000 |
87 | 9 - -12VIN | 91 | temp1 : alarms: 0x000010 beep_enable: 0x000010 |
88 | 10 - -5VIN | 92 | temp2 : alarms: 0x000020 beep_enable: 0x000020 |
89 | 11 - fan3 | 93 | temp3 : alarms: 0x002000 beep_enable: 0x000002 <== mismatch |
90 | 12 - chassis | 94 | fan1 : alarms: 0x000040 beep_enable: 0x000040 |
91 | 13 - temp3 | 95 | fan2 : alarms: 0x000080 beep_enable: 0x000080 |
92 | 14 - VINR1 | 96 | fan3 : alarms: 0x000800 beep_enable: 0x000800 |
93 | 15 - reserved | 97 | fan4 : alarms: 0x200000 beep_enable: 0x200000 |
94 | 16 - tart1 | 98 | fan5 : alarms: 0x400000 beep_enable: 0x400000 |
95 | 17 - tart2 | 99 | tart1 : alarms: 0x010000 beep_enable: 0x040000 <== mismatch |
96 | 18 - tart3 | 100 | tart2 : alarms: 0x020000 beep_enable: 0x080000 <== mismatch |
97 | 19 - VSB | 101 | tart3 : alarms: 0x040000 beep_enable: 0x100000 <== mismatch |
98 | 20 - VBAT | 102 | case_open : alarms: 0x001000 beep_enable: 0x001000 |
99 | 21 - fan4 | 103 | user_enable : alarms: -------- beep_enable: 0x800000 |
100 | 22 - fan5 | 104 | |
101 | 23 - reserved | 105 | *** NOTE: It is the responsibility of user-space code to handle the fact |
106 | that the beep enable and alarm bits are in different positions when using that | ||
107 | feature of the chip. | ||
102 | 108 | ||
103 | When an alarm goes off, you can be warned by a beeping signal through your | 109 | When an alarm goes off, you can be warned by a beeping signal through your |
104 | computer speaker. It is possible to enable all beeping globally, or only | 110 | computer speaker. It is possible to enable all beeping globally, or only |
@@ -109,5 +115,6 @@ often will do no harm, but will return 'old' values. | |||
109 | 115 | ||
110 | W83791D TODO: | 116 | W83791D TODO: |
111 | --------------- | 117 | --------------- |
112 | Provide a patch for per-file alarms as discussed on the mailing list | 118 | Provide a patch for per-file alarms and beep enables as defined in the hwmon |
119 | documentation (Documentation/hwmon/sysfs-interface) | ||
113 | Provide a patch for smart-fan control (still need appropriate motherboard/fans) | 120 | Provide a patch for smart-fan control (still need appropriate motherboard/fans) |
diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro index 16775663b9f5..25680346e0ac 100644 --- a/Documentation/i2c/busses/i2c-viapro +++ b/Documentation/i2c/busses/i2c-viapro | |||
@@ -7,9 +7,12 @@ Supported adapters: | |||
7 | * VIA Technologies, Inc. VT82C686A/B | 7 | * VIA Technologies, Inc. VT82C686A/B |
8 | Datasheet: Sometimes available at the VIA website | 8 | Datasheet: Sometimes available at the VIA website |
9 | 9 | ||
10 | * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237R | 10 | * VIA Technologies, Inc. VT8231, VT8233, VT8233A |
11 | Datasheet: available on request from VIA | 11 | Datasheet: available on request from VIA |
12 | 12 | ||
13 | * VIA Technologies, Inc. VT8235, VT8237R, VT8237A, VT8251 | ||
14 | Datasheet: available on request and under NDA from VIA | ||
15 | |||
13 | Authors: | 16 | Authors: |
14 | Kyösti Mälkki <kmalkki@cc.hut.fi>, | 17 | Kyösti Mälkki <kmalkki@cc.hut.fi>, |
15 | Mark D. Studebaker <mdsxyz123@yahoo.com>, | 18 | Mark D. Studebaker <mdsxyz123@yahoo.com>, |
@@ -39,6 +42,8 @@ Your lspci -n listing must show one of these : | |||
39 | device 1106:8235 (VT8231 function 4) | 42 | device 1106:8235 (VT8231 function 4) |
40 | device 1106:3177 (VT8235) | 43 | device 1106:3177 (VT8235) |
41 | device 1106:3227 (VT8237R) | 44 | device 1106:3227 (VT8237R) |
45 | device 1106:3337 (VT8237A) | ||
46 | device 1106:3287 (VT8251) | ||
42 | 47 | ||
43 | If none of these show up, you should look in the BIOS for settings like | 48 | If none of these show up, you should look in the BIOS for settings like |
44 | enable ACPI / SMBus or even USB. | 49 | enable ACPI / SMBus or even USB. |
diff --git a/Documentation/i2c/i2c-stub b/Documentation/i2c/i2c-stub index d6dcb138abf5..9cc081e69764 100644 --- a/Documentation/i2c/i2c-stub +++ b/Documentation/i2c/i2c-stub | |||
@@ -6,9 +6,12 @@ This module is a very simple fake I2C/SMBus driver. It implements four | |||
6 | types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, and | 6 | types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, and |
7 | (r/w) word data. | 7 | (r/w) word data. |
8 | 8 | ||
9 | You need to provide a chip address as a module parameter when loading | ||
10 | this driver, which will then only react to SMBus commands to this address. | ||
11 | |||
9 | No hardware is needed nor associated with this module. It will accept write | 12 | No hardware is needed nor associated with this module. It will accept write |
10 | quick commands to all addresses; it will respond to the other commands (also | 13 | quick commands to one address; it will respond to the other commands (also |
11 | to all addresses) by reading from or writing to an array in memory. It will | 14 | to one address) by reading from or writing to an array in memory. It will |
12 | also spam the kernel logs for every command it handles. | 15 | also spam the kernel logs for every command it handles. |
13 | 16 | ||
14 | A pointer register with auto-increment is implemented for all byte | 17 | A pointer register with auto-increment is implemented for all byte |
@@ -21,6 +24,11 @@ The typical use-case is like this: | |||
21 | 3. load the target sensors chip driver module | 24 | 3. load the target sensors chip driver module |
22 | 4. observe its behavior in the kernel log | 25 | 4. observe its behavior in the kernel log |
23 | 26 | ||
27 | PARAMETERS: | ||
28 | |||
29 | int chip_addr: | ||
30 | The SMBus address to emulate a chip at. | ||
31 | |||
24 | CAVEATS: | 32 | CAVEATS: |
25 | 33 | ||
26 | There are independent arrays for byte/data and word/data commands. Depending | 34 | There are independent arrays for byte/data and word/data commands. Depending |
@@ -33,6 +41,9 @@ If the hardware for your driver has banked registers (e.g. Winbond sensors | |||
33 | chips) this module will not work well - although it could be extended to | 41 | chips) this module will not work well - although it could be extended to |
34 | support that pretty easily. | 42 | support that pretty easily. |
35 | 43 | ||
44 | Only one chip address is supported - although this module could be | ||
45 | extended to support more. | ||
46 | |||
36 | If you spam it hard enough, printk can be lossy. This module really wants | 47 | If you spam it hard enough, printk can be lossy. This module really wants |
37 | something like relayfs. | 48 | something like relayfs. |
38 | 49 | ||
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index ca1967f36423..003fccc14d24 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
@@ -67,19 +67,19 @@ applicable everywhere (see syntax). | |||
67 | - default value: "default" <expr> ["if" <expr>] | 67 | - default value: "default" <expr> ["if" <expr>] |
68 | A config option can have any number of default values. If multiple | 68 | A config option can have any number of default values. If multiple |
69 | default values are visible, only the first defined one is active. | 69 | default values are visible, only the first defined one is active. |
70 | Default values are not limited to the menu entry, where they are | 70 | Default values are not limited to the menu entry where they are |
71 | defined, this means the default can be defined somewhere else or be | 71 | defined. This means the default can be defined somewhere else or be |
72 | overridden by an earlier definition. | 72 | overridden by an earlier definition. |
73 | The default value is only assigned to the config symbol if no other | 73 | The default value is only assigned to the config symbol if no other |
74 | value was set by the user (via the input prompt above). If an input | 74 | value was set by the user (via the input prompt above). If an input |
75 | prompt is visible the default value is presented to the user and can | 75 | prompt is visible the default value is presented to the user and can |
76 | be overridden by him. | 76 | be overridden by him. |
77 | Optionally dependencies only for this default value can be added with | 77 | Optionally, dependencies only for this default value can be added with |
78 | "if". | 78 | "if". |
79 | 79 | ||
80 | - dependencies: "depends on"/"requires" <expr> | 80 | - dependencies: "depends on"/"requires" <expr> |
81 | This defines a dependency for this menu entry. If multiple | 81 | This defines a dependency for this menu entry. If multiple |
82 | dependencies are defined they are connected with '&&'. Dependencies | 82 | dependencies are defined, they are connected with '&&'. Dependencies |
83 | are applied to all other options within this menu entry (which also | 83 | are applied to all other options within this menu entry (which also |
84 | accept an "if" expression), so these two examples are equivalent: | 84 | accept an "if" expression), so these two examples are equivalent: |
85 | 85 | ||
@@ -153,7 +153,7 @@ Nonconstant symbols are the most common ones and are defined with the | |||
153 | 'config' statement. Nonconstant symbols consist entirely of alphanumeric | 153 | 'config' statement. Nonconstant symbols consist entirely of alphanumeric |
154 | characters or underscores. | 154 | characters or underscores. |
155 | Constant symbols are only part of expressions. Constant symbols are | 155 | Constant symbols are only part of expressions. Constant symbols are |
156 | always surrounded by single or double quotes. Within the quote any | 156 | always surrounded by single or double quotes. Within the quote, any |
157 | other character is allowed and the quotes can be escaped using '\'. | 157 | other character is allowed and the quotes can be escaped using '\'. |
158 | 158 | ||
159 | Menu structure | 159 | Menu structure |
@@ -237,7 +237,7 @@ choices: | |||
237 | <choice block> | 237 | <choice block> |
238 | "endchoice" | 238 | "endchoice" |
239 | 239 | ||
240 | This defines a choice group and accepts any of above attributes as | 240 | This defines a choice group and accepts any of the above attributes as |
241 | options. A choice can only be of type bool or tristate, while a boolean | 241 | options. A choice can only be of type bool or tristate, while a boolean |
242 | choice only allows a single config entry to be selected, a tristate | 242 | choice only allows a single config entry to be selected, a tristate |
243 | choice also allows any number of config entries to be set to 'm'. This | 243 | choice also allows any number of config entries to be set to 'm'. This |
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 0706699c9da9..e2cbd59cf2d0 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -22,7 +22,7 @@ This document describes the Linux kernel Makefiles. | |||
22 | === 4 Host Program support | 22 | === 4 Host Program support |
23 | --- 4.1 Simple Host Program | 23 | --- 4.1 Simple Host Program |
24 | --- 4.2 Composite Host Programs | 24 | --- 4.2 Composite Host Programs |
25 | --- 4.3 Defining shared libraries | 25 | --- 4.3 Defining shared libraries |
26 | --- 4.4 Using C++ for host programs | 26 | --- 4.4 Using C++ for host programs |
27 | --- 4.5 Controlling compiler options for host programs | 27 | --- 4.5 Controlling compiler options for host programs |
28 | --- 4.6 When host programs are actually built | 28 | --- 4.6 When host programs are actually built |
@@ -69,7 +69,7 @@ architecture-specific information to the top Makefile. | |||
69 | 69 | ||
70 | Each subdirectory has a kbuild Makefile which carries out the commands | 70 | Each subdirectory has a kbuild Makefile which carries out the commands |
71 | passed down from above. The kbuild Makefile uses information from the | 71 | passed down from above. The kbuild Makefile uses information from the |
72 | .config file to construct various file lists used by kbuild to build | 72 | .config file to construct various file lists used by kbuild to build |
73 | any built-in or modular targets. | 73 | any built-in or modular targets. |
74 | 74 | ||
75 | scripts/Makefile.* contains all the definitions/rules etc. that | 75 | scripts/Makefile.* contains all the definitions/rules etc. that |
@@ -86,7 +86,7 @@ any kernel Makefiles (or any other source files). | |||
86 | 86 | ||
87 | *Normal developers* are people who work on features such as device | 87 | *Normal developers* are people who work on features such as device |
88 | drivers, file systems, and network protocols. These people need to | 88 | drivers, file systems, and network protocols. These people need to |
89 | maintain the kbuild Makefiles for the subsystem that they are | 89 | maintain the kbuild Makefiles for the subsystem they are |
90 | working on. In order to do this effectively, they need some overall | 90 | working on. In order to do this effectively, they need some overall |
91 | knowledge about the kernel Makefiles, plus detailed knowledge about the | 91 | knowledge about the kernel Makefiles, plus detailed knowledge about the |
92 | public interface for kbuild. | 92 | public interface for kbuild. |
@@ -104,10 +104,10 @@ This document is aimed towards normal developers and arch developers. | |||
104 | === 3 The kbuild files | 104 | === 3 The kbuild files |
105 | 105 | ||
106 | Most Makefiles within the kernel are kbuild Makefiles that use the | 106 | Most Makefiles within the kernel are kbuild Makefiles that use the |
107 | kbuild infrastructure. This chapter introduce the syntax used in the | 107 | kbuild infrastructure. This chapter introduces the syntax used in the |
108 | kbuild makefiles. | 108 | kbuild makefiles. |
109 | The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can | 109 | The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can |
110 | be used and if both a 'Makefile' and a 'Kbuild' file exists then the 'Kbuild' | 110 | be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild' |
111 | file will be used. | 111 | file will be used. |
112 | 112 | ||
113 | Section 3.1 "Goal definitions" is a quick intro, further chapters provide | 113 | Section 3.1 "Goal definitions" is a quick intro, further chapters provide |
@@ -124,7 +124,7 @@ more details, with real examples. | |||
124 | Example: | 124 | Example: |
125 | obj-y += foo.o | 125 | obj-y += foo.o |
126 | 126 | ||
127 | This tell kbuild that there is one object in that directory named | 127 | This tell kbuild that there is one object in that directory, named |
128 | foo.o. foo.o will be built from foo.c or foo.S. | 128 | foo.o. foo.o will be built from foo.c or foo.S. |
129 | 129 | ||
130 | If foo.o shall be built as a module, the variable obj-m is used. | 130 | If foo.o shall be built as a module, the variable obj-m is used. |
@@ -140,7 +140,7 @@ more details, with real examples. | |||
140 | --- 3.2 Built-in object goals - obj-y | 140 | --- 3.2 Built-in object goals - obj-y |
141 | 141 | ||
142 | The kbuild Makefile specifies object files for vmlinux | 142 | The kbuild Makefile specifies object files for vmlinux |
143 | in the lists $(obj-y). These lists depend on the kernel | 143 | in the $(obj-y) lists. These lists depend on the kernel |
144 | configuration. | 144 | configuration. |
145 | 145 | ||
146 | Kbuild compiles all the $(obj-y) files. It then calls | 146 | Kbuild compiles all the $(obj-y) files. It then calls |
@@ -154,8 +154,8 @@ more details, with real examples. | |||
154 | Link order is significant, because certain functions | 154 | Link order is significant, because certain functions |
155 | (module_init() / __initcall) will be called during boot in the | 155 | (module_init() / __initcall) will be called during boot in the |
156 | order they appear. So keep in mind that changing the link | 156 | order they appear. So keep in mind that changing the link |
157 | order may e.g. change the order in which your SCSI | 157 | order may e.g. change the order in which your SCSI |
158 | controllers are detected, and thus you disks are renumbered. | 158 | controllers are detected, and thus your disks are renumbered. |
159 | 159 | ||
160 | Example: | 160 | Example: |
161 | #drivers/isdn/i4l/Makefile | 161 | #drivers/isdn/i4l/Makefile |
@@ -203,11 +203,11 @@ more details, with real examples. | |||
203 | Example: | 203 | Example: |
204 | #fs/ext2/Makefile | 204 | #fs/ext2/Makefile |
205 | obj-$(CONFIG_EXT2_FS) += ext2.o | 205 | obj-$(CONFIG_EXT2_FS) += ext2.o |
206 | ext2-y := balloc.o bitmap.o | 206 | ext2-y := balloc.o bitmap.o |
207 | ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o | 207 | ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o |
208 | 208 | ||
209 | In this example xattr.o is only part of the composite object | 209 | In this example, xattr.o is only part of the composite object |
210 | ext2.o, if $(CONFIG_EXT2_FS_XATTR) evaluates to 'y'. | 210 | ext2.o if $(CONFIG_EXT2_FS_XATTR) evaluates to 'y'. |
211 | 211 | ||
212 | Note: Of course, when you are building objects into the kernel, | 212 | Note: Of course, when you are building objects into the kernel, |
213 | the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, | 213 | the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, |
@@ -221,16 +221,16 @@ more details, with real examples. | |||
221 | 221 | ||
222 | --- 3.5 Library file goals - lib-y | 222 | --- 3.5 Library file goals - lib-y |
223 | 223 | ||
224 | Objects listed with obj-* are used for modules or | 224 | Objects listed with obj-* are used for modules, or |
225 | combined in a built-in.o for that specific directory. | 225 | combined in a built-in.o for that specific directory. |
226 | There is also the possibility to list objects that will | 226 | There is also the possibility to list objects that will |
227 | be included in a library, lib.a. | 227 | be included in a library, lib.a. |
228 | All objects listed with lib-y are combined in a single | 228 | All objects listed with lib-y are combined in a single |
229 | library for that directory. | 229 | library for that directory. |
230 | Objects that are listed in obj-y and additional listed in | 230 | Objects that are listed in obj-y and additionaly listed in |
231 | lib-y will not be included in the library, since they will anyway | 231 | lib-y will not be included in the library, since they will anyway |
232 | be accessible. | 232 | be accessible. |
233 | For consistency objects listed in lib-m will be included in lib.a. | 233 | For consistency, objects listed in lib-m will be included in lib.a. |
234 | 234 | ||
235 | Note that the same kbuild makefile may list files to be built-in | 235 | Note that the same kbuild makefile may list files to be built-in |
236 | and to be part of a library. Therefore the same directory | 236 | and to be part of a library. Therefore the same directory |
@@ -241,11 +241,11 @@ more details, with real examples. | |||
241 | lib-y := checksum.o delay.o | 241 | lib-y := checksum.o delay.o |
242 | 242 | ||
243 | This will create a library lib.a based on checksum.o and delay.o. | 243 | This will create a library lib.a based on checksum.o and delay.o. |
244 | For kbuild to actually recognize that there is a lib.a being build | 244 | For kbuild to actually recognize that there is a lib.a being built, |
245 | the directory shall be listed in libs-y. | 245 | the directory shall be listed in libs-y. |
246 | See also "6.3 List directories to visit when descending". | 246 | See also "6.3 List directories to visit when descending". |
247 | 247 | ||
248 | Usage of lib-y is normally restricted to lib/ and arch/*/lib. | 248 | Use of lib-y is normally restricted to lib/ and arch/*/lib. |
249 | 249 | ||
250 | --- 3.6 Descending down in directories | 250 | --- 3.6 Descending down in directories |
251 | 251 | ||
@@ -255,7 +255,7 @@ more details, with real examples. | |||
255 | invoke make recursively in subdirectories, provided you let it know of | 255 | invoke make recursively in subdirectories, provided you let it know of |
256 | them. | 256 | them. |
257 | 257 | ||
258 | To do so obj-y and obj-m are used. | 258 | To do so, obj-y and obj-m are used. |
259 | ext2 lives in a separate directory, and the Makefile present in fs/ | 259 | ext2 lives in a separate directory, and the Makefile present in fs/ |
260 | tells kbuild to descend down using the following assignment. | 260 | tells kbuild to descend down using the following assignment. |
261 | 261 | ||
@@ -353,8 +353,8 @@ more details, with real examples. | |||
353 | Special rules are used when the kbuild infrastructure does | 353 | Special rules are used when the kbuild infrastructure does |
354 | not provide the required support. A typical example is | 354 | not provide the required support. A typical example is |
355 | header files generated during the build process. | 355 | header files generated during the build process. |
356 | Another example is the architecture specific Makefiles which | 356 | Another example are the architecture specific Makefiles which |
357 | needs special rules to prepare boot images etc. | 357 | need special rules to prepare boot images etc. |
358 | 358 | ||
359 | Special rules are written as normal Make rules. | 359 | Special rules are written as normal Make rules. |
360 | Kbuild is not executing in the directory where the Makefile is | 360 | Kbuild is not executing in the directory where the Makefile is |
@@ -387,28 +387,28 @@ more details, with real examples. | |||
387 | 387 | ||
388 | --- 3.11 $(CC) support functions | 388 | --- 3.11 $(CC) support functions |
389 | 389 | ||
390 | The kernel may be build with several different versions of | 390 | The kernel may be built with several different versions of |
391 | $(CC), each supporting a unique set of features and options. | 391 | $(CC), each supporting a unique set of features and options. |
392 | kbuild provide basic support to check for valid options for $(CC). | 392 | kbuild provide basic support to check for valid options for $(CC). |
393 | $(CC) is useally the gcc compiler, but other alternatives are | 393 | $(CC) is useally the gcc compiler, but other alternatives are |
394 | available. | 394 | available. |
395 | 395 | ||
396 | as-option | 396 | as-option |
397 | as-option is used to check if $(CC) when used to compile | 397 | as-option is used to check if $(CC) -- when used to compile |
398 | assembler (*.S) files supports the given option. An optional | 398 | assembler (*.S) files -- supports the given option. An optional |
399 | second option may be specified if first option are not supported. | 399 | second option may be specified if the first option is not supported. |
400 | 400 | ||
401 | Example: | 401 | Example: |
402 | #arch/sh/Makefile | 402 | #arch/sh/Makefile |
403 | cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) | 403 | cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) |
404 | 404 | ||
405 | In the above example cflags-y will be assinged the the option | 405 | In the above example, cflags-y will be assigned the option |
406 | -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC). | 406 | -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC). |
407 | The second argument is optional, and if supplied will be used | 407 | The second argument is optional, and if supplied will be used |
408 | if first argument is not supported. | 408 | if first argument is not supported. |
409 | 409 | ||
410 | ld-option | 410 | ld-option |
411 | ld-option is used to check if $(CC) when used to link object files | 411 | ld-option is used to check if $(CC) when used to link object files |
412 | supports the given option. An optional second option may be | 412 | supports the given option. An optional second option may be |
413 | specified if first option are not supported. | 413 | specified if first option are not supported. |
414 | 414 | ||
@@ -421,8 +421,13 @@ more details, with real examples. | |||
421 | The second argument is optional, and if supplied will be used | 421 | The second argument is optional, and if supplied will be used |
422 | if first argument is not supported. | 422 | if first argument is not supported. |
423 | 423 | ||
424 | as-instr | ||
425 | as-instr checks if the assembler reports a specific instruction | ||
426 | and then outputs either option1 or option2 | ||
427 | C escapes are supported in the test instruction | ||
428 | |||
424 | cc-option | 429 | cc-option |
425 | cc-option is used to check if $(CC) support a given option, and not | 430 | cc-option is used to check if $(CC) supports a given option, and not |
426 | supported to use an optional second option. | 431 | supported to use an optional second option. |
427 | 432 | ||
428 | Example: | 433 | Example: |
@@ -430,12 +435,12 @@ more details, with real examples. | |||
430 | cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) | 435 | cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) |
431 | 436 | ||
432 | In the above example cflags-y will be assigned the option | 437 | In the above example cflags-y will be assigned the option |
433 | -march=pentium-mmx if supported by $(CC), otherwise -march-i586. | 438 | -march=pentium-mmx if supported by $(CC), otherwise -march=i586. |
434 | The second argument to cc-option is optional, and if omitted | 439 | The second argument to cc-option is optional, and if omitted, |
435 | cflags-y will be assigned no value if first option is not supported. | 440 | cflags-y will be assigned no value if first option is not supported. |
436 | 441 | ||
437 | cc-option-yn | 442 | cc-option-yn |
438 | cc-option-yn is used to check if gcc supports a given option | 443 | cc-option-yn is used to check if gcc supports a given option |
439 | and return 'y' if supported, otherwise 'n'. | 444 | and return 'y' if supported, otherwise 'n'. |
440 | 445 | ||
441 | Example: | 446 | Example: |
@@ -443,32 +448,33 @@ more details, with real examples. | |||
443 | biarch := $(call cc-option-yn, -m32) | 448 | biarch := $(call cc-option-yn, -m32) |
444 | aflags-$(biarch) += -a32 | 449 | aflags-$(biarch) += -a32 |
445 | cflags-$(biarch) += -m32 | 450 | cflags-$(biarch) += -m32 |
446 | 451 | ||
447 | In the above example $(biarch) is set to y if $(CC) supports the -m32 | 452 | In the above example, $(biarch) is set to y if $(CC) supports the -m32 |
448 | option. When $(biarch) equals to y the expanded variables $(aflags-y) | 453 | option. When $(biarch) equals 'y', the expanded variables $(aflags-y) |
449 | and $(cflags-y) will be assigned the values -a32 and -m32. | 454 | and $(cflags-y) will be assigned the values -a32 and -m32, |
455 | respectively. | ||
450 | 456 | ||
451 | cc-option-align | 457 | cc-option-align |
452 | gcc version >= 3.0 shifted type of options used to speify | 458 | gcc versions >= 3.0 changed the type of options used to specify |
453 | alignment of functions, loops etc. $(cc-option-align) whrn used | 459 | alignment of functions, loops etc. $(cc-option-align), when used |
454 | as prefix to the align options will select the right prefix: | 460 | as prefix to the align options, will select the right prefix: |
455 | gcc < 3.00 | 461 | gcc < 3.00 |
456 | cc-option-align = -malign | 462 | cc-option-align = -malign |
457 | gcc >= 3.00 | 463 | gcc >= 3.00 |
458 | cc-option-align = -falign | 464 | cc-option-align = -falign |
459 | 465 | ||
460 | Example: | 466 | Example: |
461 | CFLAGS += $(cc-option-align)-functions=4 | 467 | CFLAGS += $(cc-option-align)-functions=4 |
462 | 468 | ||
463 | In the above example the option -falign-functions=4 is used for | 469 | In the above example, the option -falign-functions=4 is used for |
464 | gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used. | 470 | gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used. |
465 | 471 | ||
466 | cc-version | 472 | cc-version |
467 | cc-version return a numerical version of the $(CC) compiler version. | 473 | cc-version returns a numerical version of the $(CC) compiler version. |
468 | The format is <major><minor> where both are two digits. So for example | 474 | The format is <major><minor> where both are two digits. So for example |
469 | gcc 3.41 would return 0341. | 475 | gcc 3.41 would return 0341. |
470 | cc-version is useful when a specific $(CC) version is faulty in one | 476 | cc-version is useful when a specific $(CC) version is faulty in one |
471 | area, for example the -mregparm=3 were broken in some gcc version | 477 | area, for example -mregparm=3 was broken in some gcc versions |
472 | even though the option was accepted by gcc. | 478 | even though the option was accepted by gcc. |
473 | 479 | ||
474 | Example: | 480 | Example: |
@@ -477,20 +483,20 @@ more details, with real examples. | |||
477 | if [ $(call cc-version) -ge 0300 ] ; then \ | 483 | if [ $(call cc-version) -ge 0300 ] ; then \ |
478 | echo "-mregparm=3"; fi ;) | 484 | echo "-mregparm=3"; fi ;) |
479 | 485 | ||
480 | In the above example -mregparm=3 is only used for gcc version greater | 486 | In the above example, -mregparm=3 is only used for gcc version greater |
481 | than or equal to gcc 3.0. | 487 | than or equal to gcc 3.0. |
482 | 488 | ||
483 | cc-ifversion | 489 | cc-ifversion |
484 | cc-ifversion test the version of $(CC) and equals last argument if | 490 | cc-ifversion tests the version of $(CC) and equals last argument if |
485 | version expression is true. | 491 | version expression is true. |
486 | 492 | ||
487 | Example: | 493 | Example: |
488 | #fs/reiserfs/Makefile | 494 | #fs/reiserfs/Makefile |
489 | EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0402, -O1) | 495 | EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0402, -O1) |
490 | 496 | ||
491 | In this example EXTRA_CFLAGS will be assigned the value -O1 if the | 497 | In this example, EXTRA_CFLAGS will be assigned the value -O1 if the |
492 | $(CC) version is less than 4.2. | 498 | $(CC) version is less than 4.2. |
493 | cc-ifversion takes all the shell operators: | 499 | cc-ifversion takes all the shell operators: |
494 | -eq, -ne, -lt, -le, -gt, and -ge | 500 | -eq, -ne, -lt, -le, -gt, and -ge |
495 | The third parameter may be a text as in this example, but it may also | 501 | The third parameter may be a text as in this example, but it may also |
496 | be an expanded variable or a macro. | 502 | be an expanded variable or a macro. |
@@ -506,7 +512,7 @@ The first step is to tell kbuild that a host program exists. This is | |||
506 | done utilising the variable hostprogs-y. | 512 | done utilising the variable hostprogs-y. |
507 | 513 | ||
508 | The second step is to add an explicit dependency to the executable. | 514 | The second step is to add an explicit dependency to the executable. |
509 | This can be done in two ways. Either add the dependency in a rule, | 515 | This can be done in two ways. Either add the dependency in a rule, |
510 | or utilise the variable $(always). | 516 | or utilise the variable $(always). |
511 | Both possibilities are described in the following. | 517 | Both possibilities are described in the following. |
512 | 518 | ||
@@ -523,28 +529,28 @@ Both possibilities are described in the following. | |||
523 | Kbuild assumes in the above example that bin2hex is made from a single | 529 | Kbuild assumes in the above example that bin2hex is made from a single |
524 | c-source file named bin2hex.c located in the same directory as | 530 | c-source file named bin2hex.c located in the same directory as |
525 | the Makefile. | 531 | the Makefile. |
526 | 532 | ||
527 | --- 4.2 Composite Host Programs | 533 | --- 4.2 Composite Host Programs |
528 | 534 | ||
529 | Host programs can be made up based on composite objects. | 535 | Host programs can be made up based on composite objects. |
530 | The syntax used to define composite objects for host programs is | 536 | The syntax used to define composite objects for host programs is |
531 | similar to the syntax used for kernel objects. | 537 | similar to the syntax used for kernel objects. |
532 | $(<executeable>-objs) list all objects used to link the final | 538 | $(<executeable>-objs) lists all objects used to link the final |
533 | executable. | 539 | executable. |
534 | 540 | ||
535 | Example: | 541 | Example: |
536 | #scripts/lxdialog/Makefile | 542 | #scripts/lxdialog/Makefile |
537 | hostprogs-y := lxdialog | 543 | hostprogs-y := lxdialog |
538 | lxdialog-objs := checklist.o lxdialog.o | 544 | lxdialog-objs := checklist.o lxdialog.o |
539 | 545 | ||
540 | Objects with extension .o are compiled from the corresponding .c | 546 | Objects with extension .o are compiled from the corresponding .c |
541 | files. In the above example checklist.c is compiled to checklist.o | 547 | files. In the above example, checklist.c is compiled to checklist.o |
542 | and lxdialog.c is compiled to lxdialog.o. | 548 | and lxdialog.c is compiled to lxdialog.o. |
543 | Finally the two .o files are linked to the executable, lxdialog. | 549 | Finally, the two .o files are linked to the executable, lxdialog. |
544 | Note: The syntax <executable>-y is not permitted for host-programs. | 550 | Note: The syntax <executable>-y is not permitted for host-programs. |
545 | 551 | ||
546 | --- 4.3 Defining shared libraries | 552 | --- 4.3 Defining shared libraries |
547 | 553 | ||
548 | Objects with extension .so are considered shared libraries, and | 554 | Objects with extension .so are considered shared libraries, and |
549 | will be compiled as position independent objects. | 555 | will be compiled as position independent objects. |
550 | Kbuild provides support for shared libraries, but the usage | 556 | Kbuild provides support for shared libraries, but the usage |
@@ -557,7 +563,7 @@ Both possibilities are described in the following. | |||
557 | hostprogs-y := conf | 563 | hostprogs-y := conf |
558 | conf-objs := conf.o libkconfig.so | 564 | conf-objs := conf.o libkconfig.so |
559 | libkconfig-objs := expr.o type.o | 565 | libkconfig-objs := expr.o type.o |
560 | 566 | ||
561 | Shared libraries always require a corresponding -objs line, and | 567 | Shared libraries always require a corresponding -objs line, and |
562 | in the example above the shared library libkconfig is composed by | 568 | in the example above the shared library libkconfig is composed by |
563 | the two objects expr.o and type.o. | 569 | the two objects expr.o and type.o. |
@@ -578,7 +584,7 @@ Both possibilities are described in the following. | |||
578 | 584 | ||
579 | In the example above the executable is composed of the C++ file | 585 | In the example above the executable is composed of the C++ file |
580 | qconf.cc - identified by $(qconf-cxxobjs). | 586 | qconf.cc - identified by $(qconf-cxxobjs). |
581 | 587 | ||
582 | If qconf is composed by a mixture of .c and .cc files, then an | 588 | If qconf is composed by a mixture of .c and .cc files, then an |
583 | additional line can be used to identify this. | 589 | additional line can be used to identify this. |
584 | 590 | ||
@@ -587,34 +593,35 @@ Both possibilities are described in the following. | |||
587 | hostprogs-y := qconf | 593 | hostprogs-y := qconf |
588 | qconf-cxxobjs := qconf.o | 594 | qconf-cxxobjs := qconf.o |
589 | qconf-objs := check.o | 595 | qconf-objs := check.o |
590 | 596 | ||
591 | --- 4.5 Controlling compiler options for host programs | 597 | --- 4.5 Controlling compiler options for host programs |
592 | 598 | ||
593 | When compiling host programs, it is possible to set specific flags. | 599 | When compiling host programs, it is possible to set specific flags. |
594 | The programs will always be compiled utilising $(HOSTCC) passed | 600 | The programs will always be compiled utilising $(HOSTCC) passed |
595 | the options specified in $(HOSTCFLAGS). | 601 | the options specified in $(HOSTCFLAGS). |
596 | To set flags that will take effect for all host programs created | 602 | To set flags that will take effect for all host programs created |
597 | in that Makefile use the variable HOST_EXTRACFLAGS. | 603 | in that Makefile, use the variable HOST_EXTRACFLAGS. |
598 | 604 | ||
599 | Example: | 605 | Example: |
600 | #scripts/lxdialog/Makefile | 606 | #scripts/lxdialog/Makefile |
601 | HOST_EXTRACFLAGS += -I/usr/include/ncurses | 607 | HOST_EXTRACFLAGS += -I/usr/include/ncurses |
602 | 608 | ||
603 | To set specific flags for a single file the following construction | 609 | To set specific flags for a single file the following construction |
604 | is used: | 610 | is used: |
605 | 611 | ||
606 | Example: | 612 | Example: |
607 | #arch/ppc64/boot/Makefile | 613 | #arch/ppc64/boot/Makefile |
608 | HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE) | 614 | HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE) |
609 | 615 | ||
610 | It is also possible to specify additional options to the linker. | 616 | It is also possible to specify additional options to the linker. |
611 | 617 | ||
612 | Example: | 618 | Example: |
613 | #scripts/kconfig/Makefile | 619 | #scripts/kconfig/Makefile |
614 | HOSTLOADLIBES_qconf := -L$(QTDIR)/lib | 620 | HOSTLOADLIBES_qconf := -L$(QTDIR)/lib |
615 | 621 | ||
616 | When linking qconf it will be passed the extra option "-L$(QTDIR)/lib". | 622 | When linking qconf, it will be passed the extra option |
617 | 623 | "-L$(QTDIR)/lib". | |
624 | |||
618 | --- 4.6 When host programs are actually built | 625 | --- 4.6 When host programs are actually built |
619 | 626 | ||
620 | Kbuild will only build host-programs when they are referenced | 627 | Kbuild will only build host-programs when they are referenced |
@@ -629,7 +636,7 @@ Both possibilities are described in the following. | |||
629 | $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist | 636 | $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist |
630 | ( cd $(obj); ./gen-devlist ) < $< | 637 | ( cd $(obj); ./gen-devlist ) < $< |
631 | 638 | ||
632 | The target $(obj)/devlist.h will not be built before | 639 | The target $(obj)/devlist.h will not be built before |
633 | $(obj)/gen-devlist is updated. Note that references to | 640 | $(obj)/gen-devlist is updated. Note that references to |
634 | the host programs in special rules must be prefixed with $(obj). | 641 | the host programs in special rules must be prefixed with $(obj). |
635 | 642 | ||
@@ -648,7 +655,7 @@ Both possibilities are described in the following. | |||
648 | 655 | ||
649 | --- 4.7 Using hostprogs-$(CONFIG_FOO) | 656 | --- 4.7 Using hostprogs-$(CONFIG_FOO) |
650 | 657 | ||
651 | A typcal pattern in a Kbuild file lok like this: | 658 | A typical pattern in a Kbuild file looks like this: |
652 | 659 | ||
653 | Example: | 660 | Example: |
654 | #scripts/Makefile | 661 | #scripts/Makefile |
@@ -656,13 +663,13 @@ Both possibilities are described in the following. | |||
656 | 663 | ||
657 | Kbuild knows about both 'y' for built-in and 'm' for module. | 664 | Kbuild knows about both 'y' for built-in and 'm' for module. |
658 | So if a config symbol evaluate to 'm', kbuild will still build | 665 | So if a config symbol evaluate to 'm', kbuild will still build |
659 | the binary. In other words Kbuild handle hostprogs-m exactly | 666 | the binary. In other words, Kbuild handles hostprogs-m exactly |
660 | like hostprogs-y. But only hostprogs-y is recommend used | 667 | like hostprogs-y. But only hostprogs-y is recommended to be used |
661 | when no CONFIG symbol are involved. | 668 | when no CONFIG symbols are involved. |
662 | 669 | ||
663 | === 5 Kbuild clean infrastructure | 670 | === 5 Kbuild clean infrastructure |
664 | 671 | ||
665 | "make clean" deletes most generated files in the src tree where the kernel | 672 | "make clean" deletes most generated files in the obj tree where the kernel |
666 | is compiled. This includes generated files such as host programs. | 673 | is compiled. This includes generated files such as host programs. |
667 | Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always), | 674 | Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always), |
668 | $(extra-y) and $(targets). They are all deleted during "make clean". | 675 | $(extra-y) and $(targets). They are all deleted during "make clean". |
@@ -680,7 +687,8 @@ When executing "make clean", the two files "devlist.h classlist.h" will | |||
680 | be deleted. Kbuild will assume files to be in same relative directory as the | 687 | be deleted. Kbuild will assume files to be in same relative directory as the |
681 | Makefile except if an absolute path is specified (path starting with '/'). | 688 | Makefile except if an absolute path is specified (path starting with '/'). |
682 | 689 | ||
683 | To delete a directory hirachy use: | 690 | To delete a directory hierarchy use: |
691 | |||
684 | Example: | 692 | Example: |
685 | #scripts/package/Makefile | 693 | #scripts/package/Makefile |
686 | clean-dirs := $(objtree)/debian/ | 694 | clean-dirs := $(objtree)/debian/ |
@@ -723,29 +731,29 @@ be visited during "make clean". | |||
723 | 731 | ||
724 | The top level Makefile sets up the environment and does the preparation, | 732 | The top level Makefile sets up the environment and does the preparation, |
725 | before starting to descend down in the individual directories. | 733 | before starting to descend down in the individual directories. |
726 | The top level makefile contains the generic part, whereas the | 734 | The top level makefile contains the generic part, whereas |
727 | arch/$(ARCH)/Makefile contains what is required to set-up kbuild | 735 | arch/$(ARCH)/Makefile contains what is required to set up kbuild |
728 | to the said architecture. | 736 | for said architecture. |
729 | To do so arch/$(ARCH)/Makefile sets a number of variables, and defines | 737 | To do so, arch/$(ARCH)/Makefile sets up a number of variables and defines |
730 | a few targets. | 738 | a few targets. |
731 | 739 | ||
732 | When kbuild executes the following steps are followed (roughly): | 740 | When kbuild executes, the following steps are followed (roughly): |
733 | 1) Configuration of the kernel => produced .config | 741 | 1) Configuration of the kernel => produce .config |
734 | 2) Store kernel version in include/linux/version.h | 742 | 2) Store kernel version in include/linux/version.h |
735 | 3) Symlink include/asm to include/asm-$(ARCH) | 743 | 3) Symlink include/asm to include/asm-$(ARCH) |
736 | 4) Updating all other prerequisites to the target prepare: | 744 | 4) Updating all other prerequisites to the target prepare: |
737 | - Additional prerequisites are specified in arch/$(ARCH)/Makefile | 745 | - Additional prerequisites are specified in arch/$(ARCH)/Makefile |
738 | 5) Recursively descend down in all directories listed in | 746 | 5) Recursively descend down in all directories listed in |
739 | init-* core* drivers-* net-* libs-* and build all targets. | 747 | init-* core* drivers-* net-* libs-* and build all targets. |
740 | - The value of the above variables are extended in arch/$(ARCH)/Makefile. | 748 | - The values of the above variables are expanded in arch/$(ARCH)/Makefile. |
741 | 6) All object files are then linked and the resulting file vmlinux is | 749 | 6) All object files are then linked and the resulting file vmlinux is |
742 | located at the root of the src tree. | 750 | located at the root of the obj tree. |
743 | The very first objects linked are listed in head-y, assigned by | 751 | The very first objects linked are listed in head-y, assigned by |
744 | arch/$(ARCH)/Makefile. | 752 | arch/$(ARCH)/Makefile. |
745 | 7) Finally the architecture specific part does any required post processing | 753 | 7) Finally, the architecture specific part does any required post processing |
746 | and builds the final bootimage. | 754 | and builds the final bootimage. |
747 | - This includes building boot records | 755 | - This includes building boot records |
748 | - Preparing initrd images and the like | 756 | - Preparing initrd images and thelike |
749 | 757 | ||
750 | 758 | ||
751 | --- 6.1 Set variables to tweak the build to the architecture | 759 | --- 6.1 Set variables to tweak the build to the architecture |
@@ -760,7 +768,7 @@ When kbuild executes the following steps are followed (roughly): | |||
760 | LDFLAGS := -m elf_s390 | 768 | LDFLAGS := -m elf_s390 |
761 | Note: EXTRA_LDFLAGS and LDFLAGS_$@ can be used to further customise | 769 | Note: EXTRA_LDFLAGS and LDFLAGS_$@ can be used to further customise |
762 | the flags used. See chapter 7. | 770 | the flags used. See chapter 7. |
763 | 771 | ||
764 | LDFLAGS_MODULE Options for $(LD) when linking modules | 772 | LDFLAGS_MODULE Options for $(LD) when linking modules |
765 | 773 | ||
766 | LDFLAGS_MODULE is used to set specific flags for $(LD) when | 774 | LDFLAGS_MODULE is used to set specific flags for $(LD) when |
@@ -770,7 +778,7 @@ When kbuild executes the following steps are followed (roughly): | |||
770 | LDFLAGS_vmlinux Options for $(LD) when linking vmlinux | 778 | LDFLAGS_vmlinux Options for $(LD) when linking vmlinux |
771 | 779 | ||
772 | LDFLAGS_vmlinux is used to specify additional flags to pass to | 780 | LDFLAGS_vmlinux is used to specify additional flags to pass to |
773 | the linker when linking the final vmlinux. | 781 | the linker when linking the final vmlinux image. |
774 | LDFLAGS_vmlinux uses the LDFLAGS_$@ support. | 782 | LDFLAGS_vmlinux uses the LDFLAGS_$@ support. |
775 | 783 | ||
776 | Example: | 784 | Example: |
@@ -780,7 +788,7 @@ When kbuild executes the following steps are followed (roughly): | |||
780 | OBJCOPYFLAGS objcopy flags | 788 | OBJCOPYFLAGS objcopy flags |
781 | 789 | ||
782 | When $(call if_changed,objcopy) is used to translate a .o file, | 790 | When $(call if_changed,objcopy) is used to translate a .o file, |
783 | then the flags specified in OBJCOPYFLAGS will be used. | 791 | the flags specified in OBJCOPYFLAGS will be used. |
784 | $(call if_changed,objcopy) is often used to generate raw binaries on | 792 | $(call if_changed,objcopy) is often used to generate raw binaries on |
785 | vmlinux. | 793 | vmlinux. |
786 | 794 | ||
@@ -792,7 +800,7 @@ When kbuild executes the following steps are followed (roughly): | |||
792 | $(obj)/image: vmlinux FORCE | 800 | $(obj)/image: vmlinux FORCE |
793 | $(call if_changed,objcopy) | 801 | $(call if_changed,objcopy) |
794 | 802 | ||
795 | In this example the binary $(obj)/image is a binary version of | 803 | In this example, the binary $(obj)/image is a binary version of |
796 | vmlinux. The usage of $(call if_changed,xxx) will be described later. | 804 | vmlinux. The usage of $(call if_changed,xxx) will be described later. |
797 | 805 | ||
798 | AFLAGS $(AS) assembler flags | 806 | AFLAGS $(AS) assembler flags |
@@ -809,7 +817,7 @@ When kbuild executes the following steps are followed (roughly): | |||
809 | Default value - see top level Makefile | 817 | Default value - see top level Makefile |
810 | Append or modify as required per architecture. | 818 | Append or modify as required per architecture. |
811 | 819 | ||
812 | Often the CFLAGS variable depends on the configuration. | 820 | Often, the CFLAGS variable depends on the configuration. |
813 | 821 | ||
814 | Example: | 822 | Example: |
815 | #arch/i386/Makefile | 823 | #arch/i386/Makefile |
@@ -830,7 +838,7 @@ When kbuild executes the following steps are followed (roughly): | |||
830 | ... | 838 | ... |
831 | 839 | ||
832 | 840 | ||
833 | The first examples utilises the trick that a config option expands | 841 | The first example utilises the trick that a config option expands |
834 | to 'y' when selected. | 842 | to 'y' when selected. |
835 | 843 | ||
836 | CFLAGS_KERNEL $(CC) options specific for built-in | 844 | CFLAGS_KERNEL $(CC) options specific for built-in |
@@ -843,18 +851,18 @@ When kbuild executes the following steps are followed (roughly): | |||
843 | $(CFLAGS_MODULE) contains extra C compiler flags used to compile code | 851 | $(CFLAGS_MODULE) contains extra C compiler flags used to compile code |
844 | for loadable kernel modules. | 852 | for loadable kernel modules. |
845 | 853 | ||
846 | 854 | ||
847 | --- 6.2 Add prerequisites to archprepare: | 855 | --- 6.2 Add prerequisites to archprepare: |
848 | 856 | ||
849 | The archprepare: rule is used to list prerequisites that needs to be | 857 | The archprepare: rule is used to list prerequisites that need to be |
850 | built before starting to descend down in the subdirectories. | 858 | built before starting to descend down in the subdirectories. |
851 | This is usual header files containing assembler constants. | 859 | This is usually used for header files containing assembler constants. |
852 | 860 | ||
853 | Example: | 861 | Example: |
854 | #arch/arm/Makefile | 862 | #arch/arm/Makefile |
855 | archprepare: maketools | 863 | archprepare: maketools |
856 | 864 | ||
857 | In this example the file target maketools will be processed | 865 | In this example, the file target maketools will be processed |
858 | before descending down in the subdirectories. | 866 | before descending down in the subdirectories. |
859 | See also chapter XXX-TODO that describe how kbuild supports | 867 | See also chapter XXX-TODO that describe how kbuild supports |
860 | generating offset header files. | 868 | generating offset header files. |
@@ -867,18 +875,19 @@ When kbuild executes the following steps are followed (roughly): | |||
867 | corresponding arch-specific section for modules; the module-building | 875 | corresponding arch-specific section for modules; the module-building |
868 | machinery is all architecture-independent. | 876 | machinery is all architecture-independent. |
869 | 877 | ||
870 | 878 | ||
871 | head-y, init-y, core-y, libs-y, drivers-y, net-y | 879 | head-y, init-y, core-y, libs-y, drivers-y, net-y |
872 | 880 | ||
873 | $(head-y) list objects to be linked first in vmlinux. | 881 | $(head-y) lists objects to be linked first in vmlinux. |
874 | $(libs-y) list directories where a lib.a archive can be located. | 882 | $(libs-y) lists directories where a lib.a archive can be located. |
875 | The rest list directories where a built-in.o object file can be located. | 883 | The rest lists directories where a built-in.o object file can be |
884 | located. | ||
876 | 885 | ||
877 | $(init-y) objects will be located after $(head-y). | 886 | $(init-y) objects will be located after $(head-y). |
878 | Then the rest follows in this order: | 887 | Then the rest follows in this order: |
879 | $(core-y), $(libs-y), $(drivers-y) and $(net-y). | 888 | $(core-y), $(libs-y), $(drivers-y) and $(net-y). |
880 | 889 | ||
881 | The top level Makefile define values for all generic directories, | 890 | The top level Makefile defines values for all generic directories, |
882 | and arch/$(ARCH)/Makefile only adds architecture specific directories. | 891 | and arch/$(ARCH)/Makefile only adds architecture specific directories. |
883 | 892 | ||
884 | Example: | 893 | Example: |
@@ -915,27 +924,27 @@ When kbuild executes the following steps are followed (roughly): | |||
915 | "$(Q)$(MAKE) $(build)=<dir>" is the recommended way to invoke | 924 | "$(Q)$(MAKE) $(build)=<dir>" is the recommended way to invoke |
916 | make in a subdirectory. | 925 | make in a subdirectory. |
917 | 926 | ||
918 | There are no rules for naming of the architecture specific targets, | 927 | There are no rules for naming architecture specific targets, |
919 | but executing "make help" will list all relevant targets. | 928 | but executing "make help" will list all relevant targets. |
920 | To support this $(archhelp) must be defined. | 929 | To support this, $(archhelp) must be defined. |
921 | 930 | ||
922 | Example: | 931 | Example: |
923 | #arch/i386/Makefile | 932 | #arch/i386/Makefile |
924 | define archhelp | 933 | define archhelp |
925 | echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)' | 934 | echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)' |
926 | endef | 935 | endif |
927 | 936 | ||
928 | When make is executed without arguments, the first goal encountered | 937 | When make is executed without arguments, the first goal encountered |
929 | will be built. In the top level Makefile the first goal present | 938 | will be built. In the top level Makefile the first goal present |
930 | is all:. | 939 | is all:. |
931 | An architecture shall always per default build a bootable image. | 940 | An architecture shall always, per default, build a bootable image. |
932 | In "make help" the default goal is highlighted with a '*'. | 941 | In "make help", the default goal is highlighted with a '*'. |
933 | Add a new prerequisite to all: to select a default goal different | 942 | Add a new prerequisite to all: to select a default goal different |
934 | from vmlinux. | 943 | from vmlinux. |
935 | 944 | ||
936 | Example: | 945 | Example: |
937 | #arch/i386/Makefile | 946 | #arch/i386/Makefile |
938 | all: bzImage | 947 | all: bzImage |
939 | 948 | ||
940 | When "make" is executed without arguments, bzImage will be built. | 949 | When "make" is executed without arguments, bzImage will be built. |
941 | 950 | ||
@@ -955,10 +964,10 @@ When kbuild executes the following steps are followed (roughly): | |||
955 | #arch/i386/kernel/Makefile | 964 | #arch/i386/kernel/Makefile |
956 | extra-y := head.o init_task.o | 965 | extra-y := head.o init_task.o |
957 | 966 | ||
958 | In this example extra-y is used to list object files that | 967 | In this example, extra-y is used to list object files that |
959 | shall be built, but shall not be linked as part of built-in.o. | 968 | shall be built, but shall not be linked as part of built-in.o. |
960 | 969 | ||
961 | 970 | ||
962 | --- 6.6 Commands useful for building a boot image | 971 | --- 6.6 Commands useful for building a boot image |
963 | 972 | ||
964 | Kbuild provides a few macros that are useful when building a | 973 | Kbuild provides a few macros that are useful when building a |
@@ -972,8 +981,8 @@ When kbuild executes the following steps are followed (roughly): | |||
972 | target: source(s) FORCE | 981 | target: source(s) FORCE |
973 | $(call if_changed,ld/objcopy/gzip) | 982 | $(call if_changed,ld/objcopy/gzip) |
974 | 983 | ||
975 | When the rule is evaluated it is checked to see if any files | 984 | When the rule is evaluated, it is checked to see if any files |
976 | needs an update, or the commandline has changed since last | 985 | needs an update, or the command line has changed since the last |
977 | invocation. The latter will force a rebuild if any options | 986 | invocation. The latter will force a rebuild if any options |
978 | to the executable have changed. | 987 | to the executable have changed. |
979 | Any target that utilises if_changed must be listed in $(targets), | 988 | Any target that utilises if_changed must be listed in $(targets), |
@@ -991,8 +1000,8 @@ When kbuild executes the following steps are followed (roughly): | |||
991 | #WRONG!# $(call if_changed, ld/objcopy/gzip) | 1000 | #WRONG!# $(call if_changed, ld/objcopy/gzip) |
992 | 1001 | ||
993 | ld | 1002 | ld |
994 | Link target. Often LDFLAGS_$@ is used to set specific options to ld. | 1003 | Link target. Often, LDFLAGS_$@ is used to set specific options to ld. |
995 | 1004 | ||
996 | objcopy | 1005 | objcopy |
997 | Copy binary. Uses OBJCOPYFLAGS usually specified in | 1006 | Copy binary. Uses OBJCOPYFLAGS usually specified in |
998 | arch/$(ARCH)/Makefile. | 1007 | arch/$(ARCH)/Makefile. |
@@ -1010,10 +1019,10 @@ When kbuild executes the following steps are followed (roughly): | |||
1010 | $(obj)/setup $(obj)/bootsect: %: %.o FORCE | 1019 | $(obj)/setup $(obj)/bootsect: %: %.o FORCE |
1011 | $(call if_changed,ld) | 1020 | $(call if_changed,ld) |
1012 | 1021 | ||
1013 | In this example there are two possible targets, requiring different | 1022 | In this example, there are two possible targets, requiring different |
1014 | options to the linker. the linker options are specified using the | 1023 | options to the linker. The linker options are specified using the |
1015 | LDFLAGS_$@ syntax - one for each potential target. | 1024 | LDFLAGS_$@ syntax - one for each potential target. |
1016 | $(targets) are assinged all potential targets, herby kbuild knows | 1025 | $(targets) are assinged all potential targets, by which kbuild knows |
1017 | the targets and will: | 1026 | the targets and will: |
1018 | 1) check for commandline changes | 1027 | 1) check for commandline changes |
1019 | 2) delete target during make clean | 1028 | 2) delete target during make clean |
@@ -1027,7 +1036,7 @@ When kbuild executes the following steps are followed (roughly): | |||
1027 | 1036 | ||
1028 | --- 6.7 Custom kbuild commands | 1037 | --- 6.7 Custom kbuild commands |
1029 | 1038 | ||
1030 | When kbuild is executing with KBUILD_VERBOSE=0 then only a shorthand | 1039 | When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand |
1031 | of a command is normally displayed. | 1040 | of a command is normally displayed. |
1032 | To enable this behaviour for custom commands kbuild requires | 1041 | To enable this behaviour for custom commands kbuild requires |
1033 | two variables to be set: | 1042 | two variables to be set: |
@@ -1045,34 +1054,34 @@ When kbuild executes the following steps are followed (roughly): | |||
1045 | $(call if_changed,image) | 1054 | $(call if_changed,image) |
1046 | @echo 'Kernel: $@ is ready' | 1055 | @echo 'Kernel: $@ is ready' |
1047 | 1056 | ||
1048 | When updating the $(obj)/bzImage target the line: | 1057 | When updating the $(obj)/bzImage target, the line |
1049 | 1058 | ||
1050 | BUILD arch/i386/boot/bzImage | 1059 | BUILD arch/i386/boot/bzImage |
1051 | 1060 | ||
1052 | will be displayed with "make KBUILD_VERBOSE=0". | 1061 | will be displayed with "make KBUILD_VERBOSE=0". |
1053 | 1062 | ||
1054 | 1063 | ||
1055 | --- 6.8 Preprocessing linker scripts | 1064 | --- 6.8 Preprocessing linker scripts |
1056 | 1065 | ||
1057 | When the vmlinux image is build the linker script: | 1066 | When the vmlinux image is built, the linker script |
1058 | arch/$(ARCH)/kernel/vmlinux.lds is used. | 1067 | arch/$(ARCH)/kernel/vmlinux.lds is used. |
1059 | The script is a preprocessed variant of the file vmlinux.lds.S | 1068 | The script is a preprocessed variant of the file vmlinux.lds.S |
1060 | located in the same directory. | 1069 | located in the same directory. |
1061 | kbuild knows .lds file and includes a rule *lds.S -> *lds. | 1070 | kbuild knows .lds files and includes a rule *lds.S -> *lds. |
1062 | 1071 | ||
1063 | Example: | 1072 | Example: |
1064 | #arch/i386/kernel/Makefile | 1073 | #arch/i386/kernel/Makefile |
1065 | always := vmlinux.lds | 1074 | always := vmlinux.lds |
1066 | 1075 | ||
1067 | #Makefile | 1076 | #Makefile |
1068 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 1077 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) |
1069 | 1078 | ||
1070 | The assigment to $(always) is used to tell kbuild to build the | 1079 | The assignment to $(always) is used to tell kbuild to build the |
1071 | target: vmlinux.lds. | 1080 | target vmlinux.lds. |
1072 | The assignment to $(CPPFLAGS_vmlinux.lds) tell kbuild to use the | 1081 | The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the |
1073 | specified options when building the target vmlinux.lds. | 1082 | specified options when building the target vmlinux.lds. |
1074 | 1083 | ||
1075 | When building the *.lds target kbuild used the variakles: | 1084 | When building the *.lds target, kbuild uses the variables: |
1076 | CPPFLAGS : Set in top-level Makefile | 1085 | CPPFLAGS : Set in top-level Makefile |
1077 | EXTRA_CPPFLAGS : May be set in the kbuild makefile | 1086 | EXTRA_CPPFLAGS : May be set in the kbuild makefile |
1078 | CPPFLAGS_$(@F) : Target specific flags. | 1087 | CPPFLAGS_$(@F) : Target specific flags. |
@@ -1147,7 +1156,7 @@ The top Makefile exports the following variables: | |||
1147 | 1156 | ||
1148 | === 8 Makefile language | 1157 | === 8 Makefile language |
1149 | 1158 | ||
1150 | The kernel Makefiles are designed to run with GNU Make. The Makefiles | 1159 | The kernel Makefiles are designed to be run with GNU Make. The Makefiles |
1151 | use only the documented features of GNU Make, but they do use many | 1160 | use only the documented features of GNU Make, but they do use many |
1152 | GNU extensions. | 1161 | GNU extensions. |
1153 | 1162 | ||
@@ -1169,10 +1178,13 @@ is the right choice. | |||
1169 | Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> | 1178 | Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> |
1170 | Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 1179 | Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> |
1171 | Updates by Sam Ravnborg <sam@ravnborg.org> | 1180 | Updates by Sam Ravnborg <sam@ravnborg.org> |
1181 | Language QA by Jan Engelhardt <jengelh@gmx.de> | ||
1172 | 1182 | ||
1173 | === 10 TODO | 1183 | === 10 TODO |
1174 | 1184 | ||
1175 | - Describe how kbuild support shipped files with _shipped. | 1185 | - Describe how kbuild supports shipped files with _shipped. |
1176 | - Generating offset header files. | 1186 | - Generating offset header files. |
1177 | - Add more variables to section 7? | 1187 | - Add more variables to section 7? |
1178 | 1188 | ||
1189 | |||
1190 | |||
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt index 61fc079eb966..2e7702e94a78 100644 --- a/Documentation/kbuild/modules.txt +++ b/Documentation/kbuild/modules.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | In this document you will find information about: | 2 | In this document you will find information about: |
3 | - how to build external modules | 3 | - how to build external modules |
4 | - how to make your module use kbuild infrastructure | 4 | - how to make your module use the kbuild infrastructure |
5 | - how kbuild will install a kernel | 5 | - how kbuild will install a kernel |
6 | - how to install modules in a non-standard location | 6 | - how to install modules in a non-standard location |
7 | 7 | ||
@@ -24,7 +24,7 @@ In this document you will find information about: | |||
24 | --- 6.1 INSTALL_MOD_PATH | 24 | --- 6.1 INSTALL_MOD_PATH |
25 | --- 6.2 INSTALL_MOD_DIR | 25 | --- 6.2 INSTALL_MOD_DIR |
26 | === 7. Module versioning & Module.symvers | 26 | === 7. Module versioning & Module.symvers |
27 | --- 7.1 Symbols fron the kernel (vmlinux + modules) | 27 | --- 7.1 Symbols from the kernel (vmlinux + modules) |
28 | --- 7.2 Symbols and external modules | 28 | --- 7.2 Symbols and external modules |
29 | --- 7.3 Symbols from another external module | 29 | --- 7.3 Symbols from another external module |
30 | === 8. Tips & Tricks | 30 | === 8. Tips & Tricks |
@@ -36,13 +36,13 @@ In this document you will find information about: | |||
36 | 36 | ||
37 | kbuild includes functionality for building modules both | 37 | kbuild includes functionality for building modules both |
38 | within the kernel source tree and outside the kernel source tree. | 38 | within the kernel source tree and outside the kernel source tree. |
39 | The latter is usually referred to as external modules and is used | 39 | The latter is usually referred to as external or "out-of-tree" |
40 | both during development and for modules that are not planned to be | 40 | modules and is used both during development and for modules that |
41 | included in the kernel tree. | 41 | are not planned to be included in the kernel tree. |
42 | 42 | ||
43 | What is covered within this file is mainly information to authors | 43 | What is covered within this file is mainly information to authors |
44 | of modules. The author of an external modules should supply | 44 | of modules. The author of an external module should supply |
45 | a makefile that hides most of the complexity so one only has to type | 45 | a makefile that hides most of the complexity, so one only has to type |
46 | 'make' to build the module. A complete example will be present in | 46 | 'make' to build the module. A complete example will be present in |
47 | chapter 4, "Creating a kbuild file for an external module". | 47 | chapter 4, "Creating a kbuild file for an external module". |
48 | 48 | ||
@@ -63,14 +63,15 @@ when building an external module. | |||
63 | For the running kernel use: | 63 | For the running kernel use: |
64 | make -C /lib/modules/`uname -r`/build M=`pwd` | 64 | make -C /lib/modules/`uname -r`/build M=`pwd` |
65 | 65 | ||
66 | For the above command to succeed the kernel must have been built with | 66 | For the above command to succeed, the kernel must have been |
67 | modules enabled. | 67 | built with modules enabled. |
68 | 68 | ||
69 | To install the modules that were just built: | 69 | To install the modules that were just built: |
70 | 70 | ||
71 | make -C <path-to-kernel> M=`pwd` modules_install | 71 | make -C <path-to-kernel> M=`pwd` modules_install |
72 | 72 | ||
73 | More complex examples later, the above should get you going. | 73 | More complex examples will be shown later, the above should |
74 | be enough to get you started. | ||
74 | 75 | ||
75 | --- 2.2 Available targets | 76 | --- 2.2 Available targets |
76 | 77 | ||
@@ -89,13 +90,13 @@ when building an external module. | |||
89 | Same functionality as if no target was specified. | 90 | Same functionality as if no target was specified. |
90 | See description above. | 91 | See description above. |
91 | 92 | ||
92 | make -C $KDIR M=$PWD modules_install | 93 | make -C $KDIR M=`pwd` modules_install |
93 | Install the external module(s). | 94 | Install the external module(s). |
94 | Installation default is in /lib/modules/<kernel-version>/extra, | 95 | Installation default is in /lib/modules/<kernel-version>/extra, |
95 | but may be prefixed with INSTALL_MOD_PATH - see separate | 96 | but may be prefixed with INSTALL_MOD_PATH - see separate |
96 | chapter. | 97 | chapter. |
97 | 98 | ||
98 | make -C $KDIR M=$PWD clean | 99 | make -C $KDIR M=`pwd` clean |
99 | Remove all generated files for the module - the kernel | 100 | Remove all generated files for the module - the kernel |
100 | source directory is not modified. | 101 | source directory is not modified. |
101 | 102 | ||
@@ -129,29 +130,28 @@ when building an external module. | |||
129 | 130 | ||
130 | To make sure the kernel contains the information required to | 131 | To make sure the kernel contains the information required to |
131 | build external modules the target 'modules_prepare' must be used. | 132 | build external modules the target 'modules_prepare' must be used. |
132 | 'module_prepare' solely exists as a simple way to prepare | 133 | 'module_prepare' exists solely as a simple way to prepare |
133 | a kernel for building external modules. | 134 | a kernel source tree for building external modules. |
134 | Note: modules_prepare will not build Module.symvers even if | 135 | Note: modules_prepare will not build Module.symvers even if |
135 | CONFIG_MODULEVERSIONING is set. | 136 | CONFIG_MODULEVERSIONING is set. Therefore a full kernel build |
136 | Therefore a full kernel build needs to be executed to make | 137 | needs to be executed to make module versioning work. |
137 | module versioning work. | ||
138 | 138 | ||
139 | --- 2.5 Building separate files for a module | 139 | --- 2.5 Building separate files for a module |
140 | It is possible to build single files which is part of a module. | 140 | It is possible to build single files which are part of a module. |
141 | This works equal for the kernel, a module and even for external | 141 | This works equally well for the kernel, a module and even for |
142 | modules. | 142 | external modules. |
143 | Examples (module foo.ko, consist of bar.o, baz.o): | 143 | Examples (module foo.ko, consist of bar.o, baz.o): |
144 | make -C $KDIR M=`pwd` bar.lst | 144 | make -C $KDIR M=`pwd` bar.lst |
145 | make -C $KDIR M=`pwd` bar.o | 145 | make -C $KDIR M=`pwd` bar.o |
146 | make -C $KDIR M=`pwd` foo.ko | 146 | make -C $KDIR M=`pwd` foo.ko |
147 | make -C $KDIR M=`pwd` / | 147 | make -C $KDIR M=`pwd` / |
148 | 148 | ||
149 | 149 | ||
150 | === 3. Example commands | 150 | === 3. Example commands |
151 | 151 | ||
152 | This example shows the actual commands to be executed when building | 152 | This example shows the actual commands to be executed when building |
153 | an external module for the currently running kernel. | 153 | an external module for the currently running kernel. |
154 | In the example below the distribution is supposed to use the | 154 | In the example below, the distribution is supposed to use the |
155 | facility to locate output files for a kernel compile in a different | 155 | facility to locate output files for a kernel compile in a different |
156 | directory than the kernel source - but the examples will also work | 156 | directory than the kernel source - but the examples will also work |
157 | when the source and the output files are mixed in the same directory. | 157 | when the source and the output files are mixed in the same directory. |
@@ -170,14 +170,14 @@ the following commands to build the module: | |||
170 | O=/lib/modules/`uname-r`/build \ | 170 | O=/lib/modules/`uname-r`/build \ |
171 | M=`pwd` | 171 | M=`pwd` |
172 | 172 | ||
173 | Then to install the module use the following command: | 173 | Then, to install the module use the following command: |
174 | 174 | ||
175 | make -C /usr/src/`uname -r`/source \ | 175 | make -C /usr/src/`uname -r`/source \ |
176 | O=/lib/modules/`uname-r`/build \ | 176 | O=/lib/modules/`uname-r`/build \ |
177 | M=`pwd` \ | 177 | M=`pwd` \ |
178 | modules_install | 178 | modules_install |
179 | 179 | ||
180 | If one looks closely you will see that this is the same commands as | 180 | If you look closely you will see that this is the same command as |
181 | listed before - with the directories spelled out. | 181 | listed before - with the directories spelled out. |
182 | 182 | ||
183 | The above are rather long commands, and the following chapter | 183 | The above are rather long commands, and the following chapter |
@@ -230,7 +230,7 @@ following files: | |||
230 | 230 | ||
231 | endif | 231 | endif |
232 | 232 | ||
233 | In example 1 the check for KERNELRELEASE is used to separate | 233 | In example 1, the check for KERNELRELEASE is used to separate |
234 | the two parts of the Makefile. kbuild will only see the two | 234 | the two parts of the Makefile. kbuild will only see the two |
235 | assignments whereas make will see everything except the two | 235 | assignments whereas make will see everything except the two |
236 | kbuild assignments. | 236 | kbuild assignments. |
@@ -255,7 +255,7 @@ following files: | |||
255 | echo "X" > 8123_bin_shipped | 255 | echo "X" > 8123_bin_shipped |
256 | 256 | ||
257 | 257 | ||
258 | In example 2 we are down to two fairly simple files and for simple | 258 | In example 2, we are down to two fairly simple files and for simple |
259 | files as used in this example the split is questionable. But some | 259 | files as used in this example the split is questionable. But some |
260 | external modules use Makefiles of several hundred lines and here it | 260 | external modules use Makefiles of several hundred lines and here it |
261 | really pays off to separate the kbuild part from the rest. | 261 | really pays off to separate the kbuild part from the rest. |
@@ -282,9 +282,9 @@ following files: | |||
282 | 282 | ||
283 | endif | 283 | endif |
284 | 284 | ||
285 | The trick here is to include the Kbuild file from Makefile so | 285 | The trick here is to include the Kbuild file from Makefile, so |
286 | if an older version of kbuild picks up the Makefile the Kbuild | 286 | if an older version of kbuild picks up the Makefile, the Kbuild |
287 | file will be included. | 287 | file will be included. |
288 | 288 | ||
289 | --- 4.2 Binary blobs included in a module | 289 | --- 4.2 Binary blobs included in a module |
290 | 290 | ||
@@ -301,18 +301,19 @@ following files: | |||
301 | obj-m := 8123.o | 301 | obj-m := 8123.o |
302 | 8123-y := 8123_if.o 8123_pci.o 8123_bin.o | 302 | 8123-y := 8123_if.o 8123_pci.o 8123_bin.o |
303 | 303 | ||
304 | In example 4 there is no distinction between the ordinary .c/.h files | 304 | In example 4, there is no distinction between the ordinary .c/.h files |
305 | and the binary file. But kbuild will pick up different rules to create | 305 | and the binary file. But kbuild will pick up different rules to create |
306 | the .o file. | 306 | the .o file. |
307 | 307 | ||
308 | 308 | ||
309 | === 5. Include files | 309 | === 5. Include files |
310 | 310 | ||
311 | Include files are a necessity when a .c file uses something from another .c | 311 | Include files are a necessity when a .c file uses something from other .c |
312 | files (not strictly in the sense of .c but if good programming practice is | 312 | files (not strictly in the sense of C, but if good programming practice is |
313 | used). Any module that consist of more than one .c file will have a .h file | 313 | used). Any module that consists of more than one .c file will have a .h file |
314 | for one of the .c files. | 314 | for one of the .c files. |
315 | - If the .h file only describes a module internal interface then the .h file | 315 | |
316 | - If the .h file only describes a module internal interface, then the .h file | ||
316 | shall be placed in the same directory as the .c files. | 317 | shall be placed in the same directory as the .c files. |
317 | - If the .h files describe an interface used by other parts of the kernel | 318 | - If the .h files describe an interface used by other parts of the kernel |
318 | located in different directories, the .h files shall be located in | 319 | located in different directories, the .h files shall be located in |
@@ -323,11 +324,11 @@ under include/ such as include/scsi. Another exception is arch-specific | |||
323 | .h files which are located under include/asm-$(ARCH)/*. | 324 | .h files which are located under include/asm-$(ARCH)/*. |
324 | 325 | ||
325 | External modules have a tendency to locate include files in a separate include/ | 326 | External modules have a tendency to locate include files in a separate include/ |
326 | directory and therefore needs to deal with this in their kbuild file. | 327 | directory and therefore need to deal with this in their kbuild file. |
327 | 328 | ||
328 | --- 5.1 How to include files from the kernel include dir | 329 | --- 5.1 How to include files from the kernel include dir |
329 | 330 | ||
330 | When a module needs to include a file from include/linux/ then one | 331 | When a module needs to include a file from include/linux/, then one |
331 | just uses: | 332 | just uses: |
332 | 333 | ||
333 | #include <linux/modules.h> | 334 | #include <linux/modules.h> |
@@ -348,7 +349,7 @@ directory and therefore needs to deal with this in their kbuild file. | |||
348 | The trick here is to use either EXTRA_CFLAGS (take effect for all .c | 349 | The trick here is to use either EXTRA_CFLAGS (take effect for all .c |
349 | files) or CFLAGS_$F.o (take effect only for a single file). | 350 | files) or CFLAGS_$F.o (take effect only for a single file). |
350 | 351 | ||
351 | In our example if we move 8123_if.h to a subdirectory named include/ | 352 | In our example, if we move 8123_if.h to a subdirectory named include/ |
352 | the resulting Kbuild file would look like: | 353 | the resulting Kbuild file would look like: |
353 | 354 | ||
354 | --> filename: Kbuild | 355 | --> filename: Kbuild |
@@ -362,19 +363,19 @@ directory and therefore needs to deal with this in their kbuild file. | |||
362 | 363 | ||
363 | --- 5.3 External modules using several directories | 364 | --- 5.3 External modules using several directories |
364 | 365 | ||
365 | If an external module does not follow the usual kernel style but | 366 | If an external module does not follow the usual kernel style, but |
366 | decide to spread files over several directories then kbuild can | 367 | decides to spread files over several directories, then kbuild can |
367 | support this too. | 368 | handle this too. |
368 | 369 | ||
369 | Consider the following example: | 370 | Consider the following example: |
370 | 371 | ||
371 | | | 372 | | |
372 | +- src/complex_main.c | 373 | +- src/complex_main.c |
373 | | +- hal/hardwareif.c | 374 | | +- hal/hardwareif.c |
374 | | +- hal/include/hardwareif.h | 375 | | +- hal/include/hardwareif.h |
375 | +- include/complex.h | 376 | +- include/complex.h |
376 | 377 | ||
377 | To build a single module named complex.ko we then need the following | 378 | To build a single module named complex.ko, we then need the following |
378 | kbuild file: | 379 | kbuild file: |
379 | 380 | ||
380 | Kbuild: | 381 | Kbuild: |
@@ -387,12 +388,12 @@ directory and therefore needs to deal with this in their kbuild file. | |||
387 | 388 | ||
388 | 389 | ||
389 | kbuild knows how to handle .o files located in another directory - | 390 | kbuild knows how to handle .o files located in another directory - |
390 | although this is NOT reccommended practice. The syntax is to specify | 391 | although this is NOT recommended practice. The syntax is to specify |
391 | the directory relative to the directory where the Kbuild file is | 392 | the directory relative to the directory where the Kbuild file is |
392 | located. | 393 | located. |
393 | 394 | ||
394 | To find the .h files we have to explicitly tell kbuild where to look | 395 | To find the .h files, we have to explicitly tell kbuild where to look |
395 | for the .h files. When kbuild executes current directory is always | 396 | for the .h files. When kbuild executes, the current directory is always |
396 | the root of the kernel tree (argument to -C) and therefore we have to | 397 | the root of the kernel tree (argument to -C) and therefore we have to |
397 | tell kbuild how to find the .h files using absolute paths. | 398 | tell kbuild how to find the .h files using absolute paths. |
398 | $(src) will specify the absolute path to the directory where the | 399 | $(src) will specify the absolute path to the directory where the |
@@ -412,7 +413,7 @@ External modules are installed in the directory: | |||
412 | 413 | ||
413 | --- 6.1 INSTALL_MOD_PATH | 414 | --- 6.1 INSTALL_MOD_PATH |
414 | 415 | ||
415 | Above are the default directories, but as always some level of | 416 | Above are the default directories, but as always, some level of |
416 | customization is possible. One can prefix the path using the variable | 417 | customization is possible. One can prefix the path using the variable |
417 | INSTALL_MOD_PATH: | 418 | INSTALL_MOD_PATH: |
418 | 419 | ||
@@ -420,17 +421,17 @@ External modules are installed in the directory: | |||
420 | => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel | 421 | => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel |
421 | 422 | ||
422 | INSTALL_MOD_PATH may be set as an ordinary shell variable or as in the | 423 | INSTALL_MOD_PATH may be set as an ordinary shell variable or as in the |
423 | example above be specified on the command line when calling make. | 424 | example above, can be specified on the command line when calling make. |
424 | INSTALL_MOD_PATH has effect both when installing modules included in | 425 | INSTALL_MOD_PATH has effect both when installing modules included in |
425 | the kernel as well as when installing external modules. | 426 | the kernel as well as when installing external modules. |
426 | 427 | ||
427 | --- 6.2 INSTALL_MOD_DIR | 428 | --- 6.2 INSTALL_MOD_DIR |
428 | 429 | ||
429 | When installing external modules they are default installed in a | 430 | When installing external modules they are by default installed to a |
430 | directory under /lib/modules/$(KERNELRELEASE)/extra, but one may wish | 431 | directory under /lib/modules/$(KERNELRELEASE)/extra, but one may wish |
431 | to locate modules for a specific functionality in a separate | 432 | to locate modules for a specific functionality in a separate |
432 | directory. For this purpose one can use INSTALL_MOD_DIR to specify an | 433 | directory. For this purpose, one can use INSTALL_MOD_DIR to specify an |
433 | alternative name than 'extra'. | 434 | alternative name to 'extra'. |
434 | 435 | ||
435 | $ make INSTALL_MOD_DIR=gandalf -C KERNELDIR \ | 436 | $ make INSTALL_MOD_DIR=gandalf -C KERNELDIR \ |
436 | M=`pwd` modules_install | 437 | M=`pwd` modules_install |
@@ -444,16 +445,16 @@ Module versioning is enabled by the CONFIG_MODVERSIONS tag. | |||
444 | Module versioning is used as a simple ABI consistency check. The Module | 445 | Module versioning is used as a simple ABI consistency check. The Module |
445 | versioning creates a CRC value of the full prototype for an exported symbol and | 446 | versioning creates a CRC value of the full prototype for an exported symbol and |
446 | when a module is loaded/used then the CRC values contained in the kernel are | 447 | when a module is loaded/used then the CRC values contained in the kernel are |
447 | compared with similar values in the module. If they are not equal then the | 448 | compared with similar values in the module. If they are not equal, then the |
448 | kernel refuses to load the module. | 449 | kernel refuses to load the module. |
449 | 450 | ||
450 | Module.symvers contains a list of all exported symbols from a kernel build. | 451 | Module.symvers contains a list of all exported symbols from a kernel build. |
451 | 452 | ||
452 | --- 7.1 Symbols fron the kernel (vmlinux + modules) | 453 | --- 7.1 Symbols fron the kernel (vmlinux + modules) |
453 | 454 | ||
454 | During a kernel build a file named Module.symvers will be generated. | 455 | During a kernel build, a file named Module.symvers will be generated. |
455 | Module.symvers contains all exported symbols from the kernel and | 456 | Module.symvers contains all exported symbols from the kernel and |
456 | compiled modules. For each symbols the corresponding CRC value | 457 | compiled modules. For each symbols, the corresponding CRC value |
457 | is stored too. | 458 | is stored too. |
458 | 459 | ||
459 | The syntax of the Module.symvers file is: | 460 | The syntax of the Module.symvers file is: |
@@ -461,27 +462,27 @@ Module.symvers contains a list of all exported symbols from a kernel build. | |||
461 | Sample: | 462 | Sample: |
462 | 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod | 463 | 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod |
463 | 464 | ||
464 | For a kernel build without CONFIG_MODVERSIONING enabled the crc | 465 | For a kernel build without CONFIG_MODVERSIONS enabled, the crc |
465 | would read: 0x00000000 | 466 | would read: 0x00000000 |
466 | 467 | ||
467 | Module.symvers serve two purposes. | 468 | Module.symvers serves two purposes: |
468 | 1) It list all exported symbols both from vmlinux and all modules | 469 | 1) It lists all exported symbols both from vmlinux and all modules |
469 | 2) It list CRC if CONFIG_MODVERSION is enabled | 470 | 2) It lists the CRC if CONFIG_MODVERSIONS is enabled |
470 | 471 | ||
471 | --- 7.2 Symbols and external modules | 472 | --- 7.2 Symbols and external modules |
472 | 473 | ||
473 | When building an external module the build system needs access to | 474 | When building an external module, the build system needs access to |
474 | the symbols from the kernel to check if all external symbols are | 475 | the symbols from the kernel to check if all external symbols are |
475 | defined. This is done in the MODPOST step and to obtain all | 476 | defined. This is done in the MODPOST step and to obtain all |
476 | symbols modpost reads Module.symvers from the kernel. | 477 | symbols, modpost reads Module.symvers from the kernel. |
477 | If a Module.symvers file is present in the directory where | 478 | If a Module.symvers file is present in the directory where |
478 | the external module is being build this file will be read too. | 479 | the external module is being built, this file will be read too. |
479 | During the MODPOST step a new Module.symvers file will be written | 480 | During the MODPOST step, a new Module.symvers file will be written |
480 | containing all exported symbols that was not defined in the kernel. | 481 | containing all exported symbols that were not defined in the kernel. |
481 | 482 | ||
482 | --- 7.3 Symbols from another external module | 483 | --- 7.3 Symbols from another external module |
483 | 484 | ||
484 | Sometimes one external module uses exported symbols from another | 485 | Sometimes, an external module uses exported symbols from another |
485 | external module. Kbuild needs to have full knowledge on all symbols | 486 | external module. Kbuild needs to have full knowledge on all symbols |
486 | to avoid spitting out warnings about undefined symbols. | 487 | to avoid spitting out warnings about undefined symbols. |
487 | Two solutions exist to let kbuild know all symbols of more than | 488 | Two solutions exist to let kbuild know all symbols of more than |
@@ -490,15 +491,15 @@ Module.symvers contains a list of all exported symbols from a kernel build. | |||
490 | impractical in certain situations. | 491 | impractical in certain situations. |
491 | 492 | ||
492 | Use a top-level Kbuild file | 493 | Use a top-level Kbuild file |
493 | If you have two modules: 'foo', 'bar' and 'foo' needs symbols | 494 | If you have two modules: 'foo' and 'bar', and 'foo' needs |
494 | from 'bar' then one can use a common top-level kbuild file so | 495 | symbols from 'bar', then one can use a common top-level kbuild |
495 | both modules are compiled in same build. | 496 | file so both modules are compiled in same build. |
496 | 497 | ||
497 | Consider following directory layout: | 498 | Consider following directory layout: |
498 | ./foo/ <= contains the foo module | 499 | ./foo/ <= contains the foo module |
499 | ./bar/ <= contains the bar module | 500 | ./bar/ <= contains the bar module |
500 | The top-level Kbuild file would then look like: | 501 | The top-level Kbuild file would then look like: |
501 | 502 | ||
502 | #./Kbuild: (this file may also be named Makefile) | 503 | #./Kbuild: (this file may also be named Makefile) |
503 | obj-y := foo/ bar/ | 504 | obj-y := foo/ bar/ |
504 | 505 | ||
@@ -509,23 +510,23 @@ Module.symvers contains a list of all exported symbols from a kernel build. | |||
509 | knowledge on symbols from both modules. | 510 | knowledge on symbols from both modules. |
510 | 511 | ||
511 | Use an extra Module.symvers file | 512 | Use an extra Module.symvers file |
512 | When an external module is build a Module.symvers file is | 513 | When an external module is built, a Module.symvers file is |
513 | generated containing all exported symbols which are not | 514 | generated containing all exported symbols which are not |
514 | defined in the kernel. | 515 | defined in the kernel. |
515 | To get access to symbols from module 'bar' one can copy the | 516 | To get access to symbols from module 'bar', one can copy the |
516 | Module.symvers file from the compilation of the 'bar' module | 517 | Module.symvers file from the compilation of the 'bar' module |
517 | to the directory where the 'foo' module is build. | 518 | to the directory where the 'foo' module is built. |
518 | During the module build kbuild will read the Module.symvers | 519 | During the module build, kbuild will read the Module.symvers |
519 | file in the directory of the external module and when the | 520 | file in the directory of the external module and when the |
520 | build is finished a new Module.symvers file is created | 521 | build is finished, a new Module.symvers file is created |
521 | containing the sum of all symbols defined and not part of the | 522 | containing the sum of all symbols defined and not part of the |
522 | kernel. | 523 | kernel. |
523 | 524 | ||
524 | === 8. Tips & Tricks | 525 | === 8. Tips & Tricks |
525 | 526 | ||
526 | --- 8.1 Testing for CONFIG_FOO_BAR | 527 | --- 8.1 Testing for CONFIG_FOO_BAR |
527 | 528 | ||
528 | Modules often needs to check for certain CONFIG_ options to decide if | 529 | Modules often need to check for certain CONFIG_ options to decide if |
529 | a specific feature shall be included in the module. When kbuild is used | 530 | a specific feature shall be included in the module. When kbuild is used |
530 | this is done by referencing the CONFIG_ variable directly. | 531 | this is done by referencing the CONFIG_ variable directly. |
531 | 532 | ||
@@ -537,7 +538,7 @@ Module.symvers contains a list of all exported symbols from a kernel build. | |||
537 | 538 | ||
538 | External modules have traditionally used grep to check for specific | 539 | External modules have traditionally used grep to check for specific |
539 | CONFIG_ settings directly in .config. This usage is broken. | 540 | CONFIG_ settings directly in .config. This usage is broken. |
540 | As introduced before external modules shall use kbuild when building | 541 | As introduced before, external modules shall use kbuild when building |
541 | and therefore can use the same methods as in-kernel modules when testing | 542 | and therefore can use the same methods as in-kernel modules when |
542 | for CONFIG_ definitions. | 543 | testing for CONFIG_ definitions. |
543 | 544 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 87a17337c7f6..137e993f4329 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -110,6 +110,13 @@ be entered as an environment variable, whereas its absence indicates that | |||
110 | it will appear as a kernel argument readable via /proc/cmdline by programs | 110 | it will appear as a kernel argument readable via /proc/cmdline by programs |
111 | running once the system is up. | 111 | running once the system is up. |
112 | 112 | ||
113 | The number of kernel parameters is not limited, but the length of the | ||
114 | complete command line (parameters including spaces etc.) is limited to | ||
115 | a fixed number of characters. This limit depends on the architecture | ||
116 | and is between 256 and 4096 characters. It is defined in the file | ||
117 | ./include/asm/setup.h as COMMAND_LINE_SIZE. | ||
118 | |||
119 | |||
113 | 53c7xx= [HW,SCSI] Amiga SCSI controllers | 120 | 53c7xx= [HW,SCSI] Amiga SCSI controllers |
114 | See header of drivers/scsi/53c7xx.c. | 121 | See header of drivers/scsi/53c7xx.c. |
115 | See also Documentation/scsi/ncr53c7xx.txt. | 122 | See also Documentation/scsi/ncr53c7xx.txt. |
@@ -573,8 +580,6 @@ running once the system is up. | |||
573 | gscd= [HW,CD] | 580 | gscd= [HW,CD] |
574 | Format: <io> | 581 | Format: <io> |
575 | 582 | ||
576 | gt96100eth= [NET] MIPS GT96100 Advanced Communication Controller | ||
577 | |||
578 | gus= [HW,OSS] | 583 | gus= [HW,OSS] |
579 | Format: <io>,<irq>,<dma>,<dma16> | 584 | Format: <io>,<irq>,<dma>,<dma16> |
580 | 585 | ||
@@ -1189,8 +1194,6 @@ running once the system is up. | |||
1189 | Mechanism 2. | 1194 | Mechanism 2. |
1190 | nommconf [IA-32,X86_64] Disable use of MMCONFIG for PCI | 1195 | nommconf [IA-32,X86_64] Disable use of MMCONFIG for PCI |
1191 | Configuration | 1196 | Configuration |
1192 | mmconf [IA-32,X86_64] Force MMCONFIG. This is useful | ||
1193 | to override the builtin blacklist. | ||
1194 | nomsi [MSI] If the PCI_MSI kernel config parameter is | 1197 | nomsi [MSI] If the PCI_MSI kernel config parameter is |
1195 | enabled, this kernel boot option can be used to | 1198 | enabled, this kernel boot option can be used to |
1196 | disable the use of MSI interrupts system-wide. | 1199 | disable the use of MSI interrupts system-wide. |
@@ -1242,7 +1245,11 @@ running once the system is up. | |||
1242 | bootloader. This is currently used on | 1245 | bootloader. This is currently used on |
1243 | IXP2000 systems where the bus has to be | 1246 | IXP2000 systems where the bus has to be |
1244 | configured a certain way for adjunct CPUs. | 1247 | configured a certain way for adjunct CPUs. |
1245 | 1248 | noearly [X86] Don't do any early type 1 scanning. | |
1249 | This might help on some broken boards which | ||
1250 | machine check when some devices' config space | ||
1251 | is read. But various workarounds are disabled | ||
1252 | and some IOMMU drivers will not work. | ||
1246 | pcmv= [HW,PCMCIA] BadgePAD 4 | 1253 | pcmv= [HW,PCMCIA] BadgePAD 4 |
1247 | 1254 | ||
1248 | pd. [PARIDE] | 1255 | pd. [PARIDE] |
@@ -1324,7 +1331,7 @@ running once the system is up. | |||
1324 | pt. [PARIDE] | 1331 | pt. [PARIDE] |
1325 | See Documentation/paride.txt. | 1332 | See Documentation/paride.txt. |
1326 | 1333 | ||
1327 | quiet= [KNL] Disable log messages | 1334 | quiet [KNL] Disable most log messages |
1328 | 1335 | ||
1329 | r128= [HW,DRM] | 1336 | r128= [HW,DRM] |
1330 | 1337 | ||
@@ -1365,6 +1372,14 @@ running once the system is up. | |||
1365 | 1372 | ||
1366 | reserve= [KNL,BUGS] Force the kernel to ignore some iomem area | 1373 | reserve= [KNL,BUGS] Force the kernel to ignore some iomem area |
1367 | 1374 | ||
1375 | reservetop= [IA-32] | ||
1376 | Format: nn[KMG] | ||
1377 | Reserves a hole at the top of the kernel virtual | ||
1378 | address space. | ||
1379 | |||
1380 | reset_devices [KNL] Force drivers to reset the underlying device | ||
1381 | during initialization. | ||
1382 | |||
1368 | resume= [SWSUSP] | 1383 | resume= [SWSUSP] |
1369 | Specify the partition device for software suspend | 1384 | Specify the partition device for software suspend |
1370 | 1385 | ||
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index 2c3b1eae4280..ba26201d5023 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt | |||
@@ -151,9 +151,9 @@ So that you can load and unload Kprobes-based instrumentation modules, | |||
151 | make sure "Loadable module support" (CONFIG_MODULES) and "Module | 151 | make sure "Loadable module support" (CONFIG_MODULES) and "Module |
152 | unloading" (CONFIG_MODULE_UNLOAD) are set to "y". | 152 | unloading" (CONFIG_MODULE_UNLOAD) are set to "y". |
153 | 153 | ||
154 | You may also want to ensure that CONFIG_KALLSYMS and perhaps even | 154 | Also make sure that CONFIG_KALLSYMS and perhaps even CONFIG_KALLSYMS_ALL |
155 | CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name() | 155 | are set to "y", since kallsyms_lookup_name() is used by the in-kernel |
156 | is a handy, version-independent way to find a function's address. | 156 | kprobe address resolution code. |
157 | 157 | ||
158 | If you need to insert a probe in the middle of a function, you may find | 158 | If you need to insert a probe in the middle of a function, you may find |
159 | it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), | 159 | it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), |
@@ -179,6 +179,27 @@ occurs during execution of kp->pre_handler or kp->post_handler, | |||
179 | or during single-stepping of the probed instruction, Kprobes calls | 179 | or during single-stepping of the probed instruction, Kprobes calls |
180 | kp->fault_handler. Any or all handlers can be NULL. | 180 | kp->fault_handler. Any or all handlers can be NULL. |
181 | 181 | ||
182 | NOTE: | ||
183 | 1. With the introduction of the "symbol_name" field to struct kprobe, | ||
184 | the probepoint address resolution will now be taken care of by the kernel. | ||
185 | The following will now work: | ||
186 | |||
187 | kp.symbol_name = "symbol_name"; | ||
188 | |||
189 | (64-bit powerpc intricacies such as function descriptors are handled | ||
190 | transparently) | ||
191 | |||
192 | 2. Use the "offset" field of struct kprobe if the offset into the symbol | ||
193 | to install a probepoint is known. This field is used to calculate the | ||
194 | probepoint. | ||
195 | |||
196 | 3. Specify either the kprobe "symbol_name" OR the "addr". If both are | ||
197 | specified, kprobe registration will fail with -EINVAL. | ||
198 | |||
199 | 4. With CISC architectures (such as i386 and x86_64), the kprobes code | ||
200 | does not validate if the kprobe.addr is at an instruction boundary. | ||
201 | Use "offset" with caution. | ||
202 | |||
182 | register_kprobe() returns 0 on success, or a negative errno otherwise. | 203 | register_kprobe() returns 0 on success, or a negative errno otherwise. |
183 | 204 | ||
184 | User's pre-handler (kp->pre_handler): | 205 | User's pre-handler (kp->pre_handler): |
@@ -225,6 +246,12 @@ control to Kprobes.) If the probed function is declared asmlinkage, | |||
225 | fastcall, or anything else that affects how args are passed, the | 246 | fastcall, or anything else that affects how args are passed, the |
226 | handler's declaration must match. | 247 | handler's declaration must match. |
227 | 248 | ||
249 | NOTE: A macro JPROBE_ENTRY is provided to handle architecture-specific | ||
250 | aliasing of jp->entry. In the interest of portability, it is advised | ||
251 | to use: | ||
252 | |||
253 | jp->entry = JPROBE_ENTRY(handler); | ||
254 | |||
228 | register_jprobe() returns 0 on success, or a negative errno otherwise. | 255 | register_jprobe() returns 0 on success, or a negative errno otherwise. |
229 | 256 | ||
230 | 4.3 register_kretprobe | 257 | 4.3 register_kretprobe |
@@ -251,6 +278,11 @@ of interest: | |||
251 | - ret_addr: the return address | 278 | - ret_addr: the return address |
252 | - rp: points to the corresponding kretprobe object | 279 | - rp: points to the corresponding kretprobe object |
253 | - task: points to the corresponding task struct | 280 | - task: points to the corresponding task struct |
281 | |||
282 | The regs_return_value(regs) macro provides a simple abstraction to | ||
283 | extract the return value from the appropriate register as defined by | ||
284 | the architecture's ABI. | ||
285 | |||
254 | The handler's return value is currently ignored. | 286 | The handler's return value is currently ignored. |
255 | 287 | ||
256 | 4.4 unregister_*probe | 288 | 4.4 unregister_*probe |
@@ -369,7 +401,6 @@ stack trace and selected i386 registers when do_fork() is called. | |||
369 | #include <linux/kernel.h> | 401 | #include <linux/kernel.h> |
370 | #include <linux/module.h> | 402 | #include <linux/module.h> |
371 | #include <linux/kprobes.h> | 403 | #include <linux/kprobes.h> |
372 | #include <linux/kallsyms.h> | ||
373 | #include <linux/sched.h> | 404 | #include <linux/sched.h> |
374 | 405 | ||
375 | /*For each probe you need to allocate a kprobe structure*/ | 406 | /*For each probe you need to allocate a kprobe structure*/ |
@@ -403,18 +434,14 @@ int handler_fault(struct kprobe *p, struct pt_regs *regs, int trapnr) | |||
403 | return 0; | 434 | return 0; |
404 | } | 435 | } |
405 | 436 | ||
406 | int init_module(void) | 437 | static int __init kprobe_init(void) |
407 | { | 438 | { |
408 | int ret; | 439 | int ret; |
409 | kp.pre_handler = handler_pre; | 440 | kp.pre_handler = handler_pre; |
410 | kp.post_handler = handler_post; | 441 | kp.post_handler = handler_post; |
411 | kp.fault_handler = handler_fault; | 442 | kp.fault_handler = handler_fault; |
412 | kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name("do_fork"); | 443 | kp.symbol_name = "do_fork"; |
413 | /* register the kprobe now */ | 444 | |
414 | if (!kp.addr) { | ||
415 | printk("Couldn't find %s to plant kprobe\n", "do_fork"); | ||
416 | return -1; | ||
417 | } | ||
418 | if ((ret = register_kprobe(&kp) < 0)) { | 445 | if ((ret = register_kprobe(&kp) < 0)) { |
419 | printk("register_kprobe failed, returned %d\n", ret); | 446 | printk("register_kprobe failed, returned %d\n", ret); |
420 | return -1; | 447 | return -1; |
@@ -423,12 +450,14 @@ int init_module(void) | |||
423 | return 0; | 450 | return 0; |
424 | } | 451 | } |
425 | 452 | ||
426 | void cleanup_module(void) | 453 | static void __exit kprobe_exit(void) |
427 | { | 454 | { |
428 | unregister_kprobe(&kp); | 455 | unregister_kprobe(&kp); |
429 | printk("kprobe unregistered\n"); | 456 | printk("kprobe unregistered\n"); |
430 | } | 457 | } |
431 | 458 | ||
459 | module_init(kprobe_init) | ||
460 | module_exit(kprobe_exit) | ||
432 | MODULE_LICENSE("GPL"); | 461 | MODULE_LICENSE("GPL"); |
433 | ----- cut here ----- | 462 | ----- cut here ----- |
434 | 463 | ||
@@ -463,7 +492,6 @@ the arguments of do_fork(). | |||
463 | #include <linux/fs.h> | 492 | #include <linux/fs.h> |
464 | #include <linux/uio.h> | 493 | #include <linux/uio.h> |
465 | #include <linux/kprobes.h> | 494 | #include <linux/kprobes.h> |
466 | #include <linux/kallsyms.h> | ||
467 | 495 | ||
468 | /* | 496 | /* |
469 | * Jumper probe for do_fork. | 497 | * Jumper probe for do_fork. |
@@ -485,17 +513,13 @@ long jdo_fork(unsigned long clone_flags, unsigned long stack_start, | |||
485 | } | 513 | } |
486 | 514 | ||
487 | static struct jprobe my_jprobe = { | 515 | static struct jprobe my_jprobe = { |
488 | .entry = (kprobe_opcode_t *) jdo_fork | 516 | .entry = JPROBE_ENTRY(jdo_fork) |
489 | }; | 517 | }; |
490 | 518 | ||
491 | int init_module(void) | 519 | static int __init jprobe_init(void) |
492 | { | 520 | { |
493 | int ret; | 521 | int ret; |
494 | my_jprobe.kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("do_fork"); | 522 | my_jprobe.kp.symbol_name = "do_fork"; |
495 | if (!my_jprobe.kp.addr) { | ||
496 | printk("Couldn't find %s to plant jprobe\n", "do_fork"); | ||
497 | return -1; | ||
498 | } | ||
499 | 523 | ||
500 | if ((ret = register_jprobe(&my_jprobe)) <0) { | 524 | if ((ret = register_jprobe(&my_jprobe)) <0) { |
501 | printk("register_jprobe failed, returned %d\n", ret); | 525 | printk("register_jprobe failed, returned %d\n", ret); |
@@ -506,12 +530,14 @@ int init_module(void) | |||
506 | return 0; | 530 | return 0; |
507 | } | 531 | } |
508 | 532 | ||
509 | void cleanup_module(void) | 533 | static void __exit jprobe_exit(void) |
510 | { | 534 | { |
511 | unregister_jprobe(&my_jprobe); | 535 | unregister_jprobe(&my_jprobe); |
512 | printk("jprobe unregistered\n"); | 536 | printk("jprobe unregistered\n"); |
513 | } | 537 | } |
514 | 538 | ||
539 | module_init(jprobe_init) | ||
540 | module_exit(jprobe_exit) | ||
515 | MODULE_LICENSE("GPL"); | 541 | MODULE_LICENSE("GPL"); |
516 | ----- cut here ----- | 542 | ----- cut here ----- |
517 | 543 | ||
@@ -530,16 +556,13 @@ report failed calls to sys_open(). | |||
530 | #include <linux/kernel.h> | 556 | #include <linux/kernel.h> |
531 | #include <linux/module.h> | 557 | #include <linux/module.h> |
532 | #include <linux/kprobes.h> | 558 | #include <linux/kprobes.h> |
533 | #include <linux/kallsyms.h> | ||
534 | 559 | ||
535 | static const char *probed_func = "sys_open"; | 560 | static const char *probed_func = "sys_open"; |
536 | 561 | ||
537 | /* Return-probe handler: If the probed function fails, log the return value. */ | 562 | /* Return-probe handler: If the probed function fails, log the return value. */ |
538 | static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) | 563 | static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) |
539 | { | 564 | { |
540 | // Substitute the appropriate register name for your architecture -- | 565 | int retval = regs_return_value(regs); |
541 | // e.g., regs->rax for x86_64, regs->gpr[3] for ppc64. | ||
542 | int retval = (int) regs->eax; | ||
543 | if (retval < 0) { | 566 | if (retval < 0) { |
544 | printk("%s returns %d\n", probed_func, retval); | 567 | printk("%s returns %d\n", probed_func, retval); |
545 | } | 568 | } |
@@ -552,15 +575,11 @@ static struct kretprobe my_kretprobe = { | |||
552 | .maxactive = 20 | 575 | .maxactive = 20 |
553 | }; | 576 | }; |
554 | 577 | ||
555 | int init_module(void) | 578 | static int __init kretprobe_init(void) |
556 | { | 579 | { |
557 | int ret; | 580 | int ret; |
558 | my_kretprobe.kp.addr = | 581 | my_kretprobe.kp.symbol_name = (char *)probed_func; |
559 | (kprobe_opcode_t *) kallsyms_lookup_name(probed_func); | 582 | |
560 | if (!my_kretprobe.kp.addr) { | ||
561 | printk("Couldn't find %s to plant return probe\n", probed_func); | ||
562 | return -1; | ||
563 | } | ||
564 | if ((ret = register_kretprobe(&my_kretprobe)) < 0) { | 583 | if ((ret = register_kretprobe(&my_kretprobe)) < 0) { |
565 | printk("register_kretprobe failed, returned %d\n", ret); | 584 | printk("register_kretprobe failed, returned %d\n", ret); |
566 | return -1; | 585 | return -1; |
@@ -569,7 +588,7 @@ int init_module(void) | |||
569 | return 0; | 588 | return 0; |
570 | } | 589 | } |
571 | 590 | ||
572 | void cleanup_module(void) | 591 | static void __exit kretprobe_exit(void) |
573 | { | 592 | { |
574 | unregister_kretprobe(&my_kretprobe); | 593 | unregister_kretprobe(&my_kretprobe); |
575 | printk("kretprobe unregistered\n"); | 594 | printk("kretprobe unregistered\n"); |
@@ -578,6 +597,8 @@ void cleanup_module(void) | |||
578 | my_kretprobe.nmissed, probed_func); | 597 | my_kretprobe.nmissed, probed_func); |
579 | } | 598 | } |
580 | 599 | ||
600 | module_init(kretprobe_init) | ||
601 | module_exit(kretprobe_exit) | ||
581 | MODULE_LICENSE("GPL"); | 602 | MODULE_LICENSE("GPL"); |
582 | ----- cut here ----- | 603 | ----- cut here ----- |
583 | 604 | ||
@@ -590,3 +611,5 @@ messages.) | |||
590 | For additional information on Kprobes, refer to the following URLs: | 611 | For additional information on Kprobes, refer to the following URLs: |
591 | http://www-106.ibm.com/developerworks/library/l-kprobes.html?ca=dgr-lnxw42Kprobe | 612 | http://www-106.ibm.com/developerworks/library/l-kprobes.html?ca=dgr-lnxw42Kprobe |
592 | http://www.redhat.com/magazine/005mar05/features/kprobes/ | 613 | http://www.redhat.com/magazine/005mar05/features/kprobes/ |
614 | http://www-users.cs.umn.edu/~boutcher/kprobes/ | ||
615 | http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) | ||
diff --git a/Documentation/lockdep-design.txt b/Documentation/lockdep-design.txt index 00d93605bfd3..55a7e4fa8cc2 100644 --- a/Documentation/lockdep-design.txt +++ b/Documentation/lockdep-design.txt | |||
@@ -36,6 +36,28 @@ The validator tracks lock-class usage history into 5 separate state bits: | |||
36 | 36 | ||
37 | - 'ever used' [ == !unused ] | 37 | - 'ever used' [ == !unused ] |
38 | 38 | ||
39 | When locking rules are violated, these 4 state bits are presented in the | ||
40 | locking error messages, inside curlies. A contrived example: | ||
41 | |||
42 | modprobe/2287 is trying to acquire lock: | ||
43 | (&sio_locks[i].lock){--..}, at: [<c02867fd>] mutex_lock+0x21/0x24 | ||
44 | |||
45 | but task is already holding lock: | ||
46 | (&sio_locks[i].lock){--..}, at: [<c02867fd>] mutex_lock+0x21/0x24 | ||
47 | |||
48 | |||
49 | The bit position indicates hardirq, softirq, hardirq-read, | ||
50 | softirq-read respectively, and the character displayed in each | ||
51 | indicates: | ||
52 | |||
53 | '.' acquired while irqs enabled | ||
54 | '+' acquired in irq context | ||
55 | '-' acquired in process context with irqs disabled | ||
56 | '?' read-acquired both with irqs enabled and in irq context | ||
57 | |||
58 | Unused mutexes cannot be part of the cause of an error. | ||
59 | |||
60 | |||
39 | Single-lock state rules: | 61 | Single-lock state rules: |
40 | ------------------------ | 62 | ------------------------ |
41 | 63 | ||
diff --git a/Documentation/netlabel/00-INDEX b/Documentation/netlabel/00-INDEX new file mode 100644 index 000000000000..837bf35990e2 --- /dev/null +++ b/Documentation/netlabel/00-INDEX | |||
@@ -0,0 +1,10 @@ | |||
1 | 00-INDEX | ||
2 | - this file. | ||
3 | cipso_ipv4.txt | ||
4 | - documentation on the IPv4 CIPSO protocol engine. | ||
5 | draft-ietf-cipso-ipsecurity-01.txt | ||
6 | - IETF draft of the CIPSO protocol, dated 16 July 1992. | ||
7 | introduction.txt | ||
8 | - NetLabel introduction, READ THIS FIRST. | ||
9 | lsm_interface.txt | ||
10 | - documentation on the NetLabel kernel security module API. | ||
diff --git a/Documentation/netlabel/cipso_ipv4.txt b/Documentation/netlabel/cipso_ipv4.txt new file mode 100644 index 000000000000..93dacb132c3c --- /dev/null +++ b/Documentation/netlabel/cipso_ipv4.txt | |||
@@ -0,0 +1,48 @@ | |||
1 | NetLabel CIPSO/IPv4 Protocol Engine | ||
2 | ============================================================================== | ||
3 | Paul Moore, paul.moore@hp.com | ||
4 | |||
5 | May 17, 2006 | ||
6 | |||
7 | * Overview | ||
8 | |||
9 | The NetLabel CIPSO/IPv4 protocol engine is based on the IETF Commercial IP | ||
10 | Security Option (CIPSO) draft from July 16, 1992. A copy of this draft can be | ||
11 | found in this directory, consult '00-INDEX' for the filename. While the IETF | ||
12 | draft never made it to an RFC standard it has become a de-facto standard for | ||
13 | labeled networking and is used in many trusted operating systems. | ||
14 | |||
15 | * Outbound Packet Processing | ||
16 | |||
17 | The CIPSO/IPv4 protocol engine applies the CIPSO IP option to packets by | ||
18 | adding the CIPSO label to the socket. This causes all packets leaving the | ||
19 | system through the socket to have the CIPSO IP option applied. The socket's | ||
20 | CIPSO label can be changed at any point in time, however, it is recommended | ||
21 | that it is set upon the socket's creation. The LSM can set the socket's CIPSO | ||
22 | label by using the NetLabel security module API; if the NetLabel "domain" is | ||
23 | configured to use CIPSO for packet labeling then a CIPSO IP option will be | ||
24 | generated and attached to the socket. | ||
25 | |||
26 | * Inbound Packet Processing | ||
27 | |||
28 | The CIPSO/IPv4 protocol engine validates every CIPSO IP option it finds at the | ||
29 | IP layer without any special handling required by the LSM. However, in order | ||
30 | to decode and translate the CIPSO label on the packet the LSM must use the | ||
31 | NetLabel security module API to extract the security attributes of the packet. | ||
32 | This is typically done at the socket layer using the 'socket_sock_rcv_skb()' | ||
33 | LSM hook. | ||
34 | |||
35 | * Label Translation | ||
36 | |||
37 | The CIPSO/IPv4 protocol engine contains a mechanism to translate CIPSO security | ||
38 | attributes such as sensitivity level and category to values which are | ||
39 | appropriate for the host. These mappings are defined as part of a CIPSO | ||
40 | Domain Of Interpretation (DOI) definition and are configured through the | ||
41 | NetLabel user space communication layer. Each DOI definition can have a | ||
42 | different security attribute mapping table. | ||
43 | |||
44 | * Label Translation Cache | ||
45 | |||
46 | The NetLabel system provides a framework for caching security attribute | ||
47 | mappings from the network labels to the corresponding LSM identifiers. The | ||
48 | CIPSO/IPv4 protocol engine supports this caching mechanism. | ||
diff --git a/Documentation/netlabel/draft-ietf-cipso-ipsecurity-01.txt b/Documentation/netlabel/draft-ietf-cipso-ipsecurity-01.txt new file mode 100644 index 000000000000..256c2c9d4f50 --- /dev/null +++ b/Documentation/netlabel/draft-ietf-cipso-ipsecurity-01.txt | |||
@@ -0,0 +1,791 @@ | |||
1 | IETF CIPSO Working Group | ||
2 | 16 July, 1992 | ||
3 | |||
4 | |||
5 | |||
6 | COMMERCIAL IP SECURITY OPTION (CIPSO 2.2) | ||
7 | |||
8 | |||
9 | |||
10 | 1. Status | ||
11 | |||
12 | This Internet Draft provides the high level specification for a Commercial | ||
13 | IP Security Option (CIPSO). This draft reflects the version as approved by | ||
14 | the CIPSO IETF Working Group. Distribution of this memo is unlimited. | ||
15 | |||
16 | This document is an Internet Draft. Internet Drafts are working documents | ||
17 | of the Internet Engineering Task Force (IETF), its Areas, and its Working | ||
18 | Groups. Note that other groups may also distribute working documents as | ||
19 | Internet Drafts. | ||
20 | |||
21 | Internet Drafts are draft documents valid for a maximum of six months. | ||
22 | Internet Drafts may be updated, replaced, or obsoleted by other documents | ||
23 | at any time. It is not appropriate to use Internet Drafts as reference | ||
24 | material or to cite them other than as a "working draft" or "work in | ||
25 | progress." | ||
26 | |||
27 | Please check the I-D abstract listing contained in each Internet Draft | ||
28 | directory to learn the current status of this or any other Internet Draft. | ||
29 | |||
30 | |||
31 | |||
32 | |||
33 | 2. Background | ||
34 | |||
35 | Currently the Internet Protocol includes two security options. One of | ||
36 | these options is the DoD Basic Security Option (BSO) (Type 130) which allows | ||
37 | IP datagrams to be labeled with security classifications. This option | ||
38 | provides sixteen security classifications and a variable number of handling | ||
39 | restrictions. To handle additional security information, such as security | ||
40 | categories or compartments, another security option (Type 133) exists and | ||
41 | is referred to as the DoD Extended Security Option (ESO). The values for | ||
42 | the fixed fields within these two options are administered by the Defense | ||
43 | Information Systems Agency (DISA). | ||
44 | |||
45 | Computer vendors are now building commercial operating systems with | ||
46 | mandatory access controls and multi-level security. These systems are | ||
47 | no longer built specifically for a particular group in the defense or | ||
48 | intelligence communities. They are generally available commercial systems | ||
49 | for use in a variety of government and civil sector environments. | ||
50 | |||
51 | The small number of ESO format codes can not support all the possible | ||
52 | applications of a commercial security option. The BSO and ESO were | ||
53 | designed to only support the United States DoD. CIPSO has been designed | ||
54 | to support multiple security policies. This Internet Draft provides the | ||
55 | format and procedures required to support a Mandatory Access Control | ||
56 | security policy. Support for additional security policies shall be | ||
57 | defined in future RFCs. | ||
58 | |||
59 | |||
60 | |||
61 | |||
62 | Internet Draft, Expires 15 Jan 93 [PAGE 1] | ||
63 | |||
64 | |||
65 | |||
66 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
67 | |||
68 | |||
69 | |||
70 | |||
71 | 3. CIPSO Format | ||
72 | |||
73 | Option type: 134 (Class 0, Number 6, Copy on Fragmentation) | ||
74 | Option length: Variable | ||
75 | |||
76 | This option permits security related information to be passed between | ||
77 | systems within a single Domain of Interpretation (DOI). A DOI is a | ||
78 | collection of systems which agree on the meaning of particular values | ||
79 | in the security option. An authority that has been assigned a DOI | ||
80 | identifier will define a mapping between appropriate CIPSO field values | ||
81 | and their human readable equivalent. This authority will distribute that | ||
82 | mapping to hosts within the authority's domain. These mappings may be | ||
83 | sensitive, therefore a DOI authority is not required to make these | ||
84 | mappings available to anyone other than the systems that are included in | ||
85 | the DOI. | ||
86 | |||
87 | This option MUST be copied on fragmentation. This option appears at most | ||
88 | once in a datagram. All multi-octet fields in the option are defined to be | ||
89 | transmitted in network byte order. The format of this option is as follows: | ||
90 | |||
91 | +----------+----------+------//------+-----------//---------+ | ||
92 | | 10000110 | LLLLLLLL | DDDDDDDDDDDD | TTTTTTTTTTTTTTTTTTTT | | ||
93 | +----------+----------+------//------+-----------//---------+ | ||
94 | |||
95 | TYPE=134 OPTION DOMAIN OF TAGS | ||
96 | LENGTH INTERPRETATION | ||
97 | |||
98 | |||
99 | Figure 1. CIPSO Format | ||
100 | |||
101 | |||
102 | 3.1 Type | ||
103 | |||
104 | This field is 1 octet in length. Its value is 134. | ||
105 | |||
106 | |||
107 | 3.2 Length | ||
108 | |||
109 | This field is 1 octet in length. It is the total length of the option | ||
110 | including the type and length fields. With the current IP header length | ||
111 | restriction of 40 octets the value of this field MUST not exceed 40. | ||
112 | |||
113 | |||
114 | 3.3 Domain of Interpretation Identifier | ||
115 | |||
116 | This field is an unsigned 32 bit integer. The value 0 is reserved and MUST | ||
117 | not appear as the DOI identifier in any CIPSO option. Implementations | ||
118 | should assume that the DOI identifier field is not aligned on any particular | ||
119 | byte boundary. | ||
120 | |||
121 | To conserve space in the protocol, security levels and categories are | ||
122 | represented by numbers rather than their ASCII equivalent. This requires | ||
123 | a mapping table within CIPSO hosts to map these numbers to their | ||
124 | corresponding ASCII representations. Non-related groups of systems may | ||
125 | |||
126 | |||
127 | |||
128 | Internet Draft, Expires 15 Jan 93 [PAGE 2] | ||
129 | |||
130 | |||
131 | |||
132 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
133 | |||
134 | |||
135 | |||
136 | have their own unique mappings. For example, one group of systems may | ||
137 | use the number 5 to represent Unclassified while another group may use the | ||
138 | number 1 to represent that same security level. The DOI identifier is used | ||
139 | to identify which mapping was used for the values within the option. | ||
140 | |||
141 | |||
142 | 3.4 Tag Types | ||
143 | |||
144 | A common format for passing security related information is necessary | ||
145 | for interoperability. CIPSO uses sets of "tags" to contain the security | ||
146 | information relevant to the data in the IP packet. Each tag begins with | ||
147 | a tag type identifier followed by the length of the tag and ends with the | ||
148 | actual security information to be passed. All multi-octet fields in a tag | ||
149 | are defined to be transmitted in network byte order. Like the DOI | ||
150 | identifier field in the CIPSO header, implementations should assume that | ||
151 | all tags, as well as fields within a tag, are not aligned on any particular | ||
152 | octet boundary. The tag types defined in this document contain alignment | ||
153 | bytes to assist alignment of some information, however alignment can not | ||
154 | be guaranteed if CIPSO is not the first IP option. | ||
155 | |||
156 | CIPSO tag types 0 through 127 are reserved for defining standard tag | ||
157 | formats. Their definitions will be published in RFCs. Tag types whose | ||
158 | identifiers are greater than 127 are defined by the DOI authority and may | ||
159 | only be meaningful in certain Domains of Interpretation. For these tag | ||
160 | types, implementations will require the DOI identifier as well as the tag | ||
161 | number to determine the security policy and the format associated with the | ||
162 | tag. Use of tag types above 127 are restricted to closed networks where | ||
163 | interoperability with other networks will not be an issue. Implementations | ||
164 | that support a tag type greater than 127 MUST support at least one DOI that | ||
165 | requires only tag types 1 to 127. | ||
166 | |||
167 | Tag type 0 is reserved. Tag types 1, 2, and 5 are defined in this | ||
168 | Internet Draft. Types 3 and 4 are reserved for work in progress. | ||
169 | The standard format for all current and future CIPSO tags is shown below: | ||
170 | |||
171 | +----------+----------+--------//--------+ | ||
172 | | TTTTTTTT | LLLLLLLL | IIIIIIIIIIIIIIII | | ||
173 | +----------+----------+--------//--------+ | ||
174 | TAG TAG TAG | ||
175 | TYPE LENGTH INFORMATION | ||
176 | |||
177 | Figure 2: Standard Tag Format | ||
178 | |||
179 | In the three tag types described in this document, the length and count | ||
180 | restrictions are based on the current IP limitation of 40 octets for all | ||
181 | IP options. If the IP header is later expanded, then the length and count | ||
182 | restrictions specified in this document may increase to use the full area | ||
183 | provided for IP options. | ||
184 | |||
185 | |||
186 | 3.4.1 Tag Type Classes | ||
187 | |||
188 | Tag classes consist of tag types that have common processing requirements | ||
189 | and support the same security policy. The three tags defined in this | ||
190 | Internet Draft belong to the Mandatory Access Control (MAC) Sensitivity | ||
191 | |||
192 | |||
193 | |||
194 | Internet Draft, Expires 15 Jan 93 [PAGE 3] | ||
195 | |||
196 | |||
197 | |||
198 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
199 | |||
200 | |||
201 | |||
202 | class and support the MAC Sensitivity security policy. | ||
203 | |||
204 | |||
205 | 3.4.2 Tag Type 1 | ||
206 | |||
207 | This is referred to as the "bit-mapped" tag type. Tag type 1 is included | ||
208 | in the MAC Sensitivity tag type class. The format of this tag type is as | ||
209 | follows: | ||
210 | |||
211 | +----------+----------+----------+----------+--------//---------+ | ||
212 | | 00000001 | LLLLLLLL | 00000000 | LLLLLLLL | CCCCCCCCCCCCCCCCC | | ||
213 | +----------+----------+----------+----------+--------//---------+ | ||
214 | |||
215 | TAG TAG ALIGNMENT SENSITIVITY BIT MAP OF | ||
216 | TYPE LENGTH OCTET LEVEL CATEGORIES | ||
217 | |||
218 | Figure 3. Tag Type 1 Format | ||
219 | |||
220 | |||
221 | 3.4.2.1 Tag Type | ||
222 | |||
223 | This field is 1 octet in length and has a value of 1. | ||
224 | |||
225 | |||
226 | 3.4.2.2 Tag Length | ||
227 | |||
228 | This field is 1 octet in length. It is the total length of the tag type | ||
229 | including the type and length fields. With the current IP header length | ||
230 | restriction of 40 bytes the value within this field is between 4 and 34. | ||
231 | |||
232 | |||
233 | 3.4.2.3 Alignment Octet | ||
234 | |||
235 | This field is 1 octet in length and always has the value of 0. Its purpose | ||
236 | is to align the category bitmap field on an even octet boundary. This will | ||
237 | speed many implementations including router implementations. | ||
238 | |||
239 | |||
240 | 3.4.2.4 Sensitivity Level | ||
241 | |||
242 | This field is 1 octet in length. Its value is from 0 to 255. The values | ||
243 | are ordered with 0 being the minimum value and 255 representing the maximum | ||
244 | value. | ||
245 | |||
246 | |||
247 | 3.4.2.5 Bit Map of Categories | ||
248 | |||
249 | The length of this field is variable and ranges from 0 to 30 octets. This | ||
250 | provides representation of categories 0 to 239. The ordering of the bits | ||
251 | is left to right or MSB to LSB. For example category 0 is represented by | ||
252 | the most significant bit of the first byte and category 15 is represented | ||
253 | by the least significant bit of the second byte. Figure 4 graphically | ||
254 | shows this ordering. Bit N is binary 1 if category N is part of the label | ||
255 | for the datagram, and bit N is binary 0 if category N is not part of the | ||
256 | label. Except for the optimized tag 1 format described in the next section, | ||
257 | |||
258 | |||
259 | |||
260 | Internet Draft, Expires 15 Jan 93 [PAGE 4] | ||
261 | |||
262 | |||
263 | |||
264 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
265 | |||
266 | |||
267 | |||
268 | minimal encoding SHOULD be used resulting in no trailing zero octets in the | ||
269 | category bitmap. | ||
270 | |||
271 | octet 0 octet 1 octet 2 octet 3 octet 4 octet 5 | ||
272 | XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX . . . | ||
273 | bit 01234567 89111111 11112222 22222233 33333333 44444444 | ||
274 | number 012345 67890123 45678901 23456789 01234567 | ||
275 | |||
276 | Figure 4. Ordering of Bits in Tag 1 Bit Map | ||
277 | |||
278 | |||
279 | 3.4.2.6 Optimized Tag 1 Format | ||
280 | |||
281 | Routers work most efficiently when processing fixed length fields. To | ||
282 | support these routers there is an optimized form of tag type 1. The format | ||
283 | does not change. The only change is to the category bitmap which is set to | ||
284 | a constant length of 10 octets. Trailing octets required to fill out the 10 | ||
285 | octets are zero filled. Ten octets, allowing for 80 categories, was chosen | ||
286 | because it makes the total length of the CIPSO option 20 octets. If CIPSO | ||
287 | is the only option then the option will be full word aligned and additional | ||
288 | filler octets will not be required. | ||
289 | |||
290 | |||
291 | 3.4.3 Tag Type 2 | ||
292 | |||
293 | This is referred to as the "enumerated" tag type. It is used to describe | ||
294 | large but sparsely populated sets of categories. Tag type 2 is in the MAC | ||
295 | Sensitivity tag type class. The format of this tag type is as follows: | ||
296 | |||
297 | +----------+----------+----------+----------+-------------//-------------+ | ||
298 | | 00000010 | LLLLLLLL | 00000000 | LLLLLLLL | CCCCCCCCCCCCCCCCCCCCCCCCCC | | ||
299 | +----------+----------+----------+----------+-------------//-------------+ | ||
300 | |||
301 | TAG TAG ALIGNMENT SENSITIVITY ENUMERATED | ||
302 | TYPE LENGTH OCTET LEVEL CATEGORIES | ||
303 | |||
304 | Figure 5. Tag Type 2 Format | ||
305 | |||
306 | |||
307 | 3.4.3.1 Tag Type | ||
308 | |||
309 | This field is one octet in length and has a value of 2. | ||
310 | |||
311 | |||
312 | 3.4.3.2 Tag Length | ||
313 | |||
314 | This field is 1 octet in length. It is the total length of the tag type | ||
315 | including the type and length fields. With the current IP header length | ||
316 | restriction of 40 bytes the value within this field is between 4 and 34. | ||
317 | |||
318 | |||
319 | 3.4.3.3 Alignment Octet | ||
320 | |||
321 | This field is 1 octet in length and always has the value of 0. Its purpose | ||
322 | is to align the category field on an even octet boundary. This will | ||
323 | |||
324 | |||
325 | |||
326 | Internet Draft, Expires 15 Jan 93 [PAGE 5] | ||
327 | |||
328 | |||
329 | |||
330 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
331 | |||
332 | |||
333 | |||
334 | speed many implementations including router implementations. | ||
335 | |||
336 | |||
337 | 3.4.3.4 Sensitivity Level | ||
338 | |||
339 | This field is 1 octet in length. Its value is from 0 to 255. The values | ||
340 | are ordered with 0 being the minimum value and 255 representing the | ||
341 | maximum value. | ||
342 | |||
343 | |||
344 | 3.4.3.5 Enumerated Categories | ||
345 | |||
346 | In this tag, categories are represented by their actual value rather than | ||
347 | by their position within a bit field. The length of each category is 2 | ||
348 | octets. Up to 15 categories may be represented by this tag. Valid values | ||
349 | for categories are 0 to 65534. Category 65535 is not a valid category | ||
350 | value. The categories MUST be listed in ascending order within the tag. | ||
351 | |||
352 | |||
353 | 3.4.4 Tag Type 5 | ||
354 | |||
355 | This is referred to as the "range" tag type. It is used to represent | ||
356 | labels where all categories in a range, or set of ranges, are included | ||
357 | in the sensitivity label. Tag type 5 is in the MAC Sensitivity tag type | ||
358 | class. The format of this tag type is as follows: | ||
359 | |||
360 | +----------+----------+----------+----------+------------//-------------+ | ||
361 | | 00000101 | LLLLLLLL | 00000000 | LLLLLLLL | Top/Bottom | Top/Bottom | | ||
362 | +----------+----------+----------+----------+------------//-------------+ | ||
363 | |||
364 | TAG TAG ALIGNMENT SENSITIVITY CATEGORY RANGES | ||
365 | TYPE LENGTH OCTET LEVEL | ||
366 | |||
367 | Figure 6. Tag Type 5 Format | ||
368 | |||
369 | |||
370 | 3.4.4.1 Tag Type | ||
371 | |||
372 | This field is one octet in length and has a value of 5. | ||
373 | |||
374 | |||
375 | 3.4.4.2 Tag Length | ||
376 | |||
377 | This field is 1 octet in length. It is the total length of the tag type | ||
378 | including the type and length fields. With the current IP header length | ||
379 | restriction of 40 bytes the value within this field is between 4 and 34. | ||
380 | |||
381 | |||
382 | 3.4.4.3 Alignment Octet | ||
383 | |||
384 | This field is 1 octet in length and always has the value of 0. Its purpose | ||
385 | is to align the category range field on an even octet boundary. This will | ||
386 | speed many implementations including router implementations. | ||
387 | |||
388 | |||
389 | |||
390 | |||
391 | |||
392 | Internet Draft, Expires 15 Jan 93 [PAGE 6] | ||
393 | |||
394 | |||
395 | |||
396 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
397 | |||
398 | |||
399 | |||
400 | 3.4.4.4 Sensitivity Level | ||
401 | |||
402 | This field is 1 octet in length. Its value is from 0 to 255. The values | ||
403 | are ordered with 0 being the minimum value and 255 representing the maximum | ||
404 | value. | ||
405 | |||
406 | |||
407 | 3.4.4.5 Category Ranges | ||
408 | |||
409 | A category range is a 4 octet field comprised of the 2 octet index of the | ||
410 | highest numbered category followed by the 2 octet index of the lowest | ||
411 | numbered category. These range endpoints are inclusive within the range of | ||
412 | categories. All categories within a range are included in the sensitivity | ||
413 | label. This tag may contain a maximum of 7 category pairs. The bottom | ||
414 | category endpoint for the last pair in the tag MAY be omitted and SHOULD be | ||
415 | assumed to be 0. The ranges MUST be non-overlapping and be listed in | ||
416 | descending order. Valid values for categories are 0 to 65534. Category | ||
417 | 65535 is not a valid category value. | ||
418 | |||
419 | |||
420 | 3.4.5 Minimum Requirements | ||
421 | |||
422 | A CIPSO implementation MUST be capable of generating at least tag type 1 in | ||
423 | the non-optimized form. In addition, a CIPSO implementation MUST be able | ||
424 | to receive any valid tag type 1 even those using the optimized tag type 1 | ||
425 | format. | ||
426 | |||
427 | |||
428 | 4. Configuration Parameters | ||
429 | |||
430 | The configuration parameters defined below are required for all CIPSO hosts, | ||
431 | gateways, and routers that support multiple sensitivity labels. A CIPSO | ||
432 | host is defined to be the origination or destination system for an IP | ||
433 | datagram. A CIPSO gateway provides IP routing services between two or more | ||
434 | IP networks and may be required to perform label translations between | ||
435 | networks. A CIPSO gateway may be an enhanced CIPSO host or it may just | ||
436 | provide gateway services with no end system CIPSO capabilities. A CIPSO | ||
437 | router is a dedicated IP router that routes IP datagrams between two or more | ||
438 | IP networks. | ||
439 | |||
440 | An implementation of CIPSO on a host MUST have the capability to reject a | ||
441 | datagram for reasons that the information contained can not be adequately | ||
442 | protected by the receiving host or if acceptance may result in violation of | ||
443 | the host or network security policy. In addition, a CIPSO gateway or router | ||
444 | MUST be able to reject datagrams going to networks that can not provide | ||
445 | adequate protection or may violate the network's security policy. To | ||
446 | provide this capability the following minimal set of configuration | ||
447 | parameters are required for CIPSO implementations: | ||
448 | |||
449 | HOST_LABEL_MAX - This parameter contains the maximum sensitivity label that | ||
450 | a CIPSO host is authorized to handle. All datagrams that have a label | ||
451 | greater than this maximum MUST be rejected by the CIPSO host. This | ||
452 | parameter does not apply to CIPSO gateways or routers. This parameter need | ||
453 | not be defined explicitly as it can be implicitly derived from the | ||
454 | PORT_LABEL_MAX parameters for the associated interfaces. | ||
455 | |||
456 | |||
457 | |||
458 | Internet Draft, Expires 15 Jan 93 [PAGE 7] | ||
459 | |||
460 | |||
461 | |||
462 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
463 | |||
464 | |||
465 | |||
466 | |||
467 | HOST_LABEL_MIN - This parameter contains the minimum sensitivity label that | ||
468 | a CIPSO host is authorized to handle. All datagrams that have a label less | ||
469 | than this minimum MUST be rejected by the CIPSO host. This parameter does | ||
470 | not apply to CIPSO gateways or routers. This parameter need not be defined | ||
471 | explicitly as it can be implicitly derived from the PORT_LABEL_MIN | ||
472 | parameters for the associated interfaces. | ||
473 | |||
474 | PORT_LABEL_MAX - This parameter contains the maximum sensitivity label for | ||
475 | all datagrams that may exit a particular network interface port. All | ||
476 | outgoing datagrams that have a label greater than this maximum MUST be | ||
477 | rejected by the CIPSO system. The label within this parameter MUST be | ||
478 | less than or equal to the label within the HOST_LABEL_MAX parameter. This | ||
479 | parameter does not apply to CIPSO hosts that support only one network port. | ||
480 | |||
481 | PORT_LABEL_MIN - This parameter contains the minimum sensitivity label for | ||
482 | all datagrams that may exit a particular network interface port. All | ||
483 | outgoing datagrams that have a label less than this minimum MUST be | ||
484 | rejected by the CIPSO system. The label within this parameter MUST be | ||
485 | greater than or equal to the label within the HOST_LABEL_MIN parameter. | ||
486 | This parameter does not apply to CIPSO hosts that support only one network | ||
487 | port. | ||
488 | |||
489 | PORT_DOI - This parameter is used to assign a DOI identifier value to a | ||
490 | particular network interface port. All CIPSO labels within datagrams | ||
491 | going out this port MUST use the specified DOI identifier. All CIPSO | ||
492 | hosts and gateways MUST support either this parameter, the NET_DOI | ||
493 | parameter, or the HOST_DOI parameter. | ||
494 | |||
495 | NET_DOI - This parameter is used to assign a DOI identifier value to a | ||
496 | particular IP network address. All CIPSO labels within datagrams destined | ||
497 | for the particular IP network MUST use the specified DOI identifier. All | ||
498 | CIPSO hosts and gateways MUST support either this parameter, the PORT_DOI | ||
499 | parameter, or the HOST_DOI parameter. | ||
500 | |||
501 | HOST_DOI - This parameter is used to assign a DOI identifier value to a | ||
502 | particular IP host address. All CIPSO labels within datagrams destined for | ||
503 | the particular IP host will use the specified DOI identifier. All CIPSO | ||
504 | hosts and gateways MUST support either this parameter, the PORT_DOI | ||
505 | parameter, or the NET_DOI parameter. | ||
506 | |||
507 | This list represents the minimal set of configuration parameters required | ||
508 | to be compliant. Implementors are encouraged to add to this list to | ||
509 | provide enhanced functionality and control. For example, many security | ||
510 | policies may require both incoming and outgoing datagrams be checked against | ||
511 | the port and host label ranges. | ||
512 | |||
513 | |||
514 | 4.1 Port Range Parameters | ||
515 | |||
516 | The labels represented by the PORT_LABEL_MAX and PORT_LABEL_MIN parameters | ||
517 | MAY be in CIPSO or local format. Some CIPSO systems, such as routers, may | ||
518 | want to have the range parameters expressed in CIPSO format so that incoming | ||
519 | labels do not have to be converted to a local format before being compared | ||
520 | against the range. If multiple DOIs are supported by one of these CIPSO | ||
521 | |||
522 | |||
523 | |||
524 | Internet Draft, Expires 15 Jan 93 [PAGE 8] | ||
525 | |||
526 | |||
527 | |||
528 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
529 | |||
530 | |||
531 | |||
532 | systems then multiple port range parameters would be needed, one set for | ||
533 | each DOI supported on a particular port. | ||
534 | |||
535 | The port range will usually represent the total set of labels that may | ||
536 | exist on the logical network accessed through the corresponding network | ||
537 | interface. It may, however, represent a subset of these labels that are | ||
538 | allowed to enter the CIPSO system. | ||
539 | |||
540 | |||
541 | 4.2 Single Label CIPSO Hosts | ||
542 | |||
543 | CIPSO implementations that support only one label are not required to | ||
544 | support the parameters described above. These limited implementations are | ||
545 | only required to support a NET_LABEL parameter. This parameter contains | ||
546 | the CIPSO label that may be inserted in datagrams that exit the host. In | ||
547 | addition, the host MUST reject any incoming datagram that has a label which | ||
548 | is not equivalent to the NET_LABEL parameter. | ||
549 | |||
550 | |||
551 | 5. Handling Procedures | ||
552 | |||
553 | This section describes the processing requirements for incoming and | ||
554 | outgoing IP datagrams. Just providing the correct CIPSO label format | ||
555 | is not enough. Assumptions will be made by one system on how a | ||
556 | receiving system will handle the CIPSO label. Wrong assumptions may | ||
557 | lead to non-interoperability or even a security incident. The | ||
558 | requirements described below represent the minimal set needed for | ||
559 | interoperability and that provide users some level of confidence. | ||
560 | Many other requirements could be added to increase user confidence, | ||
561 | however at the risk of restricting creativity and limiting vendor | ||
562 | participation. | ||
563 | |||
564 | |||
565 | 5.1 Input Procedures | ||
566 | |||
567 | All datagrams received through a network port MUST have a security label | ||
568 | associated with them, either contained in the datagram or assigned to the | ||
569 | receiving port. Without this label the host, gateway, or router will not | ||
570 | have the information it needs to make security decisions. This security | ||
571 | label will be obtained from the CIPSO if the option is present in the | ||
572 | datagram. See section 4.1.2 for handling procedures for unlabeled | ||
573 | datagrams. This label will be compared against the PORT (if appropriate) | ||
574 | and HOST configuration parameters defined in section 3. | ||
575 | |||
576 | If any field within the CIPSO option, such as the DOI identifier, is not | ||
577 | recognized the IP datagram is discarded and an ICMP "parameter problem" | ||
578 | (type 12) is generated and returned. The ICMP code field is set to "bad | ||
579 | parameter" (code 0) and the pointer is set to the start of the CIPSO field | ||
580 | that is unrecognized. | ||
581 | |||
582 | If the contents of the CIPSO are valid but the security label is | ||
583 | outside of the configured host or port label range, the datagram is | ||
584 | discarded and an ICMP "destination unreachable" (type 3) is generated | ||
585 | and returned. The code field of the ICMP is set to "communication with | ||
586 | destination network administratively prohibited" (code 9) or to | ||
587 | |||
588 | |||
589 | |||
590 | Internet Draft, Expires 15 Jan 93 [PAGE 9] | ||
591 | |||
592 | |||
593 | |||
594 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
595 | |||
596 | |||
597 | |||
598 | "communication with destination host administratively prohibited" | ||
599 | (code 10). The value of the code field used is dependent upon whether | ||
600 | the originator of the ICMP message is acting as a CIPSO host or a CIPSO | ||
601 | gateway. The recipient of the ICMP message MUST be able to handle either | ||
602 | value. The same procedure is performed if a CIPSO can not be added to an | ||
603 | IP packet because it is too large to fit in the IP options area. | ||
604 | |||
605 | If the error is triggered by receipt of an ICMP message, the message | ||
606 | is discarded and no response is permitted (consistent with general ICMP | ||
607 | processing rules). | ||
608 | |||
609 | |||
610 | 5.1.1 Unrecognized tag types | ||
611 | |||
612 | The default condition for any CIPSO implementation is that an | ||
613 | unrecognized tag type MUST be treated as a "parameter problem" and | ||
614 | handled as described in section 4.1. A CIPSO implementation MAY allow | ||
615 | the system administrator to identify tag types that may safely be | ||
616 | ignored. This capability is an allowable enhancement, not a | ||
617 | requirement. | ||
618 | |||
619 | |||
620 | 5.1.2 Unlabeled Packets | ||
621 | |||
622 | A network port may be configured to not require a CIPSO label for all | ||
623 | incoming datagrams. For this configuration a CIPSO label must be | ||
624 | assigned to that network port and associated with all unlabeled IP | ||
625 | datagrams. This capability might be used for single level networks or | ||
626 | networks that have CIPSO and non-CIPSO hosts and the non-CIPSO hosts | ||
627 | all operate at the same label. | ||
628 | |||
629 | If a CIPSO option is required and none is found, the datagram is | ||
630 | discarded and an ICMP "parameter problem" (type 12) is generated and | ||
631 | returned to the originator of the datagram. The code field of the ICMP | ||
632 | is set to "option missing" (code 1) and the ICMP pointer is set to 134 | ||
633 | (the value of the option type for the missing CIPSO option). | ||
634 | |||
635 | |||
636 | 5.2 Output Procedures | ||
637 | |||
638 | A CIPSO option MUST appear only once in a datagram. Only one tag type | ||
639 | from the MAC Sensitivity class MAY be included in a CIPSO option. Given | ||
640 | the current set of defined tag types, this means that CIPSO labels at | ||
641 | first will contain only one tag. | ||
642 | |||
643 | All datagrams leaving a CIPSO system MUST meet the following condition: | ||
644 | |||
645 | PORT_LABEL_MIN <= CIPSO label <= PORT_LABEL_MAX | ||
646 | |||
647 | If this condition is not satisfied the datagram MUST be discarded. | ||
648 | If the CIPSO system only supports one port, the HOST_LABEL_MIN and the | ||
649 | HOST_LABEL_MAX parameters MAY be substituted for the PORT parameters in | ||
650 | the above condition. | ||
651 | |||
652 | The DOI identifier to be used for all outgoing datagrams is configured by | ||
653 | |||
654 | |||
655 | |||
656 | Internet Draft, Expires 15 Jan 93 [PAGE 10] | ||
657 | |||
658 | |||
659 | |||
660 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
661 | |||
662 | |||
663 | |||
664 | the administrator. If port level DOI identifier assignment is used, then | ||
665 | the PORT_DOI configuration parameter MUST contain the DOI identifier to | ||
666 | use. If network level DOI assignment is used, then the NET_DOI parameter | ||
667 | MUST contain the DOI identifier to use. And if host level DOI assignment | ||
668 | is employed, then the HOST_DOI parameter MUST contain the DOI identifier | ||
669 | to use. A CIPSO implementation need only support one level of DOI | ||
670 | assignment. | ||
671 | |||
672 | |||
673 | 5.3 DOI Processing Requirements | ||
674 | |||
675 | A CIPSO implementation MUST support at least one DOI and SHOULD support | ||
676 | multiple DOIs. System and network administrators are cautioned to | ||
677 | ensure that at least one DOI is common within an IP network to allow for | ||
678 | broadcasting of IP datagrams. | ||
679 | |||
680 | CIPSO gateways MUST be capable of translating a CIPSO option from one | ||
681 | DOI to another when forwarding datagrams between networks. For | ||
682 | efficiency purposes this capability is only a desired feature for CIPSO | ||
683 | routers. | ||
684 | |||
685 | |||
686 | 5.4 Label of ICMP Messages | ||
687 | |||
688 | The CIPSO label to be used on all outgoing ICMP messages MUST be equivalent | ||
689 | to the label of the datagram that caused the ICMP message. If the ICMP was | ||
690 | generated due to a problem associated with the original CIPSO label then the | ||
691 | following responses are allowed: | ||
692 | |||
693 | a. Use the CIPSO label of the original IP datagram | ||
694 | b. Drop the original datagram with no return message generated | ||
695 | |||
696 | In most cases these options will have the same effect. If you can not | ||
697 | interpret the label or if it is outside the label range of your host or | ||
698 | interface then an ICMP message with the same label will probably not be | ||
699 | able to exit the system. | ||
700 | |||
701 | |||
702 | 6. Assignment of DOI Identifier Numbers = | ||
703 | |||
704 | Requests for assignment of a DOI identifier number should be addressed to | ||
705 | the Internet Assigned Numbers Authority (IANA). | ||
706 | |||
707 | |||
708 | 7. Acknowledgements | ||
709 | |||
710 | Much of the material in this RFC is based on (and copied from) work | ||
711 | done by Gary Winiger of Sun Microsystems and published as Commercial | ||
712 | IP Security Option at the INTEROP 89, Commercial IPSO Workshop. | ||
713 | |||
714 | |||
715 | 8. Author's Address | ||
716 | |||
717 | To submit mail for distribution to members of the IETF CIPSO Working | ||
718 | Group, send mail to: cipso@wdl1.wdl.loral.com. | ||
719 | |||
720 | |||
721 | |||
722 | Internet Draft, Expires 15 Jan 93 [PAGE 11] | ||
723 | |||
724 | |||
725 | |||
726 | CIPSO INTERNET DRAFT 16 July, 1992 | ||
727 | |||
728 | |||
729 | |||
730 | |||
731 | To be added to or deleted from this distribution, send mail to: | ||
732 | cipso-request@wdl1.wdl.loral.com. | ||
733 | |||
734 | |||
735 | 9. References | ||
736 | |||
737 | RFC 1038, "Draft Revised IP Security Option", M. St. Johns, IETF, January | ||
738 | 1988. | ||
739 | |||
740 | RFC 1108, "U.S. Department of Defense Security Options | ||
741 | for the Internet Protocol", Stephen Kent, IAB, 1 March, 1991. | ||
742 | |||
743 | |||
744 | |||
745 | |||
746 | |||
747 | |||
748 | |||
749 | |||
750 | |||
751 | |||
752 | |||
753 | |||
754 | |||
755 | |||
756 | |||
757 | |||
758 | |||
759 | |||
760 | |||
761 | |||
762 | |||
763 | |||
764 | |||
765 | |||
766 | |||
767 | |||
768 | |||
769 | |||
770 | |||
771 | |||
772 | |||
773 | |||
774 | |||
775 | |||
776 | |||
777 | |||
778 | |||
779 | |||
780 | |||
781 | |||
782 | |||
783 | |||
784 | |||
785 | |||
786 | |||
787 | |||
788 | Internet Draft, Expires 15 Jan 93 [PAGE 12] | ||
789 | |||
790 | |||
791 | |||
diff --git a/Documentation/netlabel/introduction.txt b/Documentation/netlabel/introduction.txt new file mode 100644 index 000000000000..a4ffba1694c8 --- /dev/null +++ b/Documentation/netlabel/introduction.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | NetLabel Introduction | ||
2 | ============================================================================== | ||
3 | Paul Moore, paul.moore@hp.com | ||
4 | |||
5 | August 2, 2006 | ||
6 | |||
7 | * Overview | ||
8 | |||
9 | NetLabel is a mechanism which can be used by kernel security modules to attach | ||
10 | security attributes to outgoing network packets generated from user space | ||
11 | applications and read security attributes from incoming network packets. It | ||
12 | is composed of three main components, the protocol engines, the communication | ||
13 | layer, and the kernel security module API. | ||
14 | |||
15 | * Protocol Engines | ||
16 | |||
17 | The protocol engines are responsible for both applying and retrieving the | ||
18 | network packet's security attributes. If any translation between the network | ||
19 | security attributes and those on the host are required then the protocol | ||
20 | engine will handle those tasks as well. Other kernel subsystems should | ||
21 | refrain from calling the protocol engines directly, instead they should use | ||
22 | the NetLabel kernel security module API described below. | ||
23 | |||
24 | Detailed information about each NetLabel protocol engine can be found in this | ||
25 | directory, consult '00-INDEX' for filenames. | ||
26 | |||
27 | * Communication Layer | ||
28 | |||
29 | The communication layer exists to allow NetLabel configuration and monitoring | ||
30 | from user space. The NetLabel communication layer uses a message based | ||
31 | protocol built on top of the Generic NETLINK transport mechanism. The exact | ||
32 | formatting of these NetLabel messages as well as the Generic NETLINK family | ||
33 | names can be found in the the 'net/netlabel/' directory as comments in the | ||
34 | header files as well as in 'include/net/netlabel.h'. | ||
35 | |||
36 | * Security Module API | ||
37 | |||
38 | The purpose of the NetLabel security module API is to provide a protocol | ||
39 | independent interface to the underlying NetLabel protocol engines. In addition | ||
40 | to protocol independence, the security module API is designed to be completely | ||
41 | LSM independent which should allow multiple LSMs to leverage the same code | ||
42 | base. | ||
43 | |||
44 | Detailed information about the NetLabel security module API can be found in the | ||
45 | 'include/net/netlabel.h' header file as well as the 'lsm_interface.txt' file | ||
46 | found in this directory. | ||
diff --git a/Documentation/netlabel/lsm_interface.txt b/Documentation/netlabel/lsm_interface.txt new file mode 100644 index 000000000000..98dd9f7430f2 --- /dev/null +++ b/Documentation/netlabel/lsm_interface.txt | |||
@@ -0,0 +1,47 @@ | |||
1 | NetLabel Linux Security Module Interface | ||
2 | ============================================================================== | ||
3 | Paul Moore, paul.moore@hp.com | ||
4 | |||
5 | May 17, 2006 | ||
6 | |||
7 | * Overview | ||
8 | |||
9 | NetLabel is a mechanism which can set and retrieve security attributes from | ||
10 | network packets. It is intended to be used by LSM developers who want to make | ||
11 | use of a common code base for several different packet labeling protocols. | ||
12 | The NetLabel security module API is defined in 'include/net/netlabel.h' but a | ||
13 | brief overview is given below. | ||
14 | |||
15 | * NetLabel Security Attributes | ||
16 | |||
17 | Since NetLabel supports multiple different packet labeling protocols and LSMs | ||
18 | it uses the concept of security attributes to refer to the packet's security | ||
19 | labels. The NetLabel security attributes are defined by the | ||
20 | 'netlbl_lsm_secattr' structure in the NetLabel header file. Internally the | ||
21 | NetLabel subsystem converts the security attributes to and from the correct | ||
22 | low-level packet label depending on the NetLabel build time and run time | ||
23 | configuration. It is up to the LSM developer to translate the NetLabel | ||
24 | security attributes into whatever security identifiers are in use for their | ||
25 | particular LSM. | ||
26 | |||
27 | * NetLabel LSM Protocol Operations | ||
28 | |||
29 | These are the functions which allow the LSM developer to manipulate the labels | ||
30 | on outgoing packets as well as read the labels on incoming packets. Functions | ||
31 | exist to operate both on sockets as well as the sk_buffs directly. These high | ||
32 | level functions are translated into low level protocol operations based on how | ||
33 | the administrator has configured the NetLabel subsystem. | ||
34 | |||
35 | * NetLabel Label Mapping Cache Operations | ||
36 | |||
37 | Depending on the exact configuration, translation between the network packet | ||
38 | label and the internal LSM security identifier can be time consuming. The | ||
39 | NetLabel label mapping cache is a caching mechanism which can be used to | ||
40 | sidestep much of this overhead once a mapping has been established. Once the | ||
41 | LSM has received a packet, used NetLabel to decode it's security attributes, | ||
42 | and translated the security attributes into a LSM internal identifier the LSM | ||
43 | can use the NetLabel caching functions to associate the LSM internal | ||
44 | identifier with the network packet's label. This means that in the future | ||
45 | when a incoming packet matches a cached value not only are the internal | ||
46 | NetLabel translation mechanisms bypassed but the LSM translation mechanisms are | ||
47 | bypassed as well which should result in a significant reduction in overhead. | ||
diff --git a/Documentation/networking/LICENSE.qla3xxx b/Documentation/networking/LICENSE.qla3xxx new file mode 100644 index 000000000000..2f2077e34d81 --- /dev/null +++ b/Documentation/networking/LICENSE.qla3xxx | |||
@@ -0,0 +1,46 @@ | |||
1 | Copyright (c) 2003-2006 QLogic Corporation | ||
2 | QLogic Linux Networking HBA Driver | ||
3 | |||
4 | This program includes a device driver for Linux 2.6 that may be | ||
5 | distributed with QLogic hardware specific firmware binary file. | ||
6 | You may modify and redistribute the device driver code under the | ||
7 | GNU General Public License as published by the Free Software | ||
8 | Foundation (version 2 or a later version). | ||
9 | |||
10 | You may redistribute the hardware specific firmware binary file | ||
11 | under the following terms: | ||
12 | |||
13 | 1. Redistribution of source code (only if applicable), | ||
14 | must retain the above copyright notice, this list of | ||
15 | conditions and the following disclaimer. | ||
16 | |||
17 | 2. Redistribution in binary form must reproduce the above | ||
18 | copyright notice, this list of conditions and the | ||
19 | following disclaimer in the documentation and/or other | ||
20 | materials provided with the distribution. | ||
21 | |||
22 | 3. The name of QLogic Corporation may not be used to | ||
23 | endorse or promote products derived from this software | ||
24 | without specific prior written permission | ||
25 | |||
26 | REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE, | ||
27 | THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY | ||
28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
30 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR | ||
31 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
32 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
33 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
35 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
36 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
37 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
38 | POSSIBILITY OF SUCH DAMAGE. | ||
39 | |||
40 | USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT | ||
41 | CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR | ||
42 | OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT, | ||
43 | TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN | ||
44 | ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN | ||
45 | COMBINATION WITH THIS PROGRAM. | ||
46 | |||
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index afac780445cd..dc942eaf490f 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -192,6 +192,17 @@ or, for backwards compatibility, the option value. E.g., | |||
192 | arp_interval | 192 | arp_interval |
193 | 193 | ||
194 | Specifies the ARP link monitoring frequency in milliseconds. | 194 | Specifies the ARP link monitoring frequency in milliseconds. |
195 | |||
196 | The ARP monitor works by periodically checking the slave | ||
197 | devices to determine whether they have sent or received | ||
198 | traffic recently (the precise criteria depends upon the | ||
199 | bonding mode, and the state of the slave). Regular traffic is | ||
200 | generated via ARP probes issued for the addresses specified by | ||
201 | the arp_ip_target option. | ||
202 | |||
203 | This behavior can be modified by the arp_validate option, | ||
204 | below. | ||
205 | |||
195 | If ARP monitoring is used in an etherchannel compatible mode | 206 | If ARP monitoring is used in an etherchannel compatible mode |
196 | (modes 0 and 2), the switch should be configured in a mode | 207 | (modes 0 and 2), the switch should be configured in a mode |
197 | that evenly distributes packets across all links. If the | 208 | that evenly distributes packets across all links. If the |
@@ -213,6 +224,54 @@ arp_ip_target | |||
213 | maximum number of targets that can be specified is 16. The | 224 | maximum number of targets that can be specified is 16. The |
214 | default value is no IP addresses. | 225 | default value is no IP addresses. |
215 | 226 | ||
227 | arp_validate | ||
228 | |||
229 | Specifies whether or not ARP probes and replies should be | ||
230 | validated in the active-backup mode. This causes the ARP | ||
231 | monitor to examine the incoming ARP requests and replies, and | ||
232 | only consider a slave to be up if it is receiving the | ||
233 | appropriate ARP traffic. | ||
234 | |||
235 | Possible values are: | ||
236 | |||
237 | none or 0 | ||
238 | |||
239 | No validation is performed. This is the default. | ||
240 | |||
241 | active or 1 | ||
242 | |||
243 | Validation is performed only for the active slave. | ||
244 | |||
245 | backup or 2 | ||
246 | |||
247 | Validation is performed only for backup slaves. | ||
248 | |||
249 | all or 3 | ||
250 | |||
251 | Validation is performed for all slaves. | ||
252 | |||
253 | For the active slave, the validation checks ARP replies to | ||
254 | confirm that they were generated by an arp_ip_target. Since | ||
255 | backup slaves do not typically receive these replies, the | ||
256 | validation performed for backup slaves is on the ARP request | ||
257 | sent out via the active slave. It is possible that some | ||
258 | switch or network configurations may result in situations | ||
259 | wherein the backup slaves do not receive the ARP requests; in | ||
260 | such a situation, validation of backup slaves must be | ||
261 | disabled. | ||
262 | |||
263 | This option is useful in network configurations in which | ||
264 | multiple bonding hosts are concurrently issuing ARPs to one or | ||
265 | more targets beyond a common switch. Should the link between | ||
266 | the switch and target fail (but not the switch itself), the | ||
267 | probe traffic generated by the multiple bonding instances will | ||
268 | fool the standard ARP monitor into considering the links as | ||
269 | still up. Use of the arp_validate option can resolve this, as | ||
270 | the ARP monitor will only consider ARP requests and replies | ||
271 | associated with its own instance of bonding. | ||
272 | |||
273 | This option was added in bonding version 3.1.0. | ||
274 | |||
216 | downdelay | 275 | downdelay |
217 | 276 | ||
218 | Specifies the time, in milliseconds, to wait before disabling | 277 | Specifies the time, in milliseconds, to wait before disabling |
diff --git a/Documentation/networking/dccp.txt b/Documentation/networking/dccp.txt index c45daabd3bfe..74563b38ffd9 100644 --- a/Documentation/networking/dccp.txt +++ b/Documentation/networking/dccp.txt | |||
@@ -1,7 +1,6 @@ | |||
1 | DCCP protocol | 1 | DCCP protocol |
2 | ============ | 2 | ============ |
3 | 3 | ||
4 | Last updated: 10 November 2005 | ||
5 | 4 | ||
6 | Contents | 5 | Contents |
7 | ======== | 6 | ======== |
@@ -42,8 +41,11 @@ Socket options | |||
42 | DCCP_SOCKOPT_PACKET_SIZE is used for CCID3 to set default packet size for | 41 | DCCP_SOCKOPT_PACKET_SIZE is used for CCID3 to set default packet size for |
43 | calculations. | 42 | calculations. |
44 | 43 | ||
45 | DCCP_SOCKOPT_SERVICE sets the service. This is compulsory as per the | 44 | DCCP_SOCKOPT_SERVICE sets the service. The specification mandates use of |
46 | specification. If you don't set it you will get EPROTO. | 45 | service codes (RFC 4340, sec. 8.1.2); if this socket option is not set, |
46 | the socket will fall back to 0 (which means that no meaningful service code | ||
47 | is present). Connecting sockets set at most one service option; for | ||
48 | listening sockets, multiple service codes can be specified. | ||
47 | 49 | ||
48 | Notes | 50 | Notes |
49 | ===== | 51 | ===== |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 90ed78110fd4..935e298f674a 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -375,6 +375,41 @@ tcp_slow_start_after_idle - BOOLEAN | |||
375 | be timed out after an idle period. | 375 | be timed out after an idle period. |
376 | Default: 1 | 376 | Default: 1 |
377 | 377 | ||
378 | CIPSOv4 Variables: | ||
379 | |||
380 | cipso_cache_enable - BOOLEAN | ||
381 | If set, enable additions to and lookups from the CIPSO label mapping | ||
382 | cache. If unset, additions are ignored and lookups always result in a | ||
383 | miss. However, regardless of the setting the cache is still | ||
384 | invalidated when required when means you can safely toggle this on and | ||
385 | off and the cache will always be "safe". | ||
386 | Default: 1 | ||
387 | |||
388 | cipso_cache_bucket_size - INTEGER | ||
389 | The CIPSO label cache consists of a fixed size hash table with each | ||
390 | hash bucket containing a number of cache entries. This variable limits | ||
391 | the number of entries in each hash bucket; the larger the value the | ||
392 | more CIPSO label mappings that can be cached. When the number of | ||
393 | entries in a given hash bucket reaches this limit adding new entries | ||
394 | causes the oldest entry in the bucket to be removed to make room. | ||
395 | Default: 10 | ||
396 | |||
397 | cipso_rbm_optfmt - BOOLEAN | ||
398 | Enable the "Optimized Tag 1 Format" as defined in section 3.4.2.6 of | ||
399 | the CIPSO draft specification (see Documentation/netlabel for details). | ||
400 | This means that when set the CIPSO tag will be padded with empty | ||
401 | categories in order to make the packet data 32-bit aligned. | ||
402 | Default: 0 | ||
403 | |||
404 | cipso_rbm_structvalid - BOOLEAN | ||
405 | If set, do a very strict check of the CIPSO option when | ||
406 | ip_options_compile() is called. If unset, relax the checks done during | ||
407 | ip_options_compile(). Either way is "safe" as errors are caught else | ||
408 | where in the CIPSO processing code but setting this to 0 (False) should | ||
409 | result in less work (i.e. it should be faster) but could cause problems | ||
410 | with other implementations that require strict checking. | ||
411 | Default: 0 | ||
412 | |||
378 | IP Variables: | 413 | IP Variables: |
379 | 414 | ||
380 | ip_local_port_range - 2 INTEGERS | 415 | ip_local_port_range - 2 INTEGERS |
@@ -730,6 +765,9 @@ conf/all/forwarding - BOOLEAN | |||
730 | 765 | ||
731 | This referred to as global forwarding. | 766 | This referred to as global forwarding. |
732 | 767 | ||
768 | proxy_ndp - BOOLEAN | ||
769 | Do proxy ndp. | ||
770 | |||
733 | conf/interface/*: | 771 | conf/interface/*: |
734 | Change special settings per interface. | 772 | Change special settings per interface. |
735 | 773 | ||
diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt index 44f2f769e865..18d385c068fc 100644 --- a/Documentation/networking/pktgen.txt +++ b/Documentation/networking/pktgen.txt | |||
@@ -100,6 +100,7 @@ Examples: | |||
100 | are: IPSRC_RND #IP Source is random (between min/max), | 100 | are: IPSRC_RND #IP Source is random (between min/max), |
101 | IPDST_RND, UDPSRC_RND, | 101 | IPDST_RND, UDPSRC_RND, |
102 | UDPDST_RND, MACSRC_RND, MACDST_RND | 102 | UDPDST_RND, MACSRC_RND, MACDST_RND |
103 | MPLS_RND, VID_RND, SVID_RND | ||
103 | 104 | ||
104 | pgset "udp_src_min 9" set UDP source port min, If < udp_src_max, then | 105 | pgset "udp_src_min 9" set UDP source port min, If < udp_src_max, then |
105 | cycle through the port range. | 106 | cycle through the port range. |
@@ -125,6 +126,21 @@ Examples: | |||
125 | 126 | ||
126 | pgset "mpls 0" turn off mpls (or any invalid argument works too!) | 127 | pgset "mpls 0" turn off mpls (or any invalid argument works too!) |
127 | 128 | ||
129 | pgset "vlan_id 77" set VLAN ID 0-4095 | ||
130 | pgset "vlan_p 3" set priority bit 0-7 (default 0) | ||
131 | pgset "vlan_cfi 0" set canonical format identifier 0-1 (default 0) | ||
132 | |||
133 | pgset "svlan_id 22" set SVLAN ID 0-4095 | ||
134 | pgset "svlan_p 3" set priority bit 0-7 (default 0) | ||
135 | pgset "svlan_cfi 0" set canonical format identifier 0-1 (default 0) | ||
136 | |||
137 | pgset "vlan_id 9999" > 4095 remove vlan and svlan tags | ||
138 | pgset "svlan 9999" > 4095 remove svlan tag | ||
139 | |||
140 | |||
141 | pgset "tos XX" set former IPv4 TOS field (e.g. "tos 28" for AF11 no ECN, default 00) | ||
142 | pgset "traffic_class XX" set former IPv6 TRAFFIC CLASS (e.g. "traffic_class B8" for EF no ECN, default 00) | ||
143 | |||
128 | pgset stop aborts injection. Also, ^C aborts generator. | 144 | pgset stop aborts injection. Also, ^C aborts generator. |
129 | 145 | ||
130 | 146 | ||
diff --git a/Documentation/networking/secid.txt b/Documentation/networking/secid.txt new file mode 100644 index 000000000000..95ea06784333 --- /dev/null +++ b/Documentation/networking/secid.txt | |||
@@ -0,0 +1,14 @@ | |||
1 | flowi structure: | ||
2 | |||
3 | The secid member in the flow structure is used in LSMs (e.g. SELinux) to indicate | ||
4 | the label of the flow. This label of the flow is currently used in selecting | ||
5 | matching labeled xfrm(s). | ||
6 | |||
7 | If this is an outbound flow, the label is derived from the socket, if any, or | ||
8 | the incoming packet this flow is being generated as a response to (e.g. tcp | ||
9 | resets, timewait ack, etc.). It is also conceivable that the label could be | ||
10 | derived from other sources such as process context, device, etc., in special | ||
11 | cases, as may be appropriate. | ||
12 | |||
13 | If this is an inbound flow, the label is derived from the IPSec security | ||
14 | associations, if any, used by the packet. | ||
diff --git a/Documentation/nommu-mmap.txt b/Documentation/nommu-mmap.txt index b88ebe4d808c..7714f57caad5 100644 --- a/Documentation/nommu-mmap.txt +++ b/Documentation/nommu-mmap.txt | |||
@@ -116,6 +116,9 @@ FURTHER NOTES ON NO-MMU MMAP | |||
116 | (*) A list of all the mappings on the system is visible through /proc/maps in | 116 | (*) A list of all the mappings on the system is visible through /proc/maps in |
117 | no-MMU mode. | 117 | no-MMU mode. |
118 | 118 | ||
119 | (*) A list of all the mappings in use by a process is visible through | ||
120 | /proc/<pid>/maps in no-MMU mode. | ||
121 | |||
119 | (*) Supplying MAP_FIXED or a requesting a particular mapping address will | 122 | (*) Supplying MAP_FIXED or a requesting a particular mapping address will |
120 | result in an error. | 123 | result in an error. |
121 | 124 | ||
@@ -125,6 +128,49 @@ FURTHER NOTES ON NO-MMU MMAP | |||
125 | error will result if they don't. This is most likely to be encountered | 128 | error will result if they don't. This is most likely to be encountered |
126 | with character device files, pipes, fifos and sockets. | 129 | with character device files, pipes, fifos and sockets. |
127 | 130 | ||
131 | |||
132 | ========================== | ||
133 | INTERPROCESS SHARED MEMORY | ||
134 | ========================== | ||
135 | |||
136 | Both SYSV IPC SHM shared memory and POSIX shared memory is supported in NOMMU | ||
137 | mode. The former through the usual mechanism, the latter through files created | ||
138 | on ramfs or tmpfs mounts. | ||
139 | |||
140 | |||
141 | ======= | ||
142 | FUTEXES | ||
143 | ======= | ||
144 | |||
145 | Futexes are supported in NOMMU mode if the arch supports them. An error will | ||
146 | be given if an address passed to the futex system call lies outside the | ||
147 | mappings made by a process or if the mapping in which the address lies does not | ||
148 | support futexes (such as an I/O chardev mapping). | ||
149 | |||
150 | |||
151 | ============= | ||
152 | NO-MMU MREMAP | ||
153 | ============= | ||
154 | |||
155 | The mremap() function is partially supported. It may change the size of a | ||
156 | mapping, and may move it[*] if MREMAP_MAYMOVE is specified and if the new size | ||
157 | of the mapping exceeds the size of the slab object currently occupied by the | ||
158 | memory to which the mapping refers, or if a smaller slab object could be used. | ||
159 | |||
160 | MREMAP_FIXED is not supported, though it is ignored if there's no change of | ||
161 | address and the object does not need to be moved. | ||
162 | |||
163 | Shared mappings may not be moved. Shareable mappings may not be moved either, | ||
164 | even if they are not currently shared. | ||
165 | |||
166 | The mremap() function must be given an exact match for base address and size of | ||
167 | a previously mapped object. It may not be used to create holes in existing | ||
168 | mappings, move parts of existing mappings or resize parts of mappings. It must | ||
169 | act on a complete mapping. | ||
170 | |||
171 | [*] Not currently supported. | ||
172 | |||
173 | |||
128 | ============================================ | 174 | ============================================ |
129 | PROVIDING SHAREABLE CHARACTER DEVICE SUPPORT | 175 | PROVIDING SHAREABLE CHARACTER DEVICE SUPPORT |
130 | ============================================ | 176 | ============================================ |
diff --git a/Documentation/pcieaer-howto.txt b/Documentation/pcieaer-howto.txt new file mode 100644 index 000000000000..16c251230c82 --- /dev/null +++ b/Documentation/pcieaer-howto.txt | |||
@@ -0,0 +1,253 @@ | |||
1 | The PCI Express Advanced Error Reporting Driver Guide HOWTO | ||
2 | T. Long Nguyen <tom.l.nguyen@intel.com> | ||
3 | Yanmin Zhang <yanmin.zhang@intel.com> | ||
4 | 07/29/2006 | ||
5 | |||
6 | |||
7 | 1. Overview | ||
8 | |||
9 | 1.1 About this guide | ||
10 | |||
11 | This guide describes the basics of the PCI Express Advanced Error | ||
12 | Reporting (AER) driver and provides information on how to use it, as | ||
13 | well as how to enable the drivers of endpoint devices to conform with | ||
14 | PCI Express AER driver. | ||
15 | |||
16 | 1.2 Copyright © Intel Corporation 2006. | ||
17 | |||
18 | 1.3 What is the PCI Express AER Driver? | ||
19 | |||
20 | PCI Express error signaling can occur on the PCI Express link itself | ||
21 | or on behalf of transactions initiated on the link. PCI Express | ||
22 | defines two error reporting paradigms: the baseline capability and | ||
23 | the Advanced Error Reporting capability. The baseline capability is | ||
24 | required of all PCI Express components providing a minimum defined | ||
25 | set of error reporting requirements. Advanced Error Reporting | ||
26 | capability is implemented with a PCI Express advanced error reporting | ||
27 | extended capability structure providing more robust error reporting. | ||
28 | |||
29 | The PCI Express AER driver provides the infrastructure to support PCI | ||
30 | Express Advanced Error Reporting capability. The PCI Express AER | ||
31 | driver provides three basic functions: | ||
32 | |||
33 | - Gathers the comprehensive error information if errors occurred. | ||
34 | - Reports error to the users. | ||
35 | - Performs error recovery actions. | ||
36 | |||
37 | AER driver only attaches root ports which support PCI-Express AER | ||
38 | capability. | ||
39 | |||
40 | |||
41 | 2. User Guide | ||
42 | |||
43 | 2.1 Include the PCI Express AER Root Driver into the Linux Kernel | ||
44 | |||
45 | The PCI Express AER Root driver is a Root Port service driver attached | ||
46 | to the PCI Express Port Bus driver. If a user wants to use it, the driver | ||
47 | has to be compiled. Option CONFIG_PCIEAER supports this capability. It | ||
48 | depends on CONFIG_PCIEPORTBUS, so pls. set CONFIG_PCIEPORTBUS=y and | ||
49 | CONFIG_PCIEAER = y. | ||
50 | |||
51 | 2.2 Load PCI Express AER Root Driver | ||
52 | There is a case where a system has AER support in BIOS. Enabling the AER | ||
53 | Root driver and having AER support in BIOS may result unpredictable | ||
54 | behavior. To avoid this conflict, a successful load of the AER Root driver | ||
55 | requires ACPI _OSC support in the BIOS to allow the AER Root driver to | ||
56 | request for native control of AER. See the PCI FW 3.0 Specification for | ||
57 | details regarding OSC usage. Currently, lots of firmwares don't provide | ||
58 | _OSC support while they use PCI Express. To support such firmwares, | ||
59 | forceload, a parameter of type bool, could enable AER to continue to | ||
60 | be initiated although firmwares have no _OSC support. To enable the | ||
61 | walkaround, pls. add aerdriver.forceload=y to kernel boot parameter line | ||
62 | when booting kernel. Note that forceload=n by default. | ||
63 | |||
64 | 2.3 AER error output | ||
65 | When a PCI-E AER error is captured, an error message will be outputed to | ||
66 | console. If it's a correctable error, it is outputed as a warning. | ||
67 | Otherwise, it is printed as an error. So users could choose different | ||
68 | log level to filter out correctable error messages. | ||
69 | |||
70 | Below shows an example. | ||
71 | +------ PCI-Express Device Error -----+ | ||
72 | Error Severity : Uncorrected (Fatal) | ||
73 | PCIE Bus Error type : Transaction Layer | ||
74 | Unsupported Request : First | ||
75 | Requester ID : 0500 | ||
76 | VendorID=8086h, DeviceID=0329h, Bus=05h, Device=00h, Function=00h | ||
77 | TLB Header: | ||
78 | 04000001 00200a03 05010000 00050100 | ||
79 | |||
80 | In the example, 'Requester ID' means the ID of the device who sends | ||
81 | the error message to root port. Pls. refer to pci express specs for | ||
82 | other fields. | ||
83 | |||
84 | |||
85 | 3. Developer Guide | ||
86 | |||
87 | To enable AER aware support requires a software driver to configure | ||
88 | the AER capability structure within its device and to provide callbacks. | ||
89 | |||
90 | To support AER better, developers need understand how AER does work | ||
91 | firstly. | ||
92 | |||
93 | PCI Express errors are classified into two types: correctable errors | ||
94 | and uncorrectable errors. This classification is based on the impacts | ||
95 | of those errors, which may result in degraded performance or function | ||
96 | failure. | ||
97 | |||
98 | Correctable errors pose no impacts on the functionality of the | ||
99 | interface. The PCI Express protocol can recover without any software | ||
100 | intervention or any loss of data. These errors are detected and | ||
101 | corrected by hardware. Unlike correctable errors, uncorrectable | ||
102 | errors impact functionality of the interface. Uncorrectable errors | ||
103 | can cause a particular transaction or a particular PCI Express link | ||
104 | to be unreliable. Depending on those error conditions, uncorrectable | ||
105 | errors are further classified into non-fatal errors and fatal errors. | ||
106 | Non-fatal errors cause the particular transaction to be unreliable, | ||
107 | but the PCI Express link itself is fully functional. Fatal errors, on | ||
108 | the other hand, cause the link to be unreliable. | ||
109 | |||
110 | When AER is enabled, a PCI Express device will automatically send an | ||
111 | error message to the PCIE root port above it when the device captures | ||
112 | an error. The Root Port, upon receiving an error reporting message, | ||
113 | internally processes and logs the error message in its PCI Express | ||
114 | capability structure. Error information being logged includes storing | ||
115 | the error reporting agent's requestor ID into the Error Source | ||
116 | Identification Registers and setting the error bits of the Root Error | ||
117 | Status Register accordingly. If AER error reporting is enabled in Root | ||
118 | Error Command Register, the Root Port generates an interrupt if an | ||
119 | error is detected. | ||
120 | |||
121 | Note that the errors as described above are related to the PCI Express | ||
122 | hierarchy and links. These errors do not include any device specific | ||
123 | errors because device specific errors will still get sent directly to | ||
124 | the device driver. | ||
125 | |||
126 | 3.1 Configure the AER capability structure | ||
127 | |||
128 | AER aware drivers of PCI Express component need change the device | ||
129 | control registers to enable AER. They also could change AER registers, | ||
130 | including mask and severity registers. Helper function | ||
131 | pci_enable_pcie_error_reporting could be used to enable AER. See | ||
132 | section 3.3. | ||
133 | |||
134 | 3.2. Provide callbacks | ||
135 | |||
136 | 3.2.1 callback reset_link to reset pci express link | ||
137 | |||
138 | This callback is used to reset the pci express physical link when a | ||
139 | fatal error happens. The root port aer service driver provides a | ||
140 | default reset_link function, but different upstream ports might | ||
141 | have different specifications to reset pci express link, so all | ||
142 | upstream ports should provide their own reset_link functions. | ||
143 | |||
144 | In struct pcie_port_service_driver, a new pointer, reset_link, is | ||
145 | added. | ||
146 | |||
147 | pci_ers_result_t (*reset_link) (struct pci_dev *dev); | ||
148 | |||
149 | Section 3.2.2.2 provides more detailed info on when to call | ||
150 | reset_link. | ||
151 | |||
152 | 3.2.2 PCI error-recovery callbacks | ||
153 | |||
154 | The PCI Express AER Root driver uses error callbacks to coordinate | ||
155 | with downstream device drivers associated with a hierarchy in question | ||
156 | when performing error recovery actions. | ||
157 | |||
158 | Data struct pci_driver has a pointer, err_handler, to point to | ||
159 | pci_error_handlers who consists of a couple of callback function | ||
160 | pointers. AER driver follows the rules defined in | ||
161 | pci-error-recovery.txt except pci express specific parts (e.g. | ||
162 | reset_link). Pls. refer to pci-error-recovery.txt for detailed | ||
163 | definitions of the callbacks. | ||
164 | |||
165 | Below sections specify when to call the error callback functions. | ||
166 | |||
167 | 3.2.2.1 Correctable errors | ||
168 | |||
169 | Correctable errors pose no impacts on the functionality of | ||
170 | the interface. The PCI Express protocol can recover without any | ||
171 | software intervention or any loss of data. These errors do not | ||
172 | require any recovery actions. The AER driver clears the device's | ||
173 | correctable error status register accordingly and logs these errors. | ||
174 | |||
175 | 3.2.2.2 Non-correctable (non-fatal and fatal) errors | ||
176 | |||
177 | If an error message indicates a non-fatal error, performing link reset | ||
178 | at upstream is not required. The AER driver calls error_detected(dev, | ||
179 | pci_channel_io_normal) to all drivers associated within a hierarchy in | ||
180 | question. for example, | ||
181 | EndPoint<==>DownstreamPort B<==>UpstreamPort A<==>RootPort. | ||
182 | If Upstream port A captures an AER error, the hierarchy consists of | ||
183 | Downstream port B and EndPoint. | ||
184 | |||
185 | A driver may return PCI_ERS_RESULT_CAN_RECOVER, | ||
186 | PCI_ERS_RESULT_DISCONNECT, or PCI_ERS_RESULT_NEED_RESET, depending on | ||
187 | whether it can recover or the AER driver calls mmio_enabled as next. | ||
188 | |||
189 | If an error message indicates a fatal error, kernel will broadcast | ||
190 | error_detected(dev, pci_channel_io_frozen) to all drivers within | ||
191 | a hierarchy in question. Then, performing link reset at upstream is | ||
192 | necessary. As different kinds of devices might use different approaches | ||
193 | to reset link, AER port service driver is required to provide the | ||
194 | function to reset link. Firstly, kernel looks for if the upstream | ||
195 | component has an aer driver. If it has, kernel uses the reset_link | ||
196 | callback of the aer driver. If the upstream component has no aer driver | ||
197 | and the port is downstream port, we will use the aer driver of the | ||
198 | root port who reports the AER error. As for upstream ports, | ||
199 | they should provide their own aer service drivers with reset_link | ||
200 | function. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER and | ||
201 | reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes | ||
202 | to mmio_enabled. | ||
203 | |||
204 | 3.3 helper functions | ||
205 | |||
206 | 3.3.1 int pci_find_aer_capability(struct pci_dev *dev); | ||
207 | pci_find_aer_capability locates the PCI Express AER capability | ||
208 | in the device configuration space. If the device doesn't support | ||
209 | PCI-Express AER, the function returns 0. | ||
210 | |||
211 | 3.3.2 int pci_enable_pcie_error_reporting(struct pci_dev *dev); | ||
212 | pci_enable_pcie_error_reporting enables the device to send error | ||
213 | messages to root port when an error is detected. Note that devices | ||
214 | don't enable the error reporting by default, so device drivers need | ||
215 | call this function to enable it. | ||
216 | |||
217 | 3.3.3 int pci_disable_pcie_error_reporting(struct pci_dev *dev); | ||
218 | pci_disable_pcie_error_reporting disables the device to send error | ||
219 | messages to root port when an error is detected. | ||
220 | |||
221 | 3.3.4 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | ||
222 | pci_cleanup_aer_uncorrect_error_status cleanups the uncorrectable | ||
223 | error status register. | ||
224 | |||
225 | 3.4 Frequent Asked Questions | ||
226 | |||
227 | Q: What happens if a PCI Express device driver does not provide an | ||
228 | error recovery handler (pci_driver->err_handler is equal to NULL)? | ||
229 | |||
230 | A: The devices attached with the driver won't be recovered. If the | ||
231 | error is fatal, kernel will print out warning messages. Please refer | ||
232 | to section 3 for more information. | ||
233 | |||
234 | Q: What happens if an upstream port service driver does not provide | ||
235 | callback reset_link? | ||
236 | |||
237 | A: Fatal error recovery will fail if the errors are reported by the | ||
238 | upstream ports who are attached by the service driver. | ||
239 | |||
240 | Q: How does this infrastructure deal with driver that is not PCI | ||
241 | Express aware? | ||
242 | |||
243 | A: This infrastructure calls the error callback functions of the | ||
244 | driver when an error happens. But if the driver is not aware of | ||
245 | PCI Express, the device might not report its own errors to root | ||
246 | port. | ||
247 | |||
248 | Q: What modifications will that driver need to make it compatible | ||
249 | with the PCI Express AER Root driver? | ||
250 | |||
251 | A: It could call the helper functions to enable AER in devices and | ||
252 | cleanup uncorrectable status register. Pls. refer to section 3.3. | ||
253 | |||
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt index fba1e05c47c7..d0e79d5820a5 100644 --- a/Documentation/power/devices.txt +++ b/Documentation/power/devices.txt | |||
@@ -1,208 +1,553 @@ | |||
1 | Most of the code in Linux is device drivers, so most of the Linux power | ||
2 | management code is also driver-specific. Most drivers will do very little; | ||
3 | others, especially for platforms with small batteries (like cell phones), | ||
4 | will do a lot. | ||
5 | |||
6 | This writeup gives an overview of how drivers interact with system-wide | ||
7 | power management goals, emphasizing the models and interfaces that are | ||
8 | shared by everything that hooks up to the driver model core. Read it as | ||
9 | background for the domain-specific work you'd do with any specific driver. | ||
10 | |||
11 | |||
12 | Two Models for Device Power Management | ||
13 | ====================================== | ||
14 | Drivers will use one or both of these models to put devices into low-power | ||
15 | states: | ||
16 | |||
17 | System Sleep model: | ||
18 | Drivers can enter low power states as part of entering system-wide | ||
19 | low-power states like "suspend-to-ram", or (mostly for systems with | ||
20 | disks) "hibernate" (suspend-to-disk). | ||
21 | |||
22 | This is something that device, bus, and class drivers collaborate on | ||
23 | by implementing various role-specific suspend and resume methods to | ||
24 | cleanly power down hardware and software subsystems, then reactivate | ||
25 | them without loss of data. | ||
26 | |||
27 | Some drivers can manage hardware wakeup events, which make the system | ||
28 | leave that low-power state. This feature may be disabled using the | ||
29 | relevant /sys/devices/.../power/wakeup file; enabling it may cost some | ||
30 | power usage, but let the whole system enter low power states more often. | ||
31 | |||
32 | Runtime Power Management model: | ||
33 | Drivers may also enter low power states while the system is running, | ||
34 | independently of other power management activity. Upstream drivers | ||
35 | will normally not know (or care) if the device is in some low power | ||
36 | state when issuing requests; the driver will auto-resume anything | ||
37 | that's needed when it gets a request. | ||
38 | |||
39 | This doesn't have, or need much infrastructure; it's just something you | ||
40 | should do when writing your drivers. For example, clk_disable() unused | ||
41 | clocks as part of minimizing power drain for currently-unused hardware. | ||
42 | Of course, sometimes clusters of drivers will collaborate with each | ||
43 | other, which could involve task-specific power management. | ||
44 | |||
45 | There's not a lot to be said about those low power states except that they | ||
46 | are very system-specific, and often device-specific. Also, that if enough | ||
47 | drivers put themselves into low power states (at "runtime"), the effect may be | ||
48 | the same as entering some system-wide low-power state (system sleep) ... and | ||
49 | that synergies exist, so that several drivers using runtime pm might put the | ||
50 | system into a state where even deeper power saving options are available. | ||
51 | |||
52 | Most suspended devices will have quiesced all I/O: no more DMA or irqs, no | ||
53 | more data read or written, and requests from upstream drivers are no longer | ||
54 | accepted. A given bus or platform may have different requirements though. | ||
55 | |||
56 | Examples of hardware wakeup events include an alarm from a real time clock, | ||
57 | network wake-on-LAN packets, keyboard or mouse activity, and media insertion | ||
58 | or removal (for PCMCIA, MMC/SD, USB, and so on). | ||
59 | |||
60 | |||
61 | Interfaces for Entering System Sleep States | ||
62 | =========================================== | ||
63 | Most of the programming interfaces a device driver needs to know about | ||
64 | relate to that first model: entering a system-wide low power state, | ||
65 | rather than just minimizing power consumption by one device. | ||
66 | |||
67 | |||
68 | Bus Driver Methods | ||
69 | ------------------ | ||
70 | The core methods to suspend and resume devices reside in struct bus_type. | ||
71 | These are mostly of interest to people writing infrastructure for busses | ||
72 | like PCI or USB, or because they define the primitives that device drivers | ||
73 | may need to apply in domain-specific ways to their devices: | ||
1 | 74 | ||
2 | Device Power Management | 75 | struct bus_type { |
76 | ... | ||
77 | int (*suspend)(struct device *dev, pm_message_t state); | ||
78 | int (*suspend_late)(struct device *dev, pm_message_t state); | ||
3 | 79 | ||
80 | int (*resume_early)(struct device *dev); | ||
81 | int (*resume)(struct device *dev); | ||
82 | }; | ||
4 | 83 | ||
5 | Device power management encompasses two areas - the ability to save | 84 | Bus drivers implement those methods as appropriate for the hardware and |
6 | state and transition a device to a low-power state when the system is | 85 | the drivers using it; PCI works differently from USB, and so on. Not many |
7 | entering a low-power state; and the ability to transition a device to | 86 | people write bus drivers; most driver code is a "device driver" that |
8 | a low-power state while the system is running (and independently of | 87 | builds on top of bus-specific framework code. |
9 | any other power management activity). | 88 | |
89 | For more information on these driver calls, see the description later; | ||
90 | they are called in phases for every device, respecting the parent-child | ||
91 | sequencing in the driver model tree. Note that as this is being written, | ||
92 | only the suspend() and resume() are widely available; not many bus drivers | ||
93 | leverage all of those phases, or pass them down to lower driver levels. | ||
94 | |||
95 | |||
96 | /sys/devices/.../power/wakeup files | ||
97 | ----------------------------------- | ||
98 | All devices in the driver model have two flags to control handling of | ||
99 | wakeup events, which are hardware signals that can force the device and/or | ||
100 | system out of a low power state. These are initialized by bus or device | ||
101 | driver code using device_init_wakeup(dev,can_wakeup). | ||
102 | |||
103 | The "can_wakeup" flag just records whether the device (and its driver) can | ||
104 | physically support wakeup events. When that flag is clear, the sysfs | ||
105 | "wakeup" file is empty, and device_may_wakeup() returns false. | ||
106 | |||
107 | For devices that can issue wakeup events, a separate flag controls whether | ||
108 | that device should try to use its wakeup mechanism. The initial value of | ||
109 | device_may_wakeup() will be true, so that the device's "wakeup" file holds | ||
110 | the value "enabled". Userspace can change that to "disabled" so that | ||
111 | device_may_wakeup() returns false; or change it back to "enabled" (so that | ||
112 | it returns true again). | ||
113 | |||
114 | |||
115 | EXAMPLE: PCI Device Driver Methods | ||
116 | ----------------------------------- | ||
117 | PCI framework software calls these methods when the PCI device driver bound | ||
118 | to a device device has provided them: | ||
119 | |||
120 | struct pci_driver { | ||
121 | ... | ||
122 | int (*suspend)(struct pci_device *pdev, pm_message_t state); | ||
123 | int (*suspend_late)(struct pci_device *pdev, pm_message_t state); | ||
124 | |||
125 | int (*resume_early)(struct pci_device *pdev); | ||
126 | int (*resume)(struct pci_device *pdev); | ||
127 | }; | ||
10 | 128 | ||
129 | Drivers will implement those methods, and call PCI-specific procedures | ||
130 | like pci_set_power_state(), pci_enable_wake(), pci_save_state(), and | ||
131 | pci_restore_state() to manage PCI-specific mechanisms. (PCI config space | ||
132 | could be saved during driver probe, if it weren't for the fact that some | ||
133 | systems rely on userspace tweaking using setpci.) Devices are suspended | ||
134 | before their bridges enter low power states, and likewise bridges resume | ||
135 | before their devices. | ||
136 | |||
137 | |||
138 | Upper Layers of Driver Stacks | ||
139 | ----------------------------- | ||
140 | Device drivers generally have at least two interfaces, and the methods | ||
141 | sketched above are the ones which apply to the lower level (nearer PCI, USB, | ||
142 | or other bus hardware). The network and block layers are examples of upper | ||
143 | level interfaces, as is a character device talking to userspace. | ||
144 | |||
145 | Power management requests normally need to flow through those upper levels, | ||
146 | which often use domain-oriented requests like "blank that screen". In | ||
147 | some cases those upper levels will have power management intelligence that | ||
148 | relates to end-user activity, or other devices that work in cooperation. | ||
149 | |||
150 | When those interfaces are structured using class interfaces, there is a | ||
151 | standard way to have the upper layer stop issuing requests to a given | ||
152 | class device (and restart later): | ||
153 | |||
154 | struct class { | ||
155 | ... | ||
156 | int (*suspend)(struct device *dev, pm_message_t state); | ||
157 | int (*resume)(struct device *dev); | ||
158 | }; | ||
11 | 159 | ||
12 | Methods | 160 | Those calls are issued in specific phases of the process by which the |
161 | system enters a low power "suspend" state, or resumes from it. | ||
162 | |||
163 | |||
164 | Calling Drivers to Enter System Sleep States | ||
165 | ============================================ | ||
166 | When the system enters a low power state, each device's driver is asked | ||
167 | to suspend the device by putting it into state compatible with the target | ||
168 | system state. That's usually some version of "off", but the details are | ||
169 | system-specific. Also, wakeup-enabled devices will usually stay partly | ||
170 | functional in order to wake the system. | ||
171 | |||
172 | When the system leaves that low power state, the device's driver is asked | ||
173 | to resume it. The suspend and resume operations always go together, and | ||
174 | both are multi-phase operations. | ||
175 | |||
176 | For simple drivers, suspend might quiesce the device using the class code | ||
177 | and then turn its hardware as "off" as possible with late_suspend. The | ||
178 | matching resume calls would then completely reinitialize the hardware | ||
179 | before reactivating its class I/O queues. | ||
180 | |||
181 | More power-aware drivers drivers will use more than one device low power | ||
182 | state, either at runtime or during system sleep states, and might trigger | ||
183 | system wakeup events. | ||
184 | |||
185 | |||
186 | Call Sequence Guarantees | ||
187 | ------------------------ | ||
188 | To ensure that bridges and similar links needed to talk to a device are | ||
189 | available when the device is suspended or resumed, the device tree is | ||
190 | walked in a bottom-up order to suspend devices. A top-down order is | ||
191 | used to resume those devices. | ||
192 | |||
193 | The ordering of the device tree is defined by the order in which devices | ||
194 | get registered: a child can never be registered, probed or resumed before | ||
195 | its parent; and can't be removed or suspended after that parent. | ||
196 | |||
197 | The policy is that the device tree should match hardware bus topology. | ||
198 | (Or at least the control bus, for devices which use multiple busses.) | ||
199 | |||
200 | |||
201 | Suspending Devices | ||
202 | ------------------ | ||
203 | Suspending a given device is done in several phases. Suspending the | ||
204 | system always includes every phase, executing calls for every device | ||
205 | before the next phase begins. Not all busses or classes support all | ||
206 | these callbacks; and not all drivers use all the callbacks. | ||
207 | |||
208 | The phases are seen by driver notifications issued in this order: | ||
209 | |||
210 | 1 class.suspend(dev, message) is called after tasks are frozen, for | ||
211 | devices associated with a class that has such a method. This | ||
212 | method may sleep. | ||
213 | |||
214 | Since I/O activity usually comes from such higher layers, this is | ||
215 | a good place to quiesce all drivers of a given type (and keep such | ||
216 | code out of those drivers). | ||
217 | |||
218 | 2 bus.suspend(dev, message) is called next. This method may sleep, | ||
219 | and is often morphed into a device driver call with bus-specific | ||
220 | parameters and/or rules. | ||
221 | |||
222 | This call should handle parts of device suspend logic that require | ||
223 | sleeping. It probably does work to quiesce the device which hasn't | ||
224 | been abstracted into class.suspend() or bus.suspend_late(). | ||
225 | |||
226 | 3 bus.suspend_late(dev, message) is called with IRQs disabled, and | ||
227 | with only one CPU active. Until the bus.resume_early() phase | ||
228 | completes (see later), IRQs are not enabled again. This method | ||
229 | won't be exposed by all busses; for message based busses like USB, | ||
230 | I2C, or SPI, device interactions normally require IRQs. This bus | ||
231 | call may be morphed into a driver call with bus-specific parameters. | ||
232 | |||
233 | This call might save low level hardware state that might otherwise | ||
234 | be lost in the upcoming low power state, and actually put the | ||
235 | device into a low power state ... so that in some cases the device | ||
236 | may stay partly usable until this late. This "late" call may also | ||
237 | help when coping with hardware that behaves badly. | ||
238 | |||
239 | The pm_message_t parameter is currently used to refine those semantics | ||
240 | (described later). | ||
241 | |||
242 | At the end of those phases, drivers should normally have stopped all I/O | ||
243 | transactions (DMA, IRQs), saved enough state that they can re-initialize | ||
244 | or restore previous state (as needed by the hardware), and placed the | ||
245 | device into a low-power state. On many platforms they will also use | ||
246 | clk_disable() to gate off one or more clock sources; sometimes they will | ||
247 | also switch off power supplies, or reduce voltages. Drivers which have | ||
248 | runtime PM support may already have performed some or all of the steps | ||
249 | needed to prepare for the upcoming system sleep state. | ||
250 | |||
251 | When any driver sees that its device_can_wakeup(dev), it should make sure | ||
252 | to use the relevant hardware signals to trigger a system wakeup event. | ||
253 | For example, enable_irq_wake() might identify GPIO signals hooked up to | ||
254 | a switch or other external hardware, and pci_enable_wake() does something | ||
255 | similar for PCI's PME# signal. | ||
256 | |||
257 | If a driver (or bus, or class) fails it suspend method, the system won't | ||
258 | enter the desired low power state; it will resume all the devices it's | ||
259 | suspended so far. | ||
260 | |||
261 | Note that drivers may need to perform different actions based on the target | ||
262 | system lowpower/sleep state. At this writing, there are only platform | ||
263 | specific APIs through which drivers could determine those target states. | ||
264 | |||
265 | |||
266 | Device Low Power (suspend) States | ||
267 | --------------------------------- | ||
268 | Device low-power states aren't very standard. One device might only handle | ||
269 | "on" and "off, while another might support a dozen different versions of | ||
270 | "on" (how many engines are active?), plus a state that gets back to "on" | ||
271 | faster than from a full "off". | ||
272 | |||
273 | Some busses define rules about what different suspend states mean. PCI | ||
274 | gives one example: after the suspend sequence completes, a non-legacy | ||
275 | PCI device may not perform DMA or issue IRQs, and any wakeup events it | ||
276 | issues would be issued through the PME# bus signal. Plus, there are | ||
277 | several PCI-standard device states, some of which are optional. | ||
278 | |||
279 | In contrast, integrated system-on-chip processors often use irqs as the | ||
280 | wakeup event sources (so drivers would call enable_irq_wake) and might | ||
281 | be able to treat DMA completion as a wakeup event (sometimes DMA can stay | ||
282 | active too, it'd only be the CPU and some peripherals that sleep). | ||
283 | |||
284 | Some details here may be platform-specific. Systems may have devices that | ||
285 | can be fully active in certain sleep states, such as an LCD display that's | ||
286 | refreshed using DMA while most of the system is sleeping lightly ... and | ||
287 | its frame buffer might even be updated by a DSP or other non-Linux CPU while | ||
288 | the Linux control processor stays idle. | ||
289 | |||
290 | Moreover, the specific actions taken may depend on the target system state. | ||
291 | One target system state might allow a given device to be very operational; | ||
292 | another might require a hard shut down with re-initialization on resume. | ||
293 | And two different target systems might use the same device in different | ||
294 | ways; the aforementioned LCD might be active in one product's "standby", | ||
295 | but a different product using the same SOC might work differently. | ||
296 | |||
297 | |||
298 | Meaning of pm_message_t.event | ||
299 | ----------------------------- | ||
300 | Parameters to suspend calls include the device affected and a message of | ||
301 | type pm_message_t, which has one field: the event. If driver does not | ||
302 | recognize the event code, suspend calls may abort the request and return | ||
303 | a negative errno. However, most drivers will be fine if they implement | ||
304 | PM_EVENT_SUSPEND semantics for all messages. | ||
305 | |||
306 | The event codes are used to refine the goal of suspending the device, and | ||
307 | mostly matter when creating or resuming system memory image snapshots, as | ||
308 | used with suspend-to-disk: | ||
309 | |||
310 | PM_EVENT_SUSPEND -- quiesce the driver and put hardware into a low-power | ||
311 | state. When used with system sleep states like "suspend-to-RAM" or | ||
312 | "standby", the upcoming resume() call will often be able to rely on | ||
313 | state kept in hardware, or issue system wakeup events. When used | ||
314 | instead with suspend-to-disk, few devices support this capability; | ||
315 | most are completely powered off. | ||
316 | |||
317 | PM_EVENT_FREEZE -- quiesce the driver, but don't necessarily change into | ||
318 | any low power mode. A system snapshot is about to be taken, often | ||
319 | followed by a call to the driver's resume() method. Neither wakeup | ||
320 | events nor DMA are allowed. | ||
321 | |||
322 | PM_EVENT_PRETHAW -- quiesce the driver, knowing that the upcoming resume() | ||
323 | will restore a suspend-to-disk snapshot from a different kernel image. | ||
324 | Drivers that are smart enough to look at their hardware state during | ||
325 | resume() processing need that state to be correct ... a PRETHAW could | ||
326 | be used to invalidate that state (by resetting the device), like a | ||
327 | shutdown() invocation would before a kexec() or system halt. Other | ||
328 | drivers might handle this the same way as PM_EVENT_FREEZE. Neither | ||
329 | wakeup events nor DMA are allowed. | ||
330 | |||
331 | To enter "standby" (ACPI S1) or "Suspend to RAM" (STR, ACPI S3) states, or | ||
332 | the similarly named APM states, only PM_EVENT_SUSPEND is used; for "Suspend | ||
333 | to Disk" (STD, hibernate, ACPI S4), all of those event codes are used. | ||
334 | |||
335 | There's also PM_EVENT_ON, a value which never appears as a suspend event | ||
336 | but is sometimes used to record the "not suspended" device state. | ||
337 | |||
338 | |||
339 | Resuming Devices | ||
340 | ---------------- | ||
341 | Resuming is done in multiple phases, much like suspending, with all | ||
342 | devices processing each phase's calls before the next phase begins. | ||
343 | |||
344 | The phases are seen by driver notifications issued in this order: | ||
345 | |||
346 | 1 bus.resume_early(dev) is called with IRQs disabled, and with | ||
347 | only one CPU active. As with bus.suspend_late(), this method | ||
348 | won't be supported on busses that require IRQs in order to | ||
349 | interact with devices. | ||
350 | |||
351 | This reverses the effects of bus.suspend_late(). | ||
352 | |||
353 | 2 bus.resume(dev) is called next. This may be morphed into a device | ||
354 | driver call with bus-specific parameters; implementations may sleep. | ||
355 | |||
356 | This reverses the effects of bus.suspend(). | ||
357 | |||
358 | 3 class.resume(dev) is called for devices associated with a class | ||
359 | that has such a method. Implementations may sleep. | ||
360 | |||
361 | This reverses the effects of class.suspend(), and would usually | ||
362 | reactivate the device's I/O queue. | ||
363 | |||
364 | At the end of those phases, drivers should normally be as functional as | ||
365 | they were before suspending: I/O can be performed using DMA and IRQs, and | ||
366 | the relevant clocks are gated on. The device need not be "fully on"; it | ||
367 | might be in a runtime lowpower/suspend state that acts as if it were. | ||
368 | |||
369 | However, the details here may again be platform-specific. For example, | ||
370 | some systems support multiple "run" states, and the mode in effect at | ||
371 | the end of resume() might not be the one which preceded suspension. | ||
372 | That means availability of certain clocks or power supplies changed, | ||
373 | which could easily affect how a driver works. | ||
374 | |||
375 | |||
376 | Drivers need to be able to handle hardware which has been reset since the | ||
377 | suspend methods were called, for example by complete reinitialization. | ||
378 | This may be the hardest part, and the one most protected by NDA'd documents | ||
379 | and chip errata. It's simplest if the hardware state hasn't changed since | ||
380 | the suspend() was called, but that can't always be guaranteed. | ||
381 | |||
382 | Drivers must also be prepared to notice that the device has been removed | ||
383 | while the system was powered off, whenever that's physically possible. | ||
384 | PCMCIA, MMC, USB, Firewire, SCSI, and even IDE are common examples of busses | ||
385 | where common Linux platforms will see such removal. Details of how drivers | ||
386 | will notice and handle such removals are currently bus-specific, and often | ||
387 | involve a separate thread. | ||
13 | 388 | ||
14 | The methods to suspend and resume devices reside in struct bus_type: | ||
15 | 389 | ||
16 | struct bus_type { | 390 | Note that the bus-specific runtime PM wakeup mechanism can exist, and might |
17 | ... | 391 | be defined to share some of the same driver code as for system wakeup. For |
18 | int (*suspend)(struct device * dev, pm_message_t state); | 392 | example, a bus-specific device driver's resume() method might be used there, |
19 | int (*resume)(struct device * dev); | 393 | so it wouldn't only be called from bus.resume() during system-wide wakeup. |
20 | }; | 394 | See bus-specific information about how runtime wakeup events are handled. |
21 | 395 | ||
22 | Each bus driver is responsible implementing these methods, translating | ||
23 | the call into a bus-specific request and forwarding the call to the | ||
24 | bus-specific drivers. For example, PCI drivers implement suspend() and | ||
25 | resume() methods in struct pci_driver. The PCI core is simply | ||
26 | responsible for translating the pointers to PCI-specific ones and | ||
27 | calling the low-level driver. | ||
28 | |||
29 | This is done to a) ease transition to the new power management methods | ||
30 | and leverage the existing PM code in various bus drivers; b) allow | ||
31 | buses to implement generic and default PM routines for devices, and c) | ||
32 | make the flow of execution obvious to the reader. | ||
33 | |||
34 | |||
35 | System Power Management | ||
36 | |||
37 | When the system enters a low-power state, the device tree is walked in | ||
38 | a depth-first fashion to transition each device into a low-power | ||
39 | state. The ordering of the device tree is guaranteed by the order in | ||
40 | which devices get registered - children are never registered before | ||
41 | their ancestors, and devices are placed at the back of the list when | ||
42 | registered. By walking the list in reverse order, we are guaranteed to | ||
43 | suspend devices in the proper order. | ||
44 | |||
45 | Devices are suspended once with interrupts enabled. Drivers are | ||
46 | expected to stop I/O transactions, save device state, and place the | ||
47 | device into a low-power state. Drivers may sleep, allocate memory, | ||
48 | etc. at will. | ||
49 | |||
50 | Some devices are broken and will inevitably have problems powering | ||
51 | down or disabling themselves with interrupts enabled. For these | ||
52 | special cases, they may return -EAGAIN. This will put the device on a | ||
53 | list to be taken care of later. When interrupts are disabled, before | ||
54 | we enter the low-power state, their drivers are called again to put | ||
55 | their device to sleep. | ||
56 | |||
57 | On resume, the devices that returned -EAGAIN will be called to power | ||
58 | themselves back on with interrupts disabled. Once interrupts have been | ||
59 | re-enabled, the rest of the drivers will be called to resume their | ||
60 | devices. On resume, a driver is responsible for powering back on each | ||
61 | device, restoring state, and re-enabling I/O transactions for that | ||
62 | device. | ||
63 | 396 | ||
397 | System Devices | ||
398 | -------------- | ||
64 | System devices follow a slightly different API, which can be found in | 399 | System devices follow a slightly different API, which can be found in |
65 | 400 | ||
66 | include/linux/sysdev.h | 401 | include/linux/sysdev.h |
67 | drivers/base/sys.c | 402 | drivers/base/sys.c |
68 | 403 | ||
69 | System devices will only be suspended with interrupts disabled, and | 404 | System devices will only be suspended with interrupts disabled, and after |
70 | after all other devices have been suspended. On resume, they will be | 405 | all other devices have been suspended. On resume, they will be resumed |
71 | resumed before any other devices, and also with interrupts disabled. | 406 | before any other devices, and also with interrupts disabled. |
72 | 407 | ||
408 | That is, IRQs are disabled, the suspend_late() phase begins, then the | ||
409 | sysdev_driver.suspend() phase, and the system enters a sleep state. Then | ||
410 | the sysdev_driver.resume() phase begins, followed by the resume_early() | ||
411 | phase, after which IRQs are enabled. | ||
73 | 412 | ||
74 | Runtime Power Management | 413 | Code to actually enter and exit the system-wide low power state sometimes |
75 | 414 | involves hardware details that are only known to the boot firmware, and | |
76 | Many devices are able to dynamically power down while the system is | 415 | may leave a CPU running software (from SRAM or flash memory) that monitors |
77 | still running. This feature is useful for devices that are not being | 416 | the system and manages its wakeup sequence. |
78 | used, and can offer significant power savings on a running system. | ||
79 | |||
80 | In each device's directory, there is a 'power' directory, which | ||
81 | contains at least a 'state' file. Reading from this file displays what | ||
82 | power state the device is currently in. Writing to this file initiates | ||
83 | a transition to the specified power state, which must be a decimal in | ||
84 | the range 1-3, inclusive; or 0 for 'On'. | ||
85 | 417 | ||
86 | The PM core will call the ->suspend() method in the bus_type object | ||
87 | that the device belongs to if the specified state is not 0, or | ||
88 | ->resume() if it is. | ||
89 | 418 | ||
90 | Nothing will happen if the specified state is the same state the | 419 | Runtime Power Management |
91 | device is currently in. | 420 | ======================== |
92 | 421 | Many devices are able to dynamically power down while the system is still | |
93 | If the device is already in a low-power state, and the specified state | 422 | running. This feature is useful for devices that are not being used, and |
94 | is another, but different, low-power state, the ->resume() method will | 423 | can offer significant power savings on a running system. These devices |
95 | first be called to power the device back on, then ->suspend() will be | 424 | often support a range of runtime power states, which might use names such |
96 | called again with the new state. | 425 | as "off", "sleep", "idle", "active", and so on. Those states will in some |
97 | 426 | cases (like PCI) be partially constrained by a bus the device uses, and will | |
98 | The driver is responsible for saving the working state of the device | 427 | usually include hardware states that are also used in system sleep states. |
99 | and putting it into the low-power state specified. If this was | 428 | |
100 | successful, it returns 0, and the device's power_state field is | 429 | However, note that if a driver puts a device into a runtime low power state |
101 | updated. | 430 | and the system then goes into a system-wide sleep state, it normally ought |
102 | 431 | to resume into that runtime low power state rather than "full on". Such | |
103 | The driver must take care to know whether or not it is able to | 432 | distinctions would be part of the driver-internal state machine for that |
104 | properly resume the device, including all step of reinitialization | 433 | hardware; the whole point of runtime power management is to be sure that |
105 | necessary. (This is the hardest part, and the one most protected by | 434 | drivers are decoupled in that way from the state machine governing phases |
106 | NDA'd documents). | 435 | of the system-wide power/sleep state transitions. |
107 | 436 | ||
108 | The driver must also take care not to suspend a device that is | 437 | |
109 | currently in use. It is their responsibility to provide their own | 438 | Power Saving Techniques |
110 | exclusion mechanisms. | 439 | ----------------------- |
111 | 440 | Normally runtime power management is handled by the drivers without specific | |
112 | The runtime power transition happens with interrupts enabled. If a | 441 | userspace or kernel intervention, by device-aware use of techniques like: |
113 | device cannot support being powered down with interrupts, it may | 442 | |
114 | return -EAGAIN (as it would during a system power management | 443 | Using information provided by other system layers |
115 | transition), but it will _not_ be called again, and the transaction | 444 | - stay deeply "off" except between open() and close() |
116 | will fail. | 445 | - if transceiver/PHY indicates "nobody connected", stay "off" |
117 | 446 | - application protocols may include power commands or hints | |
118 | There is currently no way to know what states a device or driver | 447 | |
119 | supports a priori. This will change in the future. | 448 | Using fewer CPU cycles |
120 | 449 | - using DMA instead of PIO | |
121 | pm_message_t meaning | 450 | - removing timers, or making them lower frequency |
122 | 451 | - shortening "hot" code paths | |
123 | pm_message_t has two fields. event ("major"), and flags. If driver | 452 | - eliminating cache misses |
124 | does not know event code, it aborts the request, returning error. Some | 453 | - (sometimes) offloading work to device firmware |
125 | drivers may need to deal with special cases based on the actual type | 454 | |
126 | of suspend operation being done at the system level. This is why | 455 | Reducing other resource costs |
127 | there are flags. | 456 | - gating off unused clocks in software (or hardware) |
128 | 457 | - switching off unused power supplies | |
129 | Event codes are: | 458 | - eliminating (or delaying/merging) IRQs |
130 | 459 | - tuning DMA to use word and/or burst modes | |
131 | ON -- no need to do anything except special cases like broken | 460 | |
132 | HW. | 461 | Using device-specific low power states |
133 | 462 | - using lower voltages | |
134 | # NOTIFICATION -- pretty much same as ON? | 463 | - avoiding needless DMA transfers |
135 | 464 | ||
136 | FREEZE -- stop DMA and interrupts, and be prepared to reinit HW from | 465 | Read your hardware documentation carefully to see the opportunities that |
137 | scratch. That probably means stop accepting upstream requests, the | 466 | may be available. If you can, measure the actual power usage and check |
138 | actual policy of what to do with them being specific to a given | 467 | it against the budget established for your project. |
139 | driver. It's acceptable for a network driver to just drop packets | 468 | |
140 | while a block driver is expected to block the queue so no request is | 469 | |
141 | lost. (Use IDE as an example on how to do that). FREEZE requires no | 470 | Examples: USB hosts, system timer, system CPU |
142 | power state change, and it's expected for drivers to be able to | 471 | ---------------------------------------------- |
143 | quickly transition back to operating state. | 472 | USB host controllers make interesting, if complex, examples. In many cases |
144 | 473 | these have no work to do: no USB devices are connected, or all of them are | |
145 | SUSPEND -- like FREEZE, but also put hardware into low-power state. If | 474 | in the USB "suspend" state. Linux host controller drivers can then disable |
146 | there's need to distinguish several levels of sleep, additional flag | 475 | periodic DMA transfers that would otherwise be a constant power drain on the |
147 | is probably best way to do that. | 476 | memory subsystem, and enter a suspend state. In power-aware controllers, |
148 | 477 | entering that suspend state may disable the clock used with USB signaling, | |
149 | Transitions are only from a resumed state to a suspended state, never | 478 | saving a certain amount of power. |
150 | between 2 suspended states. (ON -> FREEZE or ON -> SUSPEND can happen, | 479 | |
151 | FREEZE -> SUSPEND or SUSPEND -> FREEZE can not). | 480 | The controller will be woken from that state (with an IRQ) by changes to the |
152 | 481 | signal state on the data lines of a given port, for example by an existing | |
153 | All events are: | 482 | peripheral requesting "remote wakeup" or by plugging a new peripheral. The |
154 | 483 | same wakeup mechanism usually works from "standby" sleep states, and on some | |
155 | [NOTE NOTE NOTE: If you are driver author, you should not care; you | 484 | systems also from "suspend to RAM" (or even "suspend to disk") states. |
156 | should only look at event, and ignore flags.] | 485 | (Except that ACPI may be involved instead of normal IRQs, on some hardware.) |
157 | 486 | ||
158 | #Prepare for suspend -- userland is still running but we are going to | 487 | System devices like timers and CPUs may have special roles in the platform |
159 | #enter suspend state. This gives drivers chance to load firmware from | 488 | power management scheme. For example, system timers using a "dynamic tick" |
160 | #disk and store it in memory, or do other activities taht require | 489 | approach don't just save CPU cycles (by eliminating needless timer IRQs), |
161 | #operating userland, ability to kmalloc GFP_KERNEL, etc... All of these | 490 | but they may also open the door to using lower power CPU "idle" states that |
162 | #are forbiden once the suspend dance is started.. event = ON, flags = | 491 | cost more than a jiffie to enter and exit. On x86 systems these are states |
163 | #PREPARE_TO_SUSPEND | 492 | like "C3"; note that periodic DMA transfers from a USB host controller will |
164 | 493 | also prevent entry to a C3 state, much like a periodic timer IRQ. | |
165 | Apm standby -- prepare for APM event. Quiesce devices to make life | 494 | |
166 | easier for APM BIOS. event = FREEZE, flags = APM_STANDBY | 495 | That kind of runtime mechanism interaction is common. "System On Chip" (SOC) |
167 | 496 | processors often have low power idle modes that can't be entered unless | |
168 | Apm suspend -- same as APM_STANDBY, but it we should probably avoid | 497 | certain medium-speed clocks (often 12 or 48 MHz) are gated off. When the |
169 | spinning down disks. event = FREEZE, flags = APM_SUSPEND | 498 | drivers gate those clocks effectively, then the system idle task may be able |
170 | 499 | to use the lower power idle modes and thereby increase battery life. | |
171 | System halt, reboot -- quiesce devices to make life easier for BIOS. event | 500 | |
172 | = FREEZE, flags = SYSTEM_HALT or SYSTEM_REBOOT | 501 | If the CPU can have a "cpufreq" driver, there also may be opportunities |
173 | 502 | to shift to lower voltage settings and reduce the power cost of executing | |
174 | System shutdown -- at least disks need to be spun down, or data may be | 503 | a given number of instructions. (Without voltage adjustment, it's rare |
175 | lost. Quiesce devices, just to make life easier for BIOS. event = | 504 | for cpufreq to save much power; the cost-per-instruction must go down.) |
176 | FREEZE, flags = SYSTEM_SHUTDOWN | 505 | |
177 | 506 | ||
178 | Kexec -- turn off DMAs and put hardware into some state where new | 507 | /sys/devices/.../power/state files |
179 | kernel can take over. event = FREEZE, flags = KEXEC | 508 | ================================== |
180 | 509 | For now you can also test some of this functionality using sysfs. | |
181 | Powerdown at end of swsusp -- very similar to SYSTEM_SHUTDOWN, except wake | 510 | |
182 | may need to be enabled on some devices. This actually has at least 3 | 511 | DEPRECATED: USE "power/state" ONLY FOR DRIVER TESTING, AND |
183 | subtypes, system can reboot, enter S4 and enter S5 at the end of | 512 | AVOID USING dev->power.power_state IN DRIVERS. |
184 | swsusp. event = FREEZE, flags = SWSUSP and one of SYSTEM_REBOOT, | 513 | |
185 | SYSTEM_SHUTDOWN, SYSTEM_S4 | 514 | THESE WILL BE REMOVED. IF THE "power/state" FILE GETS REPLACED, |
186 | 515 | IT WILL BECOME SOMETHING COUPLED TO THE BUS OR DRIVER. | |
187 | Suspend to ram -- put devices into low power state. event = SUSPEND, | 516 | |
188 | flags = SUSPEND_TO_RAM | 517 | In each device's directory, there is a 'power' directory, which contains |
189 | 518 | at least a 'state' file. The value of this field is effectively boolean, | |
190 | Freeze for swsusp snapshot -- stop DMA and interrupts. No need to put | 519 | PM_EVENT_ON or PM_EVENT_SUSPEND. |
191 | devices into low power mode, but you must be able to reinitialize | 520 | |
192 | device from scratch in resume method. This has two flavors, its done | 521 | * Reading from this file displays a value corresponding to |
193 | once on suspending kernel, once on resuming kernel. event = FREEZE, | 522 | the power.power_state.event field. All nonzero values are |
194 | flags = DURING_SUSPEND or DURING_RESUME | 523 | displayed as "2", corresponding to a low power state; zero |
195 | 524 | is displayed as "0", corresponding to normal operation. | |
196 | Device detach requested from /sys -- deinitialize device; proably same as | 525 | |
197 | SYSTEM_SHUTDOWN, I do not understand this one too much. probably event | 526 | * Writing to this file initiates a transition using the |
198 | = FREEZE, flags = DEV_DETACH. | 527 | specified event code number; only '0', '2', and '3' are |
199 | 528 | accepted (without a newline); '2' and '3' are both | |
200 | #These are not really events sent: | 529 | mapped to PM_EVENT_SUSPEND. |
201 | # | 530 | |
202 | #System fully on -- device is working normally; this is probably never | 531 | On writes, the PM core relies on that recorded event code and the device/bus |
203 | #passed to suspend() method... event = ON, flags = 0 | 532 | capabilities to determine whether it uses a partial suspend() or resume() |
204 | # | 533 | sequence to change things so that the recorded event corresponds to the |
205 | #Ready after resume -- userland is now running, again. Time to free any | 534 | numeric parameter. |
206 | #memory you ate during prepare to suspend... event = ON, flags = | 535 | |
207 | #READY_AFTER_RESUME | 536 | - If the bus requires the irqs-disabled suspend_late()/resume_early() |
208 | # | 537 | phases, writes fail because those operations are not supported here. |
538 | |||
539 | - If the recorded value is the expected value, nothing is done. | ||
540 | |||
541 | - If the recorded value is nonzero, the device is partially resumed, | ||
542 | using the bus.resume() and/or class.resume() methods. | ||
543 | |||
544 | - If the target value is nonzero, the device is partially suspended, | ||
545 | using the class.suspend() and/or bus.suspend() methods and the | ||
546 | PM_EVENT_SUSPEND message. | ||
547 | |||
548 | Drivers have no way to tell whether their suspend() and resume() calls | ||
549 | have come through the sysfs power/state file or as part of entering a | ||
550 | system sleep state, except that when accessed through sysfs the normal | ||
551 | parent/child sequencing rules are ignored. Drivers (such as bus, bridge, | ||
552 | or hub drivers) which expose child devices may need to enforce those rules | ||
553 | on their own. | ||
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt index 4117802af0f8..a66bec222b16 100644 --- a/Documentation/power/interface.txt +++ b/Documentation/power/interface.txt | |||
@@ -52,3 +52,18 @@ suspend image will be as small as possible. | |||
52 | 52 | ||
53 | Reading from this file will display the current image size limit, which | 53 | Reading from this file will display the current image size limit, which |
54 | is set to 500 MB by default. | 54 | is set to 500 MB by default. |
55 | |||
56 | /sys/power/pm_trace controls the code which saves the last PM event point in | ||
57 | the RTC across reboots, so that you can debug a machine that just hangs | ||
58 | during suspend (or more commonly, during resume). Namely, the RTC is only | ||
59 | used to save the last PM event point if this file contains '1'. Initially it | ||
60 | contains '0' which may be changed to '1' by writing a string representing a | ||
61 | nonzero integer into it. | ||
62 | |||
63 | To use this debugging feature you should attempt to suspend the machine, then | ||
64 | reboot it and run | ||
65 | |||
66 | dmesg -s 1000000 | grep 'hash matches' | ||
67 | |||
68 | CAUTION: Using it will cause your machine's real-time (CMOS) clock to be | ||
69 | set to a random invalid time after a resume. | ||
diff --git a/Documentation/rt-mutex-design.txt b/Documentation/rt-mutex-design.txt index c472ffacc2f6..4b736d24da7a 100644 --- a/Documentation/rt-mutex-design.txt +++ b/Documentation/rt-mutex-design.txt | |||
@@ -333,11 +333,11 @@ cmpxchg is basically the following function performed atomically: | |||
333 | 333 | ||
334 | unsigned long _cmpxchg(unsigned long *A, unsigned long *B, unsigned long *C) | 334 | unsigned long _cmpxchg(unsigned long *A, unsigned long *B, unsigned long *C) |
335 | { | 335 | { |
336 | unsigned long T = *A; | 336 | unsigned long T = *A; |
337 | if (*A == *B) { | 337 | if (*A == *B) { |
338 | *A = *C; | 338 | *A = *C; |
339 | } | 339 | } |
340 | return T; | 340 | return T; |
341 | } | 341 | } |
342 | #define cmpxchg(a,b,c) _cmpxchg(&a,&b,&c) | 342 | #define cmpxchg(a,b,c) _cmpxchg(&a,&b,&c) |
343 | 343 | ||
@@ -582,7 +582,7 @@ contention). | |||
582 | try_to_take_rt_mutex is used every time the task tries to grab a mutex in the | 582 | try_to_take_rt_mutex is used every time the task tries to grab a mutex in the |
583 | slow path. The first thing that is done here is an atomic setting of | 583 | slow path. The first thing that is done here is an atomic setting of |
584 | the "Has Waiters" flag of the mutex's owner field. Yes, this could really | 584 | the "Has Waiters" flag of the mutex's owner field. Yes, this could really |
585 | be false, because if the the mutex has no owner, there are no waiters and | 585 | be false, because if the mutex has no owner, there are no waiters and |
586 | the current task also won't have any waiters. But we don't have the lock | 586 | the current task also won't have any waiters. But we don't have the lock |
587 | yet, so we assume we are going to be a waiter. The reason for this is to | 587 | yet, so we assume we are going to be a waiter. The reason for this is to |
588 | play nice for those architectures that do have CMPXCHG. By setting this flag | 588 | play nice for those architectures that do have CMPXCHG. By setting this flag |
@@ -735,7 +735,7 @@ do have CMPXCHG, that check is done in the fast path, but it is still needed | |||
735 | in the slow path too. If a waiter of a mutex woke up because of a signal | 735 | in the slow path too. If a waiter of a mutex woke up because of a signal |
736 | or timeout between the time the owner failed the fast path CMPXCHG check and | 736 | or timeout between the time the owner failed the fast path CMPXCHG check and |
737 | the grabbing of the wait_lock, the mutex may not have any waiters, thus the | 737 | the grabbing of the wait_lock, the mutex may not have any waiters, thus the |
738 | owner still needs to make this check. If there are no waiters than the mutex | 738 | owner still needs to make this check. If there are no waiters then the mutex |
739 | owner field is set to NULL, the wait_lock is released and nothing more is | 739 | owner field is set to NULL, the wait_lock is released and nothing more is |
740 | needed. | 740 | needed. |
741 | 741 | ||
diff --git a/Documentation/scsi/ChangeLog.arcmsr b/Documentation/scsi/ChangeLog.arcmsr new file mode 100644 index 000000000000..162c47fdf45f --- /dev/null +++ b/Documentation/scsi/ChangeLog.arcmsr | |||
@@ -0,0 +1,56 @@ | |||
1 | ************************************************************************** | ||
2 | ** History | ||
3 | ** | ||
4 | ** REV# DATE NAME DESCRIPTION | ||
5 | ** 1.00.00.00 3/31/2004 Erich Chen First release | ||
6 | ** 1.10.00.04 7/28/2004 Erich Chen modify for ioctl | ||
7 | ** 1.10.00.06 8/28/2004 Erich Chen modify for 2.6.x | ||
8 | ** 1.10.00.08 9/28/2004 Erich Chen modify for x86_64 | ||
9 | ** 1.10.00.10 10/10/2004 Erich Chen bug fix for SMP & ioctl | ||
10 | ** 1.20.00.00 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error | ||
11 | ** 1.20.00.02 12/09/2004 Erich Chen bug fix with over 2T bytes RAID Volume | ||
12 | ** 1.20.00.04 1/09/2005 Erich Chen fits for Debian linux kernel version 2.2.xx | ||
13 | ** 1.20.00.05 2/20/2005 Erich Chen cleanly as look like a Linux driver at 2.6.x | ||
14 | ** thanks for peoples kindness comment | ||
15 | ** Kornel Wieliczek | ||
16 | ** Christoph Hellwig | ||
17 | ** Adrian Bunk | ||
18 | ** Andrew Morton | ||
19 | ** Christoph Hellwig | ||
20 | ** James Bottomley | ||
21 | ** Arjan van de Ven | ||
22 | ** 1.20.00.06 3/12/2005 Erich Chen fix with arcmsr_pci_unmap_dma "unsigned long" cast, | ||
23 | ** modify PCCB POOL allocated by "dma_alloc_coherent" | ||
24 | ** (Kornel Wieliczek's comment) | ||
25 | ** 1.20.00.07 3/23/2005 Erich Chen bug fix with arcmsr_scsi_host_template_init | ||
26 | ** occur segmentation fault, | ||
27 | ** if RAID adapter does not on PCI slot | ||
28 | ** and modprobe/rmmod this driver twice. | ||
29 | ** bug fix enormous stack usage (Adrian Bunk's comment) | ||
30 | ** 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command, | ||
31 | ** in case of heavy loading when sata cable | ||
32 | ** working on low quality connection | ||
33 | ** 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling, firmware version check | ||
34 | ** and firmware update notify for hardware bug fix | ||
35 | ** 1.20.00.10 9/23/2005 Erich Chen enhance sysfs function for change driver's max tag Q number. | ||
36 | ** add DMA_64BIT_MASK for backward compatible with all 2.6.x | ||
37 | ** add some useful message for abort command | ||
38 | ** add ioctl code 'ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE' | ||
39 | ** customer can send this command for sync raid volume data | ||
40 | ** 1.20.00.11 9/29/2005 Erich Chen by comment of Arjan van de Ven fix incorrect msleep redefine | ||
41 | ** cast off sizeof(dma_addr_t) condition for 64bit pci_set_dma_mask | ||
42 | ** 1.20.00.12 9/30/2005 Erich Chen bug fix with 64bit platform's ccbs using if over 4G system memory | ||
43 | ** change 64bit pci_set_consistent_dma_mask into 32bit | ||
44 | ** increcct adapter count if adapter initialize fail. | ||
45 | ** miss edit at arcmsr_build_ccb.... | ||
46 | ** psge += sizeof(struct _SG64ENTRY *) => | ||
47 | ** psge += sizeof(struct _SG64ENTRY) | ||
48 | ** 64 bits sg entry would be incorrectly calculated | ||
49 | ** thanks Kornel Wieliczek give me kindly notify | ||
50 | ** and detail description | ||
51 | ** 1.20.00.13 11/15/2005 Erich Chen scheduling pending ccb with FIFO | ||
52 | ** change the architecture of arcmsr command queue list | ||
53 | ** for linux standard list | ||
54 | ** enable usage of pci message signal interrupt | ||
55 | ** follow Randy.Danlup kindness suggestion cleanup this code | ||
56 | ************************************************************************** \ No newline at end of file | ||
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt index be55670851a4..ee03678c8029 100644 --- a/Documentation/scsi/aacraid.txt +++ b/Documentation/scsi/aacraid.txt | |||
@@ -11,38 +11,43 @@ the original). | |||
11 | Supported Cards/Chipsets | 11 | Supported Cards/Chipsets |
12 | ------------------------- | 12 | ------------------------- |
13 | PCI ID (pci.ids) OEM Product | 13 | PCI ID (pci.ids) OEM Product |
14 | 9005:0285:9005:028a Adaptec 2020ZCR (Skyhawk) | 14 | 9005:0283:9005:0283 Adaptec Catapult (3210S with arc firmware) |
15 | 9005:0285:9005:028e Adaptec 2020SA (Skyhawk) | 15 | 9005:0284:9005:0284 Adaptec Tomcat (3410S with arc firmware) |
16 | 9005:0285:9005:028b Adaptec 2025ZCR (Terminator) | ||
17 | 9005:0285:9005:028f Adaptec 2025SA (Terminator) | ||
18 | 9005:0285:9005:0286 Adaptec 2120S (Crusader) | ||
19 | 9005:0286:9005:028d Adaptec 2130S (Lancer) | ||
20 | 9005:0285:9005:0285 Adaptec 2200S (Vulcan) | 16 | 9005:0285:9005:0285 Adaptec 2200S (Vulcan) |
17 | 9005:0285:9005:0286 Adaptec 2120S (Crusader) | ||
21 | 9005:0285:9005:0287 Adaptec 2200S (Vulcan-2m) | 18 | 9005:0285:9005:0287 Adaptec 2200S (Vulcan-2m) |
19 | 9005:0285:9005:0288 Adaptec 3230S (Harrier) | ||
20 | 9005:0285:9005:0289 Adaptec 3240S (Tornado) | ||
21 | 9005:0285:9005:028a Adaptec 2020ZCR (Skyhawk) | ||
22 | 9005:0285:9005:028b Adaptec 2025ZCR (Terminator) | ||
22 | 9005:0286:9005:028c Adaptec 2230S (Lancer) | 23 | 9005:0286:9005:028c Adaptec 2230S (Lancer) |
23 | 9005:0286:9005:028c Adaptec 2230SLP (Lancer) | 24 | 9005:0286:9005:028c Adaptec 2230SLP (Lancer) |
24 | 9005:0285:9005:0296 Adaptec 2240S (SabreExpress) | 25 | 9005:0286:9005:028d Adaptec 2130S (Lancer) |
26 | 9005:0285:9005:028e Adaptec 2020SA (Skyhawk) | ||
27 | 9005:0285:9005:028f Adaptec 2025SA (Terminator) | ||
25 | 9005:0285:9005:0290 Adaptec 2410SA (Jaguar) | 28 | 9005:0285:9005:0290 Adaptec 2410SA (Jaguar) |
26 | 9005:0285:9005:0293 Adaptec 21610SA (Corsair-16) | ||
27 | 9005:0285:103c:3227 Adaptec 2610SA (Bearcat HP release) | 29 | 9005:0285:103c:3227 Adaptec 2610SA (Bearcat HP release) |
30 | 9005:0285:9005:0293 Adaptec 21610SA (Corsair-16) | ||
31 | 9005:0285:9005:0296 Adaptec 2240S (SabreExpress) | ||
28 | 9005:0285:9005:0292 Adaptec 2810SA (Corsair-8) | 32 | 9005:0285:9005:0292 Adaptec 2810SA (Corsair-8) |
29 | 9005:0285:9005:0294 Adaptec Prowler | 33 | 9005:0285:9005:0294 Adaptec Prowler |
30 | 9005:0286:9005:029d Adaptec 2420SA (Intruder HP release) | ||
31 | 9005:0286:9005:029c Adaptec 2620SA (Intruder) | ||
32 | 9005:0286:9005:029b Adaptec 2820SA (Intruder) | ||
33 | 9005:0286:9005:02a7 Adaptec 2830SA (Skyray) | ||
34 | 9005:0286:9005:02a8 Adaptec 2430SA (Skyray) | ||
35 | 9005:0285:9005:0288 Adaptec 3230S (Harrier) | ||
36 | 9005:0285:9005:0289 Adaptec 3240S (Tornado) | ||
37 | 9005:0285:9005:0298 Adaptec 4000SAS (BlackBird) | ||
38 | 9005:0285:9005:0297 Adaptec 4005SAS (AvonPark) | 34 | 9005:0285:9005:0297 Adaptec 4005SAS (AvonPark) |
35 | 9005:0285:9005:0298 Adaptec 4000SAS (BlackBird) | ||
39 | 9005:0285:9005:0299 Adaptec 4800SAS (Marauder-X) | 36 | 9005:0285:9005:0299 Adaptec 4800SAS (Marauder-X) |
40 | 9005:0285:9005:029a Adaptec 4805SAS (Marauder-E) | 37 | 9005:0285:9005:029a Adaptec 4805SAS (Marauder-E) |
38 | 9005:0286:9005:029b Adaptec 2820SA (Intruder) | ||
39 | 9005:0286:9005:029c Adaptec 2620SA (Intruder) | ||
40 | 9005:0286:9005:029d Adaptec 2420SA (Intruder HP release) | ||
41 | 9005:0286:9005:02a2 Adaptec 3800SAS (Hurricane44) | 41 | 9005:0286:9005:02a2 Adaptec 3800SAS (Hurricane44) |
42 | 9005:0286:9005:02a7 Adaptec 3805SAS (Hurricane80) | ||
43 | 9005:0286:9005:02a8 Adaptec 3400SAS (Hurricane40) | ||
44 | 9005:0286:9005:02ac Adaptec 1800SAS (Typhoon44) | ||
45 | 9005:0286:9005:02b3 Adaptec 2400SAS (Hurricane40lm) | ||
46 | 9005:0285:9005:02b5 Adaptec ASR5800 (Voodoo44) | ||
47 | 9005:0285:9005:02b6 Adaptec ASR5805 (Voodoo80) | ||
48 | 9005:0285:9005:02b7 Adaptec ASR5808 (Voodoo08) | ||
42 | 1011:0046:9005:0364 Adaptec 5400S (Mustang) | 49 | 1011:0046:9005:0364 Adaptec 5400S (Mustang) |
43 | 1011:0046:9005:0365 Adaptec 5400S (Mustang) | 50 | 1011:0046:9005:0365 Adaptec 5400S (Mustang) |
44 | 9005:0283:9005:0283 Adaptec Catapult (3210S with arc firmware) | ||
45 | 9005:0284:9005:0284 Adaptec Tomcat (3410S with arc firmware) | ||
46 | 9005:0287:9005:0800 Adaptec Themisto (Jupiter) | 51 | 9005:0287:9005:0800 Adaptec Themisto (Jupiter) |
47 | 9005:0200:9005:0200 Adaptec Themisto (Jupiter) | 52 | 9005:0200:9005:0200 Adaptec Themisto (Jupiter) |
48 | 9005:0286:9005:0800 Adaptec Callisto (Jupiter) | 53 | 9005:0286:9005:0800 Adaptec Callisto (Jupiter) |
@@ -64,18 +69,20 @@ Supported Cards/Chipsets | |||
64 | 9005:0285:9005:0290 IBM ServeRAID 7t (Jaguar) | 69 | 9005:0285:9005:0290 IBM ServeRAID 7t (Jaguar) |
65 | 9005:0285:1014:02F2 IBM ServeRAID 8i (AvonPark) | 70 | 9005:0285:1014:02F2 IBM ServeRAID 8i (AvonPark) |
66 | 9005:0285:1014:0312 IBM ServeRAID 8i (AvonParkLite) | 71 | 9005:0285:1014:0312 IBM ServeRAID 8i (AvonParkLite) |
67 | 9005:0286:1014:9580 IBM ServeRAID 8k/8k-l8 (Aurora) | ||
68 | 9005:0286:1014:9540 IBM ServeRAID 8k/8k-l4 (AuroraLite) | 72 | 9005:0286:1014:9540 IBM ServeRAID 8k/8k-l4 (AuroraLite) |
69 | 9005:0286:9005:029f ICP ICP9014R0 (Lancer) | 73 | 9005:0286:1014:9580 IBM ServeRAID 8k/8k-l8 (Aurora) |
74 | 9005:0286:1014:034d IBM ServeRAID 8s (Hurricane) | ||
70 | 9005:0286:9005:029e ICP ICP9024R0 (Lancer) | 75 | 9005:0286:9005:029e ICP ICP9024R0 (Lancer) |
76 | 9005:0286:9005:029f ICP ICP9014R0 (Lancer) | ||
71 | 9005:0286:9005:02a0 ICP ICP9047MA (Lancer) | 77 | 9005:0286:9005:02a0 ICP ICP9047MA (Lancer) |
72 | 9005:0286:9005:02a1 ICP ICP9087MA (Lancer) | 78 | 9005:0286:9005:02a1 ICP ICP9087MA (Lancer) |
79 | 9005:0286:9005:02a3 ICP ICP5445AU (Hurricane44) | ||
73 | 9005:0286:9005:02a4 ICP ICP9085LI (Marauder-X) | 80 | 9005:0286:9005:02a4 ICP ICP9085LI (Marauder-X) |
74 | 9005:0286:9005:02a5 ICP ICP5085BR (Marauder-E) | 81 | 9005:0286:9005:02a5 ICP ICP5085BR (Marauder-E) |
75 | 9005:0286:9005:02a3 ICP ICP5445AU (Hurricane44) | ||
76 | 9005:0286:9005:02a6 ICP ICP9067MA (Intruder-6) | 82 | 9005:0286:9005:02a6 ICP ICP9067MA (Intruder-6) |
77 | 9005:0286:9005:02a9 ICP ICP5087AU (Skyray) | 83 | 9005:0286:9005:02a9 ICP ICP5085AU (Hurricane80) |
78 | 9005:0286:9005:02aa ICP ICP5047AU (Skyray) | 84 | 9005:0286:9005:02aa ICP ICP5045AU (Hurricane40) |
85 | 9005:0286:9005:02b4 ICP ICP5045AL (Hurricane40lm) | ||
79 | 86 | ||
80 | People | 87 | People |
81 | ------------------------- | 88 | ------------------------- |
diff --git a/Documentation/scsi/arcmsr_spec.txt b/Documentation/scsi/arcmsr_spec.txt new file mode 100644 index 000000000000..5e0042340fd3 --- /dev/null +++ b/Documentation/scsi/arcmsr_spec.txt | |||
@@ -0,0 +1,574 @@ | |||
1 | ******************************************************************************* | ||
2 | ** ARECA FIRMWARE SPEC | ||
3 | ******************************************************************************* | ||
4 | ** Usage of IOP331 adapter | ||
5 | ** (All In/Out is in IOP331's view) | ||
6 | ** 1. Message 0 --> InitThread message and retrun code | ||
7 | ** 2. Doorbell is used for RS-232 emulation | ||
8 | ** inDoorBell : bit0 -- data in ready | ||
9 | ** (DRIVER DATA WRITE OK) | ||
10 | ** bit1 -- data out has been read | ||
11 | ** (DRIVER DATA READ OK) | ||
12 | ** outDooeBell: bit0 -- data out ready | ||
13 | ** (IOP331 DATA WRITE OK) | ||
14 | ** bit1 -- data in has been read | ||
15 | ** (IOP331 DATA READ OK) | ||
16 | ** 3. Index Memory Usage | ||
17 | ** offset 0xf00 : for RS232 out (request buffer) | ||
18 | ** offset 0xe00 : for RS232 in (scratch buffer) | ||
19 | ** offset 0xa00 : for inbound message code message_rwbuffer | ||
20 | ** (driver send to IOP331) | ||
21 | ** offset 0xa00 : for outbound message code message_rwbuffer | ||
22 | ** (IOP331 send to driver) | ||
23 | ** 4. RS-232 emulation | ||
24 | ** Currently 128 byte buffer is used | ||
25 | ** 1st uint32_t : Data length (1--124) | ||
26 | ** Byte 4--127 : Max 124 bytes of data | ||
27 | ** 5. PostQ | ||
28 | ** All SCSI Command must be sent through postQ: | ||
29 | ** (inbound queue port) Request frame must be 32 bytes aligned | ||
30 | ** #bit27--bit31 => flag for post ccb | ||
31 | ** #bit0--bit26 => real address (bit27--bit31) of post arcmsr_cdb | ||
32 | ** bit31 : | ||
33 | ** 0 : 256 bytes frame | ||
34 | ** 1 : 512 bytes frame | ||
35 | ** bit30 : | ||
36 | ** 0 : normal request | ||
37 | ** 1 : BIOS request | ||
38 | ** bit29 : reserved | ||
39 | ** bit28 : reserved | ||
40 | ** bit27 : reserved | ||
41 | ** --------------------------------------------------------------------------- | ||
42 | ** (outbount queue port) Request reply | ||
43 | ** #bit27--bit31 | ||
44 | ** => flag for reply | ||
45 | ** #bit0--bit26 | ||
46 | ** => real address (bit27--bit31) of reply arcmsr_cdb | ||
47 | ** bit31 : must be 0 (for this type of reply) | ||
48 | ** bit30 : reserved for BIOS handshake | ||
49 | ** bit29 : reserved | ||
50 | ** bit28 : | ||
51 | ** 0 : no error, ignore AdapStatus/DevStatus/SenseData | ||
52 | ** 1 : Error, error code in AdapStatus/DevStatus/SenseData | ||
53 | ** bit27 : reserved | ||
54 | ** 6. BIOS request | ||
55 | ** All BIOS request is the same with request from PostQ | ||
56 | ** Except : | ||
57 | ** Request frame is sent from configuration space | ||
58 | ** offset: 0x78 : Request Frame (bit30 == 1) | ||
59 | ** offset: 0x18 : writeonly to generate | ||
60 | ** IRQ to IOP331 | ||
61 | ** Completion of request: | ||
62 | ** (bit30 == 0, bit28==err flag) | ||
63 | ** 7. Definition of SGL entry (structure) | ||
64 | ** 8. Message1 Out - Diag Status Code (????) | ||
65 | ** 9. Message0 message code : | ||
66 | ** 0x00 : NOP | ||
67 | ** 0x01 : Get Config | ||
68 | ** ->offset 0xa00 :for outbound message code message_rwbuffer | ||
69 | ** (IOP331 send to driver) | ||
70 | ** Signature 0x87974060(4) | ||
71 | ** Request len 0x00000200(4) | ||
72 | ** numbers of queue 0x00000100(4) | ||
73 | ** SDRAM Size 0x00000100(4)-->256 MB | ||
74 | ** IDE Channels 0x00000008(4) | ||
75 | ** vendor 40 bytes char | ||
76 | ** model 8 bytes char | ||
77 | ** FirmVer 16 bytes char | ||
78 | ** Device Map 16 bytes char | ||
79 | ** FirmwareVersion DWORD <== Added for checking of | ||
80 | ** new firmware capability | ||
81 | ** 0x02 : Set Config | ||
82 | ** ->offset 0xa00 :for inbound message code message_rwbuffer | ||
83 | ** (driver send to IOP331) | ||
84 | ** Signature 0x87974063(4) | ||
85 | ** UPPER32 of Request Frame (4)-->Driver Only | ||
86 | ** 0x03 : Reset (Abort all queued Command) | ||
87 | ** 0x04 : Stop Background Activity | ||
88 | ** 0x05 : Flush Cache | ||
89 | ** 0x06 : Start Background Activity | ||
90 | ** (re-start if background is halted) | ||
91 | ** 0x07 : Check If Host Command Pending | ||
92 | ** (Novell May Need This Function) | ||
93 | ** 0x08 : Set controller time | ||
94 | ** ->offset 0xa00 : for inbound message code message_rwbuffer | ||
95 | ** (driver to IOP331) | ||
96 | ** byte 0 : 0xaa <-- signature | ||
97 | ** byte 1 : 0x55 <-- signature | ||
98 | ** byte 2 : year (04) | ||
99 | ** byte 3 : month (1..12) | ||
100 | ** byte 4 : date (1..31) | ||
101 | ** byte 5 : hour (0..23) | ||
102 | ** byte 6 : minute (0..59) | ||
103 | ** byte 7 : second (0..59) | ||
104 | ******************************************************************************* | ||
105 | ******************************************************************************* | ||
106 | ** RS-232 Interface for Areca Raid Controller | ||
107 | ** The low level command interface is exclusive with VT100 terminal | ||
108 | ** -------------------------------------------------------------------- | ||
109 | ** 1. Sequence of command execution | ||
110 | ** -------------------------------------------------------------------- | ||
111 | ** (A) Header : 3 bytes sequence (0x5E, 0x01, 0x61) | ||
112 | ** (B) Command block : variable length of data including length, | ||
113 | ** command code, data and checksum byte | ||
114 | ** (C) Return data : variable length of data | ||
115 | ** -------------------------------------------------------------------- | ||
116 | ** 2. Command block | ||
117 | ** -------------------------------------------------------------------- | ||
118 | ** (A) 1st byte : command block length (low byte) | ||
119 | ** (B) 2nd byte : command block length (high byte) | ||
120 | ** note ..command block length shouldn't > 2040 bytes, | ||
121 | ** length excludes these two bytes | ||
122 | ** (C) 3rd byte : command code | ||
123 | ** (D) 4th and following bytes : variable length data bytes | ||
124 | ** depends on command code | ||
125 | ** (E) last byte : checksum byte (sum of 1st byte until last data byte) | ||
126 | ** -------------------------------------------------------------------- | ||
127 | ** 3. Command code and associated data | ||
128 | ** -------------------------------------------------------------------- | ||
129 | ** The following are command code defined in raid controller Command | ||
130 | ** code 0x10--0x1? are used for system level management, | ||
131 | ** no password checking is needed and should be implemented in separate | ||
132 | ** well controlled utility and not for end user access. | ||
133 | ** Command code 0x20--0x?? always check the password, | ||
134 | ** password must be entered to enable these command. | ||
135 | ** enum | ||
136 | ** { | ||
137 | ** GUI_SET_SERIAL=0x10, | ||
138 | ** GUI_SET_VENDOR, | ||
139 | ** GUI_SET_MODEL, | ||
140 | ** GUI_IDENTIFY, | ||
141 | ** GUI_CHECK_PASSWORD, | ||
142 | ** GUI_LOGOUT, | ||
143 | ** GUI_HTTP, | ||
144 | ** GUI_SET_ETHERNET_ADDR, | ||
145 | ** GUI_SET_LOGO, | ||
146 | ** GUI_POLL_EVENT, | ||
147 | ** GUI_GET_EVENT, | ||
148 | ** GUI_GET_HW_MONITOR, | ||
149 | ** // GUI_QUICK_CREATE=0x20, (function removed) | ||
150 | ** GUI_GET_INFO_R=0x20, | ||
151 | ** GUI_GET_INFO_V, | ||
152 | ** GUI_GET_INFO_P, | ||
153 | ** GUI_GET_INFO_S, | ||
154 | ** GUI_CLEAR_EVENT, | ||
155 | ** GUI_MUTE_BEEPER=0x30, | ||
156 | ** GUI_BEEPER_SETTING, | ||
157 | ** GUI_SET_PASSWORD, | ||
158 | ** GUI_HOST_INTERFACE_MODE, | ||
159 | ** GUI_REBUILD_PRIORITY, | ||
160 | ** GUI_MAX_ATA_MODE, | ||
161 | ** GUI_RESET_CONTROLLER, | ||
162 | ** GUI_COM_PORT_SETTING, | ||
163 | ** GUI_NO_OPERATION, | ||
164 | ** GUI_DHCP_IP, | ||
165 | ** GUI_CREATE_PASS_THROUGH=0x40, | ||
166 | ** GUI_MODIFY_PASS_THROUGH, | ||
167 | ** GUI_DELETE_PASS_THROUGH, | ||
168 | ** GUI_IDENTIFY_DEVICE, | ||
169 | ** GUI_CREATE_RAIDSET=0x50, | ||
170 | ** GUI_DELETE_RAIDSET, | ||
171 | ** GUI_EXPAND_RAIDSET, | ||
172 | ** GUI_ACTIVATE_RAIDSET, | ||
173 | ** GUI_CREATE_HOT_SPARE, | ||
174 | ** GUI_DELETE_HOT_SPARE, | ||
175 | ** GUI_CREATE_VOLUME=0x60, | ||
176 | ** GUI_MODIFY_VOLUME, | ||
177 | ** GUI_DELETE_VOLUME, | ||
178 | ** GUI_START_CHECK_VOLUME, | ||
179 | ** GUI_STOP_CHECK_VOLUME | ||
180 | ** }; | ||
181 | ** Command description : | ||
182 | ** GUI_SET_SERIAL : Set the controller serial# | ||
183 | ** byte 0,1 : length | ||
184 | ** byte 2 : command code 0x10 | ||
185 | ** byte 3 : password length (should be 0x0f) | ||
186 | ** byte 4-0x13 : should be "ArEcATecHnoLogY" | ||
187 | ** byte 0x14--0x23 : Serial number string (must be 16 bytes) | ||
188 | ** GUI_SET_VENDOR : Set vendor string for the controller | ||
189 | ** byte 0,1 : length | ||
190 | ** byte 2 : command code 0x11 | ||
191 | ** byte 3 : password length (should be 0x08) | ||
192 | ** byte 4-0x13 : should be "ArEcAvAr" | ||
193 | ** byte 0x14--0x3B : vendor string (must be 40 bytes) | ||
194 | ** GUI_SET_MODEL : Set the model name of the controller | ||
195 | ** byte 0,1 : length | ||
196 | ** byte 2 : command code 0x12 | ||
197 | ** byte 3 : password length (should be 0x08) | ||
198 | ** byte 4-0x13 : should be "ArEcAvAr" | ||
199 | ** byte 0x14--0x1B : model string (must be 8 bytes) | ||
200 | ** GUI_IDENTIFY : Identify device | ||
201 | ** byte 0,1 : length | ||
202 | ** byte 2 : command code 0x13 | ||
203 | ** return "Areca RAID Subsystem " | ||
204 | ** GUI_CHECK_PASSWORD : Verify password | ||
205 | ** byte 0,1 : length | ||
206 | ** byte 2 : command code 0x14 | ||
207 | ** byte 3 : password length | ||
208 | ** byte 4-0x?? : user password to be checked | ||
209 | ** GUI_LOGOUT : Logout GUI (force password checking on next command) | ||
210 | ** byte 0,1 : length | ||
211 | ** byte 2 : command code 0x15 | ||
212 | ** GUI_HTTP : HTTP interface (reserved for Http proxy service)(0x16) | ||
213 | ** | ||
214 | ** GUI_SET_ETHERNET_ADDR : Set the ethernet MAC address | ||
215 | ** byte 0,1 : length | ||
216 | ** byte 2 : command code 0x17 | ||
217 | ** byte 3 : password length (should be 0x08) | ||
218 | ** byte 4-0x13 : should be "ArEcAvAr" | ||
219 | ** byte 0x14--0x19 : Ethernet MAC address (must be 6 bytes) | ||
220 | ** GUI_SET_LOGO : Set logo in HTTP | ||
221 | ** byte 0,1 : length | ||
222 | ** byte 2 : command code 0x18 | ||
223 | ** byte 3 : Page# (0/1/2/3) (0xff --> clear OEM logo) | ||
224 | ** byte 4/5/6/7 : 0x55/0xaa/0xa5/0x5a | ||
225 | ** byte 8 : TITLE.JPG data (each page must be 2000 bytes) | ||
226 | ** note page0 1st 2 byte must be | ||
227 | ** actual length of the JPG file | ||
228 | ** GUI_POLL_EVENT : Poll If Event Log Changed | ||
229 | ** byte 0,1 : length | ||
230 | ** byte 2 : command code 0x19 | ||
231 | ** GUI_GET_EVENT : Read Event | ||
232 | ** byte 0,1 : length | ||
233 | ** byte 2 : command code 0x1a | ||
234 | ** byte 3 : Event Page (0:1st page/1/2/3:last page) | ||
235 | ** GUI_GET_HW_MONITOR : Get HW monitor data | ||
236 | ** byte 0,1 : length | ||
237 | ** byte 2 : command code 0x1b | ||
238 | ** byte 3 : # of FANs(example 2) | ||
239 | ** byte 4 : # of Voltage sensor(example 3) | ||
240 | ** byte 5 : # of temperature sensor(example 2) | ||
241 | ** byte 6 : # of power | ||
242 | ** byte 7/8 : Fan#0 (RPM) | ||
243 | ** byte 9/10 : Fan#1 | ||
244 | ** byte 11/12 : Voltage#0 original value in *1000 | ||
245 | ** byte 13/14 : Voltage#0 value | ||
246 | ** byte 15/16 : Voltage#1 org | ||
247 | ** byte 17/18 : Voltage#1 | ||
248 | ** byte 19/20 : Voltage#2 org | ||
249 | ** byte 21/22 : Voltage#2 | ||
250 | ** byte 23 : Temp#0 | ||
251 | ** byte 24 : Temp#1 | ||
252 | ** byte 25 : Power indicator (bit0 : power#0, | ||
253 | ** bit1 : power#1) | ||
254 | ** byte 26 : UPS indicator | ||
255 | ** GUI_QUICK_CREATE : Quick create raid/volume set | ||
256 | ** byte 0,1 : length | ||
257 | ** byte 2 : command code 0x20 | ||
258 | ** byte 3/4/5/6 : raw capacity | ||
259 | ** byte 7 : raid level | ||
260 | ** byte 8 : stripe size | ||
261 | ** byte 9 : spare | ||
262 | ** byte 10/11/12/13: device mask (the devices to create raid/volume) | ||
263 | ** This function is removed, application like | ||
264 | ** to implement quick create function | ||
265 | ** need to use GUI_CREATE_RAIDSET and GUI_CREATE_VOLUMESET function. | ||
266 | ** GUI_GET_INFO_R : Get Raid Set Information | ||
267 | ** byte 0,1 : length | ||
268 | ** byte 2 : command code 0x20 | ||
269 | ** byte 3 : raidset# | ||
270 | ** typedef struct sGUI_RAIDSET | ||
271 | ** { | ||
272 | ** BYTE grsRaidSetName[16]; | ||
273 | ** DWORD grsCapacity; | ||
274 | ** DWORD grsCapacityX; | ||
275 | ** DWORD grsFailMask; | ||
276 | ** BYTE grsDevArray[32]; | ||
277 | ** BYTE grsMemberDevices; | ||
278 | ** BYTE grsNewMemberDevices; | ||
279 | ** BYTE grsRaidState; | ||
280 | ** BYTE grsVolumes; | ||
281 | ** BYTE grsVolumeList[16]; | ||
282 | ** BYTE grsRes1; | ||
283 | ** BYTE grsRes2; | ||
284 | ** BYTE grsRes3; | ||
285 | ** BYTE grsFreeSegments; | ||
286 | ** DWORD grsRawStripes[8]; | ||
287 | ** DWORD grsRes4; | ||
288 | ** DWORD grsRes5; // Total to 128 bytes | ||
289 | ** DWORD grsRes6; // Total to 128 bytes | ||
290 | ** } sGUI_RAIDSET, *pGUI_RAIDSET; | ||
291 | ** GUI_GET_INFO_V : Get Volume Set Information | ||
292 | ** byte 0,1 : length | ||
293 | ** byte 2 : command code 0x21 | ||
294 | ** byte 3 : volumeset# | ||
295 | ** typedef struct sGUI_VOLUMESET | ||
296 | ** { | ||
297 | ** BYTE gvsVolumeName[16]; // 16 | ||
298 | ** DWORD gvsCapacity; | ||
299 | ** DWORD gvsCapacityX; | ||
300 | ** DWORD gvsFailMask; | ||
301 | ** DWORD gvsStripeSize; | ||
302 | ** DWORD gvsNewFailMask; | ||
303 | ** DWORD gvsNewStripeSize; | ||
304 | ** DWORD gvsVolumeStatus; | ||
305 | ** DWORD gvsProgress; // 32 | ||
306 | ** sSCSI_ATTR gvsScsi; | ||
307 | ** BYTE gvsMemberDisks; | ||
308 | ** BYTE gvsRaidLevel; // 8 | ||
309 | ** BYTE gvsNewMemberDisks; | ||
310 | ** BYTE gvsNewRaidLevel; | ||
311 | ** BYTE gvsRaidSetNumber; | ||
312 | ** BYTE gvsRes0; // 4 | ||
313 | ** BYTE gvsRes1[4]; // 64 bytes | ||
314 | ** } sGUI_VOLUMESET, *pGUI_VOLUMESET; | ||
315 | ** GUI_GET_INFO_P : Get Physical Drive Information | ||
316 | ** byte 0,1 : length | ||
317 | ** byte 2 : command code 0x22 | ||
318 | ** byte 3 : drive # (from 0 to max-channels - 1) | ||
319 | ** typedef struct sGUI_PHY_DRV | ||
320 | ** { | ||
321 | ** BYTE gpdModelName[40]; | ||
322 | ** BYTE gpdSerialNumber[20]; | ||
323 | ** BYTE gpdFirmRev[8]; | ||
324 | ** DWORD gpdCapacity; | ||
325 | ** DWORD gpdCapacityX; // Reserved for expansion | ||
326 | ** BYTE gpdDeviceState; | ||
327 | ** BYTE gpdPioMode; | ||
328 | ** BYTE gpdCurrentUdmaMode; | ||
329 | ** BYTE gpdUdmaMode; | ||
330 | ** BYTE gpdDriveSelect; | ||
331 | ** BYTE gpdRaidNumber; // 0xff if not belongs to a raid set | ||
332 | ** sSCSI_ATTR gpdScsi; | ||
333 | ** BYTE gpdReserved[40]; // Total to 128 bytes | ||
334 | ** } sGUI_PHY_DRV, *pGUI_PHY_DRV; | ||
335 | ** GUI_GET_INFO_S : Get System Information | ||
336 | ** byte 0,1 : length | ||
337 | ** byte 2 : command code 0x23 | ||
338 | ** typedef struct sCOM_ATTR | ||
339 | ** { | ||
340 | ** BYTE comBaudRate; | ||
341 | ** BYTE comDataBits; | ||
342 | ** BYTE comStopBits; | ||
343 | ** BYTE comParity; | ||
344 | ** BYTE comFlowControl; | ||
345 | ** } sCOM_ATTR, *pCOM_ATTR; | ||
346 | ** typedef struct sSYSTEM_INFO | ||
347 | ** { | ||
348 | ** BYTE gsiVendorName[40]; | ||
349 | ** BYTE gsiSerialNumber[16]; | ||
350 | ** BYTE gsiFirmVersion[16]; | ||
351 | ** BYTE gsiBootVersion[16]; | ||
352 | ** BYTE gsiMbVersion[16]; | ||
353 | ** BYTE gsiModelName[8]; | ||
354 | ** BYTE gsiLocalIp[4]; | ||
355 | ** BYTE gsiCurrentIp[4]; | ||
356 | ** DWORD gsiTimeTick; | ||
357 | ** DWORD gsiCpuSpeed; | ||
358 | ** DWORD gsiICache; | ||
359 | ** DWORD gsiDCache; | ||
360 | ** DWORD gsiScache; | ||
361 | ** DWORD gsiMemorySize; | ||
362 | ** DWORD gsiMemorySpeed; | ||
363 | ** DWORD gsiEvents; | ||
364 | ** BYTE gsiMacAddress[6]; | ||
365 | ** BYTE gsiDhcp; | ||
366 | ** BYTE gsiBeeper; | ||
367 | ** BYTE gsiChannelUsage; | ||
368 | ** BYTE gsiMaxAtaMode; | ||
369 | ** BYTE gsiSdramEcc; // 1:if ECC enabled | ||
370 | ** BYTE gsiRebuildPriority; | ||
371 | ** sCOM_ATTR gsiComA; // 5 bytes | ||
372 | ** sCOM_ATTR gsiComB; // 5 bytes | ||
373 | ** BYTE gsiIdeChannels; | ||
374 | ** BYTE gsiScsiHostChannels; | ||
375 | ** BYTE gsiIdeHostChannels; | ||
376 | ** BYTE gsiMaxVolumeSet; | ||
377 | ** BYTE gsiMaxRaidSet; | ||
378 | ** BYTE gsiEtherPort; // 1:if ether net port supported | ||
379 | ** BYTE gsiRaid6Engine; // 1:Raid6 engine supported | ||
380 | ** BYTE gsiRes[75]; | ||
381 | ** } sSYSTEM_INFO, *pSYSTEM_INFO; | ||
382 | ** GUI_CLEAR_EVENT : Clear System Event | ||
383 | ** byte 0,1 : length | ||
384 | ** byte 2 : command code 0x24 | ||
385 | ** GUI_MUTE_BEEPER : Mute current beeper | ||
386 | ** byte 0,1 : length | ||
387 | ** byte 2 : command code 0x30 | ||
388 | ** GUI_BEEPER_SETTING : Disable beeper | ||
389 | ** byte 0,1 : length | ||
390 | ** byte 2 : command code 0x31 | ||
391 | ** byte 3 : 0->disable, 1->enable | ||
392 | ** GUI_SET_PASSWORD : Change password | ||
393 | ** byte 0,1 : length | ||
394 | ** byte 2 : command code 0x32 | ||
395 | ** byte 3 : pass word length ( must <= 15 ) | ||
396 | ** byte 4 : password (must be alpha-numerical) | ||
397 | ** GUI_HOST_INTERFACE_MODE : Set host interface mode | ||
398 | ** byte 0,1 : length | ||
399 | ** byte 2 : command code 0x33 | ||
400 | ** byte 3 : 0->Independent, 1->cluster | ||
401 | ** GUI_REBUILD_PRIORITY : Set rebuild priority | ||
402 | ** byte 0,1 : length | ||
403 | ** byte 2 : command code 0x34 | ||
404 | ** byte 3 : 0/1/2/3 (low->high) | ||
405 | ** GUI_MAX_ATA_MODE : Set maximum ATA mode to be used | ||
406 | ** byte 0,1 : length | ||
407 | ** byte 2 : command code 0x35 | ||
408 | ** byte 3 : 0/1/2/3 (133/100/66/33) | ||
409 | ** GUI_RESET_CONTROLLER : Reset Controller | ||
410 | ** byte 0,1 : length | ||
411 | ** byte 2 : command code 0x36 | ||
412 | ** *Response with VT100 screen (discard it) | ||
413 | ** GUI_COM_PORT_SETTING : COM port setting | ||
414 | ** byte 0,1 : length | ||
415 | ** byte 2 : command code 0x37 | ||
416 | ** byte 3 : 0->COMA (term port), | ||
417 | ** 1->COMB (debug port) | ||
418 | ** byte 4 : 0/1/2/3/4/5/6/7 | ||
419 | ** (1200/2400/4800/9600/19200/38400/57600/115200) | ||
420 | ** byte 5 : data bit | ||
421 | ** (0:7 bit, 1:8 bit : must be 8 bit) | ||
422 | ** byte 6 : stop bit (0:1, 1:2 stop bits) | ||
423 | ** byte 7 : parity (0:none, 1:off, 2:even) | ||
424 | ** byte 8 : flow control | ||
425 | ** (0:none, 1:xon/xoff, 2:hardware => must use none) | ||
426 | ** GUI_NO_OPERATION : No operation | ||
427 | ** byte 0,1 : length | ||
428 | ** byte 2 : command code 0x38 | ||
429 | ** GUI_DHCP_IP : Set DHCP option and local IP address | ||
430 | ** byte 0,1 : length | ||
431 | ** byte 2 : command code 0x39 | ||
432 | ** byte 3 : 0:dhcp disabled, 1:dhcp enabled | ||
433 | ** byte 4/5/6/7 : IP address | ||
434 | ** GUI_CREATE_PASS_THROUGH : Create pass through disk | ||
435 | ** byte 0,1 : length | ||
436 | ** byte 2 : command code 0x40 | ||
437 | ** byte 3 : device # | ||
438 | ** byte 4 : scsi channel (0/1) | ||
439 | ** byte 5 : scsi id (0-->15) | ||
440 | ** byte 6 : scsi lun (0-->7) | ||
441 | ** byte 7 : tagged queue (1 : enabled) | ||
442 | ** byte 8 : cache mode (1 : enabled) | ||
443 | ** byte 9 : max speed (0/1/2/3/4, | ||
444 | ** async/20/40/80/160 for scsi) | ||
445 | ** (0/1/2/3/4, 33/66/100/133/150 for ide ) | ||
446 | ** GUI_MODIFY_PASS_THROUGH : Modify pass through disk | ||
447 | ** byte 0,1 : length | ||
448 | ** byte 2 : command code 0x41 | ||
449 | ** byte 3 : device # | ||
450 | ** byte 4 : scsi channel (0/1) | ||
451 | ** byte 5 : scsi id (0-->15) | ||
452 | ** byte 6 : scsi lun (0-->7) | ||
453 | ** byte 7 : tagged queue (1 : enabled) | ||
454 | ** byte 8 : cache mode (1 : enabled) | ||
455 | ** byte 9 : max speed (0/1/2/3/4, | ||
456 | ** async/20/40/80/160 for scsi) | ||
457 | ** (0/1/2/3/4, 33/66/100/133/150 for ide ) | ||
458 | ** GUI_DELETE_PASS_THROUGH : Delete pass through disk | ||
459 | ** byte 0,1 : length | ||
460 | ** byte 2 : command code 0x42 | ||
461 | ** byte 3 : device# to be deleted | ||
462 | ** GUI_IDENTIFY_DEVICE : Identify Device | ||
463 | ** byte 0,1 : length | ||
464 | ** byte 2 : command code 0x43 | ||
465 | ** byte 3 : Flash Method | ||
466 | ** (0:flash selected, 1:flash not selected) | ||
467 | ** byte 4/5/6/7 : IDE device mask to be flashed | ||
468 | ** note .... no response data available | ||
469 | ** GUI_CREATE_RAIDSET : Create Raid Set | ||
470 | ** byte 0,1 : length | ||
471 | ** byte 2 : command code 0x50 | ||
472 | ** byte 3/4/5/6 : device mask | ||
473 | ** byte 7-22 : raidset name (if byte 7 == 0:use default) | ||
474 | ** GUI_DELETE_RAIDSET : Delete Raid Set | ||
475 | ** byte 0,1 : length | ||
476 | ** byte 2 : command code 0x51 | ||
477 | ** byte 3 : raidset# | ||
478 | ** GUI_EXPAND_RAIDSET : Expand Raid Set | ||
479 | ** byte 0,1 : length | ||
480 | ** byte 2 : command code 0x52 | ||
481 | ** byte 3 : raidset# | ||
482 | ** byte 4/5/6/7 : device mask for expansion | ||
483 | ** byte 8/9/10 : (8:0 no change, 1 change, 0xff:terminate, | ||
484 | ** 9:new raid level, | ||
485 | ** 10:new stripe size | ||
486 | ** 0/1/2/3/4/5->4/8/16/32/64/128K ) | ||
487 | ** byte 11/12/13 : repeat for each volume in the raidset | ||
488 | ** GUI_ACTIVATE_RAIDSET : Activate incomplete raid set | ||
489 | ** byte 0,1 : length | ||
490 | ** byte 2 : command code 0x53 | ||
491 | ** byte 3 : raidset# | ||
492 | ** GUI_CREATE_HOT_SPARE : Create hot spare disk | ||
493 | ** byte 0,1 : length | ||
494 | ** byte 2 : command code 0x54 | ||
495 | ** byte 3/4/5/6 : device mask for hot spare creation | ||
496 | ** GUI_DELETE_HOT_SPARE : Delete hot spare disk | ||
497 | ** byte 0,1 : length | ||
498 | ** byte 2 : command code 0x55 | ||
499 | ** byte 3/4/5/6 : device mask for hot spare deletion | ||
500 | ** GUI_CREATE_VOLUME : Create volume set | ||
501 | ** byte 0,1 : length | ||
502 | ** byte 2 : command code 0x60 | ||
503 | ** byte 3 : raidset# | ||
504 | ** byte 4-19 : volume set name | ||
505 | ** (if byte4 == 0, use default) | ||
506 | ** byte 20-27 : volume capacity (blocks) | ||
507 | ** byte 28 : raid level | ||
508 | ** byte 29 : stripe size | ||
509 | ** (0/1/2/3/4/5->4/8/16/32/64/128K) | ||
510 | ** byte 30 : channel | ||
511 | ** byte 31 : ID | ||
512 | ** byte 32 : LUN | ||
513 | ** byte 33 : 1 enable tag | ||
514 | ** byte 34 : 1 enable cache | ||
515 | ** byte 35 : speed | ||
516 | ** (0/1/2/3/4->async/20/40/80/160 for scsi) | ||
517 | ** (0/1/2/3/4->33/66/100/133/150 for IDE ) | ||
518 | ** byte 36 : 1 to select quick init | ||
519 | ** | ||
520 | ** GUI_MODIFY_VOLUME : Modify volume Set | ||
521 | ** byte 0,1 : length | ||
522 | ** byte 2 : command code 0x61 | ||
523 | ** byte 3 : volumeset# | ||
524 | ** byte 4-19 : new volume set name | ||
525 | ** (if byte4 == 0, not change) | ||
526 | ** byte 20-27 : new volume capacity (reserved) | ||
527 | ** byte 28 : new raid level | ||
528 | ** byte 29 : new stripe size | ||
529 | ** (0/1/2/3/4/5->4/8/16/32/64/128K) | ||
530 | ** byte 30 : new channel | ||
531 | ** byte 31 : new ID | ||
532 | ** byte 32 : new LUN | ||
533 | ** byte 33 : 1 enable tag | ||
534 | ** byte 34 : 1 enable cache | ||
535 | ** byte 35 : speed | ||
536 | ** (0/1/2/3/4->async/20/40/80/160 for scsi) | ||
537 | ** (0/1/2/3/4->33/66/100/133/150 for IDE ) | ||
538 | ** GUI_DELETE_VOLUME : Delete volume set | ||
539 | ** byte 0,1 : length | ||
540 | ** byte 2 : command code 0x62 | ||
541 | ** byte 3 : volumeset# | ||
542 | ** GUI_START_CHECK_VOLUME : Start volume consistency check | ||
543 | ** byte 0,1 : length | ||
544 | ** byte 2 : command code 0x63 | ||
545 | ** byte 3 : volumeset# | ||
546 | ** GUI_STOP_CHECK_VOLUME : Stop volume consistency check | ||
547 | ** byte 0,1 : length | ||
548 | ** byte 2 : command code 0x64 | ||
549 | ** --------------------------------------------------------------------- | ||
550 | ** 4. Returned data | ||
551 | ** --------------------------------------------------------------------- | ||
552 | ** (A) Header : 3 bytes sequence (0x5E, 0x01, 0x61) | ||
553 | ** (B) Length : 2 bytes | ||
554 | ** (low byte 1st, excludes length and checksum byte) | ||
555 | ** (C) status or data : | ||
556 | ** <1> If length == 1 ==> 1 byte status code | ||
557 | ** #define GUI_OK 0x41 | ||
558 | ** #define GUI_RAIDSET_NOT_NORMAL 0x42 | ||
559 | ** #define GUI_VOLUMESET_NOT_NORMAL 0x43 | ||
560 | ** #define GUI_NO_RAIDSET 0x44 | ||
561 | ** #define GUI_NO_VOLUMESET 0x45 | ||
562 | ** #define GUI_NO_PHYSICAL_DRIVE 0x46 | ||
563 | ** #define GUI_PARAMETER_ERROR 0x47 | ||
564 | ** #define GUI_UNSUPPORTED_COMMAND 0x48 | ||
565 | ** #define GUI_DISK_CONFIG_CHANGED 0x49 | ||
566 | ** #define GUI_INVALID_PASSWORD 0x4a | ||
567 | ** #define GUI_NO_DISK_SPACE 0x4b | ||
568 | ** #define GUI_CHECKSUM_ERROR 0x4c | ||
569 | ** #define GUI_PASSWORD_REQUIRED 0x4d | ||
570 | ** <2> If length > 1 ==> | ||
571 | ** data block returned from controller | ||
572 | ** and the contents depends on the command code | ||
573 | ** (E) Checksum : checksum of length and status or data byte | ||
574 | ************************************************************************** | ||
diff --git a/Documentation/scsi/libsas.txt b/Documentation/scsi/libsas.txt new file mode 100644 index 000000000000..9e2078b2a615 --- /dev/null +++ b/Documentation/scsi/libsas.txt | |||
@@ -0,0 +1,484 @@ | |||
1 | SAS Layer | ||
2 | --------- | ||
3 | |||
4 | The SAS Layer is a management infrastructure which manages | ||
5 | SAS LLDDs. It sits between SCSI Core and SAS LLDDs. The | ||
6 | layout is as follows: while SCSI Core is concerned with | ||
7 | SAM/SPC issues, and a SAS LLDD+sequencer is concerned with | ||
8 | phy/OOB/link management, the SAS layer is concerned with: | ||
9 | |||
10 | * SAS Phy/Port/HA event management (LLDD generates, | ||
11 | SAS Layer processes), | ||
12 | * SAS Port management (creation/destruction), | ||
13 | * SAS Domain discovery and revalidation, | ||
14 | * SAS Domain device management, | ||
15 | * SCSI Host registration/unregistration, | ||
16 | * Device registration with SCSI Core (SAS) or libata | ||
17 | (SATA), and | ||
18 | * Expander management and exporting expander control | ||
19 | to user space. | ||
20 | |||
21 | A SAS LLDD is a PCI device driver. It is concerned with | ||
22 | phy/OOB management, and vendor specific tasks and generates | ||
23 | events to the SAS layer. | ||
24 | |||
25 | The SAS Layer does most SAS tasks as outlined in the SAS 1.1 | ||
26 | spec. | ||
27 | |||
28 | The sas_ha_struct describes the SAS LLDD to the SAS layer. | ||
29 | Most of it is used by the SAS Layer but a few fields need to | ||
30 | be initialized by the LLDDs. | ||
31 | |||
32 | After initializing your hardware, from the probe() function | ||
33 | you call sas_register_ha(). It will register your LLDD with | ||
34 | the SCSI subsystem, creating a SCSI host and it will | ||
35 | register your SAS driver with the sysfs SAS tree it creates. | ||
36 | It will then return. Then you enable your phys to actually | ||
37 | start OOB (at which point your driver will start calling the | ||
38 | notify_* event callbacks). | ||
39 | |||
40 | Structure descriptions: | ||
41 | |||
42 | struct sas_phy -------------------- | ||
43 | Normally this is statically embedded to your driver's | ||
44 | phy structure: | ||
45 | struct my_phy { | ||
46 | blah; | ||
47 | struct sas_phy sas_phy; | ||
48 | bleh; | ||
49 | }; | ||
50 | And then all the phys are an array of my_phy in your HA | ||
51 | struct (shown below). | ||
52 | |||
53 | Then as you go along and initialize your phys you also | ||
54 | initialize the sas_phy struct, along with your own | ||
55 | phy structure. | ||
56 | |||
57 | In general, the phys are managed by the LLDD and the ports | ||
58 | are managed by the SAS layer. So the phys are initialized | ||
59 | and updated by the LLDD and the ports are initialized and | ||
60 | updated by the SAS layer. | ||
61 | |||
62 | There is a scheme where the LLDD can RW certain fields, | ||
63 | and the SAS layer can only read such ones, and vice versa. | ||
64 | The idea is to avoid unnecessary locking. | ||
65 | |||
66 | enabled -- must be set (0/1) | ||
67 | id -- must be set [0,MAX_PHYS) | ||
68 | class, proto, type, role, oob_mode, linkrate -- must be set | ||
69 | oob_mode -- you set this when OOB has finished and then notify | ||
70 | the SAS Layer. | ||
71 | |||
72 | sas_addr -- this normally points to an array holding the sas | ||
73 | address of the phy, possibly somewhere in your my_phy | ||
74 | struct. | ||
75 | |||
76 | attached_sas_addr -- set this when you (LLDD) receive an | ||
77 | IDENTIFY frame or a FIS frame, _before_ notifying the SAS | ||
78 | layer. The idea is that sometimes the LLDD may want to fake | ||
79 | or provide a different SAS address on that phy/port and this | ||
80 | allows it to do this. At best you should copy the sas | ||
81 | address from the IDENTIFY frame or maybe generate a SAS | ||
82 | address for SATA directly attached devices. The Discover | ||
83 | process may later change this. | ||
84 | |||
85 | frame_rcvd -- this is where you copy the IDENTIFY/FIS frame | ||
86 | when you get it; you lock, copy, set frame_rcvd_size and | ||
87 | unlock the lock, and then call the event. It is a pointer | ||
88 | since there's no way to know your hw frame size _exactly_, | ||
89 | so you define the actual array in your phy struct and let | ||
90 | this pointer point to it. You copy the frame from your | ||
91 | DMAable memory to that area holding the lock. | ||
92 | |||
93 | sas_prim -- this is where primitives go when they're | ||
94 | received. See sas.h. Grab the lock, set the primitive, | ||
95 | release the lock, notify. | ||
96 | |||
97 | port -- this points to the sas_port if the phy belongs | ||
98 | to a port -- the LLDD only reads this. It points to the | ||
99 | sas_port this phy is part of. Set by the SAS Layer. | ||
100 | |||
101 | ha -- may be set; the SAS layer sets it anyway. | ||
102 | |||
103 | lldd_phy -- you should set this to point to your phy so you | ||
104 | can find your way around faster when the SAS layer calls one | ||
105 | of your callbacks and passes you a phy. If the sas_phy is | ||
106 | embedded you can also use container_of -- whatever you | ||
107 | prefer. | ||
108 | |||
109 | |||
110 | struct sas_port -------------------- | ||
111 | The LLDD doesn't set any fields of this struct -- it only | ||
112 | reads them. They should be self explanatory. | ||
113 | |||
114 | phy_mask is 32 bit, this should be enough for now, as I | ||
115 | haven't heard of a HA having more than 8 phys. | ||
116 | |||
117 | lldd_port -- I haven't found use for that -- maybe other | ||
118 | LLDD who wish to have internal port representation can make | ||
119 | use of this. | ||
120 | |||
121 | |||
122 | struct sas_ha_struct -------------------- | ||
123 | It normally is statically declared in your own LLDD | ||
124 | structure describing your adapter: | ||
125 | struct my_sas_ha { | ||
126 | blah; | ||
127 | struct sas_ha_struct sas_ha; | ||
128 | struct my_phy phys[MAX_PHYS]; | ||
129 | struct sas_port sas_ports[MAX_PHYS]; /* (1) */ | ||
130 | bleh; | ||
131 | }; | ||
132 | |||
133 | (1) If your LLDD doesn't have its own port representation. | ||
134 | |||
135 | What needs to be initialized (sample function given below). | ||
136 | |||
137 | pcidev | ||
138 | sas_addr -- since the SAS layer doesn't want to mess with | ||
139 | memory allocation, etc, this points to statically | ||
140 | allocated array somewhere (say in your host adapter | ||
141 | structure) and holds the SAS address of the host | ||
142 | adapter as given by you or the manufacturer, etc. | ||
143 | sas_port | ||
144 | sas_phy -- an array of pointers to structures. (see | ||
145 | note above on sas_addr). | ||
146 | These must be set. See more notes below. | ||
147 | num_phys -- the number of phys present in the sas_phy array, | ||
148 | and the number of ports present in the sas_port | ||
149 | array. There can be a maximum num_phys ports (one per | ||
150 | port) so we drop the num_ports, and only use | ||
151 | num_phys. | ||
152 | |||
153 | The event interface: | ||
154 | |||
155 | /* LLDD calls these to notify the class of an event. */ | ||
156 | void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event); | ||
157 | void (*notify_port_event)(struct sas_phy *, enum port_event); | ||
158 | void (*notify_phy_event)(struct sas_phy *, enum phy_event); | ||
159 | |||
160 | When sas_register_ha() returns, those are set and can be | ||
161 | called by the LLDD to notify the SAS layer of such events | ||
162 | the SAS layer. | ||
163 | |||
164 | The port notification: | ||
165 | |||
166 | /* The class calls these to notify the LLDD of an event. */ | ||
167 | void (*lldd_port_formed)(struct sas_phy *); | ||
168 | void (*lldd_port_deformed)(struct sas_phy *); | ||
169 | |||
170 | If the LLDD wants notification when a port has been formed | ||
171 | or deformed it sets those to a function satisfying the type. | ||
172 | |||
173 | A SAS LLDD should also implement at least one of the Task | ||
174 | Management Functions (TMFs) described in SAM: | ||
175 | |||
176 | /* Task Management Functions. Must be called from process context. */ | ||
177 | int (*lldd_abort_task)(struct sas_task *); | ||
178 | int (*lldd_abort_task_set)(struct domain_device *, u8 *lun); | ||
179 | int (*lldd_clear_aca)(struct domain_device *, u8 *lun); | ||
180 | int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); | ||
181 | int (*lldd_I_T_nexus_reset)(struct domain_device *); | ||
182 | int (*lldd_lu_reset)(struct domain_device *, u8 *lun); | ||
183 | int (*lldd_query_task)(struct sas_task *); | ||
184 | |||
185 | For more information please read SAM from T10.org. | ||
186 | |||
187 | Port and Adapter management: | ||
188 | |||
189 | /* Port and Adapter management */ | ||
190 | int (*lldd_clear_nexus_port)(struct sas_port *); | ||
191 | int (*lldd_clear_nexus_ha)(struct sas_ha_struct *); | ||
192 | |||
193 | A SAS LLDD should implement at least one of those. | ||
194 | |||
195 | Phy management: | ||
196 | |||
197 | /* Phy management */ | ||
198 | int (*lldd_control_phy)(struct sas_phy *, enum phy_func); | ||
199 | |||
200 | lldd_ha -- set this to point to your HA struct. You can also | ||
201 | use container_of if you embedded it as shown above. | ||
202 | |||
203 | A sample initialization and registration function | ||
204 | can look like this (called last thing from probe()) | ||
205 | *but* before you enable the phys to do OOB: | ||
206 | |||
207 | static int register_sas_ha(struct my_sas_ha *my_ha) | ||
208 | { | ||
209 | int i; | ||
210 | static struct sas_phy *sas_phys[MAX_PHYS]; | ||
211 | static struct sas_port *sas_ports[MAX_PHYS]; | ||
212 | |||
213 | my_ha->sas_ha.sas_addr = &my_ha->sas_addr[0]; | ||
214 | |||
215 | for (i = 0; i < MAX_PHYS; i++) { | ||
216 | sas_phys[i] = &my_ha->phys[i].sas_phy; | ||
217 | sas_ports[i] = &my_ha->sas_ports[i]; | ||
218 | } | ||
219 | |||
220 | my_ha->sas_ha.sas_phy = sas_phys; | ||
221 | my_ha->sas_ha.sas_port = sas_ports; | ||
222 | my_ha->sas_ha.num_phys = MAX_PHYS; | ||
223 | |||
224 | my_ha->sas_ha.lldd_port_formed = my_port_formed; | ||
225 | |||
226 | my_ha->sas_ha.lldd_dev_found = my_dev_found; | ||
227 | my_ha->sas_ha.lldd_dev_gone = my_dev_gone; | ||
228 | |||
229 | my_ha->sas_ha.lldd_max_execute_num = lldd_max_execute_num; (1) | ||
230 | |||
231 | my_ha->sas_ha.lldd_queue_size = ha_can_queue; | ||
232 | my_ha->sas_ha.lldd_execute_task = my_execute_task; | ||
233 | |||
234 | my_ha->sas_ha.lldd_abort_task = my_abort_task; | ||
235 | my_ha->sas_ha.lldd_abort_task_set = my_abort_task_set; | ||
236 | my_ha->sas_ha.lldd_clear_aca = my_clear_aca; | ||
237 | my_ha->sas_ha.lldd_clear_task_set = my_clear_task_set; | ||
238 | my_ha->sas_ha.lldd_I_T_nexus_reset= NULL; (2) | ||
239 | my_ha->sas_ha.lldd_lu_reset = my_lu_reset; | ||
240 | my_ha->sas_ha.lldd_query_task = my_query_task; | ||
241 | |||
242 | my_ha->sas_ha.lldd_clear_nexus_port = my_clear_nexus_port; | ||
243 | my_ha->sas_ha.lldd_clear_nexus_ha = my_clear_nexus_ha; | ||
244 | |||
245 | my_ha->sas_ha.lldd_control_phy = my_control_phy; | ||
246 | |||
247 | return sas_register_ha(&my_ha->sas_ha); | ||
248 | } | ||
249 | |||
250 | (1) This is normally a LLDD parameter, something of the | ||
251 | lines of a task collector. What it tells the SAS Layer is | ||
252 | whether the SAS layer should run in Direct Mode (default: | ||
253 | value 0 or 1) or Task Collector Mode (value greater than 1). | ||
254 | |||
255 | In Direct Mode, the SAS Layer calls Execute Task as soon as | ||
256 | it has a command to send to the SDS, _and_ this is a single | ||
257 | command, i.e. not linked. | ||
258 | |||
259 | Some hardware (e.g. aic94xx) has the capability to DMA more | ||
260 | than one task at a time (interrupt) from host memory. Task | ||
261 | Collector Mode is an optional feature for HAs which support | ||
262 | this in their hardware. (Again, it is completely optional | ||
263 | even if your hardware supports it.) | ||
264 | |||
265 | In Task Collector Mode, the SAS Layer would do _natural_ | ||
266 | coalescing of tasks and at the appropriate moment it would | ||
267 | call your driver to DMA more than one task in a single HA | ||
268 | interrupt. DMBS may want to use this by insmod/modprobe | ||
269 | setting the lldd_max_execute_num to something greater than | ||
270 | 1. | ||
271 | |||
272 | (2) SAS 1.1 does not define I_T Nexus Reset TMF. | ||
273 | |||
274 | Events | ||
275 | ------ | ||
276 | |||
277 | Events are _the only way_ a SAS LLDD notifies the SAS layer | ||
278 | of anything. There is no other method or way a LLDD to tell | ||
279 | the SAS layer of anything happening internally or in the SAS | ||
280 | domain. | ||
281 | |||
282 | Phy events: | ||
283 | PHYE_LOSS_OF_SIGNAL, (C) | ||
284 | PHYE_OOB_DONE, | ||
285 | PHYE_OOB_ERROR, (C) | ||
286 | PHYE_SPINUP_HOLD. | ||
287 | |||
288 | Port events, passed on a _phy_: | ||
289 | PORTE_BYTES_DMAED, (M) | ||
290 | PORTE_BROADCAST_RCVD, (E) | ||
291 | PORTE_LINK_RESET_ERR, (C) | ||
292 | PORTE_TIMER_EVENT, (C) | ||
293 | PORTE_HARD_RESET. | ||
294 | |||
295 | Host Adapter event: | ||
296 | HAE_RESET | ||
297 | |||
298 | A SAS LLDD should be able to generate | ||
299 | - at least one event from group C (choice), | ||
300 | - events marked M (mandatory) are mandatory (only one), | ||
301 | - events marked E (expander) if it wants the SAS layer | ||
302 | to handle domain revalidation (only one such). | ||
303 | - Unmarked events are optional. | ||
304 | |||
305 | Meaning: | ||
306 | |||
307 | HAE_RESET -- when your HA got internal error and was reset. | ||
308 | |||
309 | PORTE_BYTES_DMAED -- on receiving an IDENTIFY/FIS frame | ||
310 | PORTE_BROADCAST_RCVD -- on receiving a primitive | ||
311 | PORTE_LINK_RESET_ERR -- timer expired, loss of signal, loss | ||
312 | of DWS, etc. (*) | ||
313 | PORTE_TIMER_EVENT -- DWS reset timeout timer expired (*) | ||
314 | PORTE_HARD_RESET -- Hard Reset primitive received. | ||
315 | |||
316 | PHYE_LOSS_OF_SIGNAL -- the device is gone (*) | ||
317 | PHYE_OOB_DONE -- OOB went fine and oob_mode is valid | ||
318 | PHYE_OOB_ERROR -- Error while doing OOB, the device probably | ||
319 | got disconnected. (*) | ||
320 | PHYE_SPINUP_HOLD -- SATA is present, COMWAKE not sent. | ||
321 | |||
322 | (*) should set/clear the appropriate fields in the phy, | ||
323 | or alternatively call the inlined sas_phy_disconnected() | ||
324 | which is just a helper, from their tasklet. | ||
325 | |||
326 | The Execute Command SCSI RPC: | ||
327 | |||
328 | int (*lldd_execute_task)(struct sas_task *, int num, | ||
329 | unsigned long gfp_flags); | ||
330 | |||
331 | Used to queue a task to the SAS LLDD. @task is the tasks to | ||
332 | be executed. @num should be the number of tasks being | ||
333 | queued at this function call (they are linked listed via | ||
334 | task::list), @gfp_mask should be the gfp_mask defining the | ||
335 | context of the caller. | ||
336 | |||
337 | This function should implement the Execute Command SCSI RPC, | ||
338 | or if you're sending a SCSI Task as linked commands, you | ||
339 | should also use this function. | ||
340 | |||
341 | That is, when lldd_execute_task() is called, the command(s) | ||
342 | go out on the transport *immediately*. There is *no* | ||
343 | queuing of any sort and at any level in a SAS LLDD. | ||
344 | |||
345 | The use of task::list is two-fold, one for linked commands, | ||
346 | the other discussed below. | ||
347 | |||
348 | It is possible to queue up more than one task at a time, by | ||
349 | initializing the list element of struct sas_task, and | ||
350 | passing the number of tasks enlisted in this manner in num. | ||
351 | |||
352 | Returns: -SAS_QUEUE_FULL, -ENOMEM, nothing was queued; | ||
353 | 0, the task(s) were queued. | ||
354 | |||
355 | If you want to pass num > 1, then either | ||
356 | A) you're the only caller of this function and keep track | ||
357 | of what you've queued to the LLDD, or | ||
358 | B) you know what you're doing and have a strategy of | ||
359 | retrying. | ||
360 | |||
361 | As opposed to queuing one task at a time (function call), | ||
362 | batch queuing of tasks, by having num > 1, greatly | ||
363 | simplifies LLDD code, sequencer code, and _hardware design_, | ||
364 | and has some performance advantages in certain situations | ||
365 | (DBMS). | ||
366 | |||
367 | The LLDD advertises if it can take more than one command at | ||
368 | a time at lldd_execute_task(), by setting the | ||
369 | lldd_max_execute_num parameter (controlled by "collector" | ||
370 | module parameter in aic94xx SAS LLDD). | ||
371 | |||
372 | You should leave this to the default 1, unless you know what | ||
373 | you're doing. | ||
374 | |||
375 | This is a function of the LLDD, to which the SAS layer can | ||
376 | cater to. | ||
377 | |||
378 | int lldd_queue_size | ||
379 | The host adapter's queue size. This is the maximum | ||
380 | number of commands the lldd can have pending to domain | ||
381 | devices on behalf of all upper layers submitting through | ||
382 | lldd_execute_task(). | ||
383 | |||
384 | You really want to set this to something (much) larger than | ||
385 | 1. | ||
386 | |||
387 | This _really_ has absolutely nothing to do with queuing. | ||
388 | There is no queuing in SAS LLDDs. | ||
389 | |||
390 | struct sas_task { | ||
391 | dev -- the device this task is destined to | ||
392 | list -- must be initialized (INIT_LIST_HEAD) | ||
393 | task_proto -- _one_ of enum sas_proto | ||
394 | scatter -- pointer to scatter gather list array | ||
395 | num_scatter -- number of elements in scatter | ||
396 | total_xfer_len -- total number of bytes expected to be transfered | ||
397 | data_dir -- PCI_DMA_... | ||
398 | task_done -- callback when the task has finished execution | ||
399 | }; | ||
400 | |||
401 | When an external entity, entity other than the LLDD or the | ||
402 | SAS Layer, wants to work with a struct domain_device, it | ||
403 | _must_ call kobject_get() when getting a handle on the | ||
404 | device and kobject_put() when it is done with the device. | ||
405 | |||
406 | This does two things: | ||
407 | A) implements proper kfree() for the device; | ||
408 | B) increments/decrements the kref for all players: | ||
409 | domain_device | ||
410 | all domain_device's ... (if past an expander) | ||
411 | port | ||
412 | host adapter | ||
413 | pci device | ||
414 | and up the ladder, etc. | ||
415 | |||
416 | DISCOVERY | ||
417 | --------- | ||
418 | |||
419 | The sysfs tree has the following purposes: | ||
420 | a) It shows you the physical layout of the SAS domain at | ||
421 | the current time, i.e. how the domain looks in the | ||
422 | physical world right now. | ||
423 | b) Shows some device parameters _at_discovery_time_. | ||
424 | |||
425 | This is a link to the tree(1) program, very useful in | ||
426 | viewing the SAS domain: | ||
427 | ftp://mama.indstate.edu/linux/tree/ | ||
428 | I expect user space applications to actually create a | ||
429 | graphical interface of this. | ||
430 | |||
431 | That is, the sysfs domain tree doesn't show or keep state if | ||
432 | you e.g., change the meaning of the READY LED MEANING | ||
433 | setting, but it does show you the current connection status | ||
434 | of the domain device. | ||
435 | |||
436 | Keeping internal device state changes is responsibility of | ||
437 | upper layers (Command set drivers) and user space. | ||
438 | |||
439 | When a device or devices are unplugged from the domain, this | ||
440 | is reflected in the sysfs tree immediately, and the device(s) | ||
441 | removed from the system. | ||
442 | |||
443 | The structure domain_device describes any device in the SAS | ||
444 | domain. It is completely managed by the SAS layer. A task | ||
445 | points to a domain device, this is how the SAS LLDD knows | ||
446 | where to send the task(s) to. A SAS LLDD only reads the | ||
447 | contents of the domain_device structure, but it never creates | ||
448 | or destroys one. | ||
449 | |||
450 | Expander management from User Space | ||
451 | ----------------------------------- | ||
452 | |||
453 | In each expander directory in sysfs, there is a file called | ||
454 | "smp_portal". It is a binary sysfs attribute file, which | ||
455 | implements an SMP portal (Note: this is *NOT* an SMP port), | ||
456 | to which user space applications can send SMP requests and | ||
457 | receive SMP responses. | ||
458 | |||
459 | Functionality is deceptively simple: | ||
460 | |||
461 | 1. Build the SMP frame you want to send. The format and layout | ||
462 | is described in the SAS spec. Leave the CRC field equal 0. | ||
463 | open(2) | ||
464 | 2. Open the expander's SMP portal sysfs file in RW mode. | ||
465 | write(2) | ||
466 | 3. Write the frame you built in 1. | ||
467 | read(2) | ||
468 | 4. Read the amount of data you expect to receive for the frame you built. | ||
469 | If you receive different amount of data you expected to receive, | ||
470 | then there was some kind of error. | ||
471 | close(2) | ||
472 | All this process is shown in detail in the function do_smp_func() | ||
473 | and its callers, in the file "expander_conf.c". | ||
474 | |||
475 | The kernel functionality is implemented in the file | ||
476 | "sas_expander.c". | ||
477 | |||
478 | The program "expander_conf.c" implements this. It takes one | ||
479 | argument, the sysfs file name of the SMP portal to the | ||
480 | expander, and gives expander information, including routing | ||
481 | tables. | ||
482 | |||
483 | The SMP portal gives you complete control of the expander, | ||
484 | so please be careful. | ||
diff --git a/Documentation/seclvl.txt b/Documentation/seclvl.txt deleted file mode 100644 index 97274d122d0e..000000000000 --- a/Documentation/seclvl.txt +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | BSD Secure Levels Linux Security Module | ||
2 | Michael A. Halcrow <mike@halcrow.us> | ||
3 | |||
4 | |||
5 | Introduction | ||
6 | |||
7 | Under the BSD Secure Levels security model, sets of policies are | ||
8 | associated with levels. Levels range from -1 to 2, with -1 being the | ||
9 | weakest and 2 being the strongest. These security policies are | ||
10 | enforced at the kernel level, so not even the superuser is able to | ||
11 | disable or circumvent them. This hardens the machine against attackers | ||
12 | who gain root access to the system. | ||
13 | |||
14 | |||
15 | Levels and Policies | ||
16 | |||
17 | Level -1 (Permanently Insecure): | ||
18 | - Cannot increase the secure level | ||
19 | |||
20 | Level 0 (Insecure): | ||
21 | - Cannot ptrace the init process | ||
22 | |||
23 | Level 1 (Default): | ||
24 | - /dev/mem and /dev/kmem are read-only | ||
25 | - IMMUTABLE and APPEND extended attributes, if set, may not be unset | ||
26 | - Cannot load or unload kernel modules | ||
27 | - Cannot write directly to a mounted block device | ||
28 | - Cannot perform raw I/O operations | ||
29 | - Cannot perform network administrative tasks | ||
30 | - Cannot setuid any file | ||
31 | |||
32 | Level 2 (Secure): | ||
33 | - Cannot decrement the system time | ||
34 | - Cannot write to any block device, whether mounted or not | ||
35 | - Cannot unmount any mounted filesystems | ||
36 | |||
37 | |||
38 | Compilation | ||
39 | |||
40 | To compile the BSD Secure Levels LSM, seclvl.ko, enable the | ||
41 | SECURITY_SECLVL configuration option. This is found under Security | ||
42 | options -> BSD Secure Levels in the kernel configuration menu. | ||
43 | |||
44 | |||
45 | Basic Usage | ||
46 | |||
47 | Once the machine is in a running state, with all the necessary modules | ||
48 | loaded and all the filesystems mounted, you can load the seclvl.ko | ||
49 | module: | ||
50 | |||
51 | # insmod seclvl.ko | ||
52 | |||
53 | The module defaults to secure level 1, except when compiled directly | ||
54 | into the kernel, in which case it defaults to secure level 0. To raise | ||
55 | the secure level to 2, the administrator writes ``2'' to the | ||
56 | seclvl/seclvl file under the sysfs mount point (assumed to be /sys in | ||
57 | these examples): | ||
58 | |||
59 | # echo -n "2" > /sys/seclvl/seclvl | ||
60 | |||
61 | Alternatively, you can initialize the module at secure level 2 with | ||
62 | the initlvl module parameter: | ||
63 | |||
64 | # insmod seclvl.ko initlvl=2 | ||
65 | |||
66 | At this point, it is impossible to remove the module or reduce the | ||
67 | secure level. If the administrator wishes to have the option of doing | ||
68 | so, he must provide a module parameter, sha1_passwd, that specifies | ||
69 | the SHA1 hash of the password that can be used to reduce the secure | ||
70 | level to 0. | ||
71 | |||
72 | To generate this SHA1 hash, the administrator can use OpenSSL: | ||
73 | |||
74 | # echo -n "boogabooga" | openssl sha1 | ||
75 | abeda4e0f33defa51741217592bf595efb8d289c | ||
76 | |||
77 | In order to use password-instigated secure level reduction, the SHA1 | ||
78 | crypto module must be loaded or compiled into the kernel: | ||
79 | |||
80 | # insmod sha1.ko | ||
81 | |||
82 | The administrator can then insmod the seclvl module, including the | ||
83 | SHA1 hash of the password: | ||
84 | |||
85 | # insmod seclvl.ko | ||
86 | sha1_passwd=abeda4e0f33defa51741217592bf595efb8d289c | ||
87 | |||
88 | To reduce the secure level, write the password to seclvl/passwd under | ||
89 | your sysfs mount point: | ||
90 | |||
91 | # echo -n "boogabooga" > /sys/seclvl/passwd | ||
92 | |||
93 | The September 2004 edition of Sys Admin Magazine has an article about | ||
94 | the BSD Secure Levels LSM. I encourage you to refer to that article | ||
95 | for a more in-depth treatment of this security module: | ||
96 | |||
97 | http://www.samag.com/documents/s=9304/sam0409a/0409a.htm | ||
diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.txt index eb2dd2e6993b..73988e0d112b 100644 --- a/Documentation/sh/new-machine.txt +++ b/Documentation/sh/new-machine.txt | |||
@@ -41,11 +41,6 @@ Board-specific code: | |||
41 | | | 41 | | |
42 | .. more boards here ... | 42 | .. more boards here ... |
43 | 43 | ||
44 | It should also be noted that each board is required to have some certain | ||
45 | headers. At the time of this writing, io.h is the only thing that needs | ||
46 | to be provided for each board, and can generally just reference generic | ||
47 | functions (with the exception of isa_port2addr). | ||
48 | |||
49 | Next, for companion chips: | 44 | Next, for companion chips: |
50 | . | 45 | . |
51 | `-- arch | 46 | `-- arch |
@@ -104,12 +99,13 @@ and then populate that with sub-directories for each member of the family. | |||
104 | Both the Solution Engine and the hp6xx boards are an example of this. | 99 | Both the Solution Engine and the hp6xx boards are an example of this. |
105 | 100 | ||
106 | After you have setup your new arch/sh/boards/ directory, remember that you | 101 | After you have setup your new arch/sh/boards/ directory, remember that you |
107 | also must add a directory in include/asm-sh for headers localized to this | 102 | should also add a directory in include/asm-sh for headers localized to this |
108 | board. In order to interoperate seamlessly with the build system, it's best | 103 | board (if there are going to be more than one). In order to interoperate |
109 | to have this directory the same as the arch/sh/boards/ directory name, | 104 | seamlessly with the build system, it's best to have this directory the same |
110 | though if your board is again part of a family, the build system has ways | 105 | as the arch/sh/boards/ directory name, though if your board is again part of |
111 | of dealing with this, and you can feel free to name the directory after | 106 | a family, the build system has ways of dealing with this (via incdir-y |
112 | the family member itself. | 107 | overloading), and you can feel free to name the directory after the family |
108 | member itself. | ||
113 | 109 | ||
114 | There are a few things that each board is required to have, both in the | 110 | There are a few things that each board is required to have, both in the |
115 | arch/sh/boards and the include/asm-sh/ heirarchy. In order to better | 111 | arch/sh/boards and the include/asm-sh/ heirarchy. In order to better |
@@ -122,6 +118,7 @@ might look something like: | |||
122 | * arch/sh/boards/vapor/setup.c - Setup code for imaginary board | 118 | * arch/sh/boards/vapor/setup.c - Setup code for imaginary board |
123 | */ | 119 | */ |
124 | #include <linux/init.h> | 120 | #include <linux/init.h> |
121 | #include <asm/rtc.h> /* for board_time_init() */ | ||
125 | 122 | ||
126 | const char *get_system_type(void) | 123 | const char *get_system_type(void) |
127 | { | 124 | { |
@@ -152,79 +149,57 @@ int __init platform_setup(void) | |||
152 | } | 149 | } |
153 | 150 | ||
154 | Our new imaginary board will also have to tie into the machvec in order for it | 151 | Our new imaginary board will also have to tie into the machvec in order for it |
155 | to be of any use. Currently the machvec is slowly on its way out, but is still | 152 | to be of any use. |
156 | required for the time being. As such, let us take a look at what needs to be | ||
157 | done for the machvec assignment. | ||
158 | 153 | ||
159 | machvec functions fall into a number of categories: | 154 | machvec functions fall into a number of categories: |
160 | 155 | ||
161 | - I/O functions to IO memory (inb etc) and PCI/main memory (readb etc). | 156 | - I/O functions to IO memory (inb etc) and PCI/main memory (readb etc). |
162 | - I/O remapping functions (ioremap etc) | 157 | - I/O mapping functions (ioport_map, ioport_unmap, etc). |
163 | - some initialisation functions | 158 | - a 'heartbeat' function. |
164 | - a 'heartbeat' function | 159 | - PCI and IRQ initialization routines. |
165 | - some miscellaneous flags | 160 | - Consistent allocators (for boards that need special allocators, |
166 | 161 | particularly for allocating out of some board-specific SRAM for DMA | |
167 | The tree can be built in two ways: | 162 | handles). |
168 | - as a fully generic build. All drivers are linked in, and all functions | 163 | |
169 | go through the machvec | 164 | There are machvec functions added and removed over time, so always be sure to |
170 | - as a machine specific build. In this case only the required drivers | 165 | consult include/asm-sh/machvec.h for the current state of the machvec. |
171 | will be linked in, and some macros may be redefined to not go through | 166 | |
172 | the machvec where performance is important (in particular IO functions). | 167 | The kernel will automatically wrap in generic routines for undefined function |
173 | 168 | pointers in the machvec at boot time, as machvec functions are referenced | |
174 | There are three ways in which IO can be performed: | 169 | unconditionally throughout most of the tree. Some boards have incredibly |
175 | - none at all. This is really only useful for the 'unknown' machine type, | 170 | sparse machvecs (such as the dreamcast and sh03), whereas others must define |
176 | which us designed to run on a machine about which we know nothing, and | 171 | virtually everything (rts7751r2d). |
177 | so all all IO instructions do nothing. | 172 | |
178 | - fully custom. In this case all IO functions go to a machine specific | 173 | Adding a new machine is relatively trivial (using vapor as an example): |
179 | set of functions which can do what they like | 174 | |
180 | - a generic set of functions. These will cope with most situations, | 175 | If the board-specific definitions are quite minimalistic, as is the case for |
181 | and rely on a single function, mv_port2addr, which is called through the | 176 | the vast majority of boards, simply having a single board-specific header is |
182 | machine vector, and converts an IO address into a memory address, which | 177 | sufficient. |
183 | can be read from/written to directly. | 178 | |
184 | 179 | - add a new file include/asm-sh/vapor.h which contains prototypes for | |
185 | Thus adding a new machine involves the following steps (I will assume I am | ||
186 | adding a machine called vapor): | ||
187 | |||
188 | - add a new file include/asm-sh/vapor/io.h which contains prototypes for | ||
189 | any machine specific IO functions prefixed with the machine name, for | 180 | any machine specific IO functions prefixed with the machine name, for |
190 | example vapor_inb. These will be needed when filling out the machine | 181 | example vapor_inb. These will be needed when filling out the machine |
191 | vector. | 182 | vector. |
192 | 183 | ||
193 | This is the minimum that is required, however there are ample | 184 | Note that these prototypes are generated automatically by setting |
194 | opportunities to optimise this. In particular, by making the prototypes | 185 | __IO_PREFIX to something sensible. A typical example would be: |
195 | inline function definitions, it is possible to inline the function when | 186 | |
196 | building machine specific versions. Note that the machine vector | 187 | #define __IO_PREFIX vapor |
197 | functions will still be needed, so that a module built for a generic | 188 | #include <asm/io_generic.h> |
198 | setup can be loaded. | 189 | |
199 | 190 | somewhere in the board-specific header. Any boards being ported that still | |
200 | - add a new file arch/sh/boards/vapor/mach.c. This contains the definition | 191 | have a legacy io.h should remove it entirely and switch to the new model. |
201 | of the machine vector. When building the machine specific version, this | 192 | |
202 | will be the real machine vector (via an alias), while in the generic | 193 | - Add machine vector definitions to the board's setup.c. At a bare minimum, |
203 | version is used to initialise the machine vector, and then freed, by | 194 | this must be defined as something like: |
204 | making it initdata. This should be defined as: | 195 | |
205 | 196 | struct sh_machine_vector mv_vapor __initmv = { | |
206 | struct sh_machine_vector mv_vapor __initmv = { | 197 | .mv_name = "vapor", |
207 | .mv_name = "vapor", | 198 | }; |
208 | } | 199 | ALIAS_MV(vapor) |
209 | ALIAS_MV(vapor) | 200 | |
210 | 201 | - finally add a file arch/sh/boards/vapor/io.c, which contains definitions of | |
211 | - finally add a file arch/sh/boards/vapor/io.c, which contains | 202 | the machine specific io functions (if there are enough to warrant it). |
212 | definitions of the machine specific io functions. | ||
213 | |||
214 | A note about initialisation functions. Three initialisation functions are | ||
215 | provided in the machine vector: | ||
216 | - mv_arch_init - called very early on from setup_arch | ||
217 | - mv_init_irq - called from init_IRQ, after the generic SH interrupt | ||
218 | initialisation | ||
219 | - mv_init_pci - currently not used | ||
220 | |||
221 | Any other remaining functions which need to be called at start up can be | ||
222 | added to the list using the __initcalls macro (or module_init if the code | ||
223 | can be built as a module). Many generic drivers probe to see if the device | ||
224 | they are targeting is present, however this may not always be appropriate, | ||
225 | so a flag can be added to the machine vector which will be set on those | ||
226 | machines which have the hardware in question, reducing the probe to a | ||
227 | single conditional. | ||
228 | 203 | ||
229 | 3. Hooking into the Build System | 204 | 3. Hooking into the Build System |
230 | ================================ | 205 | ================================ |
@@ -303,4 +278,3 @@ which will in turn copy the defconfig for this board, run it through | |||
303 | oldconfig (prompting you for any new options since the time of creation), | 278 | oldconfig (prompting you for any new options since the time of creation), |
304 | and start you on your way to having a functional kernel for your new | 279 | and start you on your way to having a functional kernel for your new |
305 | board. | 280 | board. |
306 | |||
diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.txt new file mode 100644 index 000000000000..a6719f2f6594 --- /dev/null +++ b/Documentation/sh/register-banks.txt | |||
@@ -0,0 +1,33 @@ | |||
1 | Notes on register bank usage in the kernel | ||
2 | ========================================== | ||
3 | |||
4 | Introduction | ||
5 | ------------ | ||
6 | |||
7 | The SH-3 and SH-4 CPU families traditionally include a single partial register | ||
8 | bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families | ||
9 | may have more full-featured banking or simply no such capabilities at all. | ||
10 | |||
11 | SR.RB banking | ||
12 | ------------- | ||
13 | |||
14 | In the case of this type of banking, banked registers are mapped directly to | ||
15 | r0 ... r7 if SR.RB is set to the bank we are interested in, otherwise ldc/stc | ||
16 | can still be used to reference the banked registers (as r0_bank ... r7_bank) | ||
17 | when in the context of another bank. The developer must keep the SR.RB value | ||
18 | in mind when writing code that utilizes these banked registers, for obvious | ||
19 | reasons. Userspace is also not able to poke at the bank1 values, so these can | ||
20 | be used rather effectively as scratch registers by the kernel. | ||
21 | |||
22 | Presently the kernel uses several of these registers. | ||
23 | |||
24 | - r0_bank, r1_bank (referenced as k0 and k1, used for scratch | ||
25 | registers when doing exception handling). | ||
26 | - r2_bank (used to track the EXPEVT/INTEVT code) | ||
27 | - Used by do_IRQ() and friends for doing irq mapping based off | ||
28 | of the interrupt exception vector jump table offset | ||
29 | - r6_bank (global interrupt mask) | ||
30 | - The SR.IMASK interrupt handler makes use of this to set the | ||
31 | interrupt priority level (used by local_irq_enable()) | ||
32 | - r7_bank (current) | ||
33 | |||
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index f61af23dd85d..e6b57dd46a4f 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -758,6 +758,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
758 | position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size) | 758 | position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size) |
759 | single_cmd - Use single immediate commands to communicate with | 759 | single_cmd - Use single immediate commands to communicate with |
760 | codecs (for debugging only) | 760 | codecs (for debugging only) |
761 | disable_msi - Disable Message Signaled Interrupt (MSI) | ||
761 | 762 | ||
762 | This module supports one card and autoprobe. | 763 | This module supports one card and autoprobe. |
763 | 764 | ||
@@ -778,11 +779,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
778 | 6stack-digout 6-jack with a SPDIF out | 779 | 6stack-digout 6-jack with a SPDIF out |
779 | w810 3-jack | 780 | w810 3-jack |
780 | z71v 3-jack (HP shared SPDIF) | 781 | z71v 3-jack (HP shared SPDIF) |
781 | asus 3-jack | 782 | asus 3-jack (ASUS Mobo) |
783 | asus-w1v ASUS W1V | ||
784 | asus-dig ASUS with SPDIF out | ||
785 | asus-dig2 ASUS with SPDIF out (using GPIO2) | ||
782 | uniwill 3-jack | 786 | uniwill 3-jack |
783 | F1734 2-jack | 787 | F1734 2-jack |
784 | lg LG laptop (m1 express dual) | 788 | lg LG laptop (m1 express dual) |
785 | lg-lw LG LW20 laptop | 789 | lg-lw LG LW20/LW25 laptop |
790 | tcl TCL S700 | ||
791 | clevo Clevo laptops (m520G, m665n) | ||
786 | test for testing/debugging purpose, almost all controls can be | 792 | test for testing/debugging purpose, almost all controls can be |
787 | adjusted. Appearing only when compiled with | 793 | adjusted. Appearing only when compiled with |
788 | $CONFIG_SND_DEBUG=y | 794 | $CONFIG_SND_DEBUG=y |
@@ -790,6 +796,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
790 | 796 | ||
791 | ALC260 | 797 | ALC260 |
792 | hp HP machines | 798 | hp HP machines |
799 | hp-3013 HP machines (3013-variant) | ||
793 | fujitsu Fujitsu S7020 | 800 | fujitsu Fujitsu S7020 |
794 | acer Acer TravelMate | 801 | acer Acer TravelMate |
795 | basic fixed pin assignment (old default model) | 802 | basic fixed pin assignment (old default model) |
@@ -797,24 +804,32 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
797 | 804 | ||
798 | ALC262 | 805 | ALC262 |
799 | fujitsu Fujitsu Laptop | 806 | fujitsu Fujitsu Laptop |
807 | hp-bpc HP xw4400/6400/8400/9400 laptops | ||
808 | benq Benq ED8 | ||
800 | basic fixed pin assignment w/o SPDIF | 809 | basic fixed pin assignment w/o SPDIF |
801 | auto auto-config reading BIOS (default) | 810 | auto auto-config reading BIOS (default) |
802 | 811 | ||
803 | ALC882/885 | 812 | ALC882/885 |
804 | 3stack-dig 3-jack with SPDIF I/O | 813 | 3stack-dig 3-jack with SPDIF I/O |
805 | 6stck-dig 6-jack digital with SPDIF I/O | 814 | 6stck-dig 6-jack digital with SPDIF I/O |
815 | arima Arima W820Di1 | ||
806 | auto auto-config reading BIOS (default) | 816 | auto auto-config reading BIOS (default) |
807 | 817 | ||
808 | ALC883/888 | 818 | ALC883/888 |
809 | 3stack-dig 3-jack with SPDIF I/O | 819 | 3stack-dig 3-jack with SPDIF I/O |
810 | 6stack-dig 6-jack digital with SPDIF I/O | 820 | 6stack-dig 6-jack digital with SPDIF I/O |
811 | 6stack-dig-demo 6-stack digital for Intel demo board | 821 | 3stack-6ch 3-jack 6-channel |
822 | 3stack-6ch-dig 3-jack 6-channel with SPDIF I/O | ||
823 | 6stack-dig-demo 6-jack digital for Intel demo board | ||
824 | acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc) | ||
812 | auto auto-config reading BIOS (default) | 825 | auto auto-config reading BIOS (default) |
813 | 826 | ||
814 | ALC861/660 | 827 | ALC861/660 |
815 | 3stack 3-jack | 828 | 3stack 3-jack |
816 | 3stack-dig 3-jack with SPDIF I/O | 829 | 3stack-dig 3-jack with SPDIF I/O |
817 | 6stack-dig 6-jack with SPDIF I/O | 830 | 6stack-dig 6-jack with SPDIF I/O |
831 | 3stack-660 3-jack (for ALC660) | ||
832 | uniwill-m31 Uniwill M31 laptop | ||
818 | auto auto-config reading BIOS (default) | 833 | auto auto-config reading BIOS (default) |
819 | 834 | ||
820 | CMI9880 | 835 | CMI9880 |
@@ -843,10 +858,21 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
843 | 3stack-dig ditto with SPDIF | 858 | 3stack-dig ditto with SPDIF |
844 | laptop 3-jack with hp-jack automute | 859 | laptop 3-jack with hp-jack automute |
845 | laptop-dig ditto with SPDIF | 860 | laptop-dig ditto with SPDIF |
846 | auto auto-confgi reading BIOS (default) | 861 | auto auto-config reading BIOS (default) |
862 | |||
863 | STAC9200/9205/9220/9221/9254 | ||
864 | ref Reference board | ||
865 | 3stack D945 3stack | ||
866 | 5stack D945 5stack + SPDIF | ||
847 | 867 | ||
848 | STAC7661(?) | 868 | STAC9227/9228/9229/927x |
869 | ref Reference board | ||
870 | 3stack D965 3stack | ||
871 | 5stack D965 5stack + SPDIF | ||
872 | |||
873 | STAC9872 | ||
849 | vaio Setup for VAIO FE550G/SZ110 | 874 | vaio Setup for VAIO FE550G/SZ110 |
875 | vaio-ar Setup for VAIO AR | ||
850 | 876 | ||
851 | If the default configuration doesn't work and one of the above | 877 | If the default configuration doesn't work and one of the above |
852 | matches with your device, report it together with the PCI | 878 | matches with your device, report it together with the PCI |
@@ -1213,6 +1239,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1213 | 1239 | ||
1214 | Module supports only 1 card. This module has no enable option. | 1240 | Module supports only 1 card. This module has no enable option. |
1215 | 1241 | ||
1242 | Module snd-mts64 | ||
1243 | ---------------- | ||
1244 | |||
1245 | Module for Ego Systems (ESI) Miditerminal 4140 | ||
1246 | |||
1247 | This module supports multiple devices. | ||
1248 | Requires parport (CONFIG_PARPORT). | ||
1249 | |||
1216 | Module snd-nm256 | 1250 | Module snd-nm256 |
1217 | ---------------- | 1251 | ---------------- |
1218 | 1252 | ||
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index b8dc51ca776c..4807ef79a94d 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -1054,9 +1054,8 @@ | |||
1054 | 1054 | ||
1055 | <para> | 1055 | <para> |
1056 | For a device which allows hotplugging, you can use | 1056 | For a device which allows hotplugging, you can use |
1057 | <function>snd_card_free_in_thread</function>. This one will | 1057 | <function>snd_card_free_when_closed</function>. This one will |
1058 | postpone the destruction and wait in a kernel-thread until all | 1058 | postpone the destruction until all devices are closed. |
1059 | devices are closed. | ||
1060 | </para> | 1059 | </para> |
1061 | 1060 | ||
1062 | </section> | 1061 | </section> |
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt index 5a311c38dd1a..f9c99c9a54f9 100644 --- a/Documentation/sparse.txt +++ b/Documentation/sparse.txt | |||
@@ -69,10 +69,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to | |||
69 | be recompiled or not. The latter is a fast way to check the whole tree if you | 69 | be recompiled or not. The latter is a fast way to check the whole tree if you |
70 | have already built it. | 70 | have already built it. |
71 | 71 | ||
72 | The optional make variable CF can be used to pass arguments to sparse. The | 72 | The optional make variable CHECKFLAGS can be used to pass arguments to sparse. |
73 | build system passes -Wbitwise to sparse automatically. To perform endianness | 73 | The build system passes -Wbitwise to sparse automatically. To perform |
74 | checks, you may define __CHECK_ENDIAN__: | 74 | endianness checks, you may define __CHECK_ENDIAN__: |
75 | 75 | ||
76 | make C=2 CF="-D__CHECK_ENDIAN__" | 76 | make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__" |
77 | 77 | ||
78 | These checks are disabled by default as they generate a host of warnings. | 78 | These checks are disabled by default as they generate a host of warnings. |
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index 7cee90223d3a..20d0d797f539 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -29,6 +29,7 @@ Currently, these files are in /proc/sys/vm: | |||
29 | - drop-caches | 29 | - drop-caches |
30 | - zone_reclaim_mode | 30 | - zone_reclaim_mode |
31 | - min_unmapped_ratio | 31 | - min_unmapped_ratio |
32 | - min_slab_ratio | ||
32 | - panic_on_oom | 33 | - panic_on_oom |
33 | 34 | ||
34 | ============================================================== | 35 | ============================================================== |
@@ -138,7 +139,6 @@ This is value ORed together of | |||
138 | 1 = Zone reclaim on | 139 | 1 = Zone reclaim on |
139 | 2 = Zone reclaim writes dirty pages out | 140 | 2 = Zone reclaim writes dirty pages out |
140 | 4 = Zone reclaim swaps pages | 141 | 4 = Zone reclaim swaps pages |
141 | 8 = Also do a global slab reclaim pass | ||
142 | 142 | ||
143 | zone_reclaim_mode is set during bootup to 1 if it is determined that pages | 143 | zone_reclaim_mode is set during bootup to 1 if it is determined that pages |
144 | from remote zones will cause a measurable performance reduction. The | 144 | from remote zones will cause a measurable performance reduction. The |
@@ -162,18 +162,13 @@ Allowing regular swap effectively restricts allocations to the local | |||
162 | node unless explicitly overridden by memory policies or cpuset | 162 | node unless explicitly overridden by memory policies or cpuset |
163 | configurations. | 163 | configurations. |
164 | 164 | ||
165 | It may be advisable to allow slab reclaim if the system makes heavy | ||
166 | use of files and builds up large slab caches. However, the slab | ||
167 | shrink operation is global, may take a long time and free slabs | ||
168 | in all nodes of the system. | ||
169 | |||
170 | ============================================================= | 165 | ============================================================= |
171 | 166 | ||
172 | min_unmapped_ratio: | 167 | min_unmapped_ratio: |
173 | 168 | ||
174 | This is available only on NUMA kernels. | 169 | This is available only on NUMA kernels. |
175 | 170 | ||
176 | A percentage of the file backed pages in each zone. Zone reclaim will only | 171 | A percentage of the total pages in each zone. Zone reclaim will only |
177 | occur if more than this percentage of pages are file backed and unmapped. | 172 | occur if more than this percentage of pages are file backed and unmapped. |
178 | This is to insure that a minimal amount of local pages is still available for | 173 | This is to insure that a minimal amount of local pages is still available for |
179 | file I/O even if the node is overallocated. | 174 | file I/O even if the node is overallocated. |
@@ -182,6 +177,24 @@ The default is 1 percent. | |||
182 | 177 | ||
183 | ============================================================= | 178 | ============================================================= |
184 | 179 | ||
180 | min_slab_ratio: | ||
181 | |||
182 | This is available only on NUMA kernels. | ||
183 | |||
184 | A percentage of the total pages in each zone. On Zone reclaim | ||
185 | (fallback from the local zone occurs) slabs will be reclaimed if more | ||
186 | than this percentage of pages in a zone are reclaimable slab pages. | ||
187 | This insures that the slab growth stays under control even in NUMA | ||
188 | systems that rarely perform global reclaim. | ||
189 | |||
190 | The default is 5 percent. | ||
191 | |||
192 | Note that slab reclaim is triggered in a per zone / node fashion. | ||
193 | The process of reclaiming slab memory is currently not node specific | ||
194 | and may not be fast. | ||
195 | |||
196 | ============================================================= | ||
197 | |||
185 | panic_on_oom | 198 | panic_on_oom |
186 | 199 | ||
187 | This enables or disables panic on out-of-memory feature. If this is set to 1, | 200 | This enables or disables panic on out-of-memory feature. If this is set to 1, |
diff --git a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt index 867f4c38f356..39c68f8c4e6c 100644 --- a/Documentation/usb/error-codes.txt +++ b/Documentation/usb/error-codes.txt | |||
@@ -98,13 +98,13 @@ one or more packets could finish before an error stops further endpoint I/O. | |||
98 | error, a failure to respond (often caused by | 98 | error, a failure to respond (often caused by |
99 | device disconnect), or some other fault. | 99 | device disconnect), or some other fault. |
100 | 100 | ||
101 | -ETIMEDOUT (**) No response packet received within the prescribed | 101 | -ETIME (**) No response packet received within the prescribed |
102 | bus turn-around time. This error may instead be | 102 | bus turn-around time. This error may instead be |
103 | reported as -EPROTO or -EILSEQ. | 103 | reported as -EPROTO or -EILSEQ. |
104 | 104 | ||
105 | Note that the synchronous USB message functions | 105 | -ETIMEDOUT Synchronous USB message functions use this code |
106 | also use this code to indicate timeout expired | 106 | to indicate timeout expired before the transfer |
107 | before the transfer completed. | 107 | completed, and no other error was reported by HC. |
108 | 108 | ||
109 | -EPIPE (**) Endpoint stalled. For non-control endpoints, | 109 | -EPIPE (**) Endpoint stalled. For non-control endpoints, |
110 | reset this status with usb_clear_halt(). | 110 | reset this status with usb_clear_halt(). |
@@ -163,6 +163,3 @@ usb_get_*/usb_set_*(): | |||
163 | usb_control_msg(): | 163 | usb_control_msg(): |
164 | usb_bulk_msg(): | 164 | usb_bulk_msg(): |
165 | -ETIMEDOUT Timeout expired before the transfer completed. | 165 | -ETIMEDOUT Timeout expired before the transfer completed. |
166 | In the future this code may change to -ETIME, | ||
167 | whose definition is a closer match to this sort | ||
168 | of error. | ||
diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt index 02b0f7beb6d1..a2dee6e6190d 100644 --- a/Documentation/usb/usb-serial.txt +++ b/Documentation/usb/usb-serial.txt | |||
@@ -433,6 +433,11 @@ Options supported: | |||
433 | See http://www.uuhaus.de/linux/palmconnect.html for up-to-date | 433 | See http://www.uuhaus.de/linux/palmconnect.html for up-to-date |
434 | information on this driver. | 434 | information on this driver. |
435 | 435 | ||
436 | AIRcable USB Dongle Bluetooth driver | ||
437 | If there is the cdc_acm driver loaded in the system, you will find that the | ||
438 | cdc_acm claims the device before AIRcable can. This is simply corrected | ||
439 | by unloading both modules and then loading the aircable module before | ||
440 | cdc_acm module | ||
436 | 441 | ||
437 | Generic Serial driver | 442 | Generic Serial driver |
438 | 443 | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 00d9a1f2a54c..669a09aa5bb4 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -7,10 +7,10 @@ | |||
7 | 6 -> AverTV Studio 303 (M126) [1461:000b] | 7 | 6 -> AverTV Studio 303 (M126) [1461:000b] |
8 | 7 -> MSI TV-@nywhere Master [1462:8606] | 8 | 7 -> MSI TV-@nywhere Master [1462:8606] |
9 | 8 -> Leadtek Winfast DV2000 [107d:6620] | 9 | 8 -> Leadtek Winfast DV2000 [107d:6620] |
10 | 9 -> Leadtek PVR 2000 [107d:663b,107d:663C] | 10 | 9 -> Leadtek PVR 2000 [107d:663b,107d:663c,107d:6632] |
11 | 10 -> IODATA GV-VCP3/PCI [10fc:d003] | 11 | 10 -> IODATA GV-VCP3/PCI [10fc:d003] |
12 | 11 -> Prolink PlayTV PVR | 12 | 11 -> Prolink PlayTV PVR |
13 | 12 -> ASUS PVR-416 [1043:4823] | 13 | 12 -> ASUS PVR-416 [1043:4823,1461:c111] |
14 | 13 -> MSI TV-@nywhere | 14 | 13 -> MSI TV-@nywhere |
15 | 14 -> KWorld/VStream XPert DVB-T [17de:08a6] | 15 | 14 -> KWorld/VStream XPert DVB-T [17de:08a6] |
16 | 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00] | 16 | 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00] |
@@ -51,3 +51,7 @@ | |||
51 | 50 -> NPG Tech Real TV FM Top 10 [14f1:0842] | 51 | 50 -> NPG Tech Real TV FM Top 10 [14f1:0842] |
52 | 51 -> WinFast DTV2000 H [107d:665e] | 52 | 51 -> WinFast DTV2000 H [107d:665e] |
53 | 52 -> Geniatech DVB-S [14f1:0084] | 53 | 52 -> Geniatech DVB-S [14f1:0084] |
54 | 53 -> Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T [0070:1404] | ||
55 | 54 -> Norwood Micro TV Tuner | ||
56 | 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] | ||
57 | 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder [0070:9600,0070:9601,0070:9602] | ||
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 9068b669f5ee..94cf695b1378 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -58,7 +58,7 @@ | |||
58 | 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] | 58 | 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] |
59 | 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370] | 59 | 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370] |
60 | 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 | 60 | 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 |
61 | 60 -> LifeView/Typhoon FlyDVB-T Duo Cardbus [5168:0502,4e42:0502] | 61 | 60 -> LifeView/Typhoon/Genius FlyDVB-T Duo Cardbus [5168:0502,4e42:0502,1489:0502] |
62 | 61 -> Philips TOUGH DVB-T reference design [1131:2004] | 62 | 61 -> Philips TOUGH DVB-T reference design [1131:2004] |
63 | 62 -> Compro VideoMate TV Gold+II | 63 | 62 -> Compro VideoMate TV Gold+II |
64 | 63 -> Kworld Xpert TV PVR7134 | 64 | 63 -> Kworld Xpert TV PVR7134 |
@@ -83,7 +83,7 @@ | |||
83 | 82 -> MSI TV@Anywhere plus [1462:6231] | 83 | 82 -> MSI TV@Anywhere plus [1462:6231] |
84 | 83 -> Terratec Cinergy 250 PCI TV [153b:1160] | 84 | 83 -> Terratec Cinergy 250 PCI TV [153b:1160] |
85 | 84 -> LifeView FlyDVB Trio [5168:0319] | 85 | 84 -> LifeView FlyDVB Trio [5168:0319] |
86 | 85 -> AverTV DVB-T 777 [1461:2c05] | 86 | 85 -> AverTV DVB-T 777 [1461:2c05,1461:2c05] |
87 | 86 -> LifeView FlyDVB-T / Genius VideoWonder DVB-T [5168:0301,1489:0301] | 87 | 86 -> LifeView FlyDVB-T / Genius VideoWonder DVB-T [5168:0301,1489:0301] |
88 | 87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421] | 88 | 87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421] |
89 | 88 -> Tevion/KWorld DVB-T 220RF [17de:7201] | 89 | 88 -> Tevion/KWorld DVB-T 220RF [17de:7201] |
@@ -94,3 +94,6 @@ | |||
94 | 93 -> Medion 7134 Bridge #2 [16be:0005] | 94 | 93 -> Medion 7134 Bridge #2 [16be:0005] |
95 | 94 -> LifeView FlyDVB-T Hybrid Cardbus [5168:3306,5168:3502] | 95 | 94 -> LifeView FlyDVB-T Hybrid Cardbus [5168:3306,5168:3502] |
96 | 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138] | 96 | 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138] |
97 | 96 -> Medion Md8800 Quadro [16be:0007,16be:0008] | ||
98 | 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300] | ||
99 | 98 -> Proteus Pro 2309 [0919:2003] | ||
diff --git a/Documentation/video4linux/bttv/Insmod-options b/Documentation/video4linux/bttv/Insmod-options index fc94ff235ffa..bb7c2cac7917 100644 --- a/Documentation/video4linux/bttv/Insmod-options +++ b/Documentation/video4linux/bttv/Insmod-options | |||
@@ -54,6 +54,12 @@ bttv.o | |||
54 | dropouts. | 54 | dropouts. |
55 | chroma_agc=0/1 AGC of chroma signal, off by default. | 55 | chroma_agc=0/1 AGC of chroma signal, off by default. |
56 | adc_crush=0/1 Luminance ADC crush, on by default. | 56 | adc_crush=0/1 Luminance ADC crush, on by default. |
57 | i2c_udelay= Allow reduce I2C speed. Default is 5 usecs | ||
58 | (meaning 66,67 Kbps). The default is the | ||
59 | maximum supported speed by kernel bitbang | ||
60 | algoritm. You may use lower numbers, if I2C | ||
61 | messages are lost (16 is known to work on | ||
62 | all supported cards). | ||
57 | 63 | ||
58 | bttv_gpio=0/1 | 64 | bttv_gpio=0/1 |
59 | gpiomask= | 65 | gpiomask= |
diff --git a/Documentation/video4linux/cx2341x/README.hm12 b/Documentation/video4linux/cx2341x/README.hm12 new file mode 100644 index 000000000000..0e213ed095e6 --- /dev/null +++ b/Documentation/video4linux/cx2341x/README.hm12 | |||
@@ -0,0 +1,116 @@ | |||
1 | The cx23416 can produce (and the cx23415 can also read) raw YUV output. The | ||
2 | format of a YUV frame is specific to this chip and is called HM12. 'HM' stands | ||
3 | for 'Hauppauge Macroblock', which is a misnomer as 'Conexant Macroblock' would | ||
4 | be more accurate. | ||
5 | |||
6 | The format is YUV 4:2:0 which uses 1 Y byte per pixel and 1 U and V byte per | ||
7 | four pixels. | ||
8 | |||
9 | The data is encoded as two macroblock planes, the first containing the Y | ||
10 | values, the second containing UV macroblocks. | ||
11 | |||
12 | The Y plane is divided into blocks of 16x16 pixels from left to right | ||
13 | and from top to bottom. Each block is transmitted in turn, line-by-line. | ||
14 | |||
15 | So the first 16 bytes are the first line of the top-left block, the | ||
16 | second 16 bytes are the second line of the top-left block, etc. After | ||
17 | transmitting this block the first line of the block on the right to the | ||
18 | first block is transmitted, etc. | ||
19 | |||
20 | The UV plane is divided into blocks of 16x8 UV values going from left | ||
21 | to right, top to bottom. Each block is transmitted in turn, line-by-line. | ||
22 | |||
23 | So the first 16 bytes are the first line of the top-left block and | ||
24 | contain 8 UV value pairs (16 bytes in total). The second 16 bytes are the | ||
25 | second line of 8 UV pairs of the top-left block, etc. After transmitting | ||
26 | this block the first line of the block on the right to the first block is | ||
27 | transmitted, etc. | ||
28 | |||
29 | The code below is given as an example on how to convert HM12 to separate | ||
30 | Y, U and V planes. This code assumes frames of 720x576 (PAL) pixels. | ||
31 | |||
32 | The width of a frame is always 720 pixels, regardless of the actual specified | ||
33 | width. | ||
34 | |||
35 | -------------------------------------------------------------------------- | ||
36 | |||
37 | #include <stdio.h> | ||
38 | #include <stdlib.h> | ||
39 | #include <string.h> | ||
40 | |||
41 | static unsigned char frame[576*720*3/2]; | ||
42 | static unsigned char framey[576*720]; | ||
43 | static unsigned char frameu[576*720 / 4]; | ||
44 | static unsigned char framev[576*720 / 4]; | ||
45 | |||
46 | static void de_macro_y(unsigned char* dst, unsigned char *src, int dstride, int w, int h) | ||
47 | { | ||
48 | unsigned int y, x, i; | ||
49 | |||
50 | // descramble Y plane | ||
51 | // dstride = 720 = w | ||
52 | // The Y plane is divided into blocks of 16x16 pixels | ||
53 | // Each block in transmitted in turn, line-by-line. | ||
54 | for (y = 0; y < h; y += 16) { | ||
55 | for (x = 0; x < w; x += 16) { | ||
56 | for (i = 0; i < 16; i++) { | ||
57 | memcpy(dst + x + (y + i) * dstride, src, 16); | ||
58 | src += 16; | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | |||
64 | static void de_macro_uv(unsigned char *dstu, unsigned char *dstv, unsigned char *src, int dstride, int w, int h) | ||
65 | { | ||
66 | unsigned int y, x, i; | ||
67 | |||
68 | // descramble U/V plane | ||
69 | // dstride = 720 / 2 = w | ||
70 | // The U/V values are interlaced (UVUV...). | ||
71 | // Again, the UV plane is divided into blocks of 16x16 UV values. | ||
72 | // Each block in transmitted in turn, line-by-line. | ||
73 | for (y = 0; y < h; y += 16) { | ||
74 | for (x = 0; x < w; x += 8) { | ||
75 | for (i = 0; i < 16; i++) { | ||
76 | int idx = x + (y + i) * dstride; | ||
77 | |||
78 | dstu[idx+0] = src[0]; dstv[idx+0] = src[1]; | ||
79 | dstu[idx+1] = src[2]; dstv[idx+1] = src[3]; | ||
80 | dstu[idx+2] = src[4]; dstv[idx+2] = src[5]; | ||
81 | dstu[idx+3] = src[6]; dstv[idx+3] = src[7]; | ||
82 | dstu[idx+4] = src[8]; dstv[idx+4] = src[9]; | ||
83 | dstu[idx+5] = src[10]; dstv[idx+5] = src[11]; | ||
84 | dstu[idx+6] = src[12]; dstv[idx+6] = src[13]; | ||
85 | dstu[idx+7] = src[14]; dstv[idx+7] = src[15]; | ||
86 | src += 16; | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /*************************************************************************/ | ||
93 | int main(int argc, char **argv) | ||
94 | { | ||
95 | FILE *fin; | ||
96 | int i; | ||
97 | |||
98 | if (argc == 1) fin = stdin; | ||
99 | else fin = fopen(argv[1], "r"); | ||
100 | |||
101 | if (fin == NULL) { | ||
102 | fprintf(stderr, "cannot open input\n"); | ||
103 | exit(-1); | ||
104 | } | ||
105 | while (fread(frame, sizeof(frame), 1, fin) == 1) { | ||
106 | de_macro_y(framey, frame, 720, 720, 576); | ||
107 | de_macro_uv(frameu, framev, frame + 720 * 576, 720 / 2, 720 / 2, 576 / 2); | ||
108 | fwrite(framey, sizeof(framey), 1, stdout); | ||
109 | fwrite(framev, sizeof(framev), 1, stdout); | ||
110 | fwrite(frameu, sizeof(frameu), 1, stdout); | ||
111 | } | ||
112 | fclose(fin); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | -------------------------------------------------------------------------- | ||
diff --git a/Documentation/video4linux/cx2341x/README.vbi b/Documentation/video4linux/cx2341x/README.vbi new file mode 100644 index 000000000000..5807cf156173 --- /dev/null +++ b/Documentation/video4linux/cx2341x/README.vbi | |||
@@ -0,0 +1,45 @@ | |||
1 | |||
2 | Format of embedded V4L2_MPEG_STREAM_VBI_FMT_IVTV VBI data | ||
3 | ========================================================= | ||
4 | |||
5 | This document describes the V4L2_MPEG_STREAM_VBI_FMT_IVTV format of the VBI data | ||
6 | embedded in an MPEG-2 program stream. This format is in part dictated by some | ||
7 | hardware limitations of the ivtv driver (the driver for the Conexant cx23415/6 | ||
8 | chips), in particular a maximum size for the VBI data. Anything longer is cut | ||
9 | off when the MPEG stream is played back through the cx23415. | ||
10 | |||
11 | The advantage of this format is it is very compact and that all VBI data for | ||
12 | all lines can be stored while still fitting within the maximum allowed size. | ||
13 | |||
14 | The stream ID of the VBI data is 0xBD. The maximum size of the embedded data is | ||
15 | 4 + 43 * 36, which is 4 bytes for a header and 2 * 18 VBI lines with a 1 byte | ||
16 | header and a 42 bytes payload each. Anything beyond this limit is cut off by | ||
17 | the cx23415/6 firmware. Besides the data for the VBI lines we also need 36 bits | ||
18 | for a bitmask determining which lines are captured and 4 bytes for a magic cookie, | ||
19 | signifying that this data package contains V4L2_MPEG_STREAM_VBI_FMT_IVTV VBI data. | ||
20 | If all lines are used, then there is no longer room for the bitmask. To solve this | ||
21 | two different magic numbers were introduced: | ||
22 | |||
23 | 'itv0': After this magic number two unsigned longs follow. Bits 0-17 of the first | ||
24 | unsigned long denote which lines of the first field are captured. Bits 18-31 of | ||
25 | the first unsigned long and bits 0-3 of the second unsigned long are used for the | ||
26 | second field. | ||
27 | |||
28 | 'ITV0': This magic number assumes all VBI lines are captured, i.e. it implicitly | ||
29 | implies that the bitmasks are 0xffffffff and 0xf. | ||
30 | |||
31 | After these magic cookies (and the 8 byte bitmask in case of cookie 'itv0') the | ||
32 | captured VBI lines start: | ||
33 | |||
34 | For each line the least significant 4 bits of the first byte contain the data type. | ||
35 | Possible values are shown in the table below. The payload is in the following 42 | ||
36 | bytes. | ||
37 | |||
38 | Here is the list of possible data types: | ||
39 | |||
40 | #define IVTV_SLICED_TYPE_TELETEXT 0x1 // Teletext (uses lines 6-22 for PAL) | ||
41 | #define IVTV_SLICED_TYPE_CC 0x4 // Closed Captions (line 21 NTSC) | ||
42 | #define IVTV_SLICED_TYPE_WSS 0x5 // Wide Screen Signal (line 23 PAL) | ||
43 | #define IVTV_SLICED_TYPE_VPS 0x7 // Video Programming System (PAL) (line 16) | ||
44 | |||
45 | Hans Verkuil <hverkuil@xs4all.nl> | ||
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index 6da24e7a56cb..74b77f9e91bc 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -199,6 +199,11 @@ IOMMU | |||
199 | allowed overwrite iommu off workarounds for specific chipsets. | 199 | allowed overwrite iommu off workarounds for specific chipsets. |
200 | soft Use software bounce buffering (default for Intel machines) | 200 | soft Use software bounce buffering (default for Intel machines) |
201 | noaperture Don't touch the aperture for AGP. | 201 | noaperture Don't touch the aperture for AGP. |
202 | allowdac Allow DMA >4GB | ||
203 | When off all DMA over >4GB is forced through an IOMMU or bounce | ||
204 | buffering. | ||
205 | nodac Forbid DMA >4GB | ||
206 | panic Always panic when IOMMU overflows | ||
202 | 207 | ||
203 | swiotlb=pages[,force] | 208 | swiotlb=pages[,force] |
204 | 209 | ||
@@ -245,6 +250,13 @@ Debugging | |||
245 | newfallback: use new unwinder but fall back to old if it gets | 250 | newfallback: use new unwinder but fall back to old if it gets |
246 | stuck (default) | 251 | stuck (default) |
247 | 252 | ||
253 | call_trace=[old|both|newfallback|new] | ||
254 | old: use old inexact backtracer | ||
255 | new: use new exact dwarf2 unwinder | ||
256 | both: print entries from both | ||
257 | newfallback: use new unwinder but fall back to old if it gets | ||
258 | stuck (default) | ||
259 | |||
248 | Misc | 260 | Misc |
249 | 261 | ||
250 | noreplacement Don't replace instructions with more appropriate ones | 262 | noreplacement Don't replace instructions with more appropriate ones |
diff --git a/Documentation/x86_64/kernel-stacks b/Documentation/x86_64/kernel-stacks new file mode 100644 index 000000000000..bddfddd466ab --- /dev/null +++ b/Documentation/x86_64/kernel-stacks | |||
@@ -0,0 +1,99 @@ | |||
1 | Most of the text from Keith Owens, hacked by AK | ||
2 | |||
3 | x86_64 page size (PAGE_SIZE) is 4K. | ||
4 | |||
5 | Like all other architectures, x86_64 has a kernel stack for every | ||
6 | active thread. These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big. | ||
7 | These stacks contain useful data as long as a thread is alive or a | ||
8 | zombie. While the thread is in user space the kernel stack is empty | ||
9 | except for the thread_info structure at the bottom. | ||
10 | |||
11 | In addition to the per thread stacks, there are specialized stacks | ||
12 | associated with each cpu. These stacks are only used while the kernel | ||
13 | is in control on that cpu, when a cpu returns to user space the | ||
14 | specialized stacks contain no useful data. The main cpu stacks is | ||
15 | |||
16 | * Interrupt stack. IRQSTACKSIZE | ||
17 | |||
18 | Used for external hardware interrupts. If this is the first external | ||
19 | hardware interrupt (i.e. not a nested hardware interrupt) then the | ||
20 | kernel switches from the current task to the interrupt stack. Like | ||
21 | the split thread and interrupt stacks on i386 (with CONFIG_4KSTACKS), | ||
22 | this gives more room for kernel interrupt processing without having | ||
23 | to increase the size of every per thread stack. | ||
24 | |||
25 | The interrupt stack is also used when processing a softirq. | ||
26 | |||
27 | Switching to the kernel interrupt stack is done by software based on a | ||
28 | per CPU interrupt nest counter. This is needed because x86-64 "IST" | ||
29 | hardware stacks cannot nest without races. | ||
30 | |||
31 | x86_64 also has a feature which is not available on i386, the ability | ||
32 | to automatically switch to a new stack for designated events such as | ||
33 | double fault or NMI, which makes it easier to handle these unusual | ||
34 | events on x86_64. This feature is called the Interrupt Stack Table | ||
35 | (IST). There can be up to 7 IST entries per cpu. The IST code is an | ||
36 | index into the Task State Segment (TSS), the IST entries in the TSS | ||
37 | point to dedicated stacks, each stack can be a different size. | ||
38 | |||
39 | An IST is selected by an non-zero value in the IST field of an | ||
40 | interrupt-gate descriptor. When an interrupt occurs and the hardware | ||
41 | loads such a descriptor, the hardware automatically sets the new stack | ||
42 | pointer based on the IST value, then invokes the interrupt handler. If | ||
43 | software wants to allow nested IST interrupts then the handler must | ||
44 | adjust the IST values on entry to and exit from the interrupt handler. | ||
45 | (this is occasionally done, e.g. for debug exceptions) | ||
46 | |||
47 | Events with different IST codes (i.e. with different stacks) can be | ||
48 | nested. For example, a debug interrupt can safely be interrupted by an | ||
49 | NMI. arch/x86_64/kernel/entry.S::paranoidentry adjusts the stack | ||
50 | pointers on entry to and exit from all IST events, in theory allowing | ||
51 | IST events with the same code to be nested. However in most cases, the | ||
52 | stack size allocated to an IST assumes no nesting for the same code. | ||
53 | If that assumption is ever broken then the stacks will become corrupt. | ||
54 | |||
55 | The currently assigned IST stacks are :- | ||
56 | |||
57 | * STACKFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE). | ||
58 | |||
59 | Used for interrupt 12 - Stack Fault Exception (#SS). | ||
60 | |||
61 | This allows to recover from invalid stack segments. Rarely | ||
62 | happens. | ||
63 | |||
64 | * DOUBLEFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE). | ||
65 | |||
66 | Used for interrupt 8 - Double Fault Exception (#DF). | ||
67 | |||
68 | Invoked when handling a exception causes another exception. Happens | ||
69 | when the kernel is very confused (e.g. kernel stack pointer corrupt) | ||
70 | Using a separate stack allows to recover from it well enough in many | ||
71 | cases to still output an oops. | ||
72 | |||
73 | * NMI_STACK. EXCEPTION_STKSZ (PAGE_SIZE). | ||
74 | |||
75 | Used for non-maskable interrupts (NMI). | ||
76 | |||
77 | NMI can be delivered at any time, including when the kernel is in the | ||
78 | middle of switching stacks. Using IST for NMI events avoids making | ||
79 | assumptions about the previous state of the kernel stack. | ||
80 | |||
81 | * DEBUG_STACK. DEBUG_STKSZ | ||
82 | |||
83 | Used for hardware debug interrupts (interrupt 1) and for software | ||
84 | debug interrupts (INT3). | ||
85 | |||
86 | When debugging a kernel, debug interrupts (both hardware and | ||
87 | software) can occur at any time. Using IST for these interrupts | ||
88 | avoids making assumptions about the previous state of the kernel | ||
89 | stack. | ||
90 | |||
91 | * MCE_STACK. EXCEPTION_STKSZ (PAGE_SIZE). | ||
92 | |||
93 | Used for interrupt 18 - Machine Check Exception (#MC). | ||
94 | |||
95 | MCE can be delivered at any time, including when the kernel is in the | ||
96 | middle of switching stacks. Using IST for MCE events avoids making | ||
97 | assumptions about the previous state of the kernel stack. | ||
98 | |||
99 | For more details see the Intel IA32 or AMD AMD64 architecture manuals. | ||