aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/Changes31
-rw-r--r--Documentation/CodingStyle43
-rw-r--r--Documentation/DocBook/.gitignore6
-rw-r--r--Documentation/DocBook/kernel-api.tmpl6
-rw-r--r--Documentation/DocBook/kernel-locking.tmpl22
-rw-r--r--Documentation/DocBook/usb.tmpl1
-rw-r--r--Documentation/DocBook/videobook.tmpl4
-rw-r--r--Documentation/RCU/rcuref.txt87
-rw-r--r--Documentation/SubmittingDrivers24
-rw-r--r--Documentation/SubmittingPatches68
-rw-r--r--Documentation/applying-patches.txt81
-rw-r--r--Documentation/block/barrier.txt271
-rw-r--r--Documentation/block/biodoc.txt12
-rw-r--r--Documentation/block/stat.txt82
-rw-r--r--Documentation/cachetlb.txt2
-rw-r--r--Documentation/cpu-freq/governors.txt62
-rw-r--r--Documentation/cpu-hotplug.txt357
-rw-r--r--Documentation/cpusets.txt165
-rw-r--r--Documentation/drivers/edac/edac.txt673
-rw-r--r--Documentation/dvb/avermedia.txt3
-rw-r--r--Documentation/dvb/get_dvb_firmware23
-rw-r--r--Documentation/dvb/ttusb-dec.txt3
-rw-r--r--Documentation/fb/cyblafb/bugs1
-rw-r--r--Documentation/fb/cyblafb/fb.modes57
-rw-r--r--Documentation/fb/cyblafb/performance1
-rw-r--r--Documentation/fb/cyblafb/todo5
-rw-r--r--Documentation/fb/cyblafb/usage33
-rw-r--r--Documentation/fb/cyblafb/whatsnew29
-rw-r--r--Documentation/feature-removal-schedule.txt29
-rw-r--r--Documentation/filesystems/00-INDEX8
-rw-r--r--Documentation/filesystems/configfs/configfs.txt434
-rw-r--r--Documentation/filesystems/configfs/configfs_example.c474
-rw-r--r--Documentation/filesystems/dlmfs.txt130
-rw-r--r--Documentation/filesystems/ext3.txt181
-rw-r--r--Documentation/filesystems/fuse.txt63
-rw-r--r--Documentation/filesystems/ocfs2.txt55
-rw-r--r--Documentation/filesystems/proc.txt19
-rw-r--r--Documentation/filesystems/ramfs-rootfs-initramfs.txt72
-rw-r--r--Documentation/filesystems/relayfs.txt126
-rw-r--r--Documentation/filesystems/spufs.txt521
-rw-r--r--Documentation/filesystems/sysfs-pci.txt21
-rw-r--r--Documentation/filesystems/tmpfs.txt12
-rw-r--r--Documentation/filesystems/vfs.txt5
-rw-r--r--Documentation/hpet.txt2
-rw-r--r--Documentation/hrtimers.txt178
-rw-r--r--Documentation/hwmon/w83627hf19
-rw-r--r--Documentation/i2c/busses/i2c-nforce23
-rw-r--r--Documentation/i2c/busses/i2c-parport1
-rw-r--r--Documentation/i2c/porting-clients90
-rw-r--r--Documentation/i2c/writing-clients20
-rw-r--r--Documentation/i2o/ioctl2
-rw-r--r--Documentation/input/appletouch.txt5
-rw-r--r--Documentation/input/ff.txt2
-rw-r--r--Documentation/ioctl/hdio.txt2
-rw-r--r--Documentation/kbuild/makefiles.txt4
-rw-r--r--Documentation/kbuild/modules.txt66
-rw-r--r--Documentation/kdump/gdbmacros.txt22
-rw-r--r--Documentation/kdump/kdump.txt149
-rw-r--r--Documentation/kernel-parameters.txt93
-rw-r--r--Documentation/keys-request-key.txt22
-rw-r--r--Documentation/keys.txt61
-rw-r--r--Documentation/kprobes.txt3
-rw-r--r--Documentation/laptop-mode.txt8
-rw-r--r--Documentation/locks.txt17
-rw-r--r--Documentation/md.txt120
-rw-r--r--Documentation/mutex-design.txt135
-rw-r--r--Documentation/networking/bonding.txt2
-rw-r--r--Documentation/networking/gianfar.txt72
-rw-r--r--Documentation/networking/ip-sysctl.txt23
-rw-r--r--Documentation/networking/sk98lin.txt4
-rw-r--r--Documentation/oops-tracing.txt8
-rw-r--r--Documentation/pci-error-recovery.txt246
-rw-r--r--Documentation/pcmcia/driver-changes.txt11
-rw-r--r--Documentation/pm.txt2
-rw-r--r--Documentation/power/interface.txt11
-rw-r--r--Documentation/power/swsusp.txt9
-rw-r--r--Documentation/powerpc/00-INDEX10
-rw-r--r--Documentation/powerpc/eeh-pci-error-recovery.txt31
-rw-r--r--Documentation/scsi/ChangeLog.megaraid35
-rw-r--r--Documentation/scsi/aacraid.txt108
-rw-r--r--Documentation/scsi/scsi_mid_low_api.txt39
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt194
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl592
-rw-r--r--Documentation/sound/alsa/Procfile.txt16
-rw-r--r--Documentation/sound/alsa/hda_codec.txt14
-rw-r--r--Documentation/spi/butterfly57
-rw-r--r--Documentation/spi/spi-summary457
-rw-r--r--Documentation/stable_kernel_rules.txt60
-rw-r--r--Documentation/sysctl/vm.txt38
-rw-r--r--Documentation/sysrq.txt6
-rw-r--r--Documentation/video4linux/CARDLIST.bttv2
-rw-r--r--Documentation/video4linux/CARDLIST.cx8812
-rw-r--r--Documentation/video4linux/CARDLIST.saa71345
-rw-r--r--Documentation/video4linux/CARDLIST.tuner7
-rw-r--r--Documentation/x86_64/boot-options.txt4
-rw-r--r--Documentation/x86_64/cpu-hotplug-spec21
96 files changed, 6429 insertions, 993 deletions
diff --git a/Documentation/Changes b/Documentation/Changes
index 86b86399d61d..fe5ae0f55020 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -31,8 +31,6 @@ al espaņol de este documento en varios formatos.
31Eine deutsche Version dieser Datei finden Sie unter 31Eine deutsche Version dieser Datei finden Sie unter
32<http://www.stefan-winter.de/Changes-2.4.0.txt>. 32<http://www.stefan-winter.de/Changes-2.4.0.txt>.
33 33
34Last updated: October 29th, 2002
35
36Chris Ricker (kaboom@gatech.edu or chris.ricker@genetics.utah.edu). 34Chris Ricker (kaboom@gatech.edu or chris.ricker@genetics.utah.edu).
37 35
38Current Minimal Requirements 36Current Minimal Requirements
@@ -48,7 +46,7 @@ necessary on all systems; obviously, if you don't have any ISDN
48hardware, for example, you probably needn't concern yourself with 46hardware, for example, you probably needn't concern yourself with
49isdn4k-utils. 47isdn4k-utils.
50 48
51o Gnu C 2.95.3 # gcc --version 49o Gnu C 3.2 # gcc --version
52o Gnu make 3.79.1 # make --version 50o Gnu make 3.79.1 # make --version
53o binutils 2.12 # ld -v 51o binutils 2.12 # ld -v
54o util-linux 2.10o # fdformat --version 52o util-linux 2.10o # fdformat --version
@@ -74,26 +72,7 @@ GCC
74--- 72---
75 73
76The gcc version requirements may vary depending on the type of CPU in your 74The gcc version requirements may vary depending on the type of CPU in your
77computer. The next paragraph applies to users of x86 CPUs, but not 75computer.
78necessarily to users of other CPUs. Users of other CPUs should obtain
79information about their gcc version requirements from another source.
80
81The recommended compiler for the kernel is gcc 2.95.x (x >= 3), and it
82should be used when you need absolute stability. You may use gcc 3.0.x
83instead if you wish, although it may cause problems. Later versions of gcc
84have not received much testing for Linux kernel compilation, and there are
85almost certainly bugs (mainly, but not exclusively, in the kernel) that
86will need to be fixed in order to use these compilers. In any case, using
87pgcc instead of plain gcc is just asking for trouble.
88
89The Red Hat gcc 2.96 compiler subtree can also be used to build this tree.
90You should ensure you use gcc-2.96-74 or later. gcc-2.96-54 will not build
91the kernel correctly.
92
93In addition, please pay attention to compiler optimization. Anything
94greater than -O2 may not be wise. Similarly, if you choose to use gcc-2.95.x
95or derivatives, be sure not to use -fstrict-aliasing (which, depending on
96your version of gcc 2.95.x, may necessitate using -fno-strict-aliasing).
97 76
98Make 77Make
99---- 78----
@@ -322,9 +301,9 @@ Getting updated software
322Kernel compilation 301Kernel compilation
323****************** 302******************
324 303
325gcc 2.95.3 304gcc
326---------- 305---
327o <ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3.tar.gz> 306o <ftp://ftp.gnu.org/gnu/gcc/>
328 307
329Make 308Make
330---- 309----
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index eb7db3c19227..ce5d2c038cf5 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -199,7 +199,7 @@ The rationale is:
199 modifications are prevented 199 modifications are prevented
200- saves the compiler work to optimize redundant code away ;) 200- saves the compiler work to optimize redundant code away ;)
201 201
202int fun(int ) 202int fun(int a)
203{ 203{
204 int result = 0; 204 int result = 0;
205 char *buffer = kmalloc(SIZE); 205 char *buffer = kmalloc(SIZE);
@@ -344,7 +344,7 @@ Remember: if another thread can find your data structure, and you don't
344have a reference count on it, you almost certainly have a bug. 344have a reference count on it, you almost certainly have a bug.
345 345
346 346
347 Chapter 11: Macros, Enums, Inline functions and RTL 347 Chapter 11: Macros, Enums and RTL
348 348
349Names of macros defining constants and labels in enums are capitalized. 349Names of macros defining constants and labels in enums are capitalized.
350 350
@@ -429,7 +429,35 @@ from void pointer to any other pointer type is guaranteed by the C programming
429language. 429language.
430 430
431 431
432 Chapter 14: References 432 Chapter 14: The inline disease
433
434There appears to be a common misperception that gcc has a magic "make me
435faster" speedup option called "inline". While the use of inlines can be
436appropriate (for example as a means of replacing macros, see Chapter 11), it
437very often is not. Abundant use of the inline keyword leads to a much bigger
438kernel, which in turn slows the system as a whole down, due to a bigger
439icache footprint for the CPU and simply because there is less memory
440available for the pagecache. Just think about it; a pagecache miss causes a
441disk seek, which easily takes 5 miliseconds. There are a LOT of cpu cycles
442that can go into these 5 miliseconds.
443
444A reasonable rule of thumb is to not put inline at functions that have more
445than 3 lines of code in them. An exception to this rule are the cases where
446a parameter is known to be a compiletime constant, and as a result of this
447constantness you *know* the compiler will be able to optimize most of your
448function away at compile time. For a good example of this later case, see
449the kmalloc() inline function.
450
451Often people argue that adding inline to functions that are static and used
452only once is always a win since there is no space tradeoff. While this is
453technically correct, gcc is capable of inlining these automatically without
454help, and the maintenance issue of removing the inline when a second user
455appears outweighs the potential value of the hint that tells gcc to do
456something it would have done anyway.
457
458
459
460 Chapter 15: References
433 461
434The C Programming Language, Second Edition 462The C Programming Language, Second Edition
435by Brian W. Kernighan and Dennis M. Ritchie. 463by Brian W. Kernighan and Dennis M. Ritchie.
@@ -444,10 +472,13 @@ ISBN 0-201-61586-X.
444URL: http://cm.bell-labs.com/cm/cs/tpop/ 472URL: http://cm.bell-labs.com/cm/cs/tpop/
445 473
446GNU manuals - where in compliance with K&R and this text - for cpp, gcc, 474GNU manuals - where in compliance with K&R and this text - for cpp, gcc,
447gcc internals and indent, all available from http://www.gnu.org 475gcc internals and indent, all available from http://www.gnu.org/manual/
448 476
449WG14 is the international standardization working group for the programming 477WG14 is the international standardization working group for the programming
450language C, URL: http://std.dkuug.dk/JTC1/SC22/WG14/ 478language C, URL: http://www.open-std.org/JTC1/SC22/WG14/
479
480Kernel CodingStyle, by greg@kroah.com at OLS 2002:
481http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/
451 482
452-- 483--
453Last updated on 16 February 2004 by a community effort on LKML. 484Last updated on 30 December 2005 by a community effort on LKML.
diff --git a/Documentation/DocBook/.gitignore b/Documentation/DocBook/.gitignore
new file mode 100644
index 000000000000..c102c02ecf89
--- /dev/null
+++ b/Documentation/DocBook/.gitignore
@@ -0,0 +1,6 @@
1*.xml
2*.ps
3*.pdf
4*.html
5*.9.gz
6*.9
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 767433bdbc40..8c9c6704e85b 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -54,6 +54,11 @@
54!Ekernel/sched.c 54!Ekernel/sched.c
55!Ekernel/timer.c 55!Ekernel/timer.c
56 </sect1> 56 </sect1>
57 <sect1><title>High-resolution timers</title>
58!Iinclude/linux/ktime.h
59!Iinclude/linux/hrtimer.h
60!Ekernel/hrtimer.c
61 </sect1>
57 <sect1><title>Internal Functions</title> 62 <sect1><title>Internal Functions</title>
58!Ikernel/exit.c 63!Ikernel/exit.c
59!Ikernel/signal.c 64!Ikernel/signal.c
@@ -369,6 +374,7 @@ X!Edrivers/acpi/motherboard.c
369X!Edrivers/acpi/bus.c 374X!Edrivers/acpi/bus.c
370--> 375-->
371!Edrivers/acpi/scan.c 376!Edrivers/acpi/scan.c
377!Idrivers/acpi/scan.c
372<!-- No correct structured comments 378<!-- No correct structured comments
373X!Edrivers/acpi/pci_bind.c 379X!Edrivers/acpi/pci_bind.c
374--> 380-->
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
index 90dc2de8e0af..158ffe9bfade 100644
--- a/Documentation/DocBook/kernel-locking.tmpl
+++ b/Documentation/DocBook/kernel-locking.tmpl
@@ -222,7 +222,7 @@
222 <title>Two Main Types of Kernel Locks: Spinlocks and Semaphores</title> 222 <title>Two Main Types of Kernel Locks: Spinlocks and Semaphores</title>
223 223
224 <para> 224 <para>
225 There are two main types of kernel locks. The fundamental type 225 There are three main types of kernel locks. The fundamental type
226 is the spinlock 226 is the spinlock
227 (<filename class="headerfile">include/asm/spinlock.h</filename>), 227 (<filename class="headerfile">include/asm/spinlock.h</filename>),
228 which is a very simple single-holder lock: if you can't get the 228 which is a very simple single-holder lock: if you can't get the
@@ -230,16 +230,22 @@
230 very small and fast, and can be used anywhere. 230 very small and fast, and can be used anywhere.
231 </para> 231 </para>
232 <para> 232 <para>
233 The second type is a semaphore 233 The second type is a mutex
234 (<filename class="headerfile">include/linux/mutex.h</filename>): it
235 is like a spinlock, but you may block holding a mutex.
236 If you can't lock a mutex, your task will suspend itself, and be woken
237 up when the mutex is released. This means the CPU can do something
238 else while you are waiting. There are many cases when you simply
239 can't sleep (see <xref linkend="sleeping-things"/>), and so have to
240 use a spinlock instead.
241 </para>
242 <para>
243 The third type is a semaphore
234 (<filename class="headerfile">include/asm/semaphore.h</filename>): it 244 (<filename class="headerfile">include/asm/semaphore.h</filename>): it
235 can have more than one holder at any time (the number decided at 245 can have more than one holder at any time (the number decided at
236 initialization time), although it is most commonly used as a 246 initialization time), although it is most commonly used as a
237 single-holder lock (a mutex). If you can't get a semaphore, 247 single-holder lock (a mutex). If you can't get a semaphore, your
238 your task will put itself on the queue, and be woken up when the 248 task will be suspended and later on woken up - just like for mutexes.
239 semaphore is released. This means the CPU will do something
240 else while you are waiting, but there are many cases when you
241 simply can't sleep (see <xref linkend="sleeping-things"/>), and so
242 have to use a spinlock instead.
243 </para> 249 </para>
244 <para> 250 <para>
245 Neither type of lock is recursive: see 251 Neither type of lock is recursive: see
diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl
index 15ce0f21e5e0..320af25de3a2 100644
--- a/Documentation/DocBook/usb.tmpl
+++ b/Documentation/DocBook/usb.tmpl
@@ -253,6 +253,7 @@
253!Edrivers/usb/core/urb.c 253!Edrivers/usb/core/urb.c
254!Edrivers/usb/core/message.c 254!Edrivers/usb/core/message.c
255!Edrivers/usb/core/file.c 255!Edrivers/usb/core/file.c
256!Edrivers/usb/core/driver.c
256!Edrivers/usb/core/usb.c 257!Edrivers/usb/core/usb.c
257!Edrivers/usb/core/hub.c 258!Edrivers/usb/core/hub.c
258 </chapter> 259 </chapter>
diff --git a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl
index 3ec6c875588a..fdff984a5161 100644
--- a/Documentation/DocBook/videobook.tmpl
+++ b/Documentation/DocBook/videobook.tmpl
@@ -229,7 +229,7 @@ int __init myradio_init(struct video_init *v)
229 229
230static int users = 0; 230static int users = 0;
231 231
232static int radio_open(stuct video_device *dev, int flags) 232static int radio_open(struct video_device *dev, int flags)
233{ 233{
234 if(users) 234 if(users)
235 return -EBUSY; 235 return -EBUSY;
@@ -949,7 +949,7 @@ int __init mycamera_init(struct video_init *v)
949 949
950static int users = 0; 950static int users = 0;
951 951
952static int camera_open(stuct video_device *dev, int flags) 952static int camera_open(struct video_device *dev, int flags)
953{ 953{
954 if(users) 954 if(users)
955 return -EBUSY; 955 return -EBUSY;
diff --git a/Documentation/RCU/rcuref.txt b/Documentation/RCU/rcuref.txt
index a23fee66064d..3f60db41b2f0 100644
--- a/Documentation/RCU/rcuref.txt
+++ b/Documentation/RCU/rcuref.txt
@@ -1,74 +1,67 @@
1Refcounter framework for elements of lists/arrays protected by 1Refcounter design for elements of lists/arrays protected by RCU.
2RCU.
3 2
4Refcounting on elements of lists which are protected by traditional 3Refcounting on elements of lists which are protected by traditional
5reader/writer spinlocks or semaphores are straight forward as in: 4reader/writer spinlocks or semaphores are straight forward as in:
6 5
71. 2. 61. 2.
8add() search_and_reference() 7add() search_and_reference()
9{ { 8{ {
10 alloc_object read_lock(&list_lock); 9 alloc_object read_lock(&list_lock);
11 ... search_for_element 10 ... search_for_element
12 atomic_set(&el->rc, 1); atomic_inc(&el->rc); 11 atomic_set(&el->rc, 1); atomic_inc(&el->rc);
13 write_lock(&list_lock); ... 12 write_lock(&list_lock); ...
14 add_element read_unlock(&list_lock); 13 add_element read_unlock(&list_lock);
15 ... ... 14 ... ...
16 write_unlock(&list_lock); } 15 write_unlock(&list_lock); }
17} 16}
18 17
193. 4. 183. 4.
20release_referenced() delete() 19release_referenced() delete()
21{ { 20{ {
22 ... write_lock(&list_lock); 21 ... write_lock(&list_lock);
23 atomic_dec(&el->rc, relfunc) ... 22 atomic_dec(&el->rc, relfunc) ...
24 ... delete_element 23 ... delete_element
25} write_unlock(&list_lock); 24} write_unlock(&list_lock);
26 ... 25 ...
27 if (atomic_dec_and_test(&el->rc)) 26 if (atomic_dec_and_test(&el->rc))
28 kfree(el); 27 kfree(el);
29 ... 28 ...
30 } 29 }
31 30
32If this list/array is made lock free using rcu as in changing the 31If this list/array is made lock free using rcu as in changing the
33write_lock in add() and delete() to spin_lock and changing read_lock 32write_lock in add() and delete() to spin_lock and changing read_lock
34in search_and_reference to rcu_read_lock(), the rcuref_get in 33in search_and_reference to rcu_read_lock(), the atomic_get in
35search_and_reference could potentially hold reference to an element which 34search_and_reference could potentially hold reference to an element which
36has already been deleted from the list/array. rcuref_lf_get_rcu takes 35has already been deleted from the list/array. atomic_inc_not_zero takes
37care of this scenario. search_and_reference should look as; 36care of this scenario. search_and_reference should look as;
38 37
391. 2. 381. 2.
40add() search_and_reference() 39add() search_and_reference()
41{ { 40{ {
42 alloc_object rcu_read_lock(); 41 alloc_object rcu_read_lock();
43 ... search_for_element 42 ... search_for_element
44 atomic_set(&el->rc, 1); if (rcuref_inc_lf(&el->rc)) { 43 atomic_set(&el->rc, 1); if (atomic_inc_not_zero(&el->rc)) {
45 write_lock(&list_lock); rcu_read_unlock(); 44 write_lock(&list_lock); rcu_read_unlock();
46 return FAIL; 45 return FAIL;
47 add_element } 46 add_element }
48 ... ... 47 ... ...
49 write_unlock(&list_lock); rcu_read_unlock(); 48 write_unlock(&list_lock); rcu_read_unlock();
50} } 49} }
513. 4. 503. 4.
52release_referenced() delete() 51release_referenced() delete()
53{ { 52{ {
54 ... write_lock(&list_lock); 53 ... write_lock(&list_lock);
55 rcuref_dec(&el->rc, relfunc) ... 54 atomic_dec(&el->rc, relfunc) ...
56 ... delete_element 55 ... delete_element
57} write_unlock(&list_lock); 56} write_unlock(&list_lock);
58 ... 57 ...
59 if (rcuref_dec_and_test(&el->rc)) 58 if (atomic_dec_and_test(&el->rc))
60 call_rcu(&el->head, el_free); 59 call_rcu(&el->head, el_free);
61 ... 60 ...
62 } 61 }
63 62
64Sometimes, reference to the element need to be obtained in the 63Sometimes, reference to the element need to be obtained in the
65update (write) stream. In such cases, rcuref_inc_lf might be an overkill 64update (write) stream. In such cases, atomic_inc_not_zero might be an
66since the spinlock serialising list updates are held. rcuref_inc 65overkill since the spinlock serialising list updates are held. atomic_inc
67is to be used in such cases. 66is to be used in such cases.
68For arches which do not have cmpxchg rcuref_inc_lf 67
69api uses a hashed spinlock implementation and the same hashed spinlock
70is acquired in all rcuref_xxx primitives to preserve atomicity.
71Note: Use rcuref_inc api only if you need to use rcuref_inc_lf on the
72refcounter atleast at one place. Mixing rcuref_inc and atomic_xxx api
73might lead to races. rcuref_inc_lf() must be used in lockfree
74RCU critical sections only.
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers
index c3cca924e94b..6bd30fdd0786 100644
--- a/Documentation/SubmittingDrivers
+++ b/Documentation/SubmittingDrivers
@@ -27,18 +27,17 @@ Who To Submit Drivers To
27------------------------ 27------------------------
28 28
29Linux 2.0: 29Linux 2.0:
30 No new drivers are accepted for this kernel tree 30 No new drivers are accepted for this kernel tree.
31 31
32Linux 2.2: 32Linux 2.2:
33 No new drivers are accepted for this kernel tree.
34
35Linux 2.4:
33 If the code area has a general maintainer then please submit it to 36 If the code area has a general maintainer then please submit it to
34 the maintainer listed in MAINTAINERS in the kernel file. If the 37 the maintainer listed in MAINTAINERS in the kernel file. If the
35 maintainer does not respond or you cannot find the appropriate 38 maintainer does not respond or you cannot find the appropriate
36 maintainer then please contact the 2.2 kernel maintainer: 39 maintainer then please contact Marcelo Tosatti
37 Marc-Christian Petersen <m.c.p@wolk-project.de>. 40 <marcelo.tosatti@cyclades.com>.
38
39Linux 2.4:
40 The same rules apply as 2.2. The final contact point for Linux 2.4
41 submissions is Marcelo Tosatti <marcelo.tosatti@cyclades.com>.
42 41
43Linux 2.6: 42Linux 2.6:
44 The same rules apply as 2.4 except that you should follow linux-kernel 43 The same rules apply as 2.4 except that you should follow linux-kernel
@@ -53,6 +52,7 @@ Licensing: The code must be released to us under the
53 of exclusive GPL licensing, and if you wish the driver 52 of exclusive GPL licensing, and if you wish the driver
54 to be useful to other communities such as BSD you may well 53 to be useful to other communities such as BSD you may well
55 wish to release under multiple licenses. 54 wish to release under multiple licenses.
55 See accepted licenses at include/linux/module.h
56 56
57Copyright: The copyright owner must agree to use of GPL. 57Copyright: The copyright owner must agree to use of GPL.
58 It's best if the submitter and copyright owner 58 It's best if the submitter and copyright owner
@@ -143,5 +143,13 @@ KernelNewbies:
143 http://kernelnewbies.org/ 143 http://kernelnewbies.org/
144 144
145Linux USB project: 145Linux USB project:
146 http://sourceforge.net/projects/linux-usb/ 146 http://www.linux-usb.org/
147
148How to NOT write kernel driver by arjanv@redhat.com
149 http://people.redhat.com/arjanv/olspaper.pdf
150
151Kernel Janitor:
152 http://janitor.kernelnewbies.org/
147 153
154--
155Last updated on 17 Nov 2005.
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 237d54c44bc5..c2c85bcb3d43 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -78,7 +78,9 @@ Randy Dunlap's patch scripts:
78http://www.xenotime.net/linux/scripts/patching-scripts-002.tar.gz 78http://www.xenotime.net/linux/scripts/patching-scripts-002.tar.gz
79 79
80Andrew Morton's patch scripts: 80Andrew Morton's patch scripts:
81http://www.zip.com.au/~akpm/linux/patches/patch-scripts-0.20 81http://www.zip.com.au/~akpm/linux/patches/
82Instead of these scripts, quilt is the recommended patch management
83tool (see above).
82 84
83 85
84 86
@@ -97,7 +99,7 @@ need to split up your patch. See #3, next.
97 99
983) Separate your changes. 1003) Separate your changes.
99 101
100Separate each logical change into its own patch. 102Separate _logical changes_ into a single patch file.
101 103
102For example, if your changes include both bug fixes and performance 104For example, if your changes include both bug fixes and performance
103enhancements for a single driver, separate those changes into two 105enhancements for a single driver, separate those changes into two
@@ -112,6 +114,10 @@ If one patch depends on another patch in order for a change to be
112complete, that is OK. Simply note "this patch depends on patch X" 114complete, that is OK. Simply note "this patch depends on patch X"
113in your patch description. 115in your patch description.
114 116
117If you cannot condense your patch set into a smaller set of patches,
118then only post say 15 or so at a time and wait for review and integration.
119
120
115 121
1164) Select e-mail destination. 1224) Select e-mail destination.
117 123
@@ -124,6 +130,10 @@ your patch to the primary Linux kernel developer's mailing list,
124linux-kernel@vger.kernel.org. Most kernel developers monitor this 130linux-kernel@vger.kernel.org. Most kernel developers monitor this
125e-mail list, and can comment on your changes. 131e-mail list, and can comment on your changes.
126 132
133
134Do not send more than 15 patches at once to the vger mailing lists!!!
135
136
127Linus Torvalds is the final arbiter of all changes accepted into the 137Linus Torvalds is the final arbiter of all changes accepted into the
128Linux kernel. His e-mail address is <torvalds@osdl.org>. He gets 138Linux kernel. His e-mail address is <torvalds@osdl.org>. He gets
129a lot of e-mail, so typically you should do your best to -avoid- sending 139a lot of e-mail, so typically you should do your best to -avoid- sending
@@ -149,6 +159,9 @@ USB, framebuffer devices, the VFS, the SCSI subsystem, etc. See the
149MAINTAINERS file for a mailing list that relates specifically to 159MAINTAINERS file for a mailing list that relates specifically to
150your change. 160your change.
151 161
162Majordomo lists of VGER.KERNEL.ORG at:
163 <http://vger.kernel.org/vger-lists.html>
164
152If changes affect userland-kernel interfaces, please send 165If changes affect userland-kernel interfaces, please send
153the MAN-PAGES maintainer (as listed in the MAINTAINERS file) 166the MAN-PAGES maintainer (as listed in the MAINTAINERS file)
154a man-pages patch, or at least a notification of the change, 167a man-pages patch, or at least a notification of the change,
@@ -158,7 +171,7 @@ Even if the maintainer did not respond in step #4, make sure to ALWAYS
158copy the maintainer when you change their code. 171copy the maintainer when you change their code.
159 172
160For small patches you may want to CC the Trivial Patch Monkey 173For small patches you may want to CC the Trivial Patch Monkey
161trivial@rustcorp.com.au set up by Rusty Russell; which collects "trivial" 174trivial@kernel.org managed by Adrian Bunk; which collects "trivial"
162patches. Trivial patches must qualify for one of the following rules: 175patches. Trivial patches must qualify for one of the following rules:
163 Spelling fixes in documentation 176 Spelling fixes in documentation
164 Spelling fixes which could break grep(1). 177 Spelling fixes which could break grep(1).
@@ -171,7 +184,7 @@ patches. Trivial patches must qualify for one of the following rules:
171 since people copy, as long as it's trivial) 184 since people copy, as long as it's trivial)
172 Any fix by the author/maintainer of the file. (ie. patch monkey 185 Any fix by the author/maintainer of the file. (ie. patch monkey
173 in re-transmission mode) 186 in re-transmission mode)
174URL: <http://www.kernel.org/pub/linux/kernel/people/rusty/trivial/> 187URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/>
175 188
176 189
177 190
@@ -373,27 +386,14 @@ a diffstat, to show what files have changed, and the number of inserted
373and deleted lines per file. A diffstat is especially useful on bigger 386and deleted lines per file. A diffstat is especially useful on bigger
374patches. Other comments relevant only to the moment or the maintainer, 387patches. Other comments relevant only to the moment or the maintainer,
375not suitable for the permanent changelog, should also go here. 388not suitable for the permanent changelog, should also go here.
389Use diffstat options "-p 1 -w 70" so that filenames are listed from the
390top of the kernel source tree and don't use too much horizontal space
391(easily fit in 80 columns, maybe with some indentation).
376 392
377See more details on the proper patch format in the following 393See more details on the proper patch format in the following
378references. 394references.
379 395
380 396
38113) More references for submitting patches
382
383Andrew Morton, "The perfect patch" (tpp).
384 <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt>
385
386Jeff Garzik, "Linux kernel patch submission format."
387 <http://linux.yyz.us/patch-format.html>
388
389Greg KH, "How to piss off a kernel subsystem maintainer"
390 <http://www.kroah.com/log/2005/03/31/>
391
392Kernel Documentation/CodingStyle
393 <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle>
394
395Linus Torvald's mail on the canonical patch format:
396 <http://lkml.org/lkml/2005/4/7/183>
397 397
398 398
399----------------------------------- 399-----------------------------------
@@ -466,3 +466,31 @@ and 'extern __inline__'.
466Don't try to anticipate nebulous future cases which may or may not 466Don't try to anticipate nebulous future cases which may or may not
467be useful: "Make it as simple as you can, and no simpler." 467be useful: "Make it as simple as you can, and no simpler."
468 468
469
470
471----------------------
472SECTION 3 - REFERENCES
473----------------------
474
475Andrew Morton, "The perfect patch" (tpp).
476 <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt>
477
478Jeff Garzik, "Linux kernel patch submission format."
479 <http://linux.yyz.us/patch-format.html>
480
481Greg Kroah-Hartman "How to piss off a kernel subsystem maintainer".
482 <http://www.kroah.com/log/2005/03/31/>
483 <http://www.kroah.com/log/2005/07/08/>
484 <http://www.kroah.com/log/2005/10/19/>
485 <http://www.kroah.com/log/2006/01/11/>
486
487NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!.
488 <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2>
489
490Kernel Documentation/CodingStyle
491 <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle>
492
493Linus Torvald's mail on the canonical patch format:
494 <http://lkml.org/lkml/2005/4/7/183>
495--
496Last updated on 17 Nov 2005.
diff --git a/Documentation/applying-patches.txt b/Documentation/applying-patches.txt
index 681e426e2482..a083ba35d1ad 100644
--- a/Documentation/applying-patches.txt
+++ b/Documentation/applying-patches.txt
@@ -2,8 +2,8 @@
2 Applying Patches To The Linux Kernel 2 Applying Patches To The Linux Kernel
3 ------------------------------------ 3 ------------------------------------
4 4
5 (Written by Jesper Juhl, August 2005) 5 Original by: Jesper Juhl, August 2005
6 6 Last update: 2006-01-05
7 7
8 8
9A frequently asked question on the Linux Kernel Mailing List is how to apply 9A frequently asked question on the Linux Kernel Mailing List is how to apply
@@ -76,7 +76,7 @@ instead:
76 76
77If you wish to uncompress the patch file by hand first before applying it 77If you wish to uncompress the patch file by hand first before applying it
78(what I assume you've done in the examples below), then you simply run 78(what I assume you've done in the examples below), then you simply run
79gunzip or bunzip2 on the file - like this: 79gunzip or bunzip2 on the file -- like this:
80 gunzip patch-x.y.z.gz 80 gunzip patch-x.y.z.gz
81 bunzip2 patch-x.y.z.bz2 81 bunzip2 patch-x.y.z.bz2
82 82
@@ -94,7 +94,7 @@ Common errors when patching
94--- 94---
95 When patch applies a patch file it attempts to verify the sanity of the 95 When patch applies a patch file it attempts to verify the sanity of the
96file in different ways. 96file in different ways.
97Checking that the file looks like a valid patch file, checking the code 97Checking that the file looks like a valid patch file & checking the code
98around the bits being modified matches the context provided in the patch are 98around the bits being modified matches the context provided in the patch are
99just two of the basic sanity checks patch does. 99just two of the basic sanity checks patch does.
100 100
@@ -118,16 +118,16 @@ wrong.
118 118
119When patch encounters a change that it can't fix up with fuzz it rejects it 119When patch encounters a change that it can't fix up with fuzz it rejects it
120outright and leaves a file with a .rej extension (a reject file). You can 120outright and leaves a file with a .rej extension (a reject file). You can
121read this file to see exactely what change couldn't be applied, so you can 121read this file to see exactly what change couldn't be applied, so you can
122go fix it up by hand if you wish. 122go fix it up by hand if you wish.
123 123
124If you don't have any third party patches applied to your kernel source, but 124If you don't have any third-party patches applied to your kernel source, but
125only patches from kernel.org and you apply the patches in the correct order, 125only patches from kernel.org and you apply the patches in the correct order,
126and have made no modifications yourself to the source files, then you should 126and have made no modifications yourself to the source files, then you should
127never see a fuzz or reject message from patch. If you do see such messages 127never see a fuzz or reject message from patch. If you do see such messages
128anyway, then there's a high risk that either your local source tree or the 128anyway, then there's a high risk that either your local source tree or the
129patch file is corrupted in some way. In that case you should probably try 129patch file is corrupted in some way. In that case you should probably try
130redownloading the patch and if things are still not OK then you'd be advised 130re-downloading the patch and if things are still not OK then you'd be advised
131to start with a fresh tree downloaded in full from kernel.org. 131to start with a fresh tree downloaded in full from kernel.org.
132 132
133Let's look a bit more at some of the messages patch can produce. 133Let's look a bit more at some of the messages patch can produce.
@@ -136,7 +136,7 @@ If patch stops and presents a "File to patch:" prompt, then patch could not
136find a file to be patched. Most likely you forgot to specify -p1 or you are 136find a file to be patched. Most likely you forgot to specify -p1 or you are
137in the wrong directory. Less often, you'll find patches that need to be 137in the wrong directory. Less often, you'll find patches that need to be
138applied with -p0 instead of -p1 (reading the patch file should reveal if 138applied with -p0 instead of -p1 (reading the patch file should reveal if
139this is the case - if so, then this is an error by the person who created 139this is the case -- if so, then this is an error by the person who created
140the patch but is not fatal). 140the patch but is not fatal).
141 141
142If you get "Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines)." or a 142If you get "Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines)." or a
@@ -167,22 +167,28 @@ the patch will in fact apply it.
167 167
168A message similar to "patch: **** unexpected end of file in patch" or "patch 168A message similar to "patch: **** unexpected end of file in patch" or "patch
169unexpectedly ends in middle of line" means that patch could make no sense of 169unexpectedly ends in middle of line" means that patch could make no sense of
170the file you fed to it. Either your download is broken or you tried to feed 170the file you fed to it. Either your download is broken, you tried to feed
171patch a compressed patch file without uncompressing it first. 171patch a compressed patch file without uncompressing it first, or the patch
172file that you are using has been mangled by a mail client or mail transfer
173agent along the way somewhere, e.g., by splitting a long line into two lines.
174Often these warnings can easily be fixed by joining (concatenating) the
175two lines that had been split.
172 176
173As I already mentioned above, these errors should never happen if you apply 177As I already mentioned above, these errors should never happen if you apply
174a patch from kernel.org to the correct version of an unmodified source tree. 178a patch from kernel.org to the correct version of an unmodified source tree.
175So if you get these errors with kernel.org patches then you should probably 179So if you get these errors with kernel.org patches then you should probably
176assume that either your patch file or your tree is broken and I'd advice you 180assume that either your patch file or your tree is broken and I'd advise you
177to start over with a fresh download of a full kernel tree and the patch you 181to start over with a fresh download of a full kernel tree and the patch you
178wish to apply. 182wish to apply.
179 183
180 184
181Are there any alternatives to `patch'? 185Are there any alternatives to `patch'?
182--- 186---
183 Yes there are alternatives. You can use the `interdiff' program 187 Yes there are alternatives.
184(http://cyberelk.net/tim/patchutils/) to generate a patch representing the 188
185differences between two patches and then apply the result. 189 You can use the `interdiff' program (http://cyberelk.net/tim/patchutils/) to
190generate a patch representing the differences between two patches and then
191apply the result.
186This will let you move from something like 2.6.12.2 to 2.6.12.3 in a single 192This will let you move from something like 2.6.12.2 to 2.6.12.3 in a single
187step. The -z flag to interdiff will even let you feed it patches in gzip or 193step. The -z flag to interdiff will even let you feed it patches in gzip or
188bzip2 compressed form directly without the use of zcat or bzcat or manual 194bzip2 compressed form directly without the use of zcat or bzcat or manual
@@ -197,10 +203,10 @@ do the additional steps since interdiff can get things wrong in some cases.
197 Another alternative is `ketchup', which is a python script for automatic 203 Another alternative is `ketchup', which is a python script for automatic
198downloading and applying of patches (http://www.selenic.com/ketchup/). 204downloading and applying of patches (http://www.selenic.com/ketchup/).
199 205
200Other nice tools are diffstat which shows a summary of changes made by a 206 Other nice tools are diffstat, which shows a summary of changes made by a
201patch, lsdiff which displays a short listing of affected files in a patch 207patch; lsdiff, which displays a short listing of affected files in a patch
202file, along with (optionally) the line numbers of the start of each patch 208file, along with (optionally) the line numbers of the start of each patch;
203and grepdiff which displays a list of the files modified by a patch where 209and grepdiff, which displays a list of the files modified by a patch where
204the patch contains a given regular expression. 210the patch contains a given regular expression.
205 211
206 212
@@ -225,8 +231,8 @@ The -mm kernels live at
225In place of ftp.kernel.org you can use ftp.cc.kernel.org, where cc is a 231In place of ftp.kernel.org you can use ftp.cc.kernel.org, where cc is a
226country code. This way you'll be downloading from a mirror site that's most 232country code. This way you'll be downloading from a mirror site that's most
227likely geographically closer to you, resulting in faster downloads for you, 233likely geographically closer to you, resulting in faster downloads for you,
228less bandwidth used globally and less load on the main kernel.org servers - 234less bandwidth used globally and less load on the main kernel.org servers --
229these are good things, do use mirrors when possible. 235these are good things, so do use mirrors when possible.
230 236
231 237
232The 2.6.x kernels 238The 2.6.x kernels
@@ -234,14 +240,14 @@ The 2.6.x kernels
234 These are the base stable releases released by Linus. The highest numbered 240 These are the base stable releases released by Linus. The highest numbered
235release is the most recent. 241release is the most recent.
236 242
237If regressions or other serious flaws are found then a -stable fix patch 243If regressions or other serious flaws are found, then a -stable fix patch
238will be released (see below) on top of this base. Once a new 2.6.x base 244will be released (see below) on top of this base. Once a new 2.6.x base
239kernel is released, a patch is made available that is a delta between the 245kernel is released, a patch is made available that is a delta between the
240previous 2.6.x kernel and the new one. 246previous 2.6.x kernel and the new one.
241 247
242To apply a patch moving from 2.6.11 to 2.6.12 you'd do the following (note 248To apply a patch moving from 2.6.11 to 2.6.12, you'd do the following (note
243that such patches do *NOT* apply on top of 2.6.x.y kernels but on top of the 249that such patches do *NOT* apply on top of 2.6.x.y kernels but on top of the
244base 2.6.x kernel - if you need to move from 2.6.x.y to 2.6.x+1 you need to 250base 2.6.x kernel -- if you need to move from 2.6.x.y to 2.6.x+1 you need to
245first revert the 2.6.x.y patch). 251first revert the 2.6.x.y patch).
246 252
247Here are some examples: 253Here are some examples:
@@ -258,12 +264,12 @@ $ patch -p1 -R < ../patch-2.6.11.1 # revert the 2.6.11.1 patch
258 # source dir is now 2.6.11 264 # source dir is now 2.6.11
259$ patch -p1 < ../patch-2.6.12 # apply new 2.6.12 patch 265$ patch -p1 < ../patch-2.6.12 # apply new 2.6.12 patch
260$ cd .. 266$ cd ..
261$ mv linux-2.6.11.1 inux-2.6.12 # rename source dir 267$ mv linux-2.6.11.1 linux-2.6.12 # rename source dir
262 268
263 269
264The 2.6.x.y kernels 270The 2.6.x.y kernels
265--- 271---
266 Kernels with 4 digit versions are -stable kernels. They contain small(ish) 272 Kernels with 4-digit versions are -stable kernels. They contain small(ish)
267critical fixes for security problems or significant regressions discovered 273critical fixes for security problems or significant regressions discovered
268in a given 2.6.x kernel. 274in a given 2.6.x kernel.
269 275
@@ -274,9 +280,14 @@ versions.
274If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is 280If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is
275the current stable kernel. 281the current stable kernel.
276 282
283 note: the -stable team usually do make incremental patches available as well
284 as patches against the latest mainline release, but I only cover the
285 non-incremental ones below. The incremental ones can be found at
286 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/incr/
287
277These patches are not incremental, meaning that for example the 2.6.12.3 288These patches are not incremental, meaning that for example the 2.6.12.3
278patch does not apply on top of the 2.6.12.2 kernel source, but rather on top 289patch does not apply on top of the 2.6.12.2 kernel source, but rather on top
279of the base 2.6.12 kernel source. 290of the base 2.6.12 kernel source .
280So, in order to apply the 2.6.12.3 patch to your existing 2.6.12.2 kernel 291So, in order to apply the 2.6.12.3 patch to your existing 2.6.12.2 kernel
281source you have to first back out the 2.6.12.2 patch (so you are left with a 292source you have to first back out the 2.6.12.2 patch (so you are left with a
282base 2.6.12 kernel source) and then apply the new 2.6.12.3 patch. 293base 2.6.12 kernel source) and then apply the new 2.6.12.3 patch.
@@ -342,12 +353,12 @@ The -git kernels
342repository, hence the name). 353repository, hence the name).
343 354
344These patches are usually released daily and represent the current state of 355These patches are usually released daily and represent the current state of
345Linus' tree. They are more experimental than -rc kernels since they are 356Linus's tree. They are more experimental than -rc kernels since they are
346generated automatically without even a cursory glance to see if they are 357generated automatically without even a cursory glance to see if they are
347sane. 358sane.
348 359
349-git patches are not incremental and apply either to a base 2.6.x kernel or 360-git patches are not incremental and apply either to a base 2.6.x kernel or
350a base 2.6.x-rc kernel - you can see which from their name. 361a base 2.6.x-rc kernel -- you can see which from their name.
351A patch named 2.6.12-git1 applies to the 2.6.12 kernel source and a patch 362A patch named 2.6.12-git1 applies to the 2.6.12 kernel source and a patch
352named 2.6.13-rc3-git2 applies to the source of the 2.6.13-rc3 kernel. 363named 2.6.13-rc3-git2 applies to the source of the 2.6.13-rc3 kernel.
353 364
@@ -390,12 +401,12 @@ You should generally strive to get your patches into mainline via -mm to
390ensure maximum testing. 401ensure maximum testing.
391 402
392This branch is in constant flux and contains many experimental features, a 403This branch is in constant flux and contains many experimental features, a
393lot of debugging patches not appropriate for mainline etc and is the most 404lot of debugging patches not appropriate for mainline etc., and is the most
394experimental of the branches described in this document. 405experimental of the branches described in this document.
395 406
396These kernels are not appropriate for use on systems that are supposed to be 407These kernels are not appropriate for use on systems that are supposed to be
397stable and they are more risky to run than any of the other branches (make 408stable and they are more risky to run than any of the other branches (make
398sure you have up-to-date backups - that goes for any experimental kernel but 409sure you have up-to-date backups -- that goes for any experimental kernel but
399even more so for -mm kernels). 410even more so for -mm kernels).
400 411
401These kernels in addition to all the other experimental patches they contain 412These kernels in addition to all the other experimental patches they contain
@@ -433,7 +444,11 @@ $ cd ..
433$ mv linux-2.6.12-mm1 linux-2.6.13-rc3-mm3 # rename the source dir 444$ mv linux-2.6.12-mm1 linux-2.6.13-rc3-mm3 # rename the source dir
434 445
435 446
436This concludes this list of explanations of the various kernel trees and I 447This concludes this list of explanations of the various kernel trees.
437hope you are now crystal clear on how to apply the various patches and help 448I hope you are now clear on how to apply the various patches and help testing
438testing the kernel. 449the kernel.
450
451Thank you's to Randy Dunlap, Rolf Eike Beer, Linus Torvalds, Bodo Eggert,
452Johannes Stezenbach, Grant Coady, Pavel Machek and others that I may have
453forgotten for their reviews and contributions to this document.
439 454
diff --git a/Documentation/block/barrier.txt b/Documentation/block/barrier.txt
new file mode 100644
index 000000000000..03971518b222
--- /dev/null
+++ b/Documentation/block/barrier.txt
@@ -0,0 +1,271 @@
1I/O Barriers
2============
3Tejun Heo <htejun@gmail.com>, July 22 2005
4
5I/O barrier requests are used to guarantee ordering around the barrier
6requests. Unless you're crazy enough to use disk drives for
7implementing synchronization constructs (wow, sounds interesting...),
8the ordering is meaningful only for write requests for things like
9journal checkpoints. All requests queued before a barrier request
10must be finished (made it to the physical medium) before the barrier
11request is started, and all requests queued after the barrier request
12must be started only after the barrier request is finished (again,
13made it to the physical medium).
14
15In other words, I/O barrier requests have the following two properties.
16
171. Request ordering
18
19Requests cannot pass the barrier request. Preceding requests are
20processed before the barrier and following requests after.
21
22Depending on what features a drive supports, this can be done in one
23of the following three ways.
24
25i. For devices which have queue depth greater than 1 (TCQ devices) and
26support ordered tags, block layer can just issue the barrier as an
27ordered request and the lower level driver, controller and drive
28itself are responsible for making sure that the ordering contraint is
29met. Most modern SCSI controllers/drives should support this.
30
31NOTE: SCSI ordered tag isn't currently used due to limitation in the
32 SCSI midlayer, see the following random notes section.
33
34ii. For devices which have queue depth greater than 1 but don't
35support ordered tags, block layer ensures that the requests preceding
36a barrier request finishes before issuing the barrier request. Also,
37it defers requests following the barrier until the barrier request is
38finished. Older SCSI controllers/drives and SATA drives fall in this
39category.
40
41iii. Devices which have queue depth of 1. This is a degenerate case
42of ii. Just keeping issue order suffices. Ancient SCSI
43controllers/drives and IDE drives are in this category.
44
452. Forced flushing to physcial medium
46
47Again, if you're not gonna do synchronization with disk drives (dang,
48it sounds even more appealing now!), the reason you use I/O barriers
49is mainly to protect filesystem integrity when power failure or some
50other events abruptly stop the drive from operating and possibly make
51the drive lose data in its cache. So, I/O barriers need to guarantee
52that requests actually get written to non-volatile medium in order.
53
54There are four cases,
55
56i. No write-back cache. Keeping requests ordered is enough.
57
58ii. Write-back cache but no flush operation. There's no way to
59gurantee physical-medium commit order. This kind of devices can't to
60I/O barriers.
61
62iii. Write-back cache and flush operation but no FUA (forced unit
63access). We need two cache flushes - before and after the barrier
64request.
65
66iv. Write-back cache, flush operation and FUA. We still need one
67flush to make sure requests preceding a barrier are written to medium,
68but post-barrier flush can be avoided by using FUA write on the
69barrier itself.
70
71
72How to support barrier requests in drivers
73------------------------------------------
74
75All barrier handling is done inside block layer proper. All low level
76drivers have to are implementing its prepare_flush_fn and using one
77the following two functions to indicate what barrier type it supports
78and how to prepare flush requests. Note that the term 'ordered' is
79used to indicate the whole sequence of performing barrier requests
80including draining and flushing.
81
82typedef void (prepare_flush_fn)(request_queue_t *q, struct request *rq);
83
84int blk_queue_ordered(request_queue_t *q, unsigned ordered,
85 prepare_flush_fn *prepare_flush_fn,
86 unsigned gfp_mask);
87
88int blk_queue_ordered_locked(request_queue_t *q, unsigned ordered,
89 prepare_flush_fn *prepare_flush_fn,
90 unsigned gfp_mask);
91
92The only difference between the two functions is whether or not the
93caller is holding q->queue_lock on entry. The latter expects the
94caller is holding the lock.
95
96@q : the queue in question
97@ordered : the ordered mode the driver/device supports
98@prepare_flush_fn : this function should prepare @rq such that it
99 flushes cache to physical medium when executed
100@gfp_mask : gfp_mask used when allocating data structures
101 for ordered processing
102
103For example, SCSI disk driver's prepare_flush_fn looks like the
104following.
105
106static void sd_prepare_flush(request_queue_t *q, struct request *rq)
107{
108 memset(rq->cmd, 0, sizeof(rq->cmd));
109 rq->flags |= REQ_BLOCK_PC;
110 rq->timeout = SD_TIMEOUT;
111 rq->cmd[0] = SYNCHRONIZE_CACHE;
112}
113
114The following seven ordered modes are supported. The following table
115shows which mode should be used depending on what features a
116device/driver supports. In the leftmost column of table,
117QUEUE_ORDERED_ prefix is omitted from the mode names to save space.
118
119The table is followed by description of each mode. Note that in the
120descriptions of QUEUE_ORDERED_DRAIN*, '=>' is used whereas '->' is
121used for QUEUE_ORDERED_TAG* descriptions. '=>' indicates that the
122preceding step must be complete before proceeding to the next step.
123'->' indicates that the next step can start as soon as the previous
124step is issued.
125
126 write-back cache ordered tag flush FUA
127-----------------------------------------------------------------------
128NONE yes/no N/A no N/A
129DRAIN no no N/A N/A
130DRAIN_FLUSH yes no yes no
131DRAIN_FUA yes no yes yes
132TAG no yes N/A N/A
133TAG_FLUSH yes yes yes no
134TAG_FUA yes yes yes yes
135
136
137QUEUE_ORDERED_NONE
138 I/O barriers are not needed and/or supported.
139
140 Sequence: N/A
141
142QUEUE_ORDERED_DRAIN
143 Requests are ordered by draining the request queue and cache
144 flushing isn't needed.
145
146 Sequence: drain => barrier
147
148QUEUE_ORDERED_DRAIN_FLUSH
149 Requests are ordered by draining the request queue and both
150 pre-barrier and post-barrier cache flushings are needed.
151
152 Sequence: drain => preflush => barrier => postflush
153
154QUEUE_ORDERED_DRAIN_FUA
155 Requests are ordered by draining the request queue and
156 pre-barrier cache flushing is needed. By using FUA on barrier
157 request, post-barrier flushing can be skipped.
158
159 Sequence: drain => preflush => barrier
160
161QUEUE_ORDERED_TAG
162 Requests are ordered by ordered tag and cache flushing isn't
163 needed.
164
165 Sequence: barrier
166
167QUEUE_ORDERED_TAG_FLUSH
168 Requests are ordered by ordered tag and both pre-barrier and
169 post-barrier cache flushings are needed.
170
171 Sequence: preflush -> barrier -> postflush
172
173QUEUE_ORDERED_TAG_FUA
174 Requests are ordered by ordered tag and pre-barrier cache
175 flushing is needed. By using FUA on barrier request,
176 post-barrier flushing can be skipped.
177
178 Sequence: preflush -> barrier
179
180
181Random notes/caveats
182--------------------
183
184* SCSI layer currently can't use TAG ordering even if the drive,
185controller and driver support it. The problem is that SCSI midlayer
186request dispatch function is not atomic. It releases queue lock and
187switch to SCSI host lock during issue and it's possible and likely to
188happen in time that requests change their relative positions. Once
189this problem is solved, TAG ordering can be enabled.
190
191* Currently, no matter which ordered mode is used, there can be only
192one barrier request in progress. All I/O barriers are held off by
193block layer until the previous I/O barrier is complete. This doesn't
194make any difference for DRAIN ordered devices, but, for TAG ordered
195devices with very high command latency, passing multiple I/O barriers
196to low level *might* be helpful if they are very frequent. Well, this
197certainly is a non-issue. I'm writing this just to make clear that no
198two I/O barrier is ever passed to low-level driver.
199
200* Completion order. Requests in ordered sequence are issued in order
201but not required to finish in order. Barrier implementation can
202handle out-of-order completion of ordered sequence. IOW, the requests
203MUST be processed in order but the hardware/software completion paths
204are allowed to reorder completion notifications - eg. current SCSI
205midlayer doesn't preserve completion order during error handling.
206
207* Requeueing order. Low-level drivers are free to requeue any request
208after they removed it from the request queue with
209blkdev_dequeue_request(). As barrier sequence should be kept in order
210when requeued, generic elevator code takes care of putting requests in
211order around barrier. See blk_ordered_req_seq() and
212ELEVATOR_INSERT_REQUEUE handling in __elv_add_request() for details.
213
214Note that block drivers must not requeue preceding requests while
215completing latter requests in an ordered sequence. Currently, no
216error checking is done against this.
217
218* Error handling. Currently, block layer will report error to upper
219layer if any of requests in an ordered sequence fails. Unfortunately,
220this doesn't seem to be enough. Look at the following request flow.
221QUEUE_ORDERED_TAG_FLUSH is in use.
222
223 [0] [1] [2] [3] [pre] [barrier] [post] < [4] [5] [6] ... >
224 still in elevator
225
226Let's say request [2], [3] are write requests to update file system
227metadata (journal or whatever) and [barrier] is used to mark that
228those updates are valid. Consider the following sequence.
229
230 i. Requests [0] ~ [post] leaves the request queue and enters
231 low-level driver.
232 ii. After a while, unfortunately, something goes wrong and the
233 drive fails [2]. Note that any of [0], [1] and [3] could have
234 completed by this time, but [pre] couldn't have been finished
235 as the drive must process it in order and it failed before
236 processing that command.
237 iii. Error handling kicks in and determines that the error is
238 unrecoverable and fails [2], and resumes operation.
239 iv. [pre] [barrier] [post] gets processed.
240 v. *BOOM* power fails
241
242The problem here is that the barrier request is *supposed* to indicate
243that filesystem update requests [2] and [3] made it safely to the
244physical medium and, if the machine crashes after the barrier is
245written, filesystem recovery code can depend on that. Sadly, that
246isn't true in this case anymore. IOW, the success of a I/O barrier
247should also be dependent on success of some of the preceding requests,
248where only upper layer (filesystem) knows what 'some' is.
249
250This can be solved by implementing a way to tell the block layer which
251requests affect the success of the following barrier request and
252making lower lever drivers to resume operation on error only after
253block layer tells it to do so.
254
255As the probability of this happening is very low and the drive should
256be faulty, implementing the fix is probably an overkill. But, still,
257it's there.
258
259* In previous drafts of barrier implementation, there was fallback
260mechanism such that, if FUA or ordered TAG fails, less fancy ordered
261mode can be selected and the failed barrier request is retried
262automatically. The rationale for this feature was that as FUA is
263pretty new in ATA world and ordered tag was never used widely, there
264could be devices which report to support those features but choke when
265actually given such requests.
266
267 This was removed for two reasons 1. it's an overkill 2. it's
268impossible to implement properly when TAG ordering is used as low
269level drivers resume after an error automatically. If it's ever
270needed adding it back and modifying low level drivers accordingly
271shouldn't be difficult.
diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt
index 0fe01c805480..8e63831971d5 100644
--- a/Documentation/block/biodoc.txt
+++ b/Documentation/block/biodoc.txt
@@ -31,7 +31,7 @@ The following people helped with review comments and inputs for this
31document: 31document:
32 Christoph Hellwig <hch@infradead.org> 32 Christoph Hellwig <hch@infradead.org>
33 Arjan van de Ven <arjanv@redhat.com> 33 Arjan van de Ven <arjanv@redhat.com>
34 Randy Dunlap <rddunlap@osdl.org> 34 Randy Dunlap <rdunlap@xenotime.net>
35 Andre Hedrick <andre@linux-ide.org> 35 Andre Hedrick <andre@linux-ide.org>
36 36
37The following people helped with fixes/contributions to the bio patches 37The following people helped with fixes/contributions to the bio patches
@@ -263,14 +263,8 @@ A flag in the bio structure, BIO_BARRIER is used to identify a barrier i/o.
263The generic i/o scheduler would make sure that it places the barrier request and 263The generic i/o scheduler would make sure that it places the barrier request and
264all other requests coming after it after all the previous requests in the 264all other requests coming after it after all the previous requests in the
265queue. Barriers may be implemented in different ways depending on the 265queue. Barriers may be implemented in different ways depending on the
266driver. A SCSI driver for example could make use of ordered tags to 266driver. For more details regarding I/O barriers, please read barrier.txt
267preserve the necessary ordering with a lower impact on throughput. For IDE 267in this directory.
268this might be two sync cache flush: a pre and post flush when encountering
269a barrier write.
270
271There is a provision for queues to indicate what kind of barriers they
272can provide. This is as of yet unmerged, details will be added here once it
273is in the kernel.
274 268
2751.2.2 Request Priority/Latency 2691.2.2 Request Priority/Latency
276 270
diff --git a/Documentation/block/stat.txt b/Documentation/block/stat.txt
new file mode 100644
index 000000000000..0dbc946de2ea
--- /dev/null
+++ b/Documentation/block/stat.txt
@@ -0,0 +1,82 @@
1Block layer statistics in /sys/block/<dev>/stat
2===============================================
3
4This file documents the contents of the /sys/block/<dev>/stat file.
5
6The stat file provides several statistics about the state of block
7device <dev>.
8
9Q. Why are there multiple statistics in a single file? Doesn't sysfs
10 normally contain a single value per file?
11A. By having a single file, the kernel can guarantee that the statistics
12 represent a consistent snapshot of the state of the device. If the
13 statistics were exported as multiple files containing one statistic
14 each, it would be impossible to guarantee that a set of readings
15 represent a single point in time.
16
17The stat file consists of a single line of text containing 11 decimal
18values separated by whitespace. The fields are summarized in the
19following table, and described in more detail below.
20
21Name units description
22---- ----- -----------
23read I/Os requests number of read I/Os processed
24read merges requests number of read I/Os merged with in-queue I/O
25read sectors sectors number of sectors read
26read ticks milliseconds total wait time for read requests
27write I/Os requests number of write I/Os processed
28write merges requests number of write I/Os merged with in-queue I/O
29write sectors sectors number of sectors written
30write ticks milliseconds total wait time for write requests
31in_flight requests number of I/Os currently in flight
32io_ticks milliseconds total time this block device has been active
33time_in_queue milliseconds total wait time for all requests
34
35read I/Os, write I/Os
36=====================
37
38These values increment when an I/O request completes.
39
40read merges, write merges
41=========================
42
43These values increment when an I/O request is merged with an
44already-queued I/O request.
45
46read sectors, write sectors
47===========================
48
49These values count the number of sectors read from or written to this
50block device. The "sectors" in question are the standard UNIX 512-byte
51sectors, not any device- or filesystem-specific block size. The
52counters are incremented when the I/O completes.
53
54read ticks, write ticks
55=======================
56
57These values count the number of milliseconds that I/O requests have
58waited on this block device. If there are multiple I/O requests waiting,
59these values will increase at a rate greater than 1000/second; for
60example, if 60 read requests wait for an average of 30 ms, the read_ticks
61field will increase by 60*30 = 1800.
62
63in_flight
64=========
65
66This value counts the number of I/O requests that have been issued to
67the device driver but have not yet completed. It does not include I/O
68requests that are in the queue but not yet issued to the device driver.
69
70io_ticks
71========
72
73This value counts the number of milliseconds during which the device has
74had I/O requests queued.
75
76time_in_queue
77=============
78
79This value counts the number of milliseconds that I/O requests have waited
80on this block device. If there are multiple I/O requests waiting, this
81value will increase as the product of the number of milliseconds times the
82number of requests waiting (see "read ticks" above for an example).
diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt
index 7eb715e07eda..4ae418889b88 100644
--- a/Documentation/cachetlb.txt
+++ b/Documentation/cachetlb.txt
@@ -136,7 +136,7 @@ changes occur:
1368) void lazy_mmu_prot_update(pte_t pte) 1368) void lazy_mmu_prot_update(pte_t pte)
137 This interface is called whenever the protection on 137 This interface is called whenever the protection on
138 any user PTEs change. This interface provides a notification 138 any user PTEs change. This interface provides a notification
139 to architecture specific code to take appropiate action. 139 to architecture specific code to take appropriate action.
140 140
141 141
142Next, we have the cache flushing interfaces. In general, when Linux 142Next, we have the cache flushing interfaces. In general, when Linux
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
index 933fae74c337..f4b8dc4237e6 100644
--- a/Documentation/cpu-freq/governors.txt
+++ b/Documentation/cpu-freq/governors.txt
@@ -27,6 +27,7 @@ Contents:
272.2 Powersave 272.2 Powersave
282.3 Userspace 282.3 Userspace
292.4 Ondemand 292.4 Ondemand
302.5 Conservative
30 31
313. The Governor Interface in the CPUfreq Core 323. The Governor Interface in the CPUfreq Core
32 33
@@ -110,9 +111,64 @@ directory.
110 111
111The CPUfreq govenor "ondemand" sets the CPU depending on the 112The CPUfreq govenor "ondemand" sets the CPU depending on the
112current usage. To do this the CPU must have the capability to 113current usage. To do this the CPU must have the capability to
113switch the frequency very fast. 114switch the frequency very quickly. There are a number of sysfs file
114 115accessible parameters:
115 116
117sampling_rate: measured in uS (10^-6 seconds), this is how often you
118want the kernel to look at the CPU usage and to make decisions on
119what to do about the frequency. Typically this is set to values of
120around '10000' or more.
121
122show_sampling_rate_(min|max): the minimum and maximum sampling rates
123available that you may set 'sampling_rate' to.
124
125up_threshold: defines what the average CPU usaged between the samplings
126of 'sampling_rate' needs to be for the kernel to make a decision on
127whether it should increase the frequency. For example when it is set
128to its default value of '80' it means that between the checking
129intervals the CPU needs to be on average more than 80% in use to then
130decide that the CPU frequency needs to be increased.
131
132sampling_down_factor: this parameter controls the rate that the CPU
133makes a decision on when to decrease the frequency. When set to its
134default value of '5' it means that at 1/5 the sampling_rate the kernel
135makes a decision to lower the frequency. Five "lower rate" decisions
136have to be made in a row before the CPU frequency is actually lower.
137If set to '1' then the frequency decreases as quickly as it increases,
138if set to '2' it decreases at half the rate of the increase.
139
140ignore_nice_load: this parameter takes a value of '0' or '1', when set
141to '0' (its default) then all processes are counted towards towards the
142'cpu utilisation' value. When set to '1' then processes that are
143run with a 'nice' value will not count (and thus be ignored) in the
144overal usage calculation. This is useful if you are running a CPU
145intensive calculation on your laptop that you do not care how long it
146takes to complete as you can 'nice' it and prevent it from taking part
147in the deciding process of whether to increase your CPU frequency.
148
149
1502.5 Conservative
151----------------
152
153The CPUfreq governor "conservative", much like the "ondemand"
154governor, sets the CPU depending on the current usage. It differs in
155behaviour in that it gracefully increases and decreases the CPU speed
156rather than jumping to max speed the moment there is any load on the
157CPU. This behaviour more suitable in a battery powered environment.
158The governor is tweaked in the same manner as the "ondemand" governor
159through sysfs with the addition of:
160
161freq_step: this describes what percentage steps the cpu freq should be
162increased and decreased smoothly by. By default the cpu frequency will
163increase in 5% chunks of your maximum cpu frequency. You can change this
164value to anywhere between 0 and 100 where '0' will effectively lock your
165CPU at a speed regardless of its load whilst '100' will, in theory, make
166it behave identically to the "ondemand" governor.
167
168down_threshold: same as the 'up_threshold' found for the "ondemand"
169governor but for the opposite direction. For example when set to its
170default value of '20' it means that if the CPU usage needs to be below
17120% between samples to have the frequency decreased.
116 172
1173. The Governor Interface in the CPUfreq Core 1733. The Governor Interface in the CPUfreq Core
118============================================= 174=============================================
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
new file mode 100644
index 000000000000..08c5d04f3086
--- /dev/null
+++ b/Documentation/cpu-hotplug.txt
@@ -0,0 +1,357 @@
1 CPU hotplug Support in Linux(tm) Kernel
2
3 Maintainers:
4 CPU Hotplug Core:
5 Rusty Russell <rusty@rustycorp.com.au>
6 Srivatsa Vaddagiri <vatsa@in.ibm.com>
7 i386:
8 Zwane Mwaikambo <zwane@arm.linux.org.uk>
9 ppc64:
10 Nathan Lynch <nathanl@austin.ibm.com>
11 Joel Schopp <jschopp@austin.ibm.com>
12 ia64/x86_64:
13 Ashok Raj <ashok.raj@intel.com>
14
15Authors: Ashok Raj <ashok.raj@intel.com>
16Lots of feedback: Nathan Lynch <nathanl@austin.ibm.com>,
17 Joel Schopp <jschopp@austin.ibm.com>
18
19Introduction
20
21Modern advances in system architectures have introduced advanced error
22reporting and correction capabilities in processors. CPU architectures permit
23partitioning support, where compute resources of a single CPU could be made
24available to virtual machine environments. There are couple OEMS that
25support NUMA hardware which are hot pluggable as well, where physical
26node insertion and removal require support for CPU hotplug.
27
28Such advances require CPUs available to a kernel to be removed either for
29provisioning reasons, or for RAS purposes to keep an offending CPU off
30system execution path. Hence the need for CPU hotplug support in the
31Linux kernel.
32
33A more novel use of CPU-hotplug support is its use today in suspend
34resume support for SMP. Dual-core and HT support makes even
35a laptop run SMP kernels which didn't support these methods. SMP support
36for suspend/resume is a work in progress.
37
38General Stuff about CPU Hotplug
39--------------------------------
40
41Command Line Switches
42---------------------
43maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
44 maxcpus=2 will only boot 2. You can choose to bring the
45 other cpus later online, read FAQ's for more info.
46
47additional_cpus=n [x86_64 only] use this to limit hotpluggable cpus.
48 This option sets
49 cpu_possible_map = cpu_present_map + additional_cpus
50
51CPU maps and such
52-----------------
53[More on cpumaps and primitive to manipulate, please check
54include/linux/cpumask.h that has more descriptive text.]
55
56cpu_possible_map: Bitmap of possible CPUs that can ever be available in the
57system. This is used to allocate some boot time memory for per_cpu variables
58that aren't designed to grow/shrink as CPUs are made available or removed.
59Once set during boot time discovery phase, the map is static, i.e no bits
60are added or removed anytime. Trimming it accurately for your system needs
61upfront can save some boot time memory. See below for how we use heuristics
62in x86_64 case to keep this under check.
63
64cpu_online_map: Bitmap of all CPUs currently online. Its set in __cpu_up()
65after a cpu is available for kernel scheduling and ready to receive
66interrupts from devices. Its cleared when a cpu is brought down using
67__cpu_disable(), before which all OS services including interrupts are
68migrated to another target CPU.
69
70cpu_present_map: Bitmap of CPUs currently present in the system. Not all
71of them may be online. When physical hotplug is processed by the relevant
72subsystem (e.g ACPI) can change and new bit either be added or removed
73from the map depending on the event is hot-add/hot-remove. There are currently
74no locking rules as of now. Typical usage is to init topology during boot,
75at which time hotplug is disabled.
76
77You really dont need to manipulate any of the system cpu maps. They should
78be read-only for most use. When setting up per-cpu resources almost always use
79cpu_possible_map/for_each_cpu() to iterate.
80
81Never use anything other than cpumask_t to represent bitmap of CPUs.
82
83#include <linux/cpumask.h>
84
85for_each_cpu - Iterate over cpu_possible_map
86for_each_online_cpu - Iterate over cpu_online_map
87for_each_present_cpu - Iterate over cpu_present_map
88for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.
89
90#include <linux/cpu.h>
91lock_cpu_hotplug() and unlock_cpu_hotplug():
92
93The above calls are used to inhibit cpu hotplug operations. While holding the
94cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid
95cpus going away, you could also use preempt_disable() and preempt_enable()
96for those sections. Just remember the critical section cannot call any
97function that can sleep or schedule this process away. The preempt_disable()
98will work as long as stop_machine_run() is used to take a cpu down.
99
100CPU Hotplug - Frequently Asked Questions.
101
102Q: How to i enable my kernel to support CPU hotplug?
103A: When doing make defconfig, Enable CPU hotplug support
104
105 "Processor type and Features" -> Support for Hotpluggable CPUs
106
107Make sure that you have CONFIG_HOTPLUG, and CONFIG_SMP turned on as well.
108
109You would need to enable CONFIG_HOTPLUG_CPU for SMP suspend/resume support
110as well.
111
112Q: What architectures support CPU hotplug?
113A: As of 2.6.14, the following architectures support CPU hotplug.
114
115i386 (Intel), ppc, ppc64, parisc, s390, ia64 and x86_64
116
117Q: How to test if hotplug is supported on the newly built kernel?
118A: You should now notice an entry in sysfs.
119
120Check if sysfs is mounted, using the "mount" command. You should notice
121an entry as shown below in the output.
122
123....
124none on /sys type sysfs (rw)
125....
126
127if this is not mounted, do the following.
128
129#mkdir /sysfs
130#mount -t sysfs sys /sys
131
132now you should see entries for all present cpu, the following is an example
133in a 8-way system.
134
135#pwd
136#/sys/devices/system/cpu
137#ls -l
138total 0
139drwxr-xr-x 10 root root 0 Sep 19 07:44 .
140drwxr-xr-x 13 root root 0 Sep 19 07:45 ..
141drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0
142drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1
143drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2
144drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3
145drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4
146drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5
147drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6
148drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7
149
150Under each directory you would find an "online" file which is the control
151file to logically online/offline a processor.
152
153Q: Does hot-add/hot-remove refer to physical add/remove of cpus?
154A: The usage of hot-add/remove may not be very consistently used in the code.
155CONFIG_CPU_HOTPLUG enables logical online/offline capability in the kernel.
156To support physical addition/removal, one would need some BIOS hooks and
157the platform should have something like an attention button in PCI hotplug.
158CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.
159
160Q: How do i logically offline a CPU?
161A: Do the following.
162
163#echo 0 > /sys/devices/system/cpu/cpuX/online
164
165once the logical offline is successful, check
166
167#cat /proc/interrupts
168
169you should now not see the CPU that you removed. Also online file will report
170the state as 0 when a cpu if offline and 1 when its online.
171
172#To display the current cpu state.
173#cat /sys/devices/system/cpu/cpuX/online
174
175Q: Why cant i remove CPU0 on some systems?
176A: Some architectures may have some special dependency on a certain CPU.
177
178For e.g in IA64 platforms we have ability to sent platform interrupts to the
179OS. a.k.a Corrected Platform Error Interrupts (CPEI). In current ACPI
180specifications, we didn't have a way to change the target CPU. Hence if the
181current ACPI version doesn't support such re-direction, we disable that CPU
182by making it not-removable.
183
184In such cases you will also notice that the online file is missing under cpu0.
185
186Q: How do i find out if a particular CPU is not removable?
187A: Depending on the implementation, some architectures may show this by the
188absence of the "online" file. This is done if it can be determined ahead of
189time that this CPU cannot be removed.
190
191In some situations, this can be a run time check, i.e if you try to remove the
192last CPU, this will not be permitted. You can find such failures by
193investigating the return value of the "echo" command.
194
195Q: What happens when a CPU is being logically offlined?
196A: The following happen, listed in no particular order :-)
197
198- A notification is sent to in-kernel registered modules by sending an event
199 CPU_DOWN_PREPARE
200- All process is migrated away from this outgoing CPU to a new CPU
201- All interrupts targeted to this CPU is migrated to a new CPU
202- timers/bottom half/task lets are also migrated to a new CPU
203- Once all services are migrated, kernel calls an arch specific routine
204 __cpu_disable() to perform arch specific cleanup.
205- Once this is successful, an event for successful cleanup is sent by an event
206 CPU_DEAD.
207
208 "It is expected that each service cleans up when the CPU_DOWN_PREPARE
209 notifier is called, when CPU_DEAD is called its expected there is nothing
210 running on behalf of this CPU that was offlined"
211
212Q: If i have some kernel code that needs to be aware of CPU arrival and
213 departure, how to i arrange for proper notification?
214A: This is what you would need in your kernel code to receive notifications.
215
216 #include <linux/cpu.h>
217 static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
218 unsigned long action, void *hcpu)
219 {
220 unsigned int cpu = (unsigned long)hcpu;
221
222 switch (action) {
223 case CPU_ONLINE:
224 foobar_online_action(cpu);
225 break;
226 case CPU_DEAD:
227 foobar_dead_action(cpu);
228 break;
229 }
230 return NOTIFY_OK;
231 }
232
233 static struct notifier_block foobar_cpu_notifer =
234 {
235 .notifier_call = foobar_cpu_callback,
236 };
237
238
239In your init function,
240
241 register_cpu_notifier(&foobar_cpu_notifier);
242
243You can fail PREPARE notifiers if something doesn't work to prepare resources.
244This will stop the activity and send a following CANCELED event back.
245
246CPU_DEAD should not be failed, its just a goodness indication, but bad
247things will happen if a notifier in path sent a BAD notify code.
248
249Q: I don't see my action being called for all CPUs already up and running?
250A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined.
251 If you need to perform some action for each cpu already in the system, then
252
253 for_each_online_cpu(i) {
254 foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i);
255 foobar_cpu_callback(&foobar-cpu_notifier, CPU_ONLINE, i);
256 }
257
258Q: If i would like to develop cpu hotplug support for a new architecture,
259 what do i need at a minimum?
260A: The following are what is required for CPU hotplug infrastructure to work
261 correctly.
262
263 - Make sure you have an entry in Kconfig to enable CONFIG_HOTPLUG_CPU
264 - __cpu_up() - Arch interface to bring up a CPU
265 - __cpu_disable() - Arch interface to shutdown a CPU, no more interrupts
266 can be handled by the kernel after the routine
267 returns. Including local APIC timers etc are
268 shutdown.
269 - __cpu_die() - This actually supposed to ensure death of the CPU.
270 Actually look at some example code in other arch
271 that implement CPU hotplug. The processor is taken
272 down from the idle() loop for that specific
273 architecture. __cpu_die() typically waits for some
274 per_cpu state to be set, to ensure the processor
275 dead routine is called to be sure positively.
276
277Q: I need to ensure that a particular cpu is not removed when there is some
278 work specific to this cpu is in progress.
279A: First switch the current thread context to preferred cpu
280
281 int my_func_on_cpu(int cpu)
282 {
283 cpumask_t saved_mask, new_mask = CPU_MASK_NONE;
284 int curr_cpu, err = 0;
285
286 saved_mask = current->cpus_allowed;
287 cpu_set(cpu, new_mask);
288 err = set_cpus_allowed(current, new_mask);
289
290 if (err)
291 return err;
292
293 /*
294 * If we got scheduled out just after the return from
295 * set_cpus_allowed() before running the work, this ensures
296 * we stay locked.
297 */
298 curr_cpu = get_cpu();
299
300 if (curr_cpu != cpu) {
301 err = -EAGAIN;
302 goto ret;
303 } else {
304 /*
305 * Do work : But cant sleep, since get_cpu() disables preempt
306 */
307 }
308 ret:
309 put_cpu();
310 set_cpus_allowed(current, saved_mask);
311 return err;
312 }
313
314
315Q: How do we determine how many CPUs are available for hotplug.
316A: There is no clear spec defined way from ACPI that can give us that
317 information today. Based on some input from Natalie of Unisys,
318 that the ACPI MADT (Multiple APIC Description Tables) marks those possible
319 CPUs in a system with disabled status.
320
321 Andi implemented some simple heuristics that count the number of disabled
322 CPUs in MADT as hotpluggable CPUS. In the case there are no disabled CPUS
323 we assume 1/2 the number of CPUs currently present can be hotplugged.
324
325 Caveat: Today's ACPI MADT can only provide 256 entries since the apicid field
326 in MADT is only 8 bits.
327
328User Space Notification
329
330Hotplug support for devices is common in Linux today. Its being used today to
331support automatic configuration of network, usb and pci devices. A hotplug
332event can be used to invoke an agent script to perform the configuration task.
333
334You can add /etc/hotplug/cpu.agent to handle hotplug notification user space
335scripts.
336
337 #!/bin/bash
338 # $Id: cpu.agent
339 # Kernel hotplug params include:
340 #ACTION=%s [online or offline]
341 #DEVPATH=%s
342 #
343 cd /etc/hotplug
344 . ./hotplug.functions
345
346 case $ACTION in
347 online)
348 echo `date` ":cpu.agent" add cpu >> /tmp/hotplug.txt
349 ;;
350 offline)
351 echo `date` ":cpu.agent" remove cpu >>/tmp/hotplug.txt
352 ;;
353 *)
354 debug_mesg CPU $ACTION event not supported
355 exit 1
356 ;;
357 esac
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index a09a8eb80665..990998ee10b6 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -14,7 +14,10 @@ CONTENTS:
14 1.1 What are cpusets ? 14 1.1 What are cpusets ?
15 1.2 Why are cpusets needed ? 15 1.2 Why are cpusets needed ?
16 1.3 How are cpusets implemented ? 16 1.3 How are cpusets implemented ?
17 1.4 How do I use cpusets ? 17 1.4 What are exclusive cpusets ?
18 1.5 What does notify_on_release do ?
19 1.6 What is memory_pressure ?
20 1.7 How do I use cpusets ?
182. Usage Examples and Syntax 212. Usage Examples and Syntax
19 2.1 Basic Usage 22 2.1 Basic Usage
20 2.2 Adding/removing cpus 23 2.2 Adding/removing cpus
@@ -49,29 +52,6 @@ its cpus_allowed vector, and the kernel page allocator will not
49allocate a page on a node that is not allowed in the requesting tasks 52allocate a page on a node that is not allowed in the requesting tasks
50mems_allowed vector. 53mems_allowed vector.
51 54
52If a cpuset is cpu or mem exclusive, no other cpuset, other than a direct
53ancestor or descendent, may share any of the same CPUs or Memory Nodes.
54A cpuset that is cpu exclusive has a sched domain associated with it.
55The sched domain consists of all cpus in the current cpuset that are not
56part of any exclusive child cpusets.
57This ensures that the scheduler load balacing code only balances
58against the cpus that are in the sched domain as defined above and not
59all of the cpus in the system. This removes any overhead due to
60load balancing code trying to pull tasks outside of the cpu exclusive
61cpuset only to be prevented by the tasks' cpus_allowed mask.
62
63A cpuset that is mem_exclusive restricts kernel allocations for
64page, buffer and other data commonly shared by the kernel across
65multiple users. All cpusets, whether mem_exclusive or not, restrict
66allocations of memory for user space. This enables configuring a
67system so that several independent jobs can share common kernel
68data, such as file system pages, while isolating each jobs user
69allocation in its own cpuset. To do this, construct a large
70mem_exclusive cpuset to hold all the jobs, and construct child,
71non-mem_exclusive cpusets for each individual job. Only a small
72amount of typical kernel memory, such as requests from interrupt
73handlers, is allowed to be taken outside even a mem_exclusive cpuset.
74
75User level code may create and destroy cpusets by name in the cpuset 55User level code may create and destroy cpusets by name in the cpuset
76virtual file system, manage the attributes and permissions of these 56virtual file system, manage the attributes and permissions of these
77cpusets and which CPUs and Memory Nodes are assigned to each cpuset, 57cpusets and which CPUs and Memory Nodes are assigned to each cpuset,
@@ -155,7 +135,7 @@ Cpusets extends these two mechanisms as follows:
155The implementation of cpusets requires a few, simple hooks 135The implementation of cpusets requires a few, simple hooks
156into the rest of the kernel, none in performance critical paths: 136into the rest of the kernel, none in performance critical paths:
157 137
158 - in main/init.c, to initialize the root cpuset at system boot. 138 - in init/main.c, to initialize the root cpuset at system boot.
159 - in fork and exit, to attach and detach a task from its cpuset. 139 - in fork and exit, to attach and detach a task from its cpuset.
160 - in sched_setaffinity, to mask the requested CPUs by what's 140 - in sched_setaffinity, to mask the requested CPUs by what's
161 allowed in that tasks cpuset. 141 allowed in that tasks cpuset.
@@ -166,7 +146,7 @@ into the rest of the kernel, none in performance critical paths:
166 and related changes in both sched.c and arch/ia64/kernel/domain.c 146 and related changes in both sched.c and arch/ia64/kernel/domain.c
167 - in the mbind and set_mempolicy system calls, to mask the requested 147 - in the mbind and set_mempolicy system calls, to mask the requested
168 Memory Nodes by what's allowed in that tasks cpuset. 148 Memory Nodes by what's allowed in that tasks cpuset.
169 - in page_alloc, to restrict memory to allowed nodes. 149 - in page_alloc.c, to restrict memory to allowed nodes.
170 - in vmscan.c, to restrict page recovery to the current cpuset. 150 - in vmscan.c, to restrict page recovery to the current cpuset.
171 151
172In addition a new file system, of type "cpuset" may be mounted, 152In addition a new file system, of type "cpuset" may be mounted,
@@ -192,9 +172,15 @@ containing the following files describing that cpuset:
192 172
193 - cpus: list of CPUs in that cpuset 173 - cpus: list of CPUs in that cpuset
194 - mems: list of Memory Nodes in that cpuset 174 - mems: list of Memory Nodes in that cpuset
175 - memory_migrate flag: if set, move pages to cpusets nodes
195 - cpu_exclusive flag: is cpu placement exclusive? 176 - cpu_exclusive flag: is cpu placement exclusive?
196 - mem_exclusive flag: is memory placement exclusive? 177 - mem_exclusive flag: is memory placement exclusive?
197 - tasks: list of tasks (by pid) attached to that cpuset 178 - tasks: list of tasks (by pid) attached to that cpuset
179 - notify_on_release flag: run /sbin/cpuset_release_agent on exit?
180 - memory_pressure: measure of how much paging pressure in cpuset
181
182In addition, the root cpuset only has the following file:
183 - memory_pressure_enabled flag: compute memory_pressure?
198 184
199New cpusets are created using the mkdir system call or shell 185New cpusets are created using the mkdir system call or shell
200command. The properties of a cpuset, such as its flags, allowed 186command. The properties of a cpuset, such as its flags, allowed
@@ -228,7 +214,108 @@ exclusive cpuset. Also, the use of a Linux virtual file system (vfs)
228to represent the cpuset hierarchy provides for a familiar permission 214to represent the cpuset hierarchy provides for a familiar permission
229and name space for cpusets, with a minimum of additional kernel code. 215and name space for cpusets, with a minimum of additional kernel code.
230 216
2311.4 How do I use cpusets ? 217
2181.4 What are exclusive cpusets ?
219--------------------------------
220
221If a cpuset is cpu or mem exclusive, no other cpuset, other than
222a direct ancestor or descendent, may share any of the same CPUs or
223Memory Nodes.
224
225A cpuset that is cpu_exclusive has a scheduler (sched) domain
226associated with it. The sched domain consists of all CPUs in the
227current cpuset that are not part of any exclusive child cpusets.
228This ensures that the scheduler load balancing code only balances
229against the CPUs that are in the sched domain as defined above and
230not all of the CPUs in the system. This removes any overhead due to
231load balancing code trying to pull tasks outside of the cpu_exclusive
232cpuset only to be prevented by the tasks' cpus_allowed mask.
233
234A cpuset that is mem_exclusive restricts kernel allocations for
235page, buffer and other data commonly shared by the kernel across
236multiple users. All cpusets, whether mem_exclusive or not, restrict
237allocations of memory for user space. This enables configuring a
238system so that several independent jobs can share common kernel data,
239such as file system pages, while isolating each jobs user allocation in
240its own cpuset. To do this, construct a large mem_exclusive cpuset to
241hold all the jobs, and construct child, non-mem_exclusive cpusets for
242each individual job. Only a small amount of typical kernel memory,
243such as requests from interrupt handlers, is allowed to be taken
244outside even a mem_exclusive cpuset.
245
246
2471.5 What does notify_on_release do ?
248------------------------------------
249
250If the notify_on_release flag is enabled (1) in a cpuset, then whenever
251the last task in the cpuset leaves (exits or attaches to some other
252cpuset) and the last child cpuset of that cpuset is removed, then
253the kernel runs the command /sbin/cpuset_release_agent, supplying the
254pathname (relative to the mount point of the cpuset file system) of the
255abandoned cpuset. This enables automatic removal of abandoned cpusets.
256The default value of notify_on_release in the root cpuset at system
257boot is disabled (0). The default value of other cpusets at creation
258is the current value of their parents notify_on_release setting.
259
260
2611.6 What is memory_pressure ?
262-----------------------------
263The memory_pressure of a cpuset provides a simple per-cpuset metric
264of the rate that the tasks in a cpuset are attempting to free up in
265use memory on the nodes of the cpuset to satisfy additional memory
266requests.
267
268This enables batch managers monitoring jobs running in dedicated
269cpusets to efficiently detect what level of memory pressure that job
270is causing.
271
272This is useful both on tightly managed systems running a wide mix of
273submitted jobs, which may choose to terminate or re-prioritize jobs that
274are trying to use more memory than allowed on the nodes assigned them,
275and with tightly coupled, long running, massively parallel scientific
276computing jobs that will dramatically fail to meet required performance
277goals if they start to use more memory than allowed to them.
278
279This mechanism provides a very economical way for the batch manager
280to monitor a cpuset for signs of memory pressure. It's up to the
281batch manager or other user code to decide what to do about it and
282take action.
283
284==> Unless this feature is enabled by writing "1" to the special file
285 /dev/cpuset/memory_pressure_enabled, the hook in the rebalance
286 code of __alloc_pages() for this metric reduces to simply noticing
287 that the cpuset_memory_pressure_enabled flag is zero. So only
288 systems that enable this feature will compute the metric.
289
290Why a per-cpuset, running average:
291
292 Because this meter is per-cpuset, rather than per-task or mm,
293 the system load imposed by a batch scheduler monitoring this
294 metric is sharply reduced on large systems, because a scan of
295 the tasklist can be avoided on each set of queries.
296
297 Because this meter is a running average, instead of an accumulating
298 counter, a batch scheduler can detect memory pressure with a
299 single read, instead of having to read and accumulate results
300 for a period of time.
301
302 Because this meter is per-cpuset rather than per-task or mm,
303 the batch scheduler can obtain the key information, memory
304 pressure in a cpuset, with a single read, rather than having to
305 query and accumulate results over all the (dynamically changing)
306 set of tasks in the cpuset.
307
308A per-cpuset simple digital filter (requires a spinlock and 3 words
309of data per-cpuset) is kept, and updated by any task attached to that
310cpuset, if it enters the synchronous (direct) page reclaim code.
311
312A per-cpuset file provides an integer number representing the recent
313(half-life of 10 seconds) rate of direct page reclaims caused by
314the tasks in the cpuset, in units of reclaims attempted per second,
315times 1000.
316
317
3181.7 How do I use cpusets ?
232-------------------------- 319--------------------------
233 320
234In order to minimize the impact of cpusets on critical kernel 321In order to minimize the impact of cpusets on critical kernel
@@ -277,6 +364,30 @@ rewritten to the 'tasks' file of its cpuset. This is done to avoid
277impacting the scheduler code in the kernel with a check for changes 364impacting the scheduler code in the kernel with a check for changes
278in a tasks processor placement. 365in a tasks processor placement.
279 366
367Normally, once a page is allocated (given a physical page
368of main memory) then that page stays on whatever node it
369was allocated, so long as it remains allocated, even if the
370cpusets memory placement policy 'mems' subsequently changes.
371If the cpuset flag file 'memory_migrate' is set true, then when
372tasks are attached to that cpuset, any pages that task had
373allocated to it on nodes in its previous cpuset are migrated
374to the tasks new cpuset. Depending on the implementation,
375this migration may either be done by swapping the page out,
376so that the next time the page is referenced, it will be paged
377into the tasks new cpuset, usually on the node where it was
378referenced, or this migration may be done by directly copying
379the pages from the tasks previous cpuset to the new cpuset,
380where possible to the same node, relative to the new cpuset,
381as the node that held the page, relative to the old cpuset.
382Also if 'memory_migrate' is set true, then if that cpusets
383'mems' file is modified, pages allocated to tasks in that
384cpuset, that were on nodes in the previous setting of 'mems',
385will be moved to nodes in the new setting of 'mems.' Again,
386depending on the implementation, this might be done by swapping,
387or by direct copying. In either case, pages that were not in
388the tasks prior cpuset, or in the cpusets prior 'mems' setting,
389will not be moved.
390
280There is an exception to the above. If hotplug functionality is used 391There is an exception to the above. If hotplug functionality is used
281to remove all the CPUs that are currently assigned to a cpuset, 392to remove all the CPUs that are currently assigned to a cpuset,
282then the kernel will automatically update the cpus_allowed of all 393then the kernel will automatically update the cpus_allowed of all
diff --git a/Documentation/drivers/edac/edac.txt b/Documentation/drivers/edac/edac.txt
new file mode 100644
index 000000000000..d37191fe5681
--- /dev/null
+++ b/Documentation/drivers/edac/edac.txt
@@ -0,0 +1,673 @@
1
2
3EDAC - Error Detection And Correction
4
5Written by Doug Thompson <norsk5@xmission.com>
67 Dec 2005
7
8
9EDAC was written by:
10 Thayne Harbaugh,
11 modified by Dave Peterson, Doug Thompson, et al,
12 from the bluesmoke.sourceforge.net project.
13
14
15============================================================================
16EDAC PURPOSE
17
18The 'edac' kernel module goal is to detect and report errors that occur
19within the computer system. In the initial release, memory Correctable Errors
20(CE) and Uncorrectable Errors (UE) are the primary errors being harvested.
21
22Detecting CE events, then harvesting those events and reporting them,
23CAN be a predictor of future UE events. With CE events, the system can
24continue to operate, but with less safety. Preventive maintainence and
25proactive part replacement of memory DIMMs exhibiting CEs can reduce
26the likelihood of the dreaded UE events and system 'panics'.
27
28
29In addition, PCI Bus Parity and SERR Errors are scanned for on PCI devices
30in order to determine if errors are occurring on data transfers.
31The presence of PCI Parity errors must be examined with a grain of salt.
32There are several addin adapters that do NOT follow the PCI specification
33with regards to Parity generation and reporting. The specification says
34the vendor should tie the parity status bits to 0 if they do not intend
35to generate parity. Some vendors do not do this, and thus the parity bit
36can "float" giving false positives.
37
38The PCI Parity EDAC device has the ability to "skip" known flakey
39cards during the parity scan. These are set by the parity "blacklist"
40interface in the sysfs for PCI Parity. (See the PCI section in the sysfs
41section below.) There is also a parity "whitelist" which is used as
42an explicit list of devices to scan, while the blacklist is a list
43of devices to skip.
44
45EDAC will have future error detectors that will be added or integrated
46into EDAC in the following list:
47
48 MCE Machine Check Exception
49 MCA Machine Check Architecture
50 NMI NMI notification of ECC errors
51 MSRs Machine Specific Register error cases
52 and other mechanisms.
53
54These errors are usually bus errors, ECC errors, thermal throttling
55and the like.
56
57
58============================================================================
59EDAC VERSIONING
60
61EDAC is composed of a "core" module (edac_mc.ko) and several Memory
62Controller (MC) driver modules. On a given system, the CORE
63is loaded and one MC driver will be loaded. Both the CORE and
64the MC driver have individual versions that reflect current release
65level of their respective modules. Thus, to "report" on what version
66a system is running, one must report both the CORE's and the
67MC driver's versions.
68
69
70LOADING
71
72If 'edac' was statically linked with the kernel then no loading is
73necessary. If 'edac' was built as modules then simply modprobe the
74'edac' pieces that you need. You should be able to modprobe
75hardware-specific modules and have the dependencies load the necessary core
76modules.
77
78Example:
79
80$> modprobe amd76x_edac
81
82loads both the amd76x_edac.ko memory controller module and the edac_mc.ko
83core module.
84
85
86============================================================================
87EDAC sysfs INTERFACE
88
89EDAC presents a 'sysfs' interface for control, reporting and attribute
90reporting purposes.
91
92EDAC lives in the /sys/devices/system/edac directory. Within this directory
93there currently reside 2 'edac' components:
94
95 mc memory controller(s) system
96 pci PCI status system
97
98
99============================================================================
100Memory Controller (mc) Model
101
102First a background on the memory controller's model abstracted in EDAC.
103Each mc device controls a set of DIMM memory modules. These modules are
104layed out in a Chip-Select Row (csrowX) and Channel table (chX). There can
105be multiple csrows and two channels.
106
107Memory controllers allow for several csrows, with 8 csrows being a typical value.
108Yet, the actual number of csrows depends on the electrical "loading"
109of a given motherboard, memory controller and DIMM characteristics.
110
111Dual channels allows for 128 bit data transfers to the CPU from memory.
112
113
114 Channel 0 Channel 1
115 ===================================
116 csrow0 | DIMM_A0 | DIMM_B0 |
117 csrow1 | DIMM_A0 | DIMM_B0 |
118 ===================================
119
120 ===================================
121 csrow2 | DIMM_A1 | DIMM_B1 |
122 csrow3 | DIMM_A1 | DIMM_B1 |
123 ===================================
124
125In the above example table there are 4 physical slots on the motherboard
126for memory DIMMs:
127
128 DIMM_A0
129 DIMM_B0
130 DIMM_A1
131 DIMM_B1
132
133Labels for these slots are usually silk screened on the motherboard. Slots
134labeled 'A' are channel 0 in this example. Slots labled 'B'
135are channel 1. Notice that there are two csrows possible on a
136physical DIMM. These csrows are allocated their csrow assignment
137based on the slot into which the memory DIMM is placed. Thus, when 1 DIMM
138is placed in each Channel, the csrows cross both DIMMs.
139
140Memory DIMMs come single or dual "ranked". A rank is a populated csrow.
141Thus, 2 single ranked DIMMs, placed in slots DIMM_A0 and DIMM_B0 above
142will have 1 csrow, csrow0. csrow1 will be empty. On the other hand,
143when 2 dual ranked DIMMs are similiaryly placed, then both csrow0 and
144csrow1 will be populated. The pattern repeats itself for csrow2 and
145csrow3.
146
147The representation of the above is reflected in the directory tree
148in EDAC's sysfs interface. Starting in directory
149/sys/devices/system/edac/mc each memory controller will be represented
150by its own 'mcX' directory, where 'X" is the index of the MC.
151
152
153 ..../edac/mc/
154 |
155 |->mc0
156 |->mc1
157 |->mc2
158 ....
159
160Under each 'mcX' directory each 'csrowX' is again represented by a
161'csrowX', where 'X" is the csrow index:
162
163
164 .../mc/mc0/
165 |
166 |->csrow0
167 |->csrow2
168 |->csrow3
169 ....
170
171Notice that there is no csrow1, which indicates that csrow0 is
172composed of a single ranked DIMMs. This should also apply in both
173Channels, in order to have dual-channel mode be operational. Since
174both csrow2 and csrow3 are populated, this indicates a dual ranked
175set of DIMMs for channels 0 and 1.
176
177
178Within each of the 'mc','mcX' and 'csrowX' directories are several
179EDAC control and attribute files.
180
181
182============================================================================
183DIRECTORY 'mc'
184
185In directory 'mc' are EDAC system overall control and attribute files:
186
187
188Panic on UE control file:
189
190 'panic_on_ue'
191
192 An uncorrectable error will cause a machine panic. This is usually
193 desirable. It is a bad idea to continue when an uncorrectable error
194 occurs - it is indeterminate what was uncorrected and the operating
195 system context might be so mangled that continuing will lead to further
196 corruption. If the kernel has MCE configured, then EDAC will never
197 notice the UE.
198
199 LOAD TIME: module/kernel parameter: panic_on_ue=[0|1]
200
201 RUN TIME: echo "1" >/sys/devices/system/edac/mc/panic_on_ue
202
203
204Log UE control file:
205
206 'log_ue'
207
208 Generate kernel messages describing uncorrectable errors. These errors
209 are reported through the system message log system. UE statistics
210 will be accumulated even when UE logging is disabled.
211
212 LOAD TIME: module/kernel parameter: log_ue=[0|1]
213
214 RUN TIME: echo "1" >/sys/devices/system/edac/mc/log_ue
215
216
217Log CE control file:
218
219 'log_ce'
220
221 Generate kernel messages describing correctable errors. These
222 errors are reported through the system message log system.
223 CE statistics will be accumulated even when CE logging is disabled.
224
225 LOAD TIME: module/kernel parameter: log_ce=[0|1]
226
227 RUN TIME: echo "1" >/sys/devices/system/edac/mc/log_ce
228
229
230Polling period control file:
231
232 'poll_msec'
233
234 The time period, in milliseconds, for polling for error information.
235 Too small a value wastes resources. Too large a value might delay
236 necessary handling of errors and might loose valuable information for
237 locating the error. 1000 milliseconds (once each second) is about
238 right for most uses.
239
240 LOAD TIME: module/kernel parameter: poll_msec=[0|1]
241
242 RUN TIME: echo "1000" >/sys/devices/system/edac/mc/poll_msec
243
244
245Module Version read-only attribute file:
246
247 'mc_version'
248
249 The EDAC CORE modules's version and compile date are shown here to
250 indicate what EDAC is running.
251
252
253
254============================================================================
255'mcX' DIRECTORIES
256
257
258In 'mcX' directories are EDAC control and attribute files for
259this 'X" instance of the memory controllers:
260
261
262Counter reset control file:
263
264 'reset_counters'
265
266 This write-only control file will zero all the statistical counters
267 for UE and CE errors. Zeroing the counters will also reset the timer
268 indicating how long since the last counter zero. This is useful
269 for computing errors/time. Since the counters are always reset at
270 driver initialization time, no module/kernel parameter is available.
271
272 RUN TIME: echo "anything" >/sys/devices/system/edac/mc/mc0/counter_reset
273
274 This resets the counters on memory controller 0
275
276
277Seconds since last counter reset control file:
278
279 'seconds_since_reset'
280
281 This attribute file displays how many seconds have elapsed since the
282 last counter reset. This can be used with the error counters to
283 measure error rates.
284
285
286
287DIMM capability attribute file:
288
289 'edac_capability'
290
291 The EDAC (Error Detection and Correction) capabilities/modes of
292 the memory controller hardware.
293
294
295DIMM Current Capability attribute file:
296
297 'edac_current_capability'
298
299 The EDAC capabilities available with the hardware
300 configuration. This may not be the same as "EDAC capability"
301 if the correct memory is not used. If a memory controller is
302 capable of EDAC, but DIMMs without check bits are in use, then
303 Parity, SECDED, S4ECD4ED capabilities will not be available
304 even though the memory controller might be capable of those
305 modes with the proper memory loaded.
306
307
308Memory Type supported on this controller attribute file:
309
310 'supported_mem_type'
311
312 This attribute file displays the memory type, usually
313 buffered and unbuffered DIMMs.
314
315
316Memory Controller name attribute file:
317
318 'mc_name'
319
320 This attribute file displays the type of memory controller
321 that is being utilized.
322
323
324Memory Controller Module name attribute file:
325
326 'module_name'
327
328 This attribute file displays the memory controller module name,
329 version and date built. The name of the memory controller
330 hardware - some drivers work with multiple controllers and
331 this field shows which hardware is present.
332
333
334Total memory managed by this memory controller attribute file:
335
336 'size_mb'
337
338 This attribute file displays, in count of megabytes, of memory
339 that this instance of memory controller manages.
340
341
342Total Uncorrectable Errors count attribute file:
343
344 'ue_count'
345
346 This attribute file displays the total count of uncorrectable
347 errors that have occurred on this memory controller. If panic_on_ue
348 is set this counter will not have a chance to increment,
349 since EDAC will panic the system.
350
351
352Total UE count that had no information attribute fileY:
353
354 'ue_noinfo_count'
355
356 This attribute file displays the number of UEs that
357 have occurred have occurred with no informations as to which DIMM
358 slot is having errors.
359
360
361Total Correctable Errors count attribute file:
362
363 'ce_count'
364
365 This attribute file displays the total count of correctable
366 errors that have occurred on this memory controller. This
367 count is very important to examine. CEs provide early
368 indications that a DIMM is beginning to fail. This count
369 field should be monitored for non-zero values and report
370 such information to the system administrator.
371
372
373Total Correctable Errors count attribute file:
374
375 'ce_noinfo_count'
376
377 This attribute file displays the number of CEs that
378 have occurred wherewith no informations as to which DIMM slot
379 is having errors. Memory is handicapped, but operational,
380 yet no information is available to indicate which slot
381 the failing memory is in. This count field should be also
382 be monitored for non-zero values.
383
384Device Symlink:
385
386 'device'
387
388 Symlink to the memory controller device
389
390
391
392============================================================================
393'csrowX' DIRECTORIES
394
395In the 'csrowX' directories are EDAC control and attribute files for
396this 'X" instance of csrow:
397
398
399Total Uncorrectable Errors count attribute file:
400
401 'ue_count'
402
403 This attribute file displays the total count of uncorrectable
404 errors that have occurred on this csrow. If panic_on_ue is set
405 this counter will not have a chance to increment, since EDAC
406 will panic the system.
407
408
409Total Correctable Errors count attribute file:
410
411 'ce_count'
412
413 This attribute file displays the total count of correctable
414 errors that have occurred on this csrow. This
415 count is very important to examine. CEs provide early
416 indications that a DIMM is beginning to fail. This count
417 field should be monitored for non-zero values and report
418 such information to the system administrator.
419
420
421Total memory managed by this csrow attribute file:
422
423 'size_mb'
424
425 This attribute file displays, in count of megabytes, of memory
426 that this csrow contatins.
427
428
429Memory Type attribute file:
430
431 'mem_type'
432
433 This attribute file will display what type of memory is currently
434 on this csrow. Normally, either buffered or unbuffered memory.
435
436
437EDAC Mode of operation attribute file:
438
439 'edac_mode'
440
441 This attribute file will display what type of Error detection
442 and correction is being utilized.
443
444
445Device type attribute file:
446
447 'dev_type'
448
449 This attribute file will display what type of DIMM device is
450 being utilized. Example: x4
451
452
453Channel 0 CE Count attribute file:
454
455 'ch0_ce_count'
456
457 This attribute file will display the count of CEs on this
458 DIMM located in channel 0.
459
460
461Channel 0 UE Count attribute file:
462
463 'ch0_ue_count'
464
465 This attribute file will display the count of UEs on this
466 DIMM located in channel 0.
467
468
469Channel 0 DIMM Label control file:
470
471 'ch0_dimm_label'
472
473 This control file allows this DIMM to have a label assigned
474 to it. With this label in the module, when errors occur
475 the output can provide the DIMM label in the system log.
476 This becomes vital for panic events to isolate the
477 cause of the UE event.
478
479 DIMM Labels must be assigned after booting, with information
480 that correctly identifies the physical slot with its
481 silk screen label. This information is currently very
482 motherboard specific and determination of this information
483 must occur in userland at this time.
484
485
486Channel 1 CE Count attribute file:
487
488 'ch1_ce_count'
489
490 This attribute file will display the count of CEs on this
491 DIMM located in channel 1.
492
493
494Channel 1 UE Count attribute file:
495
496 'ch1_ue_count'
497
498 This attribute file will display the count of UEs on this
499 DIMM located in channel 0.
500
501
502Channel 1 DIMM Label control file:
503
504 'ch1_dimm_label'
505
506 This control file allows this DIMM to have a label assigned
507 to it. With this label in the module, when errors occur
508 the output can provide the DIMM label in the system log.
509 This becomes vital for panic events to isolate the
510 cause of the UE event.
511
512 DIMM Labels must be assigned after booting, with information
513 that correctly identifies the physical slot with its
514 silk screen label. This information is currently very
515 motherboard specific and determination of this information
516 must occur in userland at this time.
517
518
519============================================================================
520SYSTEM LOGGING
521
522If logging for UEs and CEs are enabled then system logs will have
523error notices indicating errors that have been detected:
524
525MC0: CE page 0x283, offset 0xce0, grain 8, syndrome 0x6ec3, row 0,
526channel 1 "DIMM_B1": amd76x_edac
527
528MC0: CE page 0x1e5, offset 0xfb0, grain 8, syndrome 0xb741, row 0,
529channel 1 "DIMM_B1": amd76x_edac
530
531
532The structure of the message is:
533 the memory controller (MC0)
534 Error type (CE)
535 memory page (0x283)
536 offset in the page (0xce0)
537 the byte granularity (grain 8)
538 or resolution of the error
539 the error syndrome (0xb741)
540 memory row (row 0)
541 memory channel (channel 1)
542 DIMM label, if set prior (DIMM B1
543 and then an optional, driver-specific message that may
544 have additional information.
545
546Both UEs and CEs with no info will lack all but memory controller,
547error type, a notice of "no info" and then an optional,
548driver-specific error message.
549
550
551
552============================================================================
553PCI Bus Parity Detection
554
555
556On Header Type 00 devices the primary status is looked at
557for any parity error regardless of whether Parity is enabled on the
558device. (The spec indicates parity is generated in some cases).
559On Header Type 01 bridges, the secondary status register is also
560looked at to see if parity ocurred on the bus on the other side of
561the bridge.
562
563
564SYSFS CONFIGURATION
565
566Under /sys/devices/system/edac/pci are control and attribute files as follows:
567
568
569Enable/Disable PCI Parity checking control file:
570
571 'check_pci_parity'
572
573
574 This control file enables or disables the PCI Bus Parity scanning
575 operation. Writing a 1 to this file enables the scanning. Writing
576 a 0 to this file disables the scanning.
577
578 Enable:
579 echo "1" >/sys/devices/system/edac/pci/check_pci_parity
580
581 Disable:
582 echo "0" >/sys/devices/system/edac/pci/check_pci_parity
583
584
585
586Panic on PCI PARITY Error:
587
588 'panic_on_pci_parity'
589
590
591 This control files enables or disables panic'ing when a parity
592 error has been detected.
593
594
595 module/kernel parameter: panic_on_pci_parity=[0|1]
596
597 Enable:
598 echo "1" >/sys/devices/system/edac/pci/panic_on_pci_parity
599
600 Disable:
601 echo "0" >/sys/devices/system/edac/pci/panic_on_pci_parity
602
603
604Parity Count:
605
606 'pci_parity_count'
607
608 This attribute file will display the number of parity errors that
609 have been detected.
610
611
612
613PCI Device Whitelist:
614
615 'pci_parity_whitelist'
616
617 This control file allows for an explicit list of PCI devices to be
618 scanned for parity errors. Only devices found on this list will
619 be examined. The list is a line of hexadecimel VENDOR and DEVICE
620 ID tuples:
621
622 1022:7450,1434:16a6
623
624 One or more can be inserted, seperated by a comma.
625
626 To write the above list doing the following as one command line:
627
628 echo "1022:7450,1434:16a6"
629 > /sys/devices/system/edac/pci/pci_parity_whitelist
630
631
632
633 To display what the whitelist is, simply 'cat' the same file.
634
635
636PCI Device Blacklist:
637
638 'pci_parity_blacklist'
639
640 This control file allows for a list of PCI devices to be
641 skipped for scanning.
642 The list is a line of hexadecimel VENDOR and DEVICE ID tuples:
643
644 1022:7450,1434:16a6
645
646 One or more can be inserted, seperated by a comma.
647
648 To write the above list doing the following as one command line:
649
650 echo "1022:7450,1434:16a6"
651 > /sys/devices/system/edac/pci/pci_parity_blacklist
652
653
654 To display what the whitelist current contatins,
655 simply 'cat' the same file.
656
657=======================================================================
658
659PCI Vendor and Devices IDs can be obtained with the lspci command. Using
660the -n option lspci will display the vendor and device IDs. The system
661adminstrator will have to determine which devices should be scanned or
662skipped.
663
664
665
666The two lists (white and black) are prioritized. blacklist is the lower
667priority and will NOT be utilized when a whitelist has been set.
668Turn OFF a whitelist by an empty echo command:
669
670 echo > /sys/devices/system/edac/pci/pci_parity_whitelist
671
672and any previous blacklist will be utililzed.
673
diff --git a/Documentation/dvb/avermedia.txt b/Documentation/dvb/avermedia.txt
index 2dc260b2b0a4..068070ff13cd 100644
--- a/Documentation/dvb/avermedia.txt
+++ b/Documentation/dvb/avermedia.txt
@@ -150,7 +150,8 @@ Getting the card going
150 150
151 The frontend module sp887x.o, requires an external firmware. 151 The frontend module sp887x.o, requires an external firmware.
152 Please use the command "get_dvb_firmware sp887x" to download 152 Please use the command "get_dvb_firmware sp887x" to download
153 it. Then copy it to /usr/lib/hotplug/firmware. 153 it. Then copy it to /usr/lib/hotplug/firmware or /lib/firmware/
154 (depending on configuration of firmware hotplug).
154 155
155Receiving DVB-T in Australia 156Receiving DVB-T in Australia
156 157
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
index be6eb4c75991..75c28a174092 100644
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -23,7 +23,7 @@ use IO::Handle;
23 23
24@components = ( "sp8870", "sp887x", "tda10045", "tda10046", "av7110", "dec2000t", 24@components = ( "sp8870", "sp887x", "tda10045", "tda10046", "av7110", "dec2000t",
25 "dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", 25 "dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
26 "or51211", "or51132_qam", "or51132_vsb"); 26 "or51211", "or51132_qam", "or51132_vsb", "bluebird");
27 27
28# Check args 28# Check args
29syntax() if (scalar(@ARGV) != 1); 29syntax() if (scalar(@ARGV) != 1);
@@ -34,7 +34,11 @@ for ($i=0; $i < scalar(@components); $i++) {
34 if ($cid eq $components[$i]) { 34 if ($cid eq $components[$i]) {
35 $outfile = eval($cid); 35 $outfile = eval($cid);
36 die $@ if $@; 36 die $@ if $@;
37 print STDERR "Firmware $outfile extracted successfully. Now copy it to either /lib/firmware or /usr/lib/hotplug/firmware/ (depending on your hotplug version).\n"; 37 print STDERR <<EOF;
38Firmware $outfile extracted successfully.
39Now copy it to either /usr/lib/hotplug/firmware or /lib/firmware
40(depending on configuration of firmware hotplug).
41EOF
38 exit(0); 42 exit(0);
39 } 43 }
40} 44}
@@ -243,7 +247,7 @@ sub nxt2002 {
243 my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); 247 my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
244 248
245 checkstandard(); 249 checkstandard();
246 250
247 wgetfile($sourcefile, $url); 251 wgetfile($sourcefile, $url);
248 unzip($sourcefile, $tmpdir); 252 unzip($sourcefile, $tmpdir);
249 verify("$tmpdir/SkyNETU.sys", $hash); 253 verify("$tmpdir/SkyNETU.sys", $hash);
@@ -308,6 +312,19 @@ sub or51132_vsb {
308 $fwfile; 312 $fwfile;
309} 313}
310 314
315sub bluebird {
316 my $url = "http://www.linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw";
317 my $outfile = "dvb-usb-bluebird-01.fw";
318 my $hash = "658397cb9eba9101af9031302671f49d";
319
320 checkstandard();
321
322 wgetfile($outfile, $url);
323 verify($outfile,$hash);
324
325 $outfile;
326}
327
311# --------------------------------------------------------------- 328# ---------------------------------------------------------------
312# Utilities 329# Utilities
313 330
diff --git a/Documentation/dvb/ttusb-dec.txt b/Documentation/dvb/ttusb-dec.txt
index 5c1e984c26a7..b2f271cd784b 100644
--- a/Documentation/dvb/ttusb-dec.txt
+++ b/Documentation/dvb/ttusb-dec.txt
@@ -41,4 +41,5 @@ Hotplug Firmware Loading for 2.6 kernels
41For 2.6 kernels the firmware is loaded at the point that the driver module is 41For 2.6 kernels the firmware is loaded at the point that the driver module is
42loaded. See linux/Documentation/dvb/firmware.txt for more information. 42loaded. See linux/Documentation/dvb/firmware.txt for more information.
43 43
44Copy the three files downloaded above into the /usr/lib/hotplug/firmware directory. 44Copy the three files downloaded above into the /usr/lib/hotplug/firmware or
45/lib/firmware directory (depending on configuration of firmware hotplug).
diff --git a/Documentation/fb/cyblafb/bugs b/Documentation/fb/cyblafb/bugs
index f90cc66ea919..9443a6d72cdd 100644
--- a/Documentation/fb/cyblafb/bugs
+++ b/Documentation/fb/cyblafb/bugs
@@ -11,4 +11,3 @@ Untested features
11 11
12All LCD stuff is untested. If it worked in tridentfb, it should work in 12All LCD stuff is untested. If it worked in tridentfb, it should work in
13cyblafb. Please test and report the results to Knut_Petersen@t-online.de. 13cyblafb. Please test and report the results to Knut_Petersen@t-online.de.
14
diff --git a/Documentation/fb/cyblafb/fb.modes b/Documentation/fb/cyblafb/fb.modes
index cf4351fc32ff..fe0e5223ba86 100644
--- a/Documentation/fb/cyblafb/fb.modes
+++ b/Documentation/fb/cyblafb/fb.modes
@@ -14,142 +14,141 @@
14# 14#
15 15
16mode "640x480-50" 16mode "640x480-50"
17 geometry 640 480 640 3756 8 17 geometry 640 480 2048 4096 8
18 timings 47619 4294967256 24 17 0 216 3 18 timings 47619 4294967256 24 17 0 216 3
19endmode 19endmode
20 20
21mode "640x480-60" 21mode "640x480-60"
22 geometry 640 480 640 3756 8 22 geometry 640 480 2048 4096 8
23 timings 39682 4294967256 24 17 0 216 3 23 timings 39682 4294967256 24 17 0 216 3
24endmode 24endmode
25 25
26mode "640x480-70" 26mode "640x480-70"
27 geometry 640 480 640 3756 8 27 geometry 640 480 2048 4096 8
28 timings 34013 4294967256 24 17 0 216 3 28 timings 34013 4294967256 24 17 0 216 3
29endmode 29endmode
30 30
31mode "640x480-72" 31mode "640x480-72"
32 geometry 640 480 640 3756 8 32 geometry 640 480 2048 4096 8
33 timings 33068 4294967256 24 17 0 216 3 33 timings 33068 4294967256 24 17 0 216 3
34endmode 34endmode
35 35
36mode "640x480-75" 36mode "640x480-75"
37 geometry 640 480 640 3756 8 37 geometry 640 480 2048 4096 8
38 timings 31746 4294967256 24 17 0 216 3 38 timings 31746 4294967256 24 17 0 216 3
39endmode 39endmode
40 40
41mode "640x480-80" 41mode "640x480-80"
42 geometry 640 480 640 3756 8 42 geometry 640 480 2048 4096 8
43 timings 29761 4294967256 24 17 0 216 3 43 timings 29761 4294967256 24 17 0 216 3
44endmode 44endmode
45 45
46mode "640x480-85" 46mode "640x480-85"
47 geometry 640 480 640 3756 8 47 geometry 640 480 2048 4096 8
48 timings 28011 4294967256 24 17 0 216 3 48 timings 28011 4294967256 24 17 0 216 3
49endmode 49endmode
50 50
51mode "800x600-50" 51mode "800x600-50"
52 geometry 800 600 800 3221 8 52 geometry 800 600 2048 4096 8
53 timings 30303 96 24 14 0 136 11 53 timings 30303 96 24 14 0 136 11
54endmode 54endmode
55 55
56mode "800x600-60" 56mode "800x600-60"
57 geometry 800 600 800 3221 8 57 geometry 800 600 2048 4096 8
58 timings 25252 96 24 14 0 136 11 58 timings 25252 96 24 14 0 136 11
59endmode 59endmode
60 60
61mode "800x600-70" 61mode "800x600-70"
62 geometry 800 600 800 3221 8 62 geometry 800 600 2048 4096 8
63 timings 21645 96 24 14 0 136 11 63 timings 21645 96 24 14 0 136 11
64endmode 64endmode
65 65
66mode "800x600-72" 66mode "800x600-72"
67 geometry 800 600 800 3221 8 67 geometry 800 600 2048 4096 8
68 timings 21043 96 24 14 0 136 11 68 timings 21043 96 24 14 0 136 11
69endmode 69endmode
70 70
71mode "800x600-75" 71mode "800x600-75"
72 geometry 800 600 800 3221 8 72 geometry 800 600 2048 4096 8
73 timings 20202 96 24 14 0 136 11 73 timings 20202 96 24 14 0 136 11
74endmode 74endmode
75 75
76mode "800x600-80" 76mode "800x600-80"
77 geometry 800 600 800 3221 8 77 geometry 800 600 2048 4096 8
78 timings 18939 96 24 14 0 136 11 78 timings 18939 96 24 14 0 136 11
79endmode 79endmode
80 80
81mode "800x600-85" 81mode "800x600-85"
82 geometry 800 600 800 3221 8 82 geometry 800 600 2048 4096 8
83 timings 17825 96 24 14 0 136 11 83 timings 17825 96 24 14 0 136 11
84endmode 84endmode
85 85
86mode "1024x768-50" 86mode "1024x768-50"
87 geometry 1024 768 1024 2815 8 87 geometry 1024 768 2048 4096 8
88 timings 19054 144 24 29 0 120 3 88 timings 19054 144 24 29 0 120 3
89endmode 89endmode
90 90
91mode "1024x768-60" 91mode "1024x768-60"
92 geometry 1024 768 1024 2815 8 92 geometry 1024 768 2048 4096 8
93 timings 15880 144 24 29 0 120 3 93 timings 15880 144 24 29 0 120 3
94endmode 94endmode
95 95
96mode "1024x768-70" 96mode "1024x768-70"
97 geometry 1024 768 1024 2815 8 97 geometry 1024 768 2048 4096 8
98 timings 13610 144 24 29 0 120 3 98 timings 13610 144 24 29 0 120 3
99endmode 99endmode
100 100
101mode "1024x768-72" 101mode "1024x768-72"
102 geometry 1024 768 1024 2815 8 102 geometry 1024 768 2048 4096 8
103 timings 13232 144 24 29 0 120 3 103 timings 13232 144 24 29 0 120 3
104endmode 104endmode
105 105
106mode "1024x768-75" 106mode "1024x768-75"
107 geometry 1024 768 1024 2815 8 107 geometry 1024 768 2048 4096 8
108 timings 12703 144 24 29 0 120 3 108 timings 12703 144 24 29 0 120 3
109endmode 109endmode
110 110
111mode "1024x768-80" 111mode "1024x768-80"
112 geometry 1024 768 1024 2815 8 112 geometry 1024 768 2048 4096 8
113 timings 11910 144 24 29 0 120 3 113 timings 11910 144 24 29 0 120 3
114endmode 114endmode
115 115
116mode "1024x768-85" 116mode "1024x768-85"
117 geometry 1024 768 1024 2815 8 117 geometry 1024 768 2048 4096 8
118 timings 11209 144 24 29 0 120 3 118 timings 11209 144 24 29 0 120 3
119endmode 119endmode
120 120
121mode "1280x1024-50" 121mode "1280x1024-50"
122 geometry 1280 1024 1280 2662 8 122 geometry 1280 1024 2048 4096 8
123 timings 11114 232 16 39 0 160 3 123 timings 11114 232 16 39 0 160 3
124endmode 124endmode
125 125
126mode "1280x1024-60" 126mode "1280x1024-60"
127 geometry 1280 1024 1280 2662 8 127 geometry 1280 1024 2048 4096 8
128 timings 9262 232 16 39 0 160 3 128 timings 9262 232 16 39 0 160 3
129endmode 129endmode
130 130
131mode "1280x1024-70" 131mode "1280x1024-70"
132 geometry 1280 1024 1280 2662 8 132 geometry 1280 1024 2048 4096 8
133 timings 7939 232 16 39 0 160 3 133 timings 7939 232 16 39 0 160 3
134endmode 134endmode
135 135
136mode "1280x1024-72" 136mode "1280x1024-72"
137 geometry 1280 1024 1280 2662 8 137 geometry 1280 1024 2048 4096 8
138 timings 7719 232 16 39 0 160 3 138 timings 7719 232 16 39 0 160 3
139endmode 139endmode
140 140
141mode "1280x1024-75" 141mode "1280x1024-75"
142 geometry 1280 1024 1280 2662 8 142 geometry 1280 1024 2048 4096 8
143 timings 7410 232 16 39 0 160 3 143 timings 7410 232 16 39 0 160 3
144endmode 144endmode
145 145
146mode "1280x1024-80" 146mode "1280x1024-80"
147 geometry 1280 1024 1280 2662 8 147 geometry 1280 1024 2048 4096 8
148 timings 6946 232 16 39 0 160 3 148 timings 6946 232 16 39 0 160 3
149endmode 149endmode
150 150
151mode "1280x1024-85" 151mode "1280x1024-85"
152 geometry 1280 1024 1280 2662 8 152 geometry 1280 1024 2048 4096 8
153 timings 6538 232 16 39 0 160 3 153 timings 6538 232 16 39 0 160 3
154endmode 154endmode
155
diff --git a/Documentation/fb/cyblafb/performance b/Documentation/fb/cyblafb/performance
index eb4e47a9cea6..8d15d5dfc6b3 100644
--- a/Documentation/fb/cyblafb/performance
+++ b/Documentation/fb/cyblafb/performance
@@ -77,4 +77,3 @@ patch that speeds up kernel bitblitting a lot ( > 20%).
77| | | | | 77| | | | |
78| | | | | 78| | | | |
79+-----------+-----------------+-----------------+-----------------+ 79+-----------+-----------------+-----------------+-----------------+
80
diff --git a/Documentation/fb/cyblafb/todo b/Documentation/fb/cyblafb/todo
index 80fb2f89b6c1..c5f6d0eae545 100644
--- a/Documentation/fb/cyblafb/todo
+++ b/Documentation/fb/cyblafb/todo
@@ -22,11 +22,10 @@ accelerated color blitting Who needs it? The console driver does use color
22 everything else is done using color expanding 22 everything else is done using color expanding
23 blitting of 1bpp character bitmaps. 23 blitting of 1bpp character bitmaps.
24 24
25xpanning Who needs it?
26
27ioctls Who needs it? 25ioctls Who needs it?
28 26
29TV-out Will be done later 27TV-out Will be done later. Use "vga= " at boot time
28 to set a suitable video mode.
30 29
31??? Feel free to contact me if you have any 30??? Feel free to contact me if you have any
32 feature requests 31 feature requests
diff --git a/Documentation/fb/cyblafb/usage b/Documentation/fb/cyblafb/usage
index e627c8f54211..a39bb3d402a2 100644
--- a/Documentation/fb/cyblafb/usage
+++ b/Documentation/fb/cyblafb/usage
@@ -40,6 +40,16 @@ Selecting Modes
40 None of the modes possible to select as startup modes are affected by 40 None of the modes possible to select as startup modes are affected by
41 the problems described at the end of the next subsection. 41 the problems described at the end of the next subsection.
42 42
43 For all startup modes cyblafb chooses a virtual x resolution of 2048,
44 the only exception is mode 1280x1024 in combination with 32 bpp. This
45 allows ywrap scrolling for all those modes if rotation is 0 or 2, and
46 also fast scrolling if rotation is 1 or 3. The default virtual y reso-
47 lution is 4096 for bpp == 8, 2048 for bpp==16 and 1024 for bpp == 32,
48 again with the only exception of 1280x1024 at 32 bpp.
49
50 Please do set your video memory size to 8 Mb in the Bios setup. Other
51 values will work, but performace is decreased for a lot of modes.
52
43 Mode changes using fbset 53 Mode changes using fbset
44 ======================== 54 ========================
45 55
@@ -54,20 +64,26 @@ Selecting Modes
54 - if a flat panel is found, cyblafb does not allow you 64 - if a flat panel is found, cyblafb does not allow you
55 to program a resolution higher than the physical 65 to program a resolution higher than the physical
56 resolution of the flat panel monitor 66 resolution of the flat panel monitor
57 - cyblafb does not allow xres to differ from xres_virtual
58 - cyblafb does not allow vclk to exceed 230 MHz. As 32 bpp 67 - cyblafb does not allow vclk to exceed 230 MHz. As 32 bpp
59 and (currently) 24 bit modes use a doubled vclk internally, 68 and (currently) 24 bit modes use a doubled vclk internally,
60 the dotclock limit as seen by fbset is 115 MHz for those 69 the dotclock limit as seen by fbset is 115 MHz for those
61 modes and 230 MHz for 8 and 16 bpp modes. 70 modes and 230 MHz for 8 and 16 bpp modes.
71 - cyblafb will allow you to select very high resolutions as
72 long as the hardware can be programmed to these modes. The
73 documented limit 1600x1200 is not enforced, but don't expect
74 perfect signal quality.
62 75
63 Any request that violates the rules given above will be ignored and 76 Any request that violates the rules given above will be either changed
64 fbset will return an error. 77 to something the hardware supports or an error value will be returned.
65 78
66 If you program a virtual y resolution higher than the hardware limit, 79 If you program a virtual y resolution higher than the hardware limit,
67 cyblafb will silently decrease that value to the highest possible 80 cyblafb will silently decrease that value to the highest possible
68 value. 81 value. The same is true for a virtual x resolution that is not
82 supported by the hardware. Cyblafb tries to adapt vyres first because
83 vxres decides if ywrap scrolling is possible or not.
69 84
70 Attempts to disable acceleration are ignored. 85 Attempts to disable acceleration are ignored, I believe that this is
86 safe.
71 87
72 Some video modes that should work do not work as expected. If you use 88 Some video modes that should work do not work as expected. If you use
73 the standard fb.modes, fbset 640x480-60 will program that mode, but 89 the standard fb.modes, fbset 640x480-60 will program that mode, but
@@ -129,10 +145,6 @@ mode 640x480 or 800x600 or 1024x768 or 1280x1024
129verbosity 0 is the default, increase to at least 2 for every 145verbosity 0 is the default, increase to at least 2 for every
130 bug report! 146 bug report!
131 147
132vesafb allows cyblafb to be loaded after vesafb has been
133 loaded. See sections "Module unloading ...".
134
135
136Development hints 148Development hints
137================= 149=================
138 150
@@ -195,7 +207,7 @@ a graphics mode.
195After booting, load cyblafb without any mode and bpp parameter and assign 207After booting, load cyblafb without any mode and bpp parameter and assign
196cyblafb to individual ttys using con2fb, e.g.: 208cyblafb to individual ttys using con2fb, e.g.:
197 209
198 modprobe cyblafb vesafb=1 210 modprobe cyblafb
199 con2fb /dev/fb1 /dev/tty1 211 con2fb /dev/fb1 /dev/tty1
200 212
201Unloading cyblafb works without problems after you assign vesafb to all 213Unloading cyblafb works without problems after you assign vesafb to all
@@ -203,4 +215,3 @@ ttys again, e.g.:
203 215
204 con2fb /dev/fb0 /dev/tty1 216 con2fb /dev/fb0 /dev/tty1
205 rmmod cyblafb 217 rmmod cyblafb
206
diff --git a/Documentation/fb/cyblafb/whatsnew b/Documentation/fb/cyblafb/whatsnew
new file mode 100644
index 000000000000..76c07a26e044
--- /dev/null
+++ b/Documentation/fb/cyblafb/whatsnew
@@ -0,0 +1,29 @@
10.62
2====
3
4 - the vesafb parameter has been removed as I decided to allow the
5 feature without any special parameter.
6
7 - Cyblafb does not use the vga style of panning any longer, now the
8 "right view" register in the graphics engine IO space is used. Without
9 that change it was impossible to use all available memory, and without
10 access to all available memory it is impossible to ywrap.
11
12 - The imageblit function now uses hardware acceleration for all font
13 widths. Hardware blitting across pixel column 2048 is broken in the
14 cyberblade/i1 graphics core, but we work around that hardware bug.
15
16 - modes with vxres != xres are supported now.
17
18 - ywrap scrolling is supported now and the default. This is a big
19 performance gain.
20
21 - default video modes use vyres > yres and vxres > xres to allow
22 almost optimal scrolling speed for normal and rotated screens
23
24 - some features mainly usefull for debugging the upper layers of the
25 framebuffer system have been added, have a look at the code
26
27 - fixed: Oops after unloading cyblafb when reading /proc/io*
28
29 - we work around some bugs of the higher framebuffer layers.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 9b743198f77a..b4a1ea762698 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -47,17 +47,6 @@ Who: Paul E. McKenney <paulmck@us.ibm.com>
47 47
48--------------------------- 48---------------------------
49 49
50What: IEEE1394 Audio and Music Data Transmission Protocol driver,
51 Connection Management Procedures driver
52When: November 2005
53Files: drivers/ieee1394/{amdtp,cmp}*
54Why: These are incomplete, have never worked, and are better implemented
55 in userland via raw1394 (see http://freebob.sourceforge.net/ for
56 example.)
57Who: Jody McIntyre <scjody@steamballoon.com>
58
59---------------------------
60
61What: raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN 50What: raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN
62When: November 2005 51When: November 2005
63Why: Deprecated in favour of the new ioctl-based rawiso interface, which is 52Why: Deprecated in favour of the new ioctl-based rawiso interface, which is
@@ -82,15 +71,6 @@ Who: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
82 71
83--------------------------- 72---------------------------
84 73
85What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid
86When: November 2005
87Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c
88Why: Match the other drivers' name for the same function, duplicate names
89 will be available until removal of old names.
90Who: Grant Coady <gcoady@gmail.com>
91
92---------------------------
93
94What: remove EXPORT_SYMBOL(panic_timeout) 74What: remove EXPORT_SYMBOL(panic_timeout)
95When: April 2006 75When: April 2006
96Files: kernel/panic.c 76Files: kernel/panic.c
@@ -143,6 +123,15 @@ Who: Christoph Hellwig <hch@lst.de>
143 123
144--------------------------- 124---------------------------
145 125
126What: CONFIG_FORCED_INLINING
127When: June 2006
128Why: Config option is there to see if gcc is good enough. (in january
129 2006). If it is, the behavior should just be the default. If it's not,
130 the option should just go away entirely.
131Who: Arjan van de Ven
132
133---------------------------
134
146What: START_ARRAY ioctl for md 135What: START_ARRAY ioctl for md
147When: July 2006 136When: July 2006
148Files: drivers/md/md.c 137Files: drivers/md/md.c
diff --git a/Documentation/filesystems/00-INDEX b/Documentation/filesystems/00-INDEX
index bcfbab899b37..74052d22d868 100644
--- a/Documentation/filesystems/00-INDEX
+++ b/Documentation/filesystems/00-INDEX
@@ -12,14 +12,16 @@ cifs.txt
12 - description of the CIFS filesystem 12 - description of the CIFS filesystem
13coda.txt 13coda.txt
14 - description of the CODA filesystem. 14 - description of the CODA filesystem.
15configfs/
16 - directory containing configfs documentation and example code.
15cramfs.txt 17cramfs.txt
16 - info on the cram filesystem for small storage (ROMs etc) 18 - info on the cram filesystem for small storage (ROMs etc)
17devfs/ 19devfs/
18 - directory containing devfs documentation. 20 - directory containing devfs documentation.
21dlmfs.txt
22 - info on the userspace interface to the OCFS2 DLM.
19ext2.txt 23ext2.txt
20 - info, mount options and specifications for the Ext2 filesystem. 24 - info, mount options and specifications for the Ext2 filesystem.
21fat_cvf.txt
22 - info on the Compressed Volume Files extension to the FAT filesystem
23hpfs.txt 25hpfs.txt
24 - info and mount options for the OS/2 HPFS. 26 - info and mount options for the OS/2 HPFS.
25isofs.txt 27isofs.txt
@@ -32,6 +34,8 @@ ntfs.txt
32 - info and mount options for the NTFS filesystem (Windows NT). 34 - info and mount options for the NTFS filesystem (Windows NT).
33proc.txt 35proc.txt
34 - info on Linux's /proc filesystem. 36 - info on Linux's /proc filesystem.
37ocfs2.txt
38 - info and mount options for the OCFS2 clustered filesystem.
35romfs.txt 39romfs.txt
36 - Description of the ROMFS filesystem. 40 - Description of the ROMFS filesystem.
37smbfs.txt 41smbfs.txt
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
new file mode 100644
index 000000000000..c4ff96b7c4e0
--- /dev/null
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -0,0 +1,434 @@
1
2configfs - Userspace-driven kernel object configuation.
3
4Joel Becker <joel.becker@oracle.com>
5
6Updated: 31 March 2005
7
8Copyright (c) 2005 Oracle Corporation,
9 Joel Becker <joel.becker@oracle.com>
10
11
12[What is configfs?]
13
14configfs is a ram-based filesystem that provides the converse of
15sysfs's functionality. Where sysfs is a filesystem-based view of
16kernel objects, configfs is a filesystem-based manager of kernel
17objects, or config_items.
18
19With sysfs, an object is created in kernel (for example, when a device
20is discovered) and it is registered with sysfs. Its attributes then
21appear in sysfs, allowing userspace to read the attributes via
22readdir(3)/read(2). It may allow some attributes to be modified via
23write(2). The important point is that the object is created and
24destroyed in kernel, the kernel controls the lifecycle of the sysfs
25representation, and sysfs is merely a window on all this.
26
27A configfs config_item is created via an explicit userspace operation:
28mkdir(2). It is destroyed via rmdir(2). The attributes appear at
29mkdir(2) time, and can be read or modified via read(2) and write(2).
30As with sysfs, readdir(3) queries the list of items and/or attributes.
31symlink(2) can be used to group items together. Unlike sysfs, the
32lifetime of the representation is completely driven by userspace. The
33kernel modules backing the items must respond to this.
34
35Both sysfs and configfs can and should exist together on the same
36system. One is not a replacement for the other.
37
38[Using configfs]
39
40configfs can be compiled as a module or into the kernel. You can access
41it by doing
42
43 mount -t configfs none /config
44
45The configfs tree will be empty unless client modules are also loaded.
46These are modules that register their item types with configfs as
47subsystems. Once a client subsystem is loaded, it will appear as a
48subdirectory (or more than one) under /config. Like sysfs, the
49configfs tree is always there, whether mounted on /config or not.
50
51An item is created via mkdir(2). The item's attributes will also
52appear at this time. readdir(3) can determine what the attributes are,
53read(2) can query their default values, and write(2) can store new
54values. Like sysfs, attributes should be ASCII text files, preferably
55with only one value per file. The same efficiency caveats from sysfs
56apply. Don't mix more than one attribute in one attribute file.
57
58Like sysfs, configfs expects write(2) to store the entire buffer at
59once. When writing to configfs attributes, userspace processes should
60first read the entire file, modify the portions they wish to change, and
61then write the entire buffer back. Attribute files have a maximum size
62of one page (PAGE_SIZE, 4096 on i386).
63
64When an item needs to be destroyed, remove it with rmdir(2). An
65item cannot be destroyed if any other item has a link to it (via
66symlink(2)). Links can be removed via unlink(2).
67
68[Configuring FakeNBD: an Example]
69
70Imagine there's a Network Block Device (NBD) driver that allows you to
71access remote block devices. Call it FakeNBD. FakeNBD uses configfs
72for its configuration. Obviously, there will be a nice program that
73sysadmins use to configure FakeNBD, but somehow that program has to tell
74the driver about it. Here's where configfs comes in.
75
76When the FakeNBD driver is loaded, it registers itself with configfs.
77readdir(3) sees this just fine:
78
79 # ls /config
80 fakenbd
81
82A fakenbd connection can be created with mkdir(2). The name is
83arbitrary, but likely the tool will make some use of the name. Perhaps
84it is a uuid or a disk name:
85
86 # mkdir /config/fakenbd/disk1
87 # ls /config/fakenbd/disk1
88 target device rw
89
90The target attribute contains the IP address of the server FakeNBD will
91connect to. The device attribute is the device on the server.
92Predictably, the rw attribute determines whether the connection is
93read-only or read-write.
94
95 # echo 10.0.0.1 > /config/fakenbd/disk1/target
96 # echo /dev/sda1 > /config/fakenbd/disk1/device
97 # echo 1 > /config/fakenbd/disk1/rw
98
99That's it. That's all there is. Now the device is configured, via the
100shell no less.
101
102[Coding With configfs]
103
104Every object in configfs is a config_item. A config_item reflects an
105object in the subsystem. It has attributes that match values on that
106object. configfs handles the filesystem representation of that object
107and its attributes, allowing the subsystem to ignore all but the
108basic show/store interaction.
109
110Items are created and destroyed inside a config_group. A group is a
111collection of items that share the same attributes and operations.
112Items are created by mkdir(2) and removed by rmdir(2), but configfs
113handles that. The group has a set of operations to perform these tasks
114
115A subsystem is the top level of a client module. During initialization,
116the client module registers the subsystem with configfs, the subsystem
117appears as a directory at the top of the configfs filesystem. A
118subsystem is also a config_group, and can do everything a config_group
119can.
120
121[struct config_item]
122
123 struct config_item {
124 char *ci_name;
125 char ci_namebuf[UOBJ_NAME_LEN];
126 struct kref ci_kref;
127 struct list_head ci_entry;
128 struct config_item *ci_parent;
129 struct config_group *ci_group;
130 struct config_item_type *ci_type;
131 struct dentry *ci_dentry;
132 };
133
134 void config_item_init(struct config_item *);
135 void config_item_init_type_name(struct config_item *,
136 const char *name,
137 struct config_item_type *type);
138 struct config_item *config_item_get(struct config_item *);
139 void config_item_put(struct config_item *);
140
141Generally, struct config_item is embedded in a container structure, a
142structure that actually represents what the subsystem is doing. The
143config_item portion of that structure is how the object interacts with
144configfs.
145
146Whether statically defined in a source file or created by a parent
147config_group, a config_item must have one of the _init() functions
148called on it. This initializes the reference count and sets up the
149appropriate fields.
150
151All users of a config_item should have a reference on it via
152config_item_get(), and drop the reference when they are done via
153config_item_put().
154
155By itself, a config_item cannot do much more than appear in configfs.
156Usually a subsystem wants the item to display and/or store attributes,
157among other things. For that, it needs a type.
158
159[struct config_item_type]
160
161 struct configfs_item_operations {
162 void (*release)(struct config_item *);
163 ssize_t (*show_attribute)(struct config_item *,
164 struct configfs_attribute *,
165 char *);
166 ssize_t (*store_attribute)(struct config_item *,
167 struct configfs_attribute *,
168 const char *, size_t);
169 int (*allow_link)(struct config_item *src,
170 struct config_item *target);
171 int (*drop_link)(struct config_item *src,
172 struct config_item *target);
173 };
174
175 struct config_item_type {
176 struct module *ct_owner;
177 struct configfs_item_operations *ct_item_ops;
178 struct configfs_group_operations *ct_group_ops;
179 struct configfs_attribute **ct_attrs;
180 };
181
182The most basic function of a config_item_type is to define what
183operations can be performed on a config_item. All items that have been
184allocated dynamically will need to provide the ct_item_ops->release()
185method. This method is called when the config_item's reference count
186reaches zero. Items that wish to display an attribute need to provide
187the ct_item_ops->show_attribute() method. Similarly, storing a new
188attribute value uses the store_attribute() method.
189
190[struct configfs_attribute]
191
192 struct configfs_attribute {
193 char *ca_name;
194 struct module *ca_owner;
195 mode_t ca_mode;
196 };
197
198When a config_item wants an attribute to appear as a file in the item's
199configfs directory, it must define a configfs_attribute describing it.
200It then adds the attribute to the NULL-terminated array
201config_item_type->ct_attrs. When the item appears in configfs, the
202attribute file will appear with the configfs_attribute->ca_name
203filename. configfs_attribute->ca_mode specifies the file permissions.
204
205If an attribute is readable and the config_item provides a
206ct_item_ops->show_attribute() method, that method will be called
207whenever userspace asks for a read(2) on the attribute. The converse
208will happen for write(2).
209
210[struct config_group]
211
212A config_item cannot live in a vaccum. The only way one can be created
213is via mkdir(2) on a config_group. This will trigger creation of a
214child item.
215
216 struct config_group {
217 struct config_item cg_item;
218 struct list_head cg_children;
219 struct configfs_subsystem *cg_subsys;
220 struct config_group **default_groups;
221 };
222
223 void config_group_init(struct config_group *group);
224 void config_group_init_type_name(struct config_group *group,
225 const char *name,
226 struct config_item_type *type);
227
228
229The config_group structure contains a config_item. Properly configuring
230that item means that a group can behave as an item in its own right.
231However, it can do more: it can create child items or groups. This is
232accomplished via the group operations specified on the group's
233config_item_type.
234
235 struct configfs_group_operations {
236 struct config_item *(*make_item)(struct config_group *group,
237 const char *name);
238 struct config_group *(*make_group)(struct config_group *group,
239 const char *name);
240 int (*commit_item)(struct config_item *item);
241 void (*drop_item)(struct config_group *group,
242 struct config_item *item);
243 };
244
245A group creates child items by providing the
246ct_group_ops->make_item() method. If provided, this method is called from mkdir(2) in the group's directory. The subsystem allocates a new
247config_item (or more likely, its container structure), initializes it,
248and returns it to configfs. Configfs will then populate the filesystem
249tree to reflect the new item.
250
251If the subsystem wants the child to be a group itself, the subsystem
252provides ct_group_ops->make_group(). Everything else behaves the same,
253using the group _init() functions on the group.
254
255Finally, when userspace calls rmdir(2) on the item or group,
256ct_group_ops->drop_item() is called. As a config_group is also a
257config_item, it is not necessary for a seperate drop_group() method.
258The subsystem must config_item_put() the reference that was initialized
259upon item allocation. If a subsystem has no work to do, it may omit
260the ct_group_ops->drop_item() method, and configfs will call
261config_item_put() on the item on behalf of the subsystem.
262
263IMPORTANT: drop_item() is void, and as such cannot fail. When rmdir(2)
264is called, configfs WILL remove the item from the filesystem tree
265(assuming that it has no children to keep it busy). The subsystem is
266responsible for responding to this. If the subsystem has references to
267the item in other threads, the memory is safe. It may take some time
268for the item to actually disappear from the subsystem's usage. But it
269is gone from configfs.
270
271A config_group cannot be removed while it still has child items. This
272is implemented in the configfs rmdir(2) code. ->drop_item() will not be
273called, as the item has not been dropped. rmdir(2) will fail, as the
274directory is not empty.
275
276[struct configfs_subsystem]
277
278A subsystem must register itself, ususally at module_init time. This
279tells configfs to make the subsystem appear in the file tree.
280
281 struct configfs_subsystem {
282 struct config_group su_group;
283 struct semaphore su_sem;
284 };
285
286 int configfs_register_subsystem(struct configfs_subsystem *subsys);
287 void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
288
289 A subsystem consists of a toplevel config_group and a semaphore.
290The group is where child config_items are created. For a subsystem,
291this group is usually defined statically. Before calling
292configfs_register_subsystem(), the subsystem must have initialized the
293group via the usual group _init() functions, and it must also have
294initialized the semaphore.
295 When the register call returns, the subsystem is live, and it
296will be visible via configfs. At that point, mkdir(2) can be called and
297the subsystem must be ready for it.
298
299[An Example]
300
301The best example of these basic concepts is the simple_children
302subsystem/group and the simple_child item in configfs_example.c It
303shows a trivial object displaying and storing an attribute, and a simple
304group creating and destroying these children.
305
306[Hierarchy Navigation and the Subsystem Semaphore]
307
308There is an extra bonus that configfs provides. The config_groups and
309config_items are arranged in a hierarchy due to the fact that they
310appear in a filesystem. A subsystem is NEVER to touch the filesystem
311parts, but the subsystem might be interested in this hierarchy. For
312this reason, the hierarchy is mirrored via the config_group->cg_children
313and config_item->ci_parent structure members.
314
315A subsystem can navigate the cg_children list and the ci_parent pointer
316to see the tree created by the subsystem. This can race with configfs'
317management of the hierarchy, so configfs uses the subsystem semaphore to
318protect modifications. Whenever a subsystem wants to navigate the
319hierarchy, it must do so under the protection of the subsystem
320semaphore.
321
322A subsystem will be prevented from acquiring the semaphore while a newly
323allocated item has not been linked into this hierarchy. Similarly, it
324will not be able to acquire the semaphore while a dropping item has not
325yet been unlinked. This means that an item's ci_parent pointer will
326never be NULL while the item is in configfs, and that an item will only
327be in its parent's cg_children list for the same duration. This allows
328a subsystem to trust ci_parent and cg_children while they hold the
329semaphore.
330
331[Item Aggregation Via symlink(2)]
332
333configfs provides a simple group via the group->item parent/child
334relationship. Often, however, a larger environment requires aggregation
335outside of the parent/child connection. This is implemented via
336symlink(2).
337
338A config_item may provide the ct_item_ops->allow_link() and
339ct_item_ops->drop_link() methods. If the ->allow_link() method exists,
340symlink(2) may be called with the config_item as the source of the link.
341These links are only allowed between configfs config_items. Any
342symlink(2) attempt outside the configfs filesystem will be denied.
343
344When symlink(2) is called, the source config_item's ->allow_link()
345method is called with itself and a target item. If the source item
346allows linking to target item, it returns 0. A source item may wish to
347reject a link if it only wants links to a certain type of object (say,
348in its own subsystem).
349
350When unlink(2) is called on the symbolic link, the source item is
351notified via the ->drop_link() method. Like the ->drop_item() method,
352this is a void function and cannot return failure. The subsystem is
353responsible for responding to the change.
354
355A config_item cannot be removed while it links to any other item, nor
356can it be removed while an item links to it. Dangling symlinks are not
357allowed in configfs.
358
359[Automatically Created Subgroups]
360
361A new config_group may want to have two types of child config_items.
362While this could be codified by magic names in ->make_item(), it is much
363more explicit to have a method whereby userspace sees this divergence.
364
365Rather than have a group where some items behave differently than
366others, configfs provides a method whereby one or many subgroups are
367automatically created inside the parent at its creation. Thus,
368mkdir("parent) results in "parent", "parent/subgroup1", up through
369"parent/subgroupN". Items of type 1 can now be created in
370"parent/subgroup1", and items of type N can be created in
371"parent/subgroupN".
372
373These automatic subgroups, or default groups, do not preclude other
374children of the parent group. If ct_group_ops->make_group() exists,
375other child groups can be created on the parent group directly.
376
377A configfs subsystem specifies default groups by filling in the
378NULL-terminated array default_groups on the config_group structure.
379Each group in that array is populated in the configfs tree at the same
380time as the parent group. Similarly, they are removed at the same time
381as the parent. No extra notification is provided. When a ->drop_item()
382method call notifies the subsystem the parent group is going away, it
383also means every default group child associated with that parent group.
384
385As a consequence of this, default_groups cannot be removed directly via
386rmdir(2). They also are not considered when rmdir(2) on the parent
387group is checking for children.
388
389[Committable Items]
390
391NOTE: Committable items are currently unimplemented.
392
393Some config_items cannot have a valid initial state. That is, no
394default values can be specified for the item's attributes such that the
395item can do its work. Userspace must configure one or more attributes,
396after which the subsystem can start whatever entity this item
397represents.
398
399Consider the FakeNBD device from above. Without a target address *and*
400a target device, the subsystem has no idea what block device to import.
401The simple example assumes that the subsystem merely waits until all the
402appropriate attributes are configured, and then connects. This will,
403indeed, work, but now every attribute store must check if the attributes
404are initialized. Every attribute store must fire off the connection if
405that condition is met.
406
407Far better would be an explicit action notifying the subsystem that the
408config_item is ready to go. More importantly, an explicit action allows
409the subsystem to provide feedback as to whether the attibutes are
410initialized in a way that makes sense. configfs provides this as
411committable items.
412
413configfs still uses only normal filesystem operations. An item is
414committed via rename(2). The item is moved from a directory where it
415can be modified to a directory where it cannot.
416
417Any group that provides the ct_group_ops->commit_item() method has
418committable items. When this group appears in configfs, mkdir(2) will
419not work directly in the group. Instead, the group will have two
420subdirectories: "live" and "pending". The "live" directory does not
421support mkdir(2) or rmdir(2) either. It only allows rename(2). The
422"pending" directory does allow mkdir(2) and rmdir(2). An item is
423created in the "pending" directory. Its attributes can be modified at
424will. Userspace commits the item by renaming it into the "live"
425directory. At this point, the subsystem recieves the ->commit_item()
426callback. If all required attributes are filled to satisfaction, the
427method returns zero and the item is moved to the "live" directory.
428
429As rmdir(2) does not work in the "live" directory, an item must be
430shutdown, or "uncommitted". Again, this is done via rename(2), this
431time from the "live" directory back to the "pending" one. The subsystem
432is notified by the ct_group_ops->uncommit_object() method.
433
434
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c
new file mode 100644
index 000000000000..f3c6e4946f98
--- /dev/null
+++ b/Documentation/filesystems/configfs/configfs_example.c
@@ -0,0 +1,474 @@
1/*
2 * vim: noexpandtab ts=8 sts=0 sw=8:
3 *
4 * configfs_example.c - This file is a demonstration module containing
5 * a number of configfs subsystems.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 021110-1307, USA.
21 *
22 * Based on sysfs:
23 * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
24 *
25 * configfs Copyright (C) 2005 Oracle. All rights reserved.
26 */
27
28#include <linux/init.h>
29#include <linux/module.h>
30#include <linux/slab.h>
31
32#include <linux/configfs.h>
33
34
35
36/*
37 * 01-childless
38 *
39 * This first example is a childless subsystem. It cannot create
40 * any config_items. It just has attributes.
41 *
42 * Note that we are enclosing the configfs_subsystem inside a container.
43 * This is not necessary if a subsystem has no attributes directly
44 * on the subsystem. See the next example, 02-simple-children, for
45 * such a subsystem.
46 */
47
48struct childless {
49 struct configfs_subsystem subsys;
50 int showme;
51 int storeme;
52};
53
54struct childless_attribute {
55 struct configfs_attribute attr;
56 ssize_t (*show)(struct childless *, char *);
57 ssize_t (*store)(struct childless *, const char *, size_t);
58};
59
60static inline struct childless *to_childless(struct config_item *item)
61{
62 return item ? container_of(to_configfs_subsystem(to_config_group(item)), struct childless, subsys) : NULL;
63}
64
65static ssize_t childless_showme_read(struct childless *childless,
66 char *page)
67{
68 ssize_t pos;
69
70 pos = sprintf(page, "%d\n", childless->showme);
71 childless->showme++;
72
73 return pos;
74}
75
76static ssize_t childless_storeme_read(struct childless *childless,
77 char *page)
78{
79 return sprintf(page, "%d\n", childless->storeme);
80}
81
82static ssize_t childless_storeme_write(struct childless *childless,
83 const char *page,
84 size_t count)
85{
86 unsigned long tmp;
87 char *p = (char *) page;
88
89 tmp = simple_strtoul(p, &p, 10);
90 if (!p || (*p && (*p != '\n')))
91 return -EINVAL;
92
93 if (tmp > INT_MAX)
94 return -ERANGE;
95
96 childless->storeme = tmp;
97
98 return count;
99}
100
101static ssize_t childless_description_read(struct childless *childless,
102 char *page)
103{
104 return sprintf(page,
105"[01-childless]\n"
106"\n"
107"The childless subsystem is the simplest possible subsystem in\n"
108"configfs. It does not support the creation of child config_items.\n"
109"It only has a few attributes. In fact, it isn't much different\n"
110"than a directory in /proc.\n");
111}
112
113static struct childless_attribute childless_attr_showme = {
114 .attr = { .ca_owner = THIS_MODULE, .ca_name = "showme", .ca_mode = S_IRUGO },
115 .show = childless_showme_read,
116};
117static struct childless_attribute childless_attr_storeme = {
118 .attr = { .ca_owner = THIS_MODULE, .ca_name = "storeme", .ca_mode = S_IRUGO | S_IWUSR },
119 .show = childless_storeme_read,
120 .store = childless_storeme_write,
121};
122static struct childless_attribute childless_attr_description = {
123 .attr = { .ca_owner = THIS_MODULE, .ca_name = "description", .ca_mode = S_IRUGO },
124 .show = childless_description_read,
125};
126
127static struct configfs_attribute *childless_attrs[] = {
128 &childless_attr_showme.attr,
129 &childless_attr_storeme.attr,
130 &childless_attr_description.attr,
131 NULL,
132};
133
134static ssize_t childless_attr_show(struct config_item *item,
135 struct configfs_attribute *attr,
136 char *page)
137{
138 struct childless *childless = to_childless(item);
139 struct childless_attribute *childless_attr =
140 container_of(attr, struct childless_attribute, attr);
141 ssize_t ret = 0;
142
143 if (childless_attr->show)
144 ret = childless_attr->show(childless, page);
145 return ret;
146}
147
148static ssize_t childless_attr_store(struct config_item *item,
149 struct configfs_attribute *attr,
150 const char *page, size_t count)
151{
152 struct childless *childless = to_childless(item);
153 struct childless_attribute *childless_attr =
154 container_of(attr, struct childless_attribute, attr);
155 ssize_t ret = -EINVAL;
156
157 if (childless_attr->store)
158 ret = childless_attr->store(childless, page, count);
159 return ret;
160}
161
162static struct configfs_item_operations childless_item_ops = {
163 .show_attribute = childless_attr_show,
164 .store_attribute = childless_attr_store,
165};
166
167static struct config_item_type childless_type = {
168 .ct_item_ops = &childless_item_ops,
169 .ct_attrs = childless_attrs,
170 .ct_owner = THIS_MODULE,
171};
172
173static struct childless childless_subsys = {
174 .subsys = {
175 .su_group = {
176 .cg_item = {
177 .ci_namebuf = "01-childless",
178 .ci_type = &childless_type,
179 },
180 },
181 },
182};
183
184
185/* ----------------------------------------------------------------- */
186
187/*
188 * 02-simple-children
189 *
190 * This example merely has a simple one-attribute child. Note that
191 * there is no extra attribute structure, as the child's attribute is
192 * known from the get-go. Also, there is no container for the
193 * subsystem, as it has no attributes of its own.
194 */
195
196struct simple_child {
197 struct config_item item;
198 int storeme;
199};
200
201static inline struct simple_child *to_simple_child(struct config_item *item)
202{
203 return item ? container_of(item, struct simple_child, item) : NULL;
204}
205
206static struct configfs_attribute simple_child_attr_storeme = {
207 .ca_owner = THIS_MODULE,
208 .ca_name = "storeme",
209 .ca_mode = S_IRUGO | S_IWUSR,
210};
211
212static struct configfs_attribute *simple_child_attrs[] = {
213 &simple_child_attr_storeme,
214 NULL,
215};
216
217static ssize_t simple_child_attr_show(struct config_item *item,
218 struct configfs_attribute *attr,
219 char *page)
220{
221 ssize_t count;
222 struct simple_child *simple_child = to_simple_child(item);
223
224 count = sprintf(page, "%d\n", simple_child->storeme);
225
226 return count;
227}
228
229static ssize_t simple_child_attr_store(struct config_item *item,
230 struct configfs_attribute *attr,
231 const char *page, size_t count)
232{
233 struct simple_child *simple_child = to_simple_child(item);
234 unsigned long tmp;
235 char *p = (char *) page;
236
237 tmp = simple_strtoul(p, &p, 10);
238 if (!p || (*p && (*p != '\n')))
239 return -EINVAL;
240
241 if (tmp > INT_MAX)
242 return -ERANGE;
243
244 simple_child->storeme = tmp;
245
246 return count;
247}
248
249static void simple_child_release(struct config_item *item)
250{
251 kfree(to_simple_child(item));
252}
253
254static struct configfs_item_operations simple_child_item_ops = {
255 .release = simple_child_release,
256 .show_attribute = simple_child_attr_show,
257 .store_attribute = simple_child_attr_store,
258};
259
260static struct config_item_type simple_child_type = {
261 .ct_item_ops = &simple_child_item_ops,
262 .ct_attrs = simple_child_attrs,
263 .ct_owner = THIS_MODULE,
264};
265
266
267static struct config_item *simple_children_make_item(struct config_group *group, const char *name)
268{
269 struct simple_child *simple_child;
270
271 simple_child = kmalloc(sizeof(struct simple_child), GFP_KERNEL);
272 if (!simple_child)
273 return NULL;
274
275 memset(simple_child, 0, sizeof(struct simple_child));
276
277 config_item_init_type_name(&simple_child->item, name,
278 &simple_child_type);
279
280 simple_child->storeme = 0;
281
282 return &simple_child->item;
283}
284
285static struct configfs_attribute simple_children_attr_description = {
286 .ca_owner = THIS_MODULE,
287 .ca_name = "description",
288 .ca_mode = S_IRUGO,
289};
290
291static struct configfs_attribute *simple_children_attrs[] = {
292 &simple_children_attr_description,
293 NULL,
294};
295
296static ssize_t simple_children_attr_show(struct config_item *item,
297 struct configfs_attribute *attr,
298 char *page)
299{
300 return sprintf(page,
301"[02-simple-children]\n"
302"\n"
303"This subsystem allows the creation of child config_items. These\n"
304"items have only one attribute that is readable and writeable.\n");
305}
306
307static struct configfs_item_operations simple_children_item_ops = {
308 .show_attribute = simple_children_attr_show,
309};
310
311/*
312 * Note that, since no extra work is required on ->drop_item(),
313 * no ->drop_item() is provided.
314 */
315static struct configfs_group_operations simple_children_group_ops = {
316 .make_item = simple_children_make_item,
317};
318
319static struct config_item_type simple_children_type = {
320 .ct_item_ops = &simple_children_item_ops,
321 .ct_group_ops = &simple_children_group_ops,
322 .ct_attrs = simple_children_attrs,
323};
324
325static struct configfs_subsystem simple_children_subsys = {
326 .su_group = {
327 .cg_item = {
328 .ci_namebuf = "02-simple-children",
329 .ci_type = &simple_children_type,
330 },
331 },
332};
333
334
335/* ----------------------------------------------------------------- */
336
337/*
338 * 03-group-children
339 *
340 * This example reuses the simple_children group from above. However,
341 * the simple_children group is not the subsystem itself, it is a
342 * child of the subsystem. Creation of a group in the subsystem creates
343 * a new simple_children group. That group can then have simple_child
344 * children of its own.
345 */
346
347struct simple_children {
348 struct config_group group;
349};
350
351static struct config_group *group_children_make_group(struct config_group *group, const char *name)
352{
353 struct simple_children *simple_children;
354
355 simple_children = kmalloc(sizeof(struct simple_children),
356 GFP_KERNEL);
357 if (!simple_children)
358 return NULL;
359
360 memset(simple_children, 0, sizeof(struct simple_children));
361
362 config_group_init_type_name(&simple_children->group, name,
363 &simple_children_type);
364
365 return &simple_children->group;
366}
367
368static struct configfs_attribute group_children_attr_description = {
369 .ca_owner = THIS_MODULE,
370 .ca_name = "description",
371 .ca_mode = S_IRUGO,
372};
373
374static struct configfs_attribute *group_children_attrs[] = {
375 &group_children_attr_description,
376 NULL,
377};
378
379static ssize_t group_children_attr_show(struct config_item *item,
380 struct configfs_attribute *attr,
381 char *page)
382{
383 return sprintf(page,
384"[03-group-children]\n"
385"\n"
386"This subsystem allows the creation of child config_groups. These\n"
387"groups are like the subsystem simple-children.\n");
388}
389
390static struct configfs_item_operations group_children_item_ops = {
391 .show_attribute = group_children_attr_show,
392};
393
394/*
395 * Note that, since no extra work is required on ->drop_item(),
396 * no ->drop_item() is provided.
397 */
398static struct configfs_group_operations group_children_group_ops = {
399 .make_group = group_children_make_group,
400};
401
402static struct config_item_type group_children_type = {
403 .ct_item_ops = &group_children_item_ops,
404 .ct_group_ops = &group_children_group_ops,
405 .ct_attrs = group_children_attrs,
406};
407
408static struct configfs_subsystem group_children_subsys = {
409 .su_group = {
410 .cg_item = {
411 .ci_namebuf = "03-group-children",
412 .ci_type = &group_children_type,
413 },
414 },
415};
416
417/* ----------------------------------------------------------------- */
418
419/*
420 * We're now done with our subsystem definitions.
421 * For convenience in this module, here's a list of them all. It
422 * allows the init function to easily register them. Most modules
423 * will only have one subsystem, and will only call register_subsystem
424 * on it directly.
425 */
426static struct configfs_subsystem *example_subsys[] = {
427 &childless_subsys.subsys,
428 &simple_children_subsys,
429 &group_children_subsys,
430 NULL,
431};
432
433static int __init configfs_example_init(void)
434{
435 int ret;
436 int i;
437 struct configfs_subsystem *subsys;
438
439 for (i = 0; example_subsys[i]; i++) {
440 subsys = example_subsys[i];
441
442 config_group_init(&subsys->su_group);
443 init_MUTEX(&subsys->su_sem);
444 ret = configfs_register_subsystem(subsys);
445 if (ret) {
446 printk(KERN_ERR "Error %d while registering subsystem %s\n",
447 ret,
448 subsys->su_group.cg_item.ci_namebuf);
449 goto out_unregister;
450 }
451 }
452
453 return 0;
454
455out_unregister:
456 for (; i >= 0; i--) {
457 configfs_unregister_subsystem(example_subsys[i]);
458 }
459
460 return ret;
461}
462
463static void __exit configfs_example_exit(void)
464{
465 int i;
466
467 for (i = 0; example_subsys[i]; i++) {
468 configfs_unregister_subsystem(example_subsys[i]);
469 }
470}
471
472module_init(configfs_example_init);
473module_exit(configfs_example_exit);
474MODULE_LICENSE("GPL");
diff --git a/Documentation/filesystems/dlmfs.txt b/Documentation/filesystems/dlmfs.txt
new file mode 100644
index 000000000000..9afab845a906
--- /dev/null
+++ b/Documentation/filesystems/dlmfs.txt
@@ -0,0 +1,130 @@
1dlmfs
2==================
3A minimal DLM userspace interface implemented via a virtual file
4system.
5
6dlmfs is built with OCFS2 as it requires most of its infrastructure.
7
8Project web page: http://oss.oracle.com/projects/ocfs2
9Tools web page: http://oss.oracle.com/projects/ocfs2-tools
10OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/
11
12All code copyright 2005 Oracle except when otherwise noted.
13
14CREDITS
15=======
16
17Some code taken from ramfs which is Copyright (C) 2000 Linus Torvalds
18and Transmeta Corp.
19
20Mark Fasheh <mark.fasheh@oracle.com>
21
22Caveats
23=======
24- Right now it only works with the OCFS2 DLM, though support for other
25 DLM implementations should not be a major issue.
26
27Mount options
28=============
29None
30
31Usage
32=====
33
34If you're just interested in OCFS2, then please see ocfs2.txt. The
35rest of this document will be geared towards those who want to use
36dlmfs for easy to setup and easy to use clustered locking in
37userspace.
38
39Setup
40=====
41
42dlmfs requires that the OCFS2 cluster infrastructure be in
43place. Please download ocfs2-tools from the above url and configure a
44cluster.
45
46You'll want to start heartbeating on a volume which all the nodes in
47your lockspace can access. The easiest way to do this is via
48ocfs2_hb_ctl (distributed with ocfs2-tools). Right now it requires
49that an OCFS2 file system be in place so that it can automatically
50find it's heartbeat area, though it will eventually support heartbeat
51against raw disks.
52
53Please see the ocfs2_hb_ctl and mkfs.ocfs2 manual pages distributed
54with ocfs2-tools.
55
56Once you're heartbeating, DLM lock 'domains' can be easily created /
57destroyed and locks within them accessed.
58
59Locking
60=======
61
62Users may access dlmfs via standard file system calls, or they can use
63'libo2dlm' (distributed with ocfs2-tools) which abstracts the file
64system calls and presents a more traditional locking api.
65
66dlmfs handles lock caching automatically for the user, so a lock
67request for an already acquired lock will not generate another DLM
68call. Userspace programs are assumed to handle their own local
69locking.
70
71Two levels of locks are supported - Shared Read, and Exlcusive.
72Also supported is a Trylock operation.
73
74For information on the libo2dlm interface, please see o2dlm.h,
75distributed with ocfs2-tools.
76
77Lock value blocks can be read and written to a resource via read(2)
78and write(2) against the fd obtained via your open(2) call. The
79maximum currently supported LVB length is 64 bytes (though that is an
80OCFS2 DLM limitation). Through this mechanism, users of dlmfs can share
81small amounts of data amongst their nodes.
82
83mkdir(2) signals dlmfs to join a domain (which will have the same name
84as the resulting directory)
85
86rmdir(2) signals dlmfs to leave the domain
87
88Locks for a given domain are represented by regular inodes inside the
89domain directory. Locking against them is done via the open(2) system
90call.
91
92The open(2) call will not return until your lock has been granted or
93an error has occurred, unless it has been instructed to do a trylock
94operation. If the lock succeeds, you'll get an fd.
95
96open(2) with O_CREAT to ensure the resource inode is created - dlmfs does
97not automatically create inodes for existing lock resources.
98
99Open Flag Lock Request Type
100--------- -----------------
101O_RDONLY Shared Read
102O_RDWR Exclusive
103
104Open Flag Resulting Locking Behavior
105--------- --------------------------
106O_NONBLOCK Trylock operation
107
108You must provide exactly one of O_RDONLY or O_RDWR.
109
110If O_NONBLOCK is also provided and the trylock operation was valid but
111could not lock the resource then open(2) will return ETXTBUSY.
112
113close(2) drops the lock associated with your fd.
114
115Modes passed to mkdir(2) or open(2) are adhered to locally. Chown is
116supported locally as well. This means you can use them to restrict
117access to the resources via dlmfs on your local node only.
118
119The resource LVB may be read from the fd in either Shared Read or
120Exclusive modes via the read(2) system call. It can be written via
121write(2) only when open in Exclusive mode.
122
123Once written, an LVB will be visible to other nodes who obtain Read
124Only or higher level locks on the resource.
125
126See Also
127========
128http://opendlm.sourceforge.net/cvsmirror/opendlm/docs/dlmbook_final.pdf
129
130For more information on the VMS distributed locking API.
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt
index 9840d5b8d5b9..afb1335c05d6 100644
--- a/Documentation/filesystems/ext3.txt
+++ b/Documentation/filesystems/ext3.txt
@@ -2,11 +2,11 @@
2Ext3 Filesystem 2Ext3 Filesystem
3=============== 3===============
4 4
5ext3 was originally released in September 1999. Written by Stephen Tweedie 5Ext3 was originally released in September 1999. Written by Stephen Tweedie
6for 2.2 branch, and ported to 2.4 kernels by Peter Braam, Andreas Dilger, 6for the 2.2 branch, and ported to 2.4 kernels by Peter Braam, Andreas Dilger,
7Andrew Morton, Alexander Viro, Ted Ts'o and Stephen Tweedie. 7Andrew Morton, Alexander Viro, Ted Ts'o and Stephen Tweedie.
8 8
9ext3 is ext2 filesystem enhanced with journalling capabilities. 9Ext3 is the ext2 filesystem enhanced with journalling capabilities.
10 10
11Options 11Options
12======= 12=======
@@ -14,76 +14,81 @@ Options
14When mounting an ext3 filesystem, the following option are accepted: 14When mounting an ext3 filesystem, the following option are accepted:
15(*) == default 15(*) == default
16 16
17jounal=update Update the ext3 file system's journal to the 17journal=update Update the ext3 file system's journal to the current
18 current format. 18 format.
19 19
20journal=inum When a journal already exists, this option is 20journal=inum When a journal already exists, this option is ignored.
21 ignored. Otherwise, it specifies the number of 21 Otherwise, it specifies the number of the inode which
22 the inode which will represent the ext3 file 22 will represent the ext3 file system's journal file.
23 system's journal file. 23
24journal_dev=devnum When the external journal device's major/minor numbers
25 have changed, this option allows the user to specify
26 the new journal location. The journal device is
27 identified through its new major/minor numbers encoded
28 in devnum.
24 29
25noload Don't load the journal on mounting. 30noload Don't load the journal on mounting.
26 31
27data=journal All data are committed into the journal prior 32data=journal All data are committed into the journal prior to being
28 to being written into the main file system. 33 written into the main file system.
29 34
30data=ordered (*) All data are forced directly out to the main file 35data=ordered (*) All data are forced directly out to the main file
31 system prior to its metadata being committed to 36 system prior to its metadata being committed to the
32 the journal. 37 journal.
33 38
34data=writeback Data ordering is not preserved, data may be 39data=writeback Data ordering is not preserved, data may be written
35 written into the main file system after its 40 into the main file system after its metadata has been
36 metadata has been committed to the journal. 41 committed to the journal.
37 42
38commit=nrsec (*) Ext3 can be told to sync all its data and metadata 43commit=nrsec (*) Ext3 can be told to sync all its data and metadata
39 every 'nrsec' seconds. The default value is 5 seconds. 44 every 'nrsec' seconds. The default value is 5 seconds.
40 This means that if you lose your power, you will lose, 45 This means that if you lose your power, you will lose
41 as much, the latest 5 seconds of work (your filesystem 46 as much as the latest 5 seconds of work (your
42 will not be damaged though, thanks to journaling). This 47 filesystem will not be damaged though, thanks to the
43 default value (or any low value) will hurt performance, 48 journaling). This default value (or any low value)
44 but it's good for data-safety. Setting it to 0 will 49 will hurt performance, but it's good for data-safety.
45 have the same effect than leaving the default 5 sec. 50 Setting it to 0 will have the same effect as leaving
51 it at the default (5 seconds).
46 Setting it to very large values will improve 52 Setting it to very large values will improve
47 performance. 53 performance.
48 54
49barrier=1 This enables/disables barriers. barrier=0 disables it, 55barrier=1 This enables/disables barriers. barrier=0 disables
50 barrier=1 enables it. 56 it, barrier=1 enables it.
51 57
52orlov (*) This enables the new Orlov block allocator. It's enabled 58orlov (*) This enables the new Orlov block allocator. It is
53 by default. 59 enabled by default.
54 60
55oldalloc This disables the Orlov block allocator and enables the 61oldalloc This disables the Orlov block allocator and enables
56 old block allocator. Orlov should have better performance, 62 the old block allocator. Orlov should have better
57 we'd like to get some feedback if it's the contrary for 63 performance - we'd like to get some feedback if it's
58 you. 64 the contrary for you.
59 65
60user_xattr Enables Extended User Attributes. Additionally, you need 66user_xattr Enables Extended User Attributes. Additionally, you
61 to have extended attribute support enabled in the kernel 67 need to have extended attribute support enabled in the
62 configuration (CONFIG_EXT3_FS_XATTR). See the attr(5) 68 kernel configuration (CONFIG_EXT3_FS_XATTR). See the
63 manual page and http://acl.bestbits.at to learn more 69 attr(5) manual page and http://acl.bestbits.at/ to
64 about extended attributes. 70 learn more about extended attributes.
65 71
66nouser_xattr Disables Extended User Attributes. 72nouser_xattr Disables Extended User Attributes.
67 73
68acl Enables POSIX Access Control Lists support. Additionally, 74acl Enables POSIX Access Control Lists support.
69 you need to have ACL support enabled in the kernel 75 Additionally, you need to have ACL support enabled in
70 configuration (CONFIG_EXT3_FS_POSIX_ACL). See the acl(5) 76 the kernel configuration (CONFIG_EXT3_FS_POSIX_ACL).
71 manual page and http://acl.bestbits.at for more 77 See the acl(5) manual page and http://acl.bestbits.at/
72 information. 78 for more information.
73 79
74noacl This option disables POSIX Access Control List support. 80noacl This option disables POSIX Access Control List
81 support.
75 82
76reservation 83reservation
77 84
78noreservation 85noreservation
79 86
80resize=
81
82bsddf (*) Make 'df' act like BSD. 87bsddf (*) Make 'df' act like BSD.
83minixdf Make 'df' act like Minix. 88minixdf Make 'df' act like Minix.
84 89
85check=none Don't do extra checking of bitmaps on mount. 90check=none Don't do extra checking of bitmaps on mount.
86nocheck 91nocheck
87 92
88debug Extra debugging information is sent to syslog. 93debug Extra debugging information is sent to syslog.
89 94
@@ -92,7 +97,7 @@ errors=continue Keep going on a filesystem error.
92errors=panic Panic and halt the machine if an error occurs. 97errors=panic Panic and halt the machine if an error occurs.
93 98
94grpid Give objects the same group ID as their creator. 99grpid Give objects the same group ID as their creator.
95bsdgroups 100bsdgroups
96 101
97nogrpid (*) New objects have the group ID of their creator. 102nogrpid (*) New objects have the group ID of their creator.
98sysvgroups 103sysvgroups
@@ -103,81 +108,83 @@ resuid=n The user ID which may use the reserved blocks.
103 108
104sb=n Use alternate superblock at this location. 109sb=n Use alternate superblock at this location.
105 110
106quota Quota options are currently silently ignored. 111quota
107noquota (see fs/ext3/super.c, line 594) 112noquota
108grpquota 113grpquota
109usrquota 114usrquota
110 115
111 116
112Specification 117Specification
113============= 118=============
114ext3 shares all disk implementation with ext2 filesystem, and add 119Ext3 shares all disk implementation with the ext2 filesystem, and adds
115transactions capabilities to ext2. Journaling is done by the 120transactions capabilities to ext2. Journaling is done by the Journaling Block
116Journaling block device layer. 121Device layer.
117 122
118Journaling Block Device layer 123Journaling Block Device layer
119----------------------------- 124-----------------------------
120The Journaling Block Device layer (JBD) isn't ext3 specific. It was 125The Journaling Block Device layer (JBD) isn't ext3 specific. It was design to
121design to add journaling capabilities on a block device. The ext3 126add journaling capabilities on a block device. The ext3 filesystem code will
122filesystem code will inform the JBD of modifications it is performing 127inform the JBD of modifications it is performing (called a transaction). The
123(Call a transaction). the journal support the transactions start and 128journal supports the transactions start and stop, and in case of crash, the
124stop, and in case of crash, the journal can replayed the transactions 129journal can replayed the transactions to put the partition back in a
125to put the partition on a consistent state fastly. 130consistent state fast.
126 131
127handles represent a single atomic update to a filesystem. JBD can 132Handles represent a single atomic update to a filesystem. JBD can handle an
128handle external journal on a block device. 133external journal on a block device.
129 134
130Data Mode 135Data Mode
131--------- 136---------
132There's 3 different data modes: 137There are 3 different data modes:
133 138
134* writeback mode 139* writeback mode
135In data=writeback mode, ext3 does not journal data at all. This mode 140In data=writeback mode, ext3 does not journal data at all. This mode provides
136provides a similar level of journaling as XFS, JFS, and ReiserFS in its 141a similar level of journaling as that of XFS, JFS, and ReiserFS in its default
137default mode - metadata journaling. A crash+recovery can cause 142mode - metadata journaling. A crash+recovery can cause incorrect data to
138incorrect data to appear in files which were written shortly before the 143appear in files which were written shortly before the crash. This mode will
139crash. This mode will typically provide the best ext3 performance. 144typically provide the best ext3 performance.
140 145
141* ordered mode 146* ordered mode
142In data=ordered mode, ext3 only officially journals metadata, but it 147In data=ordered mode, ext3 only officially journals metadata, but it logically
143logically groups metadata and data blocks into a single unit called a 148groups metadata and data blocks into a single unit called a transaction. When
144transaction. When it's time to write the new metadata out to disk, the 149it's time to write the new metadata out to disk, the associated data blocks
145associated data blocks are written first. In general, this mode 150are written first. In general, this mode performs slightly slower than
146perform slightly slower than writeback but significantly faster than 151writeback but significantly faster than journal mode.
147journal mode.
148 152
149* journal mode 153* journal mode
150data=journal mode provides full data and metadata journaling. All new 154data=journal mode provides full data and metadata journaling. All new data is
151data is written to the journal first, and then to its final location. 155written to the journal first, and then to its final location.
152In the event of a crash, the journal can be replayed, bringing both 156In the event of a crash, the journal can be replayed, bringing both data and
153data and metadata into a consistent state. This mode is the slowest 157metadata into a consistent state. This mode is the slowest except when data
154except when data needs to be read from and written to disk at the same 158needs to be read from and written to disk at the same time where it
155time where it outperform all others mode. 159outperforms all others modes.
156 160
157Compatibility 161Compatibility
158------------- 162-------------
159 163
160Ext2 partitions can be easily convert to ext3, with `tune2fs -j <dev>`. 164Ext2 partitions can be easily convert to ext3, with `tune2fs -j <dev>`.
161Ext3 is fully compatible with Ext2. Ext3 partitions can easily be 165Ext3 is fully compatible with Ext2. Ext3 partitions can easily be mounted as
162mounted as Ext2. 166Ext2.
167
163 168
164External Tools 169External Tools
165============== 170==============
166see manual pages to know more. 171See manual pages to learn more.
172
173tune2fs: create a ext3 journal on a ext2 partition with the -j flag.
174mke2fs: create a ext3 partition with the -j flag.
175debugfs: ext2 and ext3 file system debugger.
176ext2online: online (mounted) ext2 and ext3 filesystem resizer
167 177
168tune2fs: create a ext3 journal on a ext2 partition with the -j flags
169mke2fs: create a ext3 partition with the -j flags
170debugfs: ext2 and ext3 file system debugger
171 178
172References 179References
173========== 180==========
174 181
175kernel source: file:/usr/src/linux/fs/ext3 182kernel source: <file:fs/ext3/>
176 file:/usr/src/linux/fs/jbd 183 <file:fs/jbd/>
177 184
178programs: http://e2fsprogs.sourceforge.net 185programs: http://e2fsprogs.sourceforge.net/
186 http://ext2resize.sourceforge.net
179 187
180useful link: 188useful links: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html
181 http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html
182 http://www-106.ibm.com/developerworks/linux/library/l-fs7/ 189 http://www-106.ibm.com/developerworks/linux/library/l-fs7/
183 http://www-106.ibm.com/developerworks/linux/library/l-fs8/ 190 http://www-106.ibm.com/developerworks/linux/library/l-fs8/
diff --git a/Documentation/filesystems/fuse.txt b/Documentation/filesystems/fuse.txt
index 6b5741e651a2..33f74310d161 100644
--- a/Documentation/filesystems/fuse.txt
+++ b/Documentation/filesystems/fuse.txt
@@ -86,6 +86,62 @@ Mount options
86 The default is infinite. Note that the size of read requests is 86 The default is infinite. Note that the size of read requests is
87 limited anyway to 32 pages (which is 128kbyte on i386). 87 limited anyway to 32 pages (which is 128kbyte on i386).
88 88
89Sysfs
90~~~~~
91
92FUSE sets up the following hierarchy in sysfs:
93
94 /sys/fs/fuse/connections/N/
95
96where N is an increasing number allocated to each new connection.
97
98For each connection the following attributes are defined:
99
100 'waiting'
101
102 The number of requests which are waiting to be transfered to
103 userspace or being processed by the filesystem daemon. If there is
104 no filesystem activity and 'waiting' is non-zero, then the
105 filesystem is hung or deadlocked.
106
107 'abort'
108
109 Writing anything into this file will abort the filesystem
110 connection. This means that all waiting requests will be aborted an
111 error returned for all aborted and new requests.
112
113Only a privileged user may read or write these attributes.
114
115Aborting a filesystem connection
116~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117
118It is possible to get into certain situations where the filesystem is
119not responding. Reasons for this may be:
120
121 a) Broken userspace filesystem implementation
122
123 b) Network connection down
124
125 c) Accidental deadlock
126
127 d) Malicious deadlock
128
129(For more on c) and d) see later sections)
130
131In either of these cases it may be useful to abort the connection to
132the filesystem. There are several ways to do this:
133
134 - Kill the filesystem daemon. Works in case of a) and b)
135
136 - Kill the filesystem daemon and all users of the filesystem. Works
137 in all cases except some malicious deadlocks
138
139 - Use forced umount (umount -f). Works in all cases but only if
140 filesystem is still attached (it hasn't been lazy unmounted)
141
142 - Abort filesystem through the sysfs interface. Most powerful
143 method, always works.
144
89How do non-privileged mounts work? 145How do non-privileged mounts work?
90~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91 147
@@ -313,3 +369,10 @@ faulted with get_user_pages(). The 'req->locked' flag indicates
313when the copy is taking place, and interruption is delayed until 369when the copy is taking place, and interruption is delayed until
314this flag is unset. 370this flag is unset.
315 371
372Scenario 3 - Tricky deadlock with asynchronous read
373---------------------------------------------------
374
375The same situation as above, except thread-1 will wait on page lock
376and hence it will be uninterruptible as well. The solution is to
377abort the connection with forced umount (if mount is attached) or
378through the abort attribute in sysfs.
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt
new file mode 100644
index 000000000000..f2595caf052e
--- /dev/null
+++ b/Documentation/filesystems/ocfs2.txt
@@ -0,0 +1,55 @@
1OCFS2 filesystem
2==================
3OCFS2 is a general purpose extent based shared disk cluster file
4system with many similarities to ext3. It supports 64 bit inode
5numbers, and has automatically extending metadata groups which may
6also make it attractive for non-clustered use.
7
8You'll want to install the ocfs2-tools package in order to at least
9get "mount.ocfs2" and "ocfs2_hb_ctl".
10
11Project web page: http://oss.oracle.com/projects/ocfs2
12Tools web page: http://oss.oracle.com/projects/ocfs2-tools
13OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/
14
15All code copyright 2005 Oracle except when otherwise noted.
16
17CREDITS:
18Lots of code taken from ext3 and other projects.
19
20Authors in alphabetical order:
21Joel Becker <joel.becker@oracle.com>
22Zach Brown <zach.brown@oracle.com>
23Mark Fasheh <mark.fasheh@oracle.com>
24Kurt Hackel <kurt.hackel@oracle.com>
25Sunil Mushran <sunil.mushran@oracle.com>
26Manish Singh <manish.singh@oracle.com>
27
28Caveats
29=======
30Features which OCFS2 does not support yet:
31 - sparse files
32 - extended attributes
33 - shared writeable mmap
34 - loopback is supported, but data written will not
35 be cluster coherent.
36 - quotas
37 - cluster aware flock
38 - Directory change notification (F_NOTIFY)
39 - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease)
40 - POSIX ACLs
41 - readpages / writepages (not user visible)
42
43Mount options
44=============
45
46OCFS2 supports the following mount options:
47(*) == default
48
49barrier=1 This enables/disables barriers. barrier=0 disables it,
50 barrier=1 enables it.
51errors=remount-ro(*) Remount the filesystem read-only on an error.
52errors=panic Panic and halt the machine if an error occurs.
53intr (*) Allow signals to interrupt cluster operations.
54nointr Do not allow signals to interrupt cluster
55 operations.
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index d4773565ea2f..944cf109a6f5 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -418,7 +418,7 @@ VmallocChunk: 111088 kB
418 Dirty: Memory which is waiting to get written back to the disk 418 Dirty: Memory which is waiting to get written back to the disk
419 Writeback: Memory which is actively being written back to the disk 419 Writeback: Memory which is actively being written back to the disk
420 Mapped: files which have been mmaped, such as libraries 420 Mapped: files which have been mmaped, such as libraries
421 Slab: in-kernel data structures cache 421 Slab: in-kernel data structures cache
422 CommitLimit: Based on the overcommit ratio ('vm.overcommit_ratio'), 422 CommitLimit: Based on the overcommit ratio ('vm.overcommit_ratio'),
423 this is the total amount of memory currently available to 423 this is the total amount of memory currently available to
424 be allocated on the system. This limit is only adhered to 424 be allocated on the system. This limit is only adhered to
@@ -1302,6 +1302,23 @@ VM has token based thrashing control mechanism and uses the token to prevent
1302unnecessary page faults in thrashing situation. The unit of the value is 1302unnecessary page faults in thrashing situation. The unit of the value is
1303second. The value would be useful to tune thrashing behavior. 1303second. The value would be useful to tune thrashing behavior.
1304 1304
1305drop_caches
1306-----------
1307
1308Writing to this will cause the kernel to drop clean caches, dentries and
1309inodes from memory, causing that memory to become free.
1310
1311To free pagecache:
1312 echo 1 > /proc/sys/vm/drop_caches
1313To free dentries and inodes:
1314 echo 2 > /proc/sys/vm/drop_caches
1315To free pagecache, dentries and inodes:
1316 echo 3 > /proc/sys/vm/drop_caches
1317
1318As this is a non-destructive operation and dirty objects are not freeable, the
1319user should run `sync' first.
1320
1321
13052.5 /proc/sys/dev - Device specific parameters 13222.5 /proc/sys/dev - Device specific parameters
1306---------------------------------------------- 1323----------------------------------------------
1307 1324
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
index b3404a032596..60ab61e54e8a 100644
--- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt
+++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
@@ -143,12 +143,26 @@ as the following example:
143 dir /mnt 755 0 0 143 dir /mnt 755 0 0
144 file /init initramfs/init.sh 755 0 0 144 file /init initramfs/init.sh 755 0 0
145 145
146Run "usr/gen_init_cpio" (after the kernel build) to get a usage message
147documenting the above file format.
148
146One advantage of the text file is that root access is not required to 149One advantage of the text file is that root access is not required to
147set permissions or create device nodes in the new archive. (Note that those 150set permissions or create device nodes in the new archive. (Note that those
148two example "file" entries expect to find files named "init.sh" and "busybox" in 151two example "file" entries expect to find files named "init.sh" and "busybox" in
149a directory called "initramfs", under the linux-2.6.* directory. See 152a directory called "initramfs", under the linux-2.6.* directory. See
150Documentation/early-userspace/README for more details.) 153Documentation/early-userspace/README for more details.)
151 154
155The kernel does not depend on external cpio tools, gen_init_cpio is created
156from usr/gen_init_cpio.c which is entirely self-contained, and the kernel's
157boot-time extractor is also (obviously) self-contained. However, if you _do_
158happen to have cpio installed, the following command line can extract the
159generated cpio image back into its component files:
160
161 cpio -i -d -H newc -F initramfs_data.cpio --no-absolute-filenames
162
163Contents of initramfs:
164----------------------
165
152If you don't already understand what shared libraries, devices, and paths 166If you don't already understand what shared libraries, devices, and paths
153you need to get a minimal root filesystem up and running, here are some 167you need to get a minimal root filesystem up and running, here are some
154references: 168references:
@@ -161,13 +175,69 @@ designed to be a tiny C library to statically link early userspace
161code against, along with some related utilities. It is BSD licensed. 175code against, along with some related utilities. It is BSD licensed.
162 176
163I use uClibc (http://www.uclibc.org) and busybox (http://www.busybox.net) 177I use uClibc (http://www.uclibc.org) and busybox (http://www.busybox.net)
164myself. These are LGPL and GPL, respectively. 178myself. These are LGPL and GPL, respectively. (A self-contained initramfs
179package is planned for the busybox 1.2 release.)
165 180
166In theory you could use glibc, but that's not well suited for small embedded 181In theory you could use glibc, but that's not well suited for small embedded
167uses like this. (A "hello world" program statically linked against glibc is 182uses like this. (A "hello world" program statically linked against glibc is
168over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do 183over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do
169name lookups, even when otherwise statically linked.) 184name lookups, even when otherwise statically linked.)
170 185
186Why cpio rather than tar?
187-------------------------
188
189This decision was made back in December, 2001. The discussion started here:
190
191 http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1538.html
192
193And spawned a second thread (specifically on tar vs cpio), starting here:
194
195 http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1587.html
196
197The quick and dirty summary version (which is no substitute for reading
198the above threads) is:
199
2001) cpio is a standard. It's decades old (from the AT&T days), and already
201 widely used on Linux (inside RPM, Red Hat's device driver disks). Here's
202 a Linux Journal article about it from 1996:
203
204 http://www.linuxjournal.com/article/1213
205
206 It's not as popular as tar because the traditional cpio command line tools
207 require _truly_hideous_ command line arguments. But that says nothing
208 either way about the archive format, and there are alternative tools,
209 such as:
210
211 http://freshmeat.net/projects/afio/
212
2132) The cpio archive format chosen by the kernel is simpler and cleaner (and
214 thus easier to create and parse) than any of the (literally dozens of)
215 various tar archive formats. The complete initramfs archive format is
216 explained in buffer-format.txt, created in usr/gen_init_cpio.c, and
217 extracted in init/initramfs.c. All three together come to less than 26k
218 total of human-readable text.
219
2203) The GNU project standardizing on tar is approximately as relevant as
221 Windows standardizing on zip. Linux is not part of either, and is free
222 to make its own technical decisions.
223
2244) Since this is a kernel internal format, it could easily have been
225 something brand new. The kernel provides its own tools to create and
226 extract this format anyway. Using an existing standard was preferable,
227 but not essential.
228
2295) Al Viro made the decision (quote: "tar is ugly as hell and not going to be
230 supported on the kernel side"):
231
232 http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1540.html
233
234 explained his reasoning:
235
236 http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1550.html
237 http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1638.html
238
239 and, most importantly, designed and implemented the initramfs code.
240
171Future directions: 241Future directions:
172------------------ 242------------------
173 243
diff --git a/Documentation/filesystems/relayfs.txt b/Documentation/filesystems/relayfs.txt
index d803abed29f0..5832377b7340 100644
--- a/Documentation/filesystems/relayfs.txt
+++ b/Documentation/filesystems/relayfs.txt
@@ -44,30 +44,41 @@ relayfs can operate in a mode where it will overwrite data not yet
44collected by userspace, and not wait for it to consume it. 44collected by userspace, and not wait for it to consume it.
45 45
46relayfs itself does not provide for communication of such data between 46relayfs itself does not provide for communication of such data between
47userspace and kernel, allowing the kernel side to remain simple and not 47userspace and kernel, allowing the kernel side to remain simple and
48impose a single interface on userspace. It does provide a separate 48not impose a single interface on userspace. It does provide a set of
49helper though, described below. 49examples and a separate helper though, described below.
50
51klog and relay-apps example code
52================================
53
54relayfs itself is ready to use, but to make things easier, a couple
55simple utility functions and a set of examples are provided.
56
57The relay-apps example tarball, available on the relayfs sourceforge
58site, contains a set of self-contained examples, each consisting of a
59pair of .c files containing boilerplate code for each of the user and
60kernel sides of a relayfs application; combined these two sets of
61boilerplate code provide glue to easily stream data to disk, without
62having to bother with mundane housekeeping chores.
63
64The 'klog debugging functions' patch (klog.patch in the relay-apps
65tarball) provides a couple of high-level logging functions to the
66kernel which allow writing formatted text or raw data to a channel,
67regardless of whether a channel to write into exists or not, or
68whether relayfs is compiled into the kernel or is configured as a
69module. These functions allow you to put unconditional 'trace'
70statements anywhere in the kernel or kernel modules; only when there
71is a 'klog handler' registered will data actually be logged (see the
72klog and kleak examples for details).
73
74It is of course possible to use relayfs from scratch i.e. without
75using any of the relay-apps example code or klog, but you'll have to
76implement communication between userspace and kernel, allowing both to
77convey the state of buffers (full, empty, amount of padding).
78
79klog and the relay-apps examples can be found in the relay-apps
80tarball on http://relayfs.sourceforge.net
50 81
51klog, relay-app & librelay
52==========================
53
54relayfs itself is ready to use, but to make things easier, two
55additional systems are provided. klog is a simple wrapper to make
56writing formatted text or raw data to a channel simpler, regardless of
57whether a channel to write into exists or not, or whether relayfs is
58compiled into the kernel or is configured as a module. relay-app is
59the kernel counterpart of userspace librelay.c, combined these two
60files provide glue to easily stream data to disk, without having to
61bother with housekeeping. klog and relay-app can be used together,
62with klog providing high-level logging functions to the kernel and
63relay-app taking care of kernel-user control and disk-logging chores.
64
65It is possible to use relayfs without relay-app & librelay, but you'll
66have to implement communication between userspace and kernel, allowing
67both to convey the state of buffers (full, empty, amount of padding).
68
69klog, relay-app and librelay can be found in the relay-apps tarball on
70http://relayfs.sourceforge.net
71 82
72The relayfs user space API 83The relayfs user space API
73========================== 84==========================
@@ -125,6 +136,8 @@ Here's a summary of the API relayfs provides to in-kernel clients:
125 relay_reset(chan) 136 relay_reset(chan)
126 relayfs_create_dir(name, parent) 137 relayfs_create_dir(name, parent)
127 relayfs_remove_dir(dentry) 138 relayfs_remove_dir(dentry)
139 relayfs_create_file(name, parent, mode, fops, data)
140 relayfs_remove_file(dentry)
128 141
129 channel management typically called on instigation of userspace: 142 channel management typically called on instigation of userspace:
130 143
@@ -141,6 +154,8 @@ Here's a summary of the API relayfs provides to in-kernel clients:
141 subbuf_start(buf, subbuf, prev_subbuf, prev_padding) 154 subbuf_start(buf, subbuf, prev_subbuf, prev_padding)
142 buf_mapped(buf, filp) 155 buf_mapped(buf, filp)
143 buf_unmapped(buf, filp) 156 buf_unmapped(buf, filp)
157 create_buf_file(filename, parent, mode, buf, is_global)
158 remove_buf_file(dentry)
144 159
145 helper functions: 160 helper functions:
146 161
@@ -320,6 +335,71 @@ forces a sub-buffer switch on all the channel buffers, and can be used
320to finalize and process the last sub-buffers before the channel is 335to finalize and process the last sub-buffers before the channel is
321closed. 336closed.
322 337
338Creating non-relay files
339------------------------
340
341relay_open() automatically creates files in the relayfs filesystem to
342represent the per-cpu kernel buffers; it's often useful for
343applications to be able to create their own files alongside the relay
344files in the relayfs filesystem as well e.g. 'control' files much like
345those created in /proc or debugfs for similar purposes, used to
346communicate control information between the kernel and user sides of a
347relayfs application. For this purpose the relayfs_create_file() and
348relayfs_remove_file() API functions exist. For relayfs_create_file(),
349the caller passes in a set of user-defined file operations to be used
350for the file and an optional void * to a user-specified data item,
351which will be accessible via inode->u.generic_ip (see the relay-apps
352tarball for examples). The file_operations are a required parameter
353to relayfs_create_file() and thus the semantics of these files are
354completely defined by the caller.
355
356See the relay-apps tarball at http://relayfs.sourceforge.net for
357examples of how these non-relay files are meant to be used.
358
359Creating relay files in other filesystems
360-----------------------------------------
361
362By default of course, relay_open() creates relay files in the relayfs
363filesystem. Because relay_file_operations is exported, however, it's
364also possible to create and use relay files in other pseudo-filesytems
365such as debugfs.
366
367For this purpose, two callback functions are provided,
368create_buf_file() and remove_buf_file(). create_buf_file() is called
369once for each per-cpu buffer from relay_open() to allow the client to
370create a file to be used to represent the corresponding buffer; if
371this callback is not defined, the default implementation will create
372and return a file in the relayfs filesystem to represent the buffer.
373The callback should return the dentry of the file created to represent
374the relay buffer. Note that the parent directory passed to
375relay_open() (and passed along to the callback), if specified, must
376exist in the same filesystem the new relay file is created in. If
377create_buf_file() is defined, remove_buf_file() must also be defined;
378it's responsible for deleting the file(s) created in create_buf_file()
379and is called during relay_close().
380
381The create_buf_file() implementation can also be defined in such a way
382as to allow the creation of a single 'global' buffer instead of the
383default per-cpu set. This can be useful for applications interested
384mainly in seeing the relative ordering of system-wide events without
385the need to bother with saving explicit timestamps for the purpose of
386merging/sorting per-cpu files in a postprocessing step.
387
388To have relay_open() create a global buffer, the create_buf_file()
389implementation should set the value of the is_global outparam to a
390non-zero value in addition to creating the file that will be used to
391represent the single buffer. In the case of a global buffer,
392create_buf_file() and remove_buf_file() will be called only once. The
393normal channel-writing functions e.g. relay_write() can still be used
394- writes from any cpu will transparently end up in the global buffer -
395but since it is a global buffer, callers should make sure they use the
396proper locking for such a buffer, either by wrapping writes in a
397spinlock, or by copying a write function from relayfs_fs.h and
398creating a local version that internally does the proper locking.
399
400See the 'exported-relayfile' examples in the relay-apps tarball for
401examples of creating and using relay files in debugfs.
402
323Misc 403Misc
324---- 404----
325 405
diff --git a/Documentation/filesystems/spufs.txt b/Documentation/filesystems/spufs.txt
new file mode 100644
index 000000000000..8edc3952eff4
--- /dev/null
+++ b/Documentation/filesystems/spufs.txt
@@ -0,0 +1,521 @@
1SPUFS(2) Linux Programmer's Manual SPUFS(2)
2
3
4
5NAME
6 spufs - the SPU file system
7
8
9DESCRIPTION
10 The SPU file system is used on PowerPC machines that implement the Cell
11 Broadband Engine Architecture in order to access Synergistic Processor
12 Units (SPUs).
13
14 The file system provides a name space similar to posix shared memory or
15 message queues. Users that have write permissions on the file system
16 can use spu_create(2) to establish SPU contexts in the spufs root.
17
18 Every SPU context is represented by a directory containing a predefined
19 set of files. These files can be used for manipulating the state of the
20 logical SPU. Users can change permissions on those files, but not actu-
21 ally add or remove files.
22
23
24MOUNT OPTIONS
25 uid=<uid>
26 set the user owning the mount point, the default is 0 (root).
27
28 gid=<gid>
29 set the group owning the mount point, the default is 0 (root).
30
31
32FILES
33 The files in spufs mostly follow the standard behavior for regular sys-
34 tem calls like read(2) or write(2), but often support only a subset of
35 the operations supported on regular file systems. This list details the
36 supported operations and the deviations from the behaviour in the
37 respective man pages.
38
39 All files that support the read(2) operation also support readv(2) and
40 all files that support the write(2) operation also support writev(2).
41 All files support the access(2) and stat(2) family of operations, but
42 only the st_mode, st_nlink, st_uid and st_gid fields of struct stat
43 contain reliable information.
44
45 All files support the chmod(2)/fchmod(2) and chown(2)/fchown(2) opera-
46 tions, but will not be able to grant permissions that contradict the
47 possible operations, e.g. read access on the wbox file.
48
49 The current set of files is:
50
51
52 /mem
53 the contents of the local storage memory of the SPU. This can be
54 accessed like a regular shared memory file and contains both code and
55 data in the address space of the SPU. The possible operations on an
56 open mem file are:
57
58 read(2), pread(2), write(2), pwrite(2), lseek(2)
59 These operate as documented, with the exception that seek(2),
60 write(2) and pwrite(2) are not supported beyond the end of the
61 file. The file size is the size of the local storage of the SPU,
62 which normally is 256 kilobytes.
63
64 mmap(2)
65 Mapping mem into the process address space gives access to the
66 SPU local storage within the process address space. Only
67 MAP_SHARED mappings are allowed.
68
69
70 /mbox
71 The first SPU to CPU communication mailbox. This file is read-only and
72 can be read in units of 32 bits. The file can only be used in non-
73 blocking mode and it even poll() will not block on it. The possible
74 operations on an open mbox file are:
75
76 read(2)
77 If a count smaller than four is requested, read returns -1 and
78 sets errno to EINVAL. If there is no data available in the mail
79 box, the return value is set to -1 and errno becomes EAGAIN.
80 When data has been read successfully, four bytes are placed in
81 the data buffer and the value four is returned.
82
83
84 /ibox
85 The second SPU to CPU communication mailbox. This file is similar to
86 the first mailbox file, but can be read in blocking I/O mode, and the
87 poll familiy of system calls can be used to wait for it. The possible
88 operations on an open ibox file are:
89
90 read(2)
91 If a count smaller than four is requested, read returns -1 and
92 sets errno to EINVAL. If there is no data available in the mail
93 box and the file descriptor has been opened with O_NONBLOCK, the
94 return value is set to -1 and errno becomes EAGAIN.
95
96 If there is no data available in the mail box and the file
97 descriptor has been opened without O_NONBLOCK, the call will
98 block until the SPU writes to its interrupt mailbox channel.
99 When data has been read successfully, four bytes are placed in
100 the data buffer and the value four is returned.
101
102 poll(2)
103 Poll on the ibox file returns (POLLIN | POLLRDNORM) whenever
104 data is available for reading.
105
106
107 /wbox
108 The CPU to SPU communation mailbox. It is write-only can can be written
109 in units of 32 bits. If the mailbox is full, write() will block and
110 poll can be used to wait for it becoming empty again. The possible
111 operations on an open wbox file are: write(2) If a count smaller than
112 four is requested, write returns -1 and sets errno to EINVAL. If there
113 is no space available in the mail box and the file descriptor has been
114 opened with O_NONBLOCK, the return value is set to -1 and errno becomes
115 EAGAIN.
116
117 If there is no space available in the mail box and the file descriptor
118 has been opened without O_NONBLOCK, the call will block until the SPU
119 reads from its PPE mailbox channel. When data has been read success-
120 fully, four bytes are placed in the data buffer and the value four is
121 returned.
122
123 poll(2)
124 Poll on the ibox file returns (POLLOUT | POLLWRNORM) whenever
125 space is available for writing.
126
127
128 /mbox_stat
129 /ibox_stat
130 /wbox_stat
131 Read-only files that contain the length of the current queue, i.e. how
132 many words can be read from mbox or ibox or how many words can be
133 written to wbox without blocking. The files can be read only in 4-byte
134 units and return a big-endian binary integer number. The possible
135 operations on an open *box_stat file are:
136
137 read(2)
138 If a count smaller than four is requested, read returns -1 and
139 sets errno to EINVAL. Otherwise, a four byte value is placed in
140 the data buffer, containing the number of elements that can be
141 read from (for mbox_stat and ibox_stat) or written to (for
142 wbox_stat) the respective mail box without blocking or resulting
143 in EAGAIN.
144
145
146 /npc
147 /decr
148 /decr_status
149 /spu_tag_mask
150 /event_mask
151 /srr0
152 Internal registers of the SPU. The representation is an ASCII string
153 with the numeric value of the next instruction to be executed. These
154 can be used in read/write mode for debugging, but normal operation of
155 programs should not rely on them because access to any of them except
156 npc requires an SPU context save and is therefore very inefficient.
157
158 The contents of these files are:
159
160 npc Next Program Counter
161
162 decr SPU Decrementer
163
164 decr_status Decrementer Status
165
166 spu_tag_mask MFC tag mask for SPU DMA
167
168 event_mask Event mask for SPU interrupts
169
170 srr0 Interrupt Return address register
171
172
173 The possible operations on an open npc, decr, decr_status,
174 spu_tag_mask, event_mask or srr0 file are:
175
176 read(2)
177 When the count supplied to the read call is shorter than the
178 required length for the pointer value plus a newline character,
179 subsequent reads from the same file descriptor will result in
180 completing the string, regardless of changes to the register by
181 a running SPU task. When a complete string has been read, all
182 subsequent read operations will return zero bytes and a new file
183 descriptor needs to be opened to read the value again.
184
185 write(2)
186 A write operation on the file results in setting the register to
187 the value given in the string. The string is parsed from the
188 beginning to the first non-numeric character or the end of the
189 buffer. Subsequent writes to the same file descriptor overwrite
190 the previous setting.
191
192
193 /fpcr
194 This file gives access to the Floating Point Status and Control Regis-
195 ter as a four byte long file. The operations on the fpcr file are:
196
197 read(2)
198 If a count smaller than four is requested, read returns -1 and
199 sets errno to EINVAL. Otherwise, a four byte value is placed in
200 the data buffer, containing the current value of the fpcr regis-
201 ter.
202
203 write(2)
204 If a count smaller than four is requested, write returns -1 and
205 sets errno to EINVAL. Otherwise, a four byte value is copied
206 from the data buffer, updating the value of the fpcr register.
207
208
209 /signal1
210 /signal2
211 The two signal notification channels of an SPU. These are read-write
212 files that operate on a 32 bit word. Writing to one of these files
213 triggers an interrupt on the SPU. The value writting to the signal
214 files can be read from the SPU through a channel read or from host user
215 space through the file. After the value has been read by the SPU, it
216 is reset to zero. The possible operations on an open signal1 or sig-
217 nal2 file are:
218
219 read(2)
220 If a count smaller than four is requested, read returns -1 and
221 sets errno to EINVAL. Otherwise, a four byte value is placed in
222 the data buffer, containing the current value of the specified
223 signal notification register.
224
225 write(2)
226 If a count smaller than four is requested, write returns -1 and
227 sets errno to EINVAL. Otherwise, a four byte value is copied
228 from the data buffer, updating the value of the specified signal
229 notification register. The signal notification register will
230 either be replaced with the input data or will be updated to the
231 bitwise OR or the old value and the input data, depending on the
232 contents of the signal1_type, or signal2_type respectively,
233 file.
234
235
236 /signal1_type
237 /signal2_type
238 These two files change the behavior of the signal1 and signal2 notifi-
239 cation files. The contain a numerical ASCII string which is read as
240 either "1" or "0". In mode 0 (overwrite), the hardware replaces the
241 contents of the signal channel with the data that is written to it. in
242 mode 1 (logical OR), the hardware accumulates the bits that are subse-
243 quently written to it. The possible operations on an open signal1_type
244 or signal2_type file are:
245
246 read(2)
247 When the count supplied to the read call is shorter than the
248 required length for the digit plus a newline character, subse-
249 quent reads from the same file descriptor will result in com-
250 pleting the string. When a complete string has been read, all
251 subsequent read operations will return zero bytes and a new file
252 descriptor needs to be opened to read the value again.
253
254 write(2)
255 A write operation on the file results in setting the register to
256 the value given in the string. The string is parsed from the
257 beginning to the first non-numeric character or the end of the
258 buffer. Subsequent writes to the same file descriptor overwrite
259 the previous setting.
260
261
262EXAMPLES
263 /etc/fstab entry
264 none /spu spufs gid=spu 0 0
265
266
267AUTHORS
268 Arnd Bergmann <arndb@de.ibm.com>, Mark Nutter <mnutter@us.ibm.com>,
269 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
270
271SEE ALSO
272 capabilities(7), close(2), spu_create(2), spu_run(2), spufs(7)
273
274
275
276Linux 2005-09-28 SPUFS(2)
277
278------------------------------------------------------------------------------
279
280SPU_RUN(2) Linux Programmer's Manual SPU_RUN(2)
281
282
283
284NAME
285 spu_run - execute an spu context
286
287
288SYNOPSIS
289 #include <sys/spu.h>
290
291 int spu_run(int fd, unsigned int *npc, unsigned int *event);
292
293DESCRIPTION
294 The spu_run system call is used on PowerPC machines that implement the
295 Cell Broadband Engine Architecture in order to access Synergistic Pro-
296 cessor Units (SPUs). It uses the fd that was returned from spu_cre-
297 ate(2) to address a specific SPU context. When the context gets sched-
298 uled to a physical SPU, it starts execution at the instruction pointer
299 passed in npc.
300
301 Execution of SPU code happens synchronously, meaning that spu_run does
302 not return while the SPU is still running. If there is a need to exe-
303 cute SPU code in parallel with other code on either the main CPU or
304 other SPUs, you need to create a new thread of execution first, e.g.
305 using the pthread_create(3) call.
306
307 When spu_run returns, the current value of the SPU instruction pointer
308 is written back to npc, so you can call spu_run again without updating
309 the pointers.
310
311 event can be a NULL pointer or point to an extended status code that
312 gets filled when spu_run returns. It can be one of the following con-
313 stants:
314
315 SPE_EVENT_DMA_ALIGNMENT
316 A DMA alignment error
317
318 SPE_EVENT_SPE_DATA_SEGMENT
319 A DMA segmentation error
320
321 SPE_EVENT_SPE_DATA_STORAGE
322 A DMA storage error
323
324 If NULL is passed as the event argument, these errors will result in a
325 signal delivered to the calling process.
326
327RETURN VALUE
328 spu_run returns the value of the spu_status register or -1 to indicate
329 an error and set errno to one of the error codes listed below. The
330 spu_status register value contains a bit mask of status codes and
331 optionally a 14 bit code returned from the stop-and-signal instruction
332 on the SPU. The bit masks for the status codes are:
333
334 0x02 SPU was stopped by stop-and-signal.
335
336 0x04 SPU was stopped by halt.
337
338 0x08 SPU is waiting for a channel.
339
340 0x10 SPU is in single-step mode.
341
342 0x20 SPU has tried to execute an invalid instruction.
343
344 0x40 SPU has tried to access an invalid channel.
345
346 0x3fff0000
347 The bits masked with this value contain the code returned from
348 stop-and-signal.
349
350 There are always one or more of the lower eight bits set or an error
351 code is returned from spu_run.
352
353ERRORS
354 EAGAIN or EWOULDBLOCK
355 fd is in non-blocking mode and spu_run would block.
356
357 EBADF fd is not a valid file descriptor.
358
359 EFAULT npc is not a valid pointer or status is neither NULL nor a valid
360 pointer.
361
362 EINTR A signal occured while spu_run was in progress. The npc value
363 has been updated to the new program counter value if necessary.
364
365 EINVAL fd is not a file descriptor returned from spu_create(2).
366
367 ENOMEM Insufficient memory was available to handle a page fault result-
368 ing from an MFC direct memory access.
369
370 ENOSYS the functionality is not provided by the current system, because
371 either the hardware does not provide SPUs or the spufs module is
372 not loaded.
373
374
375NOTES
376 spu_run is meant to be used from libraries that implement a more
377 abstract interface to SPUs, not to be used from regular applications.
378 See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
379 ommended libraries.
380
381
382CONFORMING TO
383 This call is Linux specific and only implemented by the ppc64 architec-
384 ture. Programs using this system call are not portable.
385
386
387BUGS
388 The code does not yet fully implement all features lined out here.
389
390
391AUTHOR
392 Arnd Bergmann <arndb@de.ibm.com>
393
394SEE ALSO
395 capabilities(7), close(2), spu_create(2), spufs(7)
396
397
398
399Linux 2005-09-28 SPU_RUN(2)
400
401------------------------------------------------------------------------------
402
403SPU_CREATE(2) Linux Programmer's Manual SPU_CREATE(2)
404
405
406
407NAME
408 spu_create - create a new spu context
409
410
411SYNOPSIS
412 #include <sys/types.h>
413 #include <sys/spu.h>
414
415 int spu_create(const char *pathname, int flags, mode_t mode);
416
417DESCRIPTION
418 The spu_create system call is used on PowerPC machines that implement
419 the Cell Broadband Engine Architecture in order to access Synergistic
420 Processor Units (SPUs). It creates a new logical context for an SPU in
421 pathname and returns a handle to associated with it. pathname must
422 point to a non-existing directory in the mount point of the SPU file
423 system (spufs). When spu_create is successful, a directory gets cre-
424 ated on pathname and it is populated with files.
425
426 The returned file handle can only be passed to spu_run(2) or closed,
427 other operations are not defined on it. When it is closed, all associ-
428 ated directory entries in spufs are removed. When the last file handle
429 pointing either inside of the context directory or to this file
430 descriptor is closed, the logical SPU context is destroyed.
431
432 The parameter flags can be zero or any bitwise or'd combination of the
433 following constants:
434
435 SPU_RAWIO
436 Allow mapping of some of the hardware registers of the SPU into
437 user space. This flag requires the CAP_SYS_RAWIO capability, see
438 capabilities(7).
439
440 The mode parameter specifies the permissions used for creating the new
441 directory in spufs. mode is modified with the user's umask(2) value
442 and then used for both the directory and the files contained in it. The
443 file permissions mask out some more bits of mode because they typically
444 support only read or write access. See stat(2) for a full list of the
445 possible mode values.
446
447
448RETURN VALUE
449 spu_create returns a new file descriptor. It may return -1 to indicate
450 an error condition and set errno to one of the error codes listed
451 below.
452
453
454ERRORS
455 EACCESS
456 The current user does not have write access on the spufs mount
457 point.
458
459 EEXIST An SPU context already exists at the given path name.
460
461 EFAULT pathname is not a valid string pointer in the current address
462 space.
463
464 EINVAL pathname is not a directory in the spufs mount point.
465
466 ELOOP Too many symlinks were found while resolving pathname.
467
468 EMFILE The process has reached its maximum open file limit.
469
470 ENAMETOOLONG
471 pathname was too long.
472
473 ENFILE The system has reached the global open file limit.
474
475 ENOENT Part of pathname could not be resolved.
476
477 ENOMEM The kernel could not allocate all resources required.
478
479 ENOSPC There are not enough SPU resources available to create a new
480 context or the user specific limit for the number of SPU con-
481 texts has been reached.
482
483 ENOSYS the functionality is not provided by the current system, because
484 either the hardware does not provide SPUs or the spufs module is
485 not loaded.
486
487 ENOTDIR
488 A part of pathname is not a directory.
489
490
491
492NOTES
493 spu_create is meant to be used from libraries that implement a more
494 abstract interface to SPUs, not to be used from regular applications.
495 See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
496 ommended libraries.
497
498
499FILES
500 pathname must point to a location beneath the mount point of spufs. By
501 convention, it gets mounted in /spu.
502
503
504CONFORMING TO
505 This call is Linux specific and only implemented by the ppc64 architec-
506 ture. Programs using this system call are not portable.
507
508
509BUGS
510 The code does not yet fully implement all features lined out here.
511
512
513AUTHOR
514 Arnd Bergmann <arndb@de.ibm.com>
515
516SEE ALSO
517 capabilities(7), close(2), spu_run(2), spufs(7)
518
519
520
521Linux 2005-09-28 SPU_CREATE(2)
diff --git a/Documentation/filesystems/sysfs-pci.txt b/Documentation/filesystems/sysfs-pci.txt
index 988a62fae11f..7ba2baa165ff 100644
--- a/Documentation/filesystems/sysfs-pci.txt
+++ b/Documentation/filesystems/sysfs-pci.txt
@@ -1,4 +1,5 @@
1Accessing PCI device resources through sysfs 1Accessing PCI device resources through sysfs
2--------------------------------------------
2 3
3sysfs, usually mounted at /sys, provides access to PCI resources on platforms 4sysfs, usually mounted at /sys, provides access to PCI resources on platforms
4that support it. For example, a given bus might look like this: 5that support it. For example, a given bus might look like this:
@@ -47,14 +48,21 @@ files, each with their own function.
47 binary - file contains binary data 48 binary - file contains binary data
48 cpumask - file contains a cpumask type 49 cpumask - file contains a cpumask type
49 50
50The read only files are informational, writes to them will be ignored. 51The read only files are informational, writes to them will be ignored, with
51Writable files can be used to perform actions on the device (e.g. changing 52the exception of the 'rom' file. Writable files can be used to perform
52config space, detaching a device). mmapable files are available via an 53actions on the device (e.g. changing config space, detaching a device).
53mmap of the file at offset 0 and can be used to do actual device programming 54mmapable files are available via an mmap of the file at offset 0 and can be
54from userspace. Note that some platforms don't support mmapping of certain 55used to do actual device programming from userspace. Note that some platforms
55resources, so be sure to check the return value from any attempted mmap. 56don't support mmapping of certain resources, so be sure to check the return
57value from any attempted mmap.
58
59The 'rom' file is special in that it provides read-only access to the device's
60ROM file, if available. It's disabled by default, however, so applications
61should write the string "1" to the file to enable it before attempting a read
62call, and disable it following the access by writing "0" to the file.
56 63
57Accessing legacy resources through sysfs 64Accessing legacy resources through sysfs
65----------------------------------------
58 66
59Legacy I/O port and ISA memory resources are also provided in sysfs if the 67Legacy I/O port and ISA memory resources are also provided in sysfs if the
60underlying platform supports them. They're located in the PCI class heirarchy, 68underlying platform supports them. They're located in the PCI class heirarchy,
@@ -75,6 +83,7 @@ simply dereference the returned pointer (after checking for errors of course)
75to access legacy memory space. 83to access legacy memory space.
76 84
77Supporting PCI access on new platforms 85Supporting PCI access on new platforms
86--------------------------------------
78 87
79In order to support PCI resource mapping as described above, Linux platform 88In order to support PCI resource mapping as described above, Linux platform
80code must define HAVE_PCI_MMAP and provide a pci_mmap_page_range function. 89code must define HAVE_PCI_MMAP and provide a pci_mmap_page_range function.
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt
index 0d783c504ead..dbe4d87d2615 100644
--- a/Documentation/filesystems/tmpfs.txt
+++ b/Documentation/filesystems/tmpfs.txt
@@ -78,6 +78,18 @@ use up all the memory on the machine; but enhances the scalability of
78that instance in a system with many cpus making intensive use of it. 78that instance in a system with many cpus making intensive use of it.
79 79
80 80
81tmpfs has a mount option to set the NUMA memory allocation policy for
82all files in that instance:
83mpol=interleave prefers to allocate memory from each node in turn
84mpol=default prefers to allocate memory from the local node
85mpol=bind prefers to allocate from mpol_nodelist
86mpol=preferred prefers to allocate from first node in mpol_nodelist
87
88The following mount option is used in conjunction with mpol=interleave,
89mpol=bind or mpol=preferred:
90mpol_nodelist: nodelist suitable for parsing with nodelist_parse.
91
92
81To specify the initial root directory you can use the following mount 93To specify the initial root directory you can use the following mount
82options: 94options:
83 95
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index ee4c0a8b8db7..e56e842847d3 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -162,9 +162,8 @@ get_sb() method fills in is the "s_op" field. This is a pointer to
162a "struct super_operations" which describes the next level of the 162a "struct super_operations" which describes the next level of the
163filesystem implementation. 163filesystem implementation.
164 164
165Usually, a filesystem uses generic one of the generic get_sb() 165Usually, a filesystem uses one of the generic get_sb() implementations
166implementations and provides a fill_super() method instead. The 166and provides a fill_super() method instead. The generic methods are:
167generic methods are:
168 167
169 get_sb_bdev: mount a filesystem residing on a block device 168 get_sb_bdev: mount a filesystem residing on a block device
170 169
diff --git a/Documentation/hpet.txt b/Documentation/hpet.txt
index e52457581f47..b7a3dc38dd52 100644
--- a/Documentation/hpet.txt
+++ b/Documentation/hpet.txt
@@ -2,7 +2,7 @@
2 2
3The High Precision Event Timer (HPET) hardware is the future replacement 3The High Precision Event Timer (HPET) hardware is the future replacement
4for the 8254 and Real Time Clock (RTC) periodic timer functionality. 4for the 8254 and Real Time Clock (RTC) periodic timer functionality.
5Each HPET can have up two 32 timers. It is possible to configure the 5Each HPET can have up to 32 timers. It is possible to configure the
6first two timers as legacy replacements for 8254 and RTC periodic timers. 6first two timers as legacy replacements for 8254 and RTC periodic timers.
7A specification done by Intel and Microsoft can be found at 7A specification done by Intel and Microsoft can be found at
8<http://www.intel.com/hardwaredesign/hpetspec.htm>. 8<http://www.intel.com/hardwaredesign/hpetspec.htm>.
diff --git a/Documentation/hrtimers.txt b/Documentation/hrtimers.txt
new file mode 100644
index 000000000000..7620ff735faf
--- /dev/null
+++ b/Documentation/hrtimers.txt
@@ -0,0 +1,178 @@
1
2hrtimers - subsystem for high-resolution kernel timers
3----------------------------------------------------
4
5This patch introduces a new subsystem for high-resolution kernel timers.
6
7One might ask the question: we already have a timer subsystem
8(kernel/timers.c), why do we need two timer subsystems? After a lot of
9back and forth trying to integrate high-resolution and high-precision
10features into the existing timer framework, and after testing various
11such high-resolution timer implementations in practice, we came to the
12conclusion that the timer wheel code is fundamentally not suitable for
13such an approach. We initially didnt believe this ('there must be a way
14to solve this'), and spent a considerable effort trying to integrate
15things into the timer wheel, but we failed. In hindsight, there are
16several reasons why such integration is hard/impossible:
17
18- the forced handling of low-resolution and high-resolution timers in
19 the same way leads to a lot of compromises, macro magic and #ifdef
20 mess. The timers.c code is very "tightly coded" around jiffies and
21 32-bitness assumptions, and has been honed and micro-optimized for a
22 relatively narrow use case (jiffies in a relatively narrow HZ range)
23 for many years - and thus even small extensions to it easily break
24 the wheel concept, leading to even worse compromises. The timer wheel
25 code is very good and tight code, there's zero problems with it in its
26 current usage - but it is simply not suitable to be extended for
27 high-res timers.
28
29- the unpredictable [O(N)] overhead of cascading leads to delays which
30 necessiate a more complex handling of high resolution timers, which
31 in turn decreases robustness. Such a design still led to rather large
32 timing inaccuracies. Cascading is a fundamental property of the timer
33 wheel concept, it cannot be 'designed out' without unevitably
34 degrading other portions of the timers.c code in an unacceptable way.
35
36- the implementation of the current posix-timer subsystem on top of
37 the timer wheel has already introduced a quite complex handling of
38 the required readjusting of absolute CLOCK_REALTIME timers at
39 settimeofday or NTP time - further underlying our experience by
40 example: that the timer wheel data structure is too rigid for high-res
41 timers.
42
43- the timer wheel code is most optimal for use cases which can be
44 identified as "timeouts". Such timeouts are usually set up to cover
45 error conditions in various I/O paths, such as networking and block
46 I/O. The vast majority of those timers never expire and are rarely
47 recascaded because the expected correct event arrives in time so they
48 can be removed from the timer wheel before any further processing of
49 them becomes necessary. Thus the users of these timeouts can accept
50 the granularity and precision tradeoffs of the timer wheel, and
51 largely expect the timer subsystem to have near-zero overhead.
52 Accurate timing for them is not a core purpose - in fact most of the
53 timeout values used are ad-hoc. For them it is at most a necessary
54 evil to guarantee the processing of actual timeout completions
55 (because most of the timeouts are deleted before completion), which
56 should thus be as cheap and unintrusive as possible.
57
58The primary users of precision timers are user-space applications that
59utilize nanosleep, posix-timers and itimer interfaces. Also, in-kernel
60users like drivers and subsystems which require precise timed events
61(e.g. multimedia) can benefit from the availability of a seperate
62high-resolution timer subsystem as well.
63
64While this subsystem does not offer high-resolution clock sources just
65yet, the hrtimer subsystem can be easily extended with high-resolution
66clock capabilities, and patches for that exist and are maturing quickly.
67The increasing demand for realtime and multimedia applications along
68with other potential users for precise timers gives another reason to
69separate the "timeout" and "precise timer" subsystems.
70
71Another potential benefit is that such a seperation allows even more
72special-purpose optimization of the existing timer wheel for the low
73resolution and low precision use cases - once the precision-sensitive
74APIs are separated from the timer wheel and are migrated over to
75hrtimers. E.g. we could decrease the frequency of the timeout subsystem
76from 250 Hz to 100 HZ (or even smaller).
77
78hrtimer subsystem implementation details
79----------------------------------------
80
81the basic design considerations were:
82
83- simplicity
84
85- data structure not bound to jiffies or any other granularity. All the
86 kernel logic works at 64-bit nanoseconds resolution - no compromises.
87
88- simplification of existing, timing related kernel code
89
90another basic requirement was the immediate enqueueing and ordering of
91timers at activation time. After looking at several possible solutions
92such as radix trees and hashes, we chose the red black tree as the basic
93data structure. Rbtrees are available as a library in the kernel and are
94used in various performance-critical areas of e.g. memory management and
95file systems. The rbtree is solely used for time sorted ordering, while
96a separate list is used to give the expiry code fast access to the
97queued timers, without having to walk the rbtree.
98
99(This seperate list is also useful for later when we'll introduce
100high-resolution clocks, where we need seperate pending and expired
101queues while keeping the time-order intact.)
102
103Time-ordered enqueueing is not purely for the purposes of
104high-resolution clocks though, it also simplifies the handling of
105absolute timers based on a low-resolution CLOCK_REALTIME. The existing
106implementation needed to keep an extra list of all armed absolute
107CLOCK_REALTIME timers along with complex locking. In case of
108settimeofday and NTP, all the timers (!) had to be dequeued, the
109time-changing code had to fix them up one by one, and all of them had to
110be enqueued again. The time-ordered enqueueing and the storage of the
111expiry time in absolute time units removes all this complex and poorly
112scaling code from the posix-timer implementation - the clock can simply
113be set without having to touch the rbtree. This also makes the handling
114of posix-timers simpler in general.
115
116The locking and per-CPU behavior of hrtimers was mostly taken from the
117existing timer wheel code, as it is mature and well suited. Sharing code
118was not really a win, due to the different data structures. Also, the
119hrtimer functions now have clearer behavior and clearer names - such as
120hrtimer_try_to_cancel() and hrtimer_cancel() [which are roughly
121equivalent to del_timer() and del_timer_sync()] - so there's no direct
1221:1 mapping between them on the algorithmical level, and thus no real
123potential for code sharing either.
124
125Basic data types: every time value, absolute or relative, is in a
126special nanosecond-resolution type: ktime_t. The kernel-internal
127representation of ktime_t values and operations is implemented via
128macros and inline functions, and can be switched between a "hybrid
129union" type and a plain "scalar" 64bit nanoseconds representation (at
130compile time). The hybrid union type optimizes time conversions on 32bit
131CPUs. This build-time-selectable ktime_t storage format was implemented
132to avoid the performance impact of 64-bit multiplications and divisions
133on 32bit CPUs. Such operations are frequently necessary to convert
134between the storage formats provided by kernel and userspace interfaces
135and the internal time format. (See include/linux/ktime.h for further
136details.)
137
138hrtimers - rounding of timer values
139-----------------------------------
140
141the hrtimer code will round timer events to lower-resolution clocks
142because it has to. Otherwise it will do no artificial rounding at all.
143
144one question is, what resolution value should be returned to the user by
145the clock_getres() interface. This will return whatever real resolution
146a given clock has - be it low-res, high-res, or artificially-low-res.
147
148hrtimers - testing and verification
149----------------------------------
150
151We used the high-resolution clock subsystem ontop of hrtimers to verify
152the hrtimer implementation details in praxis, and we also ran the posix
153timer tests in order to ensure specification compliance. We also ran
154tests on low-resolution clocks.
155
156The hrtimer patch converts the following kernel functionality to use
157hrtimers:
158
159 - nanosleep
160 - itimers
161 - posix-timers
162
163The conversion of nanosleep and posix-timers enabled the unification of
164nanosleep and clock_nanosleep.
165
166The code was successfully compiled for the following platforms:
167
168 i386, x86_64, ARM, PPC, PPC64, IA64
169
170The code was run-tested on the following platforms:
171
172 i386(UP/SMP), x86_64(UP/SMP), ARM, PPC
173
174hrtimers were also integrated into the -rt tree, along with a
175hrtimers-based high-resolution clock implementation, so the hrtimers
176code got a healthy amount of testing and use in practice.
177
178 Thomas Gleixner, Ingo Molnar
diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf
index 78f37c2d602e..5d23776e9907 100644
--- a/Documentation/hwmon/w83627hf
+++ b/Documentation/hwmon/w83627hf
@@ -54,13 +54,16 @@ If you really want i2c accesses for these Super I/O chips,
54use the w83781d driver. However this is not the preferred method 54use the w83781d driver. However this is not the preferred method
55now that this ISA driver has been developed. 55now that this ISA driver has been developed.
56 56
57Technically, the w83627thf does not support a VID reading. However, it's 57The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the
58possible or even likely that your mainboard maker has routed these signals 58same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a
59to a specific set of general purpose IO pins (the Asus P4C800-E is one such 59VID reading. However the two chips have the identical 128 pin package. So,
60board). The w83627thf driver now interprets these as VID. If the VID on 60it is possible or even likely for a w83627thf to have the VID signals routed
61your board doesn't work, first see doc/vid in the lm_sensors package. If 61to these pins despite their not being labeled for that purpose. Therefore,
62that still doesn't help, email us at lm-sensors@lm-sensors.org. 62the w83627thf driver interprets these as VID. If the VID on your board
63doesn't work, first see doc/vid in the lm_sensors package[1]. If that still
64doesn't help, you may just ignore the bogus VID reading with no harm done.
63 65
64For further information on this driver see the w83781d driver 66For further information on this driver see the w83781d driver documentation.
65documentation. 67
68[1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid
66 69
diff --git a/Documentation/i2c/busses/i2c-nforce2 b/Documentation/i2c/busses/i2c-nforce2
index e379e182e64f..d751282d9b2a 100644
--- a/Documentation/i2c/busses/i2c-nforce2
+++ b/Documentation/i2c/busses/i2c-nforce2
@@ -5,7 +5,8 @@ Supported adapters:
5 * nForce2 Ultra 400 MCP 10de:0084 5 * nForce2 Ultra 400 MCP 10de:0084
6 * nForce3 Pro150 MCP 10de:00D4 6 * nForce3 Pro150 MCP 10de:00D4
7 * nForce3 250Gb MCP 10de:00E4 7 * nForce3 250Gb MCP 10de:00E4
8 * nForce4 MCP 10de:0052 8 * nForce4 MCP 10de:0052
9 * nForce4 MCP-04 10de:0034
9 10
10Datasheet: not publically available, but seems to be similar to the 11Datasheet: not publically available, but seems to be similar to the
11 AMD-8111 SMBus 2.0 adapter. 12 AMD-8111 SMBus 2.0 adapter.
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport
index 9f1d0082da18..d9f23c0763f1 100644
--- a/Documentation/i2c/busses/i2c-parport
+++ b/Documentation/i2c/busses/i2c-parport
@@ -17,6 +17,7 @@ It currently supports the following devices:
17 * Velleman K8000 adapter 17 * Velleman K8000 adapter
18 * ELV adapter 18 * ELV adapter
19 * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) 19 * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032)
20 * Barco LPT->DVI (K5800236) adapter
20 21
21These devices use different pinout configurations, so you have to tell 22These devices use different pinout configurations, so you have to tell
22the driver what you have, using the type module parameter. There is no 23the driver what you have, using the type module parameter. There is no
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
index 184fac2377aa..f03c2a02f806 100644
--- a/Documentation/i2c/porting-clients
+++ b/Documentation/i2c/porting-clients
@@ -1,10 +1,13 @@
1Revision 5, 2005-07-29 1Revision 6, 2005-11-20
2Jean Delvare <khali@linux-fr.org> 2Jean Delvare <khali@linux-fr.org>
3Greg KH <greg@kroah.com> 3Greg KH <greg@kroah.com>
4 4
5This is a guide on how to convert I2C chip drivers from Linux 2.4 to 5This is a guide on how to convert I2C chip drivers from Linux 2.4 to
6Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. 6Linux 2.6. I have been using existing drivers (lm75, lm78) as examples.
7Then I converted a driver myself (lm83) and updated this document. 7Then I converted a driver myself (lm83) and updated this document.
8Note that this guide is strongly oriented towards hardware monitoring
9drivers. Many points are still valid for other type of drivers, but
10others may be irrelevant.
8 11
9There are two sets of points below. The first set concerns technical 12There are two sets of points below. The first set concerns technical
10changes. The second set concerns coding policy. Both are mandatory. 13changes. The second set concerns coding policy. Both are mandatory.
@@ -22,16 +25,20 @@ Technical changes:
22 #include <linux/module.h> 25 #include <linux/module.h>
23 #include <linux/init.h> 26 #include <linux/init.h>
24 #include <linux/slab.h> 27 #include <linux/slab.h>
28 #include <linux/jiffies.h>
25 #include <linux/i2c.h> 29 #include <linux/i2c.h>
30 #include <linux/i2c-isa.h> /* for ISA drivers */
26 #include <linux/hwmon.h> /* for hardware monitoring drivers */ 31 #include <linux/hwmon.h> /* for hardware monitoring drivers */
27 #include <linux/hwmon-sysfs.h> 32 #include <linux/hwmon-sysfs.h>
28 #include <linux/hwmon-vid.h> /* if you need VRM support */ 33 #include <linux/hwmon-vid.h> /* if you need VRM support */
34 #include <linux/err.h> /* for class registration */
29 #include <asm/io.h> /* if you have I/O operations */ 35 #include <asm/io.h> /* if you have I/O operations */
30 Please respect this inclusion order. Some extra headers may be 36 Please respect this inclusion order. Some extra headers may be
31 required for a given driver (e.g. "lm75.h"). 37 required for a given driver (e.g. "lm75.h").
32 38
33* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses 39* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses
34 are no more handled by the i2c core. 40 are no more handled by the i2c core. Address ranges are no more
41 supported either, define each individual address separately.
35 SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. 42 SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>.
36 43
37* [Client data] Get rid of sysctl_id. Try using standard names for 44* [Client data] Get rid of sysctl_id. Try using standard names for
@@ -48,23 +55,23 @@ Technical changes:
48 int kind); 55 int kind);
49 static void lm75_init_client(struct i2c_client *client); 56 static void lm75_init_client(struct i2c_client *client);
50 static int lm75_detach_client(struct i2c_client *client); 57 static int lm75_detach_client(struct i2c_client *client);
51 static void lm75_update_client(struct i2c_client *client); 58 static struct lm75_data lm75_update_device(struct device *dev);
52 59
53* [Sysctl] All sysctl stuff is of course gone (defines, ctl_table 60* [Sysctl] All sysctl stuff is of course gone (defines, ctl_table
54 and functions). Instead, you have to define show and set functions for 61 and functions). Instead, you have to define show and set functions for
55 each sysfs file. Only define set for writable values. Take a look at an 62 each sysfs file. Only define set for writable values. Take a look at an
56 existing 2.6 driver for details (lm78 for example). Don't forget 63 existing 2.6 driver for details (it87 for example). Don't forget
57 to define the attributes for each file (this is that step that 64 to define the attributes for each file (this is that step that
58 links callback functions). Use the file names specified in 65 links callback functions). Use the file names specified in
59 Documentation/i2c/sysfs-interface for the individual files. Also 66 Documentation/hwmon/sysfs-interface for the individual files. Also
60 convert the units these files read and write to the specified ones. 67 convert the units these files read and write to the specified ones.
61 If you need to add a new type of file, please discuss it on the 68 If you need to add a new type of file, please discuss it on the
62 sensors mailing list <lm-sensors@lm-sensors.org> by providing a 69 sensors mailing list <lm-sensors@lm-sensors.org> by providing a
63 patch to the Documentation/i2c/sysfs-interface file. 70 patch to the Documentation/hwmon/sysfs-interface file.
64 71
65* [Attach] For I2C drivers, the attach function should make sure 72* [Attach] For I2C drivers, the attach function should make sure
66 that the adapter's class has I2C_CLASS_HWMON, using the 73 that the adapter's class has I2C_CLASS_HWMON (or whatever class is
67 following construct: 74 suitable for your driver), using the following construct:
68 if (!(adapter->class & I2C_CLASS_HWMON)) 75 if (!(adapter->class & I2C_CLASS_HWMON))
69 return 0; 76 return 0;
70 ISA-only drivers of course don't need this. 77 ISA-only drivers of course don't need this.
@@ -72,63 +79,72 @@ Technical changes:
72 79
73* [Detect] As mentioned earlier, the flags parameter is gone. 80* [Detect] As mentioned earlier, the flags parameter is gone.
74 The type_name and client_name strings are replaced by a single 81 The type_name and client_name strings are replaced by a single
75 name string, which will be filled with a lowercase, short string 82 name string, which will be filled with a lowercase, short string.
76 (typically the driver name, e.g. "lm75").
77 In i2c-only drivers, drop the i2c_is_isa_adapter check, it's 83 In i2c-only drivers, drop the i2c_is_isa_adapter check, it's
78 useless. Same for isa-only drivers, as the test would always be 84 useless. Same for isa-only drivers, as the test would always be
79 true. Only hybrid drivers (which are quite rare) still need it. 85 true. Only hybrid drivers (which are quite rare) still need it.
80 The errorN labels are reduced to the number needed. If that number 86 The labels used for error paths are reduced to the number needed.
81 is 2 (i2c-only drivers), it is advised that the labels are named 87 It is advised that the labels are given descriptive names such as
82 exit and exit_free. For i2c+isa drivers, labels should be named 88 exit and exit_free. Don't forget to properly set err before
83 ERROR0, ERROR1 and ERROR2. Don't forget to properly set err before
84 jumping to error labels. By the way, labels should be left-aligned. 89 jumping to error labels. By the way, labels should be left-aligned.
85 Use kzalloc instead of kmalloc. 90 Use kzalloc instead of kmalloc.
86 Use i2c_set_clientdata to set the client data (as opposed to 91 Use i2c_set_clientdata to set the client data (as opposed to
87 a direct access to client->data). 92 a direct access to client->data).
88 Use strlcpy instead of strcpy to copy the client name. 93 Use strlcpy instead of strcpy or snprintf to copy the client name.
89 Replace the sysctl directory registration by calls to 94 Replace the sysctl directory registration by calls to
90 device_create_file. Move the driver initialization before any 95 device_create_file. Move the driver initialization before any
91 sysfs file creation. 96 sysfs file creation.
97 Register the client with the hwmon class (using hwmon_device_register)
98 if applicable.
92 Drop client->id. 99 Drop client->id.
93 Drop any 24RF08 corruption prevention you find, as this is now done 100 Drop any 24RF08 corruption prevention you find, as this is now done
94 at the i2c-core level, and doing it twice voids it. 101 at the i2c-core level, and doing it twice voids it.
102 Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now.
95 103
96* [Init] Limits must not be set by the driver (can be done later in 104* [Init] Limits must not be set by the driver (can be done later in
97 user-space). Chip should not be reset default (although a module 105 user-space). Chip should not be reset default (although a module
98 parameter may be used to force is), and initialization should be 106 parameter may be used to force it), and initialization should be
99 limited to the strictly necessary steps. 107 limited to the strictly necessary steps.
100 108
101* [Detach] Get rid of data, remove the call to 109* [Detach] Remove the call to i2c_deregister_entry. Do not log an
102 i2c_deregister_entry. Do not log an error message if 110 error message if i2c_detach_client fails, as i2c-core will now do
103 i2c_detach_client fails, as i2c-core will now do it for you. 111 it for you.
104 112 Unregister from the hwmon class if applicable.
105* [Update] Don't access client->data directly, use 113
106 i2c_get_clientdata(client) instead. 114* [Update] The function prototype changed, it is now
107 115 passed a device structure, which you have to convert to a client
108* [Interface] Init function should not print anything. Make sure 116 using to_i2c_client(dev). The update function should return a
109 there is a MODULE_LICENSE() line, at the bottom of the file 117 pointer to the client data.
110 (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order). 118 Don't access client->data directly, use i2c_get_clientdata(client)
119 instead.
120 Use time_after() instead of direct jiffies comparison.
121
122* [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom
123 of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this
124 order).
125
126* [Driver] The flags field of the i2c_driver structure is gone.
127 I2C_DF_NOTIFY is now the default behavior.
128 The i2c_driver structure has a driver member, which is itself a
129 structure, those name member should be initialized to a driver name
130 string. i2c_driver itself has no name member anymore.
111 131
112Coding policy: 132Coding policy:
113 133
114* [Copyright] Use (C), not (c), for copyright. 134* [Copyright] Use (C), not (c), for copyright.
115 135
116* [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you 136* [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you
117 can. Calls to printk/pr_debug for debugging purposes are replaced 137 can. Calls to printk for debugging purposes are replaced by calls to
118 by calls to dev_dbg. Here is an example on how to call it (taken 138 dev_dbg where possible, else to pr_debug. Here is an example of how
119 from lm75_detect): 139 to call it (taken from lm75_detect):
120 dev_dbg(&client->dev, "Starting lm75 update\n"); 140 dev_dbg(&client->dev, "Starting lm75 update\n");
121 Replace other printk calls with the dev_info, dev_err or dev_warn 141 Replace other printk calls with the dev_info, dev_err or dev_warn
122 function, as appropriate. 142 function, as appropriate.
123 143
124* [Constants] Constants defines (registers, conversions, initial 144* [Constants] Constants defines (registers, conversions) should be
125 values) should be aligned. This greatly improves readability. 145 aligned. This greatly improves readability.
126 Same goes for variables declarations. Alignments are achieved by the 146 Alignments are achieved by the means of tabs, not spaces. Remember
127 means of tabs, not spaces. Remember that tabs are set to 8 in the 147 that tabs are set to 8 in the Linux kernel code.
128 Linux kernel code.
129
130* [Structure definition] The name field should be standardized. All
131 lowercase and as simple as the driver name itself (e.g. "lm75").
132 148
133* [Layout] Avoid extra empty lines between comments and what they 149* [Layout] Avoid extra empty lines between comments and what they
134 comment. Respect the coding style (see Documentation/CodingStyle), 150 comment. Respect the coding style (see Documentation/CodingStyle),
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index d19993cc0604..3a057c8e5507 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -25,9 +25,9 @@ routines, a client structure specific information like the actual I2C
25address. 25address.
26 26
27static struct i2c_driver foo_driver = { 27static struct i2c_driver foo_driver = {
28 .owner = THIS_MODULE, 28 .driver = {
29 .name = "Foo version 2.3 driver", 29 .name = "foo",
30 .flags = I2C_DF_NOTIFY, 30 },
31 .attach_adapter = &foo_attach_adapter, 31 .attach_adapter = &foo_attach_adapter,
32 .detach_client = &foo_detach_client, 32 .detach_client = &foo_detach_client,
33 .command = &foo_command /* may be NULL */ 33 .command = &foo_command /* may be NULL */
@@ -36,10 +36,6 @@ static struct i2c_driver foo_driver = {
36The name field must match the driver name, including the case. It must not 36The name field must match the driver name, including the case. It must not
37contain spaces, and may be up to 31 characters long. 37contain spaces, and may be up to 31 characters long.
38 38
39Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This
40means that your driver will be notified when new adapters are found.
41This is almost always what you want.
42
43All other fields are for call-back functions which will be explained 39All other fields are for call-back functions which will be explained
44below. 40below.
45 41
@@ -496,17 +492,13 @@ Note that some functions are marked by `__init', and some data structures
496by `__init_data'. Hose functions and structures can be removed after 492by `__init_data'. Hose functions and structures can be removed after
497kernel booting (or module loading) is completed. 493kernel booting (or module loading) is completed.
498 494
495
499Command function 496Command function
500================ 497================
501 498
502A generic ioctl-like function call back is supported. You will seldom 499A generic ioctl-like function call back is supported. You will seldom
503need this. You may even set it to NULL. 500need this, and its use is deprecated anyway, so newer design should not
504 501use it. Set it to NULL.
505 /* No commands defined */
506 int foo_command(struct i2c_client *client, unsigned int cmd, void *arg)
507 {
508 return 0;
509 }
510 502
511 503
512Sending and receiving 504Sending and receiving
diff --git a/Documentation/i2o/ioctl b/Documentation/i2o/ioctl
index 3e174978997d..1e77fac4e120 100644
--- a/Documentation/i2o/ioctl
+++ b/Documentation/i2o/ioctl
@@ -185,7 +185,7 @@ VII. Getting Parameters
185 ENOMEM Kernel memory allocation error 185 ENOMEM Kernel memory allocation error
186 186
187 A return value of 0 does not mean that the value was actually 187 A return value of 0 does not mean that the value was actually
188 properly retreived. The user should check the result list 188 properly retrieved. The user should check the result list
189 to determine the specific status of the transaction. 189 to determine the specific status of the transaction.
190 190
191VIII. Downloading Software 191VIII. Downloading Software
diff --git a/Documentation/input/appletouch.txt b/Documentation/input/appletouch.txt
index b48d11d0326d..4f7c633a76d2 100644
--- a/Documentation/input/appletouch.txt
+++ b/Documentation/input/appletouch.txt
@@ -3,7 +3,7 @@ Apple Touchpad Driver (appletouch)
3 Copyright (C) 2005 Stelian Pop <stelian@popies.net> 3 Copyright (C) 2005 Stelian Pop <stelian@popies.net>
4 4
5appletouch is a Linux kernel driver for the USB touchpad found on post 5appletouch is a Linux kernel driver for the USB touchpad found on post
6February 2005 Apple Alu Powerbooks. 6February 2005 and October 2005 Apple Aluminium Powerbooks.
7 7
8This driver is derived from Johannes Berg's appletrackpad driver[1], but it has 8This driver is derived from Johannes Berg's appletrackpad driver[1], but it has
9been improved in some areas: 9been improved in some areas:
@@ -13,7 +13,8 @@ been improved in some areas:
13 13
14Credits go to Johannes Berg for reverse-engineering the touchpad protocol, 14Credits go to Johannes Berg for reverse-engineering the touchpad protocol,
15Frank Arnold for further improvements, and Alex Harper for some additional 15Frank Arnold for further improvements, and Alex Harper for some additional
16information about the inner workings of the touchpad sensors. 16information about the inner workings of the touchpad sensors. Michael
17Hanselmann added support for the October 2005 models.
17 18
18Usage: 19Usage:
19------ 20------
diff --git a/Documentation/input/ff.txt b/Documentation/input/ff.txt
index efa7dd6751f3..c7e10eaff203 100644
--- a/Documentation/input/ff.txt
+++ b/Documentation/input/ff.txt
@@ -120,7 +120,7 @@ to the unique id assigned by the driver. This data is required for performing
120some operations (removing an effect, controlling the playback). 120some operations (removing an effect, controlling the playback).
121This if field must be set to -1 by the user in order to tell the driver to 121This if field must be set to -1 by the user in order to tell the driver to
122allocate a new effect. 122allocate a new effect.
123See <linux/input.h> for a description of the ff_effect stuct. You should also 123See <linux/input.h> for a description of the ff_effect struct. You should also
124find help in a few sketches, contained in files shape.fig and interactive.fig. 124find help in a few sketches, contained in files shape.fig and interactive.fig.
125You need xfig to visualize these files. 125You need xfig to visualize these files.
126 126
diff --git a/Documentation/ioctl/hdio.txt b/Documentation/ioctl/hdio.txt
index 9a7aea0636a5..11c9be49f37c 100644
--- a/Documentation/ioctl/hdio.txt
+++ b/Documentation/ioctl/hdio.txt
@@ -946,7 +946,7 @@ HDIO_SCAN_HWIF register and (re)scan interface
946 946
947 This ioctl initializes the addresses and irq for a disk 947 This ioctl initializes the addresses and irq for a disk
948 controller, probes for drives, and creates /proc/ide 948 controller, probes for drives, and creates /proc/ide
949 interfaces as appropiate. 949 interfaces as appropriate.
950 950
951 951
952 952
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index d802ce88bedc..443230b43e09 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -1033,9 +1033,9 @@ When kbuild executes the following steps are followed (roughly):
1033 1033
1034 Example: 1034 Example:
1035 #arch/i386/Makefile 1035 #arch/i386/Makefile
1036 GCC_VERSION := $(call cc-version)
1037 cflags-y += $(shell \ 1036 cflags-y += $(shell \
1038 if [ $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;) 1037 if [ $(call cc-version) -ge 0300 ] ; then \
1038 echo "-mregparm=3"; fi ;)
1039 1039
1040 In the above example -mregparm=3 is only used for gcc version greater 1040 In the above example -mregparm=3 is only used for gcc version greater
1041 than or equal to gcc 3.0. 1041 than or equal to gcc 3.0.
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
index c91caf7eb303..7e77f93634ea 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.txt
@@ -18,6 +18,7 @@ In this document you will find information about:
18 === 5. Include files 18 === 5. Include files
19 --- 5.1 How to include files from the kernel include dir 19 --- 5.1 How to include files from the kernel include dir
20 --- 5.2 External modules using an include/ dir 20 --- 5.2 External modules using an include/ dir
21 --- 5.3 External modules using several directories
21 === 6. Module installation 22 === 6. Module installation
22 --- 6.1 INSTALL_MOD_PATH 23 --- 6.1 INSTALL_MOD_PATH
23 --- 6.2 INSTALL_MOD_DIR 24 --- 6.2 INSTALL_MOD_DIR
@@ -38,7 +39,7 @@ included in the kernel tree.
38What is covered within this file is mainly information to authors 39What is covered within this file is mainly information to authors
39of modules. The author of an external modules should supply 40of modules. The author of an external modules should supply
40a makefile that hides most of the complexity so one only has to type 41a makefile that hides most of the complexity so one only has to type
41'make' to buld the module. A complete example will be present in 42'make' to build the module. A complete example will be present in
42chapter Ī. Creating a kbuild file for an external module". 43chapter Ī. Creating a kbuild file for an external module".
43 44
44 45
@@ -69,7 +70,7 @@ when building an external module.
69 70
70--- 2.2 Available targets 71--- 2.2 Available targets
71 72
72 $KDIR refers to path to kernel source top-level directory 73 $KDIR refers to the path to the kernel source top-level directory
73 74
74 make -C $KDIR M=`pwd` 75 make -C $KDIR M=`pwd`
75 Will build the module(s) located in current directory. 76 Will build the module(s) located in current directory.
@@ -87,11 +88,11 @@ when building an external module.
87 make -C $KDIR M=$PWD modules_install 88 make -C $KDIR M=$PWD modules_install
88 Install the external module(s). 89 Install the external module(s).
89 Installation default is in /lib/modules/<kernel-version>/extra, 90 Installation default is in /lib/modules/<kernel-version>/extra,
90 but may be prefixed with INSTALL_MOD_PATH - see separate chater. 91 but may be prefixed with INSTALL_MOD_PATH - see separate chapter.
91 92
92 make -C $KDIR M=$PWD clean 93 make -C $KDIR M=$PWD clean
93 Remove all generated files for the module - the kernel 94 Remove all generated files for the module - the kernel
94 source directory is not moddified. 95 source directory is not modified.
95 96
96 make -C $KDIR M=`pwd` help 97 make -C $KDIR M=`pwd` help
97 help will list the available target when building external 98 help will list the available target when building external
@@ -99,7 +100,7 @@ when building an external module.
99 100
100--- 2.3 Available options: 101--- 2.3 Available options:
101 102
102 $KDIR refer to path to kernel src 103 $KDIR refers to the path to the kernel source top-level directory
103 104
104 make -C $KDIR 105 make -C $KDIR
105 Used to specify where to find the kernel source. 106 Used to specify where to find the kernel source.
@@ -206,11 +207,11 @@ following files:
206 207
207 KERNELDIR := /lib/modules/`uname -r`/build 208 KERNELDIR := /lib/modules/`uname -r`/build
208 all:: 209 all::
209 $(MAKE) -C $KERNELDIR M=`pwd` $@ 210 $(MAKE) -C $(KERNELDIR) M=`pwd` $@
210 211
211 # Module specific targets 212 # Module specific targets
212 genbin: 213 genbin:
213 echo "X" > 8123_bini.o_shipped 214 echo "X" > 8123_bin.o_shipped
214 215
215 endif 216 endif
216 217
@@ -341,13 +342,52 @@ directory and therefore needs to deal with this in their kbuild file.
341 EXTRA_CFLAGS := -Iinclude 342 EXTRA_CFLAGS := -Iinclude
342 8123-y := 8123_if.o 8123_pci.o 8123_bin.o 343 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
343 344
344 Note that in the assingment there is no space between -I and the path. 345 Note that in the assignment there is no space between -I and the path.
345 This is a kbuild limitation and no space must be present. 346 This is a kbuild limitation: there must be no space present.
346 347
348--- 5.3 External modules using several directories
349
350 If an external module does not follow the usual kernel style but
351 decide to spread files over several directories then kbuild can
352 support this too.
353
354 Consider the following example:
355
356 |
357 +- src/complex_main.c
358 | +- hal/hardwareif.c
359 | +- hal/include/hardwareif.h
360 +- include/complex.h
361
362 To build a single module named complex.ko we then need the following
363 kbuild file:
364
365 Kbuild:
366 obj-m := complex.o
367 complex-y := src/complex_main.o
368 complex-y += src/hal/hardwareif.o
369
370 EXTRA_CFLAGS := -I$(src)/include
371 EXTRA_CFLAGS += -I$(src)src/hal/include
372
373
374 kbuild knows how to handle .o files located in another directory -
375 although this is NOT reccommended practice. The syntax is to specify
376 the directory relative to the directory where the Kbuild file is
377 located.
378
379 To find the .h files we have to explicitly tell kbuild where to look
380 for the .h files. When kbuild executes current directory is always
381 the root of the kernel tree (argument to -C) and therefore we have to
382 tell kbuild how to find the .h files using absolute paths.
383 $(src) will specify the absolute path to the directory where the
384 Kbuild file are located when being build as an external module.
385 Therefore -I$(src)/ is used to point out the directory of the Kbuild
386 file and any additional path are just appended.
347 387
348=== 6. Module installation 388=== 6. Module installation
349 389
350Modules which are included in the kernel is installed in the directory: 390Modules which are included in the kernel are installed in the directory:
351 391
352 /lib/modules/$(KERNELRELEASE)/kernel 392 /lib/modules/$(KERNELRELEASE)/kernel
353 393
@@ -365,7 +405,7 @@ External modules are installed in the directory:
365 => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel 405 => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel
366 406
367 INSTALL_MOD_PATH may be set as an ordinary shell variable or as in the 407 INSTALL_MOD_PATH may be set as an ordinary shell variable or as in the
368 example above be specified on the commandline when calling make. 408 example above be specified on the command line when calling make.
369 INSTALL_MOD_PATH has effect both when installing modules included in 409 INSTALL_MOD_PATH has effect both when installing modules included in
370 the kernel as well as when installing external modules. 410 the kernel as well as when installing external modules.
371 411
@@ -384,7 +424,7 @@ External modules are installed in the directory:
384 424
385=== 7. Module versioning 425=== 7. Module versioning
386 426
387Module versioning are enabled by the CONFIG_MODVERSIONS tag. 427Module versioning is enabled by the CONFIG_MODVERSIONS tag.
388 428
389Module versioning is used as a simple ABI consistency check. The Module 429Module versioning is used as a simple ABI consistency check. The Module
390versioning creates a CRC value of the full prototype for an exported symbol and 430versioning creates a CRC value of the full prototype for an exported symbol and
diff --git a/Documentation/kdump/gdbmacros.txt b/Documentation/kdump/gdbmacros.txt
index bc1b9eb92ae1..dcf5580380ab 100644
--- a/Documentation/kdump/gdbmacros.txt
+++ b/Documentation/kdump/gdbmacros.txt
@@ -177,3 +177,25 @@ document trapinfo
177 'trapinfo <pid>' will tell you by which trap & possibly 177 'trapinfo <pid>' will tell you by which trap & possibly
178 addresthe kernel paniced. 178 addresthe kernel paniced.
179end 179end
180
181
182define dmesg
183 set $i = 0
184 set $end_idx = (log_end - 1) & (log_buf_len - 1)
185
186 while ($i < logged_chars)
187 set $idx = (log_end - 1 - logged_chars + $i) & (log_buf_len - 1)
188
189 if ($idx + 100 <= $end_idx) || \
190 ($end_idx <= $idx && $idx + 100 < log_buf_len)
191 printf "%.100s", &log_buf[$idx]
192 set $i = $i + 100
193 else
194 printf "%c", log_buf[$idx]
195 set $i = $i + 1
196 end
197 end
198end
199document dmesg
200 print the kernel ring buffer
201end
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 5f08f9ce6046..212cf3c21abf 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -4,10 +4,10 @@ Documentation for kdump - the kexec-based crash dumping solution
4DESIGN 4DESIGN
5====== 5======
6 6
7Kdump uses kexec to reboot to a second kernel whenever a dump needs to be taken. 7Kdump uses kexec to reboot to a second kernel whenever a dump needs to be
8This second kernel is booted with very little memory. The first kernel reserves 8taken. This second kernel is booted with very little memory. The first kernel
9the section of memory that the second kernel uses. This ensures that on-going 9reserves the section of memory that the second kernel uses. This ensures that
10DMA from the first kernel does not corrupt the second kernel. 10on-going DMA from the first kernel does not corrupt the second kernel.
11 11
12All the necessary information about Core image is encoded in ELF format and 12All the necessary information about Core image is encoded in ELF format and
13stored in reserved area of memory before crash. Physical address of start of 13stored in reserved area of memory before crash. Physical address of start of
@@ -35,77 +35,82 @@ In the second kernel, "old memory" can be accessed in two ways.
35SETUP 35SETUP
36===== 36=====
37 37
381) Download http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-1.101.tar.gz 381) Download the upstream kexec-tools userspace package from
39 and apply http://lse.sourceforge.net/kdump/patches/kexec-tools-1.101-kdump.patch 39 http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-1.101.tar.gz.
40 and after that build the source.
41 40
422) Download and build the appropriate (2.6.13-rc1 onwards) vanilla kernel. 41 Apply the latest consolidated kdump patch on top of kexec-tools-1.101
42 from http://lse.sourceforge.net/kdump/. This arrangment has been made
43 till all the userspace patches supporting kdump are integrated with
44 upstream kexec-tools userspace.
43 45
462) Download and build the appropriate (2.6.13-rc1 onwards) vanilla kernels.
44 Two kernels need to be built in order to get this feature working. 47 Two kernels need to be built in order to get this feature working.
48 Following are the steps to properly configure the two kernels specific
49 to kexec and kdump features:
45 50
46 A) First kernel: 51 A) First kernel or regular kernel:
52 ----------------------------------
47 a) Enable "kexec system call" feature (in Processor type and features). 53 a) Enable "kexec system call" feature (in Processor type and features).
48 CONFIG_KEXEC=y 54 CONFIG_KEXEC=y
49 b) This kernel's physical load address should be the default value of 55 b) Enable "sysfs file system support" (in Pseudo filesystems).
50 0x100000 (0x100000, 1 MB) (in Processor type and features). 56 CONFIG_SYSFS=y
51 CONFIG_PHYSICAL_START=0x100000 57 c) make
52 c) Enable "sysfs file system support" (in Pseudo filesystems).
53 CONFIG_SYSFS=y
54 d) Boot into first kernel with the command line parameter "crashkernel=Y@X". 58 d) Boot into first kernel with the command line parameter "crashkernel=Y@X".
55 Use appropriate values for X and Y. Y denotes how much memory to reserve 59 Use appropriate values for X and Y. Y denotes how much memory to reserve
56 for the second kernel, and X denotes at what physical address the reserved 60 for the second kernel, and X denotes at what physical address the
57 memory section starts. For example: "crashkernel=64M@16M". 61 reserved memory section starts. For example: "crashkernel=64M@16M".
58 62
59 B) Second kernel: 63
60 a) Enable "kernel crash dumps" feature (in Processor type and features). 64 B) Second kernel or dump capture kernel:
61 CONFIG_CRASH_DUMP=y 65 ---------------------------------------
62 b) Specify a suitable value for "Physical address where the kernel is 66 a) For i386 architecture enable Highmem support
63 loaded" (in Processor type and features). Typically this value 67 CONFIG_HIGHMEM=y
64 should be same as X (See option d) above, e.g., 16 MB or 0x1000000. 68 b) Enable "kernel crash dumps" feature (under "Processor type and features")
65 CONFIG_PHYSICAL_START=0x1000000 69 CONFIG_CRASH_DUMP=y
66 c) Enable "/proc/vmcore support" (Optional, in Pseudo filesystems). 70 c) Make sure a suitable value for "Physical address where the kernel is
67 CONFIG_PROC_VMCORE=y 71 loaded" (under "Processor type and features"). By default this value
68 d) Disable SMP support and build a UP kernel (Until it is fixed). 72 is 0x1000000 (16MB) and it should be same as X (See option d above),
69 CONFIG_SMP=n 73 e.g., 16 MB or 0x1000000.
70 e) Enable "Local APIC support on uniprocessors". 74 CONFIG_PHYSICAL_START=0x1000000
71 CONFIG_X86_UP_APIC=y 75 d) Enable "/proc/vmcore support" (Optional, under "Pseudo filesystems").
72 f) Enable "IO-APIC support on uniprocessors" 76 CONFIG_PROC_VMCORE=y
73 CONFIG_X86_UP_IOAPIC=y 77
74 783) After booting to regular kernel or first kernel, load the second kernel
75 Note: i) Options a) and b) depend upon "Configure standard kernel features 79 using the following command:
76 (for small systems)" (under General setup).
77 ii) Option a) also depends on CONFIG_HIGHMEM (under Processor
78 type and features).
79 iii) Both option a) and b) are under "Processor type and features".
80
813) Boot into the first kernel. You are now ready to try out kexec-based crash
82 dumps.
83
844) Load the second kernel to be booted using:
85 80
86 kexec -p <second-kernel> --args-linux --elf32-core-headers 81 kexec -p <second-kernel> --args-linux --elf32-core-headers
87 --append="root=<root-dev> init 1 irqpoll" 82 --append="root=<root-dev> init 1 irqpoll maxcpus=1"
88 83
89 Note: i) <second-kernel> has to be a vmlinux image. bzImage will not work, 84 Notes:
90 as of now. 85 ======
91 ii) By default ELF headers are stored in ELF64 format. Option 86 i) <second-kernel> has to be a vmlinux image ie uncompressed elf image.
92 --elf32-core-headers forces generation of ELF32 headers. gdb can 87 bzImage will not work, as of now.
93 not open ELF64 headers on 32 bit systems. So creating ELF32 88 ii) --args-linux has to be speicfied as if kexec it loading an elf image,
94 headers can come handy for users who have got non-PAE systems and 89 it needs to know that the arguments supplied are of linux type.
95 hence have memory less than 4GB. 90 iii) By default ELF headers are stored in ELF64 format to support systems
96 iii) Specify "irqpoll" as command line parameter. This reduces driver 91 with more than 4GB memory. Option --elf32-core-headers forces generation
97 initialization failures in second kernel due to shared interrupts. 92 of ELF32 headers. The reason for this option being, as of now gdb can
98 iv) <root-dev> needs to be specified in a format corresponding to 93 not open vmcore file with ELF64 headers on a 32 bit systems. So ELF32
99 the root device name in the output of mount command. 94 headers can be used if one has non-PAE systems and hence memory less
100 v) If you have built the drivers required to mount root file 95 than 4GB.
101 system as modules in <second-kernel>, then, specify 96 iv) Specify "irqpoll" as command line parameter. This reduces driver
102 --initrd=<initrd-for-second-kernel>. 97 initialization failures in second kernel due to shared interrupts.
103 98 v) <root-dev> needs to be specified in a format corresponding to the root
1045) System reboots into the second kernel when a panic occurs. A module can be 99 device name in the output of mount command.
105 written to force the panic or "ALT-SysRq-c" can be used initiate a crash 100 vi) If you have built the drivers required to mount root file system as
106 dump for testing purposes. 101 modules in <second-kernel>, then, specify
107 102 --initrd=<initrd-for-second-kernel>.
1086) Write out the dump file using 103 vii) Specify maxcpus=1 as, if during first kernel run, if panic happens on
104 non-boot cpus, second kernel doesn't seem to be boot up all the cpus.
105 The other option is to always built the second kernel without SMP
106 support ie CONFIG_SMP=n
107
1084) After successfully loading the second kernel as above, if a panic occurs
109 system reboots into the second kernel. A module can be written to force
110 the panic or "ALT-SysRq-c" can be used initiate a crash dump for testing
111 purposes.
112
1135) Once the second kernel has booted, write out the dump file using
109 114
110 cp /proc/vmcore <dump-file> 115 cp /proc/vmcore <dump-file>
111 116
@@ -119,9 +124,9 @@ SETUP
119 124
120 Entire memory: dd if=/dev/oldmem of=oldmem.001 125 Entire memory: dd if=/dev/oldmem of=oldmem.001
121 126
127
122ANALYSIS 128ANALYSIS
123======== 129========
124
125Limited analysis can be done using gdb on the dump file copied out of 130Limited analysis can be done using gdb on the dump file copied out of
126/proc/vmcore. Use vmlinux built with -g and run 131/proc/vmcore. Use vmlinux built with -g and run
127 132
@@ -132,15 +137,19 @@ work fine.
132 137
133Note: gdb cannot analyse core files generated in ELF64 format for i386. 138Note: gdb cannot analyse core files generated in ELF64 format for i386.
134 139
140Latest "crash" (crash-4.0-2.18) as available on Dave Anderson's site
141http://people.redhat.com/~anderson/ works well with kdump format.
142
143
135TODO 144TODO
136==== 145====
137
1381) Provide a kernel pages filtering mechanism so that core file size is not 1461) Provide a kernel pages filtering mechanism so that core file size is not
139 insane on systems having huge memory banks. 147 insane on systems having huge memory banks.
1402) Modify "crash" tool to make it recognize this dump. 1482) Relocatable kernel can help in maintaining multiple kernels for crashdump
149 and same kernel as the first kernel can be used to capture the dump.
150
141 151
142CONTACT 152CONTACT
143======= 153=======
144
145Vivek Goyal (vgoyal@in.ibm.com) 154Vivek Goyal (vgoyal@in.ibm.com)
146Maneesh Soni (maneesh@in.ibm.com) 155Maneesh Soni (maneesh@in.ibm.com)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 5dffcfefc3c7..84370363da80 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -452,6 +452,11 @@ running once the system is up.
452 452
453 eata= [HW,SCSI] 453 eata= [HW,SCSI]
454 454
455 ec_intr= [HW,ACPI] ACPI Embedded Controller interrupt mode
456 Format: <int>
457 0: polling mode
458 non-0: interrupt mode (default)
459
455 eda= [HW,PS2] 460 eda= [HW,PS2]
456 461
457 edb= [HW,PS2] 462 edb= [HW,PS2]
@@ -471,14 +476,15 @@ running once the system is up.
471 arch/i386/kernel/cpu/cpufreq/elanfreq.c. 476 arch/i386/kernel/cpu/cpufreq/elanfreq.c.
472 477
473 elevator= [IOSCHED] 478 elevator= [IOSCHED]
474 Format: {"as" | "cfq" | "deadline" | "noop"} 479 Format: {"anticipatory" | "cfq" | "deadline" | "noop"}
475 See Documentation/block/as-iosched.txt and 480 See Documentation/block/as-iosched.txt and
476 Documentation/block/deadline-iosched.txt for details. 481 Documentation/block/deadline-iosched.txt for details.
477 482
478 elfcorehdr= [IA-32] 483 elfcorehdr= [IA-32, X86_64]
479 Specifies physical address of start of kernel core 484 Specifies physical address of start of kernel core
480 image elf header. 485 image elf header. Generally kexec loader will
481 See Documentation/kdump.txt for details. 486 pass this option to capture kernel.
487 See Documentation/kdump/kdump.txt for details.
482 488
483 enforcing [SELINUX] Set initial enforcing status. 489 enforcing [SELINUX] Set initial enforcing status.
484 Format: {"0" | "1"} 490 Format: {"0" | "1"}
@@ -633,6 +639,14 @@ running once the system is up.
633 inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver 639 inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver
634 Format: <irq> 640 Format: <irq>
635 641
642 combined_mode= [HW] control which driver uses IDE ports in combined
643 mode: legacy IDE driver, libata, or both
644 (in the libata case, libata.atapi_enabled=1 may be
645 useful as well). Note that using the ide or libata
646 options may affect your device naming (e.g. by
647 changing hdc to sdb).
648 Format: combined (default), ide, or libata
649
636 inttest= [IA64] 650 inttest= [IA64]
637 651
638 io7= [HW] IO7 for Marvel based alpha systems 652 io7= [HW] IO7 for Marvel based alpha systems
@@ -703,9 +717,17 @@ running once the system is up.
703 load_ramdisk= [RAM] List of ramdisks to load from floppy 717 load_ramdisk= [RAM] List of ramdisks to load from floppy
704 See Documentation/ramdisk.txt. 718 See Documentation/ramdisk.txt.
705 719
706 lockd.udpport= [NFS] 720 lockd.nlm_grace_period=P [NFS] Assign grace period.
721 Format: <integer>
722
723 lockd.nlm_tcpport=N [NFS] Assign TCP port.
724 Format: <integer>
725
726 lockd.nlm_timeout=T [NFS] Assign timeout value.
727 Format: <integer>
707 728
708 lockd.tcpport= [NFS] 729 lockd.nlm_udpport=M [NFS] Assign UDP port.
730 Format: <integer>
709 731
710 logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver 732 logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver
711 Format: <irq> 733 Format: <irq>
@@ -824,7 +846,7 @@ running once the system is up.
824 mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel 846 mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel
825 memory. 847 memory.
826 848
827 memmap=exactmap [KNL,IA-32] Enable setting of an exact 849 memmap=exactmap [KNL,IA-32,X86_64] Enable setting of an exact
828 E820 memory map, as specified by the user. 850 E820 memory map, as specified by the user.
829 Such memmap=exactmap lines can be constructed based on 851 Such memmap=exactmap lines can be constructed based on
830 BIOS output or other requirements. See the memmap=nn@ss 852 BIOS output or other requirements. See the memmap=nn@ss
@@ -847,6 +869,49 @@ running once the system is up.
847 869
848 mga= [HW,DRM] 870 mga= [HW,DRM]
849 871
872 migration_cost=
873 [KNL,SMP] debug: override scheduler migration costs
874 Format: <level-1-usecs>,<level-2-usecs>,...
875 This debugging option can be used to override the
876 default scheduler migration cost matrix. The numbers
877 are indexed by 'CPU domain distance'.
878 E.g. migration_cost=1000,2000,3000 on an SMT NUMA
879 box will set up an intra-core migration cost of
880 1 msec, an inter-core migration cost of 2 msecs,
881 and an inter-node migration cost of 3 msecs.
882
883 WARNING: using the wrong values here can break
884 scheduler performance, so it's only for scheduler
885 development purposes, not production environments.
886
887 migration_debug=
888 [KNL,SMP] migration cost auto-detect verbosity
889 Format=<0|1|2>
890 If a system's migration matrix reported at bootup
891 seems erroneous then this option can be used to
892 increase verbosity of the detection process.
893 We default to 0 (no extra messages), 1 will print
894 some more information, and 2 will be really
895 verbose (probably only useful if you also have a
896 serial console attached to the system).
897
898 migration_factor=
899 [KNL,SMP] multiply/divide migration costs by a factor
900 Format=<percent>
901 This debug option can be used to proportionally
902 increase or decrease the auto-detected migration
903 costs for all entries of the migration matrix.
904 E.g. migration_factor=150 will increase migration
905 costs by 50%. (and thus the scheduler will be less
906 eager migrating cache-hot tasks)
907 migration_factor=80 will decrease migration costs
908 by 20%. (thus the scheduler will be more eager to
909 migrate tasks)
910
911 WARNING: using the wrong values here can break
912 scheduler performance, so it's only for scheduler
913 development purposes, not production environments.
914
850 mousedev.tap_time= 915 mousedev.tap_time=
851 [MOUSE] Maximum time between finger touching and 916 [MOUSE] Maximum time between finger touching and
852 leaving touchpad surface for touch to be considered 917 leaving touchpad surface for touch to be considered
@@ -902,6 +967,14 @@ running once the system is up.
902 nfsroot= [NFS] nfs root filesystem for disk-less boxes. 967 nfsroot= [NFS] nfs root filesystem for disk-less boxes.
903 See Documentation/nfsroot.txt. 968 See Documentation/nfsroot.txt.
904 969
970 nfs.callback_tcpport=
971 [NFS] set the TCP port on which the NFSv4 callback
972 channel should listen.
973
974 nfs.idmap_cache_timeout=
975 [NFS] set the maximum lifetime for idmapper cache
976 entries.
977
905 nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels 978 nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels
906 979
907 no387 [BUGS=IA-32] Tells the kernel to use the 387 maths 980 no387 [BUGS=IA-32] Tells the kernel to use the 387 maths
@@ -982,6 +1055,8 @@ running once the system is up.
982 1055
983 nowb [ARM] 1056 nowb [ARM]
984 1057
1058 nr_uarts= [SERIAL] maximum number of UARTs to be registered.
1059
985 opl3= [HW,OSS] 1060 opl3= [HW,OSS]
986 Format: <io> 1061 Format: <io>
987 1062
@@ -1160,6 +1235,10 @@ running once the system is up.
1160 Limit processor to maximum C-state 1235 Limit processor to maximum C-state
1161 max_cstate=9 overrides any DMI blacklist limit. 1236 max_cstate=9 overrides any DMI blacklist limit.
1162 1237
1238 processor.nocst [HW,ACPI]
1239 Ignore the _CST method to determine C-states,
1240 instead using the legacy FADT method
1241
1163 prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk 1242 prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk
1164 before loading. 1243 before loading.
1165 See Documentation/ramdisk.txt. 1244 See Documentation/ramdisk.txt.
diff --git a/Documentation/keys-request-key.txt b/Documentation/keys-request-key.txt
index 5f2b9c5edbb5..22488d791168 100644
--- a/Documentation/keys-request-key.txt
+++ b/Documentation/keys-request-key.txt
@@ -56,10 +56,12 @@ A request proceeds in the following manner:
56 (4) request_key() then forks and executes /sbin/request-key with a new session 56 (4) request_key() then forks and executes /sbin/request-key with a new session
57 keyring that contains a link to auth key V. 57 keyring that contains a link to auth key V.
58 58
59 (5) /sbin/request-key execs an appropriate program to perform the actual 59 (5) /sbin/request-key assumes the authority associated with key U.
60
61 (6) /sbin/request-key execs an appropriate program to perform the actual
60 instantiation. 62 instantiation.
61 63
62 (6) The program may want to access another key from A's context (say a 64 (7) The program may want to access another key from A's context (say a
63 Kerberos TGT key). It just requests the appropriate key, and the keyring 65 Kerberos TGT key). It just requests the appropriate key, and the keyring
64 search notes that the session keyring has auth key V in its bottom level. 66 search notes that the session keyring has auth key V in its bottom level.
65 67
@@ -67,19 +69,19 @@ A request proceeds in the following manner:
67 UID, GID, groups and security info of process A as if it was process A, 69 UID, GID, groups and security info of process A as if it was process A,
68 and come up with key W. 70 and come up with key W.
69 71
70 (7) The program then does what it must to get the data with which to 72 (8) The program then does what it must to get the data with which to
71 instantiate key U, using key W as a reference (perhaps it contacts a 73 instantiate key U, using key W as a reference (perhaps it contacts a
72 Kerberos server using the TGT) and then instantiates key U. 74 Kerberos server using the TGT) and then instantiates key U.
73 75
74 (8) Upon instantiating key U, auth key V is automatically revoked so that it 76 (9) Upon instantiating key U, auth key V is automatically revoked so that it
75 may not be used again. 77 may not be used again.
76 78
77 (9) The program then exits 0 and request_key() deletes key V and returns key 79(10) The program then exits 0 and request_key() deletes key V and returns key
78 U to the caller. 80 U to the caller.
79 81
80This also extends further. If key W (step 5 above) didn't exist, key W would be 82This also extends further. If key W (step 7 above) didn't exist, key W would be
81created uninstantiated, another auth key (X) would be created [as per step 3] 83created uninstantiated, another auth key (X) would be created (as per step 3)
82and another copy of /sbin/request-key spawned [as per step 4]; but the context 84and another copy of /sbin/request-key spawned (as per step 4); but the context
83specified by auth key X will still be process A, as it was in auth key V. 85specified by auth key X will still be process A, as it was in auth key V.
84 86
85This is because process A's keyrings can't simply be attached to 87This is because process A's keyrings can't simply be attached to
@@ -138,8 +140,8 @@ until one succeeds:
138 140
139 (3) The process's session keyring is searched. 141 (3) The process's session keyring is searched.
140 142
141 (4) If the process has a request_key() authorisation key in its session 143 (4) If the process has assumed the authority associated with a request_key()
142 keyring then: 144 authorisation key then:
143 145
144 (a) If extant, the calling process's thread keyring is searched. 146 (a) If extant, the calling process's thread keyring is searched.
145 147
diff --git a/Documentation/keys.txt b/Documentation/keys.txt
index 31154882000a..aaa01b0e3ee9 100644
--- a/Documentation/keys.txt
+++ b/Documentation/keys.txt
@@ -308,6 +308,8 @@ process making the call:
308 KEY_SPEC_USER_KEYRING -4 UID-specific keyring 308 KEY_SPEC_USER_KEYRING -4 UID-specific keyring
309 KEY_SPEC_USER_SESSION_KEYRING -5 UID-session keyring 309 KEY_SPEC_USER_SESSION_KEYRING -5 UID-session keyring
310 KEY_SPEC_GROUP_KEYRING -6 GID-specific keyring 310 KEY_SPEC_GROUP_KEYRING -6 GID-specific keyring
311 KEY_SPEC_REQKEY_AUTH_KEY -7 assumed request_key()
312 authorisation key
311 313
312 314
313The main syscalls are: 315The main syscalls are:
@@ -498,7 +500,11 @@ The keyctl syscall functions are:
498 keyring is full, error ENFILE will result. 500 keyring is full, error ENFILE will result.
499 501
500 The link procedure checks the nesting of the keyrings, returning ELOOP if 502 The link procedure checks the nesting of the keyrings, returning ELOOP if
501 it appears to deep or EDEADLK if the link would introduce a cycle. 503 it appears too deep or EDEADLK if the link would introduce a cycle.
504
505 Any links within the keyring to keys that match the new key in terms of
506 type and description will be discarded from the keyring as the new one is
507 added.
502 508
503 509
504 (*) Unlink a key or keyring from another keyring: 510 (*) Unlink a key or keyring from another keyring:
@@ -628,6 +634,41 @@ The keyctl syscall functions are:
628 there is one, otherwise the user default session keyring. 634 there is one, otherwise the user default session keyring.
629 635
630 636
637 (*) Set the timeout on a key.
638
639 long keyctl(KEYCTL_SET_TIMEOUT, key_serial_t key, unsigned timeout);
640
641 This sets or clears the timeout on a key. The timeout can be 0 to clear
642 the timeout or a number of seconds to set the expiry time that far into
643 the future.
644
645 The process must have attribute modification access on a key to set its
646 timeout. Timeouts may not be set with this function on negative, revoked
647 or expired keys.
648
649
650 (*) Assume the authority granted to instantiate a key
651
652 long keyctl(KEYCTL_ASSUME_AUTHORITY, key_serial_t key);
653
654 This assumes or divests the authority required to instantiate the
655 specified key. Authority can only be assumed if the thread has the
656 authorisation key associated with the specified key in its keyrings
657 somewhere.
658
659 Once authority is assumed, searches for keys will also search the
660 requester's keyrings using the requester's security label, UID, GID and
661 groups.
662
663 If the requested authority is unavailable, error EPERM will be returned,
664 likewise if the authority has been revoked because the target key is
665 already instantiated.
666
667 If the specified key is 0, then any assumed authority will be divested.
668
669 The assumed authorititive key is inherited across fork and exec.
670
671
631=============== 672===============
632KERNEL SERVICES 673KERNEL SERVICES
633=============== 674===============
@@ -860,24 +901,6 @@ The structure has a number of fields, some of which are mandatory:
860 It is safe to sleep in this method. 901 It is safe to sleep in this method.
861 902
862 903
863 (*) int (*duplicate)(struct key *key, const struct key *source);
864
865 If this type of key can be duplicated, then this method should be
866 provided. It is called to copy the payload attached to the source into the
867 new key. The data length on the new key will have been updated and the
868 quota adjusted already.
869
870 This method will be called with the source key's semaphore read-locked to
871 prevent its payload from being changed, thus RCU constraints need not be
872 applied to the source key.
873
874 This method does not have to lock the destination key in order to attach a
875 payload. The fact that KEY_FLAG_INSTANTIATED is not set in key->flags
876 prevents anything else from gaining access to the key.
877
878 It is safe to sleep in this method.
879
880
881 (*) int (*update)(struct key *key, const void *data, size_t datalen); 904 (*) int (*update)(struct key *key, const void *data, size_t datalen);
882 905
883 If this type of key can be updated, then this method should be provided. 906 If this type of key can be updated, then this method should be provided.
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 0541fe1de704..0ea5a0c6e827 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -411,7 +411,8 @@ int init_module(void)
411 printk("Couldn't find %s to plant kprobe\n", "do_fork"); 411 printk("Couldn't find %s to plant kprobe\n", "do_fork");
412 return -1; 412 return -1;
413 } 413 }
414 if ((ret = register_kprobe(&kp) < 0)) { 414 ret = register_kprobe(&kp);
415 if (ret < 0) {
415 printk("register_kprobe failed, returned %d\n", ret); 416 printk("register_kprobe failed, returned %d\n", ret);
416 return -1; 417 return -1;
417 } 418 }
diff --git a/Documentation/laptop-mode.txt b/Documentation/laptop-mode.txt
index dc4e810afdcd..b18e21675906 100644
--- a/Documentation/laptop-mode.txt
+++ b/Documentation/laptop-mode.txt
@@ -3,7 +3,7 @@ How to conserve battery power using laptop-mode
3 3
4Document Author: Bart Samwel (bart@samwel.tk) 4Document Author: Bart Samwel (bart@samwel.tk)
5Date created: January 2, 2004 5Date created: January 2, 2004
6Last modified: July 10, 2004 6Last modified: December 06, 2004
7 7
8Introduction 8Introduction
9------------ 9------------
@@ -33,7 +33,7 @@ or anything. Simply install all the files included in this document, and
33laptop mode will automatically be started when you're on battery. For 33laptop mode will automatically be started when you're on battery. For
34your convenience, a tarball containing an installer can be downloaded at: 34your convenience, a tarball containing an installer can be downloaded at:
35 35
36http://www.xs4all.nl/~bsamwel/laptop_mode/tools 36http://www.xs4all.nl/~bsamwel/laptop_mode/tools/
37 37
38To configure laptop mode, you need to edit the configuration file, which is 38To configure laptop mode, you need to edit the configuration file, which is
39located in /etc/default/laptop-mode on Debian-based systems, or in 39located in /etc/default/laptop-mode on Debian-based systems, or in
@@ -357,7 +357,7 @@ MAX_AGE=${MAX_AGE:-'600'}
357# Read-ahead, in kilobytes 357# Read-ahead, in kilobytes
358READAHEAD=${READAHEAD:-'4096'} 358READAHEAD=${READAHEAD:-'4096'}
359 359
360# Shall we remount journaled fs. with appropiate commit interval? (1=yes) 360# Shall we remount journaled fs. with appropriate commit interval? (1=yes)
361DO_REMOUNTS=${DO_REMOUNTS:-'1'} 361DO_REMOUNTS=${DO_REMOUNTS:-'1'}
362 362
363# And shall we add the "noatime" option to that as well? (1=yes) 363# And shall we add the "noatime" option to that as well? (1=yes)
@@ -912,7 +912,7 @@ void usage()
912 exit(0); 912 exit(0);
913} 913}
914 914
915int main(int ac, char **av) 915int main(int argc, char **argv)
916{ 916{
917 int fd; 917 int fd;
918 char *disk = 0; 918 char *disk = 0;
diff --git a/Documentation/locks.txt b/Documentation/locks.txt
index ce1be79edfb8..e3b402ef33bd 100644
--- a/Documentation/locks.txt
+++ b/Documentation/locks.txt
@@ -65,20 +65,3 @@ The default is to disallow mandatory locking. The intention is that
65mandatory locking only be enabled on a local filesystem as the specific need 65mandatory locking only be enabled on a local filesystem as the specific need
66arises. 66arises.
67 67
68Until an updated version of mount(8) becomes available you may have to apply
69this patch to the mount sources (based on the version distributed with Rick
70Faith's util-linux-2.5 package):
71
72*** mount.c.orig Sat Jun 8 09:14:31 1996
73--- mount.c Sat Jun 8 09:13:02 1996
74***************
75*** 100,105 ****
76--- 100,107 ----
77 { "noauto", 0, MS_NOAUTO }, /* Can only be mounted explicitly */
78 { "user", 0, MS_USER }, /* Allow ordinary user to mount */
79 { "nouser", 1, MS_USER }, /* Forbid ordinary user to mount */
80+ { "mand", 0, MS_MANDLOCK }, /* Allow mandatory locks on this FS */
81+ { "nomand", 1, MS_MANDLOCK }, /* Forbid mandatory locks on this FS */
82 /* add new options here */
83 #ifdef MS_NOSUB
84 { "sub", 1, MS_NOSUB }, /* allow submounts */
diff --git a/Documentation/md.txt b/Documentation/md.txt
index 23e6cce40f9c..03a13c462cf2 100644
--- a/Documentation/md.txt
+++ b/Documentation/md.txt
@@ -51,6 +51,30 @@ superblock can be autodetected and run at boot time.
51The kernel parameter "raid=partitionable" (or "raid=part") means 51The kernel parameter "raid=partitionable" (or "raid=part") means
52that all auto-detected arrays are assembled as partitionable. 52that all auto-detected arrays are assembled as partitionable.
53 53
54Boot time assembly of degraded/dirty arrays
55-------------------------------------------
56
57If a raid5 or raid6 array is both dirty and degraded, it could have
58undetectable data corruption. This is because the fact that it is
59'dirty' means that the parity cannot be trusted, and the fact that it
60is degraded means that some datablocks are missing and cannot reliably
61be reconstructed (due to no parity).
62
63For this reason, md will normally refuse to start such an array. This
64requires the sysadmin to take action to explicitly start the array
65desipite possible corruption. This is normally done with
66 mdadm --assemble --force ....
67
68This option is not really available if the array has the root
69filesystem on it. In order to support this booting from such an
70array, md supports a module parameter "start_dirty_degraded" which,
71when set to 1, bypassed the checks and will allows dirty degraded
72arrays to be started.
73
74So, to boot with a root filesystem of a dirty degraded raid[56], use
75
76 md-mod.start_dirty_degraded=1
77
54 78
55Superblock formats 79Superblock formats
56------------------ 80------------------
@@ -141,6 +165,70 @@ All md devices contain:
141 in a fully functional array. If this is not yet known, the file 165 in a fully functional array. If this is not yet known, the file
142 will be empty. If an array is being resized (not currently 166 will be empty. If an array is being resized (not currently
143 possible) this will contain the larger of the old and new sizes. 167 possible) this will contain the larger of the old and new sizes.
168 Some raid level (RAID1) allow this value to be set while the
169 array is active. This will reconfigure the array. Otherwise
170 it can only be set while assembling an array.
171
172 chunk_size
173 This is the size if bytes for 'chunks' and is only relevant to
174 raid levels that involve striping (1,4,5,6,10). The address space
175 of the array is conceptually divided into chunks and consecutive
176 chunks are striped onto neighbouring devices.
177 The size should be atleast PAGE_SIZE (4k) and should be a power
178 of 2. This can only be set while assembling an array
179
180 component_size
181 For arrays with data redundancy (i.e. not raid0, linear, faulty,
182 multipath), all components must be the same size - or at least
183 there must a size that they all provide space for. This is a key
184 part or the geometry of the array. It is measured in sectors
185 and can be read from here. Writing to this value may resize
186 the array if the personality supports it (raid1, raid5, raid6),
187 and if the component drives are large enough.
188
189 metadata_version
190 This indicates the format that is being used to record metadata
191 about the array. It can be 0.90 (traditional format), 1.0, 1.1,
192 1.2 (newer format in varying locations) or "none" indicating that
193 the kernel isn't managing metadata at all.
194
195 level
196 The raid 'level' for this array. The name will often (but not
197 always) be the same as the name of the module that implements the
198 level. To be auto-loaded the module must have an alias
199 md-$LEVEL e.g. md-raid5
200 This can be written only while the array is being assembled, not
201 after it is started.
202
203 new_dev
204 This file can be written but not read. The value written should
205 be a block device number as major:minor. e.g. 8:0
206 This will cause that device to be attached to the array, if it is
207 available. It will then appear at md/dev-XXX (depending on the
208 name of the device) and further configuration is then possible.
209
210 sync_speed_min
211 sync_speed_max
212 This are similar to /proc/sys/dev/raid/speed_limit_{min,max}
213 however they only apply to the particular array.
214 If no value has been written to these, of if the word 'system'
215 is written, then the system-wide value is used. If a value,
216 in kibibytes-per-second is written, then it is used.
217 When the files are read, they show the currently active value
218 followed by "(local)" or "(system)" depending on whether it is
219 a locally set or system-wide value.
220
221 sync_completed
222 This shows the number of sectors that have been completed of
223 whatever the current sync_action is, followed by the number of
224 sectors in total that could need to be processed. The two
225 numbers are separated by a '/' thus effectively showing one
226 value, a fraction of the process that is complete.
227
228 sync_speed
229 This shows the current actual speed, in K/sec, of the current
230 sync_action. It is averaged over the last 30 seconds.
231
144 232
145As component devices are added to an md array, they appear in the 'md' 233As component devices are added to an md array, they appear in the 'md'
146directory as new directories named 234directory as new directories named
@@ -167,6 +255,38 @@ Each directory contains:
167 of being recoverred to 255 of being recoverred to
168 This list make grow in future. 256 This list make grow in future.
169 257
258 errors
259 An approximate count of read errors that have been detected on
260 this device but have not caused the device to be evicted from
261 the array (either because they were corrected or because they
262 happened while the array was read-only). When using version-1
263 metadata, this value persists across restarts of the array.
264
265 This value can be written while assembling an array thus
266 providing an ongoing count for arrays with metadata managed by
267 userspace.
268
269 slot
270 This gives the role that the device has in the array. It will
271 either be 'none' if the device is not active in the array
272 (i.e. is a spare or has failed) or an integer less than the
273 'raid_disks' number for the array indicating which possition
274 it currently fills. This can only be set while assembling an
275 array. A device for which this is set is assumed to be working.
276
277 offset
278 This gives the location in the device (in sectors from the
279 start) where data from the array will be stored. Any part of
280 the device before this offset us not touched, unless it is
281 used for storing metadata (Formats 1.1 and 1.2).
282
283 size
284 The amount of the device, after the offset, that can be used
285 for storage of data. This will normally be the same as the
286 component_size. This can be written while assembling an
287 array. If a value less than the current component_size is
288 written, component_size will be reduced to this value.
289
170 290
171An active md device will also contain and entry for each active device 291An active md device will also contain and entry for each active device
172in the array. These are named 292in the array. These are named
diff --git a/Documentation/mutex-design.txt b/Documentation/mutex-design.txt
new file mode 100644
index 000000000000..cbf79881a41c
--- /dev/null
+++ b/Documentation/mutex-design.txt
@@ -0,0 +1,135 @@
1Generic Mutex Subsystem
2
3started by Ingo Molnar <mingo@redhat.com>
4
5 "Why on earth do we need a new mutex subsystem, and what's wrong
6 with semaphores?"
7
8firstly, there's nothing wrong with semaphores. But if the simpler
9mutex semantics are sufficient for your code, then there are a couple
10of advantages of mutexes:
11
12 - 'struct mutex' is smaller on most architectures: .e.g on x86,
13 'struct semaphore' is 20 bytes, 'struct mutex' is 16 bytes.
14 A smaller structure size means less RAM footprint, and better
15 CPU-cache utilization.
16
17 - tighter code. On x86 i get the following .text sizes when
18 switching all mutex-alike semaphores in the kernel to the mutex
19 subsystem:
20
21 text data bss dec hex filename
22 3280380 868188 396860 4545428 455b94 vmlinux-semaphore
23 3255329 865296 396732 4517357 44eded vmlinux-mutex
24
25 that's 25051 bytes of code saved, or a 0.76% win - off the hottest
26 codepaths of the kernel. (The .data savings are 2892 bytes, or 0.33%)
27 Smaller code means better icache footprint, which is one of the
28 major optimization goals in the Linux kernel currently.
29
30 - the mutex subsystem is slightly faster and has better scalability for
31 contended workloads. On an 8-way x86 system, running a mutex-based
32 kernel and testing creat+unlink+close (of separate, per-task files)
33 in /tmp with 16 parallel tasks, the average number of ops/sec is:
34
35 Semaphores: Mutexes:
36
37 $ ./test-mutex V 16 10 $ ./test-mutex V 16 10
38 8 CPUs, running 16 tasks. 8 CPUs, running 16 tasks.
39 checking VFS performance. checking VFS performance.
40 avg loops/sec: 34713 avg loops/sec: 84153
41 CPU utilization: 63% CPU utilization: 22%
42
43 i.e. in this workload, the mutex based kernel was 2.4 times faster
44 than the semaphore based kernel, _and_ it also had 2.8 times less CPU
45 utilization. (In terms of 'ops per CPU cycle', the semaphore kernel
46 performed 551 ops/sec per 1% of CPU time used, while the mutex kernel
47 performed 3825 ops/sec per 1% of CPU time used - it was 6.9 times
48 more efficient.)
49
50 the scalability difference is visible even on a 2-way P4 HT box:
51
52 Semaphores: Mutexes:
53
54 $ ./test-mutex V 16 10 $ ./test-mutex V 16 10
55 4 CPUs, running 16 tasks. 8 CPUs, running 16 tasks.
56 checking VFS performance. checking VFS performance.
57 avg loops/sec: 127659 avg loops/sec: 181082
58 CPU utilization: 100% CPU utilization: 34%
59
60 (the straight performance advantage of mutexes is 41%, the per-cycle
61 efficiency of mutexes is 4.1 times better.)
62
63 - there are no fastpath tradeoffs, the mutex fastpath is just as tight
64 as the semaphore fastpath. On x86, the locking fastpath is 2
65 instructions:
66
67 c0377ccb <mutex_lock>:
68 c0377ccb: f0 ff 08 lock decl (%eax)
69 c0377cce: 78 0e js c0377cde <.text.lock.mutex>
70 c0377cd0: c3 ret
71
72 the unlocking fastpath is equally tight:
73
74 c0377cd1 <mutex_unlock>:
75 c0377cd1: f0 ff 00 lock incl (%eax)
76 c0377cd4: 7e 0f jle c0377ce5 <.text.lock.mutex+0x7>
77 c0377cd6: c3 ret
78
79 - 'struct mutex' semantics are well-defined and are enforced if
80 CONFIG_DEBUG_MUTEXES is turned on. Semaphores on the other hand have
81 virtually no debugging code or instrumentation. The mutex subsystem
82 checks and enforces the following rules:
83
84 * - only one task can hold the mutex at a time
85 * - only the owner can unlock the mutex
86 * - multiple unlocks are not permitted
87 * - recursive locking is not permitted
88 * - a mutex object must be initialized via the API
89 * - a mutex object must not be initialized via memset or copying
90 * - task may not exit with mutex held
91 * - memory areas where held locks reside must not be freed
92 * - held mutexes must not be reinitialized
93 * - mutexes may not be used in irq contexts
94
95 furthermore, there are also convenience features in the debugging
96 code:
97
98 * - uses symbolic names of mutexes, whenever they are printed in debug output
99 * - point-of-acquire tracking, symbolic lookup of function names
100 * - list of all locks held in the system, printout of them
101 * - owner tracking
102 * - detects self-recursing locks and prints out all relevant info
103 * - detects multi-task circular deadlocks and prints out all affected
104 * locks and tasks (and only those tasks)
105
106Disadvantages
107-------------
108
109The stricter mutex API means you cannot use mutexes the same way you
110can use semaphores: e.g. they cannot be used from an interrupt context,
111nor can they be unlocked from a different context that which acquired
112it. [ I'm not aware of any other (e.g. performance) disadvantages from
113using mutexes at the moment, please let me know if you find any. ]
114
115Implementation of mutexes
116-------------------------
117
118'struct mutex' is the new mutex type, defined in include/linux/mutex.h
119and implemented in kernel/mutex.c. It is a counter-based mutex with a
120spinlock and a wait-list. The counter has 3 states: 1 for "unlocked",
1210 for "locked" and negative numbers (usually -1) for "locked, potential
122waiters queued".
123
124the APIs of 'struct mutex' have been streamlined:
125
126 DEFINE_MUTEX(name);
127
128 mutex_init(mutex);
129
130 void mutex_lock(struct mutex *lock);
131 int mutex_lock_interruptible(struct mutex *lock);
132 int mutex_trylock(struct mutex *lock);
133 void mutex_unlock(struct mutex *lock);
134 int mutex_is_locked(struct mutex *lock);
135
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index b0fe41da007b..8d8b4e5ea184 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -945,7 +945,6 @@ bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
945 collisions:0 txqueuelen:0 945 collisions:0 txqueuelen:0
946 946
947eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 947eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
948 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
949 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 948 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
950 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0 949 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
951 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0 950 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
@@ -953,7 +952,6 @@ eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
953 Interrupt:10 Base address:0x1080 952 Interrupt:10 Base address:0x1080
954 953
955eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 954eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
956 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
957 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 955 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
958 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0 956 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
959 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0 957 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
diff --git a/Documentation/networking/gianfar.txt b/Documentation/networking/gianfar.txt
new file mode 100644
index 000000000000..ad474ea07d07
--- /dev/null
+++ b/Documentation/networking/gianfar.txt
@@ -0,0 +1,72 @@
1The Gianfar Ethernet Driver
2Sysfs File description
3
4Author: Andy Fleming <afleming@freescale.com>
5Updated: 2005-07-28
6
7SYSFS
8
9Several of the features of the gianfar driver are controlled
10through sysfs files. These are:
11
12bd_stash:
13To stash RX Buffer Descriptors in the L2, echo 'on' or '1' to
14bd_stash, echo 'off' or '0' to disable
15
16rx_stash_len:
17To stash the first n bytes of the packet in L2, echo the number
18of bytes to buf_stash_len. echo 0 to disable.
19
20WARNING: You could really screw these up if you set them too low or high!
21fifo_threshold:
22To change the number of bytes the controller needs in the
23fifo before it starts transmission, echo the number of bytes to
24fifo_thresh. Range should be 0-511.
25
26fifo_starve:
27When the FIFO has less than this many bytes during a transmit, it
28enters starve mode, and increases the priority of TX memory
29transactions. To change, echo the number of bytes to
30fifo_starve. Range should be 0-511.
31
32fifo_starve_off:
33Once in starve mode, the FIFO remains there until it has this
34many bytes. To change, echo the number of bytes to
35fifo_starve_off. Range should be 0-511.
36
37CHECKSUM OFFLOADING
38
39The eTSEC controller (first included in parts from late 2005 like
40the 8548) has the ability to perform TCP, UDP, and IP checksums
41in hardware. The Linux kernel only offloads the TCP and UDP
42checksums (and always performs the pseudo header checksums), so
43the driver only supports checksumming for TCP/IP and UDP/IP
44packets. Use ethtool to enable or disable this feature for RX
45and TX.
46
47VLAN
48
49In order to use VLAN, please consult Linux documentation on
50configuring VLANs. The gianfar driver supports hardware insertion and
51extraction of VLAN headers, but not filtering. Filtering will be
52done by the kernel.
53
54MULTICASTING
55
56The gianfar driver supports using the group hash table on the
57TSEC (and the extended hash table on the eTSEC) for multicast
58filtering. On the eTSEC, the exact-match MAC registers are used
59before the hash tables. See Linux documentation on how to join
60multicast groups.
61
62PADDING
63
64The gianfar driver supports padding received frames with 2 bytes
65to align the IP header to a 16-byte boundary, when supported by
66hardware.
67
68ETHTOOL
69
70The gianfar driver supports the use of ethtool for many
71configuration options. You must run ethtool only on currently
72open interfaces. See ethtool documentation for details.
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index ebc09a159f62..2b7cf19a06ad 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -46,6 +46,29 @@ ipfrag_secret_interval - INTEGER
46 for the hash secret) for IP fragments. 46 for the hash secret) for IP fragments.
47 Default: 600 47 Default: 600
48 48
49ipfrag_max_dist - INTEGER
50 ipfrag_max_dist is a non-negative integer value which defines the
51 maximum "disorder" which is allowed among fragments which share a
52 common IP source address. Note that reordering of packets is
53 not unusual, but if a large number of fragments arrive from a source
54 IP address while a particular fragment queue remains incomplete, it
55 probably indicates that one or more fragments belonging to that queue
56 have been lost. When ipfrag_max_dist is positive, an additional check
57 is done on fragments before they are added to a reassembly queue - if
58 ipfrag_max_dist (or more) fragments have arrived from a particular IP
59 address between additions to any IP fragment queue using that source
60 address, it's presumed that one or more fragments in the queue are
61 lost. The existing fragment queue will be dropped, and a new one
62 started. An ipfrag_max_dist value of zero disables this check.
63
64 Using a very small value, e.g. 1 or 2, for ipfrag_max_dist can
65 result in unnecessarily dropping fragment queues when normal
66 reordering of packets occurs, which could lead to poor application
67 performance. Using a very large value, e.g. 50000, increases the
68 likelihood of incorrectly reassembling IP fragments that originate
69 from different IP datagrams, which could result in data corruption.
70 Default: 64
71
49INET peer storage: 72INET peer storage:
50 73
51inet_peer_threshold - INTEGER 74inet_peer_threshold - INTEGER
diff --git a/Documentation/networking/sk98lin.txt b/Documentation/networking/sk98lin.txt
index 851fc97bb22f..7837c53fd5fe 100644
--- a/Documentation/networking/sk98lin.txt
+++ b/Documentation/networking/sk98lin.txt
@@ -91,7 +91,7 @@ To use the driver as a module, proceed as follows:
91 with (M) 91 with (M)
925. Execute the command "make modules". 925. Execute the command "make modules".
936. Execute the command "make modules_install". 936. Execute the command "make modules_install".
94 The appropiate modules will be installed. 94 The appropriate modules will be installed.
957. Reboot your system. 957. Reboot your system.
96 96
97 97
@@ -245,7 +245,7 @@ Default: Both
245This parameters is only relevant if auto-negotiation for this port is 245This parameters is only relevant if auto-negotiation for this port is
246not set to "Sense". If auto-negotiation is set to "On", all three values 246not set to "Sense". If auto-negotiation is set to "On", all three values
247are possible. If it is set to "Off", only "Full" and "Half" are allowed. 247are possible. If it is set to "Off", only "Full" and "Half" are allowed.
248This parameter is usefull if your link partner does not support all 248This parameter is useful if your link partner does not support all
249possible combinations. 249possible combinations.
250 250
251Flow Control 251Flow Control
diff --git a/Documentation/oops-tracing.txt b/Documentation/oops-tracing.txt
index 05960f8a748e..2503404ae5c2 100644
--- a/Documentation/oops-tracing.txt
+++ b/Documentation/oops-tracing.txt
@@ -41,11 +41,9 @@ the disk is not available then you have three options :-
41 run a null modem to a second machine and capture the output there 41 run a null modem to a second machine and capture the output there
42 using your favourite communication program. Minicom works well. 42 using your favourite communication program. Minicom works well.
43 43
44(3) Patch the kernel with one of the crash dump patches. These save 44(3) Use Kdump (see Documentation/kdump/kdump.txt),
45 data to a floppy disk or video rom or a swap partition. None of 45 extract the kernel ring buffer from old memory with using dmesg
46 these are standard kernel patches so you have to find and apply 46 gdbmacro in Documentation/kdump/gdbmacros.txt.
47 them yourself. Search kernel archives for kmsgdump, lkcd and
48 oops+smram.
49 47
50 48
51Full Information 49Full Information
diff --git a/Documentation/pci-error-recovery.txt b/Documentation/pci-error-recovery.txt
new file mode 100644
index 000000000000..d089967e4948
--- /dev/null
+++ b/Documentation/pci-error-recovery.txt
@@ -0,0 +1,246 @@
1
2 PCI Error Recovery
3 ------------------
4 May 31, 2005
5
6 Current document maintainer:
7 Linas Vepstas <linas@austin.ibm.com>
8
9
10Some PCI bus controllers are able to detect certain "hard" PCI errors
11on the bus, such as parity errors on the data and address busses, as
12well as SERR and PERR errors. These chipsets are then able to disable
13I/O to/from the affected device, so that, for example, a bad DMA
14address doesn't end up corrupting system memory. These same chipsets
15are also able to reset the affected PCI device, and return it to
16working condition. This document describes a generic API form
17performing error recovery.
18
19The core idea is that after a PCI error has been detected, there must
20be a way for the kernel to coordinate with all affected device drivers
21so that the pci card can be made operational again, possibly after
22performing a full electrical #RST of the PCI card. The API below
23provides a generic API for device drivers to be notified of PCI
24errors, and to be notified of, and respond to, a reset sequence.
25
26Preliminary sketch of API, cut-n-pasted-n-modified email from
27Ben Herrenschmidt, circa 5 april 2005
28
29The error recovery API support is exposed to the driver in the form of
30a structure of function pointers pointed to by a new field in struct
31pci_driver. The absence of this pointer in pci_driver denotes an
32"non-aware" driver, behaviour on these is platform dependant.
33Platforms like ppc64 can try to simulate pci hotplug remove/add.
34
35The definition of "pci_error_token" is not covered here. It is based on
36Seto's work on the synchronous error detection. We still need to define
37functions for extracting infos out of an opaque error token. This is
38separate from this API.
39
40This structure has the form:
41
42struct pci_error_handlers
43{
44 int (*error_detected)(struct pci_dev *dev, pci_error_token error);
45 int (*mmio_enabled)(struct pci_dev *dev);
46 int (*resume)(struct pci_dev *dev);
47 int (*link_reset)(struct pci_dev *dev);
48 int (*slot_reset)(struct pci_dev *dev);
49};
50
51A driver doesn't have to implement all of these callbacks. The
52only mandatory one is error_detected(). If a callback is not
53implemented, the corresponding feature is considered unsupported.
54For example, if mmio_enabled() and resume() aren't there, then the
55driver is assumed as not doing any direct recovery and requires
56a reset. If link_reset() is not implemented, the card is assumed as
57not caring about link resets, in which case, if recover is supported,
58the core can try recover (but not slot_reset() unless it really did
59reset the slot). If slot_reset() is not supported, link_reset() can
60be called instead on a slot reset.
61
62At first, the call will always be :
63
64 1) error_detected()
65
66 Error detected. This is sent once after an error has been detected. At
67this point, the device might not be accessible anymore depending on the
68platform (the slot will be isolated on ppc64). The driver may already
69have "noticed" the error because of a failing IO, but this is the proper
70"synchronisation point", that is, it gives a chance to the driver to
71cleanup, waiting for pending stuff (timers, whatever, etc...) to
72complete; it can take semaphores, schedule, etc... everything but touch
73the device. Within this function and after it returns, the driver
74shouldn't do any new IOs. Called in task context. This is sort of a
75"quiesce" point. See note about interrupts at the end of this doc.
76
77 Result codes:
78 - PCIERR_RESULT_CAN_RECOVER:
79 Driever returns this if it thinks it might be able to recover
80 the HW by just banging IOs or if it wants to be given
81 a chance to extract some diagnostic informations (see
82 below).
83 - PCIERR_RESULT_NEED_RESET:
84 Driver returns this if it thinks it can't recover unless the
85 slot is reset.
86 - PCIERR_RESULT_DISCONNECT:
87 Return this if driver thinks it won't recover at all,
88 (this will detach the driver ? or just leave it
89 dangling ? to be decided)
90
91So at this point, we have called error_detected() for all drivers
92on the segment that had the error. On ppc64, the slot is isolated. What
93happens now typically depends on the result from the drivers. If all
94drivers on the segment/slot return PCIERR_RESULT_CAN_RECOVER, we would
95re-enable IOs on the slot (or do nothing special if the platform doesn't
96isolate slots) and call 2). If not and we can reset slots, we go to 4),
97if neither, we have a dead slot. If it's an hotplug slot, we might
98"simulate" reset by triggering HW unplug/replug though.
99
100>>> Current ppc64 implementation assumes that a device driver will
101>>> *not* schedule or semaphore in this routine; the current ppc64
102>>> implementation uses one kernel thread to notify all devices;
103>>> thus, of one device sleeps/schedules, all devices are affected.
104>>> Doing better requires complex multi-threaded logic in the error
105>>> recovery implementation (e.g. waiting for all notification threads
106>>> to "join" before proceeding with recovery.) This seems excessively
107>>> complex and not worth implementing.
108
109>>> The current ppc64 implementation doesn't much care if the device
110>>> attempts i/o at this point, or not. I/O's will fail, returning
111>>> a value of 0xff on read, and writes will be dropped. If the device
112>>> driver attempts more than 10K I/O's to a frozen adapter, it will
113>>> assume that the device driver has gone into an infinite loop, and
114>>> it will panic the the kernel.
115
116 2) mmio_enabled()
117
118 This is the "early recovery" call. IOs are allowed again, but DMA is
119not (hrm... to be discussed, I prefer not), with some restrictions. This
120is NOT a callback for the driver to start operations again, only to
121peek/poke at the device, extract diagnostic information, if any, and
122eventually do things like trigger a device local reset or some such,
123but not restart operations. This is sent if all drivers on a segment
124agree that they can try to recover and no automatic link reset was
125performed by the HW. If the platform can't just re-enable IOs without
126a slot reset or a link reset, it doesn't call this callback and goes
127directly to 3) or 4). All IOs should be done _synchronously_ from
128within this callback, errors triggered by them will be returned via
129the normal pci_check_whatever() api, no new error_detected() callback
130will be issued due to an error happening here. However, such an error
131might cause IOs to be re-blocked for the whole segment, and thus
132invalidate the recovery that other devices on the same segment might
133have done, forcing the whole segment into one of the next states,
134that is link reset or slot reset.
135
136 Result codes:
137 - PCIERR_RESULT_RECOVERED
138 Driver returns this if it thinks the device is fully
139 functionnal and thinks it is ready to start
140 normal driver operations again. There is no
141 guarantee that the driver will actually be
142 allowed to proceed, as another driver on the
143 same segment might have failed and thus triggered a
144 slot reset on platforms that support it.
145
146 - PCIERR_RESULT_NEED_RESET
147 Driver returns this if it thinks the device is not
148 recoverable in it's current state and it needs a slot
149 reset to proceed.
150
151 - PCIERR_RESULT_DISCONNECT
152 Same as above. Total failure, no recovery even after
153 reset driver dead. (To be defined more precisely)
154
155>>> The current ppc64 implementation does not implement this callback.
156
157 3) link_reset()
158
159 This is called after the link has been reset. This is typically
160a PCI Express specific state at this point and is done whenever a
161non-fatal error has been detected that can be "solved" by resetting
162the link. This call informs the driver of the reset and the driver
163should check if the device appears to be in working condition.
164This function acts a bit like 2) mmio_enabled(), in that the driver
165is not supposed to restart normal driver I/O operations right away.
166Instead, it should just "probe" the device to check it's recoverability
167status. If all is right, then the core will call resume() once all
168drivers have ack'd link_reset().
169
170 Result codes:
171 (identical to mmio_enabled)
172
173>>> The current ppc64 implementation does not implement this callback.
174
175 4) slot_reset()
176
177 This is called after the slot has been soft or hard reset by the
178platform. A soft reset consists of asserting the adapter #RST line
179and then restoring the PCI BARs and PCI configuration header. If the
180platform supports PCI hotplug, then it might instead perform a hard
181reset by toggling power on the slot off/on. This call gives drivers
182the chance to re-initialize the hardware (re-download firmware, etc.),
183but drivers shouldn't restart normal I/O processing operations at
184this point. (See note about interrupts; interrupts aren't guaranteed
185to be delivered until the resume() callback has been called). If all
186device drivers report success on this callback, the patform will call
187resume() to complete the error handling and let the driver restart
188normal I/O processing.
189
190A driver can still return a critical failure for this function if
191it can't get the device operational after reset. If the platform
192previously tried a soft reset, it migh now try a hard reset (power
193cycle) and then call slot_reset() again. It the device still can't
194be recovered, there is nothing more that can be done; the platform
195will typically report a "permanent failure" in such a case. The
196device will be considered "dead" in this case.
197
198 Result codes:
199 - PCIERR_RESULT_DISCONNECT
200 Same as above.
201
202>>> The current ppc64 implementation does not try a power-cycle reset
203>>> if the driver returned PCIERR_RESULT_DISCONNECT. However, it should.
204
205 5) resume()
206
207 This is called if all drivers on the segment have returned
208PCIERR_RESULT_RECOVERED from one of the 3 prevous callbacks.
209That basically tells the driver to restart activity, tht everything
210is back and running. No result code is taken into account here. If
211a new error happens, it will restart a new error handling process.
212
213That's it. I think this covers all the possibilities. The way those
214callbacks are called is platform policy. A platform with no slot reset
215capability for example may want to just "ignore" drivers that can't
216recover (disconnect them) and try to let other cards on the same segment
217recover. Keep in mind that in most real life cases, though, there will
218be only one driver per segment.
219
220Now, there is a note about interrupts. If you get an interrupt and your
221device is dead or has been isolated, there is a problem :)
222
223After much thinking, I decided to leave that to the platform. That is,
224the recovery API only precies that:
225
226 - There is no guarantee that interrupt delivery can proceed from any
227device on the segment starting from the error detection and until the
228restart callback is sent, at which point interrupts are expected to be
229fully operational.
230
231 - There is no guarantee that interrupt delivery is stopped, that is, ad
232river that gets an interrupts after detecting an error, or that detects
233and error within the interrupt handler such that it prevents proper
234ack'ing of the interrupt (and thus removal of the source) should just
235return IRQ_NOTHANDLED. It's up to the platform to deal with taht
236condition, typically by masking the irq source during the duration of
237the error handling. It is expected that the platform "knows" which
238interrupts are routed to error-management capable slots and can deal
239with temporarily disabling that irq number during error processing (this
240isn't terribly complex). That means some IRQ latency for other devices
241sharing the interrupt, but there is simply no other way. High end
242platforms aren't supposed to share interrupts between many devices
243anyway :)
244
245
246Revised: 31 May 2005 Linas Vepstas <linas@austin.ibm.com>
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt
index 403e7b4dcdd4..97420f08c786 100644
--- a/Documentation/pcmcia/driver-changes.txt
+++ b/Documentation/pcmcia/driver-changes.txt
@@ -1,5 +1,16 @@
1This file details changes in 2.6 which affect PCMCIA card driver authors: 1This file details changes in 2.6 which affect PCMCIA card driver authors:
2 2
3* Unify detach and REMOVAL event code, as well as attach and INSERTION
4 code (as of 2.6.16)
5 void (*remove) (struct pcmcia_device *dev);
6 int (*probe) (struct pcmcia_device *dev);
7
8* Move suspend, resume and reset out of event handler (as of 2.6.16)
9 int (*suspend) (struct pcmcia_device *dev);
10 int (*resume) (struct pcmcia_device *dev);
11 should be initialized in struct pcmcia_driver, and handle
12 (SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events
13
3* event handler initialization in struct pcmcia_driver (as of 2.6.13) 14* event handler initialization in struct pcmcia_driver (as of 2.6.13)
4 The event handler is notified of all events, and must be initialized 15 The event handler is notified of all events, and must be initialized
5 as the event() callback in the driver's struct pcmcia_driver. 16 as the event() callback in the driver's struct pcmcia_driver.
diff --git a/Documentation/pm.txt b/Documentation/pm.txt
index 2ea1149bf6b0..79c0f32a760e 100644
--- a/Documentation/pm.txt
+++ b/Documentation/pm.txt
@@ -218,7 +218,7 @@ proceed in the opposite direction.
218Q: Who do I contact for additional information about 218Q: Who do I contact for additional information about
219 enabling power management for my specific driver/device? 219 enabling power management for my specific driver/device?
220 220
221ACPI Development mailing list: acpi-devel@lists.sourceforge.net 221ACPI Development mailing list: linux-acpi@vger.kernel.org
222 222
223System Interface -- OBSOLETE, DO NOT USE! 223System Interface -- OBSOLETE, DO NOT USE!
224----------------************************* 224----------------*************************
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt
index f5ebda5f4276..bd4ffb5bd49a 100644
--- a/Documentation/power/interface.txt
+++ b/Documentation/power/interface.txt
@@ -41,3 +41,14 @@ to. Writing to this file will accept one of
41It will only change to 'firmware' or 'platform' if the system supports 41It will only change to 'firmware' or 'platform' if the system supports
42it. 42it.
43 43
44/sys/power/image_size controls the size of the image created by
45the suspend-to-disk mechanism. It can be written a string
46representing a non-negative integer that will be used as an upper
47limit of the image size, in megabytes. The suspend-to-disk mechanism will
48do its best to ensure the image size will not exceed that number. However,
49if this turns out to be impossible, it will try to suspend anyway using the
50smallest image possible. In particular, if "0" is written to this file, the
51suspend image will be as small as possible.
52
53Reading from this file will display the current image size limit, which
54is set to 500 MB by default.
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt
index b0d50840788e..08c79d4dc540 100644
--- a/Documentation/power/swsusp.txt
+++ b/Documentation/power/swsusp.txt
@@ -27,6 +27,11 @@ echo shutdown > /sys/power/disk; echo disk > /sys/power/state
27 27
28echo platform > /sys/power/disk; echo disk > /sys/power/state 28echo platform > /sys/power/disk; echo disk > /sys/power/state
29 29
30If you want to limit the suspend image size to N megabytes, do
31
32echo N > /sys/power/image_size
33
34before suspend (it is limited to 500 MB by default).
30 35
31Encrypted suspend image: 36Encrypted suspend image:
32------------------------ 37------------------------
@@ -207,7 +212,7 @@ A: Try running
207 212
208cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null 213cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null
209 214
210after resume. swapoff -a; swapon -a may also be usefull. 215after resume. swapoff -a; swapon -a may also be useful.
211 216
212Q: What happens to devices during swsusp? They seem to be resumed 217Q: What happens to devices during swsusp? They seem to be resumed
213during system suspend? 218during system suspend?
@@ -318,7 +323,7 @@ to be useless to try to suspend to disk while that app is running?
318A: No, it should work okay, as long as your app does not mlock() 323A: No, it should work okay, as long as your app does not mlock()
319it. Just prepare big enough swap partition. 324it. Just prepare big enough swap partition.
320 325
321Q: What information is usefull for debugging suspend-to-disk problems? 326Q: What information is useful for debugging suspend-to-disk problems?
322 327
323A: Well, last messages on the screen are always useful. If something 328A: Well, last messages on the screen are always useful. If something
324is broken, it is usually some kernel driver, therefore trying with as 329is broken, it is usually some kernel driver, therefore trying with as
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX
index e7bea0a407b4..d6d65b9bcfe3 100644
--- a/Documentation/powerpc/00-INDEX
+++ b/Documentation/powerpc/00-INDEX
@@ -8,12 +8,18 @@ please mail me.
8cpu_features.txt 8cpu_features.txt
9 - info on how we support a variety of CPUs with minimal compile-time 9 - info on how we support a variety of CPUs with minimal compile-time
10 options. 10 options.
11eeh-pci-error-recovery.txt
12 - info on PCI Bus EEH Error Recovery
13hvcs.txt
14 - IBM "Hypervisor Virtual Console Server" Installation Guide
15mpc52xx.txt
16 - Linux 2.6.x on MPC52xx family
11ppc_htab.txt 17ppc_htab.txt
12 - info about the Linux/PPC /proc/ppc_htab entry 18 - info about the Linux/PPC /proc/ppc_htab entry
13smp.txt
14 - use and state info about Linux/PPC on MP machines
15SBC8260_memory_mapping.txt 19SBC8260_memory_mapping.txt
16 - EST SBC8260 board info 20 - EST SBC8260 board info
21smp.txt
22 - use and state info about Linux/PPC on MP machines
17sound.txt 23sound.txt
18 - info on sound support under Linux/PPC 24 - info on sound support under Linux/PPC
19zImage_layout.txt 25zImage_layout.txt
diff --git a/Documentation/powerpc/eeh-pci-error-recovery.txt b/Documentation/powerpc/eeh-pci-error-recovery.txt
index e75d7474322c..67a11a36270c 100644
--- a/Documentation/powerpc/eeh-pci-error-recovery.txt
+++ b/Documentation/powerpc/eeh-pci-error-recovery.txt
@@ -115,7 +115,7 @@ Current PPC64 Linux EEH Implementation
115At this time, a generic EEH recovery mechanism has been implemented, 115At this time, a generic EEH recovery mechanism has been implemented,
116so that individual device drivers do not need to be modified to support 116so that individual device drivers do not need to be modified to support
117EEH recovery. This generic mechanism piggy-backs on the PCI hotplug 117EEH recovery. This generic mechanism piggy-backs on the PCI hotplug
118infrastructure, and percolates events up through the hotplug/udev 118infrastructure, and percolates events up through the userspace/udev
119infrastructure. Followiing is a detailed description of how this is 119infrastructure. Followiing is a detailed description of how this is
120accomplished. 120accomplished.
121 121
@@ -172,7 +172,7 @@ A handler for the EEH notifier_block events is implemented in
172drivers/pci/hotplug/pSeries_pci.c, called handle_eeh_events(). 172drivers/pci/hotplug/pSeries_pci.c, called handle_eeh_events().
173It saves the device BAR's and then calls rpaphp_unconfig_pci_adapter(). 173It saves the device BAR's and then calls rpaphp_unconfig_pci_adapter().
174This last call causes the device driver for the card to be stopped, 174This last call causes the device driver for the card to be stopped,
175which causes hotplug events to go out to user space. This triggers 175which causes uevents to go out to user space. This triggers
176user-space scripts that might issue commands such as "ifdown eth0" 176user-space scripts that might issue commands such as "ifdown eth0"
177for ethernet cards, and so on. This handler then sleeps for 5 seconds, 177for ethernet cards, and so on. This handler then sleeps for 5 seconds,
178hoping to give the user-space scripts enough time to complete. 178hoping to give the user-space scripts enough time to complete.
@@ -258,29 +258,30 @@ rpa_php_unconfig_pci_adapter() { // in rpaphp_pci.c
258 calls 258 calls
259 pci_destroy_dev (struct pci_dev *) { 259 pci_destroy_dev (struct pci_dev *) {
260 calls 260 calls
261 device_unregister (&dev->dev) { // in /drivers/base/core.c 261 device_unregister (&dev->dev) { // in /drivers/base/core.c
262 calls 262 calls
263 device_del(struct device * dev) { // in /drivers/base/core.c 263 device_del(struct device * dev) { // in /drivers/base/core.c
264 calls 264 calls
265 kobject_del() { //in /libs/kobject.c 265 kobject_del() { //in /libs/kobject.c
266 calls 266 calls
267 kobject_hotplug() { // in /libs/kobject.c 267 kobject_uevent() { // in /libs/kobject.c
268 calls 268 calls
269 kset_hotplug() { // in /lib/kobject.c 269 kset_uevent() { // in /lib/kobject.c
270 calls 270 calls
271 kset->hotplug_ops->hotplug() which is really just 271 kset->uevent_ops->uevent() // which is really just
272 a call to 272 a call to
273 dev_hotplug() { // in /drivers/base/core.c 273 dev_uevent() { // in /drivers/base/core.c
274 calls 274 calls
275 dev->bus->hotplug() which is really just a call to 275 dev->bus->uevent() which is really just a call to
276 pci_hotplug () { // in drivers/pci/hotplug.c 276 pci_uevent () { // in drivers/pci/hotplug.c
277 which prints device name, etc.... 277 which prints device name, etc....
278 } 278 }
279 } 279 }
280 then kset_hotplug() calls 280 then kobject_uevent() sends a netlink uevent to userspace
281 call_usermodehelper () with 281 --> userspace uevent
282 argv[0]=hotplug_path[] which is "/sbin/hotplug" 282 (during early boot, nobody listens to netlink events and
283 --> event to userspace, 283 kobject_uevent() executes uevent_helper[], which runs the
284 event process /sbin/hotplug)
284 } 285 }
285 } 286 }
286 kobject_del() then calls sysfs_remove_dir(), which would 287 kobject_del() then calls sysfs_remove_dir(), which would
diff --git a/Documentation/scsi/ChangeLog.megaraid b/Documentation/scsi/ChangeLog.megaraid
index 5331d91432c7..09f6300eda4b 100644
--- a/Documentation/scsi/ChangeLog.megaraid
+++ b/Documentation/scsi/ChangeLog.megaraid
@@ -1,3 +1,38 @@
1Release Date : Fri Nov 11 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com>
2Current Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module)
3Older Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module)
4
51. Sorted out PCI IDs to remove megaraid support overlaps.
6 Based on the patch from Daniel, sorted out PCI IDs along with
7 charactor node name change from 'megadev' to 'megadev_legacy' to avoid
8 conflict.
9 ---
10 Hopefully we'll be getting the build restriction zapped much sooner,
11 but we should also be thinking about totally removing the hardware
12 support overlap in the megaraid drivers.
13
14 This patch pencils in a date of Feb 06 for this, and performs some
15 printk abuse in hope that existing legacy users might pick up on what's
16 going on.
17
18 Signed-off-by: Daniel Drake <dsd@gentoo.org>
19 ---
20
212. Fixed a issue: megaraid always fails to reset handler.
22 ---
23 I found that the megaraid driver always fails to reset the
24 adapter with the following message:
25 megaraid: resetting the host...
26 megaraid mbox: reset sequence completed successfully
27 megaraid: fast sync command timed out
28 megaraid: reservation reset failed
29 when the "Cluster mode" of the adapter BIOS is enabled.
30 So, whenever the reset occurs, the adapter goes to
31 offline and just become unavailable.
32
33 Jun'ichi Nomura [mailto:jnomura@mtc.biglobe.ne.jp]
34 ---
35
1Release Date : Mon Mar 07 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com> 36Release Date : Mon Mar 07 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com>
2Current Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module) 37Current Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module)
3Older Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module) 38Older Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt
new file mode 100644
index 000000000000..820fd0793502
--- /dev/null
+++ b/Documentation/scsi/aacraid.txt
@@ -0,0 +1,108 @@
1AACRAID Driver for Linux (take two)
2
3Introduction
4-------------------------
5The aacraid driver adds support for Adaptec (http://www.adaptec.com)
6RAID controllers. This is a major rewrite from the original
7Adaptec supplied driver. It has signficantly cleaned up both the code
8and the running binary size (the module is less than half the size of
9the original).
10
11Supported Cards/Chipsets
12-------------------------
13 PCI ID (pci.ids) OEM Product
14 9005:0285:9005:028a Adaptec 2020ZCR (Skyhawk)
15 9005:0285:9005:028e Adaptec 2020SA (Skyhawk)
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)
21 9005:0285:9005:0287 Adaptec 2200S (Vulcan-2m)
22 9005:0286:9005:028c Adaptec 2230S (Lancer)
23 9005:0286:9005:028c Adaptec 2230SLP (Lancer)
24 9005:0285:9005:0296 Adaptec 2240S (SabreExpress)
25 9005:0285:9005:0290 Adaptec 2410SA (Jaguar)
26 9005:0285:9005:0293 Adaptec 21610SA (Corsair-16)
27 9005:0285:103c:3227 Adaptec 2610SA (Bearcat)
28 9005:0285:9005:0292 Adaptec 2810SA (Corsair-8)
29 9005:0285:9005:0294 Adaptec Prowler
30 9005:0286:9005:029d Adaptec 2420SA (Intruder)
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)
39 9005:0285:9005:0299 Adaptec 4800SAS (Marauder-X)
40 9005:0285:9005:029a Adaptec 4805SAS (Marauder-E)
41 9005:0286:9005:02a2 Adaptec 4810SAS (Hurricane)
42 1011:0046:9005:0364 Adaptec 5400S (Mustang)
43 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)
47 9005:0200:9005:0200 Adaptec Themisto (Jupiter)
48 9005:0286:9005:0800 Adaptec Callisto (Jupiter)
49 1011:0046:9005:1364 Dell PERC 2/QC (Quad Channel, Mustang)
50 1028:0001:1028:0001 Dell PERC 2/Si (Iguana)
51 1028:0003:1028:0003 Dell PERC 3/Si (SlimFast)
52 1028:0002:1028:0002 Dell PERC 3/Di (Opal)
53 1028:0004:1028:0004 Dell PERC 3/DiF (Iguana)
54 1028:0002:1028:00d1 Dell PERC 3/DiV (Viper)
55 1028:0002:1028:00d9 Dell PERC 3/DiL (Lexus)
56 1028:000a:1028:0106 Dell PERC 3/DiJ (Jaguar)
57 1028:000a:1028:011b Dell PERC 3/DiD (Dagger)
58 1028:000a:1028:0121 Dell PERC 3/DiB (Boxster)
59 9005:0285:1028:0287 Dell PERC 320/DC (Vulcan)
60 9005:0285:1028:0291 Dell CERC 2 (DellCorsair)
61 1011:0046:103c:10c2 HP NetRAID-4M (Mustang)
62 9005:0285:17aa:0286 Legend S220 (Crusader)
63 9005:0285:17aa:0287 Legend S230 (Vulcan)
64 9005:0285:9005:0290 IBM ServeRAID 7t (Jaguar)
65 9005:0285:1014:02F2 IBM ServeRAID 8i (AvonPark)
66 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)
69 9005:0286:9005:029f ICP ICP9014R0 (Lancer)
70 9005:0286:9005:029e ICP ICP9024R0 (Lancer)
71 9005:0286:9005:02a0 ICP ICP9047MA (Lancer)
72 9005:0286:9005:02a1 ICP ICP9087MA (Lancer)
73 9005:0286:9005:02a4 ICP ICP9085LI (Marauder-X)
74 9005:0286:9005:02a5 ICP ICP5085BR (Marauder-E)
75 9005:0286:9005:02a3 ICP ICP5085AU (Hurricane)
76 9005:0286:9005:02a6 ICP ICP9067MA (Intruder-6)
77 9005:0286:9005:02a9 ICP ICP5087AU (Skyray)
78 9005:0286:9005:02aa ICP ICP5047AU (Skyray)
79
80People
81-------------------------
82Alan Cox <alan@redhat.com>
83Christoph Hellwig <hch@infradead.org> (updates for new-style PCI probing and SCSI host registration,
84 small cleanups/fixes)
85Matt Domsch <matt_domsch@dell.com> (revision ioctl, adapter messages)
86Deanna Bonds (non-DASD support, PAE fibs and 64 bit, added new adaptec controllers
87 added new ioctls, changed scsi interface to use new error handler,
88 increased the number of fibs and outstanding commands to a container)
89
90 (fixed 64bit and 64G memory model, changed confusing naming convention
91 where fibs that go to the hardware are consistently called hw_fibs and
92 not just fibs like the name of the driver tracking structure)
93Mark Salyzyn <Mark_Salyzyn@adaptec.com> Fixed panic issues and added some new product ids for upcoming hbas. Performance tuning, card failover and bug mitigations.
94
95Original Driver
96-------------------------
97Adaptec Unix OEM Product Group
98
99Mailing List
100-------------------------
101linux-scsi@vger.kernel.org (Interested parties troll here)
102Also note this is very different to Brian's original driver
103so don't expect him to support it.
104Adaptec does support this driver. Contact Adaptec tech support or
105aacraid@adaptec.com
106
107Original by Brian Boerner February 2001
108Rewritten by Alan Cox, November 2001
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
index 66565d42288f..8bbae3e1abdf 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -150,7 +150,8 @@ scsi devices of which only the first 2 respond:
150LLD mid level LLD 150LLD mid level LLD
151===-------------------=========--------------------===------ 151===-------------------=========--------------------===------
152scsi_host_alloc() --> 152scsi_host_alloc() -->
153scsi_add_host() --------+ 153scsi_add_host() ---->
154scsi_scan_host() -------+
154 | 155 |
155 slave_alloc() 156 slave_alloc()
156 slave_configure() --> scsi_adjust_queue_depth() 157 slave_configure() --> scsi_adjust_queue_depth()
@@ -196,7 +197,7 @@ of the issues involved. See the section on reference counting below.
196 197
197 198
198The hotplug concept may be extended to SCSI devices. Currently, when an 199The hotplug concept may be extended to SCSI devices. Currently, when an
199HBA is added, the scsi_add_host() function causes a scan for SCSI devices 200HBA is added, the scsi_scan_host() function causes a scan for SCSI devices
200attached to the HBA's SCSI transport. On newer SCSI transports the HBA 201attached to the HBA's SCSI transport. On newer SCSI transports the HBA
201may become aware of a new SCSI device _after_ the scan has completed. 202may become aware of a new SCSI device _after_ the scan has completed.
202An LLD can use this sequence to make the mid level aware of a SCSI device: 203An LLD can use this sequence to make the mid level aware of a SCSI device:
@@ -372,7 +373,7 @@ names all start with "scsi_".
372Summary: 373Summary:
373 scsi_activate_tcq - turn on tag command queueing 374 scsi_activate_tcq - turn on tag command queueing
374 scsi_add_device - creates new scsi device (lu) instance 375 scsi_add_device - creates new scsi device (lu) instance
375 scsi_add_host - perform sysfs registration and SCSI bus scan. 376 scsi_add_host - perform sysfs registration and set up transport class
376 scsi_adjust_queue_depth - change the queue depth on a SCSI device 377 scsi_adjust_queue_depth - change the queue depth on a SCSI device
377 scsi_assign_lock - replace default host_lock with given lock 378 scsi_assign_lock - replace default host_lock with given lock
378 scsi_bios_ptable - return copy of block device's partition table 379 scsi_bios_ptable - return copy of block device's partition table
@@ -386,6 +387,7 @@ Summary:
386 scsi_remove_device - detach and remove a SCSI device 387 scsi_remove_device - detach and remove a SCSI device
387 scsi_remove_host - detach and remove all SCSI devices owned by host 388 scsi_remove_host - detach and remove all SCSI devices owned by host
388 scsi_report_bus_reset - report scsi _bus_ reset observed 389 scsi_report_bus_reset - report scsi _bus_ reset observed
390 scsi_scan_host - scan SCSI bus
389 scsi_track_queue_full - track successive QUEUE_FULL events 391 scsi_track_queue_full - track successive QUEUE_FULL events
390 scsi_unblock_requests - allow further commands to be queued to given host 392 scsi_unblock_requests - allow further commands to be queued to given host
391 scsi_unregister - [calls scsi_host_put()] 393 scsi_unregister - [calls scsi_host_put()]
@@ -425,10 +427,10 @@ void scsi_activate_tcq(struct scsi_device *sdev, int depth)
425 * Might block: yes 427 * Might block: yes
426 * 428 *
427 * Notes: This call is usually performed internally during a scsi 429 * Notes: This call is usually performed internally during a scsi
428 * bus scan when an HBA is added (i.e. scsi_add_host()). So it 430 * bus scan when an HBA is added (i.e. scsi_scan_host()). So it
429 * should only be called if the HBA becomes aware of a new scsi 431 * should only be called if the HBA becomes aware of a new scsi
430 * device (lu) after scsi_add_host() has completed. If successful 432 * device (lu) after scsi_scan_host() has completed. If successful
431 * this call we lead to slave_alloc() and slave_configure() callbacks 433 * this call can lead to slave_alloc() and slave_configure() callbacks
432 * into the LLD. 434 * into the LLD.
433 * 435 *
434 * Defined in: drivers/scsi/scsi_scan.c 436 * Defined in: drivers/scsi/scsi_scan.c
@@ -439,7 +441,7 @@ struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
439 441
440 442
441/** 443/**
442 * scsi_add_host - perform sysfs registration and SCSI bus scan. 444 * scsi_add_host - perform sysfs registration and set up transport class
443 * @shost: pointer to scsi host instance 445 * @shost: pointer to scsi host instance
444 * @dev: pointer to struct device of type scsi class 446 * @dev: pointer to struct device of type scsi class
445 * 447 *
@@ -448,7 +450,11 @@ struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
448 * Might block: no 450 * Might block: no
449 * 451 *
450 * Notes: Only required in "hotplug initialization model" after a 452 * Notes: Only required in "hotplug initialization model" after a
451 * successful call to scsi_host_alloc(). 453 * successful call to scsi_host_alloc(). This function does not
454 * scan the bus; this can be done by calling scsi_scan_host() or
455 * in some other transport-specific way. The LLD must set up
456 * the transport template before calling this function and may only
457 * access the transport class data after this function has been called.
452 * 458 *
453 * Defined in: drivers/scsi/hosts.c 459 * Defined in: drivers/scsi/hosts.c
454 **/ 460 **/
@@ -559,7 +565,7 @@ void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
559 * area for the LLD's exclusive use. 565 * area for the LLD's exclusive use.
560 * Both associated refcounting objects have their refcount set to 1. 566 * Both associated refcounting objects have their refcount set to 1.
561 * Full registration (in sysfs) and a bus scan are performed later when 567 * Full registration (in sysfs) and a bus scan are performed later when
562 * scsi_add_host() is called. 568 * scsi_add_host() and scsi_scan_host() are called.
563 * 569 *
564 * Defined in: drivers/scsi/hosts.c . 570 * Defined in: drivers/scsi/hosts.c .
565 **/ 571 **/
@@ -699,6 +705,19 @@ void scsi_report_bus_reset(struct Scsi_Host * shost, int channel)
699 705
700 706
701/** 707/**
708 * scsi_scan_host - scan SCSI bus
709 * @shost: a pointer to a scsi host instance
710 *
711 * Might block: yes
712 *
713 * Notes: Should be called after scsi_add_host()
714 *
715 * Defined in: drivers/scsi/scsi_scan.c
716 **/
717void scsi_scan_host(struct Scsi_Host *shost)
718
719
720/**
702 * scsi_track_queue_full - track successive QUEUE_FULL events on given 721 * scsi_track_queue_full - track successive QUEUE_FULL events on given
703 * device to determine if and when there is a need 722 * device to determine if and when there is a need
704 * to adjust the queue depth on the device. 723 * to adjust the queue depth on the device.
@@ -1433,7 +1452,7 @@ The following people have contributed to this document:
1433 Christoph Hellwig <hch at infradead dot org> 1452 Christoph Hellwig <hch at infradead dot org>
1434 Doug Ledford <dledford at redhat dot com> 1453 Doug Ledford <dledford at redhat dot com>
1435 Andries Brouwer <Andries dot Brouwer at cwi dot nl> 1454 Andries Brouwer <Andries dot Brouwer at cwi dot nl>
1436 Randy Dunlap <rddunlap at osdl dot org> 1455 Randy Dunlap <rdunlap at xenotime dot net>
1437 Alan Stern <stern at rowland dot harvard dot edu> 1456 Alan Stern <stern at rowland dot harvard dot edu>
1438 1457
1439 1458
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 2f27f391c7cc..d2578013e829 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -105,7 +105,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
105 Each of top level sound card module takes the following options. 105 Each of top level sound card module takes the following options.
106 106
107 index - index (slot #) of sound card 107 index - index (slot #) of sound card
108 - Values: 0 through 7 or negative 108 - Values: 0 through 31 or negative
109 - If nonnegative, assign that index number 109 - If nonnegative, assign that index number
110 - if negative, interpret as a bitmask of permissible 110 - if negative, interpret as a bitmask of permissible
111 indices; the first free permitted index is assigned 111 indices; the first free permitted index is assigned
@@ -134,7 +134,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
134 dma2 - second DMA # for AD1816A chip (PnP setup) 134 dma2 - second DMA # for AD1816A chip (PnP setup)
135 clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz) 135 clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz)
136 136
137 Module supports up to 8 cards, autoprobe and PnP. 137 This module supports multiple cards, autoprobe and PnP.
138 138
139 Module snd-ad1848 139 Module snd-ad1848
140 ----------------- 140 -----------------
@@ -145,9 +145,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
145 irq - IRQ # for AD1848 chip 145 irq - IRQ # for AD1848 chip
146 dma1 - DMA # for AD1848 chip (0,1,3) 146 dma1 - DMA # for AD1848 chip (0,1,3)
147 147
148 Module supports up to 8 cards. This module does not support autoprobe 148 This module supports multiple cards. It does not support autoprobe
149 thus main port must be specified!!! Other ports are optional. 149 thus main port must be specified!!! Other ports are optional.
150 150
151 The power-management is supported.
152
151 Module snd-ad1889 153 Module snd-ad1889
152 ----------------- 154 -----------------
153 155
@@ -156,7 +158,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
156 ac97_quirk - AC'97 workaround for strange hardware 158 ac97_quirk - AC'97 workaround for strange hardware
157 See the description of intel8x0 module for details. 159 See the description of intel8x0 module for details.
158 160
159 This module supports up to 8 cards. 161 This module supports multiple cards.
160 162
161 Module snd-ali5451 163 Module snd-ali5451
162 ------------------ 164 ------------------
@@ -184,7 +186,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
184 mpu_irq - IRQ # for MPU-401 (PnP setup) 186 mpu_irq - IRQ # for MPU-401 (PnP setup)
185 fm_port - port # for OPL3 FM (PnP setup) 187 fm_port - port # for OPL3 FM (PnP setup)
186 188
187 Module supports up to 8 cards, autoprobe and PnP. 189 This module supports multiple cards, autoprobe and PnP.
190
191 The power-management is supported.
188 192
189 Module snd-als4000 193 Module snd-als4000
190 ------------------ 194 ------------------
@@ -194,7 +198,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
194 joystick_port - port # for legacy joystick support. 198 joystick_port - port # for legacy joystick support.
195 0 = disabled (default), 1 = auto-detect 199 0 = disabled (default), 1 = auto-detect
196 200
197 Module supports up to 8 cards, autoprobe and PnP. 201 This module supports multiple cards, autoprobe and PnP.
202
203 The power-management is supported.
198 204
199 Module snd-atiixp 205 Module snd-atiixp
200 ----------------- 206 -----------------
@@ -213,6 +219,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
213 implementation depends on the motherboard, and you'll need to 219 implementation depends on the motherboard, and you'll need to
214 choose the correct one via spdif_aclink module option. 220 choose the correct one via spdif_aclink module option.
215 221
222 The power-management is supported.
223
216 Module snd-atiixp-modem 224 Module snd-atiixp-modem
217 ----------------------- 225 -----------------------
218 226
@@ -223,6 +231,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
223 Note: The default index value of this module is -2, i.e. the first 231 Note: The default index value of this module is -2, i.e. the first
224 slot is excluded. 232 slot is excluded.
225 233
234 The power-management is supported.
235
226 Module snd-au8810, snd-au8820, snd-au8830 236 Module snd-au8810, snd-au8820, snd-au8830
227 ----------------------------------------- 237 -----------------------------------------
228 238
@@ -263,8 +273,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
263 dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup) 273 dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup)
264 dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup) 274 dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup)
265 275
266 Module supports up to 8 cards, PnP and autoprobe. 276 This module supports multiple cards, PnP and autoprobe.
267 277
278 The power-management is supported.
279
268 Module snd-azt3328 280 Module snd-azt3328
269 ------------------ 281 ------------------
270 282
@@ -272,7 +284,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
272 284
273 joystick - Enable joystick (default off) 285 joystick - Enable joystick (default off)
274 286
275 Module supports up to 8 cards. 287 This module supports multiple cards.
276 288
277 Module snd-bt87x 289 Module snd-bt87x
278 ---------------- 290 ----------------
@@ -282,7 +294,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
282 digital_rate - Override the default digital rate (Hz) 294 digital_rate - Override the default digital rate (Hz)
283 load_all - Load the driver even if the card model isn't known 295 load_all - Load the driver even if the card model isn't known
284 296
285 Module supports up to 8 cards. 297 This module supports multiple cards.
286 298
287 Note: The default index value of this module is -2, i.e. the first 299 Note: The default index value of this module is -2, i.e. the first
288 slot is excluded. 300 slot is excluded.
@@ -292,7 +304,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
292 304
293 Module for Creative Audigy LS and SB Live 24bit 305 Module for Creative Audigy LS and SB Live 24bit
294 306
295 Module supports up to 8 cards. 307 This module supports multiple cards.
296 308
297 309
298 Module snd-cmi8330 310 Module snd-cmi8330
@@ -308,7 +320,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
308 sbdma8 - 8bit DMA # for CMI8330 chip (SB16) 320 sbdma8 - 8bit DMA # for CMI8330 chip (SB16)
309 sbdma16 - 16bit DMA # for CMI8330 chip (SB16) 321 sbdma16 - 16bit DMA # for CMI8330 chip (SB16)
310 322
311 Module supports up to 8 cards and autoprobe. 323 This module supports multiple cards and autoprobe.
324
325 The power-management is supported.
312 326
313 Module snd-cmipci 327 Module snd-cmipci
314 ----------------- 328 -----------------
@@ -321,8 +335,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
321 (default = 1) 335 (default = 1)
322 joystick_port - Joystick port address (0 = disable, 1 = auto-detect) 336 joystick_port - Joystick port address (0 = disable, 1 = auto-detect)
323 337
324 Module supports autoprobe and multiple chips (max 8). 338 This module supports autoprobe and multiple cards.
325 339
340 The power-management is supported.
341
326 Module snd-cs4231 342 Module snd-cs4231
327 ----------------- 343 -----------------
328 344
@@ -335,7 +351,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
335 dma1 - first DMA # for CS4231 chip 351 dma1 - first DMA # for CS4231 chip
336 dma2 - second DMA # for CS4231 chip 352 dma2 - second DMA # for CS4231 chip
337 353
338 Module supports up to 8 cards. This module does not support autoprobe 354 This module supports multiple cards. This module does not support autoprobe
339 thus main port must be specified!!! Other ports are optional. 355 thus main port must be specified!!! Other ports are optional.
340 356
341 The power-management is supported. 357 The power-management is supported.
@@ -355,7 +371,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
355 dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable 371 dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable
356 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 372 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
357 373
358 Module supports up to 8 cards. This module does not support autoprobe 374 This module supports multiple cards. This module does not support autoprobe
359 thus main port must be specified!!! Other ports are optional. 375 thus main port must be specified!!! Other ports are optional.
360 376
361 The power-management is supported. 377 The power-management is supported.
@@ -376,7 +392,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
376 dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable 392 dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable
377 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 393 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
378 394
379 Module supports up to 8 cards. This module does not support autoprobe 395 This module supports multiple cards. This module does not support autoprobe
380 (if ISA PnP is not used) thus main port and control port must be 396 (if ISA PnP is not used) thus main port and control port must be
381 specified!!! Other ports are optional. 397 specified!!! Other ports are optional.
382 398
@@ -389,7 +405,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
389 405
390 dual_codec - Secondary codec ID (0 = disable, default) 406 dual_codec - Secondary codec ID (0 = disable, default)
391 407
392 Module supports up to 8 cards. 408 This module supports multiple cards.
393 409
394 The power-management is supported. 410 The power-management is supported.
395 411
@@ -403,13 +419,20 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
403 thinkpad - Force to enable Thinkpad's CLKRUN control. 419 thinkpad - Force to enable Thinkpad's CLKRUN control.
404 mmap_valid - Support OSS mmap mode (default = 0). 420 mmap_valid - Support OSS mmap mode (default = 0).
405 421
406 Module supports up to 8 cards and autoprobe. 422 This module supports multiple cards and autoprobe.
407 Usually external amp and CLKRUN controls are detected automatically 423 Usually external amp and CLKRUN controls are detected automatically
408 from PCI sub vendor/device ids. If they don't work, give the options 424 from PCI sub vendor/device ids. If they don't work, give the options
409 above explicitly. 425 above explicitly.
410 426
411 The power-management is supported. 427 The power-management is supported.
412 428
429 Module snd-cs5535audio
430 ----------------------
431
432 Module for multifunction CS5535 companion PCI device
433
434 This module supports multiple cards.
435
413 Module snd-dt019x 436 Module snd-dt019x
414 ----------------- 437 -----------------
415 438
@@ -423,9 +446,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
423 mpu_irq - IRQ # for MPU-401 (PnP setup) 446 mpu_irq - IRQ # for MPU-401 (PnP setup)
424 dma8 - DMA # (PnP setup) 447 dma8 - DMA # (PnP setup)
425 448
426 Module supports up to 8 cards. This module is enabled only with 449 This module supports multiple cards. This module is enabled only with
427 ISA PnP support. 450 ISA PnP support.
428 451
452 The power-management is supported.
453
429 Module snd-dummy 454 Module snd-dummy
430 ---------------- 455 ----------------
431 456
@@ -433,6 +458,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
433 or input, but you may use this module for any application which 458 or input, but you may use this module for any application which
434 requires a sound card (like RealPlayer). 459 requires a sound card (like RealPlayer).
435 460
461 The power-management is supported.
462
436 Module snd-emu10k1 463 Module snd-emu10k1
437 ------------------ 464 ------------------
438 465
@@ -450,7 +477,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
450 given in MB unit. Default value is 128. 477 given in MB unit. Default value is 128.
451 enable_ir - enable IR 478 enable_ir - enable IR
452 479
453 Module supports up to 8 cards and autoprobe. 480 This module supports multiple cards and autoprobe.
454 481
455 Input & Output configurations [extin/extout] 482 Input & Output configurations [extin/extout]
456 * Creative Card wo/Digital out [0x0003/0x1f03] 483 * Creative Card wo/Digital out [0x0003/0x1f03]
@@ -466,12 +493,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
466 * Creative Card 5.1 (c) 2003 [0x3fc3/0x7cff] 493 * Creative Card 5.1 (c) 2003 [0x3fc3/0x7cff]
467 * Creative Card all ins and outs [0x3fff/0x7fff] 494 * Creative Card all ins and outs [0x3fff/0x7fff]
468 495
496 The power-management is supported.
497
469 Module snd-emu10k1x 498 Module snd-emu10k1x
470 ------------------- 499 -------------------
471 500
472 Module for Creative Emu10k1X (SB Live Dell OEM version) 501 Module for Creative Emu10k1X (SB Live Dell OEM version)
473 502
474 Module supports up to 8 cards. 503 This module supports multiple cards.
475 504
476 Module snd-ens1370 505 Module snd-ens1370
477 ------------------ 506 ------------------
@@ -482,7 +511,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
482 511
483 joystick - Enable joystick (default off) 512 joystick - Enable joystick (default off)
484 513
485 Module supports up to 8 cards and autoprobe. 514 This module supports multiple cards and autoprobe.
486 515
487 Module snd-ens1371 516 Module snd-ens1371
488 ------------------ 517 ------------------
@@ -495,7 +524,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
495 joystick_port - port # for joystick (0x200,0x208,0x210,0x218), 524 joystick_port - port # for joystick (0x200,0x208,0x210,0x218),
496 0 = disable (default), 1 = auto-detect 525 0 = disable (default), 1 = auto-detect
497 526
498 Module supports up to 8 cards and autoprobe. 527 This module supports multiple cards and autoprobe.
499 528
500 Module snd-es968 529 Module snd-es968
501 ---------------- 530 ----------------
@@ -506,8 +535,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
506 irq - IRQ # for ES968 (SB8) chip (PnP setup) 535 irq - IRQ # for ES968 (SB8) chip (PnP setup)
507 dma1 - DMA # for ES968 (SB8) chip (PnP setup) 536 dma1 - DMA # for ES968 (SB8) chip (PnP setup)
508 537
509 Module supports up to 8 cards, PnP and autoprobe. 538 This module supports multiple cards, PnP and autoprobe.
510 539
540 The power-management is supported.
541
511 Module snd-es1688 542 Module snd-es1688
512 ----------------- 543 -----------------
513 544
@@ -519,7 +550,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
519 mpu_irq - IRQ # for MPU-401 port (5,7,9,10) 550 mpu_irq - IRQ # for MPU-401 port (5,7,9,10)
520 dma8 - DMA # for ES-1688 chip (0,1,3) 551 dma8 - DMA # for ES-1688 chip (0,1,3)
521 552
522 Module supports up to 8 cards and autoprobe (without MPU-401 port). 553 This module supports multiple cards and autoprobe (without MPU-401 port).
523 554
524 Module snd-es18xx 555 Module snd-es18xx
525 ----------------- 556 -----------------
@@ -534,8 +565,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
534 dma2 - first DMA # for ES-18xx chip (0,1,3) 565 dma2 - first DMA # for ES-18xx chip (0,1,3)
535 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 566 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
536 567
537 Module supports up to 8 cards ISA PnP and autoprobe (without MPU-401 port 568 This module supports multiple cards, ISA PnP and autoprobe (without MPU-401
538 if native ISA PnP routines are not used). 569 port if native ISA PnP routines are not used).
539 When dma2 is equal with dma1, the driver works as half-duplex. 570 When dma2 is equal with dma1, the driver works as half-duplex.
540 571
541 The power-management is supported. 572 The power-management is supported.
@@ -545,7 +576,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
545 576
546 Module for sound cards based on ESS Solo-1 (ES1938,ES1946) chips. 577 Module for sound cards based on ESS Solo-1 (ES1938,ES1946) chips.
547 578
548 Module supports up to 8 cards and autoprobe. 579 This module supports multiple cards and autoprobe.
580
581 The power-management is supported.
549 582
550 Module snd-es1968 583 Module snd-es1968
551 ----------------- 584 -----------------
@@ -561,7 +594,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
561 enable_mpu - enable MPU401 (0 = off, 1 = on, 2 = auto (default)) 594 enable_mpu - enable MPU401 (0 = off, 1 = on, 2 = auto (default))
562 joystick - enable joystick (default off) 595 joystick - enable joystick (default off)
563 596
564 Module supports up to 8 cards and autoprobe. 597 This module supports multiple cards and autoprobe.
565 598
566 The power-management is supported. 599 The power-management is supported.
567 600
@@ -577,8 +610,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
577 - High 16-bits are video (radio) device number + 1 610 - High 16-bits are video (radio) device number + 1
578 - example: 0x10002 (MediaForte 256-PCPR, device 1) 611 - example: 0x10002 (MediaForte 256-PCPR, device 1)
579 612
580 Module supports up to 8 cards and autoprobe. 613 This module supports multiple cards and autoprobe.
581 614
615 The power-management is supported.
616
582 Module snd-gusclassic 617 Module snd-gusclassic
583 --------------------- 618 ---------------------
584 619
@@ -592,7 +627,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
592 voices - GF1 voices limit (14-32) 627 voices - GF1 voices limit (14-32)
593 pcm_voices - reserved PCM voices 628 pcm_voices - reserved PCM voices
594 629
595 Module supports up to 8 cards and autoprobe. 630 This module supports multiple cards and autoprobe.
596 631
597 Module snd-gusextreme 632 Module snd-gusextreme
598 --------------------- 633 ---------------------
@@ -611,7 +646,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
611 voices - GF1 voices limit (14-32) 646 voices - GF1 voices limit (14-32)
612 pcm_voices - reserved PCM voices 647 pcm_voices - reserved PCM voices
613 648
614 Module supports up to 8 cards and autoprobe (without MPU-401 port). 649 This module supports multiple cards and autoprobe (without MPU-401 port).
615 650
616 Module snd-gusmax 651 Module snd-gusmax
617 ----------------- 652 -----------------
@@ -626,7 +661,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
626 voices - GF1 voices limit (14-32) 661 voices - GF1 voices limit (14-32)
627 pcm_voices - reserved PCM voices 662 pcm_voices - reserved PCM voices
628 663
629 Module supports up to 8 cards and autoprobe. 664 This module supports multiple cards and autoprobe.
630 665
631 Module snd-hda-intel 666 Module snd-hda-intel
632 -------------------- 667 --------------------
@@ -688,12 +723,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
688 (Usually SD_LPLIB register is more accurate than the 723 (Usually SD_LPLIB register is more accurate than the
689 position buffer.) 724 position buffer.)
690 725
726 The power-management is supported.
727
691 Module snd-hdsp 728 Module snd-hdsp
692 --------------- 729 ---------------
693 730
694 Module for RME Hammerfall DSP audio interface(s) 731 Module for RME Hammerfall DSP audio interface(s)
695 732
696 Module supports up to 8 cards. 733 This module supports multiple cards.
697 734
698 Note: The firmware data can be automatically loaded via hotplug 735 Note: The firmware data can be automatically loaded via hotplug
699 when CONFIG_FW_LOADER is set. Otherwise, you need to load 736 when CONFIG_FW_LOADER is set. Otherwise, you need to load
@@ -751,7 +788,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
751 cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever) 788 cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever)
752 in msec resolution, default value is 500 (0.5 sec) 789 in msec resolution, default value is 500 (0.5 sec)
753 790
754 Module supports up to 8 cards and autoprobe. Note: The consumer part 791 This module supports multiple cards and autoprobe. Note: The consumer part
755 is not used with all Envy24 based cards (for example in the MidiMan Delta 792 is not used with all Envy24 based cards (for example in the MidiMan Delta
756 serie). 793 serie).
757 794
@@ -787,7 +824,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
787 aureon71, universe, k8x800, phase22, phase28, ms300, 824 aureon71, universe, k8x800, phase22, phase28, ms300,
788 av710 825 av710
789 826
790 Module supports up to 8 cards and autoprobe. 827 This module supports multiple cards and autoprobe.
791 828
792 Note: The supported board is detected by reading EEPROM or PCI 829 Note: The supported board is detected by reading EEPROM or PCI
793 SSID (if EEPROM isn't available). You can override the 830 SSID (if EEPROM isn't available). You can override the
@@ -839,6 +876,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
839 Note: The default index value of this module is -2, i.e. the first 876 Note: The default index value of this module is -2, i.e. the first
840 slot is excluded. 877 slot is excluded.
841 878
879 The power-management is supported.
880
842 Module snd-interwave 881 Module snd-interwave
843 -------------------- 882 --------------------
844 883
@@ -855,7 +894,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
855 effect - 1 = InterWave effects enable (default 0); 894 effect - 1 = InterWave effects enable (default 0);
856 requires 8 voices 895 requires 8 voices
857 896
858 Module supports up to 8 cards, autoprobe and ISA PnP. 897 This module supports multiple cards, autoprobe and ISA PnP.
859 898
860 Module snd-interwave-stb 899 Module snd-interwave-stb
861 ------------------------ 900 ------------------------
@@ -875,14 +914,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
875 effect - 1 = InterWave effects enable (default 0); 914 effect - 1 = InterWave effects enable (default 0);
876 requires 8 voices 915 requires 8 voices
877 916
878 Module supports up to 8 cards, autoprobe and ISA PnP. 917 This module supports multiple cards, autoprobe and ISA PnP.
879 918
880 Module snd-korg1212 919 Module snd-korg1212
881 ------------------- 920 -------------------
882 921
883 Module for Korg 1212 IO PCI card 922 Module for Korg 1212 IO PCI card
884 923
885 Module supports up to 8 cards. 924 This module supports multiple cards.
886 925
887 Module snd-maestro3 926 Module snd-maestro3
888 ------------------- 927 -------------------
@@ -894,7 +933,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
894 -1 for default pin (8 for allegro, 1 for 933 -1 for default pin (8 for allegro, 1 for
895 others) 934 others)
896 935
897 Module supports autoprobe and multiple chips (max 8). 936 This module supports autoprobe and multiple chips.
898 937
899 Note: the binding of amplifier is dependent on hardware. 938 Note: the binding of amplifier is dependent on hardware.
900 If there is no sound even though all channels are unmuted, try to 939 If there is no sound even though all channels are unmuted, try to
@@ -909,7 +948,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
909 948
910 Module for Digigram miXart8 sound cards. 949 Module for Digigram miXart8 sound cards.
911 950
912 Module supports multiple cards. 951 This module supports multiple cards.
913 Note: One miXart8 board will be represented as 4 alsa cards. 952 Note: One miXart8 board will be represented as 4 alsa cards.
914 See MIXART.txt for details. 953 See MIXART.txt for details.
915 954
@@ -928,7 +967,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
928 irq - IRQ number or -1 (disable) 967 irq - IRQ number or -1 (disable)
929 pnp - PnP detection - 0 = disable, 1 = enable (default) 968 pnp - PnP detection - 0 = disable, 1 = enable (default)
930 969
931 Module supports multiple devices (max 8) and PnP. 970 This module supports multiple devices and PnP.
932 971
933 Module snd-mtpav 972 Module snd-mtpav
934 ---------------- 973 ----------------
@@ -1014,7 +1053,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1014 dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable 1053 dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable
1015 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1054 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1016 1055
1017 Module supports up to 8 cards and ISA PnP. This module does not support 1056 This module supports multiple cards and ISA PnP. It does not support
1018 autoprobe (if ISA PnP is not used) thus all ports must be specified!!! 1057 autoprobe (if ISA PnP is not used) thus all ports must be specified!!!
1019 1058
1020 The power-management is supported. 1059 The power-management is supported.
@@ -1064,6 +1103,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1064 1103
1065 This module supports only one card, autoprobe and PnP. 1104 This module supports only one card, autoprobe and PnP.
1066 1105
1106 Module snd-pcxhr
1107 ----------------
1108
1109 Module for Digigram PCXHR boards
1110
1111 This module supports multiple cards.
1112
1067 Module snd-powermac (on ppc only) 1113 Module snd-powermac (on ppc only)
1068 --------------------------------- 1114 ---------------------------------
1069 1115
@@ -1084,20 +1130,22 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1084 1130
1085 For ARM architecture only. 1131 For ARM architecture only.
1086 1132
1133 The power-management is supported.
1134
1087 Module snd-rme32 1135 Module snd-rme32
1088 ---------------- 1136 ----------------
1089 1137
1090 Module for RME Digi32, Digi32 Pro and Digi32/8 (Sek'd Prodif32, 1138 Module for RME Digi32, Digi32 Pro and Digi32/8 (Sek'd Prodif32,
1091 Prodif96 and Prodif Gold) sound cards. 1139 Prodif96 and Prodif Gold) sound cards.
1092 1140
1093 Module supports up to 8 cards. 1141 This module supports multiple cards.
1094 1142
1095 Module snd-rme96 1143 Module snd-rme96
1096 ---------------- 1144 ----------------
1097 1145
1098 Module for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST sound cards. 1146 Module for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST sound cards.
1099 1147
1100 Module supports up to 8 cards. 1148 This module supports multiple cards.
1101 1149
1102 Module snd-rme9652 1150 Module snd-rme9652
1103 ------------------ 1151 ------------------
@@ -1107,7 +1155,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1107 precise_ptr - Enable precise pointer (doesn't work reliably). 1155 precise_ptr - Enable precise pointer (doesn't work reliably).
1108 (default = 0) 1156 (default = 0)
1109 1157
1110 Module supports up to 8 cards. 1158 This module supports multiple cards.
1111 1159
1112 Note: snd-page-alloc module does the job which snd-hammerfall-mem 1160 Note: snd-page-alloc module does the job which snd-hammerfall-mem
1113 module did formerly. It will allocate the buffers in advance 1161 module did formerly. It will allocate the buffers in advance
@@ -1124,6 +1172,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1124 Module supports only one card. 1172 Module supports only one card.
1125 Module has no enable and index options. 1173 Module has no enable and index options.
1126 1174
1175 The power-management is supported.
1176
1127 Module snd-sb8 1177 Module snd-sb8
1128 -------------- 1178 --------------
1129 1179
@@ -1135,8 +1185,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1135 irq - IRQ # for SB DSP chip (5,7,9,10) 1185 irq - IRQ # for SB DSP chip (5,7,9,10)
1136 dma8 - DMA # for SB DSP chip (1,3) 1186 dma8 - DMA # for SB DSP chip (1,3)
1137 1187
1138 Module supports up to 8 cards and autoprobe. 1188 This module supports multiple cards and autoprobe.
1139 1189
1190 The power-management is supported.
1191
1140 Module snd-sb16 and snd-sbawe 1192 Module snd-sb16 and snd-sbawe
1141 ----------------------------- 1193 -----------------------------
1142 1194
@@ -1155,7 +1207,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1155 csp - ASP/CSP chip support - 0 = disable (default), 1 = enable 1207 csp - ASP/CSP chip support - 0 = disable (default), 1 = enable
1156 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1208 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1157 1209
1158 Module supports up to 8 cards, autoprobe and ISA PnP. 1210 This module supports multiple cards, autoprobe and ISA PnP.
1159 1211
1160 Note: To use Vibra16X cards in 16-bit half duplex mode, you must 1212 Note: To use Vibra16X cards in 16-bit half duplex mode, you must
1161 disable 16bit DMA with dma16 = -1 module parameter. 1213 disable 16bit DMA with dma16 = -1 module parameter.
@@ -1163,6 +1215,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1163 half duplex mode through 8-bit DMA channel by disabling their 1215 half duplex mode through 8-bit DMA channel by disabling their
1164 16-bit DMA channel. 1216 16-bit DMA channel.
1165 1217
1218 The power-management is supported.
1219
1166 Module snd-sgalaxy 1220 Module snd-sgalaxy
1167 ------------------ 1221 ------------------
1168 1222
@@ -1173,7 +1227,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1173 irq - IRQ # (7,9,10,11) 1227 irq - IRQ # (7,9,10,11)
1174 dma1 - DMA # 1228 dma1 - DMA #
1175 1229
1176 Module supports up to 8 cards. 1230 This module supports multiple cards.
1231
1232 The power-management is supported.
1177 1233
1178 Module snd-sscape 1234 Module snd-sscape
1179 ----------------- 1235 -----------------
@@ -1185,7 +1241,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1185 mpu_irq - MPU-401 IRQ # (PnP setup) 1241 mpu_irq - MPU-401 IRQ # (PnP setup)
1186 dma - DMA # (PnP setup) 1242 dma - DMA # (PnP setup)
1187 1243
1188 Module supports up to 8 cards. ISA PnP must be enabled. 1244 This module supports multiple cards. ISA PnP must be enabled.
1189 You need sscape_ctl tool in alsa-tools package for loading 1245 You need sscape_ctl tool in alsa-tools package for loading
1190 the microcode. 1246 the microcode.
1191 1247
@@ -1194,21 +1250,21 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1194 1250
1195 Module for AMD7930 sound chips found on Sparcs. 1251 Module for AMD7930 sound chips found on Sparcs.
1196 1252
1197 Module supports up to 8 cards. 1253 This module supports multiple cards.
1198 1254
1199 Module snd-sun-cs4231 (on sparc only) 1255 Module snd-sun-cs4231 (on sparc only)
1200 ------------------------------------- 1256 -------------------------------------
1201 1257
1202 Module for CS4231 sound chips found on Sparcs. 1258 Module for CS4231 sound chips found on Sparcs.
1203 1259
1204 Module supports up to 8 cards. 1260 This module supports multiple cards.
1205 1261
1206 Module snd-sun-dbri (on sparc only) 1262 Module snd-sun-dbri (on sparc only)
1207 ----------------------------------- 1263 -----------------------------------
1208 1264
1209 Module for DBRI sound chips found on Sparcs. 1265 Module for DBRI sound chips found on Sparcs.
1210 1266
1211 Module supports up to 8 cards. 1267 This module supports multiple cards.
1212 1268
1213 Module snd-wavefront 1269 Module snd-wavefront
1214 -------------------- 1270 --------------------
@@ -1228,7 +1284,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1228 dma2 - DMA2 # for CS4232 PCM interface. 1284 dma2 - DMA2 # for CS4232 PCM interface.
1229 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1285 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1230 1286
1231 Module supports up to 8 cards and ISA PnP. 1287 This module supports multiple cards and ISA PnP.
1232 1288
1233 Module snd-sonicvibes 1289 Module snd-sonicvibes
1234 --------------------- 1290 ---------------------
@@ -1240,7 +1296,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1240 - SoundCard must have onboard SRAM for this. 1296 - SoundCard must have onboard SRAM for this.
1241 mge - Mic Gain Enable - 1 = enable, 0 = disable (default) 1297 mge - Mic Gain Enable - 1 = enable, 0 = disable (default)
1242 1298
1243 Module supports up to 8 cards and autoprobe. 1299 This module supports multiple cards and autoprobe.
1244 1300
1245 Module snd-serial-u16550 1301 Module snd-serial-u16550
1246 ------------------------ 1302 ------------------------
@@ -1259,7 +1315,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1259 0 = Soundcanvas, 1 = MS-124T, 2 = MS-124W S/A, 1315 0 = Soundcanvas, 1 = MS-124T, 2 = MS-124W S/A,
1260 3 = MS-124W M/B, 4 = Generic 1316 3 = MS-124W M/B, 4 = Generic
1261 1317
1262 Module supports up to 8 cards. This module does not support autoprobe 1318 This module supports multiple cards. This module does not support autoprobe
1263 thus the main port must be specified!!! Other options are optional. 1319 thus the main port must be specified!!! Other options are optional.
1264 1320
1265 Module snd-trident 1321 Module snd-trident
@@ -1278,7 +1334,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1278 pcm_channels - max channels (voices) reserved for PCM 1334 pcm_channels - max channels (voices) reserved for PCM
1279 wavetable_size - max wavetable size in kB (4-?kb) 1335 wavetable_size - max wavetable size in kB (4-?kb)
1280 1336
1281 Module supports up to 8 cards and autoprobe. 1337 This module supports multiple cards and autoprobe.
1282 1338
1283 The power-management is supported. 1339 The power-management is supported.
1284 1340
@@ -1290,14 +1346,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1290 vid - Vendor ID for the device (optional) 1346 vid - Vendor ID for the device (optional)
1291 pid - Product ID for the device (optional) 1347 pid - Product ID for the device (optional)
1292 1348
1293 This module supports up to 8 cards, autoprobe and hotplugging. 1349 This module supports multiple devices, autoprobe and hotplugging.
1294 1350
1295 Module snd-usb-usx2y 1351 Module snd-usb-usx2y
1296 -------------------- 1352 --------------------
1297 1353
1298 Module for Tascam USB US-122, US-224 and US-428 devices. 1354 Module for Tascam USB US-122, US-224 and US-428 devices.
1299 1355
1300 This module supports up to 8 cards, autoprobe and hotplugging. 1356 This module supports multiple devices, autoprobe and hotplugging.
1301 1357
1302 Note: you need to load the firmware via usx2yloader utility included 1358 Note: you need to load the firmware via usx2yloader utility included
1303 in alsa-tools and alsa-firmware packages. 1359 in alsa-tools and alsa-firmware packages.
@@ -1356,6 +1412,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1356 Note: for the MPU401 on VIA823x, use snd-mpu401 driver 1412 Note: for the MPU401 on VIA823x, use snd-mpu401 driver
1357 additionally. The mpu_port option is for VIA686 chips only. 1413 additionally. The mpu_port option is for VIA686 chips only.
1358 1414
1415 The power-management is supported.
1416
1359 Module snd-via82xx-modem 1417 Module snd-via82xx-modem
1360 ------------------------ 1418 ------------------------
1361 1419
@@ -1368,6 +1426,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1368 Note: The default index value of this module is -2, i.e. the first 1426 Note: The default index value of this module is -2, i.e. the first
1369 slot is excluded. 1427 slot is excluded.
1370 1428
1429 The power-management is supported.
1430
1371 Module snd-virmidi 1431 Module snd-virmidi
1372 ------------------ 1432 ------------------
1373 1433
@@ -1375,9 +1435,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1375 This module creates virtual rawmidi devices which communicate 1435 This module creates virtual rawmidi devices which communicate
1376 to the corresponding ALSA sequencer ports. 1436 to the corresponding ALSA sequencer ports.
1377 1437
1378 midi_devs - MIDI devices # (1-8, default=4) 1438 midi_devs - MIDI devices # (1-4, default=4)
1379 1439
1380 Module supports up to 8 cards. 1440 This module supports multiple cards.
1381 1441
1382 Module snd-vx222 1442 Module snd-vx222
1383 ---------------- 1443 ----------------
@@ -1387,7 +1447,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1387 mic - Enable Microphone on V222 Mic (NYI) 1447 mic - Enable Microphone on V222 Mic (NYI)
1388 ibl - Capture IBL size. (default = 0, minimum size) 1448 ibl - Capture IBL size. (default = 0, minimum size)
1389 1449
1390 Module supports up to 8 cards. 1450 This module supports multiple cards.
1391 1451
1392 When the driver is compiled as a module and the hotplug firmware 1452 When the driver is compiled as a module and the hotplug firmware
1393 is supported, the firmware data is loaded via hotplug automatically. 1453 is supported, the firmware data is loaded via hotplug automatically.
@@ -1406,6 +1466,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1406 size is chosen. The possible IBL values can be found in 1466 size is chosen. The possible IBL values can be found in
1407 /proc/asound/cardX/vx-status proc file. 1467 /proc/asound/cardX/vx-status proc file.
1408 1468
1469 The power-management is supported.
1470
1409 Module snd-vxpocket 1471 Module snd-vxpocket
1410 ------------------- 1472 -------------------
1411 1473
@@ -1413,7 +1475,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1413 1475
1414 ibl - Capture IBL size. (default = 0, minimum size) 1476 ibl - Capture IBL size. (default = 0, minimum size)
1415 1477
1416 Module supports up to 8 cards. The module is compiled only when 1478 This module supports multiple cards. The module is compiled only when
1417 PCMCIA is supported on kernel. 1479 PCMCIA is supported on kernel.
1418 1480
1419 With the older 2.6.x kernel, to activate the driver via the card 1481 With the older 2.6.x kernel, to activate the driver via the card
@@ -1434,6 +1496,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1434 Note2: snd-vxp440 driver is merged to snd-vxpocket driver since 1496 Note2: snd-vxp440 driver is merged to snd-vxpocket driver since
1435 ALSA 1.0.10. 1497 ALSA 1.0.10.
1436 1498
1499 The power-management is supported.
1500
1437 Module snd-ymfpci 1501 Module snd-ymfpci
1438 ----------------- 1502 -----------------
1439 1503
@@ -1447,7 +1511,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1447 1 (auto-detect) 1511 1 (auto-detect)
1448 rear_switch - enable shared rear/line-in switch (bool) 1512 rear_switch - enable shared rear/line-in switch (bool)
1449 1513
1450 Module supports autoprobe and multiple chips (max 8). 1514 This module supports autoprobe and multiple chips.
1451 1515
1452 The power-management is supported. 1516 The power-management is supported.
1453 1517
@@ -1458,6 +1522,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1458 1522
1459 Note: the driver is build only when CONFIG_ISA is set. 1523 Note: the driver is build only when CONFIG_ISA is set.
1460 1524
1525 The power-management is supported.
1526
1461 1527
1462AC97 Quirk Option 1528AC97 Quirk Option
1463================= 1529=================
@@ -1474,7 +1540,7 @@ the proper value with this option.
1474 1540
1475The following strings are accepted: 1541The following strings are accepted:
1476 - default Don't override the default setting 1542 - default Don't override the default setting
1477 - disable Disable the quirk 1543 - none Disable the quirk
1478 - hp_only Bind Master and Headphone controls as a single control 1544 - hp_only Bind Master and Headphone controls as a single control
1479 - swap_hp Swap headphone and master controls 1545 - swap_hp Swap headphone and master controls
1480 - swap_surround Swap master and surround controls 1546 - swap_surround Swap master and surround controls
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 260334c98d95..e651ed8d1e6f 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -18,8 +18,8 @@
18 </affiliation> 18 </affiliation>
19 </author> 19 </author>
20 20
21 <date>October 6, 2005</date> 21 <date>November 17, 2005</date>
22 <edition>0.3.5</edition> 22 <edition>0.3.6</edition>
23 23
24 <abstract> 24 <abstract>
25 <para> 25 <para>
@@ -403,9 +403,8 @@
403 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 403 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
404 404
405 /* definition of the chip-specific record */ 405 /* definition of the chip-specific record */
406 typedef struct snd_mychip mychip_t; 406 struct mychip {
407 struct snd_mychip { 407 struct snd_card *card;
408 snd_card_t *card;
409 // rest of implementation will be in the section 408 // rest of implementation will be in the section
410 // "PCI Resource Managements" 409 // "PCI Resource Managements"
411 }; 410 };
@@ -413,7 +412,7 @@
413 /* chip-specific destructor 412 /* chip-specific destructor
414 * (see "PCI Resource Managements") 413 * (see "PCI Resource Managements")
415 */ 414 */
416 static int snd_mychip_free(mychip_t *chip) 415 static int snd_mychip_free(struct mychip *chip)
417 { 416 {
418 .... // will be implemented later... 417 .... // will be implemented later...
419 } 418 }
@@ -421,22 +420,21 @@
421 /* component-destructor 420 /* component-destructor
422 * (see "Management of Cards and Components") 421 * (see "Management of Cards and Components")
423 */ 422 */
424 static int snd_mychip_dev_free(snd_device_t *device) 423 static int snd_mychip_dev_free(struct snd_device *device)
425 { 424 {
426 mychip_t *chip = device->device_data; 425 return snd_mychip_free(device->device_data);
427 return snd_mychip_free(chip);
428 } 426 }
429 427
430 /* chip-specific constructor 428 /* chip-specific constructor
431 * (see "Management of Cards and Components") 429 * (see "Management of Cards and Components")
432 */ 430 */
433 static int __devinit snd_mychip_create(snd_card_t *card, 431 static int __devinit snd_mychip_create(struct snd_card *card,
434 struct pci_dev *pci, 432 struct pci_dev *pci,
435 mychip_t **rchip) 433 struct mychip **rchip)
436 { 434 {
437 mychip_t *chip; 435 struct mychip *chip;
438 int err; 436 int err;
439 static snd_device_ops_t ops = { 437 static struct snd_device_ops ops = {
440 .dev_free = snd_mychip_dev_free, 438 .dev_free = snd_mychip_dev_free,
441 }; 439 };
442 440
@@ -474,8 +472,8 @@
474 const struct pci_device_id *pci_id) 472 const struct pci_device_id *pci_id)
475 { 473 {
476 static int dev; 474 static int dev;
477 snd_card_t *card; 475 struct snd_card *card;
478 mychip_t *chip; 476 struct mychip *chip;
479 int err; 477 int err;
480 478
481 /* (1) */ 479 /* (1) */
@@ -582,7 +580,7 @@
582 <informalexample> 580 <informalexample>
583 <programlisting> 581 <programlisting>
584<![CDATA[ 582<![CDATA[
585 snd_card_t *card; 583 struct snd_card *card;
586 .... 584 ....
587 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 585 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
588]]> 586]]>
@@ -605,7 +603,7 @@
605 <informalexample> 603 <informalexample>
606 <programlisting> 604 <programlisting>
607<![CDATA[ 605<![CDATA[
608 mychip_t *chip; 606 struct mychip *chip;
609 .... 607 ....
610 if ((err = snd_mychip_create(card, pci, &chip)) < 0) { 608 if ((err = snd_mychip_create(card, pci, &chip)) < 0) {
611 snd_card_free(card); 609 snd_card_free(card);
@@ -806,7 +804,7 @@
806 <informalexample> 804 <informalexample>
807 <programlisting> 805 <programlisting>
808<![CDATA[ 806<![CDATA[
809 snd_card_t *card; 807 struct snd_card *card;
810 card = snd_card_new(index, id, module, extra_size); 808 card = snd_card_new(index, id, module, extra_size);
811]]> 809]]>
812 </programlisting> 810 </programlisting>
@@ -830,7 +828,7 @@
830 <para> 828 <para>
831 After the card is created, you can attach the components 829 After the card is created, you can attach the components
832 (devices) to the card instance. On ALSA driver, a component is 830 (devices) to the card instance. On ALSA driver, a component is
833 represented as a <type>snd_device_t</type> object. 831 represented as a struct <structname>snd_device</structname> object.
834 A component can be a PCM instance, a control interface, a raw 832 A component can be a PCM instance, a control interface, a raw
835 MIDI interface, etc. Each of such instances has one component 833 MIDI interface, etc. Each of such instances has one component
836 entry. 834 entry.
@@ -891,14 +889,11 @@
891 The chip-specific information, e.g. the i/o port address, its 889 The chip-specific information, e.g. the i/o port address, its
892 resource pointer, or the irq number, is stored in the 890 resource pointer, or the irq number, is stored in the
893 chip-specific record. 891 chip-specific record.
894 Usually, the chip-specific record is typedef'ed as
895 <type>xxx_t</type> like the following:
896 892
897 <informalexample> 893 <informalexample>
898 <programlisting> 894 <programlisting>
899<![CDATA[ 895<![CDATA[
900 typedef struct snd_mychip mychip_t; 896 struct mychip {
901 struct snd_mychip {
902 .... 897 ....
903 }; 898 };
904]]> 899]]>
@@ -918,12 +913,12 @@
918 <informalexample> 913 <informalexample>
919 <programlisting> 914 <programlisting>
920<![CDATA[ 915<![CDATA[
921 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(mychip_t)); 916 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip));
922]]> 917]]>
923 </programlisting> 918 </programlisting>
924 </informalexample> 919 </informalexample>
925 920
926 whether <type>mychip_t</type> is the type of the chip record. 921 whether struct <structname>mychip</structname> is the type of the chip record.
927 </para> 922 </para>
928 923
929 <para> 924 <para>
@@ -932,7 +927,7 @@
932 <informalexample> 927 <informalexample>
933 <programlisting> 928 <programlisting>
934<![CDATA[ 929<![CDATA[
935 mychip_t *chip = (mychip_t *)card->private_data; 930 struct mychip *chip = (struct mychip *)card->private_data;
936]]> 931]]>
937 </programlisting> 932 </programlisting>
938 </informalexample> 933 </informalexample>
@@ -954,8 +949,8 @@
954 <informalexample> 949 <informalexample>
955 <programlisting> 950 <programlisting>
956<![CDATA[ 951<![CDATA[
957 snd_card_t *card; 952 struct snd_card *card;
958 mychip_t *chip; 953 struct mychip *chip;
959 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); 954 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
960 ..... 955 .....
961 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 956 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
@@ -971,8 +966,8 @@
971 <informalexample> 966 <informalexample>
972 <programlisting> 967 <programlisting>
973<![CDATA[ 968<![CDATA[
974 struct snd_mychip { 969 struct mychip {
975 snd_card_t *card; 970 struct snd_card *card;
976 .... 971 ....
977 }; 972 };
978]]> 973]]>
@@ -1000,7 +995,7 @@
1000 <informalexample> 995 <informalexample>
1001 <programlisting> 996 <programlisting>
1002<![CDATA[ 997<![CDATA[
1003 static snd_device_ops_t ops = { 998 static struct snd_device_ops ops = {
1004 .dev_free = snd_mychip_dev_free, 999 .dev_free = snd_mychip_dev_free,
1005 }; 1000 };
1006 .... 1001 ....
@@ -1018,10 +1013,9 @@
1018 <informalexample> 1013 <informalexample>
1019 <programlisting> 1014 <programlisting>
1020<![CDATA[ 1015<![CDATA[
1021 static int snd_mychip_dev_free(snd_device_t *device) 1016 static int snd_mychip_dev_free(struct snd_device *device)
1022 { 1017 {
1023 mychip_t *chip = device->device_data; 1018 return snd_mychip_free(device->device_data);
1024 return snd_mychip_free(chip);
1025 } 1019 }
1026]]> 1020]]>
1027 </programlisting> 1021 </programlisting>
@@ -1087,15 +1081,15 @@
1087 <title>PCI Resource Managements Example</title> 1081 <title>PCI Resource Managements Example</title>
1088 <programlisting> 1082 <programlisting>
1089<![CDATA[ 1083<![CDATA[
1090 struct snd_mychip { 1084 struct mychip {
1091 snd_card_t *card; 1085 struct snd_card *card;
1092 struct pci_dev *pci; 1086 struct pci_dev *pci;
1093 1087
1094 unsigned long port; 1088 unsigned long port;
1095 int irq; 1089 int irq;
1096 }; 1090 };
1097 1091
1098 static int snd_mychip_free(mychip_t *chip) 1092 static int snd_mychip_free(struct mychip *chip)
1099 { 1093 {
1100 /* disable hardware here if any */ 1094 /* disable hardware here if any */
1101 .... // (not implemented in this document) 1095 .... // (not implemented in this document)
@@ -1113,13 +1107,13 @@
1113 } 1107 }
1114 1108
1115 /* chip-specific constructor */ 1109 /* chip-specific constructor */
1116 static int __devinit snd_mychip_create(snd_card_t *card, 1110 static int __devinit snd_mychip_create(struct snd_card *card,
1117 struct pci_dev *pci, 1111 struct pci_dev *pci,
1118 mychip_t **rchip) 1112 struct mychip **rchip)
1119 { 1113 {
1120 mychip_t *chip; 1114 struct mychip *chip;
1121 int err; 1115 int err;
1122 static snd_device_ops_t ops = { 1116 static struct snd_device_ops ops = {
1123 .dev_free = snd_mychip_dev_free, 1117 .dev_free = snd_mychip_dev_free,
1124 }; 1118 };
1125 1119
@@ -1155,8 +1149,7 @@
1155 } 1149 }
1156 chip->port = pci_resource_start(pci, 0); 1150 chip->port = pci_resource_start(pci, 0);
1157 if (request_irq(pci->irq, snd_mychip_interrupt, 1151 if (request_irq(pci->irq, snd_mychip_interrupt,
1158 SA_INTERRUPT|SA_SHIRQ, "My Chip", 1152 SA_INTERRUPT|SA_SHIRQ, "My Chip", chip)) {
1159 (void *)chip)) {
1160 printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 1153 printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
1161 snd_mychip_free(chip); 1154 snd_mychip_free(chip);
1162 return -EBUSY; 1155 return -EBUSY;
@@ -1268,14 +1261,14 @@
1268 1261
1269 <para> 1262 <para>
1270 Now assume that this PCI device has an I/O port with 8 bytes 1263 Now assume that this PCI device has an I/O port with 8 bytes
1271 and an interrupt. Then <type>mychip_t</type> will have the 1264 and an interrupt. Then struct <structname>mychip</structname> will have the
1272 following fields: 1265 following fields:
1273 1266
1274 <informalexample> 1267 <informalexample>
1275 <programlisting> 1268 <programlisting>
1276<![CDATA[ 1269<![CDATA[
1277 struct snd_mychip { 1270 struct mychip {
1278 snd_card_t *card; 1271 struct snd_card *card;
1279 1272
1280 unsigned long port; 1273 unsigned long port;
1281 int irq; 1274 int irq;
@@ -1330,8 +1323,7 @@
1330 <programlisting> 1323 <programlisting>
1331<![CDATA[ 1324<![CDATA[
1332 if (request_irq(pci->irq, snd_mychip_interrupt, 1325 if (request_irq(pci->irq, snd_mychip_interrupt,
1333 SA_INTERRUPT|SA_SHIRQ, "My Chip", 1326 SA_INTERRUPT|SA_SHIRQ, "My Chip", chip)) {
1334 (void *)chip)) {
1335 printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 1327 printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
1336 snd_mychip_free(chip); 1328 snd_mychip_free(chip);
1337 return -EBUSY; 1329 return -EBUSY;
@@ -1372,7 +1364,7 @@
1372 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 1364 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id,
1373 struct pt_regs *regs) 1365 struct pt_regs *regs)
1374 { 1366 {
1375 mychip_t *chip = dev_id; 1367 struct mychip *chip = dev_id;
1376 .... 1368 ....
1377 return IRQ_HANDLED; 1369 return IRQ_HANDLED;
1378 } 1370 }
@@ -1487,7 +1479,7 @@
1487 <informalexample> 1479 <informalexample>
1488 <programlisting> 1480 <programlisting>
1489<![CDATA[ 1481<![CDATA[
1490 struct snd_mychip { 1482 struct mychip {
1491 .... 1483 ....
1492 unsigned long iobase_phys; 1484 unsigned long iobase_phys;
1493 void __iomem *iobase_virt; 1485 void __iomem *iobase_virt;
@@ -1517,7 +1509,7 @@
1517 <informalexample> 1509 <informalexample>
1518 <programlisting> 1510 <programlisting>
1519<![CDATA[ 1511<![CDATA[
1520 static int snd_mychip_free(mychip_t *chip) 1512 static int snd_mychip_free(struct mychip *chip)
1521 { 1513 {
1522 .... 1514 ....
1523 if (chip->iobase_virt) 1515 if (chip->iobase_virt)
@@ -1537,7 +1529,7 @@
1537 <title>Registration of Device Struct</title> 1529 <title>Registration of Device Struct</title>
1538 <para> 1530 <para>
1539 At some point, typically after calling <function>snd_device_new()</function>, 1531 At some point, typically after calling <function>snd_device_new()</function>,
1540 you need to register the <structname>struct device</structname> of the chip 1532 you need to register the struct <structname>device</structname> of the chip
1541 you're handling for udev and co. ALSA provides a macro for compatibility with 1533 you're handling for udev and co. ALSA provides a macro for compatibility with
1542 older kernels. Simply call like the following: 1534 older kernels. Simply call like the following:
1543 <informalexample> 1535 <informalexample>
@@ -1739,7 +1731,7 @@
1739 .... 1731 ....
1740 1732
1741 /* hardware definition */ 1733 /* hardware definition */
1742 static snd_pcm_hardware_t snd_mychip_playback_hw = { 1734 static struct snd_pcm_hardware snd_mychip_playback_hw = {
1743 .info = (SNDRV_PCM_INFO_MMAP | 1735 .info = (SNDRV_PCM_INFO_MMAP |
1744 SNDRV_PCM_INFO_INTERLEAVED | 1736 SNDRV_PCM_INFO_INTERLEAVED |
1745 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1737 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1758,7 +1750,7 @@
1758 }; 1750 };
1759 1751
1760 /* hardware definition */ 1752 /* hardware definition */
1761 static snd_pcm_hardware_t snd_mychip_capture_hw = { 1753 static struct snd_pcm_hardware snd_mychip_capture_hw = {
1762 .info = (SNDRV_PCM_INFO_MMAP | 1754 .info = (SNDRV_PCM_INFO_MMAP |
1763 SNDRV_PCM_INFO_INTERLEAVED | 1755 SNDRV_PCM_INFO_INTERLEAVED |
1764 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1756 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1777,10 +1769,10 @@
1777 }; 1769 };
1778 1770
1779 /* open callback */ 1771 /* open callback */
1780 static int snd_mychip_playback_open(snd_pcm_substream_t *substream) 1772 static int snd_mychip_playback_open(struct snd_pcm_substream *substream)
1781 { 1773 {
1782 mychip_t *chip = snd_pcm_substream_chip(substream); 1774 struct mychip *chip = snd_pcm_substream_chip(substream);
1783 snd_pcm_runtime_t *runtime = substream->runtime; 1775 struct snd_pcm_runtime *runtime = substream->runtime;
1784 1776
1785 runtime->hw = snd_mychip_playback_hw; 1777 runtime->hw = snd_mychip_playback_hw;
1786 // more hardware-initialization will be done here 1778 // more hardware-initialization will be done here
@@ -1788,19 +1780,19 @@
1788 } 1780 }
1789 1781
1790 /* close callback */ 1782 /* close callback */
1791 static int snd_mychip_playback_close(snd_pcm_substream_t *substream) 1783 static int snd_mychip_playback_close(struct snd_pcm_substream *substream)
1792 { 1784 {
1793 mychip_t *chip = snd_pcm_substream_chip(substream); 1785 struct mychip *chip = snd_pcm_substream_chip(substream);
1794 // the hardware-specific codes will be here 1786 // the hardware-specific codes will be here
1795 return 0; 1787 return 0;
1796 1788
1797 } 1789 }
1798 1790
1799 /* open callback */ 1791 /* open callback */
1800 static int snd_mychip_capture_open(snd_pcm_substream_t *substream) 1792 static int snd_mychip_capture_open(struct snd_pcm_substream *substream)
1801 { 1793 {
1802 mychip_t *chip = snd_pcm_substream_chip(substream); 1794 struct mychip *chip = snd_pcm_substream_chip(substream);
1803 snd_pcm_runtime_t *runtime = substream->runtime; 1795 struct snd_pcm_runtime *runtime = substream->runtime;
1804 1796
1805 runtime->hw = snd_mychip_capture_hw; 1797 runtime->hw = snd_mychip_capture_hw;
1806 // more hardware-initialization will be done here 1798 // more hardware-initialization will be done here
@@ -1808,33 +1800,33 @@
1808 } 1800 }
1809 1801
1810 /* close callback */ 1802 /* close callback */
1811 static int snd_mychip_capture_close(snd_pcm_substream_t *substream) 1803 static int snd_mychip_capture_close(struct snd_pcm_substream *substream)
1812 { 1804 {
1813 mychip_t *chip = snd_pcm_substream_chip(substream); 1805 struct mychip *chip = snd_pcm_substream_chip(substream);
1814 // the hardware-specific codes will be here 1806 // the hardware-specific codes will be here
1815 return 0; 1807 return 0;
1816 1808
1817 } 1809 }
1818 1810
1819 /* hw_params callback */ 1811 /* hw_params callback */
1820 static int snd_mychip_pcm_hw_params(snd_pcm_substream_t *substream, 1812 static int snd_mychip_pcm_hw_params(struct snd_pcm_substream *substream,
1821 snd_pcm_hw_params_t * hw_params) 1813 struct snd_pcm_hw_params *hw_params)
1822 { 1814 {
1823 return snd_pcm_lib_malloc_pages(substream, 1815 return snd_pcm_lib_malloc_pages(substream,
1824 params_buffer_bytes(hw_params)); 1816 params_buffer_bytes(hw_params));
1825 } 1817 }
1826 1818
1827 /* hw_free callback */ 1819 /* hw_free callback */
1828 static int snd_mychip_pcm_hw_free(snd_pcm_substream_t *substream) 1820 static int snd_mychip_pcm_hw_free(struct snd_pcm_substream *substream)
1829 { 1821 {
1830 return snd_pcm_lib_free_pages(substream); 1822 return snd_pcm_lib_free_pages(substream);
1831 } 1823 }
1832 1824
1833 /* prepare callback */ 1825 /* prepare callback */
1834 static int snd_mychip_pcm_prepare(snd_pcm_substream_t *substream) 1826 static int snd_mychip_pcm_prepare(struct snd_pcm_substream *substream)
1835 { 1827 {
1836 mychip_t *chip = snd_pcm_substream_chip(substream); 1828 struct mychip *chip = snd_pcm_substream_chip(substream);
1837 snd_pcm_runtime_t *runtime = substream->runtime; 1829 struct snd_pcm_runtime *runtime = substream->runtime;
1838 1830
1839 /* set up the hardware with the current configuration 1831 /* set up the hardware with the current configuration
1840 * for example... 1832 * for example...
@@ -1849,7 +1841,7 @@
1849 } 1841 }
1850 1842
1851 /* trigger callback */ 1843 /* trigger callback */
1852 static int snd_mychip_pcm_trigger(snd_pcm_substream_t *substream, 1844 static int snd_mychip_pcm_trigger(struct snd_pcm_substream *substream,
1853 int cmd) 1845 int cmd)
1854 { 1846 {
1855 switch (cmd) { 1847 switch (cmd) {
@@ -1866,9 +1858,9 @@
1866 1858
1867 /* pointer callback */ 1859 /* pointer callback */
1868 static snd_pcm_uframes_t 1860 static snd_pcm_uframes_t
1869 snd_mychip_pcm_pointer(snd_pcm_substream_t *substream) 1861 snd_mychip_pcm_pointer(struct snd_pcm_substream *substream)
1870 { 1862 {
1871 mychip_t *chip = snd_pcm_substream_chip(substream); 1863 struct mychip *chip = snd_pcm_substream_chip(substream);
1872 unsigned int current_ptr; 1864 unsigned int current_ptr;
1873 1865
1874 /* get the current hardware pointer */ 1866 /* get the current hardware pointer */
@@ -1877,7 +1869,7 @@
1877 } 1869 }
1878 1870
1879 /* operators */ 1871 /* operators */
1880 static snd_pcm_ops_t snd_mychip_playback_ops = { 1872 static struct snd_pcm_ops snd_mychip_playback_ops = {
1881 .open = snd_mychip_playback_open, 1873 .open = snd_mychip_playback_open,
1882 .close = snd_mychip_playback_close, 1874 .close = snd_mychip_playback_close,
1883 .ioctl = snd_pcm_lib_ioctl, 1875 .ioctl = snd_pcm_lib_ioctl,
@@ -1889,7 +1881,7 @@
1889 }; 1881 };
1890 1882
1891 /* operators */ 1883 /* operators */
1892 static snd_pcm_ops_t snd_mychip_capture_ops = { 1884 static struct snd_pcm_ops snd_mychip_capture_ops = {
1893 .open = snd_mychip_capture_open, 1885 .open = snd_mychip_capture_open,
1894 .close = snd_mychip_capture_close, 1886 .close = snd_mychip_capture_close,
1895 .ioctl = snd_pcm_lib_ioctl, 1887 .ioctl = snd_pcm_lib_ioctl,
@@ -1905,9 +1897,9 @@
1905 */ 1897 */
1906 1898
1907 /* create a pcm device */ 1899 /* create a pcm device */
1908 static int __devinit snd_mychip_new_pcm(mychip_t *chip) 1900 static int __devinit snd_mychip_new_pcm(struct mychip *chip)
1909 { 1901 {
1910 snd_pcm_t *pcm; 1902 struct snd_pcm *pcm;
1911 int err; 1903 int err;
1912 1904
1913 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, 1905 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1,
@@ -1944,9 +1936,9 @@
1944 <informalexample> 1936 <informalexample>
1945 <programlisting> 1937 <programlisting>
1946<![CDATA[ 1938<![CDATA[
1947 static int __devinit snd_mychip_new_pcm(mychip_t *chip) 1939 static int __devinit snd_mychip_new_pcm(struct mychip *chip)
1948 { 1940 {
1949 snd_pcm_t *pcm; 1941 struct snd_pcm *pcm;
1950 int err; 1942 int err;
1951 1943
1952 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, 1944 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1,
@@ -1989,13 +1981,13 @@
1989 specify more numbers, but they must be handled properly in 1981 specify more numbers, but they must be handled properly in
1990 open/close, etc. callbacks. When you need to know which 1982 open/close, etc. callbacks. When you need to know which
1991 substream you are referring to, then it can be obtained from 1983 substream you are referring to, then it can be obtained from
1992 <type>snd_pcm_substream_t</type> data passed to each callback 1984 struct <structname>snd_pcm_substream</structname> data passed to each callback
1993 as follows: 1985 as follows:
1994 1986
1995 <informalexample> 1987 <informalexample>
1996 <programlisting> 1988 <programlisting>
1997<![CDATA[ 1989<![CDATA[
1998 snd_pcm_substream_t *substream; 1990 struct snd_pcm_substream *substream;
1999 int index = substream->number; 1991 int index = substream->number;
2000]]> 1992]]>
2001 </programlisting> 1993 </programlisting>
@@ -2024,7 +2016,7 @@
2024 <informalexample> 2016 <informalexample>
2025 <programlisting> 2017 <programlisting>
2026<![CDATA[ 2018<![CDATA[
2027 static snd_pcm_ops_t snd_mychip_playback_ops = { 2019 static struct snd_pcm_ops snd_mychip_playback_ops = {
2028 .open = snd_mychip_pcm_open, 2020 .open = snd_mychip_pcm_open,
2029 .close = snd_mychip_pcm_close, 2021 .close = snd_mychip_pcm_close,
2030 .ioctl = snd_pcm_lib_ioctl, 2022 .ioctl = snd_pcm_lib_ioctl,
@@ -2102,18 +2094,18 @@
2102 <title>PCM Instance with a Destructor</title> 2094 <title>PCM Instance with a Destructor</title>
2103 <programlisting> 2095 <programlisting>
2104<![CDATA[ 2096<![CDATA[
2105 static void mychip_pcm_free(snd_pcm_t *pcm) 2097 static void mychip_pcm_free(struct snd_pcm *pcm)
2106 { 2098 {
2107 mychip_t *chip = snd_pcm_chip(pcm); 2099 struct mychip *chip = snd_pcm_chip(pcm);
2108 /* free your own data */ 2100 /* free your own data */
2109 kfree(chip->my_private_pcm_data); 2101 kfree(chip->my_private_pcm_data);
2110 // do what you like else 2102 // do what you like else
2111 .... 2103 ....
2112 } 2104 }
2113 2105
2114 static int __devinit snd_mychip_new_pcm(mychip_t *chip) 2106 static int __devinit snd_mychip_new_pcm(struct mychip *chip)
2115 { 2107 {
2116 snd_pcm_t *pcm; 2108 struct snd_pcm *pcm;
2117 .... 2109 ....
2118 /* allocate your own data */ 2110 /* allocate your own data */
2119 chip->my_private_pcm_data = kmalloc(...); 2111 chip->my_private_pcm_data = kmalloc(...);
@@ -2149,7 +2141,7 @@
2149<![CDATA[ 2141<![CDATA[
2150struct _snd_pcm_runtime { 2142struct _snd_pcm_runtime {
2151 /* -- Status -- */ 2143 /* -- Status -- */
2152 snd_pcm_substream_t *trigger_master; 2144 struct snd_pcm_substream *trigger_master;
2153 snd_timestamp_t trigger_tstamp; /* trigger timestamp */ 2145 snd_timestamp_t trigger_tstamp; /* trigger timestamp */
2154 int overrange; 2146 int overrange;
2155 snd_pcm_uframes_t avail_max; 2147 snd_pcm_uframes_t avail_max;
@@ -2192,8 +2184,8 @@ struct _snd_pcm_runtime {
2192 snd_pcm_sync_id_t sync; /* hardware synchronization ID */ 2184 snd_pcm_sync_id_t sync; /* hardware synchronization ID */
2193 2185
2194 /* -- mmap -- */ 2186 /* -- mmap -- */
2195 volatile snd_pcm_mmap_status_t *status; 2187 volatile struct snd_pcm_mmap_status *status;
2196 volatile snd_pcm_mmap_control_t *control; 2188 volatile struct snd_pcm_mmap_control *control;
2197 atomic_t mmap_count; 2189 atomic_t mmap_count;
2198 2190
2199 /* -- locking / scheduling -- */ 2191 /* -- locking / scheduling -- */
@@ -2204,15 +2196,15 @@ struct _snd_pcm_runtime {
2204 2196
2205 /* -- private section -- */ 2197 /* -- private section -- */
2206 void *private_data; 2198 void *private_data;
2207 void (*private_free)(snd_pcm_runtime_t *runtime); 2199 void (*private_free)(struct snd_pcm_runtime *runtime);
2208 2200
2209 /* -- hardware description -- */ 2201 /* -- hardware description -- */
2210 snd_pcm_hardware_t hw; 2202 struct snd_pcm_hardware hw;
2211 snd_pcm_hw_constraints_t hw_constraints; 2203 struct snd_pcm_hw_constraints hw_constraints;
2212 2204
2213 /* -- interrupt callbacks -- */ 2205 /* -- interrupt callbacks -- */
2214 void (*transfer_ack_begin)(snd_pcm_substream_t *substream); 2206 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
2215 void (*transfer_ack_end)(snd_pcm_substream_t *substream); 2207 void (*transfer_ack_end)(struct snd_pcm_substream *substream);
2216 2208
2217 /* -- timer -- */ 2209 /* -- timer -- */
2218 unsigned int timer_resolution; /* timer resolution */ 2210 unsigned int timer_resolution; /* timer resolution */
@@ -2226,7 +2218,7 @@ struct _snd_pcm_runtime {
2226 2218
2227#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 2219#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
2228 /* -- OSS things -- */ 2220 /* -- OSS things -- */
2229 snd_pcm_oss_runtime_t oss; 2221 struct snd_pcm_oss_runtime oss;
2230#endif 2222#endif
2231}; 2223};
2232]]> 2224]]>
@@ -2252,7 +2244,7 @@ struct _snd_pcm_runtime {
2252 <section id="pcm-interface-runtime-hw"> 2244 <section id="pcm-interface-runtime-hw">
2253 <title>Hardware Description</title> 2245 <title>Hardware Description</title>
2254 <para> 2246 <para>
2255 The hardware descriptor (<type>snd_pcm_hardware_t</type>) 2247 The hardware descriptor (struct <structname>snd_pcm_hardware</structname>)
2256 contains the definitions of the fundamental hardware 2248 contains the definitions of the fundamental hardware
2257 configuration. Above all, you'll need to define this in 2249 configuration. Above all, you'll need to define this in
2258 <link linkend="pcm-interface-operators-open-callback"><citetitle> 2250 <link linkend="pcm-interface-operators-open-callback"><citetitle>
@@ -2267,7 +2259,7 @@ struct _snd_pcm_runtime {
2267 <informalexample> 2259 <informalexample>
2268 <programlisting> 2260 <programlisting>
2269<![CDATA[ 2261<![CDATA[
2270 snd_pcm_runtime_t *runtime = substream->runtime; 2262 struct snd_pcm_runtime *runtime = substream->runtime;
2271 ... 2263 ...
2272 runtime->hw = snd_mychip_playback_hw; /* common definition */ 2264 runtime->hw = snd_mychip_playback_hw; /* common definition */
2273 if (chip->model == VERY_OLD_ONE) 2265 if (chip->model == VERY_OLD_ONE)
@@ -2282,7 +2274,7 @@ struct _snd_pcm_runtime {
2282 <informalexample> 2274 <informalexample>
2283 <programlisting> 2275 <programlisting>
2284<![CDATA[ 2276<![CDATA[
2285 static snd_pcm_hardware_t snd_mychip_playback_hw = { 2277 static struct snd_pcm_hardware snd_mychip_playback_hw = {
2286 .info = (SNDRV_PCM_INFO_MMAP | 2278 .info = (SNDRV_PCM_INFO_MMAP |
2287 SNDRV_PCM_INFO_INTERLEAVED | 2279 SNDRV_PCM_INFO_INTERLEAVED |
2288 SNDRV_PCM_INFO_BLOCK_TRANSFER | 2280 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -2337,9 +2329,14 @@ struct _snd_pcm_runtime {
2337 <constant>PAUSE</constant> bit means that the pcm supports the 2329 <constant>PAUSE</constant> bit means that the pcm supports the
2338 <quote>pause</quote> operation, while the 2330 <quote>pause</quote> operation, while the
2339 <constant>RESUME</constant> bit means that the pcm supports 2331 <constant>RESUME</constant> bit means that the pcm supports
2340 the <quote>suspend/resume</quote> operation. If these flags 2332 the full <quote>suspend/resume</quote> operation.
2341 are set, the <structfield>trigger</structfield> callback below 2333 If <constant>PAUSE</constant> flag is set,
2342 must handle the corresponding commands. 2334 the <structfield>trigger</structfield> callback below
2335 must handle the corresponding (pause push/release) commands.
2336 The suspend/resume trigger commands can be defined even without
2337 <constant>RESUME</constant> flag. See <link
2338 linkend="power-management"><citetitle>
2339 Power Management</citetitle></link> section for details.
2343 </para> 2340 </para>
2344 2341
2345 <para> 2342 <para>
@@ -2512,7 +2509,7 @@ struct _snd_pcm_runtime {
2512 <title>Running Status</title> 2509 <title>Running Status</title>
2513 <para> 2510 <para>
2514 The running status can be referred via <constant>runtime-&gt;status</constant>. 2511 The running status can be referred via <constant>runtime-&gt;status</constant>.
2515 This is the pointer to <type>snd_pcm_mmap_status_t</type> 2512 This is the pointer to struct <structname>snd_pcm_mmap_status</structname>
2516 record. For example, you can get the current DMA hardware 2513 record. For example, you can get the current DMA hardware
2517 pointer via <constant>runtime-&gt;status-&gt;hw_ptr</constant>. 2514 pointer via <constant>runtime-&gt;status-&gt;hw_ptr</constant>.
2518 </para> 2515 </para>
@@ -2520,7 +2517,7 @@ struct _snd_pcm_runtime {
2520 <para> 2517 <para>
2521 The DMA application pointer can be referred via 2518 The DMA application pointer can be referred via
2522 <constant>runtime-&gt;control</constant>, which points 2519 <constant>runtime-&gt;control</constant>, which points
2523 <type>snd_pcm_mmap_control_t</type> record. 2520 struct <structname>snd_pcm_mmap_control</structname> record.
2524 However, accessing directly to this value is not recommended. 2521 However, accessing directly to this value is not recommended.
2525 </para> 2522 </para>
2526 </section> 2523 </section>
@@ -2542,9 +2539,9 @@ struct _snd_pcm_runtime {
2542 <informalexample> 2539 <informalexample>
2543 <programlisting> 2540 <programlisting>
2544<![CDATA[ 2541<![CDATA[
2545 static int snd_xxx_open(snd_pcm_substream_t *substream) 2542 static int snd_xxx_open(struct snd_pcm_substream *substream)
2546 { 2543 {
2547 my_pcm_data_t *data; 2544 struct my_pcm_data *data;
2548 .... 2545 ....
2549 data = kmalloc(sizeof(*data), GFP_KERNEL); 2546 data = kmalloc(sizeof(*data), GFP_KERNEL);
2550 substream->runtime->private_data = data; 2547 substream->runtime->private_data = data;
@@ -2586,7 +2583,7 @@ struct _snd_pcm_runtime {
2586 2583
2587 <para> 2584 <para>
2588 The callback function takes at least the argument with 2585 The callback function takes at least the argument with
2589 <type>snd_pcm_substream_t</type> pointer. For retrieving the 2586 <structname>snd_pcm_substream</structname> pointer. For retrieving the
2590 chip record from the given substream instance, you can use the 2587 chip record from the given substream instance, you can use the
2591 following macro. 2588 following macro.
2592 2589
@@ -2594,7 +2591,7 @@ struct _snd_pcm_runtime {
2594 <programlisting> 2591 <programlisting>
2595<![CDATA[ 2592<![CDATA[
2596 int xxx() { 2593 int xxx() {
2597 mychip_t *chip = snd_pcm_substream_chip(substream); 2594 struct mychip *chip = snd_pcm_substream_chip(substream);
2598 .... 2595 ....
2599 } 2596 }
2600]]> 2597]]>
@@ -2616,7 +2613,7 @@ struct _snd_pcm_runtime {
2616 <informalexample> 2613 <informalexample>
2617 <programlisting> 2614 <programlisting>
2618<![CDATA[ 2615<![CDATA[
2619 static int snd_xxx_open(snd_pcm_substream_t *substream); 2616 static int snd_xxx_open(struct snd_pcm_substream *substream);
2620]]> 2617]]>
2621 </programlisting> 2618 </programlisting>
2622 </informalexample> 2619 </informalexample>
@@ -2631,10 +2628,10 @@ struct _snd_pcm_runtime {
2631 <informalexample> 2628 <informalexample>
2632 <programlisting> 2629 <programlisting>
2633<![CDATA[ 2630<![CDATA[
2634 static int snd_xxx_open(snd_pcm_substream_t *substream) 2631 static int snd_xxx_open(struct snd_pcm_substream *substream)
2635 { 2632 {
2636 mychip_t *chip = snd_pcm_substream_chip(substream); 2633 struct mychip *chip = snd_pcm_substream_chip(substream);
2637 snd_pcm_runtime_t *runtime = substream->runtime; 2634 struct snd_pcm_runtime *runtime = substream->runtime;
2638 2635
2639 runtime->hw = snd_mychip_playback_hw; 2636 runtime->hw = snd_mychip_playback_hw;
2640 return 0; 2637 return 0;
@@ -2667,7 +2664,7 @@ struct _snd_pcm_runtime {
2667 <informalexample> 2664 <informalexample>
2668 <programlisting> 2665 <programlisting>
2669<![CDATA[ 2666<![CDATA[
2670 static int snd_xxx_close(snd_pcm_substream_t *substream); 2667 static int snd_xxx_close(struct snd_pcm_substream *substream);
2671]]> 2668]]>
2672 </programlisting> 2669 </programlisting>
2673 </informalexample> 2670 </informalexample>
@@ -2682,7 +2679,7 @@ struct _snd_pcm_runtime {
2682 <informalexample> 2679 <informalexample>
2683 <programlisting> 2680 <programlisting>
2684<![CDATA[ 2681<![CDATA[
2685 static int snd_xxx_close(snd_pcm_substream_t *substream) 2682 static int snd_xxx_close(struct snd_pcm_substream *substream)
2686 { 2683 {
2687 .... 2684 ....
2688 kfree(substream->runtime->private_data); 2685 kfree(substream->runtime->private_data);
@@ -2709,8 +2706,8 @@ struct _snd_pcm_runtime {
2709 <informalexample> 2706 <informalexample>
2710 <programlisting> 2707 <programlisting>
2711<![CDATA[ 2708<![CDATA[
2712 static int snd_xxx_hw_params(snd_pcm_substream_t * substream, 2709 static int snd_xxx_hw_params(struct snd_pcm_substream *substream,
2713 snd_pcm_hw_params_t * hw_params); 2710 struct snd_pcm_hw_params *hw_params);
2714]]> 2711]]>
2715 </programlisting> 2712 </programlisting>
2716 </informalexample> 2713 </informalexample>
@@ -2785,7 +2782,7 @@ struct _snd_pcm_runtime {
2785 <informalexample> 2782 <informalexample>
2786 <programlisting> 2783 <programlisting>
2787<![CDATA[ 2784<![CDATA[
2788 static int snd_xxx_hw_free(snd_pcm_substream_t * substream); 2785 static int snd_xxx_hw_free(struct snd_pcm_substream *substream);
2789]]> 2786]]>
2790 </programlisting> 2787 </programlisting>
2791 </informalexample> 2788 </informalexample>
@@ -2820,7 +2817,7 @@ struct _snd_pcm_runtime {
2820 <informalexample> 2817 <informalexample>
2821 <programlisting> 2818 <programlisting>
2822<![CDATA[ 2819<![CDATA[
2823 static int snd_xxx_prepare(snd_pcm_substream_t * substream); 2820 static int snd_xxx_prepare(struct snd_pcm_substream *substream);
2824]]> 2821]]>
2825 </programlisting> 2822 </programlisting>
2826 </informalexample> 2823 </informalexample>
@@ -2869,7 +2866,7 @@ struct _snd_pcm_runtime {
2869 <informalexample> 2866 <informalexample>
2870 <programlisting> 2867 <programlisting>
2871<![CDATA[ 2868<![CDATA[
2872 static int snd_xxx_trigger(snd_pcm_substream_t * substream, int cmd); 2869 static int snd_xxx_trigger(struct snd_pcm_substream *substream, int cmd);
2873]]> 2870]]>
2874 </programlisting> 2871 </programlisting>
2875 </informalexample> 2872 </informalexample>
@@ -2911,8 +2908,8 @@ struct _snd_pcm_runtime {
2911 </para> 2908 </para>
2912 2909
2913 <para> 2910 <para>
2914 When the pcm supports the suspend/resume operation 2911 When the pcm supports the suspend/resume operation,
2915 (i.e. <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set), 2912 regardless of full or partial suspend/resume support,
2916 <constant>SUSPEND</constant> and <constant>RESUME</constant> 2913 <constant>SUSPEND</constant> and <constant>RESUME</constant>
2917 commands must be handled, too. 2914 commands must be handled, too.
2918 These commands are issued when the power-management status is 2915 These commands are issued when the power-management status is
@@ -2921,6 +2918,8 @@ struct _snd_pcm_runtime {
2921 do suspend and resume of the pcm substream, and usually, they 2918 do suspend and resume of the pcm substream, and usually, they
2922 are identical with <constant>STOP</constant> and 2919 are identical with <constant>STOP</constant> and
2923 <constant>START</constant> commands, respectively. 2920 <constant>START</constant> commands, respectively.
2921 See <link linkend="power-management"><citetitle>
2922 Power Management</citetitle></link> section for details.
2924 </para> 2923 </para>
2925 2924
2926 <para> 2925 <para>
@@ -2939,7 +2938,7 @@ struct _snd_pcm_runtime {
2939 <informalexample> 2938 <informalexample>
2940 <programlisting> 2939 <programlisting>
2941<![CDATA[ 2940<![CDATA[
2942 static snd_pcm_uframes_t snd_xxx_pointer(snd_pcm_substream_t * substream) 2941 static snd_pcm_uframes_t snd_xxx_pointer(struct snd_pcm_substream *substream)
2943]]> 2942]]>
2944 </programlisting> 2943 </programlisting>
2945 </informalexample> 2944 </informalexample>
@@ -3067,7 +3066,7 @@ struct _snd_pcm_runtime {
3067 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 3066 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id,
3068 struct pt_regs *regs) 3067 struct pt_regs *regs)
3069 { 3068 {
3070 mychip_t *chip = dev_id; 3069 struct mychip *chip = dev_id;
3071 spin_lock(&chip->lock); 3070 spin_lock(&chip->lock);
3072 .... 3071 ....
3073 if (pcm_irq_invoked(chip)) { 3072 if (pcm_irq_invoked(chip)) {
@@ -3111,7 +3110,7 @@ struct _snd_pcm_runtime {
3111 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 3110 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id,
3112 struct pt_regs *regs) 3111 struct pt_regs *regs)
3113 { 3112 {
3114 mychip_t *chip = dev_id; 3113 struct mychip *chip = dev_id;
3115 spin_lock(&chip->lock); 3114 spin_lock(&chip->lock);
3116 .... 3115 ....
3117 if (pcm_irq_invoked(chip)) { 3116 if (pcm_irq_invoked(chip)) {
@@ -3221,13 +3220,13 @@ struct _snd_pcm_runtime {
3221<![CDATA[ 3220<![CDATA[
3222 static unsigned int rates[] = 3221 static unsigned int rates[] =
3223 {4000, 10000, 22050, 44100}; 3222 {4000, 10000, 22050, 44100};
3224 static snd_pcm_hw_constraint_list_t constraints_rates = { 3223 static struct snd_pcm_hw_constraint_list constraints_rates = {
3225 .count = ARRAY_SIZE(rates), 3224 .count = ARRAY_SIZE(rates),
3226 .list = rates, 3225 .list = rates,
3227 .mask = 0, 3226 .mask = 0,
3228 }; 3227 };
3229 3228
3230 static int snd_mychip_pcm_open(snd_pcm_substream_t *substream) 3229 static int snd_mychip_pcm_open(struct snd_pcm_substream *substream)
3231 { 3230 {
3232 int err; 3231 int err;
3233 .... 3232 ....
@@ -3249,19 +3248,20 @@ struct _snd_pcm_runtime {
3249 You can even define your own constraint rules. 3248 You can even define your own constraint rules.
3250 For example, let's suppose my_chip can manage a substream of 1 channel 3249 For example, let's suppose my_chip can manage a substream of 1 channel
3251 if and only if the format is S16_LE, otherwise it supports any format 3250 if and only if the format is S16_LE, otherwise it supports any format
3252 specified in the <type>snd_pcm_hardware_t</type> stucture (or in any 3251 specified in the <structname>snd_pcm_hardware</structname> stucture (or in any
3253 other constraint_list). You can build a rule like this: 3252 other constraint_list). You can build a rule like this:
3254 3253
3255 <example> 3254 <example>
3256 <title>Example of Hardware Constraints for Channels</title> 3255 <title>Example of Hardware Constraints for Channels</title>
3257 <programlisting> 3256 <programlisting>
3258<![CDATA[ 3257<![CDATA[
3259 static int hw_rule_format_by_channels(snd_pcm_hw_params_t *params, 3258 static int hw_rule_format_by_channels(struct snd_pcm_hw_params *params,
3260 snd_pcm_hw_rule_t *rule) 3259 struct snd_pcm_hw_rule *rule)
3261 { 3260 {
3262 snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 3261 struct snd_interval *c = hw_param_interval(params,
3263 snd_mask_t *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 3262 SNDRV_PCM_HW_PARAM_CHANNELS);
3264 snd_mask_t fmt; 3263 struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
3264 struct snd_mask fmt;
3265 3265
3266 snd_mask_any(&fmt); /* Init the struct */ 3266 snd_mask_any(&fmt); /* Init the struct */
3267 if (c->min < 2) { 3267 if (c->min < 2) {
@@ -3298,12 +3298,13 @@ struct _snd_pcm_runtime {
3298 <title>Example of Hardware Constraints for Channels</title> 3298 <title>Example of Hardware Constraints for Channels</title>
3299 <programlisting> 3299 <programlisting>
3300<![CDATA[ 3300<![CDATA[
3301 static int hw_rule_channels_by_format(snd_pcm_hw_params_t *params, 3301 static int hw_rule_channels_by_format(struct snd_pcm_hw_params *params,
3302 snd_pcm_hw_rule_t *rule) 3302 struct snd_pcm_hw_rule *rule)
3303 { 3303 {
3304 snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 3304 struct snd_interval *c = hw_param_interval(params,
3305 snd_mask_t *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 3305 SNDRV_PCM_HW_PARAM_CHANNELS);
3306 snd_interval_t ch; 3306 struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
3307 struct snd_interval ch;
3307 3308
3308 snd_interval_any(&ch); 3309 snd_interval_any(&ch);
3309 if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { 3310 if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) {
@@ -3376,13 +3377,13 @@ struct _snd_pcm_runtime {
3376 callbacks: <structfield>info</structfield>, 3377 callbacks: <structfield>info</structfield>,
3377 <structfield>get</structfield> and 3378 <structfield>get</structfield> and
3378 <structfield>put</structfield>. Then, define a 3379 <structfield>put</structfield>. Then, define a
3379 <type>snd_kcontrol_new_t</type> record, such as: 3380 struct <structname>snd_kcontrol_new</structname> record, such as:
3380 3381
3381 <example> 3382 <example>
3382 <title>Definition of a Control</title> 3383 <title>Definition of a Control</title>
3383 <programlisting> 3384 <programlisting>
3384<![CDATA[ 3385<![CDATA[
3385 static snd_kcontrol_new_t my_control __devinitdata = { 3386 static struct snd_kcontrol_new my_control __devinitdata = {
3386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3387 .name = "PCM Playback Switch", 3388 .name = "PCM Playback Switch",
3388 .index = 0, 3389 .index = 0,
@@ -3599,7 +3600,7 @@ struct _snd_pcm_runtime {
3599 <para> 3600 <para>
3600 The <structfield>info</structfield> callback is used to get 3601 The <structfield>info</structfield> callback is used to get
3601 the detailed information of this control. This must store the 3602 the detailed information of this control. This must store the
3602 values of the given <type>snd_ctl_elem_info_t</type> 3603 values of the given struct <structname>snd_ctl_elem_info</structname>
3603 object. For example, for a boolean control with a single 3604 object. For example, for a boolean control with a single
3604 element will be: 3605 element will be:
3605 3606
@@ -3607,8 +3608,8 @@ struct _snd_pcm_runtime {
3607 <title>Example of info callback</title> 3608 <title>Example of info callback</title>
3608 <programlisting> 3609 <programlisting>
3609<![CDATA[ 3610<![CDATA[
3610 static int snd_myctl_info(snd_kcontrol_t *kcontrol, 3611 static int snd_myctl_info(struct snd_kcontrol *kcontrol,
3611 snd_ctl_elem_info_t *uinfo) 3612 struct snd_ctl_elem_info *uinfo)
3612 { 3613 {
3613 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 3614 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
3614 uinfo->count = 1; 3615 uinfo->count = 1;
@@ -3642,8 +3643,8 @@ struct _snd_pcm_runtime {
3642 <informalexample> 3643 <informalexample>
3643 <programlisting> 3644 <programlisting>
3644<![CDATA[ 3645<![CDATA[
3645 static int snd_myctl_info(snd_kcontrol_t *kcontrol, 3646 static int snd_myctl_info(struct snd_kcontrol *kcontrol,
3646 snd_ctl_elem_info_t *uinfo) 3647 struct snd_ctl_elem_info *uinfo)
3647 { 3648 {
3648 static char *texts[4] = { 3649 static char *texts[4] = {
3649 "First", "Second", "Third", "Fourth" 3650 "First", "Second", "Third", "Fourth"
@@ -3678,10 +3679,10 @@ struct _snd_pcm_runtime {
3678 <title>Example of get callback</title> 3679 <title>Example of get callback</title>
3679 <programlisting> 3680 <programlisting>
3680<![CDATA[ 3681<![CDATA[
3681 static int snd_myctl_get(snd_kcontrol_t *kcontrol, 3682 static int snd_myctl_get(struct snd_kcontrol *kcontrol,
3682 snd_ctl_elem_value_t *ucontrol) 3683 struct snd_ctl_elem_value *ucontrol)
3683 { 3684 {
3684 mychip_t *chip = snd_kcontrol_chip(kcontrol); 3685 struct mychip *chip = snd_kcontrol_chip(kcontrol);
3685 ucontrol->value.integer.value[0] = get_some_value(chip); 3686 ucontrol->value.integer.value[0] = get_some_value(chip);
3686 return 0; 3687 return 0;
3687 } 3688 }
@@ -3717,8 +3718,8 @@ struct _snd_pcm_runtime {
3717 <informalexample> 3718 <informalexample>
3718 <programlisting> 3719 <programlisting>
3719<![CDATA[ 3720<![CDATA[
3720 static int snd_sbmixer_get_single(snd_kcontrol_t *kcontrol, 3721 static int snd_sbmixer_get_single(struct snd_kcontrol *kcontrol,
3721 snd_ctl_elem_value_t *ucontrol) 3722 struct snd_ctl_elem_value *ucontrol)
3722 { 3723 {
3723 int reg = kcontrol->private_value & 0xff; 3724 int reg = kcontrol->private_value & 0xff;
3724 int shift = (kcontrol->private_value >> 16) & 0xff; 3725 int shift = (kcontrol->private_value >> 16) & 0xff;
@@ -3754,10 +3755,10 @@ struct _snd_pcm_runtime {
3754 <title>Example of put callback</title> 3755 <title>Example of put callback</title>
3755 <programlisting> 3756 <programlisting>
3756<![CDATA[ 3757<![CDATA[
3757 static int snd_myctl_put(snd_kcontrol_t *kcontrol, 3758 static int snd_myctl_put(struct snd_kcontrol *kcontrol,
3758 snd_ctl_elem_value_t *ucontrol) 3759 struct snd_ctl_elem_value *ucontrol)
3759 { 3760 {
3760 mychip_t *chip = snd_kcontrol_chip(kcontrol); 3761 struct mychip *chip = snd_kcontrol_chip(kcontrol);
3761 int changed = 0; 3762 int changed = 0;
3762 if (chip->current_value != 3763 if (chip->current_value !=
3763 ucontrol->value.integer.value[0]) { 3764 ucontrol->value.integer.value[0]) {
@@ -3814,7 +3815,7 @@ struct _snd_pcm_runtime {
3814 </informalexample> 3815 </informalexample>
3815 3816
3816 where <parameter>my_control</parameter> is the 3817 where <parameter>my_control</parameter> is the
3817 <type>snd_kcontrol_new_t</type> object defined above, and chip 3818 struct <structname>snd_kcontrol_new</structname> object defined above, and chip
3818 is the object pointer to be passed to 3819 is the object pointer to be passed to
3819 kcontrol-&gt;private_data 3820 kcontrol-&gt;private_data
3820 which can be referred in callbacks. 3821 which can be referred in callbacks.
@@ -3822,7 +3823,7 @@ struct _snd_pcm_runtime {
3822 3823
3823 <para> 3824 <para>
3824 <function>snd_ctl_new1()</function> allocates a new 3825 <function>snd_ctl_new1()</function> allocates a new
3825 <type>snd_kcontrol_t</type> instance (that's why the definition 3826 <structname>snd_kcontrol</structname> instance (that's why the definition
3826 of <parameter>my_control</parameter> can be with 3827 of <parameter>my_control</parameter> can be with
3827 <parameter>__devinitdata</parameter> 3828 <parameter>__devinitdata</parameter>
3828 prefix), and <function>snd_ctl_add</function> assigns the given 3829 prefix), and <function>snd_ctl_add</function> assigns the given
@@ -3849,7 +3850,7 @@ struct _snd_pcm_runtime {
3849 control id pointer for the notification. The event-mask 3850 control id pointer for the notification. The event-mask
3850 specifies the types of notification, for example, in the above 3851 specifies the types of notification, for example, in the above
3851 example, the change of control values is notified. 3852 example, the change of control values is notified.
3852 The id pointer is the pointer of <type>snd_ctl_elem_id_t</type> 3853 The id pointer is the pointer of struct <structname>snd_ctl_elem_id</structname>
3853 to be notified. 3854 to be notified.
3854 You can find some examples in <filename>es1938.c</filename> or 3855 You can find some examples in <filename>es1938.c</filename> or
3855 <filename>es1968.c</filename> for hardware volume interrupts. 3856 <filename>es1968.c</filename> for hardware volume interrupts.
@@ -3882,35 +3883,35 @@ struct _snd_pcm_runtime {
3882 <title>Example of AC97 Interface</title> 3883 <title>Example of AC97 Interface</title>
3883 <programlisting> 3884 <programlisting>
3884<![CDATA[ 3885<![CDATA[
3885 struct snd_mychip { 3886 struct mychip {
3886 .... 3887 ....
3887 ac97_t *ac97; 3888 struct snd_ac97 *ac97;
3888 .... 3889 ....
3889 }; 3890 };
3890 3891
3891 static unsigned short snd_mychip_ac97_read(ac97_t *ac97, 3892 static unsigned short snd_mychip_ac97_read(struct snd_ac97 *ac97,
3892 unsigned short reg) 3893 unsigned short reg)
3893 { 3894 {
3894 mychip_t *chip = ac97->private_data; 3895 struct mychip *chip = ac97->private_data;
3895 .... 3896 ....
3896 // read a register value here from the codec 3897 // read a register value here from the codec
3897 return the_register_value; 3898 return the_register_value;
3898 } 3899 }
3899 3900
3900 static void snd_mychip_ac97_write(ac97_t *ac97, 3901 static void snd_mychip_ac97_write(struct snd_ac97 *ac97,
3901 unsigned short reg, unsigned short val) 3902 unsigned short reg, unsigned short val)
3902 { 3903 {
3903 mychip_t *chip = ac97->private_data; 3904 struct mychip *chip = ac97->private_data;
3904 .... 3905 ....
3905 // write the given register value to the codec 3906 // write the given register value to the codec
3906 } 3907 }
3907 3908
3908 static int snd_mychip_ac97(mychip_t *chip) 3909 static int snd_mychip_ac97(struct mychip *chip)
3909 { 3910 {
3910 ac97_bus_t *bus; 3911 struct snd_ac97_bus *bus;
3911 ac97_template_t ac97; 3912 struct snd_ac97_template ac97;
3912 int err; 3913 int err;
3913 static ac97_bus_ops_t ops = { 3914 static struct snd_ac97_bus_ops ops = {
3914 .write = snd_mychip_ac97_write, 3915 .write = snd_mychip_ac97_write,
3915 .read = snd_mychip_ac97_read, 3916 .read = snd_mychip_ac97_read,
3916 }; 3917 };
@@ -3937,8 +3938,8 @@ struct _snd_pcm_runtime {
3937 <informalexample> 3938 <informalexample>
3938 <programlisting> 3939 <programlisting>
3939<![CDATA[ 3940<![CDATA[
3940 ac97_bus_t *bus; 3941 struct snd_ac97_bus *bus;
3941 static ac97_bus_ops_t ops = { 3942 static struct snd_ac97_bus_ops ops = {
3942 .write = snd_mychip_ac97_write, 3943 .write = snd_mychip_ac97_write,
3943 .read = snd_mychip_ac97_read, 3944 .read = snd_mychip_ac97_read,
3944 }; 3945 };
@@ -3952,13 +3953,14 @@ struct _snd_pcm_runtime {
3952 </para> 3953 </para>
3953 3954
3954 <para> 3955 <para>
3955 And then call <function>snd_ac97_mixer()</function> with an <type>ac97_template_t</type> 3956 And then call <function>snd_ac97_mixer()</function> with an
3957 struct <structname>snd_ac97_template</structname>
3956 record together with the bus pointer created above. 3958 record together with the bus pointer created above.
3957 3959
3958 <informalexample> 3960 <informalexample>
3959 <programlisting> 3961 <programlisting>
3960<![CDATA[ 3962<![CDATA[
3961 ac97_template_t ac97; 3963 struct snd_ac97_template ac97;
3962 int err; 3964 int err;
3963 3965
3964 memset(&ac97, 0, sizeof(ac97)); 3966 memset(&ac97, 0, sizeof(ac97));
@@ -3995,10 +3997,10 @@ struct _snd_pcm_runtime {
3995 <informalexample> 3997 <informalexample>
3996 <programlisting> 3998 <programlisting>
3997<![CDATA[ 3999<![CDATA[
3998 static unsigned short snd_mychip_ac97_read(ac97_t *ac97, 4000 static unsigned short snd_mychip_ac97_read(struct snd_ac97 *ac97,
3999 unsigned short reg) 4001 unsigned short reg)
4000 { 4002 {
4001 mychip_t *chip = ac97->private_data; 4003 struct mychip *chip = ac97->private_data;
4002 .... 4004 ....
4003 return the_register_value; 4005 return the_register_value;
4004 } 4006 }
@@ -4016,7 +4018,7 @@ struct _snd_pcm_runtime {
4016 <informalexample> 4018 <informalexample>
4017 <programlisting> 4019 <programlisting>
4018<![CDATA[ 4020<![CDATA[
4019 static void snd_mychip_ac97_write(ac97_t *ac97, 4021 static void snd_mychip_ac97_write(struct snd_ac97 *ac97,
4020 unsigned short reg, unsigned short val) 4022 unsigned short reg, unsigned short val)
4021]]> 4023]]>
4022 </programlisting> 4024 </programlisting>
@@ -4163,7 +4165,7 @@ struct _snd_pcm_runtime {
4163 <title>Multiple Codecs</title> 4165 <title>Multiple Codecs</title>
4164 <para> 4166 <para>
4165 When there are several codecs on the same card, you need to 4167 When there are several codecs on the same card, you need to
4166 call <function>snd_ac97_new()</function> multiple times with 4168 call <function>snd_ac97_mixer()</function> multiple times with
4167 ac97.num=1 or greater. The <structfield>num</structfield> field 4169 ac97.num=1 or greater. The <structfield>num</structfield> field
4168 specifies the codec 4170 specifies the codec
4169 number. 4171 number.
@@ -4212,7 +4214,7 @@ struct _snd_pcm_runtime {
4212 <informalexample> 4214 <informalexample>
4213 <programlisting> 4215 <programlisting>
4214<![CDATA[ 4216<![CDATA[
4215 snd_rawmidi_t *rmidi; 4217 struct snd_rawmidi *rmidi;
4216 snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated, 4218 snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated,
4217 irq, irq_flags, &rmidi); 4219 irq, irq_flags, &rmidi);
4218]]> 4220]]>
@@ -4253,17 +4255,17 @@ struct _snd_pcm_runtime {
4253 Usually, the port address corresponds to the command port and 4255 Usually, the port address corresponds to the command port and
4254 port + 1 corresponds to the data port. If not, you may change 4256 port + 1 corresponds to the data port. If not, you may change
4255 the <structfield>cport</structfield> field of 4257 the <structfield>cport</structfield> field of
4256 <type>mpu401_t</type> manually 4258 struct <structname>snd_mpu401</structname> manually
4257 afterward. However, <type>mpu401_t</type> pointer is not 4259 afterward. However, <structname>snd_mpu401</structname> pointer is not
4258 returned explicitly by 4260 returned explicitly by
4259 <function>snd_mpu401_uart_new()</function>. You need to cast 4261 <function>snd_mpu401_uart_new()</function>. You need to cast
4260 rmidi-&gt;private_data to 4262 rmidi-&gt;private_data to
4261 <type>mpu401_t</type> explicitly, 4263 <structname>snd_mpu401</structname> explicitly,
4262 4264
4263 <informalexample> 4265 <informalexample>
4264 <programlisting> 4266 <programlisting>
4265<![CDATA[ 4267<![CDATA[
4266 mpu401_t *mpu; 4268 struct snd_mpu401 *mpu;
4267 mpu = rmidi->private_data; 4269 mpu = rmidi->private_data;
4268]]> 4270]]>
4269 </programlisting> 4271 </programlisting>
@@ -4359,7 +4361,7 @@ struct _snd_pcm_runtime {
4359 <informalexample> 4361 <informalexample>
4360 <programlisting> 4362 <programlisting>
4361<![CDATA[ 4363<![CDATA[
4362 snd_rawmidi_t *rmidi; 4364 struct snd_rawmidi *rmidi;
4363 err = snd_rawmidi_new(chip->card, "MyMIDI", 0, outs, ins, &rmidi); 4365 err = snd_rawmidi_new(chip->card, "MyMIDI", 0, outs, ins, &rmidi);
4364 if (err < 0) 4366 if (err < 0)
4365 return err; 4367 return err;
@@ -4419,7 +4421,7 @@ struct _snd_pcm_runtime {
4419 <informalexample> 4421 <informalexample>
4420 <programlisting> 4422 <programlisting>
4421<![CDATA[ 4423<![CDATA[
4422 static snd_rawmidi_ops_t snd_mymidi_output_ops = { 4424 static struct snd_rawmidi_ops snd_mymidi_output_ops = {
4423 .open = snd_mymidi_output_open, 4425 .open = snd_mymidi_output_open,
4424 .close = snd_mymidi_output_close, 4426 .close = snd_mymidi_output_close,
4425 .trigger = snd_mymidi_output_trigger, 4427 .trigger = snd_mymidi_output_trigger,
@@ -4439,9 +4441,9 @@ struct _snd_pcm_runtime {
4439 <programlisting> 4441 <programlisting>
4440<![CDATA[ 4442<![CDATA[
4441 struct list_head *list; 4443 struct list_head *list;
4442 snd_rawmidi_substream_t *substream; 4444 struct snd_rawmidi_substream *substream;
4443 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { 4445 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) {
4444 substream = list_entry(list, snd_rawmidi_substream_t, list); 4446 substream = list_entry(list, struct snd_rawmidi_substream, list);
4445 sprintf(substream->name, "My MIDI Port %d", substream->number + 1); 4447 sprintf(substream->name, "My MIDI Port %d", substream->number + 1);
4446 } 4448 }
4447 /* same for SNDRV_RAWMIDI_STREAM_INPUT */ 4449 /* same for SNDRV_RAWMIDI_STREAM_INPUT */
@@ -4463,12 +4465,12 @@ struct _snd_pcm_runtime {
4463 4465
4464 <para> 4466 <para>
4465 If there is more than one port, your callbacks can determine the 4467 If there is more than one port, your callbacks can determine the
4466 port index from the snd_rawmidi_substream_t data passed to each 4468 port index from the struct snd_rawmidi_substream data passed to each
4467 callback: 4469 callback:
4468 <informalexample> 4470 <informalexample>
4469 <programlisting> 4471 <programlisting>
4470<![CDATA[ 4472<![CDATA[
4471 snd_rawmidi_substream_t *substream; 4473 struct snd_rawmidi_substream *substream;
4472 int index = substream->number; 4474 int index = substream->number;
4473]]> 4475]]>
4474 </programlisting> 4476 </programlisting>
@@ -4481,7 +4483,7 @@ struct _snd_pcm_runtime {
4481 <informalexample> 4483 <informalexample>
4482 <programlisting> 4484 <programlisting>
4483<![CDATA[ 4485<![CDATA[
4484 static int snd_xxx_open(snd_rawmidi_substream_t *substream); 4486 static int snd_xxx_open(struct snd_rawmidi_substream *substream);
4485]]> 4487]]>
4486 </programlisting> 4488 </programlisting>
4487 </informalexample> 4489 </informalexample>
@@ -4499,7 +4501,7 @@ struct _snd_pcm_runtime {
4499 <informalexample> 4501 <informalexample>
4500 <programlisting> 4502 <programlisting>
4501<![CDATA[ 4503<![CDATA[
4502 static int snd_xxx_close(snd_rawmidi_substream_t *substream); 4504 static int snd_xxx_close(struct snd_rawmidi_substream *substream);
4503]]> 4505]]>
4504 </programlisting> 4506 </programlisting>
4505 </informalexample> 4507 </informalexample>
@@ -4522,7 +4524,7 @@ struct _snd_pcm_runtime {
4522 <informalexample> 4524 <informalexample>
4523 <programlisting> 4525 <programlisting>
4524<![CDATA[ 4526<![CDATA[
4525 static void snd_xxx_output_trigger(snd_rawmidi_substream_t *substream, int up); 4527 static void snd_xxx_output_trigger(struct snd_rawmidi_substream *substream, int up);
4526]]> 4528]]>
4527 </programlisting> 4529 </programlisting>
4528 </informalexample> 4530 </informalexample>
@@ -4547,7 +4549,7 @@ struct _snd_pcm_runtime {
4547<![CDATA[ 4549<![CDATA[
4548 unsigned char data; 4550 unsigned char data;
4549 while (snd_rawmidi_transmit_peek(substream, &data, 1) == 1) { 4551 while (snd_rawmidi_transmit_peek(substream, &data, 1) == 1) {
4550 if (mychip_try_to_transmit(data)) 4552 if (snd_mychip_try_to_transmit(data))
4551 snd_rawmidi_transmit_ack(substream, 1); 4553 snd_rawmidi_transmit_ack(substream, 1);
4552 else 4554 else
4553 break; /* hardware FIFO full */ 4555 break; /* hardware FIFO full */
@@ -4564,11 +4566,11 @@ struct _snd_pcm_runtime {
4564 <informalexample> 4566 <informalexample>
4565 <programlisting> 4567 <programlisting>
4566<![CDATA[ 4568<![CDATA[
4567 while (mychip_transmit_possible()) { 4569 while (snd_mychip_transmit_possible()) {
4568 unsigned char data; 4570 unsigned char data;
4569 if (snd_rawmidi_transmit(substream, &data, 1) != 1) 4571 if (snd_rawmidi_transmit(substream, &data, 1) != 1)
4570 break; /* no more data */ 4572 break; /* no more data */
4571 mychip_transmit(data); 4573 snd_mychip_transmit(data);
4572 } 4574 }
4573]]> 4575]]>
4574 </programlisting> 4576 </programlisting>
@@ -4603,7 +4605,7 @@ struct _snd_pcm_runtime {
4603 <informalexample> 4605 <informalexample>
4604 <programlisting> 4606 <programlisting>
4605<![CDATA[ 4607<![CDATA[
4606 static void snd_xxx_input_trigger(snd_rawmidi_substream_t *substream, int up); 4608 static void snd_xxx_input_trigger(struct snd_rawmidi_substream *substream, int up);
4607]]> 4609]]>
4608 </programlisting> 4610 </programlisting>
4609 </informalexample> 4611 </informalexample>
@@ -4647,7 +4649,7 @@ struct _snd_pcm_runtime {
4647 <informalexample> 4649 <informalexample>
4648 <programlisting> 4650 <programlisting>
4649<![CDATA[ 4651<![CDATA[
4650 static void snd_xxx_drain(snd_rawmidi_substream_t *substream); 4652 static void snd_xxx_drain(struct snd_rawmidi_substream *substream);
4651]]> 4653]]>
4652 </programlisting> 4654 </programlisting>
4653 </informalexample> 4655 </informalexample>
@@ -4661,7 +4663,7 @@ struct _snd_pcm_runtime {
4661 4663
4662 <para> 4664 <para>
4663 This callback is optional. If you do not set 4665 This callback is optional. If you do not set
4664 <structfield>drain</structfield> in the snd_rawmidi_ops_t 4666 <structfield>drain</structfield> in the struct snd_rawmidi_ops
4665 structure, ALSA will simply wait for 50&nbsp;milliseconds 4667 structure, ALSA will simply wait for 50&nbsp;milliseconds
4666 instead. 4668 instead.
4667 </para> 4669 </para>
@@ -4703,7 +4705,7 @@ struct _snd_pcm_runtime {
4703 <informalexample> 4705 <informalexample>
4704 <programlisting> 4706 <programlisting>
4705<![CDATA[ 4707<![CDATA[
4706 opl3_t *opl3; 4708 struct snd_opl3 *opl3;
4707 snd_opl3_create(card, lport, rport, OPL3_HW_OPL3_XXX, 4709 snd_opl3_create(card, lport, rport, OPL3_HW_OPL3_XXX,
4708 integrated, &opl3); 4710 integrated, &opl3);
4709]]> 4711]]>
@@ -4736,7 +4738,7 @@ struct _snd_pcm_runtime {
4736 <informalexample> 4738 <informalexample>
4737 <programlisting> 4739 <programlisting>
4738<![CDATA[ 4740<![CDATA[
4739 opl3_t *opl3; 4741 struct snd_opl3 *opl3;
4740 snd_opl3_new(card, OPL3_HW_OPL3_XXX, &opl3); 4742 snd_opl3_new(card, OPL3_HW_OPL3_XXX, &opl3);
4741]]> 4743]]>
4742 </programlisting> 4744 </programlisting>
@@ -4767,7 +4769,7 @@ struct _snd_pcm_runtime {
4767 <informalexample> 4769 <informalexample>
4768 <programlisting> 4770 <programlisting>
4769<![CDATA[ 4771<![CDATA[
4770 snd_hwdep_t *opl3hwdep; 4772 struct snd_hwdep *opl3hwdep;
4771 snd_opl3_hwdep_new(opl3, 0, 1, &opl3hwdep); 4773 snd_opl3_hwdep_new(opl3, 0, 1, &opl3hwdep);
4772]]> 4774]]>
4773 </programlisting> 4775 </programlisting>
@@ -4804,7 +4806,7 @@ struct _snd_pcm_runtime {
4804 <informalexample> 4806 <informalexample>
4805 <programlisting> 4807 <programlisting>
4806<![CDATA[ 4808<![CDATA[
4807 snd_hwdep_t *hw; 4809 struct snd_hwdep *hw;
4808 snd_hwdep_new(card, "My HWDEP", 0, &hw); 4810 snd_hwdep_new(card, "My HWDEP", 0, &hw);
4809]]> 4811]]>
4810 </programlisting> 4812 </programlisting>
@@ -4823,7 +4825,7 @@ struct _snd_pcm_runtime {
4823 <informalexample> 4825 <informalexample>
4824 <programlisting> 4826 <programlisting>
4825<![CDATA[ 4827<![CDATA[
4826 mydata_t *p = kmalloc(sizeof(*p), GFP_KERNEL); 4828 struct mydata *p = kmalloc(sizeof(*p), GFP_KERNEL);
4827 hw->private_data = p; 4829 hw->private_data = p;
4828 hw->private_free = mydata_free; 4830 hw->private_free = mydata_free;
4829]]> 4831]]>
@@ -4835,9 +4837,9 @@ struct _snd_pcm_runtime {
4835 <informalexample> 4837 <informalexample>
4836 <programlisting> 4838 <programlisting>
4837<![CDATA[ 4839<![CDATA[
4838 static void mydata_free(snd_hwdep_t *hw) 4840 static void mydata_free(struct snd_hwdep *hw)
4839 { 4841 {
4840 mydata_t *p = hw->private_data; 4842 struct mydata *p = hw->private_data;
4841 kfree(p); 4843 kfree(p);
4842 } 4844 }
4843]]> 4845]]>
@@ -5061,9 +5063,9 @@ struct _snd_pcm_runtime {
5061 <informalexample> 5063 <informalexample>
5062 <programlisting> 5064 <programlisting>
5063<![CDATA[ 5065<![CDATA[
5064 static int playback_copy(snd_pcm_substream_t *substream, int channel, 5066 static int playback_copy(struct snd_pcm_substream *substream, int channel,
5065 snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count); 5067 snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count);
5066 static int capture_copy(snd_pcm_substream_t *substream, int channel, 5068 static int capture_copy(struct snd_pcm_substream *substream, int channel,
5067 snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count); 5069 snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count);
5068]]> 5070]]>
5069 </programlisting> 5071 </programlisting>
@@ -5144,7 +5146,7 @@ struct _snd_pcm_runtime {
5144 <informalexample> 5146 <informalexample>
5145 <programlisting> 5147 <programlisting>
5146<![CDATA[ 5148<![CDATA[
5147 static int silence(snd_pcm_substream_t *substream, int channel, 5149 static int silence(struct snd_pcm_substream *substream, int channel,
5148 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 5150 snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
5149]]> 5151]]>
5150 </programlisting> 5152 </programlisting>
@@ -5211,7 +5213,7 @@ struct _snd_pcm_runtime {
5211 <informalexample> 5213 <informalexample>
5212 <programlisting> 5214 <programlisting>
5213<![CDATA[ 5215<![CDATA[
5214 snd_pcm_sgbuf_t *sgbuf = (snd_pcm_sgbuf_t*)substream->dma_private; 5216 struct snd_sg_buf *sgbuf = (struct snd_sg_buf_t*)substream->dma_private;
5215]]> 5217]]>
5216 </programlisting> 5218 </programlisting>
5217 </informalexample> 5219 </informalexample>
@@ -5266,7 +5268,7 @@ struct _snd_pcm_runtime {
5266 #include <linux/vmalloc.h> 5268 #include <linux/vmalloc.h>
5267 5269
5268 /* get the physical page pointer on the given offset */ 5270 /* get the physical page pointer on the given offset */
5269 static struct page *mychip_page(snd_pcm_substream_t *substream, 5271 static struct page *mychip_page(struct snd_pcm_substream *substream,
5270 unsigned long offset) 5272 unsigned long offset)
5271 { 5273 {
5272 void *pageptr = substream->runtime->dma_area + offset; 5274 void *pageptr = substream->runtime->dma_area + offset;
@@ -5301,7 +5303,7 @@ struct _snd_pcm_runtime {
5301 <informalexample> 5303 <informalexample>
5302 <programlisting> 5304 <programlisting>
5303<![CDATA[ 5305<![CDATA[
5304 snd_info_entry_t *entry; 5306 struct snd_info_entry *entry;
5305 int err = snd_card_proc_new(card, "my-file", &entry); 5307 int err = snd_card_proc_new(card, "my-file", &entry);
5306]]> 5308]]>
5307 </programlisting> 5309 </programlisting>
@@ -5345,8 +5347,8 @@ struct _snd_pcm_runtime {
5345 <informalexample> 5347 <informalexample>
5346 <programlisting> 5348 <programlisting>
5347<![CDATA[ 5349<![CDATA[
5348 static void my_proc_read(snd_info_entry_t *entry, 5350 static void my_proc_read(struct snd_info_entry *entry,
5349 snd_info_buffer_t *buffer); 5351 struct snd_info_buffer *buffer);
5350]]> 5352]]>
5351 </programlisting> 5353 </programlisting>
5352 </informalexample> 5354 </informalexample>
@@ -5361,10 +5363,10 @@ struct _snd_pcm_runtime {
5361 <informalexample> 5363 <informalexample>
5362 <programlisting> 5364 <programlisting>
5363<![CDATA[ 5365<![CDATA[
5364 static void my_proc_read(snd_info_entry_t *entry, 5366 static void my_proc_read(struct snd_info_entry *entry,
5365 snd_info_buffer_t *buffer) 5367 struct snd_info_buffer *buffer)
5366 { 5368 {
5367 chip_t *chip = entry->private_data; 5369 struct my_chip *chip = entry->private_data;
5368 5370
5369 snd_iprintf(buffer, "This is my chip!\n"); 5371 snd_iprintf(buffer, "This is my chip!\n");
5370 snd_iprintf(buffer, "Port = %ld\n", chip->port); 5372 snd_iprintf(buffer, "Port = %ld\n", chip->port);
@@ -5453,7 +5455,7 @@ struct _snd_pcm_runtime {
5453 <informalexample> 5455 <informalexample>
5454 <programlisting> 5456 <programlisting>
5455<![CDATA[ 5457<![CDATA[
5456 static long my_file_io_read(snd_info_entry_t *entry, 5458 static long my_file_io_read(struct snd_info_entry *entry,
5457 void *file_private_data, 5459 void *file_private_data,
5458 struct file *file, 5460 struct file *file,
5459 char *buf, 5461 char *buf,
@@ -5488,22 +5490,60 @@ struct _snd_pcm_runtime {
5488 <constant>CONFIG_PM</constant>. 5490 <constant>CONFIG_PM</constant>.
5489 </para> 5491 </para>
5490 5492
5493 <para>
5494 If the driver supports the suspend/resume
5495 <emphasis>fully</emphasis>, that is, the device can be
5496 properly resumed to the status at the suspend is called,
5497 you can set <constant>SNDRV_PCM_INFO_RESUME</constant> flag
5498 to pcm info field. Usually, this is possible when the
5499 registers of ths chip can be safely saved and restored to the
5500 RAM. If this is set, the trigger callback is called with
5501 <constant>SNDRV_PCM_TRIGGER_RESUME</constant> after resume
5502 callback is finished.
5503 </para>
5504
5505 <para>
5506 Even if the driver doesn't support PM fully but only the
5507 partial suspend/resume is possible, it's still worthy to
5508 implement suspend/resume callbacks. In such a case, applications
5509 would reset the status by calling
5510 <function>snd_pcm_prepare()</function> and restart the stream
5511 appropriately. Hence, you can define suspend/resume callbacks
5512 below but don't set <constant>SNDRV_PCM_INFO_RESUME</constant>
5513 info flag to the PCM.
5514 </para>
5515
5516 <para>
5517 Note that the trigger with SUSPEND can be always called when
5518 <function>snd_pcm_suspend_all</function> is called,
5519 regardless of <constant>SNDRV_PCM_INFO_RESUME</constant> flag.
5520 The <constant>RESUME</constant> flag affects only the behavior
5521 of <function>snd_pcm_resume()</function>.
5522 (Thus, in theory,
5523 <constant>SNDRV_PCM_TRIGGER_RESUME</constant> isn't needed
5524 to be handled in the trigger callback when no
5525 <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set. But,
5526 it's better to keep it for compatibility reason.)
5527 </para>
5491 <para> 5528 <para>
5492 ALSA provides the common power-management layer. Each card driver 5529 In the earlier version of ALSA drivers, a common
5493 needs to have only low-level suspend and resume callbacks. 5530 power-management layer was provided, but it has been removed.
5531 The driver needs to define the suspend/resume hooks according to
5532 the bus the device is assigned. In the case of PCI driver, the
5533 callbacks look like below:
5494 5534
5495 <informalexample> 5535 <informalexample>
5496 <programlisting> 5536 <programlisting>
5497<![CDATA[ 5537<![CDATA[
5498 #ifdef CONFIG_PM 5538 #ifdef CONFIG_PM
5499 static int snd_my_suspend(snd_card_t *card, pm_message_t state) 5539 static int snd_my_suspend(struct pci_dev *pci, pm_message_t state)
5500 { 5540 {
5501 .... // do things for suspsend 5541 .... /* do things for suspsend */
5502 return 0; 5542 return 0;
5503 } 5543 }
5504 static int snd_my_resume(snd_card_t *card) 5544 static int snd_my_resume(struct pci_dev *pci)
5505 { 5545 {
5506 .... // do things for suspsend 5546 .... /* do things for suspsend */
5507 return 0; 5547 return 0;
5508 } 5548 }
5509 #endif 5549 #endif
@@ -5516,11 +5556,18 @@ struct _snd_pcm_runtime {
5516 The scheme of the real suspend job is as following. 5556 The scheme of the real suspend job is as following.
5517 5557
5518 <orderedlist> 5558 <orderedlist>
5519 <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> 5559 <listitem><para>Retrieve the card and the chip data.</para></listitem>
5560 <listitem><para>Call <function>snd_power_change_state()</function> with
5561 <constant>SNDRV_CTL_POWER_D3hot</constant> to change the
5562 power status.</para></listitem>
5520 <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem> 5563 <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem>
5564 <listitem><para>If AC97 codecs are used, call
5565 <function>snd_ac97_resume()</function> for each codec.</para></listitem>
5521 <listitem><para>Save the register values if necessary.</para></listitem> 5566 <listitem><para>Save the register values if necessary.</para></listitem>
5522 <listitem><para>Stop the hardware if necessary.</para></listitem> 5567 <listitem><para>Stop the hardware if necessary.</para></listitem>
5523 <listitem><para>Disable the PCI device by calling <function>pci_disable_device()</function>.</para></listitem> 5568 <listitem><para>Disable the PCI device by calling
5569 <function>pci_disable_device()</function>. Then, call
5570 <function>pci_save_state()</function> at last.</para></listitem>
5524 </orderedlist> 5571 </orderedlist>
5525 </para> 5572 </para>
5526 5573
@@ -5530,18 +5577,24 @@ struct _snd_pcm_runtime {
5530 <informalexample> 5577 <informalexample>
5531 <programlisting> 5578 <programlisting>
5532<![CDATA[ 5579<![CDATA[
5533 static int mychip_suspend(snd_card_t *card, pm_message_t state) 5580 static int mychip_suspend(struct pci_dev *pci, pm_message_t state)
5534 { 5581 {
5535 /* (1) */ 5582 /* (1) */
5536 mychip_t *chip = card->pm_private_data; 5583 struct snd_card *card = pci_get_drvdata(pci);
5584 struct mychip *chip = card->private_data;
5537 /* (2) */ 5585 /* (2) */
5538 snd_pcm_suspend_all(chip->pcm); 5586 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
5539 /* (3) */ 5587 /* (3) */
5540 snd_mychip_save_registers(chip); 5588 snd_pcm_suspend_all(chip->pcm);
5541 /* (4) */ 5589 /* (4) */
5542 snd_mychip_stop_hardware(chip); 5590 snd_ac97_suspend(chip->ac97);
5543 /* (5) */ 5591 /* (5) */
5544 pci_disable_device(chip->pci); 5592 snd_mychip_save_registers(chip);
5593 /* (6) */
5594 snd_mychip_stop_hardware(chip);
5595 /* (7) */
5596 pci_disable_device(pci);
5597 pci_save_state(pci);
5545 return 0; 5598 return 0;
5546 } 5599 }
5547]]> 5600]]>
@@ -5553,14 +5606,17 @@ struct _snd_pcm_runtime {
5553 The scheme of the real resume job is as following. 5606 The scheme of the real resume job is as following.
5554 5607
5555 <orderedlist> 5608 <orderedlist>
5556 <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> 5609 <listitem><para>Retrieve the card and the chip data.</para></listitem>
5557 <listitem><para>Enable the pci device again by calling 5610 <listitem><para>Set up PCI. First, call <function>pci_restore_state()</function>.
5558 <function>pci_enable_device()</function>.</para></listitem> 5611 Then enable the pci device again by calling <function>pci_enable_device()</function>.
5612 Call <function>pci_set_master()</function> if necessary, too.</para></listitem>
5559 <listitem><para>Re-initialize the chip.</para></listitem> 5613 <listitem><para>Re-initialize the chip.</para></listitem>
5560 <listitem><para>Restore the saved registers if necessary.</para></listitem> 5614 <listitem><para>Restore the saved registers if necessary.</para></listitem>
5561 <listitem><para>Resume the mixer, e.g. calling 5615 <listitem><para>Resume the mixer, e.g. calling
5562 <function>snd_ac97_resume()</function>.</para></listitem> 5616 <function>snd_ac97_resume()</function>.</para></listitem>
5563 <listitem><para>Restart the hardware (if any).</para></listitem> 5617 <listitem><para>Restart the hardware (if any).</para></listitem>
5618 <listitem><para>Call <function>snd_power_change_state()</function> with
5619 <constant>SNDRV_CTL_POWER_D0</constant> to notify the processes.</para></listitem>
5564 </orderedlist> 5620 </orderedlist>
5565 </para> 5621 </para>
5566 5622
@@ -5570,12 +5626,15 @@ struct _snd_pcm_runtime {
5570 <informalexample> 5626 <informalexample>
5571 <programlisting> 5627 <programlisting>
5572<![CDATA[ 5628<![CDATA[
5573 static void mychip_resume(mychip_t *chip) 5629 static int mychip_resume(struct pci_dev *pci)
5574 { 5630 {
5575 /* (1) */ 5631 /* (1) */
5576 mychip_t *chip = card->pm_private_data; 5632 struct snd_card *card = pci_get_drvdata(pci);
5633 struct mychip *chip = card->private_data;
5577 /* (2) */ 5634 /* (2) */
5578 pci_enable_device(chip->pci); 5635 pci_restore_state(pci);
5636 pci_enable_device(pci);
5637 pci_set_master(pci);
5579 /* (3) */ 5638 /* (3) */
5580 snd_mychip_reinit_chip(chip); 5639 snd_mychip_reinit_chip(chip);
5581 /* (4) */ 5640 /* (4) */
@@ -5584,6 +5643,8 @@ struct _snd_pcm_runtime {
5584 snd_ac97_resume(chip->ac97); 5643 snd_ac97_resume(chip->ac97);
5585 /* (6) */ 5644 /* (6) */
5586 snd_mychip_restart_chip(chip); 5645 snd_mychip_restart_chip(chip);
5646 /* (7) */
5647 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
5587 return 0; 5648 return 0;
5588 } 5649 }
5589]]> 5650]]>
@@ -5592,8 +5653,23 @@ struct _snd_pcm_runtime {
5592 </para> 5653 </para>
5593 5654
5594 <para> 5655 <para>
5595 OK, we have all callbacks now. Let's set up them now. In the 5656 As shown in the above, it's better to save registers after
5596 initialization of the card, add the following: 5657 suspending the PCM operations via
5658 <function>snd_pcm_suspend_all()</function> or
5659 <function>snd_pcm_suspend()</function>. It means that the PCM
5660 streams are already stoppped when the register snapshot is
5661 taken. But, remind that you don't have to restart the PCM
5662 stream in the resume callback. It'll be restarted via
5663 trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant>
5664 when necessary.
5665 </para>
5666
5667 <para>
5668 OK, we have all callbacks now. Let's set them up. In the
5669 initialization of the card, make sure that you can get the chip
5670 data from the card instance, typically via
5671 <structfield>private_data</structfield> field, in case you
5672 created the chip data individually.
5597 5673
5598 <informalexample> 5674 <informalexample>
5599 <programlisting> 5675 <programlisting>
@@ -5602,33 +5678,56 @@ struct _snd_pcm_runtime {
5602 const struct pci_device_id *pci_id) 5678 const struct pci_device_id *pci_id)
5603 { 5679 {
5604 .... 5680 ....
5605 snd_card_t *card; 5681 struct snd_card *card;
5606 mychip_t *chip; 5682 struct mychip *chip;
5607 .... 5683 ....
5608 snd_card_set_pm_callback(card, snd_my_suspend, snd_my_resume, chip); 5684 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
5685 ....
5686 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
5687 ....
5688 card->private_data = chip;
5689 ....
5690 }
5691]]>
5692 </programlisting>
5693 </informalexample>
5694
5695 When you created the chip data with
5696 <function>snd_card_new()</function>, it's anyway accessible
5697 via <structfield>private_data</structfield> field.
5698
5699 <informalexample>
5700 <programlisting>
5701<![CDATA[
5702 static int __devinit snd_mychip_probe(struct pci_dev *pci,
5703 const struct pci_device_id *pci_id)
5704 {
5705 ....
5706 struct snd_card *card;
5707 struct mychip *chip;
5708 ....
5709 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
5710 sizeof(struct mychip));
5711 ....
5712 chip = card->private_data;
5609 .... 5713 ....
5610 } 5714 }
5611]]> 5715]]>
5612 </programlisting> 5716 </programlisting>
5613 </informalexample> 5717 </informalexample>
5614 5718
5615 Here you don't have to put ifdef CONFIG_PM around, since it's already
5616 checked in the header and expanded to empty if not needed.
5617 </para> 5719 </para>
5618 5720
5619 <para> 5721 <para>
5620 If you need a space for saving the registers, you'll need to 5722 If you need a space for saving the registers, allocate the
5621 allocate the buffer for it here, too, since it would be fatal 5723 buffer for it here, too, since it would be fatal
5622 if you cannot allocate a memory in the suspend phase. 5724 if you cannot allocate a memory in the suspend phase.
5623 The allocated buffer should be released in the corresponding 5725 The allocated buffer should be released in the corresponding
5624 destructor. 5726 destructor.
5625 </para> 5727 </para>
5626 5728
5627 <para> 5729 <para>
5628 And next, set suspend/resume callbacks to the pci_driver, 5730 And next, set suspend/resume callbacks to the pci_driver.
5629 This can be done by passing a macro SND_PCI_PM_CALLBACKS
5630 in the pci_driver struct. This macro is expanded to the correct
5631 (global) callbacks if CONFIG_PM is set.
5632 5731
5633 <informalexample> 5732 <informalexample>
5634 <programlisting> 5733 <programlisting>
@@ -5638,7 +5737,10 @@ struct _snd_pcm_runtime {
5638 .id_table = snd_my_ids, 5737 .id_table = snd_my_ids,
5639 .probe = snd_my_probe, 5738 .probe = snd_my_probe,
5640 .remove = __devexit_p(snd_my_remove), 5739 .remove = __devexit_p(snd_my_remove),
5641 SND_PCI_PM_CALLBACKS 5740 #ifdef CONFIG_PM
5741 .suspend = snd_my_suspend,
5742 .resume = snd_my_resume,
5743 #endif
5642 }; 5744 };
5643]]> 5745]]>
5644 </programlisting> 5746 </programlisting>
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt
index 25c5d648aef6..1fe48846d78f 100644
--- a/Documentation/sound/alsa/Procfile.txt
+++ b/Documentation/sound/alsa/Procfile.txt
@@ -138,6 +138,22 @@ card*/codec97#0/ac97#?-?+regs
138 # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs 138 # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs
139 139
140 140
141USB Audio Streams
142-----------------
143
144card*/stream*
145 Shows the assignment and the current status of each audio stream
146 of the given card. This information is very useful for debugging.
147
148
149HD-Audio Codecs
150---------------
151
152card*/codec#*
153 Shows the general codec information and the attribute of each
154 widget node.
155
156
141Sequencer Information 157Sequencer Information
142--------------------- 158---------------------
143 159
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt
index e9d07b8f1acb..0be57ed81302 100644
--- a/Documentation/sound/alsa/hda_codec.txt
+++ b/Documentation/sound/alsa/hda_codec.txt
@@ -63,7 +63,7 @@ The bus instance is created via snd_hda_bus_new(). You need to pass
63the card instance, the template, and the pointer to store the 63the card instance, the template, and the pointer to store the
64resultant bus instance. 64resultant bus instance.
65 65
66int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp, 66int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
67 struct hda_bus **busp); 67 struct hda_bus **busp);
68 68
69It returns zero if successful. A negative return value means any 69It returns zero if successful. A negative return value means any
@@ -166,14 +166,14 @@ The ops field contains the following callback functions:
166 166
167struct hda_pcm_ops { 167struct hda_pcm_ops {
168 int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec, 168 int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec,
169 snd_pcm_substream_t *substream); 169 struct snd_pcm_substream *substream);
170 int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec, 170 int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec,
171 snd_pcm_substream_t *substream); 171 struct snd_pcm_substream *substream);
172 int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec, 172 int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec,
173 unsigned int stream_tag, unsigned int format, 173 unsigned int stream_tag, unsigned int format,
174 snd_pcm_substream_t *substream); 174 struct snd_pcm_substream *substream);
175 int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec, 175 int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec,
176 snd_pcm_substream_t *substream); 176 struct snd_pcm_substream *substream);
177}; 177};
178 178
179All are non-NULL, so you can call them safely without NULL check. 179All are non-NULL, so you can call them safely without NULL check.
@@ -284,7 +284,7 @@ parameter, and PCI subsystem IDs. If the matching entry is found, it
284returns the config field value. 284returns the config field value.
285 285
286snd_hda_add_new_ctls() can be used to create and add control entries. 286snd_hda_add_new_ctls() can be used to create and add control entries.
287Pass the zero-terminated array of snd_kcontrol_new_t. The same array 287Pass the zero-terminated array of struct snd_kcontrol_new. The same array
288can be passed to snd_hda_resume_ctls() for resume. 288can be passed to snd_hda_resume_ctls() for resume.
289Note that this will call control->put callback of these entries. So, 289Note that this will call control->put callback of these entries. So,
290put callback should check codec->in_resume and force to restore the 290put callback should check codec->in_resume and force to restore the
@@ -292,7 +292,7 @@ given value if it's non-zero even if the value is identical with the
292cached value. 292cached value.
293 293
294Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be 294Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be
295used for the entry of snd_kcontrol_new_t. 295used for the entry of struct snd_kcontrol_new.
296 296
297The input MUX helper callbacks for such a control are provided, too: 297The input MUX helper callbacks for such a control are provided, too:
298snd_hda_input_mux_info() and snd_hda_input_mux_put(). See 298snd_hda_input_mux_info() and snd_hda_input_mux_put(). See
diff --git a/Documentation/spi/butterfly b/Documentation/spi/butterfly
new file mode 100644
index 000000000000..a2e8c8d90e35
--- /dev/null
+++ b/Documentation/spi/butterfly
@@ -0,0 +1,57 @@
1spi_butterfly - parport-to-butterfly adapter driver
2===================================================
3
4This is a hardware and software project that includes building and using
5a parallel port adapter cable, together with an "AVR Butterfly" to run
6firmware for user interfacing and/or sensors. A Butterfly is a $US20
7battery powered card with an AVR microcontroller and lots of goodies:
8sensors, LCD, flash, toggle stick, and more. You can use AVR-GCC to
9develop firmware for this, and flash it using this adapter cable.
10
11You can make this adapter from an old printer cable and solder things
12directly to the Butterfly. Or (if you have the parts and skills) you
13can come up with something fancier, providing ciruit protection to the
14Butterfly and the printer port, or with a better power supply than two
15signal pins from the printer port.
16
17
18The first cable connections will hook Linux up to one SPI bus, with the
19AVR and a DataFlash chip; and to the AVR reset line. This is all you
20need to reflash the firmware, and the pins are the standard Atmel "ISP"
21connector pins (used also on non-Butterfly AVR boards).
22
23 Signal Butterfly Parport (DB-25)
24 ------ --------- ---------------
25 SCK = J403.PB1/SCK = pin 2/D0
26 RESET = J403.nRST = pin 3/D1
27 VCC = J403.VCC_EXT = pin 8/D6
28 MOSI = J403.PB2/MOSI = pin 9/D7
29 MISO = J403.PB3/MISO = pin 11/S7,nBUSY
30 GND = J403.GND = pin 23/GND
31
32Then to let Linux master that bus to talk to the DataFlash chip, you must
33(a) flash new firmware that disables SPI (set PRR.2, and disable pullups
34by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and
35(c) cable in the chipselect.
36
37 Signal Butterfly Parport (DB-25)
38 ------ --------- ---------------
39 VCC = J400.VCC_EXT = pin 7/D5
40 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT
41 GND = J400.GND = pin 24/GND
42
43The "USI" controller, using J405, can be used for a second SPI bus. That
44would let you talk to the AVR over SPI, running firmware that makes it act
45as an SPI slave, while letting either Linux or the AVR use the DataFlash.
46There are plenty of spare parport pins to wire this one up, such as:
47
48 Signal Butterfly Parport (DB-25)
49 ------ --------- ---------------
50 SCK = J403.PE4/USCK = pin 5/D3
51 MOSI = J403.PE5/DI = pin 6/D4
52 MISO = J403.PE6/DO = pin 12/S5,nPAPEROUT
53 GND = J403.GND = pin 22/GND
54
55 IRQ = J402.PF4 = pin 10/S6,ACK
56 GND = J402.GND(P2) = pin 25/GND
57
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
new file mode 100644
index 000000000000..a5ffba33a351
--- /dev/null
+++ b/Documentation/spi/spi-summary
@@ -0,0 +1,457 @@
1Overview of Linux kernel SPI support
2====================================
3
402-Dec-2005
5
6What is SPI?
7------------
8The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial
9link used to connect microcontrollers to sensors, memory, and peripherals.
10
11The three signal wires hold a clock (SCLK, often on the order of 10 MHz),
12and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In,
13Slave Out" (MISO) signals. (Other names are also used.) There are four
14clocking modes through which data is exchanged; mode-0 and mode-3 are most
15commonly used. Each clock cycle shifts data out and data in; the clock
16doesn't cycle except when there is data to shift.
17
18SPI masters may use a "chip select" line to activate a given SPI slave
19device, so those three signal wires may be connected to several chips
20in parallel. All SPI slaves support chipselects. Some devices have
21other signals, often including an interrupt to the master.
22
23Unlike serial busses like USB or SMBUS, even low level protocols for
24SPI slave functions are usually not interoperable between vendors
25(except for cases like SPI memory chips).
26
27 - SPI may be used for request/response style device protocols, as with
28 touchscreen sensors and memory chips.
29
30 - It may also be used to stream data in either direction (half duplex),
31 or both of them at the same time (full duplex).
32
33 - Some devices may use eight bit words. Others may different word
34 lengths, such as streams of 12-bit or 20-bit digital samples.
35
36In the same way, SPI slaves will only rarely support any kind of automatic
37discovery/enumeration protocol. The tree of slave devices accessible from
38a given SPI master will normally be set up manually, with configuration
39tables.
40
41SPI is only one of the names used by such four-wire protocols, and
42most controllers have no problem handling "MicroWire" (think of it as
43half-duplex SPI, for request/response protocols), SSP ("Synchronous
44Serial Protocol"), PSP ("Programmable Serial Protocol"), and other
45related protocols.
46
47Microcontrollers often support both master and slave sides of the SPI
48protocol. This document (and Linux) currently only supports the master
49side of SPI interactions.
50
51
52Who uses it? On what kinds of systems?
53---------------------------------------
54Linux developers using SPI are probably writing device drivers for embedded
55systems boards. SPI is used to control external chips, and it is also a
56protocol supported by every MMC or SD memory card. (The older "DataFlash"
57cards, predating MMC cards but using the same connectors and card shape,
58support only SPI.) Some PC hardware uses SPI flash for BIOS code.
59
60SPI slave chips range from digital/analog converters used for analog
61sensors and codecs, to memory, to peripherals like USB controllers
62or Ethernet adapters; and more.
63
64Most systems using SPI will integrate a few devices on a mainboard.
65Some provide SPI links on expansion connectors; in cases where no
66dedicated SPI controller exists, GPIO pins can be used to create a
67low speed "bitbanging" adapter. Very few systems will "hotplug" an SPI
68controller; the reasons to use SPI focus on low cost and simple operation,
69and if dynamic reconfiguration is important, USB will often be a more
70appropriate low-pincount peripheral bus.
71
72Many microcontrollers that can run Linux integrate one or more I/O
73interfaces with SPI modes. Given SPI support, they could use MMC or SD
74cards without needing a special purpose MMC/SD/SDIO controller.
75
76
77How do these driver programming interfaces work?
78------------------------------------------------
79The <linux/spi/spi.h> header file includes kerneldoc, as does the
80main source code, and you should certainly read that. This is just
81an overview, so you get the big picture before the details.
82
83SPI requests always go into I/O queues. Requests for a given SPI device
84are always executed in FIFO order, and complete asynchronously through
85completion callbacks. There are also some simple synchronous wrappers
86for those calls, including ones for common transaction types like writing
87a command and then reading its response.
88
89There are two types of SPI driver, here called:
90
91 Controller drivers ... these are often built in to System-On-Chip
92 processors, and often support both Master and Slave roles.
93 These drivers touch hardware registers and may use DMA.
94 Or they can be PIO bitbangers, needing just GPIO pins.
95
96 Protocol drivers ... these pass messages through the controller
97 driver to communicate with a Slave or Master device on the
98 other side of an SPI link.
99
100So for example one protocol driver might talk to the MTD layer to export
101data to filesystems stored on SPI flash like DataFlash; and others might
102control audio interfaces, present touchscreen sensors as input interfaces,
103or monitor temperature and voltage levels during industrial processing.
104And those might all be sharing the same controller driver.
105
106A "struct spi_device" encapsulates the master-side interface between
107those two types of driver. At this writing, Linux has no slave side
108programming interface.
109
110There is a minimal core of SPI programming interfaces, focussing on
111using driver model to connect controller and protocol drivers using
112device tables provided by board specific initialization code. SPI
113shows up in sysfs in several locations:
114
115 /sys/devices/.../CTLR/spiB.C ... spi_device for on bus "B",
116 chipselect C, accessed through CTLR.
117
118 /sys/devices/.../CTLR/spiB.C/modalias ... identifies the driver
119 that should be used with this device (for hotplug/coldplug)
120
121 /sys/bus/spi/devices/spiB.C ... symlink to the physical
122 spiB-C device
123
124 /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices
125
126 /sys/class/spi_master/spiB ... class device for the controller
127 managing bus "B". All the spiB.* devices share the same
128 physical SPI bus segment, with SCLK, MOSI, and MISO.
129
130
131How does board-specific init code declare SPI devices?
132------------------------------------------------------
133Linux needs several kinds of information to properly configure SPI devices.
134That information is normally provided by board-specific code, even for
135chips that do support some of automated discovery/enumeration.
136
137DECLARE CONTROLLERS
138
139The first kind of information is a list of what SPI controllers exist.
140For System-on-Chip (SOC) based boards, these will usually be platform
141devices, and the controller may need some platform_data in order to
142operate properly. The "struct platform_device" will include resources
143like the physical address of the controller's first register and its IRQ.
144
145Platforms will often abstract the "register SPI controller" operation,
146maybe coupling it with code to initialize pin configurations, so that
147the arch/.../mach-*/board-*.c files for several boards can all share the
148same basic controller setup code. This is because most SOCs have several
149SPI-capable controllers, and only the ones actually usable on a given
150board should normally be set up and registered.
151
152So for example arch/.../mach-*/board-*.c files might have code like:
153
154 #include <asm/arch/spi.h> /* for mysoc_spi_data */
155
156 /* if your mach-* infrastructure doesn't support kernels that can
157 * run on multiple boards, pdata wouldn't benefit from "__init".
158 */
159 static struct mysoc_spi_data __init pdata = { ... };
160
161 static __init board_init(void)
162 {
163 ...
164 /* this board only uses SPI controller #2 */
165 mysoc_register_spi(2, &pdata);
166 ...
167 }
168
169And SOC-specific utility code might look something like:
170
171 #include <asm/arch/spi.h>
172
173 static struct platform_device spi2 = { ... };
174
175 void mysoc_register_spi(unsigned n, struct mysoc_spi_data *pdata)
176 {
177 struct mysoc_spi_data *pdata2;
178
179 pdata2 = kmalloc(sizeof *pdata2, GFP_KERNEL);
180 *pdata2 = pdata;
181 ...
182 if (n == 2) {
183 spi2->dev.platform_data = pdata2;
184 register_platform_device(&spi2);
185
186 /* also: set up pin modes so the spi2 signals are
187 * visible on the relevant pins ... bootloaders on
188 * production boards may already have done this, but
189 * developer boards will often need Linux to do it.
190 */
191 }
192 ...
193 }
194
195Notice how the platform_data for boards may be different, even if the
196same SOC controller is used. For example, on one board SPI might use
197an external clock, where another derives the SPI clock from current
198settings of some master clock.
199
200
201DECLARE SLAVE DEVICES
202
203The second kind of information is a list of what SPI slave devices exist
204on the target board, often with some board-specific data needed for the
205driver to work correctly.
206
207Normally your arch/.../mach-*/board-*.c files would provide a small table
208listing the SPI devices on each board. (This would typically be only a
209small handful.) That might look like:
210
211 static struct ads7846_platform_data ads_info = {
212 .vref_delay_usecs = 100,
213 .x_plate_ohms = 580,
214 .y_plate_ohms = 410,
215 };
216
217 static struct spi_board_info spi_board_info[] __initdata = {
218 {
219 .modalias = "ads7846",
220 .platform_data = &ads_info,
221 .mode = SPI_MODE_0,
222 .irq = GPIO_IRQ(31),
223 .max_speed_hz = 120000 /* max sample rate at 3V */ * 16,
224 .bus_num = 1,
225 .chip_select = 0,
226 },
227 };
228
229Again, notice how board-specific information is provided; each chip may need
230several types. This example shows generic constraints like the fastest SPI
231clock to allow (a function of board voltage in this case) or how an IRQ pin
232is wired, plus chip-specific constraints like an important delay that's
233changed by the capacitance at one pin.
234
235(There's also "controller_data", information that may be useful to the
236controller driver. An example would be peripheral-specific DMA tuning
237data or chipselect callbacks. This is stored in spi_device later.)
238
239The board_info should provide enough information to let the system work
240without the chip's driver being loaded. The most troublesome aspect of
241that is likely the SPI_CS_HIGH bit in the spi_device.mode field, since
242sharing a bus with a device that interprets chipselect "backwards" is
243not possible.
244
245Then your board initialization code would register that table with the SPI
246infrastructure, so that it's available later when the SPI master controller
247driver is registered:
248
249 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
250
251Like with other static board-specific setup, you won't unregister those.
252
253The widely used "card" style computers bundle memory, cpu, and little else
254onto a card that's maybe just thirty square centimeters. On such systems,
255your arch/.../mach-.../board-*.c file would primarily provide information
256about the devices on the mainboard into which such a card is plugged. That
257certainly includes SPI devices hooked up through the card connectors!
258
259
260NON-STATIC CONFIGURATIONS
261
262Developer boards often play by different rules than product boards, and one
263example is the potential need to hotplug SPI devices and/or controllers.
264
265For those cases you might need to use use spi_busnum_to_master() to look
266up the spi bus master, and will likely need spi_new_device() to provide the
267board info based on the board that was hotplugged. Of course, you'd later
268call at least spi_unregister_device() when that board is removed.
269
270When Linux includes support for MMC/SD/SDIO/DataFlash cards through SPI, those
271configurations will also be dynamic. Fortunately, those devices all support
272basic device identification probes, so that support should hotplug normally.
273
274
275How do I write an "SPI Protocol Driver"?
276----------------------------------------
277All SPI drivers are currently kernel drivers. A userspace driver API
278would just be another kernel driver, probably offering some lowlevel
279access through aio_read(), aio_write(), and ioctl() calls and using the
280standard userspace sysfs mechanisms to bind to a given SPI device.
281
282SPI protocol drivers somewhat resemble platform device drivers:
283
284 static struct spi_driver CHIP_driver = {
285 .driver = {
286 .name = "CHIP",
287 .bus = &spi_bus_type,
288 .owner = THIS_MODULE,
289 },
290
291 .probe = CHIP_probe,
292 .remove = __devexit_p(CHIP_remove),
293 .suspend = CHIP_suspend,
294 .resume = CHIP_resume,
295 };
296
297The driver core will autmatically attempt to bind this driver to any SPI
298device whose board_info gave a modalias of "CHIP". Your probe() code
299might look like this unless you're creating a class_device:
300
301 static int __devinit CHIP_probe(struct spi_device *spi)
302 {
303 struct CHIP *chip;
304 struct CHIP_platform_data *pdata;
305
306 /* assuming the driver requires board-specific data: */
307 pdata = &spi->dev.platform_data;
308 if (!pdata)
309 return -ENODEV;
310
311 /* get memory for driver's per-chip state */
312 chip = kzalloc(sizeof *chip, GFP_KERNEL);
313 if (!chip)
314 return -ENOMEM;
315 dev_set_drvdata(&spi->dev, chip);
316
317 ... etc
318 return 0;
319 }
320
321As soon as it enters probe(), the driver may issue I/O requests to
322the SPI device using "struct spi_message". When remove() returns,
323the driver guarantees that it won't submit any more such messages.
324
325 - An spi_message is a sequence of of protocol operations, executed
326 as one atomic sequence. SPI driver controls include:
327
328 + when bidirectional reads and writes start ... by how its
329 sequence of spi_transfer requests is arranged;
330
331 + optionally defining short delays after transfers ... using
332 the spi_transfer.delay_usecs setting;
333
334 + whether the chipselect becomes inactive after a transfer and
335 any delay ... by using the spi_transfer.cs_change flag;
336
337 + hinting whether the next message is likely to go to this same
338 device ... using the spi_transfer.cs_change flag on the last
339 transfer in that atomic group, and potentially saving costs
340 for chip deselect and select operations.
341
342 - Follow standard kernel rules, and provide DMA-safe buffers in
343 your messages. That way controller drivers using DMA aren't forced
344 to make extra copies unless the hardware requires it (e.g. working
345 around hardware errata that force the use of bounce buffering).
346
347 If standard dma_map_single() handling of these buffers is inappropriate,
348 you can use spi_message.is_dma_mapped to tell the controller driver
349 that you've already provided the relevant DMA addresses.
350
351 - The basic I/O primitive is spi_async(). Async requests may be
352 issued in any context (irq handler, task, etc) and completion
353 is reported using a callback provided with the message.
354 After any detected error, the chip is deselected and processing
355 of that spi_message is aborted.
356
357 - There are also synchronous wrappers like spi_sync(), and wrappers
358 like spi_read(), spi_write(), and spi_write_then_read(). These
359 may be issued only in contexts that may sleep, and they're all
360 clean (and small, and "optional") layers over spi_async().
361
362 - The spi_write_then_read() call, and convenience wrappers around
363 it, should only be used with small amounts of data where the
364 cost of an extra copy may be ignored. It's designed to support
365 common RPC-style requests, such as writing an eight bit command
366 and reading a sixteen bit response -- spi_w8r16() being one its
367 wrappers, doing exactly that.
368
369Some drivers may need to modify spi_device characteristics like the
370transfer mode, wordsize, or clock rate. This is done with spi_setup(),
371which would normally be called from probe() before the first I/O is
372done to the device.
373
374While "spi_device" would be the bottom boundary of the driver, the
375upper boundaries might include sysfs (especially for sensor readings),
376the input layer, ALSA, networking, MTD, the character device framework,
377or other Linux subsystems.
378
379Note that there are two types of memory your driver must manage as part
380of interacting with SPI devices.
381
382 - I/O buffers use the usual Linux rules, and must be DMA-safe.
383 You'd normally allocate them from the heap or free page pool.
384 Don't use the stack, or anything that's declared "static".
385
386 - The spi_message and spi_transfer metadata used to glue those
387 I/O buffers into a group of protocol transactions. These can
388 be allocated anywhere it's convenient, including as part of
389 other allocate-once driver data structures. Zero-init these.
390
391If you like, spi_message_alloc() and spi_message_free() convenience
392routines are available to allocate and zero-initialize an spi_message
393with several transfers.
394
395
396How do I write an "SPI Master Controller Driver"?
397-------------------------------------------------
398An SPI controller will probably be registered on the platform_bus; write
399a driver to bind to the device, whichever bus is involved.
400
401The main task of this type of driver is to provide an "spi_master".
402Use spi_alloc_master() to allocate the master, and class_get_devdata()
403to get the driver-private data allocated for that device.
404
405 struct spi_master *master;
406 struct CONTROLLER *c;
407
408 master = spi_alloc_master(dev, sizeof *c);
409 if (!master)
410 return -ENODEV;
411
412 c = class_get_devdata(&master->cdev);
413
414The driver will initialize the fields of that spi_master, including the
415bus number (maybe the same as the platform device ID) and three methods
416used to interact with the SPI core and SPI protocol drivers. It will
417also initialize its own internal state.
418
419 master->setup(struct spi_device *spi)
420 This sets up the device clock rate, SPI mode, and word sizes.
421 Drivers may change the defaults provided by board_info, and then
422 call spi_setup(spi) to invoke this routine. It may sleep.
423
424 master->transfer(struct spi_device *spi, struct spi_message *message)
425 This must not sleep. Its responsibility is arrange that the
426 transfer happens and its complete() callback is issued; the two
427 will normally happen later, after other transfers complete.
428
429 master->cleanup(struct spi_device *spi)
430 Your controller driver may use spi_device.controller_state to hold
431 state it dynamically associates with that device. If you do that,
432 be sure to provide the cleanup() method to free that state.
433
434The bulk of the driver will be managing the I/O queue fed by transfer().
435
436That queue could be purely conceptual. For example, a driver used only
437for low-frequency sensor acess might be fine using synchronous PIO.
438
439But the queue will probably be very real, using message->queue, PIO,
440often DMA (especially if the root filesystem is in SPI flash), and
441execution contexts like IRQ handlers, tasklets, or workqueues (such
442as keventd). Your driver can be as fancy, or as simple, as you need.
443
444
445THANKS TO
446---------
447Contributors to Linux-SPI discussions include (in alphabetical order,
448by last name):
449
450David Brownell
451Russell King
452Dmitry Pervushin
453Stephen Street
454Mark Underwood
455Andrew Victor
456Vitaly Wool
457
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index 2c81305090df..e409e5d07486 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -1,58 +1,56 @@
1Everything you ever wanted to know about Linux 2.6 -stable releases. 1Everything you ever wanted to know about Linux 2.6 -stable releases.
2 2
3Rules on what kind of patches are accepted, and what ones are not, into 3Rules on what kind of patches are accepted, and which ones are not, into the
4the "-stable" tree: 4"-stable" tree:
5 5
6 - It must be obviously correct and tested. 6 - It must be obviously correct and tested.
7 - It can not bigger than 100 lines, with context. 7 - It can not be bigger than 100 lines, with context.
8 - It must fix only one thing. 8 - It must fix only one thing.
9 - It must fix a real bug that bothers people (not a, "This could be a 9 - It must fix a real bug that bothers people (not a, "This could be a
10 problem..." type thing.) 10 problem..." type thing).
11 - It must fix a problem that causes a build error (but not for things 11 - It must fix a problem that causes a build error (but not for things
12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real 12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
13 security issue, or some "oh, that's not good" issue. In short, 13 security issue, or some "oh, that's not good" issue. In short, something
14 something critical. 14 critical.
15 - No "theoretical race condition" issues, unless an explanation of how 15 - No "theoretical race condition" issues, unless an explanation of how the
16 the race can be exploited. 16 race can be exploited is also provided.
17 - It can not contain any "trivial" fixes in it (spelling changes, 17 - It can not contain any "trivial" fixes in it (spelling changes,
18 whitespace cleanups, etc.) 18 whitespace cleanups, etc).
19 - It must be accepted by the relevant subsystem maintainer. 19 - It must be accepted by the relevant subsystem maintainer.
20 - It must follow Documentation/SubmittingPatches rules. 20 - It must follow the Documentation/SubmittingPatches rules.
21 21
22 22
23Procedure for submitting patches to the -stable tree: 23Procedure for submitting patches to the -stable tree:
24 24
25 - Send the patch, after verifying that it follows the above rules, to 25 - Send the patch, after verifying that it follows the above rules, to
26 stable@kernel.org. 26 stable@kernel.org.
27 - The sender will receive an ack when the patch has been accepted into 27 - The sender will receive an ACK when the patch has been accepted into the
28 the queue, or a nak if the patch is rejected. This response might 28 queue, or a NAK if the patch is rejected. This response might take a few
29 take a few days, according to the developer's schedules. 29 days, according to the developer's schedules.
30 - If accepted, the patch will be added to the -stable queue, for review 30 - If accepted, the patch will be added to the -stable queue, for review by
31 by other developers. 31 other developers.
32 - Security patches should not be sent to this alias, but instead to the 32 - Security patches should not be sent to this alias, but instead to the
33 documented security@kernel.org. 33 documented security@kernel.org address.
34 34
35 35
36Review cycle: 36Review cycle:
37 37
38 - When the -stable maintainers decide for a review cycle, the patches 38 - When the -stable maintainers decide for a review cycle, the patches will be
39 will be sent to the review committee, and the maintainer of the 39 sent to the review committee, and the maintainer of the affected area of
40 affected area of the patch (unless the submitter is the maintainer of 40 the patch (unless the submitter is the maintainer of the area) and CC: to
41 the area) and CC: to the linux-kernel mailing list. 41 the linux-kernel mailing list.
42 - The review committee has 48 hours in which to ack or nak the patch. 42 - The review committee has 48 hours in which to ACK or NAK the patch.
43 - If the patch is rejected by a member of the committee, or linux-kernel 43 - If the patch is rejected by a member of the committee, or linux-kernel
44 members object to the patch, bringing up issues that the maintainers 44 members object to the patch, bringing up issues that the maintainers and
45 and members did not realize, the patch will be dropped from the 45 members did not realize, the patch will be dropped from the queue.
46 queue. 46 - At the end of the review cycle, the ACKed patches will be added to the
47 - At the end of the review cycle, the acked patches will be added to 47 latest -stable release, and a new -stable release will happen.
48 the latest -stable release, and a new -stable release will happen. 48 - Security patches will be accepted into the -stable tree directly from the
49 - Security patches will be accepted into the -stable tree directly from 49 security kernel team, and not go through the normal review cycle.
50 the security kernel team, and not go through the normal review cycle.
51 Contact the kernel security team for more details on this procedure. 50 Contact the kernel security team for more details on this procedure.
52 51
53 52
54Review committe: 53Review committe:
55 54
56 - This will be made up of a number of kernel developers who have 55 - This is made up of a number of kernel developers who have volunteered for
57 volunteered for this task, and a few that haven't. 56 this task, and a few that haven't.
58
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 2f1aae32a5d9..391dd64363e7 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -26,12 +26,14 @@ Currently, these files are in /proc/sys/vm:
26- min_free_kbytes 26- min_free_kbytes
27- laptop_mode 27- laptop_mode
28- block_dump 28- block_dump
29- drop-caches
30- zone_reclaim_mode
29 31
30============================================================== 32==============================================================
31 33
32dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, 34dirty_ratio, dirty_background_ratio, dirty_expire_centisecs,
33dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode, 35dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode,
34block_dump, swap_token_timeout: 36block_dump, swap_token_timeout, drop-caches:
35 37
36See Documentation/filesystems/proc.txt 38See Documentation/filesystems/proc.txt
37 39
@@ -102,3 +104,37 @@ This is used to force the Linux VM to keep a minimum number
102of kilobytes free. The VM uses this number to compute a pages_min 104of kilobytes free. The VM uses this number to compute a pages_min
103value for each lowmem zone in the system. Each lowmem zone gets 105value for each lowmem zone in the system. Each lowmem zone gets
104a number of reserved free pages based proportionally on its size. 106a number of reserved free pages based proportionally on its size.
107
108==============================================================
109
110percpu_pagelist_fraction
111
112This is the fraction of pages at most (high mark pcp->high) in each zone that
113are allocated for each per cpu page list. The min value for this is 8. It
114means that we don't allow more than 1/8th of pages in each zone to be
115allocated in any single per_cpu_pagelist. This entry only changes the value
116of hot per cpu pagelists. User can specify a number like 100 to allocate
1171/100th of each zone to each per cpu page list.
118
119The batch value of each per cpu pagelist is also updated as a result. It is
120set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
121
122The initial value is zero. Kernel does not use this value at boot time to set
123the high water marks for each per cpu page list.
124
125===============================================================
126
127zone_reclaim_mode:
128
129This is set during bootup to 1 if it is determined that pages from
130remote zones will cause a significant performance reduction. The
131page allocator will then reclaim easily reusable pages (those page
132cache pages that are currently not used) before going off node.
133
134The user can override this setting. It may be beneficial to switch
135off zone reclaim if the system is used for a file server and all
136of memory should be used for caching files from disk.
137
138It may be beneficial to switch this on if one wants to do zone
139reclaim regardless of the numa distances in the system.
140
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index baf17b381588..ad0bedf678b3 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -202,17 +202,13 @@ you must call __handle_sysrq_nolock instead.
202 202
203* I have more questions, who can I ask? 203* I have more questions, who can I ask?
204~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205You may feel free to send email to myrdraal@deathsdoor.com, and I will
206respond as soon as possible.
207 -Myrdraal
208
209And I'll answer any questions about the registration system you got, also 205And I'll answer any questions about the registration system you got, also
210responding as soon as possible. 206responding as soon as possible.
211 -Crutcher 207 -Crutcher
212 208
213* Credits 209* Credits
214~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 210~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215Written by Mydraal <myrdraal@deathsdoor.com> 211Written by Mydraal <vulpyne@vulpyne.net>
216Updated by Adam Sulmicki <adam@cfar.umd.edu> 212Updated by Adam Sulmicki <adam@cfar.umd.edu>
217Updated by Jeremy M. Dolan <jmd@turbogeek.org> 2001/01/28 10:15:59 213Updated by Jeremy M. Dolan <jmd@turbogeek.org> 2001/01/28 10:15:59
218Added to by Crutcher Dunnavant <crutcher+kernel@datastacks.com> 214Added to by Crutcher Dunnavant <crutcher+kernel@datastacks.com>
diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv
index 330246ac80f8..b72706c58a44 100644
--- a/Documentation/video4linux/CARDLIST.bttv
+++ b/Documentation/video4linux/CARDLIST.bttv
@@ -141,3 +141,5 @@
141140 -> Osprey 440 [0070:ff07] 141140 -> Osprey 440 [0070:ff07]
142141 -> Asound Skyeye PCTV 142141 -> Asound Skyeye PCTV
143142 -> Sabrent TV-FM (bttv version) 143142 -> Sabrent TV-FM (bttv version)
144143 -> Hauppauge ImpactVCB (bt878) [0070:13eb]
145144 -> MagicTV
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index a1017d1a85d4..56e194f1a0b0 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -16,10 +16,10 @@
16 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00] 16 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00]
17 16 -> KWorld LTV883RF 17 16 -> KWorld LTV883RF
18 17 -> DViCO FusionHDTV 3 Gold-Q [18ac:d810] 18 17 -> DViCO FusionHDTV 3 Gold-Q [18ac:d810]
19 18 -> Hauppauge Nova-T DVB-T [0070:9002] 19 18 -> Hauppauge Nova-T DVB-T [0070:9002,0070:9001]
20 19 -> Conexant DVB-T reference design [14f1:0187] 20 19 -> Conexant DVB-T reference design [14f1:0187]
21 20 -> Provideo PV259 [1540:2580] 21 20 -> Provideo PV259 [1540:2580]
22 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10] 22 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10,18ac:db11]
23 22 -> pcHDTV HD3000 HDTV [7063:3000] 23 22 -> pcHDTV HD3000 HDTV [7063:3000]
24 23 -> digitalnow DNTV Live! DVB-T [17de:a8a6] 24 23 -> digitalnow DNTV Live! DVB-T [17de:a8a6]
25 24 -> Hauppauge WinTV 28xxx (Roslyn) models [0070:2801] 25 24 -> Hauppauge WinTV 28xxx (Roslyn) models [0070:2801]
@@ -35,3 +35,11 @@
35 34 -> ATI HDTV Wonder [1002:a101] 35 34 -> ATI HDTV Wonder [1002:a101]
36 35 -> WinFast DTV1000-T [107d:665f] 36 35 -> WinFast DTV1000-T [107d:665f]
37 36 -> AVerTV 303 (M126) [1461:000a] 37 36 -> AVerTV 303 (M126) [1461:000a]
38 37 -> Hauppauge Nova-S-Plus DVB-S [0070:9201,0070:9202]
39 38 -> Hauppauge Nova-SE2 DVB-S [0070:9200]
40 39 -> KWorld DVB-S 100 [17de:08b2]
41 40 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid [0070:9400,0070:9402]
42 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802]
43 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025]
44 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1]
45 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50]
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index efb708ec116a..cb3a59bbeb17 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -56,7 +56,7 @@
56 55 -> LifeView FlyDVB-T DUO [5168:0502,5168:0306] 56 55 -> LifeView FlyDVB-T DUO [5168:0502,5168:0306]
57 56 -> Avermedia AVerTV 307 [1461:a70a] 57 56 -> Avermedia AVerTV 307 [1461:a70a]
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: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 -> Typhoon DVB-T Duo Digital/Analog Cardbus [4e42:0502] 61 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus [4e42:0502]
62 61 -> Philips TOUGH DVB-T reference design [1131:2004] 62 61 -> Philips TOUGH DVB-T reference design [1131:2004]
@@ -81,4 +81,5 @@
81 80 -> ASUS Digimatrix TV [1043:0210] 81 80 -> ASUS Digimatrix TV [1043:0210]
82 81 -> Philips Tiger reference design [1131:2018] 82 81 -> Philips Tiger reference design [1131:2018]
83 82 -> MSI TV@Anywhere plus [1462:6231] 83 82 -> MSI TV@Anywhere plus [1462:6231]
84 84 83 -> Terratec Cinergy 250 PCI TV [153b:1160]
85 84 -> LifeView FlyDVB Trio [5168:0319]
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
index 9d6544ea9f41..f6d0cf7b7922 100644
--- a/Documentation/video4linux/CARDLIST.tuner
+++ b/Documentation/video4linux/CARDLIST.tuner
@@ -40,7 +40,7 @@ tuner=38 - Philips PAL/SECAM multi (FM1216ME MK3)
40tuner=39 - LG NTSC (newer TAPC series) 40tuner=39 - LG NTSC (newer TAPC series)
41tuner=40 - HITACHI V7-J180AT 41tuner=40 - HITACHI V7-J180AT
42tuner=41 - Philips PAL_MK (FI1216 MK) 42tuner=41 - Philips PAL_MK (FI1216 MK)
43tuner=42 - Philips 1236D ATSC/NTSC daul in 43tuner=42 - Philips 1236D ATSC/NTSC dual in
44tuner=43 - Philips NTSC MK3 (FM1236MK3 or FM1236/F) 44tuner=43 - Philips NTSC MK3 (FM1236MK3 or FM1236/F)
45tuner=44 - Philips 4 in 1 (ATI TV Wonder Pro/Conexant) 45tuner=44 - Philips 4 in 1 (ATI TV Wonder Pro/Conexant)
46tuner=45 - Microtune 4049 FM5 46tuner=45 - Microtune 4049 FM5
@@ -50,7 +50,7 @@ tuner=48 - Tenna TNF 8831 BGFF)
50tuner=49 - Microtune 4042 FI5 ATSC/NTSC dual in 50tuner=49 - Microtune 4042 FI5 ATSC/NTSC dual in
51tuner=50 - TCL 2002N 51tuner=50 - TCL 2002N
52tuner=51 - Philips PAL/SECAM_D (FM 1256 I-H3) 52tuner=51 - Philips PAL/SECAM_D (FM 1256 I-H3)
53tuner=52 - Thomson DDT 7610 (ATSC/NTSC) 53tuner=52 - Thomson DTT 7610 (ATSC/NTSC)
54tuner=53 - Philips FQ1286 54tuner=53 - Philips FQ1286
55tuner=54 - tda8290+75 55tuner=54 - tda8290+75
56tuner=55 - TCL 2002MB 56tuner=55 - TCL 2002MB
@@ -58,7 +58,7 @@ tuner=56 - Philips PAL/SECAM multi (FQ1216AME MK4)
58tuner=57 - Philips FQ1236A MK4 58tuner=57 - Philips FQ1236A MK4
59tuner=58 - Ymec TVision TVF-8531MF/8831MF/8731MF 59tuner=58 - Ymec TVision TVF-8531MF/8831MF/8731MF
60tuner=59 - Ymec TVision TVF-5533MF 60tuner=59 - Ymec TVision TVF-5533MF
61tuner=60 - Thomson DDT 7611 (ATSC/NTSC) 61tuner=60 - Thomson DTT 761X (ATSC/NTSC)
62tuner=61 - Tena TNF9533-D/IF/TNF9533-B/DF 62tuner=61 - Tena TNF9533-D/IF/TNF9533-B/DF
63tuner=62 - Philips TEA5767HN FM Radio 63tuner=62 - Philips TEA5767HN FM Radio
64tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner 64tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner
@@ -68,3 +68,4 @@ tuner=66 - LG NTSC (TALN mini series)
68tuner=67 - Philips TD1316 Hybrid Tuner 68tuner=67 - Philips TD1316 Hybrid Tuner
69tuner=68 - Philips TUV1236D ATSC/NTSC dual in 69tuner=68 - Philips TUV1236D ATSC/NTSC dual in
70tuner=69 - Tena TNF 5335 MF 70tuner=69 - Tena TNF 5335 MF
71tuner=70 - Samsung TCPN 2121P30A
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index e566affeed7f..9c5fc15d03d1 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -125,7 +125,7 @@ SMP
125 cpumask=MASK only use cpus with bits set in mask 125 cpumask=MASK only use cpus with bits set in mask
126 126
127 additional_cpus=NUM Allow NUM more CPUs for hotplug 127 additional_cpus=NUM Allow NUM more CPUs for hotplug
128 (defaults are specified by the BIOS or half the available CPUs) 128 (defaults are specified by the BIOS, see Documentation/x86_64/cpu-hotplug-spec)
129 129
130NUMA 130NUMA
131 131
@@ -198,6 +198,6 @@ Debugging
198 198
199Misc 199Misc
200 200
201 noreplacement Don't replace instructions with more appropiate ones 201 noreplacement Don't replace instructions with more appropriate ones
202 for the CPU. This may be useful on asymmetric MP systems 202 for the CPU. This may be useful on asymmetric MP systems
203 where some CPU have less capabilities than the others. 203 where some CPU have less capabilities than the others.
diff --git a/Documentation/x86_64/cpu-hotplug-spec b/Documentation/x86_64/cpu-hotplug-spec
new file mode 100644
index 000000000000..5c0fa345e556
--- /dev/null
+++ b/Documentation/x86_64/cpu-hotplug-spec
@@ -0,0 +1,21 @@
1Firmware support for CPU hotplug under Linux/x86-64
2---------------------------------------------------
3
4Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to
5know in advance boot time the maximum number of CPUs that could be plugged
6into the system. ACPI 3.0 currently has no official way to supply
7this information from the firmware to the operating system.
8
9In ACPI each CPU needs an LAPIC object in the MADT table (5.2.11.5 in the
10ACPI 3.0 specification). ACPI already has the concept of disabled LAPIC
11objects by setting the Enabled bit in the LAPIC object to zero.
12
13For CPU hotplug Linux/x86-64 expects now that any possible future hotpluggable
14CPU is already available in the MADT. If the CPU is not available yet
15it should have its LAPIC Enabled bit set to 0. Linux will use the number
16of disabled LAPICs to compute the maximum number of future CPUs.
17
18In the worst case the user can overwrite this choice using a command line
19option (additional_cpus=...), but it is recommended to supply the correct
20number (or a reasonable approximation of it, with erring towards more not less)
21in the MADT to avoid manual configuration.