aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/00-INDEX7
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb33
-rw-r--r--Documentation/BUG-HUNTING39
-rw-r--r--Documentation/DocBook/kernel-api.tmpl2
-rw-r--r--Documentation/DocBook/kernel-locking.tmpl32
-rw-r--r--Documentation/DocBook/s390-drivers.tmpl21
-rw-r--r--Documentation/Smack.txt493
-rw-r--r--Documentation/SubmittingPatches16
-rw-r--r--Documentation/acpi/method-tracing.txt26
-rw-r--r--Documentation/arm/Sharp-LH/IOBarrier2
-rw-r--r--Documentation/debugging-modules.txt4
-rw-r--r--Documentation/driver-model/platform.txt6
-rw-r--r--Documentation/fb/deferred_io.txt6
-rw-r--r--Documentation/feature-removal-schedule.txt23
-rw-r--r--Documentation/filesystems/configfs/configfs.txt2
-rw-r--r--Documentation/filesystems/porting6
-rw-r--r--Documentation/filesystems/proc.txt104
-rw-r--r--Documentation/filesystems/ramfs-rootfs-initramfs.txt2
-rw-r--r--Documentation/filesystems/relay.txt2
-rw-r--r--Documentation/frv/README.txt (renamed from Documentation/fujitsu/frv/README.txt)0
-rw-r--r--Documentation/frv/atomic-ops.txt (renamed from Documentation/fujitsu/frv/atomic-ops.txt)0
-rw-r--r--Documentation/frv/booting.txt (renamed from Documentation/fujitsu/frv/booting.txt)2
-rw-r--r--Documentation/frv/clock.txt (renamed from Documentation/fujitsu/frv/clock.txt)0
-rw-r--r--Documentation/frv/configuring.txt (renamed from Documentation/fujitsu/frv/configuring.txt)0
-rw-r--r--Documentation/frv/features.txt (renamed from Documentation/fujitsu/frv/features.txt)0
-rw-r--r--Documentation/frv/gdbinit (renamed from Documentation/fujitsu/frv/gdbinit)0
-rw-r--r--Documentation/frv/gdbstub.txt (renamed from Documentation/fujitsu/frv/gdbstub.txt)0
-rw-r--r--Documentation/frv/kernel-ABI.txt (renamed from Documentation/fujitsu/frv/kernel-ABI.txt)0
-rw-r--r--Documentation/frv/mmu-layout.txt (renamed from Documentation/fujitsu/frv/mmu-layout.txt)0
-rw-r--r--Documentation/gpio.txt133
-rw-r--r--Documentation/i2c/chips/pca95393
-rw-r--r--Documentation/ia64/aliasing-test.c15
-rw-r--r--Documentation/ide/ChangeLog.ide-tape.1995-2002257
-rw-r--r--Documentation/ide/ide-tape.txt146
-rw-r--r--Documentation/initrd.txt2
-rw-r--r--Documentation/ja_JP/stable_kernel_rules.txt79
-rw-r--r--Documentation/kernel-parameters.txt29
-rw-r--r--Documentation/kprobes.txt81
-rw-r--r--Documentation/kref.txt20
-rw-r--r--Documentation/lguest/lguest.c231
-rw-r--r--Documentation/md.txt10
-rw-r--r--Documentation/networking/decnet.txt2
-rw-r--r--Documentation/pci.txt37
-rw-r--r--Documentation/pcmcia/driver-changes.txt4
-rw-r--r--Documentation/pm_qos_interface.txt59
-rw-r--r--Documentation/power/basic-pm-debugging.txt216
-rw-r--r--Documentation/power/devices.txt49
-rw-r--r--Documentation/power/drivers-testing.txt30
-rw-r--r--Documentation/power/notifiers.txt8
-rw-r--r--Documentation/power/userland-swsusp.txt82
-rw-r--r--Documentation/power_supply_class.txt6
-rw-r--r--Documentation/rtc.txt42
-rw-r--r--Documentation/smp.txt22
-rw-r--r--Documentation/sysctl/fs.txt10
-rw-r--r--Documentation/sysctl/vm.txt7
-rw-r--r--Documentation/thinkpad-acpi.txt116
-rw-r--r--Documentation/unaligned-memory-access.txt226
-rw-r--r--Documentation/usb/gadget_printer.txt510
-rw-r--r--Documentation/usb/iuu_phoenix.txt84
-rw-r--r--Documentation/w1/masters/00-INDEX2
-rw-r--r--Documentation/w1/masters/w1-gpio33
-rw-r--r--Documentation/x86_64/00-INDEX16
62 files changed, 2892 insertions, 503 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index c3014df066c4..33f55917f23f 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -14,6 +14,7 @@ Following translations are available on the WWW:
14 - this file. 14 - this file.
15ABI/ 15ABI/
16 - info on kernel <-> userspace ABI and relative interface stability. 16 - info on kernel <-> userspace ABI and relative interface stability.
17
17BUG-HUNTING 18BUG-HUNTING
18 - brute force method of doing binary search of patches to find bug. 19 - brute force method of doing binary search of patches to find bug.
19Changes 20Changes
@@ -66,6 +67,8 @@ VGA-softcursor.txt
66 - how to change your VGA cursor from a blinking underscore. 67 - how to change your VGA cursor from a blinking underscore.
67accounting/ 68accounting/
68 - documentation on accounting and taskstats. 69 - documentation on accounting and taskstats.
70acpi/
71 - info on ACPI-specific hooks in the kernel.
69aoe/ 72aoe/
70 - description of AoE (ATA over Ethernet) along with config examples. 73 - description of AoE (ATA over Ethernet) along with config examples.
71applying-patches.txt 74applying-patches.txt
@@ -154,7 +157,7 @@ firmware_class/
154 - request_firmware() hotplug interface info. 157 - request_firmware() hotplug interface info.
155floppy.txt 158floppy.txt
156 - notes and driver options for the floppy disk driver. 159 - notes and driver options for the floppy disk driver.
157fujitsu/ 160frv/
158 - Fujitsu FR-V Linux documentation. 161 - Fujitsu FR-V Linux documentation.
159gpio.txt 162gpio.txt
160 - overview of GPIO (General Purpose Input/Output) access conventions. 163 - overview of GPIO (General Purpose Input/Output) access conventions.
@@ -364,8 +367,6 @@ sharedsubtree.txt
364 - a description of shared subtrees for namespaces. 367 - a description of shared subtrees for namespaces.
365smart-config.txt 368smart-config.txt
366 - description of the Smart Config makefile feature. 369 - description of the Smart Config makefile feature.
367smp.txt
368 - a few notes on symmetric multi-processing.
369sony-laptop.txt 370sony-laptop.txt
370 - Sony Notebook Control Driver (SNC) Readme. 371 - Sony Notebook Control Driver (SNC) Readme.
371sonypi.txt 372sonypi.txt
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index 9734577d1711..11a3c1682cec 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -52,3 +52,36 @@ Description:
52 facility is inherently dangerous, it is disabled by default 52 facility is inherently dangerous, it is disabled by default
53 for all devices except hubs. For more information, see 53 for all devices except hubs. For more information, see
54 Documentation/usb/persist.txt. 54 Documentation/usb/persist.txt.
55
56What: /sys/bus/usb/device/.../power/connected_duration
57Date: January 2008
58KernelVersion: 2.6.25
59Contact: Sarah Sharp <sarah.a.sharp@intel.com>
60Description:
61 If CONFIG_PM and CONFIG_USB_SUSPEND are enabled, then this file
62 is present. When read, it returns the total time (in msec)
63 that the USB device has been connected to the machine. This
64 file is read-only.
65Users:
66 PowerTOP <power@bughost.org>
67 http://www.lesswatts.org/projects/powertop/
68
69What: /sys/bus/usb/device/.../power/active_duration
70Date: January 2008
71KernelVersion: 2.6.25
72Contact: Sarah Sharp <sarah.a.sharp@intel.com>
73Description:
74 If CONFIG_PM and CONFIG_USB_SUSPEND are enabled, then this file
75 is present. When read, it returns the total time (in msec)
76 that the USB device has been active, i.e. not in a suspended
77 state. This file is read-only.
78
79 Tools can use this file and the connected_duration file to
80 compute the percentage of time that a device has been active.
81 For example,
82 echo $((100 * `cat active_duration` / `cat connected_duration`))
83 will give an integer percentage. Note that this does not
84 account for counter wrap.
85Users:
86 PowerTOP <power@bughost.org>
87 http://www.lesswatts.org/projects/powertop/
diff --git a/Documentation/BUG-HUNTING b/Documentation/BUG-HUNTING
index 35f5bd243336..65022a87bf17 100644
--- a/Documentation/BUG-HUNTING
+++ b/Documentation/BUG-HUNTING
@@ -53,7 +53,7 @@ Finding it the old way
53 53
54[Sat Mar 2 10:32:33 PST 1996 KERNEL_BUG-HOWTO lm@sgi.com (Larry McVoy)] 54[Sat Mar 2 10:32:33 PST 1996 KERNEL_BUG-HOWTO lm@sgi.com (Larry McVoy)]
55 55
56This is how to track down a bug if you know nothing about kernel hacking. 56This is how to track down a bug if you know nothing about kernel hacking.
57It's a brute force approach but it works pretty well. 57It's a brute force approach but it works pretty well.
58 58
59You need: 59You need:
@@ -66,12 +66,12 @@ You will then do:
66 66
67 . Rebuild a revision that you believe works, install, and verify that. 67 . Rebuild a revision that you believe works, install, and verify that.
68 . Do a binary search over the kernels to figure out which one 68 . Do a binary search over the kernels to figure out which one
69 introduced the bug. I.e., suppose 1.3.28 didn't have the bug, but 69 introduced the bug. I.e., suppose 1.3.28 didn't have the bug, but
70 you know that 1.3.69 does. Pick a kernel in the middle and build 70 you know that 1.3.69 does. Pick a kernel in the middle and build
71 that, like 1.3.50. Build & test; if it works, pick the mid point 71 that, like 1.3.50. Build & test; if it works, pick the mid point
72 between .50 and .69, else the mid point between .28 and .50. 72 between .50 and .69, else the mid point between .28 and .50.
73 . You'll narrow it down to the kernel that introduced the bug. You 73 . You'll narrow it down to the kernel that introduced the bug. You
74 can probably do better than this but it gets tricky. 74 can probably do better than this but it gets tricky.
75 75
76 . Narrow it down to a subdirectory 76 . Narrow it down to a subdirectory
77 77
@@ -81,27 +81,27 @@ You will then do:
81 directories: 81 directories:
82 82
83 Copy the non-working directory next to the working directory 83 Copy the non-working directory next to the working directory
84 as "dir.63". 84 as "dir.63".
85 One directory at time, try moving the working directory to 85 One directory at time, try moving the working directory to
86 "dir.62" and mv dir.63 dir"time, try 86 "dir.62" and mv dir.63 dir"time, try
87 87
88 mv dir dir.62 88 mv dir dir.62
89 mv dir.63 dir 89 mv dir.63 dir
90 find dir -name '*.[oa]' -print | xargs rm -f 90 find dir -name '*.[oa]' -print | xargs rm -f
91 91
92 And then rebuild and retest. Assuming that all related 92 And then rebuild and retest. Assuming that all related
93 changes were contained in the sub directory, this should 93 changes were contained in the sub directory, this should
94 isolate the change to a directory. 94 isolate the change to a directory.
95 95
96 Problems: changes in header files may have occurred; I've 96 Problems: changes in header files may have occurred; I've
97 found in my case that they were self explanatory - you may 97 found in my case that they were self explanatory - you may
98 or may not want to give up when that happens. 98 or may not want to give up when that happens.
99 99
100 . Narrow it down to a file 100 . Narrow it down to a file
101 101
102 - You can apply the same technique to each file in the directory, 102 - You can apply the same technique to each file in the directory,
103 hoping that the changes in that file are self contained. 103 hoping that the changes in that file are self contained.
104 104
105 . Narrow it down to a routine 105 . Narrow it down to a routine
106 106
107 - You can take the old file and the new file and manually create 107 - You can take the old file and the new file and manually create
@@ -130,7 +130,7 @@ You will then do:
130 that makes the difference. 130 that makes the difference.
131 131
132Finally, you take all the info that you have, kernel revisions, bug 132Finally, you take all the info that you have, kernel revisions, bug
133description, the extent to which you have narrowed it down, and pass 133description, the extent to which you have narrowed it down, and pass
134that off to whomever you believe is the maintainer of that section. 134that off to whomever you believe is the maintainer of that section.
135A post to linux.dev.kernel isn't such a bad idea if you've done some 135A post to linux.dev.kernel isn't such a bad idea if you've done some
136work to narrow it down. 136work to narrow it down.
@@ -214,6 +214,23 @@ And recompile the kernel with CONFIG_DEBUG_INFO enabled:
214 gdb vmlinux 214 gdb vmlinux
215 (gdb) p vt_ioctl 215 (gdb) p vt_ioctl
216 (gdb) l *(0x<address of vt_ioctl> + 0xda8) 216 (gdb) l *(0x<address of vt_ioctl> + 0xda8)
217or, as one command
218 (gdb) l *(vt_ioctl + 0xda8)
219
220If you have a call trace, such as :-
221>Call Trace:
222> [<ffffffff8802c8e9>] :jbd:log_wait_commit+0xa3/0xf5
223> [<ffffffff810482d9>] autoremove_wake_function+0x0/0x2e
224> [<ffffffff8802770b>] :jbd:journal_stop+0x1be/0x1ee
225> ...
226this shows the problem in the :jbd: module. You can load that module in gdb
227and list the relevant code.
228 gdb fs/jbd/jbd.ko
229 (gdb) p log_wait_commit
230 (gdb) l *(0x<address> + 0xa3)
231or
232 (gdb) l *(log_wait_commit + 0xa3)
233
217 234
218Another very useful option of the Kernel Hacking section in menuconfig is 235Another very useful option of the Kernel Hacking section in menuconfig is
219Debug memory allocations. This will help you see whether data has been 236Debug memory allocations. This will help you see whether data has been
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 77436d735013..059aaf20951a 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -165,6 +165,7 @@ X!Ilib/string.c
165!Emm/vmalloc.c 165!Emm/vmalloc.c
166!Imm/page_alloc.c 166!Imm/page_alloc.c
167!Emm/mempool.c 167!Emm/mempool.c
168!Emm/dmapool.c
168!Emm/page-writeback.c 169!Emm/page-writeback.c
169!Emm/truncate.c 170!Emm/truncate.c
170 </sect1> 171 </sect1>
@@ -371,7 +372,6 @@ X!Iinclude/linux/device.h
371!Edrivers/base/class.c 372!Edrivers/base/class.c
372!Edrivers/base/firmware_class.c 373!Edrivers/base/firmware_class.c
373!Edrivers/base/transport_class.c 374!Edrivers/base/transport_class.c
374!Edrivers/base/dmapool.c
375<!-- Cannot be included, because 375<!-- Cannot be included, because
376 attribute_container_add_class_device_adapter 376 attribute_container_add_class_device_adapter
377 and attribute_container_classdev_to_container 377 and attribute_container_classdev_to_container
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
index 01825ee7db64..2e9d6b41f034 100644
--- a/Documentation/DocBook/kernel-locking.tmpl
+++ b/Documentation/DocBook/kernel-locking.tmpl
@@ -717,7 +717,7 @@ used, and when it gets full, throws out the least used one.
717 <para> 717 <para>
718For our first example, we assume that all operations are in user 718For our first example, we assume that all operations are in user
719context (ie. from system calls), so we can sleep. This means we can 719context (ie. from system calls), so we can sleep. This means we can
720use a semaphore to protect the cache and all the objects within 720use a mutex to protect the cache and all the objects within
721it. Here's the code: 721it. Here's the code:
722 </para> 722 </para>
723 723
@@ -725,7 +725,7 @@ it. Here's the code:
725#include &lt;linux/list.h&gt; 725#include &lt;linux/list.h&gt;
726#include &lt;linux/slab.h&gt; 726#include &lt;linux/slab.h&gt;
727#include &lt;linux/string.h&gt; 727#include &lt;linux/string.h&gt;
728#include &lt;asm/semaphore.h&gt; 728#include &lt;linux/mutex.h&gt;
729#include &lt;asm/errno.h&gt; 729#include &lt;asm/errno.h&gt;
730 730
731struct object 731struct object
@@ -737,7 +737,7 @@ struct object
737}; 737};
738 738
739/* Protects the cache, cache_num, and the objects within it */ 739/* Protects the cache, cache_num, and the objects within it */
740static DECLARE_MUTEX(cache_lock); 740static DEFINE_MUTEX(cache_lock);
741static LIST_HEAD(cache); 741static LIST_HEAD(cache);
742static unsigned int cache_num = 0; 742static unsigned int cache_num = 0;
743#define MAX_CACHE_SIZE 10 743#define MAX_CACHE_SIZE 10
@@ -789,17 +789,17 @@ int cache_add(int id, const char *name)
789 obj-&gt;id = id; 789 obj-&gt;id = id;
790 obj-&gt;popularity = 0; 790 obj-&gt;popularity = 0;
791 791
792 down(&amp;cache_lock); 792 mutex_lock(&amp;cache_lock);
793 __cache_add(obj); 793 __cache_add(obj);
794 up(&amp;cache_lock); 794 mutex_unlock(&amp;cache_lock);
795 return 0; 795 return 0;
796} 796}
797 797
798void cache_delete(int id) 798void cache_delete(int id)
799{ 799{
800 down(&amp;cache_lock); 800 mutex_lock(&amp;cache_lock);
801 __cache_delete(__cache_find(id)); 801 __cache_delete(__cache_find(id));
802 up(&amp;cache_lock); 802 mutex_unlock(&amp;cache_lock);
803} 803}
804 804
805int cache_find(int id, char *name) 805int cache_find(int id, char *name)
@@ -807,13 +807,13 @@ int cache_find(int id, char *name)
807 struct object *obj; 807 struct object *obj;
808 int ret = -ENOENT; 808 int ret = -ENOENT;
809 809
810 down(&amp;cache_lock); 810 mutex_lock(&amp;cache_lock);
811 obj = __cache_find(id); 811 obj = __cache_find(id);
812 if (obj) { 812 if (obj) {
813 ret = 0; 813 ret = 0;
814 strcpy(name, obj-&gt;name); 814 strcpy(name, obj-&gt;name);
815 } 815 }
816 up(&amp;cache_lock); 816 mutex_unlock(&amp;cache_lock);
817 return ret; 817 return ret;
818} 818}
819</programlisting> 819</programlisting>
@@ -853,7 +853,7 @@ The change is shown below, in standard patch format: the
853 int popularity; 853 int popularity;
854 }; 854 };
855 855
856-static DECLARE_MUTEX(cache_lock); 856-static DEFINE_MUTEX(cache_lock);
857+static spinlock_t cache_lock = SPIN_LOCK_UNLOCKED; 857+static spinlock_t cache_lock = SPIN_LOCK_UNLOCKED;
858 static LIST_HEAD(cache); 858 static LIST_HEAD(cache);
859 static unsigned int cache_num = 0; 859 static unsigned int cache_num = 0;
@@ -870,22 +870,22 @@ The change is shown below, in standard patch format: the
870 obj-&gt;id = id; 870 obj-&gt;id = id;
871 obj-&gt;popularity = 0; 871 obj-&gt;popularity = 0;
872 872
873- down(&amp;cache_lock); 873- mutex_lock(&amp;cache_lock);
874+ spin_lock_irqsave(&amp;cache_lock, flags); 874+ spin_lock_irqsave(&amp;cache_lock, flags);
875 __cache_add(obj); 875 __cache_add(obj);
876- up(&amp;cache_lock); 876- mutex_unlock(&amp;cache_lock);
877+ spin_unlock_irqrestore(&amp;cache_lock, flags); 877+ spin_unlock_irqrestore(&amp;cache_lock, flags);
878 return 0; 878 return 0;
879 } 879 }
880 880
881 void cache_delete(int id) 881 void cache_delete(int id)
882 { 882 {
883- down(&amp;cache_lock); 883- mutex_lock(&amp;cache_lock);
884+ unsigned long flags; 884+ unsigned long flags;
885+ 885+
886+ spin_lock_irqsave(&amp;cache_lock, flags); 886+ spin_lock_irqsave(&amp;cache_lock, flags);
887 __cache_delete(__cache_find(id)); 887 __cache_delete(__cache_find(id));
888- up(&amp;cache_lock); 888- mutex_unlock(&amp;cache_lock);
889+ spin_unlock_irqrestore(&amp;cache_lock, flags); 889+ spin_unlock_irqrestore(&amp;cache_lock, flags);
890 } 890 }
891 891
@@ -895,14 +895,14 @@ The change is shown below, in standard patch format: the
895 int ret = -ENOENT; 895 int ret = -ENOENT;
896+ unsigned long flags; 896+ unsigned long flags;
897 897
898- down(&amp;cache_lock); 898- mutex_lock(&amp;cache_lock);
899+ spin_lock_irqsave(&amp;cache_lock, flags); 899+ spin_lock_irqsave(&amp;cache_lock, flags);
900 obj = __cache_find(id); 900 obj = __cache_find(id);
901 if (obj) { 901 if (obj) {
902 ret = 0; 902 ret = 0;
903 strcpy(name, obj-&gt;name); 903 strcpy(name, obj-&gt;name);
904 } 904 }
905- up(&amp;cache_lock); 905- mutex_unlock(&amp;cache_lock);
906+ spin_unlock_irqrestore(&amp;cache_lock, flags); 906+ spin_unlock_irqrestore(&amp;cache_lock, flags);
907 return ret; 907 return ret;
908 } 908 }
diff --git a/Documentation/DocBook/s390-drivers.tmpl b/Documentation/DocBook/s390-drivers.tmpl
index 3d2f31b99dd9..4acc73240a6d 100644
--- a/Documentation/DocBook/s390-drivers.tmpl
+++ b/Documentation/DocBook/s390-drivers.tmpl
@@ -59,7 +59,7 @@
59 <title>Introduction</title> 59 <title>Introduction</title>
60 <para> 60 <para>
61 This document describes the interfaces available for device drivers that 61 This document describes the interfaces available for device drivers that
62 drive s390 based channel attached devices. This includes interfaces for 62 drive s390 based channel attached I/O devices. This includes interfaces for
63 interaction with the hardware and interfaces for interacting with the 63 interaction with the hardware and interfaces for interacting with the
64 common driver core. Those interfaces are provided by the s390 common I/O 64 common driver core. Those interfaces are provided by the s390 common I/O
65 layer. 65 layer.
@@ -86,9 +86,10 @@
86 The ccw bus typically contains the majority of devices available to 86 The ccw bus typically contains the majority of devices available to
87 a s390 system. Named after the channel command word (ccw), the basic 87 a s390 system. Named after the channel command word (ccw), the basic
88 command structure used to address its devices, the ccw bus contains 88 command structure used to address its devices, the ccw bus contains
89 so-called channel attached devices. They are addressed via subchannels, 89 so-called channel attached devices. They are addressed via I/O
90 visible on the css bus. A device driver, however, will never interact 90 subchannels, visible on the css bus. A device driver for
91 with the subchannel directly, but only via the device on the ccw bus, 91 channel-attached devices, however, will never interact with the
92 subchannel directly, but only via the I/O device on the ccw bus,
92 the ccw device. 93 the ccw device.
93 </para> 94 </para>
94 <sect1 id="channelIO"> 95 <sect1 id="channelIO">
@@ -116,7 +117,6 @@
116!Iinclude/asm-s390/ccwdev.h 117!Iinclude/asm-s390/ccwdev.h
117!Edrivers/s390/cio/device.c 118!Edrivers/s390/cio/device.c
118!Edrivers/s390/cio/device_ops.c 119!Edrivers/s390/cio/device_ops.c
119!Edrivers/s390/cio/airq.c
120 </sect1> 120 </sect1>
121 <sect1 id="cmf"> 121 <sect1 id="cmf">
122 <title>The channel-measurement facility</title> 122 <title>The channel-measurement facility</title>
@@ -147,4 +147,15 @@
147 </sect1> 147 </sect1>
148 </chapter> 148 </chapter>
149 149
150 <chapter id="genericinterfaces">
151 <title>Generic interfaces</title>
152 <para>
153 Some interfaces are available to other drivers that do not necessarily
154 have anything to do with the busses described above, but still are
155 indirectly using basic infrastructure in the common I/O layer.
156 One example is the support for adapter interrupts.
157 </para>
158!Edrivers/s390/cio/airq.c
159 </chapter>
160
150</book> 161</book>
diff --git a/Documentation/Smack.txt b/Documentation/Smack.txt
new file mode 100644
index 000000000000..989c2fcd8111
--- /dev/null
+++ b/Documentation/Smack.txt
@@ -0,0 +1,493 @@
1
2
3 "Good for you, you've decided to clean the elevator!"
4 - The Elevator, from Dark Star
5
6Smack is the the Simplified Mandatory Access Control Kernel.
7Smack is a kernel based implementation of mandatory access
8control that includes simplicity in its primary design goals.
9
10Smack is not the only Mandatory Access Control scheme
11available for Linux. Those new to Mandatory Access Control
12are encouraged to compare Smack with the other mechanisms
13available to determine which is best suited to the problem
14at hand.
15
16Smack consists of three major components:
17 - The kernel
18 - A start-up script and a few modified applications
19 - Configuration data
20
21The kernel component of Smack is implemented as a Linux
22Security Modules (LSM) module. It requires netlabel and
23works best with file systems that support extended attributes,
24although xattr support is not strictly required.
25It is safe to run a Smack kernel under a "vanilla" distribution.
26Smack kernels use the CIPSO IP option. Some network
27configurations are intolerant of IP options and can impede
28access to systems that use them as Smack does.
29
30The startup script etc-init.d-smack should be installed
31in /etc/init.d/smack and should be invoked early in the
32start-up process. On Fedora rc5.d/S02smack is recommended.
33This script ensures that certain devices have the correct
34Smack attributes and loads the Smack configuration if
35any is defined. This script invokes two programs that
36ensure configuration data is properly formatted. These
37programs are /usr/sbin/smackload and /usr/sin/smackcipso.
38The system will run just fine without these programs,
39but it will be difficult to set access rules properly.
40
41A version of "ls" that provides a "-M" option to display
42Smack labels on long listing is available.
43
44A hacked version of sshd that allows network logins by users
45with specific Smack labels is available. This version does
46not work for scp. You must set the /etc/ssh/sshd_config
47line:
48 UsePrivilegeSeparation no
49
50The format of /etc/smack/usr is:
51
52 username smack
53
54In keeping with the intent of Smack, configuration data is
55minimal and not strictly required. The most important
56configuration step is mounting the smackfs pseudo filesystem.
57
58Add this line to /etc/fstab:
59
60 smackfs /smack smackfs smackfsdef=* 0 0
61
62and create the /smack directory for mounting.
63
64Smack uses extended attributes (xattrs) to store file labels.
65The command to set a Smack label on a file is:
66
67 # attr -S -s SMACK64 -V "value" path
68
69NOTE: Smack labels are limited to 23 characters. The attr command
70 does not enforce this restriction and can be used to set
71 invalid Smack labels on files.
72
73If you don't do anything special all users will get the floor ("_")
74label when they log in. If you do want to log in via the hacked ssh
75at other labels use the attr command to set the smack value on the
76home directory and it's contents.
77
78You can add access rules in /etc/smack/accesses. They take the form:
79
80 subjectlabel objectlabel access
81
82access is a combination of the letters rwxa which specify the
83kind of access permitted a subject with subjectlabel on an
84object with objectlabel. If there is no rule no access is allowed.
85
86A process can see the smack label it is running with by
87reading /proc/self/attr/current. A privileged process can
88set the process smack by writing there.
89
90Look for additional programs on http://schaufler-ca.com
91
92From the Smack Whitepaper:
93
94The Simplified Mandatory Access Control Kernel
95
96Casey Schaufler
97casey@schaufler-ca.com
98
99Mandatory Access Control
100
101Computer systems employ a variety of schemes to constrain how information is
102shared among the people and services using the machine. Some of these schemes
103allow the program or user to decide what other programs or users are allowed
104access to pieces of data. These schemes are called discretionary access
105control mechanisms because the access control is specified at the discretion
106of the user. Other schemes do not leave the decision regarding what a user or
107program can access up to users or programs. These schemes are called mandatory
108access control mechanisms because you don't have a choice regarding the users
109or programs that have access to pieces of data.
110
111Bell & LaPadula
112
113From the middle of the 1980's until the turn of the century Mandatory Access
114Control (MAC) was very closely associated with the Bell & LaPadula security
115model, a mathematical description of the United States Department of Defense
116policy for marking paper documents. MAC in this form enjoyed a following
117within the Capital Beltway and Scandinavian supercomputer centers but was
118often sited as failing to address general needs.
119
120Domain Type Enforcement
121
122Around the turn of the century Domain Type Enforcement (DTE) became popular.
123This scheme organizes users, programs, and data into domains that are
124protected from each other. This scheme has been widely deployed as a component
125of popular Linux distributions. The administrative overhead required to
126maintain this scheme and the detailed understanding of the whole system
127necessary to provide a secure domain mapping leads to the scheme being
128disabled or used in limited ways in the majority of cases.
129
130Smack
131
132Smack is a Mandatory Access Control mechanism designed to provide useful MAC
133while avoiding the pitfalls of its predecessors. The limitations of Bell &
134LaPadula are addressed by providing a scheme whereby access can be controlled
135according to the requirements of the system and its purpose rather than those
136imposed by an arcane government policy. The complexity of Domain Type
137Enforcement and avoided by defining access controls in terms of the access
138modes already in use.
139
140Smack Terminology
141
142The jargon used to talk about Smack will be familiar to those who have dealt
143with other MAC systems and shouldn't be too difficult for the uninitiated to
144pick up. There are four terms that are used in a specific way and that are
145especially important:
146
147 Subject: A subject is an active entity on the computer system.
148 On Smack a subject is a task, which is in turn the basic unit
149 of execution.
150
151 Object: An object is a passive entity on the computer system.
152 On Smack files of all types, IPC, and tasks can be objects.
153
154 Access: Any attempt by a subject to put information into or get
155 information from an object is an access.
156
157 Label: Data that identifies the Mandatory Access Control
158 characteristics of a subject or an object.
159
160These definitions are consistent with the traditional use in the security
161community. There are also some terms from Linux that are likely to crop up:
162
163 Capability: A task that possesses a capability has permission to
164 violate an aspect of the system security policy, as identified by
165 the specific capability. A task that possesses one or more
166 capabilities is a privileged task, whereas a task with no
167 capabilities is an unprivileged task.
168
169 Privilege: A task that is allowed to violate the system security
170 policy is said to have privilege. As of this writing a task can
171 have privilege either by possessing capabilities or by having an
172 effective user of root.
173
174Smack Basics
175
176Smack is an extension to a Linux system. It enforces additional restrictions
177on what subjects can access which objects, based on the labels attached to
178each of the subject and the object.
179
180Labels
181
182Smack labels are ASCII character strings, one to twenty-three characters in
183length. Single character labels using special characters, that being anything
184other than a letter or digit, are reserved for use by the Smack development
185team. Smack labels are unstructured, case sensitive, and the only operation
186ever performed on them is comparison for equality. Smack labels cannot
187contain unprintable characters or the "/" (slash) character.
188
189There are some predefined labels:
190
191 _ Pronounced "floor", a single underscore character.
192 ^ Pronounced "hat", a single circumflex character.
193 * Pronounced "star", a single asterisk character.
194 ? Pronounced "huh", a single question mark character.
195
196Every task on a Smack system is assigned a label. System tasks, such as
197init(8) and systems daemons, are run with the floor ("_") label. User tasks
198are assigned labels according to the specification found in the
199/etc/smack/user configuration file.
200
201Access Rules
202
203Smack uses the traditional access modes of Linux. These modes are read,
204execute, write, and occasionally append. There are a few cases where the
205access mode may not be obvious. These include:
206
207 Signals: A signal is a write operation from the subject task to
208 the object task.
209 Internet Domain IPC: Transmission of a packet is considered a
210 write operation from the source task to the destination task.
211
212Smack restricts access based on the label attached to a subject and the label
213attached to the object it is trying to access. The rules enforced are, in
214order:
215
216 1. Any access requested by a task labeled "*" is denied.
217 2. A read or execute access requested by a task labeled "^"
218 is permitted.
219 3. A read or execute access requested on an object labeled "_"
220 is permitted.
221 4. Any access requested on an object labeled "*" is permitted.
222 5. Any access requested by a task on an object with the same
223 label is permitted.
224 6. Any access requested that is explicitly defined in the loaded
225 rule set is permitted.
226 7. Any other access is denied.
227
228Smack Access Rules
229
230With the isolation provided by Smack access separation is simple. There are
231many interesting cases where limited access by subjects to objects with
232different labels is desired. One example is the familiar spy model of
233sensitivity, where a scientist working on a highly classified project would be
234able to read documents of lower classifications and anything she writes will
235be "born" highly classified. To accommodate such schemes Smack includes a
236mechanism for specifying rules allowing access between labels.
237
238Access Rule Format
239
240The format of an access rule is:
241
242 subject-label object-label access
243
244Where subject-label is the Smack label of the task, object-label is the Smack
245label of the thing being accessed, and access is a string specifying the sort
246of access allowed. The Smack labels are limited to 23 characters. The access
247specification is searched for letters that describe access modes:
248
249 a: indicates that append access should be granted.
250 r: indicates that read access should be granted.
251 w: indicates that write access should be granted.
252 x: indicates that execute access should be granted.
253
254Uppercase values for the specification letters are allowed as well.
255Access mode specifications can be in any order. Examples of acceptable rules
256are:
257
258 TopSecret Secret rx
259 Secret Unclass R
260 Manager Game x
261 User HR w
262 New Old rRrRr
263 Closed Off -
264
265Examples of unacceptable rules are:
266
267 Top Secret Secret rx
268 Ace Ace r
269 Odd spells waxbeans
270
271Spaces are not allowed in labels. Since a subject always has access to files
272with the same label specifying a rule for that case is pointless. Only
273valid letters (rwxaRWXA) and the dash ('-') character are allowed in
274access specifications. The dash is a placeholder, so "a-r" is the same
275as "ar". A lone dash is used to specify that no access should be allowed.
276
277Applying Access Rules
278
279The developers of Linux rarely define new sorts of things, usually importing
280schemes and concepts from other systems. Most often, the other systems are
281variants of Unix. Unix has many endearing properties, but consistency of
282access control models is not one of them. Smack strives to treat accesses as
283uniformly as is sensible while keeping with the spirit of the underlying
284mechanism.
285
286File system objects including files, directories, named pipes, symbolic links,
287and devices require access permissions that closely match those used by mode
288bit access. To open a file for reading read access is required on the file. To
289search a directory requires execute access. Creating a file with write access
290requires both read and write access on the containing directory. Deleting a
291file requires read and write access to the file and to the containing
292directory. It is possible that a user may be able to see that a file exists
293but not any of its attributes by the circumstance of having read access to the
294containing directory but not to the differently labeled file. This is an
295artifact of the file name being data in the directory, not a part of the file.
296
297IPC objects, message queues, semaphore sets, and memory segments exist in flat
298namespaces and access requests are only required to match the object in
299question.
300
301Process objects reflect tasks on the system and the Smack label used to access
302them is the same Smack label that the task would use for its own access
303attempts. Sending a signal via the kill() system call is a write operation
304from the signaler to the recipient. Debugging a process requires both reading
305and writing. Creating a new task is an internal operation that results in two
306tasks with identical Smack labels and requires no access checks.
307
308Sockets are data structures attached to processes and sending a packet from
309one process to another requires that the sender have write access to the
310receiver. The receiver is not required to have read access to the sender.
311
312Setting Access Rules
313
314The configuration file /etc/smack/accesses contains the rules to be set at
315system startup. The contents are written to the special file /smack/load.
316Rules can be written to /smack/load at any time and take effect immediately.
317For any pair of subject and object labels there can be only one rule, with the
318most recently specified overriding any earlier specification.
319
320The program smackload is provided to ensure data is formatted
321properly when written to /smack/load. This program reads lines
322of the form
323
324 subjectlabel objectlabel mode.
325
326Task Attribute
327
328The Smack label of a process can be read from /proc/<pid>/attr/current. A
329process can read its own Smack label from /proc/self/attr/current. A
330privileged process can change its own Smack label by writing to
331/proc/self/attr/current but not the label of another process.
332
333File Attribute
334
335The Smack label of a filesystem object is stored as an extended attribute
336named SMACK64 on the file. This attribute is in the security namespace. It can
337only be changed by a process with privilege.
338
339Privilege
340
341A process with CAP_MAC_OVERRIDE is privileged.
342
343Smack Networking
344
345As mentioned before, Smack enforces access control on network protocol
346transmissions. Every packet sent by a Smack process is tagged with its Smack
347label. This is done by adding a CIPSO tag to the header of the IP packet. Each
348packet received is expected to have a CIPSO tag that identifies the label and
349if it lacks such a tag the network ambient label is assumed. Before the packet
350is delivered a check is made to determine that a subject with the label on the
351packet has write access to the receiving process and if that is not the case
352the packet is dropped.
353
354CIPSO Configuration
355
356It is normally unnecessary to specify the CIPSO configuration. The default
357values used by the system handle all internal cases. Smack will compose CIPSO
358label values to match the Smack labels being used without administrative
359intervention. Unlabeled packets that come into the system will be given the
360ambient label.
361
362Smack requires configuration in the case where packets from a system that is
363not smack that speaks CIPSO may be encountered. Usually this will be a Trusted
364Solaris system, but there are other, less widely deployed systems out there.
365CIPSO provides 3 important values, a Domain Of Interpretation (DOI), a level,
366and a category set with each packet. The DOI is intended to identify a group
367of systems that use compatible labeling schemes, and the DOI specified on the
368smack system must match that of the remote system or packets will be
369discarded. The DOI is 3 by default. The value can be read from /smack/doi and
370can be changed by writing to /smack/doi.
371
372The label and category set are mapped to a Smack label as defined in
373/etc/smack/cipso.
374
375A Smack/CIPSO mapping has the form:
376
377 smack level [category [category]*]
378
379Smack does not expect the level or category sets to be related in any
380particular way and does not assume or assign accesses based on them. Some
381examples of mappings:
382
383 TopSecret 7
384 TS:A,B 7 1 2
385 SecBDE 5 2 4 6
386 RAFTERS 7 12 26
387
388The ":" and "," characters are permitted in a Smack label but have no special
389meaning.
390
391The mapping of Smack labels to CIPSO values is defined by writing to
392/smack/cipso. Again, the format of data written to this special file
393is highly restrictive, so the program smackcipso is provided to
394ensure the writes are done properly. This program takes mappings
395on the standard input and sends them to /smack/cipso properly.
396
397In addition to explicit mappings Smack supports direct CIPSO mappings. One
398CIPSO level is used to indicate that the category set passed in the packet is
399in fact an encoding of the Smack label. The level used is 250 by default. The
400value can be read from /smack/direct and changed by writing to /smack/direct.
401
402Socket Attributes
403
404There are two attributes that are associated with sockets. These attributes
405can only be set by privileged tasks, but any task can read them for their own
406sockets.
407
408 SMACK64IPIN: The Smack label of the task object. A privileged
409 program that will enforce policy may set this to the star label.
410
411 SMACK64IPOUT: The Smack label transmitted with outgoing packets.
412 A privileged program may set this to match the label of another
413 task with which it hopes to communicate.
414
415Writing Applications for Smack
416
417There are three sorts of applications that will run on a Smack system. How an
418application interacts with Smack will determine what it will have to do to
419work properly under Smack.
420
421Smack Ignorant Applications
422
423By far the majority of applications have no reason whatever to care about the
424unique properties of Smack. Since invoking a program has no impact on the
425Smack label associated with the process the only concern likely to arise is
426whether the process has execute access to the program.
427
428Smack Relevant Applications
429
430Some programs can be improved by teaching them about Smack, but do not make
431any security decisions themselves. The utility ls(1) is one example of such a
432program.
433
434Smack Enforcing Applications
435
436These are special programs that not only know about Smack, but participate in
437the enforcement of system policy. In most cases these are the programs that
438set up user sessions. There are also network services that provide information
439to processes running with various labels.
440
441File System Interfaces
442
443Smack maintains labels on file system objects using extended attributes. The
444Smack label of a file, directory, or other file system object can be obtained
445using getxattr(2).
446
447 len = getxattr("/", "security.SMACK64", value, sizeof (value));
448
449will put the Smack label of the root directory into value. A privileged
450process can set the Smack label of a file system object with setxattr(2).
451
452 len = strlen("Rubble");
453 rc = setxattr("/foo", "security.SMACK64", "Rubble", len, 0);
454
455will set the Smack label of /foo to "Rubble" if the program has appropriate
456privilege.
457
458Socket Interfaces
459
460The socket attributes can be read using fgetxattr(2).
461
462A privileged process can set the Smack label of outgoing packets with
463fsetxattr(2).
464
465 len = strlen("Rubble");
466 rc = fsetxattr(fd, "security.SMACK64IPOUT", "Rubble", len, 0);
467
468will set the Smack label "Rubble" on packets going out from the socket if the
469program has appropriate privilege.
470
471 rc = fsetxattr(fd, "security.SMACK64IPIN, "*", strlen("*"), 0);
472
473will set the Smack label "*" as the object label against which incoming
474packets will be checked if the program has appropriate privilege.
475
476Administration
477
478Smack supports some mount options:
479
480 smackfsdef=label: specifies the label to give files that lack
481 the Smack label extended attribute.
482
483 smackfsroot=label: specifies the label to assign the root of the
484 file system if it lacks the Smack extended attribute.
485
486 smackfshat=label: specifies a label that must have read access to
487 all labels set on the filesystem. Not yet enforced.
488
489 smackfsfloor=label: specifies a label to which all labels set on the
490 filesystem must have read access. Not yet enforced.
491
492These mount options apply to all file system types.
493
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 681e2b36195c..08a1ed1cb5d8 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -220,20 +220,8 @@ decreasing the likelihood of your MIME-attached change being accepted.
220Exception: If your mailer is mangling patches then someone may ask 220Exception: If your mailer is mangling patches then someone may ask
221you to re-send them using MIME. 221you to re-send them using MIME.
222 222
223 223See Documentation/email-clients.txt for hints about configuring
224WARNING: Some mailers like Mozilla send your messages with 224your e-mail client so that it sends your patches untouched.
225---- message header ----
226Content-Type: text/plain; charset=us-ascii; format=flowed
227---- message header ----
228The problem is that "format=flowed" makes some of the mailers
229on receiving side to replace TABs with spaces and do similar
230changes. Thus the patches from you can look corrupted.
231
232To fix this just make your mozilla defaults/pref/mailnews.js file to look like:
233pref("mailnews.send_plaintext_flowed", false); // RFC 2646=======
234pref("mailnews.display.disable_format_flowed_support", true);
235
236
237 225
2388) E-mail size. 2268) E-mail size.
239 227
diff --git a/Documentation/acpi/method-tracing.txt b/Documentation/acpi/method-tracing.txt
new file mode 100644
index 000000000000..f6efb1ea559a
--- /dev/null
+++ b/Documentation/acpi/method-tracing.txt
@@ -0,0 +1,26 @@
1/sys/module/acpi/parameters/:
2
3trace_method_name
4 The AML method name that the user wants to trace
5
6trace_debug_layer
7 The temporary debug_layer used when tracing the method.
8 Using 0xffffffff by default if it is 0.
9
10trace_debug_level
11 The temporary debug_level used when tracing the method.
12 Using 0x00ffffff by default if it is 0.
13
14trace_state
15 The status of the tracing feature.
16
17 "enabled" means this feature is enabled
18 and the AML method is traced every time it's executed.
19
20 "1" means this feature is enabled and the AML method
21 will only be traced during the next execution.
22
23 "disabled" means this feature is disabled.
24 Users can enable/disable this debug tracing feature by
25 "echo string > /sys/module/acpi/parameters/trace_state".
26 "string" should be one of "enable", "disable" and "1".
diff --git a/Documentation/arm/Sharp-LH/IOBarrier b/Documentation/arm/Sharp-LH/IOBarrier
index c0d8853672dc..2e953e228f4d 100644
--- a/Documentation/arm/Sharp-LH/IOBarrier
+++ b/Documentation/arm/Sharp-LH/IOBarrier
@@ -32,7 +32,7 @@ BARRIER IO before the access to the SMC chip because the AEN latch
32only needs occurs after the SMC IO write cycle. The routines that 32only needs occurs after the SMC IO write cycle. The routines that
33implement this work-around make an additional concession which is to 33implement this work-around make an additional concession which is to
34disable interrupts during the IO sequence. Other hardware devices 34disable interrupts during the IO sequence. Other hardware devices
35(the LogicPD CPLD) have registers in the same the physical memory 35(the LogicPD CPLD) have registers in the same physical memory
36region as the SMC chip. An interrupt might allow an access to one of 36region as the SMC chip. An interrupt might allow an access to one of
37those registers while SMC IO is being performed. 37those registers while SMC IO is being performed.
38 38
diff --git a/Documentation/debugging-modules.txt b/Documentation/debugging-modules.txt
index 24029f65fc94..172ad4aec493 100644
--- a/Documentation/debugging-modules.txt
+++ b/Documentation/debugging-modules.txt
@@ -16,3 +16,7 @@ echo 'echo "$@" >> /tmp/modprobe.log' >> /tmp/modprobe
16echo 'exec /sbin/modprobe "$@"' >> /tmp/modprobe 16echo 'exec /sbin/modprobe "$@"' >> /tmp/modprobe
17chmod a+x /tmp/modprobe 17chmod a+x /tmp/modprobe
18echo /tmp/modprobe > /proc/sys/kernel/modprobe 18echo /tmp/modprobe > /proc/sys/kernel/modprobe
19
20Note that the above applies only when the *kernel* is requesting
21that the module be loaded -- it won't have any effect if that module
22is being loaded explicitly using "modprobe" from userspace.
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt
index 2a97320ee17f..83009fdcbbc8 100644
--- a/Documentation/driver-model/platform.txt
+++ b/Documentation/driver-model/platform.txt
@@ -122,15 +122,15 @@ None the less, there are some APIs to support such legacy drivers. Avoid
122using these calls except with such hotplug-deficient drivers. 122using these calls except with such hotplug-deficient drivers.
123 123
124 struct platform_device *platform_device_alloc( 124 struct platform_device *platform_device_alloc(
125 char *name, unsigned id); 125 const char *name, int id);
126 126
127You can use platform_device_alloc() to dynamically allocate a device, which 127You can use platform_device_alloc() to dynamically allocate a device, which
128you will then initialize with resources and platform_device_register(). 128you will then initialize with resources and platform_device_register().
129A better solution is usually: 129A better solution is usually:
130 130
131 struct platform_device *platform_device_register_simple( 131 struct platform_device *platform_device_register_simple(
132 char *name, unsigned id, 132 const char *name, int id,
133 struct resource *res, unsigned nres); 133 struct resource *res, unsigned int nres);
134 134
135You can use platform_device_register_simple() as a one-step call to allocate 135You can use platform_device_register_simple() as a one-step call to allocate
136and register a device. 136and register a device.
diff --git a/Documentation/fb/deferred_io.txt b/Documentation/fb/deferred_io.txt
index 63883a892120..748328370250 100644
--- a/Documentation/fb/deferred_io.txt
+++ b/Documentation/fb/deferred_io.txt
@@ -7,10 +7,10 @@ IO. The following example may be a useful explanation of how one such setup
7works: 7works:
8 8
9- userspace app like Xfbdev mmaps framebuffer 9- userspace app like Xfbdev mmaps framebuffer
10- deferred IO and driver sets up nopage and page_mkwrite handlers 10- deferred IO and driver sets up fault and page_mkwrite handlers
11- userspace app tries to write to mmaped vaddress 11- userspace app tries to write to mmaped vaddress
12- we get pagefault and reach nopage handler 12- we get pagefault and reach fault handler
13- nopage handler finds and returns physical page 13- fault handler finds and returns physical page
14- we get page_mkwrite where we add this page to a list 14- we get page_mkwrite where we add this page to a list
15- schedule a workqueue task to be run after a delay 15- schedule a workqueue task to be run after a delay
16- app continues writing to that page with no additional cost. this is 16- app continues writing to that page with no additional cost. this is
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 181bff005167..68ce1300a360 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -156,22 +156,6 @@ Who: Arjan van de Ven <arjan@linux.intel.com>
156 156
157--------------------------- 157---------------------------
158 158
159What: USB driver API moves to EXPORT_SYMBOL_GPL
160When: February 2008
161Files: include/linux/usb.h, drivers/usb/core/driver.c
162Why: The USB subsystem has changed a lot over time, and it has been
163 possible to create userspace USB drivers using usbfs/libusb/gadgetfs
164 that operate as fast as the USB bus allows. Because of this, the USB
165 subsystem will not be allowing closed source kernel drivers to
166 register with it, after this grace period is over. If anyone needs
167 any help in converting their closed source drivers over to use the
168 userspace filesystems, please contact the
169 linux-usb-devel@lists.sourceforge.net mailing list, and the developers
170 there will be glad to help you out.
171Who: Greg Kroah-Hartman <gregkh@suse.de>
172
173---------------------------
174
175What: vm_ops.nopage 159What: vm_ops.nopage
176When: Soon, provided in-kernel callers have been converted 160When: Soon, provided in-kernel callers have been converted
177Why: This interface is replaced by vm_ops.fault, but it has been around 161Why: This interface is replaced by vm_ops.fault, but it has been around
@@ -224,13 +208,6 @@ Who: Randy Dunlap <randy.dunlap@oracle.com>
224 208
225--------------------------- 209---------------------------
226 210
227What: drivers depending on OSS_OBSOLETE
228When: options in 2.6.23, code in 2.6.25
229Why: obsolete OSS drivers
230Who: Adrian Bunk <bunk@stusta.de>
231
232---------------------------
233
234What: libata spindown skipping and warning 211What: libata spindown skipping and warning
235When: Dec 2008 212When: Dec 2008
236Why: Some halt(8) implementations synchronize caches for and spin 213Why: Some halt(8) implementations synchronize caches for and spin
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
index d1b98257d000..44c97e6accb2 100644
--- a/Documentation/filesystems/configfs/configfs.txt
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -377,7 +377,7 @@ more explicit to have a method whereby userspace sees this divergence.
377Rather than have a group where some items behave differently than 377Rather than have a group where some items behave differently than
378others, configfs provides a method whereby one or many subgroups are 378others, configfs provides a method whereby one or many subgroups are
379automatically created inside the parent at its creation. Thus, 379automatically created inside the parent at its creation. Thus,
380mkdir("parent) results in "parent", "parent/subgroup1", up through 380mkdir("parent") results in "parent", "parent/subgroup1", up through
381"parent/subgroupN". Items of type 1 can now be created in 381"parent/subgroupN". Items of type 1 can now be created in
382"parent/subgroup1", and items of type N can be created in 382"parent/subgroup1", and items of type N can be created in
383"parent/subgroupN". 383"parent/subgroupN".
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index dac45c92d872..0f33c77bc14b 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -1,6 +1,6 @@
1Changes since 2.5.0: 1Changes since 2.5.0:
2 2
3--- 3---
4[recommended] 4[recommended]
5 5
6New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(), 6New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(),
@@ -10,7 +10,7 @@ Use them.
10 10
11(sb_find_get_block() replaces 2.4's get_hash_table()) 11(sb_find_get_block() replaces 2.4's get_hash_table())
12 12
13--- 13---
14[recommended] 14[recommended]
15 15
16New methods: ->alloc_inode() and ->destroy_inode(). 16New methods: ->alloc_inode() and ->destroy_inode().
@@ -28,7 +28,7 @@ Declare
28 28
29Use FOO_I(inode) instead of &inode->u.foo_inode_i; 29Use FOO_I(inode) instead of &inode->u.foo_inode_i;
30 30
31Add foo_alloc_inode() and foo_destory_inode() - the former should allocate 31Add foo_alloc_inode() and foo_destroy_inode() - the former should allocate
32foo_inode_info and return the address of ->vfs_inode, the latter should free 32foo_inode_info and return the address of ->vfs_inode, the latter should free
33FOO_I(inode) (see in-tree filesystems for examples). 33FOO_I(inode) (see in-tree filesystems for examples).
34 34
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 194c8f351320..5681e2fa1496 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -216,6 +216,7 @@ Table 1-3: Contents of the stat files (as of 2.6.22-rc3)
216 priority priority level 216 priority priority level
217 nice nice level 217 nice nice level
218 num_threads number of threads 218 num_threads number of threads
219 it_real_value (obsolete, always 0)
219 start_time time the process started after system boot 220 start_time time the process started after system boot
220 vsize virtual memory size 221 vsize virtual memory size
221 rss resident set memory size 222 rss resident set memory size
@@ -1028,6 +1029,14 @@ nr_inodes
1028Denotes the number of inodes the system has allocated. This number will 1029Denotes the number of inodes the system has allocated. This number will
1029grow and shrink dynamically. 1030grow and shrink dynamically.
1030 1031
1032nr_open
1033-------
1034
1035Denotes the maximum number of file-handles a process can
1036allocate. Default value is 1024*1024 (1048576) which should be
1037enough for most machines. Actual limit depends on RLIMIT_NOFILE
1038resource limit.
1039
1031nr_free_inodes 1040nr_free_inodes
1032-------------- 1041--------------
1033 1042
@@ -1314,13 +1323,28 @@ for writeout by the pdflush daemons. It is expressed in 100'ths of a second.
1314Data which has been dirty in-memory for longer than this interval will be 1323Data which has been dirty in-memory for longer than this interval will be
1315written out next time a pdflush daemon wakes up. 1324written out next time a pdflush daemon wakes up.
1316 1325
1326highmem_is_dirtyable
1327--------------------
1328
1329Only present if CONFIG_HIGHMEM is set.
1330
1331This defaults to 0 (false), meaning that the ratios set above are calculated
1332as a percentage of lowmem only. This protects against excessive scanning
1333in page reclaim, swapping and general VM distress.
1334
1335Setting this to 1 can be useful on 32 bit machines where you want to make
1336random changes within an MMAPed file that is larger than your available
1337lowmem without causing large quantities of random IO. Is is safe if the
1338behavior of all programs running on the machine is known and memory will
1339not be otherwise stressed.
1340
1317legacy_va_layout 1341legacy_va_layout
1318---------------- 1342----------------
1319 1343
1320If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel 1344If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
1321will use the legacy (2.4) layout for all processes. 1345will use the legacy (2.4) layout for all processes.
1322 1346
1323lower_zone_protection 1347lowmem_reserve_ratio
1324--------------------- 1348---------------------
1325 1349
1326For some specialised workloads on highmem machines it is dangerous for 1350For some specialised workloads on highmem machines it is dangerous for
@@ -1340,25 +1364,71 @@ captured into pinned user memory.
1340mechanism will also defend that region from allocations which could use 1364mechanism will also defend that region from allocations which could use
1341highmem or lowmem). 1365highmem or lowmem).
1342 1366
1343The `lower_zone_protection' tunable determines how aggressive the kernel is 1367The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
1344in defending these lower zones. The default value is zero - no 1368in defending these lower zones.
1345protection at all.
1346 1369
1347If you have a machine which uses highmem or ISA DMA and your 1370If you have a machine which uses highmem or ISA DMA and your
1348applications are using mlock(), or if you are running with no swap then 1371applications are using mlock(), or if you are running with no swap then
1349you probably should increase the lower_zone_protection setting. 1372you probably should change the lowmem_reserve_ratio setting.
1350 1373
1351The units of this tunable are fairly vague. It is approximately equal 1374The lowmem_reserve_ratio is an array. You can see them by reading this file.
1352to "megabytes," so setting lower_zone_protection=100 will protect around 100 1375-
1353megabytes of the lowmem zone from user allocations. It will also make 1376% cat /proc/sys/vm/lowmem_reserve_ratio
1354those 100 megabytes unavailable for use by applications and by 1377256 256 32
1355pagecache, so there is a cost. 1378-
1356 1379Note: # of this elements is one fewer than number of zones. Because the highest
1357The effects of this tunable may be observed by monitoring 1380 zone's value is not necessary for following calculation.
1358/proc/meminfo:LowFree. Write a single huge file and observe the point 1381
1359at which LowFree ceases to fall. 1382But, these values are not used directly. The kernel calculates # of protection
1360 1383pages for each zones from them. These are shown as array of protection pages
1361A reasonable value for lower_zone_protection is 100. 1384in /proc/zoneinfo like followings. (This is an example of x86-64 box).
1385Each zone has an array of protection pages like this.
1386
1387-
1388Node 0, zone DMA
1389 pages free 1355
1390 min 3
1391 low 3
1392 high 4
1393 :
1394 :
1395 numa_other 0
1396 protection: (0, 2004, 2004, 2004)
1397 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1398 pagesets
1399 cpu: 0 pcp: 0
1400 :
1401-
1402These protections are added to score to judge whether this zone should be used
1403for page allocation or should be reclaimed.
1404
1405In this example, if normal pages (index=2) are required to this DMA zone and
1406pages_high is used for watermark, the kernel judges this zone should not be
1407used because pages_free(1355) is smaller than watermark + protection[2]
1408(4 + 2004 = 2008). If this protection value is 0, this zone would be used for
1409normal page requirement. If requirement is DMA zone(index=0), protection[0]
1410(=0) is used.
1411
1412zone[i]'s protection[j] is calculated by following exprssion.
1413
1414(i < j):
1415 zone[i]->protection[j]
1416 = (total sums of present_pages from zone[i+1] to zone[j] on the node)
1417 / lowmem_reserve_ratio[i];
1418(i = j):
1419 (should not be protected. = 0;
1420(i > j):
1421 (not necessary, but looks 0)
1422
1423The default values of lowmem_reserve_ratio[i] are
1424 256 (if zone[i] means DMA or DMA32 zone)
1425 32 (others).
1426As above expression, they are reciprocal number of ratio.
1427256 means 1/256. # of protection pages becomes about "0.39%" of total present
1428pages of higher zones on the node.
1429
1430If you would like to protect more pages, smaller values are effective.
1431The minimum value is 1 (1/1 -> 100%).
1362 1432
1363page-cluster 1433page-cluster
1364------------ 1434------------
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
index 339c6a4f220e..7be232b44ee4 100644
--- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt
+++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
@@ -118,7 +118,7 @@ All this differs from the old initrd in several ways:
118 with the new root (cd /newmount; mount --move . /; chroot .), attach 118 with the new root (cd /newmount; mount --move . /; chroot .), attach
119 stdin/stdout/stderr to the new /dev/console, and exec the new init. 119 stdin/stdout/stderr to the new /dev/console, and exec the new init.
120 120
121 Since this is a remarkably persnickity process (and involves deleting 121 Since this is a remarkably persnickety process (and involves deleting
122 commands before you can run them), the klibc package introduced a helper 122 commands before you can run them), the klibc package introduced a helper
123 program (utils/run_init.c) to do all this for you. Most other packages 123 program (utils/run_init.c) to do all this for you. Most other packages
124 (such as busybox) have named this command "switch_root". 124 (such as busybox) have named this command "switch_root".
diff --git a/Documentation/filesystems/relay.txt b/Documentation/filesystems/relay.txt
index 18d23f9a18c7..094f2d2f38b1 100644
--- a/Documentation/filesystems/relay.txt
+++ b/Documentation/filesystems/relay.txt
@@ -140,7 +140,7 @@ close() decrements the channel buffer's refcount. When the refcount
140In order for a user application to make use of relay files, the 140In order for a user application to make use of relay files, the
141host filesystem must be mounted. For example, 141host filesystem must be mounted. For example,
142 142
143 mount -t debugfs debugfs /debug 143 mount -t debugfs debugfs /sys/kernel/debug
144 144
145NOTE: the host filesystem doesn't need to be mounted for kernel 145NOTE: the host filesystem doesn't need to be mounted for kernel
146 clients to create or use channels - it only needs to be 146 clients to create or use channels - it only needs to be
diff --git a/Documentation/fujitsu/frv/README.txt b/Documentation/frv/README.txt
index a984faa968e8..a984faa968e8 100644
--- a/Documentation/fujitsu/frv/README.txt
+++ b/Documentation/frv/README.txt
diff --git a/Documentation/fujitsu/frv/atomic-ops.txt b/Documentation/frv/atomic-ops.txt
index 96638e9b9fe0..96638e9b9fe0 100644
--- a/Documentation/fujitsu/frv/atomic-ops.txt
+++ b/Documentation/frv/atomic-ops.txt
diff --git a/Documentation/fujitsu/frv/booting.txt b/Documentation/frv/booting.txt
index 4e229056ef22..ace200b7c214 100644
--- a/Documentation/fujitsu/frv/booting.txt
+++ b/Documentation/frv/booting.txt
@@ -177,5 +177,5 @@ separated by spaces:
177 (*) vdc=... 177 (*) vdc=...
178 178
179 This option configures the MB93493 companion chip visual display 179 This option configures the MB93493 companion chip visual display
180 driver. Please see Documentation/fujitsu/mb93493/vdc.txt for more 180 driver. Please see Documentation/frv/mb93493/vdc.txt for more
181 information. 181 information.
diff --git a/Documentation/fujitsu/frv/clock.txt b/Documentation/frv/clock.txt
index c72d350e177a..c72d350e177a 100644
--- a/Documentation/fujitsu/frv/clock.txt
+++ b/Documentation/frv/clock.txt
diff --git a/Documentation/fujitsu/frv/configuring.txt b/Documentation/frv/configuring.txt
index 36e76a2336fa..36e76a2336fa 100644
--- a/Documentation/fujitsu/frv/configuring.txt
+++ b/Documentation/frv/configuring.txt
diff --git a/Documentation/fujitsu/frv/features.txt b/Documentation/frv/features.txt
index fa20c0e72833..fa20c0e72833 100644
--- a/Documentation/fujitsu/frv/features.txt
+++ b/Documentation/frv/features.txt
diff --git a/Documentation/fujitsu/frv/gdbinit b/Documentation/frv/gdbinit
index 51517b6f307f..51517b6f307f 100644
--- a/Documentation/fujitsu/frv/gdbinit
+++ b/Documentation/frv/gdbinit
diff --git a/Documentation/fujitsu/frv/gdbstub.txt b/Documentation/frv/gdbstub.txt
index b92bfd902a4e..b92bfd902a4e 100644
--- a/Documentation/fujitsu/frv/gdbstub.txt
+++ b/Documentation/frv/gdbstub.txt
diff --git a/Documentation/fujitsu/frv/kernel-ABI.txt b/Documentation/frv/kernel-ABI.txt
index aaa1cec86f0b..aaa1cec86f0b 100644
--- a/Documentation/fujitsu/frv/kernel-ABI.txt
+++ b/Documentation/frv/kernel-ABI.txt
diff --git a/Documentation/fujitsu/frv/mmu-layout.txt b/Documentation/frv/mmu-layout.txt
index db10250df6be..db10250df6be 100644
--- a/Documentation/fujitsu/frv/mmu-layout.txt
+++ b/Documentation/frv/mmu-layout.txt
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index 6bc2ba215df9..8da724e2a0ff 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -32,7 +32,7 @@ The exact capabilities of GPIOs vary between systems. Common options:
32 - Input values are likewise readable (1, 0). Some chips support readback 32 - Input values are likewise readable (1, 0). Some chips support readback
33 of pins configured as "output", which is very useful in such "wire-OR" 33 of pins configured as "output", which is very useful in such "wire-OR"
34 cases (to support bidirectional signaling). GPIO controllers may have 34 cases (to support bidirectional signaling). GPIO controllers may have
35 input de-glitch logic, sometimes with software controls. 35 input de-glitch/debounce logic, sometimes with software controls.
36 36
37 - Inputs can often be used as IRQ signals, often edge triggered but 37 - Inputs can often be used as IRQ signals, often edge triggered but
38 sometimes level triggered. Such IRQs may be configurable as system 38 sometimes level triggered. Such IRQs may be configurable as system
@@ -60,10 +60,13 @@ used on a board that's wired differently. Only least-common-denominator
60functionality can be very portable. Other features are platform-specific, 60functionality can be very portable. Other features are platform-specific,
61and that can be critical for glue logic. 61and that can be critical for glue logic.
62 62
63Plus, this doesn't define an implementation framework, just an interface. 63Plus, this doesn't require any implementation framework, just an interface.
64One platform might implement it as simple inline functions accessing chip 64One platform might implement it as simple inline functions accessing chip
65registers; another might implement it by delegating through abstractions 65registers; another might implement it by delegating through abstractions
66used for several very different kinds of GPIO controller. 66used for several very different kinds of GPIO controller. (There is some
67optional code supporting such an implementation strategy, described later
68in this document, but drivers acting as clients to the GPIO interface must
69not care how it's implemented.)
67 70
68That said, if the convention is supported on their platform, drivers should 71That said, if the convention is supported on their platform, drivers should
69use it when possible. Platforms should declare GENERIC_GPIO support in 72use it when possible. Platforms should declare GENERIC_GPIO support in
@@ -121,6 +124,11 @@ before tasking is enabled, as part of early board setup.
121For output GPIOs, the value provided becomes the initial output value. 124For output GPIOs, the value provided becomes the initial output value.
122This helps avoid signal glitching during system startup. 125This helps avoid signal glitching during system startup.
123 126
127For compatibility with legacy interfaces to GPIOs, setting the direction
128of a GPIO implicitly requests that GPIO (see below) if it has not been
129requested already. That compatibility may be removed in the future;
130explicitly requesting GPIOs is strongly preferred.
131
124Setting the direction can fail if the GPIO number is invalid, or when 132Setting the direction can fail if the GPIO number is invalid, or when
125that particular GPIO can't be used in that mode. It's generally a bad 133that particular GPIO can't be used in that mode. It's generally a bad
126idea to rely on boot firmware to have set the direction correctly, since 134idea to rely on boot firmware to have set the direction correctly, since
@@ -133,6 +141,7 @@ Spinlock-Safe GPIO access
133------------------------- 141-------------------------
134Most GPIO controllers can be accessed with memory read/write instructions. 142Most GPIO controllers can be accessed with memory read/write instructions.
135That doesn't need to sleep, and can safely be done from inside IRQ handlers. 143That doesn't need to sleep, and can safely be done from inside IRQ handlers.
144(That includes hardirq contexts on RT kernels.)
136 145
137Use these calls to access such GPIOs: 146Use these calls to access such GPIOs:
138 147
@@ -145,7 +154,7 @@ Use these calls to access such GPIOs:
145The values are boolean, zero for low, nonzero for high. When reading the 154The values are boolean, zero for low, nonzero for high. When reading the
146value of an output pin, the value returned should be what's seen on the 155value of an output pin, the value returned should be what's seen on the
147pin ... that won't always match the specified output value, because of 156pin ... that won't always match the specified output value, because of
148issues including wire-OR and output latencies. 157issues including open-drain signaling and output latencies.
149 158
150The get/set calls have no error returns because "invalid GPIO" should have 159The get/set calls have no error returns because "invalid GPIO" should have
151been reported earlier from gpio_direction_*(). However, note that not all 160been reported earlier from gpio_direction_*(). However, note that not all
@@ -170,7 +179,8 @@ get to the head of a queue to transmit a command and get its response.
170This requires sleeping, which can't be done from inside IRQ handlers. 179This requires sleeping, which can't be done from inside IRQ handlers.
171 180
172Platforms that support this type of GPIO distinguish them from other GPIOs 181Platforms that support this type of GPIO distinguish them from other GPIOs
173by returning nonzero from this call: 182by returning nonzero from this call (which requires a valid GPIO number,
183either explicitly or implicitly requested):
174 184
175 int gpio_cansleep(unsigned gpio); 185 int gpio_cansleep(unsigned gpio);
176 186
@@ -209,8 +219,11 @@ before tasking is enabled, as part of early board setup.
209These calls serve two basic purposes. One is marking the signals which 219These calls serve two basic purposes. One is marking the signals which
210are actually in use as GPIOs, for better diagnostics; systems may have 220are actually in use as GPIOs, for better diagnostics; systems may have
211several hundred potential GPIOs, but often only a dozen are used on any 221several hundred potential GPIOs, but often only a dozen are used on any
212given board. Another is to catch conflicts between drivers, reporting 222given board. Another is to catch conflicts, identifying errors when
213errors when drivers wrongly think they have exclusive use of that signal. 223(a) two or more drivers wrongly think they have exclusive use of that
224signal, or (b) something wrongly believes it's safe to remove drivers
225needed to manage a signal that's in active use. That is, requesting a
226GPIO can serve as a kind of lock.
214 227
215These two calls are optional because not not all current Linux platforms 228These two calls are optional because not not all current Linux platforms
216offer such functionality in their GPIO support; a valid implementation 229offer such functionality in their GPIO support; a valid implementation
@@ -223,6 +236,9 @@ Note that requesting a GPIO does NOT cause it to be configured in any
223way; it just marks that GPIO as in use. Separate code must handle any 236way; it just marks that GPIO as in use. Separate code must handle any
224pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). 237pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown).
225 238
239Also note that it's your responsibility to have stopped using a GPIO
240before you free it.
241
226 242
227GPIOs mapped to IRQs 243GPIOs mapped to IRQs
228-------------------- 244--------------------
@@ -238,7 +254,7 @@ map between them using calls like:
238 254
239Those return either the corresponding number in the other namespace, or 255Those return either the corresponding number in the other namespace, or
240else a negative errno code if the mapping can't be done. (For example, 256else a negative errno code if the mapping can't be done. (For example,
241some GPIOs can't used as IRQs.) It is an unchecked error to use a GPIO 257some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO
242number that wasn't set up as an input using gpio_direction_input(), or 258number that wasn't set up as an input using gpio_direction_input(), or
243to use an IRQ number that didn't originally come from gpio_to_irq(). 259to use an IRQ number that didn't originally come from gpio_to_irq().
244 260
@@ -299,17 +315,110 @@ Related to multiplexing is configuration and enabling of the pullups or
299pulldowns integrated on some platforms. Not all platforms support them, 315pulldowns integrated on some platforms. Not all platforms support them,
300or support them in the same way; and any given board might use external 316or support them in the same way; and any given board might use external
301pullups (or pulldowns) so that the on-chip ones should not be used. 317pullups (or pulldowns) so that the on-chip ones should not be used.
318(When a circuit needs 5 kOhm, on-chip 100 kOhm resistors won't do.)
302 319
303There are other system-specific mechanisms that are not specified here, 320There are other system-specific mechanisms that are not specified here,
304like the aforementioned options for input de-glitching and wire-OR output. 321like the aforementioned options for input de-glitching and wire-OR output.
305Hardware may support reading or writing GPIOs in gangs, but that's usually 322Hardware may support reading or writing GPIOs in gangs, but that's usually
306configuration dependent: for GPIOs sharing the same bank. (GPIOs are 323configuration dependent: for GPIOs sharing the same bank. (GPIOs are
307commonly grouped in banks of 16 or 32, with a given SOC having several such 324commonly grouped in banks of 16 or 32, with a given SOC having several such
308banks.) Some systems can trigger IRQs from output GPIOs. Code relying on 325banks.) Some systems can trigger IRQs from output GPIOs, or read values
309such mechanisms will necessarily be nonportable. 326from pins not managed as GPIOs. Code relying on such mechanisms will
327necessarily be nonportable.
310 328
311Dynamic definition of GPIOs is not currently supported; for example, as 329Dynamic definition of GPIOs is not currently standard; for example, as
312a side effect of configuring an add-on board with some GPIO expanders. 330a side effect of configuring an add-on board with some GPIO expanders.
313 331
314These calls are purely for kernel space, but a userspace API could be built 332These calls are purely for kernel space, but a userspace API could be built
315on top of it. 333on top of them.
334
335
336GPIO implementor's framework (OPTIONAL)
337=======================================
338As noted earlier, there is an optional implementation framework making it
339easier for platforms to support different kinds of GPIO controller using
340the same programming interface.
341
342As a debugging aid, if debugfs is available a /sys/kernel/debug/gpio file
343will be found there. That will list all the controllers registered through
344this framework, and the state of the GPIOs currently in use.
345
346
347Controller Drivers: gpio_chip
348-----------------------------
349In this framework each GPIO controller is packaged as a "struct gpio_chip"
350with information common to each controller of that type:
351
352 - methods to establish GPIO direction
353 - methods used to access GPIO values
354 - flag saying whether calls to its methods may sleep
355 - optional debugfs dump method (showing extra state like pullup config)
356 - label for diagnostics
357
358There is also per-instance data, which may come from device.platform_data:
359the number of its first GPIO, and how many GPIOs it exposes.
360
361The code implementing a gpio_chip should support multiple instances of the
362controller, possibly using the driver model. That code will configure each
363gpio_chip and issue gpiochip_add(). Removing a GPIO controller should be
364rare; use gpiochip_remove() when it is unavoidable.
365
366Most often a gpio_chip is part of an instance-specific structure with state
367not exposed by the GPIO interfaces, such as addressing, power management,
368and more. Chips such as codecs will have complex non-GPIO state,
369
370Any debugfs dump method should normally ignore signals which haven't been
371requested as GPIOs. They can use gpiochip_is_requested(), which returns
372either NULL or the label associated with that GPIO when it was requested.
373
374
375Platform Support
376----------------
377To support this framework, a platform's Kconfig will "select HAVE_GPIO_LIB"
378and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines
379three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep().
380They may also want to provide a custom value for ARCH_NR_GPIOS.
381
382Trivial implementations of those functions can directly use framework
383code, which always dispatches through the gpio_chip:
384
385 #define gpio_get_value __gpio_get_value
386 #define gpio_set_value __gpio_set_value
387 #define gpio_cansleep __gpio_cansleep
388
389Fancier implementations could instead define those as inline functions with
390logic optimizing access to specific SOC-based GPIOs. For example, if the
391referenced GPIO is the constant "12", getting or setting its value could
392cost as little as two or three instructions, never sleeping. When such an
393optimization is not possible those calls must delegate to the framework
394code, costing at least a few dozen instructions. For bitbanged I/O, such
395instruction savings can be significant.
396
397For SOCs, platform-specific code defines and registers gpio_chip instances
398for each bank of on-chip GPIOs. Those GPIOs should be numbered/labeled to
399match chip vendor documentation, and directly match board schematics. They
400may well start at zero and go up to a platform-specific limit. Such GPIOs
401are normally integrated into platform initialization to make them always be
402available, from arch_initcall() or earlier; they can often serve as IRQs.
403
404
405Board Support
406-------------
407For external GPIO controllers -- such as I2C or SPI expanders, ASICs, multi
408function devices, FPGAs or CPLDs -- most often board-specific code handles
409registering controller devices and ensures that their drivers know what GPIO
410numbers to use with gpiochip_add(). Their numbers often start right after
411platform-specific GPIOs.
412
413For example, board setup code could create structures identifying the range
414of GPIOs that chip will expose, and passes them to each GPIO expander chip
415using platform_data. Then the chip driver's probe() routine could pass that
416data to gpiochip_add().
417
418Initialization order can be important. For example, when a device relies on
419an I2C-based GPIO, its probe() routine should only be called after that GPIO
420becomes available. That may mean the device should not be registered until
421calls for that GPIO can work. One way to address such dependencies is for
422such gpio_chip controllers to provide setup() and teardown() callbacks to
423board specific code; those board specific callbacks would register devices
424once all the necessary resources are available.
diff --git a/Documentation/i2c/chips/pca9539 b/Documentation/i2c/chips/pca9539
index c4fce6a13537..1d81c530c4a5 100644
--- a/Documentation/i2c/chips/pca9539
+++ b/Documentation/i2c/chips/pca9539
@@ -1,6 +1,9 @@
1Kernel driver pca9539 1Kernel driver pca9539
2===================== 2=====================
3 3
4NOTE: this driver is deprecated and will be dropped soon, use
5drivers/gpio/pca9539.c instead.
6
4Supported chips: 7Supported chips:
5 * Philips PCA9539 8 * Philips PCA9539
6 Prefix: 'pca9539' 9 Prefix: 'pca9539'
diff --git a/Documentation/ia64/aliasing-test.c b/Documentation/ia64/aliasing-test.c
index 773a814d4093..d23610fb2ff9 100644
--- a/Documentation/ia64/aliasing-test.c
+++ b/Documentation/ia64/aliasing-test.c
@@ -16,6 +16,7 @@
16#include <fcntl.h> 16#include <fcntl.h>
17#include <fnmatch.h> 17#include <fnmatch.h>
18#include <string.h> 18#include <string.h>
19#include <sys/ioctl.h>
19#include <sys/mman.h> 20#include <sys/mman.h>
20#include <sys/stat.h> 21#include <sys/stat.h>
21#include <unistd.h> 22#include <unistd.h>
@@ -65,7 +66,7 @@ int scan_tree(char *path, char *file, off_t offset, size_t length, int touch)
65{ 66{
66 struct dirent **namelist; 67 struct dirent **namelist;
67 char *name, *path2; 68 char *name, *path2;
68 int i, n, r, rc, result = 0; 69 int i, n, r, rc = 0, result = 0;
69 struct stat buf; 70 struct stat buf;
70 71
71 n = scandir(path, &namelist, 0, alphasort); 72 n = scandir(path, &namelist, 0, alphasort);
@@ -113,7 +114,7 @@ skip:
113 free(namelist[i]); 114 free(namelist[i]);
114 } 115 }
115 free(namelist); 116 free(namelist);
116 return rc; 117 return result;
117} 118}
118 119
119char buf[1024]; 120char buf[1024];
@@ -149,7 +150,7 @@ int scan_rom(char *path, char *file)
149{ 150{
150 struct dirent **namelist; 151 struct dirent **namelist;
151 char *name, *path2; 152 char *name, *path2;
152 int i, n, r, rc, result = 0; 153 int i, n, r, rc = 0, result = 0;
153 struct stat buf; 154 struct stat buf;
154 155
155 n = scandir(path, &namelist, 0, alphasort); 156 n = scandir(path, &namelist, 0, alphasort);
@@ -180,7 +181,7 @@ int scan_rom(char *path, char *file)
180 * important thing is that no MCA happened. 181 * important thing is that no MCA happened.
181 */ 182 */
182 if (rc > 0) 183 if (rc > 0)
183 fprintf(stderr, "PASS: %s read %ld bytes\n", path2, rc); 184 fprintf(stderr, "PASS: %s read %d bytes\n", path2, rc);
184 else { 185 else {
185 fprintf(stderr, "PASS: %s not readable\n", path2); 186 fprintf(stderr, "PASS: %s not readable\n", path2);
186 return rc; 187 return rc;
@@ -201,10 +202,10 @@ skip:
201 free(namelist[i]); 202 free(namelist[i]);
202 } 203 }
203 free(namelist); 204 free(namelist);
204 return rc; 205 return result;
205} 206}
206 207
207int main() 208int main(void)
208{ 209{
209 int rc; 210 int rc;
210 211
@@ -256,4 +257,6 @@ int main()
256 scan_tree("/proc/bus/pci", "??.?", 0xA0000, 0x20000, 0); 257 scan_tree("/proc/bus/pci", "??.?", 0xA0000, 0x20000, 0);
257 scan_tree("/proc/bus/pci", "??.?", 0xC0000, 0x40000, 1); 258 scan_tree("/proc/bus/pci", "??.?", 0xC0000, 0x40000, 1);
258 scan_tree("/proc/bus/pci", "??.?", 0, 1024*1024, 0); 259 scan_tree("/proc/bus/pci", "??.?", 0, 1024*1024, 0);
260
261 return rc;
259} 262}
diff --git a/Documentation/ide/ChangeLog.ide-tape.1995-2002 b/Documentation/ide/ChangeLog.ide-tape.1995-2002
new file mode 100644
index 000000000000..877fac8770b3
--- /dev/null
+++ b/Documentation/ide/ChangeLog.ide-tape.1995-2002
@@ -0,0 +1,257 @@
1/*
2 * Ver 0.1 Nov 1 95 Pre-working code :-)
3 * Ver 0.2 Nov 23 95 A short backup (few megabytes) and restore procedure
4 * was successful ! (Using tar cvf ... on the block
5 * device interface).
6 * A longer backup resulted in major swapping, bad
7 * overall Linux performance and eventually failed as
8 * we received non serial read-ahead requests from the
9 * buffer cache.
10 * Ver 0.3 Nov 28 95 Long backups are now possible, thanks to the
11 * character device interface. Linux's responsiveness
12 * and performance doesn't seem to be much affected
13 * from the background backup procedure.
14 * Some general mtio.h magnetic tape operations are
15 * now supported by our character device. As a result,
16 * popular tape utilities are starting to work with
17 * ide tapes :-)
18 * The following configurations were tested:
19 * 1. An IDE ATAPI TAPE shares the same interface
20 * and irq with an IDE ATAPI CDROM.
21 * 2. An IDE ATAPI TAPE shares the same interface
22 * and irq with a normal IDE disk.
23 * Both configurations seemed to work just fine !
24 * However, to be on the safe side, it is meanwhile
25 * recommended to give the IDE TAPE its own interface
26 * and irq.
27 * The one thing which needs to be done here is to
28 * add a "request postpone" feature to ide.c,
29 * so that we won't have to wait for the tape to finish
30 * performing a long media access (DSC) request (such
31 * as a rewind) before we can access the other device
32 * on the same interface. This effect doesn't disturb
33 * normal operation most of the time because read/write
34 * requests are relatively fast, and once we are
35 * performing one tape r/w request, a lot of requests
36 * from the other device can be queued and ide.c will
37 * service all of them after this single tape request.
38 * Ver 1.0 Dec 11 95 Integrated into Linux 1.3.46 development tree.
39 * On each read / write request, we now ask the drive
40 * if we can transfer a constant number of bytes
41 * (a parameter of the drive) only to its buffers,
42 * without causing actual media access. If we can't,
43 * we just wait until we can by polling the DSC bit.
44 * This ensures that while we are not transferring
45 * more bytes than the constant referred to above, the
46 * interrupt latency will not become too high and
47 * we won't cause an interrupt timeout, as happened
48 * occasionally in the previous version.
49 * While polling for DSC, the current request is
50 * postponed and ide.c is free to handle requests from
51 * the other device. This is handled transparently to
52 * ide.c. The hwgroup locking method which was used
53 * in the previous version was removed.
54 * Use of new general features which are provided by
55 * ide.c for use with atapi devices.
56 * (Programming done by Mark Lord)
57 * Few potential bug fixes (Again, suggested by Mark)
58 * Single character device data transfers are now
59 * not limited in size, as they were before.
60 * We are asking the tape about its recommended
61 * transfer unit and send a larger data transfer
62 * as several transfers of the above size.
63 * For best results, use an integral number of this
64 * basic unit (which is shown during driver
65 * initialization). I will soon add an ioctl to get
66 * this important parameter.
67 * Our data transfer buffer is allocated on startup,
68 * rather than before each data transfer. This should
69 * ensure that we will indeed have a data buffer.
70 * Ver 1.1 Dec 14 95 Fixed random problems which occurred when the tape
71 * shared an interface with another device.
72 * (poll_for_dsc was a complete mess).
73 * Removed some old (non-active) code which had
74 * to do with supporting buffer cache originated
75 * requests.
76 * The block device interface can now be opened, so
77 * that general ide driver features like the unmask
78 * interrupts flag can be selected with an ioctl.
79 * This is the only use of the block device interface.
80 * New fast pipelined operation mode (currently only on
81 * writes). When using the pipelined mode, the
82 * throughput can potentially reach the maximum
83 * tape supported throughput, regardless of the
84 * user backup program. On my tape drive, it sometimes
85 * boosted performance by a factor of 2. Pipelined
86 * mode is enabled by default, but since it has a few
87 * downfalls as well, you may want to disable it.
88 * A short explanation of the pipelined operation mode
89 * is available below.
90 * Ver 1.2 Jan 1 96 Eliminated pipelined mode race condition.
91 * Added pipeline read mode. As a result, restores
92 * are now as fast as backups.
93 * Optimized shared interface behavior. The new behavior
94 * typically results in better IDE bus efficiency and
95 * higher tape throughput.
96 * Pre-calculation of the expected read/write request
97 * service time, based on the tape's parameters. In
98 * the pipelined operation mode, this allows us to
99 * adjust our polling frequency to a much lower value,
100 * and thus to dramatically reduce our load on Linux,
101 * without any decrease in performance.
102 * Implemented additional mtio.h operations.
103 * The recommended user block size is returned by
104 * the MTIOCGET ioctl.
105 * Additional minor changes.
106 * Ver 1.3 Feb 9 96 Fixed pipelined read mode bug which prevented the
107 * use of some block sizes during a restore procedure.
108 * The character device interface will now present a
109 * continuous view of the media - any mix of block sizes
110 * during a backup/restore procedure is supported. The
111 * driver will buffer the requests internally and
112 * convert them to the tape's recommended transfer
113 * unit, making performance almost independent of the
114 * chosen user block size.
115 * Some improvements in error recovery.
116 * By cooperating with ide-dma.c, bus mastering DMA can
117 * now sometimes be used with IDE tape drives as well.
118 * Bus mastering DMA has the potential to dramatically
119 * reduce the CPU's overhead when accessing the device,
120 * and can be enabled by using hdparm -d1 on the tape's
121 * block device interface. For more info, read the
122 * comments in ide-dma.c.
123 * Ver 1.4 Mar 13 96 Fixed serialize support.
124 * Ver 1.5 Apr 12 96 Fixed shared interface operation, broken in 1.3.85.
125 * Fixed pipelined read mode inefficiency.
126 * Fixed nasty null dereferencing bug.
127 * Ver 1.6 Aug 16 96 Fixed FPU usage in the driver.
128 * Fixed end of media bug.
129 * Ver 1.7 Sep 10 96 Minor changes for the CONNER CTT8000-A model.
130 * Ver 1.8 Sep 26 96 Attempt to find a better balance between good
131 * interactive response and high system throughput.
132 * Ver 1.9 Nov 5 96 Automatically cross encountered filemarks rather
133 * than requiring an explicit FSF command.
134 * Abort pending requests at end of media.
135 * MTTELL was sometimes returning incorrect results.
136 * Return the real block size in the MTIOCGET ioctl.
137 * Some error recovery bug fixes.
138 * Ver 1.10 Nov 5 96 Major reorganization.
139 * Reduced CPU overhead a bit by eliminating internal
140 * bounce buffers.
141 * Added module support.
142 * Added multiple tape drives support.
143 * Added partition support.
144 * Rewrote DSC handling.
145 * Some portability fixes.
146 * Removed ide-tape.h.
147 * Additional minor changes.
148 * Ver 1.11 Dec 2 96 Bug fix in previous DSC timeout handling.
149 * Use ide_stall_queue() for DSC overlap.
150 * Use the maximum speed rather than the current speed
151 * to compute the request service time.
152 * Ver 1.12 Dec 7 97 Fix random memory overwriting and/or last block data
153 * corruption, which could occur if the total number
154 * of bytes written to the tape was not an integral
155 * number of tape blocks.
156 * Add support for INTERRUPT DRQ devices.
157 * Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB
158 * Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives.
159 * Replace cli()/sti() with hwgroup spinlocks.
160 * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup
161 * spinlock with private per-tape spinlock.
162 * Ver 1.16 Sep 1 99 Add OnStream tape support.
163 * Abort read pipeline on EOD.
164 * Wait for the tape to become ready in case it returns
165 * "in the process of becoming ready" on open().
166 * Fix zero padding of the last written block in
167 * case the tape block size is larger than PAGE_SIZE.
168 * Decrease the default disconnection time to tn.
169 * Ver 1.16e Oct 3 99 Minor fixes.
170 * Ver 1.16e1 Oct 13 99 Patches by Arnold Niessen,
171 * niessen@iae.nl / arnold.niessen@philips.com
172 * GO-1) Undefined code in idetape_read_position
173 * according to Gadi's email
174 * AJN-1) Minor fix asc == 11 should be asc == 0x11
175 * in idetape_issue_packet_command (did effect
176 * debugging output only)
177 * AJN-2) Added more debugging output, and
178 * added ide-tape: where missing. I would also
179 * like to add tape->name where possible
180 * AJN-3) Added different debug_level's
181 * via /proc/ide/hdc/settings
182 * "debug_level" determines amount of debugging output;
183 * can be changed using /proc/ide/hdx/settings
184 * 0 : almost no debugging output
185 * 1 : 0+output errors only
186 * 2 : 1+output all sensekey/asc
187 * 3 : 2+follow all chrdev related procedures
188 * 4 : 3+follow all procedures
189 * 5 : 4+include pc_stack rq_stack info
190 * 6 : 5+USE_COUNT updates
191 * AJN-4) Fixed timeout for retension in idetape_queue_pc_tail
192 * from 5 to 10 minutes
193 * AJN-5) Changed maximum number of blocks to skip when
194 * reading tapes with multiple consecutive write
195 * errors from 100 to 1000 in idetape_get_logical_blk
196 * Proposed changes to code:
197 * 1) output "logical_blk_num" via /proc
198 * 2) output "current_operation" via /proc
199 * 3) Either solve or document the fact that `mt rewind' is
200 * required after reading from /dev/nhtx to be
201 * able to rmmod the idetape module;
202 * Also, sometimes an application finishes but the
203 * device remains `busy' for some time. Same cause ?
204 * Proposed changes to release-notes:
205 * 4) write a simple `quickstart' section in the
206 * release notes; I volunteer if you don't want to
207 * 5) include a pointer to video4linux in the doc
208 * to stimulate video applications
209 * 6) release notes lines 331 and 362: explain what happens
210 * if the application data rate is higher than 1100 KB/s;
211 * similar approach to lower-than-500 kB/s ?
212 * 7) 6.6 Comparison; wouldn't it be better to allow different
213 * strategies for read and write ?
214 * Wouldn't it be better to control the tape buffer
215 * contents instead of the bandwidth ?
216 * 8) line 536: replace will by would (if I understand
217 * this section correctly, a hypothetical and unwanted situation
218 * is being described)
219 * Ver 1.16f Dec 15 99 Change place of the secondary OnStream header frames.
220 * Ver 1.17 Nov 2000 / Jan 2001 Marcel Mol, marcel@mesa.nl
221 * - Add idetape_onstream_mode_sense_tape_parameter_page
222 * function to get tape capacity in frames: tape->capacity.
223 * - Add support for DI-50 drives( or any DI- drive).
224 * - 'workaround' for read error/blank block around block 3000.
225 * - Implement Early warning for end of media for Onstream.
226 * - Cosmetic code changes for readability.
227 * - Idetape_position_tape should not use SKIP bit during
228 * Onstream read recovery.
229 * - Add capacity, logical_blk_num and first/last_frame_position
230 * to /proc/ide/hd?/settings.
231 * - Module use count was gone in the Linux 2.4 driver.
232 * Ver 1.17a Apr 2001 Willem Riede osst@riede.org
233 * - Get drive's actual block size from mode sense block descriptor
234 * - Limit size of pipeline
235 * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu>
236 * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used
237 * it in the code!
238 * Actually removed aborted stages in idetape_abort_pipeline
239 * instead of just changing the command code.
240 * Made the transfer byte count for Request Sense equal to the
241 * actual length of the data transfer.
242 * Changed handling of partial data transfers: they do not
243 * cause DMA errors.
244 * Moved initiation of DMA transfers to the correct place.
245 * Removed reference to unallocated memory.
246 * Made __idetape_discard_read_pipeline return the number of
247 * sectors skipped, not the number of stages.
248 * Replaced errant kfree() calls with __idetape_kfree_stage().
249 * Fixed off-by-one error in testing the pipeline length.
250 * Fixed handling of filemarks in the read pipeline.
251 * Small code optimization for MTBSF and MTBSFM ioctls.
252 * Don't try to unlock the door during device close if is
253 * already unlocked!
254 * Cosmetic fixes to miscellaneous debugging output messages.
255 * Set the minimum /proc/ide/hd?/settings values for "pipeline",
256 * "pipeline_min", and "pipeline_max" to 1.
257 */
diff --git a/Documentation/ide/ide-tape.txt b/Documentation/ide/ide-tape.txt
new file mode 100644
index 000000000000..658f271a373f
--- /dev/null
+++ b/Documentation/ide/ide-tape.txt
@@ -0,0 +1,146 @@
1/*
2 * IDE ATAPI streaming tape driver.
3 *
4 * This driver is a part of the Linux ide driver.
5 *
6 * The driver, in co-operation with ide.c, basically traverses the
7 * request-list for the block device interface. The character device
8 * interface, on the other hand, creates new requests, adds them
9 * to the request-list of the block device, and waits for their completion.
10 *
11 * Pipelined operation mode is now supported on both reads and writes.
12 *
13 * The block device major and minor numbers are determined from the
14 * tape's relative position in the ide interfaces, as explained in ide.c.
15 *
16 * The character device interface consists of the following devices:
17 *
18 * ht0 major 37, minor 0 first IDE tape, rewind on close.
19 * ht1 major 37, minor 1 second IDE tape, rewind on close.
20 * ...
21 * nht0 major 37, minor 128 first IDE tape, no rewind on close.
22 * nht1 major 37, minor 129 second IDE tape, no rewind on close.
23 * ...
24 *
25 * The general magnetic tape commands compatible interface, as defined by
26 * include/linux/mtio.h, is accessible through the character device.
27 *
28 * General ide driver configuration options, such as the interrupt-unmask
29 * flag, can be configured by issuing an ioctl to the block device interface,
30 * as any other ide device.
31 *
32 * Our own ide-tape ioctl's can be issued to either the block device or
33 * the character device interface.
34 *
35 * Maximal throughput with minimal bus load will usually be achieved in the
36 * following scenario:
37 *
38 * 1. ide-tape is operating in the pipelined operation mode.
39 * 2. No buffering is performed by the user backup program.
40 *
41 * Testing was done with a 2 GB CONNER CTMA 4000 IDE ATAPI Streaming Tape Drive.
42 *
43 * Here are some words from the first releases of hd.c, which are quoted
44 * in ide.c and apply here as well:
45 *
46 * | Special care is recommended. Have Fun!
47 *
48 *
49 * An overview of the pipelined operation mode.
50 *
51 * In the pipelined write mode, we will usually just add requests to our
52 * pipeline and return immediately, before we even start to service them. The
53 * user program will then have enough time to prepare the next request while
54 * we are still busy servicing previous requests. In the pipelined read mode,
55 * the situation is similar - we add read-ahead requests into the pipeline,
56 * before the user even requested them.
57 *
58 * The pipeline can be viewed as a "safety net" which will be activated when
59 * the system load is high and prevents the user backup program from keeping up
60 * with the current tape speed. At this point, the pipeline will get
61 * shorter and shorter but the tape will still be streaming at the same speed.
62 * Assuming we have enough pipeline stages, the system load will hopefully
63 * decrease before the pipeline is completely empty, and the backup program
64 * will be able to "catch up" and refill the pipeline again.
65 *
66 * When using the pipelined mode, it would be best to disable any type of
67 * buffering done by the user program, as ide-tape already provides all the
68 * benefits in the kernel, where it can be done in a more efficient way.
69 * As we will usually not block the user program on a request, the most
70 * efficient user code will then be a simple read-write-read-... cycle.
71 * Any additional logic will usually just slow down the backup process.
72 *
73 * Using the pipelined mode, I get a constant over 400 KBps throughput,
74 * which seems to be the maximum throughput supported by my tape.
75 *
76 * However, there are some downfalls:
77 *
78 * 1. We use memory (for data buffers) in proportional to the number
79 * of pipeline stages (each stage is about 26 KB with my tape).
80 * 2. In the pipelined write mode, we cheat and postpone error codes
81 * to the user task. In read mode, the actual tape position
82 * will be a bit further than the last requested block.
83 *
84 * Concerning (1):
85 *
86 * 1. We allocate stages dynamically only when we need them. When
87 * we don't need them, we don't consume additional memory. In
88 * case we can't allocate stages, we just manage without them
89 * (at the expense of decreased throughput) so when Linux is
90 * tight in memory, we will not pose additional difficulties.
91 *
92 * 2. The maximum number of stages (which is, in fact, the maximum
93 * amount of memory) which we allocate is limited by the compile
94 * time parameter IDETAPE_MAX_PIPELINE_STAGES.
95 *
96 * 3. The maximum number of stages is a controlled parameter - We
97 * don't start from the user defined maximum number of stages
98 * but from the lower IDETAPE_MIN_PIPELINE_STAGES (again, we
99 * will not even allocate this amount of stages if the user
100 * program can't handle the speed). We then implement a feedback
101 * loop which checks if the pipeline is empty, and if it is, we
102 * increase the maximum number of stages as necessary until we
103 * reach the optimum value which just manages to keep the tape
104 * busy with minimum allocated memory or until we reach
105 * IDETAPE_MAX_PIPELINE_STAGES.
106 *
107 * Concerning (2):
108 *
109 * In pipelined write mode, ide-tape can not return accurate error codes
110 * to the user program since we usually just add the request to the
111 * pipeline without waiting for it to be serviced. In case an error
112 * occurs, I will report it on the next user request.
113 *
114 * In the pipelined read mode, subsequent read requests or forward
115 * filemark spacing will perform correctly, as we preserve all blocks
116 * and filemarks which we encountered during our excess read-ahead.
117 *
118 * For accurate tape positioning and error reporting, disabling
119 * pipelined mode might be the best option.
120 *
121 * You can enable/disable/tune the pipelined operation mode by adjusting
122 * the compile time parameters below.
123 *
124 *
125 * Possible improvements.
126 *
127 * 1. Support for the ATAPI overlap protocol.
128 *
129 * In order to maximize bus throughput, we currently use the DSC
130 * overlap method which enables ide.c to service requests from the
131 * other device while the tape is busy executing a command. The
132 * DSC overlap method involves polling the tape's status register
133 * for the DSC bit, and servicing the other device while the tape
134 * isn't ready.
135 *
136 * In the current QIC development standard (December 1995),
137 * it is recommended that new tape drives will *in addition*
138 * implement the ATAPI overlap protocol, which is used for the
139 * same purpose - efficient use of the IDE bus, but is interrupt
140 * driven and thus has much less CPU overhead.
141 *
142 * ATAPI overlap is likely to be supported in most new ATAPI
143 * devices, including new ATAPI cdroms, and thus provides us
144 * a method by which we can achieve higher throughput when
145 * sharing a (fast) ATA-2 disk with any (slow) new ATAPI device.
146 */
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt
index 74f68b35f7c1..1ba84f3584e3 100644
--- a/Documentation/initrd.txt
+++ b/Documentation/initrd.txt
@@ -85,7 +85,7 @@ involve special block devices or loopbacks; you merely create a directory on
85disk with the desired initrd content, cd to that directory, and run (as an 85disk with the desired initrd content, cd to that directory, and run (as an
86example): 86example):
87 87
88find . | cpio --quiet -c -o | gzip -9 -n > /boot/imagefile.img 88find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/imagefile.img
89 89
90Examining the contents of an existing image file is just as simple: 90Examining the contents of an existing image file is just as simple:
91 91
diff --git a/Documentation/ja_JP/stable_kernel_rules.txt b/Documentation/ja_JP/stable_kernel_rules.txt
new file mode 100644
index 000000000000..17d87519e468
--- /dev/null
+++ b/Documentation/ja_JP/stable_kernel_rules.txt
@@ -0,0 +1,79 @@
1NOTE:
2This is Japanese translated version of "Documentation/stable_kernel_rules.txt".
3This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com>
4and JF Project team <www.linux.or.jp/JF>.
5If you find difference with original file or problem in translation,
6please contact maintainer of this file or JF project.
7
8Please also note that purpose of this file is easier to read for non
9English natives and do no intended to fork. So, if you have any
10comment or update of this file, please try to update Original(English)
11file at first.
12
13==================================
14これは、
15linux-2.6.24/Documentation/stable_kernel_rules.txt
16の和訳です。
17
18翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
19翻訳日: 2007/12/30
20翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
21校正者: 武井伸光さん、<takei at webmasters dot gr dot jp>
22 かねこさん (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp>
23 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
24 野口さん (Kenji Noguchi) <tokyo246 at gmail dot com>
25 神宮信太郎さん <jin at libjingu dot jp>
26==================================
27
28ずっと知りたかった Linux 2.6 -stable リリースの全て
29
30"-stable" ツリーにどのような種類のパッチが受け入れられるか、どのような
31ものが受け入れられないか、についての規則-
32
33 - 明らかに正しく、テストされているものでなければならない。
34 - 文脈(変更行の前後)を含めて 100 行より大きくてはいけない。
35 - ただ一個のことだけを修正しているべき。
36 - 皆を悩ませている本物のバグを修正しなければならない。("これはバグで
37 あるかもしれないが..." のようなものではない)
38 - ビルドエラー(CONFIG_BROKENになっているものを除く), oops, ハング、デー
39 タ破壊、現実のセキュリティ問題、その他 "ああ、これはダメだね"という
40 ようなものを修正しなければならない。短く言えば、重大な問題。
41 - どのように競合状態が発生するかの説明も一緒に書かれていない限り、
42 "理論的には競合状態になる"ようなものは不可。
43 - いかなる些細な修正も含めることはできない。(スペルの修正、空白のクリー
44 ンアップなど)
45 - 対応するサブシステムメンテナが受け入れたものでなければならない。
46 - Documentation/SubmittingPatches の規則に従ったものでなければならない。
47
48-stable ツリーにパッチを送付する手続き-
49
50 - 上記の規則に従っているかを確認した後に、stable@kernel.org にパッチ
51 を送る。
52 - 送信者はパッチがキューに受け付けられた際には ACK を、却下された場合
53 には NAK を受け取る。この反応は開発者たちのスケジュールによって、数
54 日かかる場合がある。
55 - もし受け取られたら、パッチは他の開発者たちのレビューのために
56 -stable キューに追加される。
57 - セキュリティパッチはこのエイリアス (stable@kernel.org) に送られるべ
58 きではなく、代わりに security@kernel.org のアドレスに送られる。
59
60レビューサイクル-
61
62 - -stable メンテナがレビューサイクルを決めるとき、パッチはレビュー委
63 員会とパッチが影響する領域のメンテナ(提供者がその領域のメンテナで無
64 い限り)に送られ、linux-kernel メーリングリストにCCされる。
65 - レビュー委員会は 48時間の間に ACK か NAK を出す。
66 - もしパッチが委員会のメンバから却下れるか、メンテナ達やメンバが気付
67 かなかった問題が持ちあがり、linux-kernel メンバがパッチに異議を唱え
68 た場合には、パッチはキューから削除される。
69 - レビューサイクルの最後に、ACK を受けたパッチは最新の -stable リリー
70 スに追加され、その後に新しい -stable リリースが行われる。
71 - セキュリティパッチは、通常のレビューサイクルを通らず、セキュリティ
72 カーネルチームから直接 -stable ツリーに受け付けられる。
73 この手続きの詳細については kernel security チームに問い合わせること。
74
75レビュー委員会-
76
77 - この委員会は、このタスクについて活動する多くのボランティアと、少数の
78 非ボランティアのカーネル開発者達で構成されている。
79
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 92c40d174355..8fd5aa40585f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -168,6 +168,11 @@ and is between 256 and 4096 characters. It is defined in the file
168 acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA 168 acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA
169 Format: <irq>,<irq>... 169 Format: <irq>,<irq>...
170 170
171 acpi_new_pts_ordering [HW,ACPI]
172 Enforce the ACPI 2.0 ordering of the _PTS control
173 method wrt putting devices into low power states
174 default: pre ACPI 2.0 ordering of _PTS
175
171 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT 176 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
172 177
173 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 178 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
@@ -544,7 +549,7 @@ and is between 256 and 4096 characters. It is defined in the file
544 1 will print _a lot_ more information - normally 549 1 will print _a lot_ more information - normally
545 only useful to kernel developers. 550 only useful to kernel developers.
546 551
547 decnet= [HW,NET] 552 decnet.addr= [HW,NET]
548 Format: <area>[,<node>] 553 Format: <area>[,<node>]
549 See also Documentation/networking/decnet.txt. 554 See also Documentation/networking/decnet.txt.
550 555
@@ -775,6 +780,9 @@ and is between 256 and 4096 characters. It is defined in the file
775 loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same 780 loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same
776 as idle=poll. 781 as idle=poll.
777 782
783 ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem
784 Claim all unknown PCI IDE storage controllers.
785
778 ignore_loglevel [KNL] 786 ignore_loglevel [KNL]
779 Ignore loglevel setting - this will print /all/ 787 Ignore loglevel setting - this will print /all/
780 kernel messages to the console. Useful for debugging. 788 kernel messages to the console. Useful for debugging.
@@ -1556,14 +1564,17 @@ and is between 256 and 4096 characters. It is defined in the file
1556 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes 1564 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes
1557 See Documentation/ramdisk.txt. 1565 See Documentation/ramdisk.txt.
1558 1566
1559 rcu.blimit= [KNL,BOOT] Set maximum number of finished 1567 rcupdate.blimit= [KNL,BOOT]
1560 RCU callbacks to process in one batch. 1568 Set maximum number of finished RCU callbacks to process
1569 in one batch.
1561 1570
1562 rcu.qhimark= [KNL,BOOT] Set threshold of queued 1571 rcupdate.qhimark= [KNL,BOOT]
1572 Set threshold of queued
1563 RCU callbacks over which batch limiting is disabled. 1573 RCU callbacks over which batch limiting is disabled.
1564 1574
1565 rcu.qlowmark= [KNL,BOOT] Set threshold of queued 1575 rcupdate.qlowmark= [KNL,BOOT]
1566 RCU callbacks below which batch limiting is re-enabled. 1576 Set threshold of queued RCU callbacks below which
1577 batch limiting is re-enabled.
1567 1578
1568 rdinit= [KNL] 1579 rdinit= [KNL]
1569 Format: <full_path> 1580 Format: <full_path>
@@ -1883,9 +1894,6 @@ and is between 256 and 4096 characters. It is defined in the file
1883 st= [HW,SCSI] SCSI tape parameters (buffers, etc.) 1894 st= [HW,SCSI] SCSI tape parameters (buffers, etc.)
1884 See Documentation/scsi/st.txt. 1895 See Documentation/scsi/st.txt.
1885 1896
1886 st0x= [HW,SCSI]
1887 See header of drivers/scsi/seagate.c.
1888
1889 sti= [PARISC,HW] 1897 sti= [PARISC,HW]
1890 Format: <num> 1898 Format: <num>
1891 Set the STI (builtin display/keyboard on the HP-PARISC 1899 Set the STI (builtin display/keyboard on the HP-PARISC
@@ -1970,9 +1978,6 @@ and is between 256 and 4096 characters. It is defined in the file
1970 tipar.delay= [HW,PPT] 1978 tipar.delay= [HW,PPT]
1971 Set inter-bit delay in microseconds (default 10). 1979 Set inter-bit delay in microseconds (default 10).
1972 1980
1973 tmc8xx= [HW,SCSI]
1974 See header of drivers/scsi/seagate.c.
1975
1976 tmscsim= [HW,SCSI] 1981 tmscsim= [HW,SCSI]
1977 See comment before function dc390_setup() in 1982 See comment before function dc390_setup() in
1978 drivers/scsi/tmscsim.c. 1983 drivers/scsi/tmscsim.c.
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 53a63890aea4..30c101761d0d 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -96,7 +96,9 @@ or in registers (e.g., for x86_64 or for an i386 fastcall function).
96The jprobe will work in either case, so long as the handler's 96The jprobe will work in either case, so long as the handler's
97prototype matches that of the probed function. 97prototype matches that of the probed function.
98 98
991.3 How Does a Return Probe Work? 991.3 Return Probes
100
1011.3.1 How Does a Return Probe Work?
100 102
101When you call register_kretprobe(), Kprobes establishes a kprobe at 103When you call register_kretprobe(), Kprobes establishes a kprobe at
102the entry to the function. When the probed function is called and this 104the entry to the function. When the probed function is called and this
@@ -107,9 +109,9 @@ At boot time, Kprobes registers a kprobe at the trampoline.
107 109
108When the probed function executes its return instruction, control 110When the probed function executes its return instruction, control
109passes to the trampoline and that probe is hit. Kprobes' trampoline 111passes to the trampoline and that probe is hit. Kprobes' trampoline
110handler calls the user-specified handler associated with the kretprobe, 112handler calls the user-specified return handler associated with the
111then sets the saved instruction pointer to the saved return address, 113kretprobe, then sets the saved instruction pointer to the saved return
112and that's where execution resumes upon return from the trap. 114address, and that's where execution resumes upon return from the trap.
113 115
114While the probed function is executing, its return address is 116While the probed function is executing, its return address is
115stored in an object of type kretprobe_instance. Before calling 117stored in an object of type kretprobe_instance. Before calling
@@ -131,6 +133,30 @@ zero when the return probe is registered, and is incremented every
131time the probed function is entered but there is no kretprobe_instance 133time the probed function is entered but there is no kretprobe_instance
132object available for establishing the return probe. 134object available for establishing the return probe.
133 135
1361.3.2 Kretprobe entry-handler
137
138Kretprobes also provides an optional user-specified handler which runs
139on function entry. This handler is specified by setting the entry_handler
140field of the kretprobe struct. Whenever the kprobe placed by kretprobe at the
141function entry is hit, the user-defined entry_handler, if any, is invoked.
142If the entry_handler returns 0 (success) then a corresponding return handler
143is guaranteed to be called upon function return. If the entry_handler
144returns a non-zero error then Kprobes leaves the return address as is, and
145the kretprobe has no further effect for that particular function instance.
146
147Multiple entry and return handler invocations are matched using the unique
148kretprobe_instance object associated with them. Additionally, a user
149may also specify per return-instance private data to be part of each
150kretprobe_instance object. This is especially useful when sharing private
151data between corresponding user entry and return handlers. The size of each
152private data object can be specified at kretprobe registration time by
153setting the data_size field of the kretprobe struct. This data can be
154accessed through the data field of each kretprobe_instance object.
155
156In case probed function is entered but there is no kretprobe_instance
157object available, then in addition to incrementing the nmissed count,
158the user entry_handler invocation is also skipped.
159
1342. Architectures Supported 1602. Architectures Supported
135 161
136Kprobes, jprobes, and return probes are implemented on the following 162Kprobes, jprobes, and return probes are implemented on the following
@@ -274,6 +300,8 @@ of interest:
274- ret_addr: the return address 300- ret_addr: the return address
275- rp: points to the corresponding kretprobe object 301- rp: points to the corresponding kretprobe object
276- task: points to the corresponding task struct 302- task: points to the corresponding task struct
303- data: points to per return-instance private data; see "Kretprobe
304 entry-handler" for details.
277 305
278The regs_return_value(regs) macro provides a simple abstraction to 306The regs_return_value(regs) macro provides a simple abstraction to
279extract the return value from the appropriate register as defined by 307extract the return value from the appropriate register as defined by
@@ -556,23 +584,52 @@ report failed calls to sys_open().
556#include <linux/kernel.h> 584#include <linux/kernel.h>
557#include <linux/module.h> 585#include <linux/module.h>
558#include <linux/kprobes.h> 586#include <linux/kprobes.h>
587#include <linux/ktime.h>
588
589/* per-instance private data */
590struct my_data {
591 ktime_t entry_stamp;
592};
559 593
560static const char *probed_func = "sys_open"; 594static const char *probed_func = "sys_open";
561 595
562/* Return-probe handler: If the probed function fails, log the return value. */ 596/* Timestamp function entry. */
563static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) 597static int entry_handler(struct kretprobe_instance *ri, struct pt_regs *regs)
598{
599 struct my_data *data;
600
601 if(!current->mm)
602 return 1; /* skip kernel threads */
603
604 data = (struct my_data *)ri->data;
605 data->entry_stamp = ktime_get();
606 return 0;
607}
608
609/* If the probed function failed, log the return value and duration.
610 * Duration may turn out to be zero consistently, depending upon the
611 * granularity of time accounting on the platform. */
612static int return_handler(struct kretprobe_instance *ri, struct pt_regs *regs)
564{ 613{
565 int retval = regs_return_value(regs); 614 int retval = regs_return_value(regs);
615 struct my_data *data = (struct my_data *)ri->data;
616 s64 delta;
617 ktime_t now;
618
566 if (retval < 0) { 619 if (retval < 0) {
567 printk("%s returns %d\n", probed_func, retval); 620 now = ktime_get();
621 delta = ktime_to_ns(ktime_sub(now, data->entry_stamp));
622 printk("%s: return val = %d (duration = %lld ns)\n",
623 probed_func, retval, delta);
568 } 624 }
569 return 0; 625 return 0;
570} 626}
571 627
572static struct kretprobe my_kretprobe = { 628static struct kretprobe my_kretprobe = {
573 .handler = ret_handler, 629 .handler = return_handler,
574 /* Probe up to 20 instances concurrently. */ 630 .entry_handler = entry_handler,
575 .maxactive = 20 631 .data_size = sizeof(struct my_data),
632 .maxactive = 20, /* probe up to 20 instances concurrently */
576}; 633};
577 634
578static int __init kretprobe_init(void) 635static int __init kretprobe_init(void)
@@ -584,7 +641,7 @@ static int __init kretprobe_init(void)
584 printk("register_kretprobe failed, returned %d\n", ret); 641 printk("register_kretprobe failed, returned %d\n", ret);
585 return -1; 642 return -1;
586 } 643 }
587 printk("Planted return probe at %p\n", my_kretprobe.kp.addr); 644 printk("Kretprobe active on %s\n", my_kretprobe.kp.symbol_name);
588 return 0; 645 return 0;
589} 646}
590 647
@@ -594,7 +651,7 @@ static void __exit kretprobe_exit(void)
594 printk("kretprobe unregistered\n"); 651 printk("kretprobe unregistered\n");
595 /* nmissed > 0 suggests that maxactive was set too low. */ 652 /* nmissed > 0 suggests that maxactive was set too low. */
596 printk("Missed probing %d instances of %s\n", 653 printk("Missed probing %d instances of %s\n",
597 my_kretprobe.nmissed, probed_func); 654 my_kretprobe.nmissed, probed_func);
598} 655}
599 656
600module_init(kretprobe_init) 657module_init(kretprobe_init)
diff --git a/Documentation/kref.txt b/Documentation/kref.txt
index f38b59d00c63..130b6e87aa7e 100644
--- a/Documentation/kref.txt
+++ b/Documentation/kref.txt
@@ -141,10 +141,10 @@ The last rule (rule 3) is the nastiest one to handle. Say, for
141instance, you have a list of items that are each kref-ed, and you wish 141instance, you have a list of items that are each kref-ed, and you wish
142to get the first one. You can't just pull the first item off the list 142to get the first one. You can't just pull the first item off the list
143and kref_get() it. That violates rule 3 because you are not already 143and kref_get() it. That violates rule 3 because you are not already
144holding a valid pointer. You must add locks or semaphores. For 144holding a valid pointer. You must add a mutex (or some other lock).
145instance: 145For instance:
146 146
147static DECLARE_MUTEX(sem); 147static DEFINE_MUTEX(mutex);
148static LIST_HEAD(q); 148static LIST_HEAD(q);
149struct my_data 149struct my_data
150{ 150{
@@ -155,12 +155,12 @@ struct my_data
155static struct my_data *get_entry() 155static struct my_data *get_entry()
156{ 156{
157 struct my_data *entry = NULL; 157 struct my_data *entry = NULL;
158 down(&sem); 158 mutex_lock(&mutex);
159 if (!list_empty(&q)) { 159 if (!list_empty(&q)) {
160 entry = container_of(q.next, struct my_q_entry, link); 160 entry = container_of(q.next, struct my_q_entry, link);
161 kref_get(&entry->refcount); 161 kref_get(&entry->refcount);
162 } 162 }
163 up(&sem); 163 mutex_unlock(&mutex);
164 return entry; 164 return entry;
165} 165}
166 166
@@ -174,9 +174,9 @@ static void release_entry(struct kref *ref)
174 174
175static void put_entry(struct my_data *entry) 175static void put_entry(struct my_data *entry)
176{ 176{
177 down(&sem); 177 mutex_lock(&mutex);
178 kref_put(&entry->refcount, release_entry); 178 kref_put(&entry->refcount, release_entry);
179 up(&sem); 179 mutex_unlock(&mutex);
180} 180}
181 181
182The kref_put() return value is useful if you do not want to hold the 182The kref_put() return value is useful if you do not want to hold the
@@ -191,13 +191,13 @@ static void release_entry(struct kref *ref)
191 191
192static void put_entry(struct my_data *entry) 192static void put_entry(struct my_data *entry)
193{ 193{
194 down(&sem); 194 mutex_lock(&mutex);
195 if (kref_put(&entry->refcount, release_entry)) { 195 if (kref_put(&entry->refcount, release_entry)) {
196 list_del(&entry->link); 196 list_del(&entry->link);
197 up(&sem); 197 mutex_unlock(&mutex);
198 kfree(entry); 198 kfree(entry);
199 } else 199 } else
200 up(&sem); 200 mutex_unlock(&mutex);
201} 201}
202 202
203This is really more useful if you have to call other routines as part 203This is really more useful if you have to call other routines as part
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 6c8a2386cd50..0f23d67f958f 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -34,6 +34,8 @@
34#include <zlib.h> 34#include <zlib.h>
35#include <assert.h> 35#include <assert.h>
36#include <sched.h> 36#include <sched.h>
37#include <limits.h>
38#include <stddef.h>
37#include "linux/lguest_launcher.h" 39#include "linux/lguest_launcher.h"
38#include "linux/virtio_config.h" 40#include "linux/virtio_config.h"
39#include "linux/virtio_net.h" 41#include "linux/virtio_net.h"
@@ -99,13 +101,11 @@ struct device_list
99 /* The descriptor page for the devices. */ 101 /* The descriptor page for the devices. */
100 u8 *descpage; 102 u8 *descpage;
101 103
102 /* The tail of the last descriptor. */
103 unsigned int desc_used;
104
105 /* A single linked list of devices. */ 104 /* A single linked list of devices. */
106 struct device *dev; 105 struct device *dev;
107 /* ... And an end pointer so we can easily append new devices */ 106 /* And a pointer to the last device for easy append and also for
108 struct device **lastdev; 107 * configuration appending. */
108 struct device *lastdev;
109}; 109};
110 110
111/* The list of Guest devices, based on command line arguments. */ 111/* The list of Guest devices, based on command line arguments. */
@@ -191,7 +191,14 @@ static void *_convert(struct iovec *iov, size_t size, size_t align,
191#define cpu_to_le64(v64) (v64) 191#define cpu_to_le64(v64) (v64)
192#define le16_to_cpu(v16) (v16) 192#define le16_to_cpu(v16) (v16)
193#define le32_to_cpu(v32) (v32) 193#define le32_to_cpu(v32) (v32)
194#define le64_to_cpu(v32) (v64) 194#define le64_to_cpu(v64) (v64)
195
196/* The device virtqueue descriptors are followed by feature bitmasks. */
197static u8 *get_feature_bits(struct device *dev)
198{
199 return (u8 *)(dev->desc + 1)
200 + dev->desc->num_vq * sizeof(struct lguest_vqconfig);
201}
195 202
196/*L:100 The Launcher code itself takes us out into userspace, that scary place 203/*L:100 The Launcher code itself takes us out into userspace, that scary place
197 * where pointers run wild and free! Unfortunately, like most userspace 204 * where pointers run wild and free! Unfortunately, like most userspace
@@ -914,21 +921,58 @@ static void enable_fd(int fd, struct virtqueue *vq)
914 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); 921 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd));
915} 922}
916 923
924/* Resetting a device is fairly easy. */
925static void reset_device(struct device *dev)
926{
927 struct virtqueue *vq;
928
929 verbose("Resetting device %s\n", dev->name);
930 /* Clear the status. */
931 dev->desc->status = 0;
932
933 /* Clear any features they've acked. */
934 memset(get_feature_bits(dev) + dev->desc->feature_len, 0,
935 dev->desc->feature_len);
936
937 /* Zero out the virtqueues. */
938 for (vq = dev->vq; vq; vq = vq->next) {
939 memset(vq->vring.desc, 0,
940 vring_size(vq->config.num, getpagesize()));
941 vq->last_avail_idx = 0;
942 }
943}
944
917/* This is the generic routine we call when the Guest uses LHCALL_NOTIFY. */ 945/* This is the generic routine we call when the Guest uses LHCALL_NOTIFY. */
918static void handle_output(int fd, unsigned long addr) 946static void handle_output(int fd, unsigned long addr)
919{ 947{
920 struct device *i; 948 struct device *i;
921 struct virtqueue *vq; 949 struct virtqueue *vq;
922 950
923 /* Check each virtqueue. */ 951 /* Check each device and virtqueue. */
924 for (i = devices.dev; i; i = i->next) { 952 for (i = devices.dev; i; i = i->next) {
953 /* Notifications to device descriptors reset the device. */
954 if (from_guest_phys(addr) == i->desc) {
955 reset_device(i);
956 return;
957 }
958
959 /* Notifications to virtqueues mean output has occurred. */
925 for (vq = i->vq; vq; vq = vq->next) { 960 for (vq = i->vq; vq; vq = vq->next) {
926 if (vq->config.pfn == addr/getpagesize() 961 if (vq->config.pfn != addr/getpagesize())
927 && vq->handle_output) { 962 continue;
928 verbose("Output to %s\n", vq->dev->name); 963
929 vq->handle_output(fd, vq); 964 /* Guest should acknowledge (and set features!) before
965 * using the device. */
966 if (i->desc->status == 0) {
967 warnx("%s gave early output", i->name);
930 return; 968 return;
931 } 969 }
970
971 if (strcmp(vq->dev->name, "console") != 0)
972 verbose("Output to %s\n", vq->dev->name);
973 if (vq->handle_output)
974 vq->handle_output(fd, vq);
975 return;
932 } 976 }
933 } 977 }
934 978
@@ -986,54 +1030,44 @@ static void handle_input(int fd)
986 * 1030 *
987 * All devices need a descriptor so the Guest knows it exists, and a "struct 1031 * All devices need a descriptor so the Guest knows it exists, and a "struct
988 * device" so the Launcher can keep track of it. We have common helper 1032 * device" so the Launcher can keep track of it. We have common helper
989 * routines to allocate them. 1033 * routines to allocate and manage them. */
990 *
991 * This routine allocates a new "struct lguest_device_desc" from descriptor
992 * table just above the Guest's normal memory. It returns a pointer to that
993 * descriptor. */
994static struct lguest_device_desc *new_dev_desc(u16 type)
995{
996 struct lguest_device_desc *d;
997 1034
998 /* We only have one page for all the descriptors. */ 1035/* The layout of the device page is a "struct lguest_device_desc" followed by a
999 if (devices.desc_used + sizeof(*d) > getpagesize()) 1036 * number of virtqueue descriptors, then two sets of feature bits, then an
1000 errx(1, "Too many devices"); 1037 * array of configuration bytes. This routine returns the configuration
1001 1038 * pointer. */
1002 /* We don't need to set config_len or status: page is 0 already. */ 1039static u8 *device_config(const struct device *dev)
1003 d = (void *)devices.descpage + devices.desc_used; 1040{
1004 d->type = type; 1041 return (void *)(dev->desc + 1)
1005 devices.desc_used += sizeof(*d); 1042 + dev->desc->num_vq * sizeof(struct lguest_vqconfig)
1006 1043 + dev->desc->feature_len * 2;
1007 return d;
1008} 1044}
1009 1045
1010/* Each device descriptor is followed by some configuration information. 1046/* This routine allocates a new "struct lguest_device_desc" from descriptor
1011 * Each configuration field looks like: u8 type, u8 len, [... len bytes...]. 1047 * table page just above the Guest's normal memory. It returns a pointer to
1012 * 1048 * that descriptor. */
1013 * This routine adds a new field to an existing device's descriptor. It only 1049static struct lguest_device_desc *new_dev_desc(u16 type)
1014 * works for the last device, but that's OK because that's how we use it. */
1015static void add_desc_field(struct device *dev, u8 type, u8 len, const void *c)
1016{ 1050{
1017 /* This is the last descriptor, right? */ 1051 struct lguest_device_desc d = { .type = type };
1018 assert(devices.descpage + devices.desc_used 1052 void *p;
1019 == (u8 *)(dev->desc + 1) + dev->desc->config_len);
1020 1053
1021 /* We only have one page of device descriptions. */ 1054 /* Figure out where the next device config is, based on the last one. */
1022 if (devices.desc_used + 2 + len > getpagesize()) 1055 if (devices.lastdev)
1023 errx(1, "Too many devices"); 1056 p = device_config(devices.lastdev)
1057 + devices.lastdev->desc->config_len;
1058 else
1059 p = devices.descpage;
1024 1060
1025 /* Copy in the new config header: type then length. */ 1061 /* We only have one page for all the descriptors. */
1026 devices.descpage[devices.desc_used++] = type; 1062 if (p + sizeof(d) > (void *)devices.descpage + getpagesize())
1027 devices.descpage[devices.desc_used++] = len; 1063 errx(1, "Too many devices");
1028 memcpy(devices.descpage + devices.desc_used, c, len);
1029 devices.desc_used += len;
1030 1064
1031 /* Update the device descriptor length: two byte head then data. */ 1065 /* p might not be aligned, so we memcpy in. */
1032 dev->desc->config_len += 2 + len; 1066 return memcpy(p, &d, sizeof(d));
1033} 1067}
1034 1068
1035/* This routine adds a virtqueue to a device. We specify how many descriptors 1069/* Each device descriptor is followed by the description of its virtqueues. We
1036 * the virtqueue is to have. */ 1070 * specify how many descriptors the virtqueue is to have. */
1037static void add_virtqueue(struct device *dev, unsigned int num_descs, 1071static void add_virtqueue(struct device *dev, unsigned int num_descs,
1038 void (*handle_output)(int fd, struct virtqueue *me)) 1072 void (*handle_output)(int fd, struct virtqueue *me))
1039{ 1073{
@@ -1059,9 +1093,15 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1059 /* Initialize the vring. */ 1093 /* Initialize the vring. */
1060 vring_init(&vq->vring, num_descs, p, getpagesize()); 1094 vring_init(&vq->vring, num_descs, p, getpagesize());
1061 1095
1062 /* Add the configuration information to this device's descriptor. */ 1096 /* Append virtqueue to this device's descriptor. We use
1063 add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE, 1097 * device_config() to get the end of the device's current virtqueues;
1064 sizeof(vq->config), &vq->config); 1098 * we check that we haven't added any config or feature information
1099 * yet, otherwise we'd be overwriting them. */
1100 assert(dev->desc->config_len == 0 && dev->desc->feature_len == 0);
1101 memcpy(device_config(dev), &vq->config, sizeof(vq->config));
1102 dev->desc->num_vq++;
1103
1104 verbose("Virtqueue page %#lx\n", to_guest_phys(p));
1065 1105
1066 /* Add to tail of list, so dev->vq is first vq, dev->vq->next is 1106 /* Add to tail of list, so dev->vq is first vq, dev->vq->next is
1067 * second. */ 1107 * second. */
@@ -1072,11 +1112,41 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1072 * virtqueue. */ 1112 * virtqueue. */
1073 vq->handle_output = handle_output; 1113 vq->handle_output = handle_output;
1074 1114
1075 /* Set the "Don't Notify Me" flag if we don't have a handler */ 1115 /* As an optimization, set the advisory "Don't Notify Me" flag if we
1116 * don't have a handler */
1076 if (!handle_output) 1117 if (!handle_output)
1077 vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; 1118 vq->vring.used->flags = VRING_USED_F_NO_NOTIFY;
1078} 1119}
1079 1120
1121/* The first half of the feature bitmask is for us to advertise features. The
1122 * second half if for the Guest to accept features. */
1123static void add_feature(struct device *dev, unsigned bit)
1124{
1125 u8 *features = get_feature_bits(dev);
1126
1127 /* We can't extend the feature bits once we've added config bytes */
1128 if (dev->desc->feature_len <= bit / CHAR_BIT) {
1129 assert(dev->desc->config_len == 0);
1130 dev->desc->feature_len = (bit / CHAR_BIT) + 1;
1131 }
1132
1133 features[bit / CHAR_BIT] |= (1 << (bit % CHAR_BIT));
1134}
1135
1136/* This routine sets the configuration fields for an existing device's
1137 * descriptor. It only works for the last device, but that's OK because that's
1138 * how we use it. */
1139static void set_config(struct device *dev, unsigned len, const void *conf)
1140{
1141 /* Check we haven't overflowed our single page. */
1142 if (device_config(dev) + len > devices.descpage + getpagesize())
1143 errx(1, "Too many devices");
1144
1145 /* Copy in the config information, and store the length. */
1146 memcpy(device_config(dev), conf, len);
1147 dev->desc->config_len = len;
1148}
1149
1080/* This routine does all the creation and setup of a new device, including 1150/* This routine does all the creation and setup of a new device, including
1081 * calling new_dev_desc() to allocate the descriptor and device memory. */ 1151 * calling new_dev_desc() to allocate the descriptor and device memory. */
1082static struct device *new_device(const char *name, u16 type, int fd, 1152static struct device *new_device(const char *name, u16 type, int fd,
@@ -1084,14 +1154,6 @@ static struct device *new_device(const char *name, u16 type, int fd,
1084{ 1154{
1085 struct device *dev = malloc(sizeof(*dev)); 1155 struct device *dev = malloc(sizeof(*dev));
1086 1156
1087 /* Append to device list. Prepending to a single-linked list is
1088 * easier, but the user expects the devices to be arranged on the bus
1089 * in command-line order. The first network device on the command line
1090 * is eth0, the first block device /dev/vda, etc. */
1091 *devices.lastdev = dev;
1092 dev->next = NULL;
1093 devices.lastdev = &dev->next;
1094
1095 /* Now we populate the fields one at a time. */ 1157 /* Now we populate the fields one at a time. */
1096 dev->fd = fd; 1158 dev->fd = fd;
1097 /* If we have an input handler for this file descriptor, then we add it 1159 /* If we have an input handler for this file descriptor, then we add it
@@ -1102,6 +1164,17 @@ static struct device *new_device(const char *name, u16 type, int fd,
1102 dev->handle_input = handle_input; 1164 dev->handle_input = handle_input;
1103 dev->name = name; 1165 dev->name = name;
1104 dev->vq = NULL; 1166 dev->vq = NULL;
1167
1168 /* Append to device list. Prepending to a single-linked list is
1169 * easier, but the user expects the devices to be arranged on the bus
1170 * in command-line order. The first network device on the command line
1171 * is eth0, the first block device /dev/vda, etc. */
1172 if (devices.lastdev)
1173 devices.lastdev->next = dev;
1174 else
1175 devices.dev = dev;
1176 devices.lastdev = dev;
1177
1105 return dev; 1178 return dev;
1106} 1179}
1107 1180
@@ -1226,7 +1299,7 @@ static void setup_tun_net(const char *arg)
1226 int netfd, ipfd; 1299 int netfd, ipfd;
1227 u32 ip; 1300 u32 ip;
1228 const char *br_name = NULL; 1301 const char *br_name = NULL;
1229 u8 hwaddr[6]; 1302 struct virtio_net_config conf;
1230 1303
1231 /* We open the /dev/net/tun device and tell it we want a tap device. A 1304 /* We open the /dev/net/tun device and tell it we want a tap device. A
1232 * tap device is like a tun device, only somehow different. To tell 1305 * tap device is like a tun device, only somehow different. To tell
@@ -1265,12 +1338,13 @@ static void setup_tun_net(const char *arg)
1265 ip = str2ip(arg); 1338 ip = str2ip(arg);
1266 1339
1267 /* Set up the tun device, and get the mac address for the interface. */ 1340 /* Set up the tun device, and get the mac address for the interface. */
1268 configure_device(ipfd, ifr.ifr_name, ip, hwaddr); 1341 configure_device(ipfd, ifr.ifr_name, ip, conf.mac);
1269 1342
1270 /* Tell Guest what MAC address to use. */ 1343 /* Tell Guest what MAC address to use. */
1271 add_desc_field(dev, VIRTIO_CONFIG_NET_MAC_F, sizeof(hwaddr), hwaddr); 1344 add_feature(dev, VIRTIO_NET_F_MAC);
1345 set_config(dev, sizeof(conf), &conf);
1272 1346
1273 /* We don't seed the socket any more; setup is done. */ 1347 /* We don't need the socket any more; setup is done. */
1274 close(ipfd); 1348 close(ipfd);
1275 1349
1276 verbose("device %u: tun net %u.%u.%u.%u\n", 1350 verbose("device %u: tun net %u.%u.%u.%u\n",
@@ -1458,8 +1532,7 @@ static void setup_block_file(const char *filename)
1458 struct device *dev; 1532 struct device *dev;
1459 struct vblk_info *vblk; 1533 struct vblk_info *vblk;
1460 void *stack; 1534 void *stack;
1461 u64 cap; 1535 struct virtio_blk_config conf;
1462 unsigned int val;
1463 1536
1464 /* This is the pipe the I/O thread will use to tell us I/O is done. */ 1537 /* This is the pipe the I/O thread will use to tell us I/O is done. */
1465 pipe(p); 1538 pipe(p);
@@ -1477,14 +1550,18 @@ static void setup_block_file(const char *filename)
1477 vblk->fd = open_or_die(filename, O_RDWR|O_LARGEFILE); 1550 vblk->fd = open_or_die(filename, O_RDWR|O_LARGEFILE);
1478 vblk->len = lseek64(vblk->fd, 0, SEEK_END); 1551 vblk->len = lseek64(vblk->fd, 0, SEEK_END);
1479 1552
1553 /* We support barriers. */
1554 add_feature(dev, VIRTIO_BLK_F_BARRIER);
1555
1480 /* Tell Guest how many sectors this device has. */ 1556 /* Tell Guest how many sectors this device has. */
1481 cap = cpu_to_le64(vblk->len / 512); 1557 conf.capacity = cpu_to_le64(vblk->len / 512);
1482 add_desc_field(dev, VIRTIO_CONFIG_BLK_F_CAPACITY, sizeof(cap), &cap);
1483 1558
1484 /* Tell Guest not to put in too many descriptors at once: two are used 1559 /* Tell Guest not to put in too many descriptors at once: two are used
1485 * for the in and out elements. */ 1560 * for the in and out elements. */
1486 val = cpu_to_le32(VIRTQUEUE_NUM - 2); 1561 add_feature(dev, VIRTIO_BLK_F_SEG_MAX);
1487 add_desc_field(dev, VIRTIO_CONFIG_BLK_F_SEG_MAX, sizeof(val), &val); 1562 conf.seg_max = cpu_to_le32(VIRTQUEUE_NUM - 2);
1563
1564 set_config(dev, sizeof(conf), &conf);
1488 1565
1489 /* The I/O thread writes to this end of the pipe when done. */ 1566 /* The I/O thread writes to this end of the pipe when done. */
1490 vblk->done_fd = p[1]; 1567 vblk->done_fd = p[1];
@@ -1505,7 +1582,7 @@ static void setup_block_file(const char *filename)
1505 close(vblk->workpipe[0]); 1582 close(vblk->workpipe[0]);
1506 1583
1507 verbose("device %u: virtblock %llu sectors\n", 1584 verbose("device %u: virtblock %llu sectors\n",
1508 devices.device_num, cap); 1585 devices.device_num, le64_to_cpu(conf.capacity));
1509} 1586}
1510/* That's the end of device setup. :*/ 1587/* That's the end of device setup. :*/
1511 1588
@@ -1610,12 +1687,12 @@ int main(int argc, char *argv[])
1610 /* First we initialize the device list. Since console and network 1687 /* First we initialize the device list. Since console and network
1611 * device receive input from a file descriptor, we keep an fdset 1688 * device receive input from a file descriptor, we keep an fdset
1612 * (infds) and the maximum fd number (max_infd) with the head of the 1689 * (infds) and the maximum fd number (max_infd) with the head of the
1613 * list. We also keep a pointer to the last device, for easy appending 1690 * list. We also keep a pointer to the last device. Finally, we keep
1614 * to the list. Finally, we keep the next interrupt number to hand out 1691 * the next interrupt number to hand out (1: remember that 0 is used by
1615 * (1: remember that 0 is used by the timer). */ 1692 * the timer). */
1616 FD_ZERO(&devices.infds); 1693 FD_ZERO(&devices.infds);
1617 devices.max_infd = -1; 1694 devices.max_infd = -1;
1618 devices.lastdev = &devices.dev; 1695 devices.lastdev = NULL;
1619 devices.next_irq = 1; 1696 devices.next_irq = 1;
1620 1697
1621 cpu_id = 0; 1698 cpu_id = 0;
diff --git a/Documentation/md.txt b/Documentation/md.txt
index 5818628207b5..396cdd982c26 100644
--- a/Documentation/md.txt
+++ b/Documentation/md.txt
@@ -416,6 +416,16 @@ also have
416 sectors in total that could need to be processed. The two 416 sectors in total that could need to be processed. The two
417 numbers are separated by a '/' thus effectively showing one 417 numbers are separated by a '/' thus effectively showing one
418 value, a fraction of the process that is complete. 418 value, a fraction of the process that is complete.
419 A 'select' on this attribute will return when resync completes,
420 when it reaches the current sync_max (below) and possibly at
421 other times.
422
423 sync_max
424 This is a number of sectors at which point a resync/recovery
425 process will pause. When a resync is active, the value can
426 only ever be increased, never decreased. The value of 'max'
427 effectively disables the limit.
428
419 429
420 sync_speed 430 sync_speed
421 This shows the current actual speed, in K/sec, of the current 431 This shows the current actual speed, in K/sec, of the current
diff --git a/Documentation/networking/decnet.txt b/Documentation/networking/decnet.txt
index badb7480ea62..d8968958d839 100644
--- a/Documentation/networking/decnet.txt
+++ b/Documentation/networking/decnet.txt
@@ -60,7 +60,7 @@ operation of the local communications in any other way though.
60 60
61The kernel command line takes options looking like the following: 61The kernel command line takes options looking like the following:
62 62
63 decnet=1,2 63 decnet.addr=1,2
64 64
65the two numbers are the node address 1,2 = 1.2 For 2.2.xx kernels 65the two numbers are the node address 1,2 = 1.2 For 2.2.xx kernels
66and early 2.3.xx kernels, you must use a comma when specifying the 66and early 2.3.xx kernels, you must use a comma when specifying the
diff --git a/Documentation/pci.txt b/Documentation/pci.txt
index 7754f5aea4e9..72b20c639596 100644
--- a/Documentation/pci.txt
+++ b/Documentation/pci.txt
@@ -274,8 +274,6 @@ the PCI device by calling pci_enable_device(). This will:
274 o allocate an IRQ (if BIOS did not). 274 o allocate an IRQ (if BIOS did not).
275 275
276NOTE: pci_enable_device() can fail! Check the return value. 276NOTE: pci_enable_device() can fail! Check the return value.
277NOTE2: Also see pci_enable_device_bars() below. Drivers can
278 attempt to enable only a subset of BARs they need.
279 277
280[ OS BUG: we don't check resource allocations before enabling those 278[ OS BUG: we don't check resource allocations before enabling those
281 resources. The sequence would make more sense if we called 279 resources. The sequence would make more sense if we called
@@ -605,40 +603,7 @@ device lists. This is still possible but discouraged.
605 603
606 604
607 605
60810. pci_enable_device_bars() and Legacy I/O Port space 60610. MMIO Space and "Write Posting"
609~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
610
611Large servers may not be able to provide I/O port resources to all PCI
612devices. I/O Port space is only 64KB on Intel Architecture[1] and is
613likely also fragmented since the I/O base register of PCI-to-PCI
614bridge will usually be aligned to a 4KB boundary[2]. On such systems,
615pci_enable_device() and pci_request_region() will fail when
616attempting to enable I/O Port regions that don't have I/O Port
617resources assigned.
618
619Fortunately, many PCI devices which request I/O Port resources also
620provide access to the same registers via MMIO BARs. These devices can
621be handled without using I/O port space and the drivers typically
622offer a CONFIG_ option to only use MMIO regions
623(e.g. CONFIG_TULIP_MMIO). PCI devices typically provide I/O port
624interface for legacy OSes and will work when I/O port resources are not
625assigned. The "PCI Local Bus Specification Revision 3.0" discusses
626this on p.44, "IMPLEMENTATION NOTE".
627
628If your PCI device driver doesn't need I/O port resources assigned to
629I/O Port BARs, you should use pci_enable_device_bars() instead of
630pci_enable_device() in order not to enable I/O port regions for the
631corresponding devices. In addition, you should use
632pci_request_selected_regions() and pci_release_selected_regions()
633instead of pci_request_regions()/pci_release_regions() in order not to
634request/release I/O port regions for the corresponding devices.
635
636[1] Some systems support 64KB I/O port space per PCI segment.
637[2] Some PCI-to-PCI bridges support optional 1KB aligned I/O base.
638
639
640
64111. MMIO Space and "Write Posting"
642~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 607~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
643 608
644Converting a driver from using I/O Port space to using MMIO space 609Converting a driver from using I/O Port space to using MMIO space
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt
index 4739c5c3face..96f155e68750 100644
--- a/Documentation/pcmcia/driver-changes.txt
+++ b/Documentation/pcmcia/driver-changes.txt
@@ -33,8 +33,8 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
33 and can be used (e.g. for SET_NETDEV_DEV) by using 33 and can be used (e.g. for SET_NETDEV_DEV) by using
34 handle_to_dev(client_handle_t * handle). 34 handle_to_dev(client_handle_t * handle).
35 35
36* Convert internal I/O port addresses to unsigned long (as of 2.6.11) 36* Convert internal I/O port addresses to unsigned int (as of 2.6.11)
37 ioaddr_t should be replaced by kio_addr_t in PCMCIA card drivers. 37 ioaddr_t should be replaced by unsigned int in PCMCIA card drivers.
38 38
39* irq_mask and irq_list parameters (as of 2.6.11) 39* irq_mask and irq_list parameters (as of 2.6.11)
40 The irq_mask and irq_list parameters should no longer be used in 40 The irq_mask and irq_list parameters should no longer be used in
diff --git a/Documentation/pm_qos_interface.txt b/Documentation/pm_qos_interface.txt
new file mode 100644
index 000000000000..49adb1a33514
--- /dev/null
+++ b/Documentation/pm_qos_interface.txt
@@ -0,0 +1,59 @@
1PM quality of Service interface.
2
3This interface provides a kernel and user mode interface for registering
4performance expectations by drivers, subsystems and user space applications on
5one of the parameters.
6
7Currently we have {cpu_dma_latency, network_latency, network_throughput} as the
8initial set of pm_qos parameters.
9
10The infrastructure exposes multiple misc device nodes one per implemented
11parameter. The set of parameters implement is defined by pm_qos_power_init()
12and pm_qos_params.h. This is done because having the available parameters
13being runtime configurable or changeable from a driver was seen as too easy to
14abuse.
15
16For each parameter a list of performance requirements is maintained along with
17an aggregated target value. The aggregated target value is updated with
18changes to the requirement list or elements of the list. Typically the
19aggregated target value is simply the max or min of the requirement values held
20in the parameter list elements.
21
22From kernel mode the use of this interface is simple:
23pm_qos_add_requirement(param_id, name, target_value):
24Will insert a named element in the list for that identified PM_QOS parameter
25with the target value. Upon change to this list the new target is recomputed
26and any registered notifiers are called only if the target value is now
27different.
28
29pm_qos_update_requirement(param_id, name, new_target_value):
30Will search the list identified by the param_id for the named list element and
31then update its target value, calling the notification tree if the aggregated
32target is changed. with that name is already registered.
33
34pm_qos_remove_requirement(param_id, name):
35Will search the identified list for the named element and remove it, after
36removal it will update the aggregate target and call the notification tree if
37the target was changed as a result of removing the named requirement.
38
39
40From user mode:
41Only processes can register a pm_qos requirement. To provide for automatic
42cleanup for process the interface requires the process to register its
43parameter requirements in the following way:
44
45To register the default pm_qos target for the specific parameter, the process
46must open one of /dev/[cpu_dma_latency, network_latency, network_throughput]
47
48As long as the device node is held open that process has a registered
49requirement on the parameter. The name of the requirement is "process_<PID>"
50derived from the current->pid from within the open system call.
51
52To change the requested target value the process needs to write a s32 value to
53the open device node. This translates to a pm_qos_update_requirement call.
54
55To remove the user mode request for a target value simply close the device
56node.
57
58
59
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt
index 57aef2f6e0de..1555001bc733 100644
--- a/Documentation/power/basic-pm-debugging.txt
+++ b/Documentation/power/basic-pm-debugging.txt
@@ -1,45 +1,111 @@
1Debugging suspend and resume 1Debugging hibernation and suspend
2 (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL 2 (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL
3 3
41. Testing suspend to disk (STD) 41. Testing hibernation (aka suspend to disk or STD)
5 5
6To verify that the STD works, you can try to suspend in the "reboot" mode: 6To check if hibernation works, you can try to hibernate in the "reboot" mode:
7 7
8# echo reboot > /sys/power/disk 8# echo reboot > /sys/power/disk
9# echo disk > /sys/power/state 9# echo disk > /sys/power/state
10 10
11and the system should suspend, reboot, resume and get back to the command prompt 11and the system should create a hibernation image, reboot, resume and get back to
12where you have started the transition. If that happens, the STD is most likely 12the command prompt where you have started the transition. If that happens,
13to work correctly, but you need to repeat the test at least a couple of times in 13hibernation is most likely to work correctly. Still, you need to repeat the
14a row for confidence. This is necessary, because some problems only show up on 14test at least a couple of times in a row for confidence. [This is necessary,
15a second attempt at suspending and resuming the system. You should also test 15because some problems only show up on a second attempt at suspending and
16the "platform" and "shutdown" modes of suspend: 16resuming the system.] Moreover, hibernating in the "reboot" and "shutdown"
17modes causes the PM core to skip some platform-related callbacks which on ACPI
18systems might be necessary to make hibernation work. Thus, if you machine fails
19to hibernate or resume in the "reboot" mode, you should try the "platform" mode:
17 20
18# echo platform > /sys/power/disk 21# echo platform > /sys/power/disk
19# echo disk > /sys/power/state 22# echo disk > /sys/power/state
20 23
21or 24which is the default and recommended mode of hibernation.
25
26Unfortunately, the "platform" mode of hibernation does not work on some systems
27with broken BIOSes. In such cases the "shutdown" mode of hibernation might
28work:
22 29
23# echo shutdown > /sys/power/disk 30# echo shutdown > /sys/power/disk
24# echo disk > /sys/power/state 31# echo disk > /sys/power/state
25 32
26in which cases you will have to press the power button to make the system 33(it is similar to the "reboot" mode, but it requires you to press the power
27resume. If that does not work, you will need to identify what goes wrong. 34button to make the system resume).
35
36If neither "platform" nor "shutdown" hibernation mode works, you will need to
37identify what goes wrong.
38
39a) Test modes of hibernation
40
41To find out why hibernation fails on your system, you can use a special testing
42facility available if the kernel is compiled with CONFIG_PM_DEBUG set. Then,
43there is the file /sys/power/pm_test that can be used to make the hibernation
44core run in a test mode. There are 5 test modes available:
45
46freezer
47- test the freezing of processes
48
49devices
50- test the freezing of processes and suspending of devices
28 51
29a) Test mode of STD 52platform
53- test the freezing of processes, suspending of devices and platform
54 global control methods(*)
30 55
31To verify if there are any drivers that cause problems you can run the STD 56processors
32in the test mode: 57- test the freezing of processes, suspending of devices, platform
58 global control methods(*) and the disabling of nonboot CPUs
33 59
34# echo test > /sys/power/disk 60core
61- test the freezing of processes, suspending of devices, platform global
62 control methods(*), the disabling of nonboot CPUs and suspending of
63 platform/system devices
64
65(*) the platform global control methods are only available on ACPI systems
66 and are only tested if the hibernation mode is set to "platform"
67
68To use one of them it is necessary to write the corresponding string to
69/sys/power/pm_test (eg. "devices" to test the freezing of processes and
70suspending devices) and issue the standard hibernation commands. For example,
71to use the "devices" test mode along with the "platform" mode of hibernation,
72you should do the following:
73
74# echo devices > /sys/power/pm_test
75# echo platform > /sys/power/disk
35# echo disk > /sys/power/state 76# echo disk > /sys/power/state
36 77
37in which case the system should freeze tasks, suspend devices, disable nonboot 78Then, the kernel will try to freeze processes, suspend devices, wait 5 seconds,
38CPUs (if any), wait for 5 seconds, enable nonboot CPUs, resume devices, thaw 79resume devices and thaw processes. If "platform" is written to
39tasks and return to your command prompt. If that fails, most likely there is 80/sys/power/pm_test , then after suspending devices the kernel will additionally
40a driver that fails to either suspend or resume (in the latter case the system 81invoke the global control methods (eg. ACPI global control methods) used to
41may hang or be unstable after the test, so please take that into consideration). 82prepare the platform firmware for hibernation. Next, it will wait 5 seconds and
42To find this driver, you can carry out a binary search according to the rules: 83invoke the platform (eg. ACPI) global methods used to cancel hibernation etc.
84
85Writing "none" to /sys/power/pm_test causes the kernel to switch to the normal
86hibernation/suspend operations. Also, when open for reading, /sys/power/pm_test
87contains a space-separated list of all available tests (including "none" that
88represents the normal functionality) in which the current test level is
89indicated by square brackets.
90
91Generally, as you can see, each test level is more "invasive" than the previous
92one and the "core" level tests the hardware and drivers as deeply as possible
93without creating a hibernation image. Obviously, if the "devices" test fails,
94the "platform" test will fail as well and so on. Thus, as a rule of thumb, you
95should try the test modes starting from "freezer", through "devices", "platform"
96and "processors" up to "core" (repeat the test on each level a couple of times
97to make sure that any random factors are avoided).
98
99If the "freezer" test fails, there is a task that cannot be frozen (in that case
100it usually is possible to identify the offending task by analysing the output of
101dmesg obtained after the failing test). Failure at this level usually means
102that there is a problem with the tasks freezer subsystem that should be
103reported.
104
105If the "devices" test fails, most likely there is a driver that cannot suspend
106or resume its device (in the latter case the system may hang or become unstable
107after the test, so please take that into consideration). To find this driver,
108you can carry out a binary search according to the rules:
43- if the test fails, unload a half of the drivers currently loaded and repeat 109- if the test fails, unload a half of the drivers currently loaded and repeat
44(that would probably involve rebooting the system, so always note what drivers 110(that would probably involve rebooting the system, so always note what drivers
45have been loaded before the test), 111have been loaded before the test),
@@ -47,23 +113,46 @@ have been loaded before the test),
47recently and repeat. 113recently and repeat.
48 114
49Once you have found the failing driver (there can be more than just one of 115Once you have found the failing driver (there can be more than just one of
50them), you have to unload it every time before the STD transition. In that case 116them), you have to unload it every time before hibernation. In that case please
51please make sure to report the problem with the driver. 117make sure to report the problem with the driver.
52 118
53It is also possible that a cycle can still fail after you have unloaded 119It is also possible that the "devices" test will still fail after you have
54all modules. In that case, you would want to look in your kernel configuration 120unloaded all modules. In that case, you may want to look in your kernel
55for the drivers that can be compiled as modules (testing again with them as 121configuration for the drivers that can be compiled as modules (and test again
56modules), and possibly also try boot time options such as "noapic" or "noacpi". 122with these drivers compiled as modules). You may also try to use some special
123kernel command line options such as "noapic", "noacpi" or even "acpi=off".
124
125If the "platform" test fails, there is a problem with the handling of the
126platform (eg. ACPI) firmware on your system. In that case the "platform" mode
127of hibernation is not likely to work. You can try the "shutdown" mode, but that
128is rather a poor man's workaround.
129
130If the "processors" test fails, the disabling/enabling of nonboot CPUs does not
131work (of course, this only may be an issue on SMP systems) and the problem
132should be reported. In that case you can also try to switch the nonboot CPUs
133off and on using the /sys/devices/system/cpu/cpu*/online sysfs attributes and
134see if that works.
135
136If the "core" test fails, which means that suspending of the system/platform
137devices has failed (these devices are suspended on one CPU with interrupts off),
138the problem is most probably hardware-related and serious, so it should be
139reported.
140
141A failure of any of the "platform", "processors" or "core" tests may cause your
142system to hang or become unstable, so please beware. Such a failure usually
143indicates a serious problem that very well may be related to the hardware, but
144please report it anyway.
57 145
58b) Testing minimal configuration 146b) Testing minimal configuration
59 147
60If the test mode of STD works, you can boot the system with "init=/bin/bash" 148If all of the hibernation test modes work, you can boot the system with the
61and attempt to suspend in the "reboot", "shutdown" and "platform" modes. If 149"init=/bin/bash" command line parameter and attempt to hibernate in the
62that does not work, there probably is a problem with a driver statically 150"reboot", "shutdown" and "platform" modes. If that does not work, there
63compiled into the kernel and you can try to compile more drivers as modules, 151probably is a problem with a driver statically compiled into the kernel and you
64so that they can be tested individually. Otherwise, there is a problem with a 152can try to compile more drivers as modules, so that they can be tested
65modular driver and you can find it by loading a half of the modules you normally 153individually. Otherwise, there is a problem with a modular driver and you can
66use and binary searching in accordance with the algorithm: 154find it by loading a half of the modules you normally use and binary searching
155in accordance with the algorithm:
67- if there are n modules loaded and the attempt to suspend and resume fails, 156- if there are n modules loaded and the attempt to suspend and resume fails,
68unload n/2 of the modules and try again (that would probably involve rebooting 157unload n/2 of the modules and try again (that would probably involve rebooting
69the system), 158the system),
@@ -71,19 +160,19 @@ the system),
71load n/2 modules more and try again. 160load n/2 modules more and try again.
72 161
73Again, if you find the offending module(s), it(they) must be unloaded every time 162Again, if you find the offending module(s), it(they) must be unloaded every time
74before the STD transition, and please report the problem with it(them). 163before hibernation, and please report the problem with it(them).
75 164
76c) Advanced debugging 165c) Advanced debugging
77 166
78In case the STD does not work on your system even in the minimal configuration 167In case that hibernation does not work on your system even in the minimal
79and compiling more drivers as modules is not practical or some modules cannot 168configuration and compiling more drivers as modules is not practical or some
80be unloaded, you can use one of the more advanced debugging techniques to find 169modules cannot be unloaded, you can use one of the more advanced debugging
81the problem. First, if there is a serial port in your box, you can boot the 170techniques to find the problem. First, if there is a serial port in your box,
82kernel with the 'no_console_suspend' parameter and try to log kernel 171you can boot the kernel with the 'no_console_suspend' parameter and try to log
83messages using the serial console. This may provide you with some information 172kernel messages using the serial console. This may provide you with some
84about the reasons of the suspend (resume) failure. Alternatively, it may be 173information about the reasons of the suspend (resume) failure. Alternatively,
85possible to use a FireWire port for debugging with firescope 174it may be possible to use a FireWire port for debugging with firescope
86(ftp://ftp.firstfloor.org/pub/ak/firescope/). On i386 it is also possible to 175(ftp://ftp.firstfloor.org/pub/ak/firescope/). On x86 it is also possible to
87use the PM_TRACE mechanism documented in Documentation/s2ram.txt . 176use the PM_TRACE mechanism documented in Documentation/s2ram.txt .
88 177
892. Testing suspend to RAM (STR) 1782. Testing suspend to RAM (STR)
@@ -91,16 +180,25 @@ use the PM_TRACE mechanism documented in Documentation/s2ram.txt .
91To verify that the STR works, it is generally more convenient to use the s2ram 180To verify that the STR works, it is generally more convenient to use the s2ram
92tool available from http://suspend.sf.net and documented at 181tool available from http://suspend.sf.net and documented at
93http://en.opensuse.org/s2ram . However, before doing that it is recommended to 182http://en.opensuse.org/s2ram . However, before doing that it is recommended to
94carry out the procedure described in section 1. 183carry out STR testing using the facility described in section 1.
95 184
96Assume you have resolved the problems with the STD and you have found some 185Namely, after writing "freezer", "devices", "platform", "processors", or "core"
97failing drivers. These drivers are also likely to fail during the STR or 186into /sys/power/pm_test (available if the kernel is compiled with
98during the resume, so it is better to unload them every time before the STR 187CONFIG_PM_DEBUG set) the suspend code will work in the test mode corresponding
99transition. Now, you can follow the instructions at 188to given string. The STR test modes are defined in the same way as for
100http://en.opensuse.org/s2ram to test the system, but if it does not work 189hibernation, so please refer to Section 1 for more information about them. In
101"out of the box", you may need to boot it with "init=/bin/bash" and test 190particular, the "core" test allows you to test everything except for the actual
102s2ram in the minimal configuration. In that case, you may be able to search 191invocation of the platform firmware in order to put the system into the sleep
103for failing drivers by following the procedure analogous to the one described in 192state.
1041b). If you find some failing drivers, you will have to unload them every time 193
105before the STR transition (ie. before you run s2ram), and please report the 194Among other things, the testing with the help of /sys/power/pm_test may allow
106problems with them. 195you to identify drivers that fail to suspend or resume their devices. They
196should be unloaded every time before an STR transition.
197
198Next, you can follow the instructions at http://en.opensuse.org/s2ram to test
199the system, but if it does not work "out of the box", you may need to boot it
200with "init=/bin/bash" and test s2ram in the minimal configuration. In that
201case, you may be able to search for failing drivers by following the procedure
202analogous to the one described in section 1. If you find some failing drivers,
203you will have to unload them every time before an STR transition (ie. before
204you run s2ram), and please report the problems with them.
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt
index d0e79d5820a5..c53d26361919 100644
--- a/Documentation/power/devices.txt
+++ b/Documentation/power/devices.txt
@@ -502,52 +502,3 @@ If the CPU can have a "cpufreq" driver, there also may be opportunities
502to shift to lower voltage settings and reduce the power cost of executing 502to shift to lower voltage settings and reduce the power cost of executing
503a given number of instructions. (Without voltage adjustment, it's rare 503a given number of instructions. (Without voltage adjustment, it's rare
504for cpufreq to save much power; the cost-per-instruction must go down.) 504for cpufreq to save much power; the cost-per-instruction must go down.)
505
506
507/sys/devices/.../power/state files
508==================================
509For now you can also test some of this functionality using sysfs.
510
511 DEPRECATED: USE "power/state" ONLY FOR DRIVER TESTING, AND
512 AVOID USING dev->power.power_state IN DRIVERS.
513
514 THESE WILL BE REMOVED. IF THE "power/state" FILE GETS REPLACED,
515 IT WILL BECOME SOMETHING COUPLED TO THE BUS OR DRIVER.
516
517In each device's directory, there is a 'power' directory, which contains
518at least a 'state' file. The value of this field is effectively boolean,
519PM_EVENT_ON or PM_EVENT_SUSPEND.
520
521 * Reading from this file displays a value corresponding to
522 the power.power_state.event field. All nonzero values are
523 displayed as "2", corresponding to a low power state; zero
524 is displayed as "0", corresponding to normal operation.
525
526 * Writing to this file initiates a transition using the
527 specified event code number; only '0', '2', and '3' are
528 accepted (without a newline); '2' and '3' are both
529 mapped to PM_EVENT_SUSPEND.
530
531On writes, the PM core relies on that recorded event code and the device/bus
532capabilities to determine whether it uses a partial suspend() or resume()
533sequence to change things so that the recorded event corresponds to the
534numeric parameter.
535
536 - If the bus requires the irqs-disabled suspend_late()/resume_early()
537 phases, writes fail because those operations are not supported here.
538
539 - If the recorded value is the expected value, nothing is done.
540
541 - If the recorded value is nonzero, the device is partially resumed,
542 using the bus.resume() and/or class.resume() methods.
543
544 - If the target value is nonzero, the device is partially suspended,
545 using the class.suspend() and/or bus.suspend() methods and the
546 PM_EVENT_SUSPEND message.
547
548Drivers have no way to tell whether their suspend() and resume() calls
549have come through the sysfs power/state file or as part of entering a
550system sleep state, except that when accessed through sysfs the normal
551parent/child sequencing rules are ignored. Drivers (such as bus, bridge,
552or hub drivers) which expose child devices may need to enforce those rules
553on their own.
diff --git a/Documentation/power/drivers-testing.txt b/Documentation/power/drivers-testing.txt
index e4bdcaee24e4..7f7a737f7f9f 100644
--- a/Documentation/power/drivers-testing.txt
+++ b/Documentation/power/drivers-testing.txt
@@ -6,9 +6,9 @@ Testing suspend and resume support in device drivers
6Unfortunately, to effectively test the support for the system-wide suspend and 6Unfortunately, to effectively test the support for the system-wide suspend and
7resume transitions in a driver, it is necessary to suspend and resume a fully 7resume transitions in a driver, it is necessary to suspend and resume a fully
8functional system with this driver loaded. Moreover, that should be done 8functional system with this driver loaded. Moreover, that should be done
9several times, preferably several times in a row, and separately for the suspend 9several times, preferably several times in a row, and separately for hibernation
10to disk (STD) and the suspend to RAM (STR) transitions, because each of these 10(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
11cases involves different ordering of operations and different interactions with 11cases involves slightly different operations and different interactions with
12the machine's BIOS. 12the machine's BIOS.
13 13
14Of course, for this purpose the test system has to be known to suspend and 14Of course, for this purpose the test system has to be known to suspend and
@@ -22,20 +22,24 @@ for more information about the debugging of suspend/resume functionality.
22Once you have resolved the suspend/resume-related problems with your test system 22Once you have resolved the suspend/resume-related problems with your test system
23without the new driver, you are ready to test it: 23without the new driver, you are ready to test it:
24 24
25a) Build the driver as a module, load it and try the STD in the test mode (see: 25a) Build the driver as a module, load it and try the test modes of hibernation
26Documents/power/basic-pm-debugging.txt, 1a)). 26 (see: Documents/power/basic-pm-debugging.txt, 1).
27 27
28b) Load the driver and attempt to suspend to disk in the "reboot", "shutdown" 28b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and
29and "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). 29 "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1).
30 30
31c) Compile the driver directly into the kernel and try the STD in the test mode. 31c) Compile the driver directly into the kernel and try the test modes of
32 hibernation.
32 33
33d) Attempt to suspend to disk with the driver compiled directly into the kernel 34d) Attempt to hibernate with the driver compiled directly into the kernel
34in the "reboot", "shutdown" and "platform" modes. 35 in the "reboot", "shutdown" and "platform" modes.
35 36
36e) Attempt to suspend to RAM using the s2ram tool with the driver loaded (see: 37e) Try the test modes of suspend (see: Documents/power/basic-pm-debugging.txt,
37Documents/power/basic-pm-debugging.txt, 2). As far as the STR tests are 38 2). [As far as the STR tests are concerned, it should not matter whether or
38concerned, it should not matter whether or not the driver is built as a module. 39 not the driver is built as a module.]
40
41f) Attempt to suspend to RAM using the s2ram tool with the driver loaded
42 (see: Documents/power/basic-pm-debugging.txt, 2).
39 43
40Each of the above tests should be repeated several times and the STD tests 44Each of the above tests should be repeated several times and the STD tests
41should be mixed with the STR tests. If any of them fails, the driver cannot be 45should be mixed with the STR tests. If any of them fails, the driver cannot be
diff --git a/Documentation/power/notifiers.txt b/Documentation/power/notifiers.txt
index 9293e4bc857c..ae1b7ec07684 100644
--- a/Documentation/power/notifiers.txt
+++ b/Documentation/power/notifiers.txt
@@ -28,6 +28,14 @@ PM_POST_HIBERNATION The system memory state has been restored from a
28 hibernation. Device drivers' .resume() callbacks have 28 hibernation. Device drivers' .resume() callbacks have
29 been executed and tasks have been thawed. 29 been executed and tasks have been thawed.
30 30
31PM_RESTORE_PREPARE The system is going to restore a hibernation image.
32 If all goes well the restored kernel will issue a
33 PM_POST_HIBERNATION notification.
34
35PM_POST_RESTORE An error occurred during the hibernation restore.
36 Device drivers' .resume() callbacks have been executed
37 and tasks have been thawed.
38
31PM_SUSPEND_PREPARE The system is preparing for a suspend. 39PM_SUSPEND_PREPARE The system is preparing for a suspend.
32 40
33PM_POST_SUSPEND The system has just resumed or an error occured during 41PM_POST_SUSPEND The system has just resumed or an error occured during
diff --git a/Documentation/power/userland-swsusp.txt b/Documentation/power/userland-swsusp.txt
index e00c6cf09e85..7b99636564c8 100644
--- a/Documentation/power/userland-swsusp.txt
+++ b/Documentation/power/userland-swsusp.txt
@@ -14,7 +14,7 @@ are going to develop your own suspend/resume utilities.
14 14
15The interface consists of a character device providing the open(), 15The interface consists of a character device providing the open(),
16release(), read(), and write() operations as well as several ioctl() 16release(), read(), and write() operations as well as several ioctl()
17commands defined in kernel/power/power.h. The major and minor 17commands defined in include/linux/suspend_ioctls.h . The major and minor
18numbers of the device are, respectively, 10 and 231, and they can 18numbers of the device are, respectively, 10 and 231, and they can
19be read from /sys/class/misc/snapshot/dev. 19be read from /sys/class/misc/snapshot/dev.
20 20
@@ -27,17 +27,17 @@ once at a time.
27The ioctl() commands recognized by the device are: 27The ioctl() commands recognized by the device are:
28 28
29SNAPSHOT_FREEZE - freeze user space processes (the current process is 29SNAPSHOT_FREEZE - freeze user space processes (the current process is
30 not frozen); this is required for SNAPSHOT_ATOMIC_SNAPSHOT 30 not frozen); this is required for SNAPSHOT_CREATE_IMAGE
31 and SNAPSHOT_ATOMIC_RESTORE to succeed 31 and SNAPSHOT_ATOMIC_RESTORE to succeed
32 32
33SNAPSHOT_UNFREEZE - thaw user space processes frozen by SNAPSHOT_FREEZE 33SNAPSHOT_UNFREEZE - thaw user space processes frozen by SNAPSHOT_FREEZE
34 34
35SNAPSHOT_ATOMIC_SNAPSHOT - create a snapshot of the system memory; the 35SNAPSHOT_CREATE_IMAGE - create a snapshot of the system memory; the
36 last argument of ioctl() should be a pointer to an int variable, 36 last argument of ioctl() should be a pointer to an int variable,
37 the value of which will indicate whether the call returned after 37 the value of which will indicate whether the call returned after
38 creating the snapshot (1) or after restoring the system memory state 38 creating the snapshot (1) or after restoring the system memory state
39 from it (0) (after resume the system finds itself finishing the 39 from it (0) (after resume the system finds itself finishing the
40 SNAPSHOT_ATOMIC_SNAPSHOT ioctl() again); after the snapshot 40 SNAPSHOT_CREATE_IMAGE ioctl() again); after the snapshot
41 has been created the read() operation can be used to transfer 41 has been created the read() operation can be used to transfer
42 it out of the kernel 42 it out of the kernel
43 43
@@ -49,39 +49,37 @@ SNAPSHOT_ATOMIC_RESTORE - restore the system memory state from the
49 49
50SNAPSHOT_FREE - free memory allocated for the snapshot image 50SNAPSHOT_FREE - free memory allocated for the snapshot image
51 51
52SNAPSHOT_SET_IMAGE_SIZE - set the preferred maximum size of the image 52SNAPSHOT_PREF_IMAGE_SIZE - set the preferred maximum size of the image
53 (the kernel will do its best to ensure the image size will not exceed 53 (the kernel will do its best to ensure the image size will not exceed
54 this number, but if it turns out to be impossible, the kernel will 54 this number, but if it turns out to be impossible, the kernel will
55 create the smallest image possible) 55 create the smallest image possible)
56 56
57SNAPSHOT_AVAIL_SWAP - return the amount of available swap in bytes (the last 57SNAPSHOT_GET_IMAGE_SIZE - return the actual size of the hibernation image
58 argument should be a pointer to an unsigned int variable that will 58
59SNAPSHOT_AVAIL_SWAP_SIZE - return the amount of available swap in bytes (the
60 last argument should be a pointer to an unsigned int variable that will
59 contain the result if the call is successful). 61 contain the result if the call is successful).
60 62
61SNAPSHOT_GET_SWAP_PAGE - allocate a swap page from the resume partition 63SNAPSHOT_ALLOC_SWAP_PAGE - allocate a swap page from the resume partition
62 (the last argument should be a pointer to a loff_t variable that 64 (the last argument should be a pointer to a loff_t variable that
63 will contain the swap page offset if the call is successful) 65 will contain the swap page offset if the call is successful)
64 66
65SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated with 67SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated by
66 SNAPSHOT_GET_SWAP_PAGE 68 SNAPSHOT_ALLOC_SWAP_PAGE
67
68SNAPSHOT_SET_SWAP_FILE - set the resume partition (the last ioctl() argument
69 should specify the device's major and minor numbers in the old
70 two-byte format, as returned by the stat() function in the .st_rdev
71 member of the stat structure)
72 69
73SNAPSHOT_SET_SWAP_AREA - set the resume partition and the offset (in <PAGE_SIZE> 70SNAPSHOT_SET_SWAP_AREA - set the resume partition and the offset (in <PAGE_SIZE>
74 units) from the beginning of the partition at which the swap header is 71 units) from the beginning of the partition at which the swap header is
75 located (the last ioctl() argument should point to a struct 72 located (the last ioctl() argument should point to a struct
76 resume_swap_area, as defined in kernel/power/power.h, containing the 73 resume_swap_area, as defined in kernel/power/suspend_ioctls.h,
77 resume device specification, as for the SNAPSHOT_SET_SWAP_FILE ioctl(), 74 containing the resume device specification and the offset); for swap
78 and the offset); for swap partitions the offset is always 0, but it is 75 partitions the offset is always 0, but it is different from zero for
79 different to zero for swap files (please see 76 swap files (see Documentation/swsusp-and-swap-files.txt for details).
80 Documentation/swsusp-and-swap-files.txt for details). 77
81 The SNAPSHOT_SET_SWAP_AREA ioctl() is considered as a replacement for 78SNAPSHOT_PLATFORM_SUPPORT - enable/disable the hibernation platform support,
82 SNAPSHOT_SET_SWAP_FILE which is regarded as obsolete. It is 79 depending on the argument value (enable, if the argument is nonzero)
83 recommended to always use this call, because the code to set the resume 80
84 partition may be removed from future kernels 81SNAPSHOT_POWER_OFF - make the kernel transition the system to the hibernation
82 state (eg. ACPI S4) using the platform (eg. ACPI) driver
85 83
86SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to 84SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to
87 immediately enter the suspend-to-RAM state, so this call must always 85 immediately enter the suspend-to-RAM state, so this call must always
@@ -93,24 +91,6 @@ SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to
93 to resume the system from RAM if there's enough battery power or restore 91 to resume the system from RAM if there's enough battery power or restore
94 its state on the basis of the saved suspend image otherwise) 92 its state on the basis of the saved suspend image otherwise)
95 93
96SNAPSHOT_PMOPS - enable the usage of the hibernation_ops->prepare,
97 hibernate_ops->enter and hibernation_ops->finish methods (the in-kernel
98 swsusp knows these as the "platform method") which are needed on many
99 machines to (among others) speed up the resume by letting the BIOS skip
100 some steps or to let the system recognise the correct state of the
101 hardware after the resume (in particular on many machines this ensures
102 that unplugged AC adapters get correctly detected and that kacpid does
103 not run wild after the resume). The last ioctl() argument can take one
104 of the three values, defined in kernel/power/power.h:
105 PMOPS_PREPARE - make the kernel carry out the
106 hibernation_ops->prepare() operation
107 PMOPS_ENTER - make the kernel power off the system by calling
108 hibernation_ops->enter()
109 PMOPS_FINISH - make the kernel carry out the
110 hibernation_ops->finish() operation
111 Note that the actual constants are misnamed because they surface
112 internal kernel implementation details that have changed.
113
114The device's read() operation can be used to transfer the snapshot image from 94The device's read() operation can be used to transfer the snapshot image from
115the kernel. It has the following limitations: 95the kernel. It has the following limitations:
116- you cannot read() more than one virtual memory page at a time 96- you cannot read() more than one virtual memory page at a time
@@ -122,7 +102,7 @@ The device's write() operation is used for uploading the system memory snapshot
122into the kernel. It has the same limitations as the read() operation. 102into the kernel. It has the same limitations as the read() operation.
123 103
124The release() operation frees all memory allocated for the snapshot image 104The release() operation frees all memory allocated for the snapshot image
125and all swap pages allocated with SNAPSHOT_GET_SWAP_PAGE (if any). 105and all swap pages allocated with SNAPSHOT_ALLOC_SWAP_PAGE (if any).
126Thus it is not necessary to use either SNAPSHOT_FREE or 106Thus it is not necessary to use either SNAPSHOT_FREE or
127SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also 107SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also
128unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are 108unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are
@@ -133,16 +113,12 @@ snapshot image from/to the kernel will use a swap parition, called the resume
133partition, or a swap file as storage space (if a swap file is used, the resume 113partition, or a swap file as storage space (if a swap file is used, the resume
134partition is the partition that holds this file). However, this is not really 114partition is the partition that holds this file). However, this is not really
135required, as they can use, for example, a special (blank) suspend partition or 115required, as they can use, for example, a special (blank) suspend partition or
136a file on a partition that is unmounted before SNAPSHOT_ATOMIC_SNAPSHOT and 116a file on a partition that is unmounted before SNAPSHOT_CREATE_IMAGE and
137mounted afterwards. 117mounted afterwards.
138 118
139These utilities SHOULD NOT make any assumptions regarding the ordering of 119These utilities MUST NOT make any assumptions regarding the ordering of
140data within the snapshot image, except for the image header that MAY be 120data within the snapshot image. The contents of the image are entirely owned
141assumed to start with an swsusp_info structure, as specified in 121by the kernel and its structure may be changed in future kernel releases.
142kernel/power/power.h. This structure MAY be used by the userland utilities
143to obtain some information about the snapshot image, such as the size
144of the snapshot image, including the metadata and the header itself,
145contained in the .size member of swsusp_info.
146 122
147The snapshot image MUST be written to the kernel unaltered (ie. all of the image 123The snapshot image MUST be written to the kernel unaltered (ie. all of the image
148data, metadata and header MUST be written in _exactly_ the same amount, form 124data, metadata and header MUST be written in _exactly_ the same amount, form
@@ -159,7 +135,7 @@ means, such as checksums, to ensure the integrity of the snapshot image.
159The suspending and resuming utilities MUST lock themselves in memory, 135The suspending and resuming utilities MUST lock themselves in memory,
160preferrably using mlockall(), before calling SNAPSHOT_FREEZE. 136preferrably using mlockall(), before calling SNAPSHOT_FREEZE.
161 137
162The suspending utility MUST check the value stored by SNAPSHOT_ATOMIC_SNAPSHOT 138The suspending utility MUST check the value stored by SNAPSHOT_CREATE_IMAGE
163in the memory location pointed to by the last argument of ioctl() and proceed 139in the memory location pointed to by the last argument of ioctl() and proceed
164in accordance with it: 140in accordance with it:
1651. If the value is 1 (ie. the system memory snapshot has just been 1411. If the value is 1 (ie. the system memory snapshot has just been
@@ -173,7 +149,7 @@ in accordance with it:
173 image has been saved. 149 image has been saved.
174 (b) The suspending utility SHOULD NOT attempt to perform any 150 (b) The suspending utility SHOULD NOT attempt to perform any
175 file system operations (including reads) on the file systems 151 file system operations (including reads) on the file systems
176 that were mounted before SNAPSHOT_ATOMIC_SNAPSHOT has been 152 that were mounted before SNAPSHOT_CREATE_IMAGE has been
177 called. However, it MAY mount a file system that was not 153 called. However, it MAY mount a file system that was not
178 mounted at that time and perform some operations on it (eg. 154 mounted at that time and perform some operations on it (eg.
179 use it for saving the image). 155 use it for saving the image).
diff --git a/Documentation/power_supply_class.txt b/Documentation/power_supply_class.txt
index 9758cf433c06..a8686e5a6857 100644
--- a/Documentation/power_supply_class.txt
+++ b/Documentation/power_supply_class.txt
@@ -87,6 +87,10 @@ batteries use voltage for very approximated calculation of capacity.
87Battery driver also can use this attribute just to inform userspace 87Battery driver also can use this attribute just to inform userspace
88about maximal and minimal voltage thresholds of a given battery. 88about maximal and minimal voltage thresholds of a given battery.
89 89
90VOLTAGE_MAX, VOLTAGE_MIN - same as _DESIGN voltage values except that
91these ones should be used if hardware could only guess (measure and
92retain) the thresholds of a given power supply.
93
90CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when 94CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when
91battery considered full/empty. 95battery considered full/empty.
92 96
@@ -100,8 +104,6 @@ age)". I.e. these attributes represents real thresholds, not design values.
100ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. 104ENERGY_FULL, ENERGY_EMPTY - same as above but for energy.
101 105
102CAPACITY - capacity in percents. 106CAPACITY - capacity in percents.
103CAPACITY_LEVEL - capacity level. This corresponds to
104POWER_SUPPLY_CAPACITY_LEVEL_*.
105 107
106TEMP - temperature of the power supply. 108TEMP - temperature of the power supply.
107TEMP_AMBIENT - ambient temperature. 109TEMP_AMBIENT - ambient temperature.
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt
index e20b19c1b60d..8deffcd68cb8 100644
--- a/Documentation/rtc.txt
+++ b/Documentation/rtc.txt
@@ -182,8 +182,8 @@ driver returns ENOIOCTLCMD. Some common examples:
182 since the frequency is stored in the irq_freq member of the rtc_device 182 since the frequency is stored in the irq_freq member of the rtc_device
183 structure. Your driver needs to initialize the irq_freq member during 183 structure. Your driver needs to initialize the irq_freq member during
184 init. Make sure you check the requested frequency is in range of your 184 init. Make sure you check the requested frequency is in range of your
185 hardware in the irq_set_freq function. If you cannot actually change 185 hardware in the irq_set_freq function. If it isn't, return -EINVAL. If
186 the frequency, just return -ENOTTY. 186 you cannot actually change the frequency, do not define irq_set_freq.
187 187
188If all else fails, check out the rtc-test.c driver! 188If all else fails, check out the rtc-test.c driver!
189 189
@@ -268,8 +268,8 @@ int main(int argc, char **argv)
268 /* This read will block */ 268 /* This read will block */
269 retval = read(fd, &data, sizeof(unsigned long)); 269 retval = read(fd, &data, sizeof(unsigned long));
270 if (retval == -1) { 270 if (retval == -1) {
271 perror("read"); 271 perror("read");
272 exit(errno); 272 exit(errno);
273 } 273 }
274 fprintf(stderr, " %d",i); 274 fprintf(stderr, " %d",i);
275 fflush(stderr); 275 fflush(stderr);
@@ -326,11 +326,11 @@ test_READ:
326 rtc_tm.tm_sec %= 60; 326 rtc_tm.tm_sec %= 60;
327 rtc_tm.tm_min++; 327 rtc_tm.tm_min++;
328 } 328 }
329 if (rtc_tm.tm_min == 60) { 329 if (rtc_tm.tm_min == 60) {
330 rtc_tm.tm_min = 0; 330 rtc_tm.tm_min = 0;
331 rtc_tm.tm_hour++; 331 rtc_tm.tm_hour++;
332 } 332 }
333 if (rtc_tm.tm_hour == 24) 333 if (rtc_tm.tm_hour == 24)
334 rtc_tm.tm_hour = 0; 334 rtc_tm.tm_hour = 0;
335 335
336 retval = ioctl(fd, RTC_ALM_SET, &rtc_tm); 336 retval = ioctl(fd, RTC_ALM_SET, &rtc_tm);
@@ -407,8 +407,8 @@ test_PIE:
407 "\n...Periodic IRQ rate is fixed\n"); 407 "\n...Periodic IRQ rate is fixed\n");
408 goto done; 408 goto done;
409 } 409 }
410 perror("RTC_IRQP_SET ioctl"); 410 perror("RTC_IRQP_SET ioctl");
411 exit(errno); 411 exit(errno);
412 } 412 }
413 413
414 fprintf(stderr, "\n%ldHz:\t", tmp); 414 fprintf(stderr, "\n%ldHz:\t", tmp);
@@ -417,27 +417,27 @@ test_PIE:
417 /* Enable periodic interrupts */ 417 /* Enable periodic interrupts */
418 retval = ioctl(fd, RTC_PIE_ON, 0); 418 retval = ioctl(fd, RTC_PIE_ON, 0);
419 if (retval == -1) { 419 if (retval == -1) {
420 perror("RTC_PIE_ON ioctl"); 420 perror("RTC_PIE_ON ioctl");
421 exit(errno); 421 exit(errno);
422 } 422 }
423 423
424 for (i=1; i<21; i++) { 424 for (i=1; i<21; i++) {
425 /* This blocks */ 425 /* This blocks */
426 retval = read(fd, &data, sizeof(unsigned long)); 426 retval = read(fd, &data, sizeof(unsigned long));
427 if (retval == -1) { 427 if (retval == -1) {
428 perror("read"); 428 perror("read");
429 exit(errno); 429 exit(errno);
430 } 430 }
431 fprintf(stderr, " %d",i); 431 fprintf(stderr, " %d",i);
432 fflush(stderr); 432 fflush(stderr);
433 irqcount++; 433 irqcount++;
434 } 434 }
435 435
436 /* Disable periodic interrupts */ 436 /* Disable periodic interrupts */
437 retval = ioctl(fd, RTC_PIE_OFF, 0); 437 retval = ioctl(fd, RTC_PIE_OFF, 0);
438 if (retval == -1) { 438 if (retval == -1) {
439 perror("RTC_PIE_OFF ioctl"); 439 perror("RTC_PIE_OFF ioctl");
440 exit(errno); 440 exit(errno);
441 } 441 }
442 } 442 }
443 443
diff --git a/Documentation/smp.txt b/Documentation/smp.txt
deleted file mode 100644
index 82fc50b6305d..000000000000
--- a/Documentation/smp.txt
+++ /dev/null
@@ -1,22 +0,0 @@
1To set up SMP
2
3Configure the kernel and answer Y to CONFIG_SMP.
4
5If you are using LILO, it is handy to have both SMP and non-SMP
6kernel images on hand. Edit /etc/lilo.conf to create an entry
7for another kernel image called "linux-smp" or something.
8
9The next time you compile the kernel, when running a SMP kernel,
10edit linux/Makefile and change "MAKE=make" to "MAKE=make -jN"
11(where N = number of CPU + 1, or if you have tons of memory/swap
12 you can just use "-j" without a number). Feel free to experiment
13with this one.
14
15Of course you should time how long each build takes :-)
16Example:
17 make config
18 time -v sh -c 'make clean install modules modules_install'
19
20If you are using some Compaq MP compliant machines you will need to set
21the operating system in the BIOS settings to "Unixware" - don't ask me
22why Compaqs don't work otherwise.
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index aa986a35e994..f99254327ae5 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -23,6 +23,7 @@ Currently, these files are in /proc/sys/fs:
23- inode-max 23- inode-max
24- inode-nr 24- inode-nr
25- inode-state 25- inode-state
26- nr_open
26- overflowuid 27- overflowuid
27- overflowgid 28- overflowgid
28- suid_dumpable 29- suid_dumpable
@@ -91,6 +92,15 @@ usage of file handles and you don't need to increase the maximum.
91 92
92============================================================== 93==============================================================
93 94
95nr_open:
96
97This denotes the maximum number of file-handles a process can
98allocate. Default value is 1024*1024 (1048576) which should be
99enough for most machines. Actual limit depends on RLIMIT_NOFILE
100resource limit.
101
102==============================================================
103
94inode-max, inode-nr & inode-state: 104inode-max, inode-nr & inode-state:
95 105
96As with file handles, the kernel allocates the inode structures 106As with file handles, the kernel allocates the inode structures
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 6f31f0a247d0..24eac1bc735d 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -22,6 +22,7 @@ Currently, these files are in /proc/sys/vm:
22- dirty_background_ratio 22- dirty_background_ratio
23- dirty_expire_centisecs 23- dirty_expire_centisecs
24- dirty_writeback_centisecs 24- dirty_writeback_centisecs
25- highmem_is_dirtyable (only if CONFIG_HIGHMEM set)
25- max_map_count 26- max_map_count
26- min_free_kbytes 27- min_free_kbytes
27- laptop_mode 28- laptop_mode
@@ -40,9 +41,9 @@ Currently, these files are in /proc/sys/vm:
40============================================================== 41==============================================================
41 42
42dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, 43dirty_ratio, dirty_background_ratio, dirty_expire_centisecs,
43dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode, 44dirty_writeback_centisecs, highmem_is_dirtyable,
44block_dump, swap_token_timeout, drop-caches, 45vfs_cache_pressure, laptop_mode, block_dump, swap_token_timeout,
45hugepages_treat_as_movable: 46drop-caches, hugepages_treat_as_movable:
46 47
47See Documentation/filesystems/proc.txt 48See Documentation/filesystems/proc.txt
48 49
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 10c041ca13c7..6c2477754a2a 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -1,7 +1,7 @@
1 ThinkPad ACPI Extras Driver 1 ThinkPad ACPI Extras Driver
2 2
3 Version 0.17 3 Version 0.19
4 October 04th, 2007 4 January 06th, 2008
5 5
6 Borislav Deianov <borislav@users.sf.net> 6 Borislav Deianov <borislav@users.sf.net>
7 Henrique de Moraes Holschuh <hmh@hmh.eng.br> 7 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
@@ -215,6 +215,11 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file:
215 ... any other 8-hex-digit mask ... 215 ... any other 8-hex-digit mask ...
216 echo reset > /proc/acpi/ibm/hotkey -- restore the original mask 216 echo reset > /proc/acpi/ibm/hotkey -- restore the original mask
217 217
218The procfs interface does not support NVRAM polling control. So as to
219maintain maximum bug-to-bug compatibility, it does not report any masks,
220nor does it allow one to manipulate the hot key mask when the firmware
221does not support masks at all, even if NVRAM polling is in use.
222
218sysfs notes: 223sysfs notes:
219 224
220 hotkey_bios_enabled: 225 hotkey_bios_enabled:
@@ -231,17 +236,26 @@ sysfs notes:
231 to this value. 236 to this value.
232 237
233 hotkey_enable: 238 hotkey_enable:
234 Enables/disables the hot keys feature, and reports 239 Enables/disables the hot keys feature in the ACPI
235 current status of the hot keys feature. 240 firmware, and reports current status of the hot keys
241 feature. Has no effect on the NVRAM hot key polling
242 functionality.
236 243
237 0: disables the hot keys feature / feature disabled 244 0: disables the hot keys feature / feature disabled
238 1: enables the hot keys feature / feature enabled 245 1: enables the hot keys feature / feature enabled
239 246
240 hotkey_mask: 247 hotkey_mask:
241 bit mask to enable driver-handling and ACPI event 248 bit mask to enable driver-handling (and depending on
242 generation for each hot key (see above). Returns the 249 the firmware, ACPI event generation) for each hot key
243 current status of the hot keys mask, and allows one to 250 (see above). Returns the current status of the hot keys
244 modify it. 251 mask, and allows one to modify it.
252
253 Note: when NVRAM polling is active, the firmware mask
254 will be different from the value returned by
255 hotkey_mask. The driver will retain enabled bits for
256 hotkeys that are under NVRAM polling even if the
257 firmware refuses them, and will not set these bits on
258 the firmware hot key mask.
245 259
246 hotkey_all_mask: 260 hotkey_all_mask:
247 bit mask that should enable event reporting for all 261 bit mask that should enable event reporting for all
@@ -257,12 +271,48 @@ sysfs notes:
257 handled by the firmware anyway. Echo it to 271 handled by the firmware anyway. Echo it to
258 hotkey_mask above, to use. 272 hotkey_mask above, to use.
259 273
274 hotkey_source_mask:
275 bit mask that selects which hot keys will the driver
276 poll the NVRAM for. This is auto-detected by the driver
277 based on the capabilities reported by the ACPI firmware,
278 but it can be overridden at runtime.
279
280 Hot keys whose bits are set in both hotkey_source_mask
281 and also on hotkey_mask are polled for in NVRAM. Only a
282 few hot keys are available through CMOS NVRAM polling.
283
284 Warning: when in NVRAM mode, the volume up/down/mute
285 keys are synthesized according to changes in the mixer,
286 so you have to use volume up or volume down to unmute,
287 as per the ThinkPad volume mixer user interface. When
288 in ACPI event mode, volume up/down/mute are reported as
289 separate events, but this behaviour may be corrected in
290 future releases of this driver, in which case the
291 ThinkPad volume mixer user interface semanthics will be
292 enforced.
293
294 hotkey_poll_freq:
295 frequency in Hz for hot key polling. It must be between
296 0 and 25 Hz. Polling is only carried out when strictly
297 needed.
298
299 Setting hotkey_poll_freq to zero disables polling, and
300 will cause hot key presses that require NVRAM polling
301 to never be reported.
302
303 Setting hotkey_poll_freq too low will cause repeated
304 pressings of the same hot key to be misreported as a
305 single key press, or to not even be detected at all.
306 The recommended polling frequency is 10Hz.
307
260 hotkey_radio_sw: 308 hotkey_radio_sw:
261 if the ThinkPad has a hardware radio switch, this 309 if the ThinkPad has a hardware radio switch, this
262 attribute will read 0 if the switch is in the "radios 310 attribute will read 0 if the switch is in the "radios
263 disabled" postition, and 1 if the switch is in the 311 disabled" postition, and 1 if the switch is in the
264 "radios enabled" position. 312 "radios enabled" position.
265 313
314 This attribute has poll()/select() support.
315
266 hotkey_report_mode: 316 hotkey_report_mode:
267 Returns the state of the procfs ACPI event report mode 317 Returns the state of the procfs ACPI event report mode
268 filter for hot keys. If it is set to 1 (the default), 318 filter for hot keys. If it is set to 1 (the default),
@@ -277,6 +327,25 @@ sysfs notes:
277 May return -EPERM (write access locked out by module 327 May return -EPERM (write access locked out by module
278 parameter) or -EACCES (read-only). 328 parameter) or -EACCES (read-only).
279 329
330 wakeup_reason:
331 Set to 1 if the system is waking up because the user
332 requested a bay ejection. Set to 2 if the system is
333 waking up because the user requested the system to
334 undock. Set to zero for normal wake-ups or wake-ups
335 due to unknown reasons.
336
337 This attribute has poll()/select() support.
338
339 wakeup_hotunplug_complete:
340 Set to 1 if the system was waken up because of an
341 undock or bay ejection request, and that request
342 was sucessfully completed. At this point, it might
343 be useful to send the system back to sleep, at the
344 user's choice. Refer to HKEY events 0x4003 and
345 0x3003, below.
346
347 This attribute has poll()/select() support.
348
280input layer notes: 349input layer notes:
281 350
282A Hot key is mapped to a single input layer EV_KEY event, possibly 351A Hot key is mapped to a single input layer EV_KEY event, possibly
@@ -427,6 +496,23 @@ Non hot-key ACPI HKEY event map:
427The above events are not propagated by the driver, except for legacy 496The above events are not propagated by the driver, except for legacy
428compatibility purposes when hotkey_report_mode is set to 1. 497compatibility purposes when hotkey_report_mode is set to 1.
429 498
4990x2304 System is waking up from suspend to undock
5000x2305 System is waking up from suspend to eject bay
5010x2404 System is waking up from hibernation to undock
5020x2405 System is waking up from hibernation to eject bay
503
504The above events are never propagated by the driver.
505
5060x3003 Bay ejection (see 0x2x05) complete, can sleep again
5070x4003 Undocked (see 0x2x04), can sleep again
5080x5009 Tablet swivel: switched to tablet mode
5090x500A Tablet swivel: switched to normal mode
5100x500B Tablet pen insterted into its storage bay
5110x500C Tablet pen removed from its storage bay
5120x5010 Brightness level changed (newer Lenovo BIOSes)
513
514The above events are propagated by the driver.
515
430Compatibility notes: 516Compatibility notes:
431 517
432ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never 518ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never
@@ -1263,3 +1349,17 @@ Sysfs interface changelog:
1263 and the hwmon class for libsensors4 (lm-sensors 3) 1349 and the hwmon class for libsensors4 (lm-sensors 3)
1264 compatibility. Moved all hwmon attributes to this 1350 compatibility. Moved all hwmon attributes to this
1265 new platform device. 1351 new platform device.
1352
13530x020100: Marker for thinkpad-acpi with hot key NVRAM polling
1354 support. If you must, use it to know you should not
1355 start an userspace NVRAM poller (allows to detect when
1356 NVRAM is compiled out by the user because it is
1357 unneeded/undesired in the first place).
13580x020101: Marker for thinkpad-acpi with hot key NVRAM polling
1359 and proper hotkey_mask semanthics (version 8 of the
1360 NVRAM polling patch). Some development snapshots of
1361 0.18 had an earlier version that did strange things
1362 to hotkey_mask.
1363
13640x020200: Add poll()/select() support to the following attributes:
1365 hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason
diff --git a/Documentation/unaligned-memory-access.txt b/Documentation/unaligned-memory-access.txt
new file mode 100644
index 000000000000..6223eace3c09
--- /dev/null
+++ b/Documentation/unaligned-memory-access.txt
@@ -0,0 +1,226 @@
1UNALIGNED MEMORY ACCESSES
2=========================
3
4Linux runs on a wide variety of architectures which have varying behaviour
5when it comes to memory access. This document presents some details about
6unaligned accesses, why you need to write code that doesn't cause them,
7and how to write such code!
8
9
10The definition of an unaligned access
11=====================================
12
13Unaligned memory accesses occur when you try to read N bytes of data starting
14from an address that is not evenly divisible by N (i.e. addr % N != 0).
15For example, reading 4 bytes of data from address 0x10004 is fine, but
16reading 4 bytes of data from address 0x10005 would be an unaligned memory
17access.
18
19The above may seem a little vague, as memory access can happen in different
20ways. The context here is at the machine code level: certain instructions read
21or write a number of bytes to or from memory (e.g. movb, movw, movl in x86
22assembly). As will become clear, it is relatively easy to spot C statements
23which will compile to multiple-byte memory access instructions, namely when
24dealing with types such as u16, u32 and u64.
25
26
27Natural alignment
28=================
29
30The rule mentioned above forms what we refer to as natural alignment:
31When accessing N bytes of memory, the base memory address must be evenly
32divisible by N, i.e. addr % N == 0.
33
34When writing code, assume the target architecture has natural alignment
35requirements.
36
37In reality, only a few architectures require natural alignment on all sizes
38of memory access. However, we must consider ALL supported architectures;
39writing code that satisfies natural alignment requirements is the easiest way
40to achieve full portability.
41
42
43Why unaligned access is bad
44===========================
45
46The effects of performing an unaligned memory access vary from architecture
47to architecture. It would be easy to write a whole document on the differences
48here; a summary of the common scenarios is presented below:
49
50 - Some architectures are able to perform unaligned memory accesses
51 transparently, but there is usually a significant performance cost.
52 - Some architectures raise processor exceptions when unaligned accesses
53 happen. The exception handler is able to correct the unaligned access,
54 at significant cost to performance.
55 - Some architectures raise processor exceptions when unaligned accesses
56 happen, but the exceptions do not contain enough information for the
57 unaligned access to be corrected.
58 - Some architectures are not capable of unaligned memory access, but will
59 silently perform a different memory access to the one that was requested,
60 resulting a a subtle code bug that is hard to detect!
61
62It should be obvious from the above that if your code causes unaligned
63memory accesses to happen, your code will not work correctly on certain
64platforms and will cause performance problems on others.
65
66
67Code that does not cause unaligned access
68=========================================
69
70At first, the concepts above may seem a little hard to relate to actual
71coding practice. After all, you don't have a great deal of control over
72memory addresses of certain variables, etc.
73
74Fortunately things are not too complex, as in most cases, the compiler
75ensures that things will work for you. For example, take the following
76structure:
77
78 struct foo {
79 u16 field1;
80 u32 field2;
81 u8 field3;
82 };
83
84Let us assume that an instance of the above structure resides in memory
85starting at address 0x10000. With a basic level of understanding, it would
86not be unreasonable to expect that accessing field2 would cause an unaligned
87access. You'd be expecting field2 to be located at offset 2 bytes into the
88structure, i.e. address 0x10002, but that address is not evenly divisible
89by 4 (remember, we're reading a 4 byte value here).
90
91Fortunately, the compiler understands the alignment constraints, so in the
92above case it would insert 2 bytes of padding in between field1 and field2.
93Therefore, for standard structure types you can always rely on the compiler
94to pad structures so that accesses to fields are suitably aligned (assuming
95you do not cast the field to a type of different length).
96
97Similarly, you can also rely on the compiler to align variables and function
98parameters to a naturally aligned scheme, based on the size of the type of
99the variable.
100
101At this point, it should be clear that accessing a single byte (u8 or char)
102will never cause an unaligned access, because all memory addresses are evenly
103divisible by one.
104
105On a related topic, with the above considerations in mind you may observe
106that you could reorder the fields in the structure in order to place fields
107where padding would otherwise be inserted, and hence reduce the overall
108resident memory size of structure instances. The optimal layout of the
109above example is:
110
111 struct foo {
112 u32 field2;
113 u16 field1;
114 u8 field3;
115 };
116
117For a natural alignment scheme, the compiler would only have to add a single
118byte of padding at the end of the structure. This padding is added in order
119to satisfy alignment constraints for arrays of these structures.
120
121Another point worth mentioning is the use of __attribute__((packed)) on a
122structure type. This GCC-specific attribute tells the compiler never to
123insert any padding within structures, useful when you want to use a C struct
124to represent some data that comes in a fixed arrangement 'off the wire'.
125
126You might be inclined to believe that usage of this attribute can easily
127lead to unaligned accesses when accessing fields that do not satisfy
128architectural alignment requirements. However, again, the compiler is aware
129of the alignment constraints and will generate extra instructions to perform
130the memory access in a way that does not cause unaligned access. Of course,
131the extra instructions obviously cause a loss in performance compared to the
132non-packed case, so the packed attribute should only be used when avoiding
133structure padding is of importance.
134
135
136Code that causes unaligned access
137=================================
138
139With the above in mind, let's move onto a real life example of a function
140that can cause an unaligned memory access. The following function adapted
141from include/linux/etherdevice.h is an optimized routine to compare two
142ethernet MAC addresses for equality.
143
144unsigned int compare_ether_addr(const u8 *addr1, const u8 *addr2)
145{
146 const u16 *a = (const u16 *) addr1;
147 const u16 *b = (const u16 *) addr2;
148 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
149}
150
151In the above function, the reference to a[0] causes 2 bytes (16 bits) to
152be read from memory starting at address addr1. Think about what would happen
153if addr1 was an odd address such as 0x10003. (Hint: it'd be an unaligned
154access.)
155
156Despite the potential unaligned access problems with the above function, it
157is included in the kernel anyway but is understood to only work on
15816-bit-aligned addresses. It is up to the caller to ensure this alignment or
159not use this function at all. This alignment-unsafe function is still useful
160as it is a decent optimization for the cases when you can ensure alignment,
161which is true almost all of the time in ethernet networking context.
162
163
164Here is another example of some code that could cause unaligned accesses:
165 void myfunc(u8 *data, u32 value)
166 {
167 [...]
168 *((u32 *) data) = cpu_to_le32(value);
169 [...]
170 }
171
172This code will cause unaligned accesses every time the data parameter points
173to an address that is not evenly divisible by 4.
174
175In summary, the 2 main scenarios where you may run into unaligned access
176problems involve:
177 1. Casting variables to types of different lengths
178 2. Pointer arithmetic followed by access to at least 2 bytes of data
179
180
181Avoiding unaligned accesses
182===========================
183
184The easiest way to avoid unaligned access is to use the get_unaligned() and
185put_unaligned() macros provided by the <asm/unaligned.h> header file.
186
187Going back to an earlier example of code that potentially causes unaligned
188access:
189
190 void myfunc(u8 *data, u32 value)
191 {
192 [...]
193 *((u32 *) data) = cpu_to_le32(value);
194 [...]
195 }
196
197To avoid the unaligned memory access, you would rewrite it as follows:
198
199 void myfunc(u8 *data, u32 value)
200 {
201 [...]
202 value = cpu_to_le32(value);
203 put_unaligned(value, (u32 *) data);
204 [...]
205 }
206
207The get_unaligned() macro works similarly. Assuming 'data' is a pointer to
208memory and you wish to avoid unaligned access, its usage is as follows:
209
210 u32 value = get_unaligned((u32 *) data);
211
212These macros work work for memory accesses of any length (not just 32 bits as
213in the examples above). Be aware that when compared to standard access of
214aligned memory, using these macros to access unaligned memory can be costly in
215terms of performance.
216
217If use of such macros is not convenient, another option is to use memcpy(),
218where the source or destination (or both) are of type u8* or unsigned char*.
219Due to the byte-wise nature of this operation, unaligned accesses are avoided.
220
221--
222Author: Daniel Drake <dsd@gentoo.org>
223With help from: Alan Cox, Avuton Olrich, Heikki Orsila, Jan Engelhardt,
224Johannes Berg, Kyle McMartin, Kyle Moffett, Randy Dunlap, Robert Hancock,
225Uli Kunitz, Vadim Lobanov
226
diff --git a/Documentation/usb/gadget_printer.txt b/Documentation/usb/gadget_printer.txt
new file mode 100644
index 000000000000..ad995bf0db41
--- /dev/null
+++ b/Documentation/usb/gadget_printer.txt
@@ -0,0 +1,510 @@
1
2 Linux USB Printer Gadget Driver
3 06/04/2007
4
5 Copyright (C) 2007 Craig W. Nadler <craig@nadler.us>
6
7
8
9GENERAL
10=======
11
12This driver may be used if you are writing printer firmware using Linux as
13the embedded OS. This driver has nothing to do with using a printer with
14your Linux host system.
15
16You will need a USB device controller and a Linux driver for it that accepts
17a gadget / "device class" driver using the Linux USB Gadget API. After the
18USB device controller driver is loaded then load the printer gadget driver.
19This will present a printer interface to the USB Host that your USB Device
20port is connected to.
21
22This driver is structured for printer firmware that runs in user mode. The
23user mode printer firmware will read and write data from the kernel mode
24printer gadget driver using a device file. The printer returns a printer status
25byte when the USB HOST sends a device request to get the printer status. The
26user space firmware can read or write this status byte using a device file
27/dev/g_printer . Both blocking and non-blocking read/write calls are supported.
28
29
30
31
32HOWTO USE THIS DRIVER
33=====================
34
35To load the USB device controller driver and the printer gadget driver. The
36following example uses the Netchip 2280 USB device controller driver:
37
38modprobe net2280
39modprobe g_printer
40
41
42The follow command line parameter can be used when loading the printer gadget
43(ex: modprobe g_printer idVendor=0x0525 idProduct=0xa4a8 ):
44
45idVendor - This is the Vendor ID used in the device descriptor. The default is
46 the Netchip vendor id 0x0525. YOU MUST CHANGE TO YOUR OWN VENDOR ID
47 BEFORE RELEASING A PRODUCT. If you plan to release a product and don't
48 already have a Vendor ID please see www.usb.org for details on how to
49 get one.
50
51idProduct - This is the Product ID used in the device descriptor. The default
52 is 0xa4a8, you should change this to an ID that's not used by any of
53 your other USB products if you have any. It would be a good idea to
54 start numbering your products starting with say 0x0001.
55
56bcdDevice - This is the version number of your product. It would be a good idea
57 to put your firmware version here.
58
59iManufacturer - A string containing the name of the Vendor.
60
61iProduct - A string containing the Product Name.
62
63iSerialNum - A string containing the Serial Number. This should be changed for
64 each unit of your product.
65
66iPNPstring - The PNP ID string used for this printer. You will want to set
67 either on the command line or hard code the PNP ID string used for
68 your printer product.
69
70qlen - The number of 8k buffers to use per endpoint. The default is 10, you
71 should tune this for your product. You may also want to tune the
72 size of each buffer for your product.
73
74
75
76
77USING THE EXAMPLE CODE
78======================
79
80This example code talks to stdout, instead of a print engine.
81
82To compile the test code below:
83
841) save it to a file called prn_example.c
852) compile the code with the follow command:
86 gcc prn_example.c -o prn_example
87
88
89
90To read printer data from the host to stdout:
91
92 # prn_example -read_data
93
94
95To write printer data from a file (data_file) to the host:
96
97 # cat data_file | prn_example -write_data
98
99
100To get the current printer status for the gadget driver:
101
102 # prn_example -get_status
103
104 Printer status is:
105 Printer is NOT Selected
106 Paper is Out
107 Printer OK
108
109
110To set printer to Selected/On-line:
111
112 # prn_example -selected
113
114
115To set printer to Not Selected/Off-line:
116
117 # prn_example -not_selected
118
119
120To set paper status to paper out:
121
122 # prn_example -paper_out
123
124
125To set paper status to paper loaded:
126
127 # prn_example -paper_loaded
128
129
130To set error status to printer OK:
131
132 # prn_example -no_error
133
134
135To set error status to ERROR:
136
137 # prn_example -error
138
139
140
141
142EXAMPLE CODE
143============
144
145
146#include <stdio.h>
147#include <stdlib.h>
148#include <fcntl.h>
149#include <linux/poll.h>
150#include <sys/ioctl.h>
151#include <linux/usb/g_printer.h>
152
153#define PRINTER_FILE "/dev/g_printer"
154#define BUF_SIZE 512
155
156
157/*
158 * 'usage()' - Show program usage.
159 */
160
161static void
162usage(const char *option) /* I - Option string or NULL */
163{
164 if (option) {
165 fprintf(stderr,"prn_example: Unknown option \"%s\"!\n",
166 option);
167 }
168
169 fputs("\n", stderr);
170 fputs("Usage: prn_example -[options]\n", stderr);
171 fputs("Options:\n", stderr);
172 fputs("\n", stderr);
173 fputs("-get_status Get the current printer status.\n", stderr);
174 fputs("-selected Set the selected status to selected.\n", stderr);
175 fputs("-not_selected Set the selected status to NOT selected.\n",
176 stderr);
177 fputs("-error Set the error status to error.\n", stderr);
178 fputs("-no_error Set the error status to NO error.\n", stderr);
179 fputs("-paper_out Set the paper status to paper out.\n", stderr);
180 fputs("-paper_loaded Set the paper status to paper loaded.\n",
181 stderr);
182 fputs("-read_data Read printer data from driver.\n", stderr);
183 fputs("-write_data Write printer sata to driver.\n", stderr);
184 fputs("-NB_read_data (Non-Blocking) Read printer data from driver.\n",
185 stderr);
186 fputs("\n\n", stderr);
187
188 exit(1);
189}
190
191
192static int
193read_printer_data()
194{
195 struct pollfd fd[1];
196
197 /* Open device file for printer gadget. */
198 fd[0].fd = open(PRINTER_FILE, O_RDWR);
199 if (fd[0].fd < 0) {
200 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE);
201 close(fd[0].fd);
202 return(-1);
203 }
204
205 fd[0].events = POLLIN | POLLRDNORM;
206
207 while (1) {
208 static char buf[BUF_SIZE];
209 int bytes_read;
210 int retval;
211
212 /* Wait for up to 1 second for data. */
213 retval = poll(fd, 1, 1000);
214
215 if (retval && (fd[0].revents & POLLRDNORM)) {
216
217 /* Read data from printer gadget driver. */
218 bytes_read = read(fd[0].fd, buf, BUF_SIZE);
219
220 if (bytes_read < 0) {
221 printf("Error %d reading from %s\n",
222 fd[0].fd, PRINTER_FILE);
223 close(fd[0].fd);
224 return(-1);
225 } else if (bytes_read > 0) {
226 /* Write data to standard OUTPUT (stdout). */
227 fwrite(buf, 1, bytes_read, stdout);
228 fflush(stdout);
229 }
230
231 }
232
233 }
234
235 /* Close the device file. */
236 close(fd[0].fd);
237
238 return 0;
239}
240
241
242static int
243write_printer_data()
244{
245 struct pollfd fd[1];
246
247 /* Open device file for printer gadget. */
248 fd[0].fd = open (PRINTER_FILE, O_RDWR);
249 if (fd[0].fd < 0) {
250 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE);
251 close(fd[0].fd);
252 return(-1);
253 }
254
255 fd[0].events = POLLOUT | POLLWRNORM;
256
257 while (1) {
258 int retval;
259 static char buf[BUF_SIZE];
260 /* Read data from standard INPUT (stdin). */
261 int bytes_read = fread(buf, 1, BUF_SIZE, stdin);
262
263 if (!bytes_read) {
264 break;
265 }
266
267 while (bytes_read) {
268
269 /* Wait for up to 1 second to sent data. */
270 retval = poll(fd, 1, 1000);
271
272 /* Write data to printer gadget driver. */
273 if (retval && (fd[0].revents & POLLWRNORM)) {
274 retval = write(fd[0].fd, buf, bytes_read);
275 if (retval < 0) {
276 printf("Error %d writing to %s\n",
277 fd[0].fd,
278 PRINTER_FILE);
279 close(fd[0].fd);
280 return(-1);
281 } else {
282 bytes_read -= retval;
283 }
284
285 }
286
287 }
288
289 }
290
291 /* Wait until the data has been sent. */
292 fsync(fd[0].fd);
293
294 /* Close the device file. */
295 close(fd[0].fd);
296
297 return 0;
298}
299
300
301static int
302read_NB_printer_data()
303{
304 int fd;
305 static char buf[BUF_SIZE];
306 int bytes_read;
307
308 /* Open device file for printer gadget. */
309 fd = open(PRINTER_FILE, O_RDWR|O_NONBLOCK);
310 if (fd < 0) {
311 printf("Error %d opening %s\n", fd, PRINTER_FILE);
312 close(fd);
313 return(-1);
314 }
315
316 while (1) {
317 /* Read data from printer gadget driver. */
318 bytes_read = read(fd, buf, BUF_SIZE);
319 if (bytes_read <= 0) {
320 break;
321 }
322
323 /* Write data to standard OUTPUT (stdout). */
324 fwrite(buf, 1, bytes_read, stdout);
325 fflush(stdout);
326 }
327
328 /* Close the device file. */
329 close(fd);
330
331 return 0;
332}
333
334
335static int
336get_printer_status()
337{
338 int retval;
339 int fd;
340
341 /* Open device file for printer gadget. */
342 fd = open(PRINTER_FILE, O_RDWR);
343 if (fd < 0) {
344 printf("Error %d opening %s\n", fd, PRINTER_FILE);
345 close(fd);
346 return(-1);
347 }
348
349 /* Make the IOCTL call. */
350 retval = ioctl(fd, GADGET_GET_PRINTER_STATUS);
351 if (retval < 0) {
352 fprintf(stderr, "ERROR: Failed to set printer status\n");
353 return(-1);
354 }
355
356 /* Close the device file. */
357 close(fd);
358
359 return(retval);
360}
361
362
363static int
364set_printer_status(unsigned char buf, int clear_printer_status_bit)
365{
366 int retval;
367 int fd;
368
369 retval = get_printer_status();
370 if (retval < 0) {
371 fprintf(stderr, "ERROR: Failed to get printer status\n");
372 return(-1);
373 }
374
375 /* Open device file for printer gadget. */
376 fd = open(PRINTER_FILE, O_RDWR);
377
378 if (fd < 0) {
379 printf("Error %d opening %s\n", fd, PRINTER_FILE);
380 close(fd);
381 return(-1);
382 }
383
384 if (clear_printer_status_bit) {
385 retval &= ~buf;
386 } else {
387 retval |= buf;
388 }
389
390 /* Make the IOCTL call. */
391 if (ioctl(fd, GADGET_SET_PRINTER_STATUS, (unsigned char)retval)) {
392 fprintf(stderr, "ERROR: Failed to set printer status\n");
393 return(-1);
394 }
395
396 /* Close the device file. */
397 close(fd);
398
399 return 0;
400}
401
402
403static int
404display_printer_status()
405{
406 char printer_status;
407
408 printer_status = get_printer_status();
409 if (printer_status < 0) {
410 fprintf(stderr, "ERROR: Failed to get printer status\n");
411 return(-1);
412 }
413
414 printf("Printer status is:\n");
415 if (printer_status & PRINTER_SELECTED) {
416 printf(" Printer is Selected\n");
417 } else {
418 printf(" Printer is NOT Selected\n");
419 }
420 if (printer_status & PRINTER_PAPER_EMPTY) {
421 printf(" Paper is Out\n");
422 } else {
423 printf(" Paper is Loaded\n");
424 }
425 if (printer_status & PRINTER_NOT_ERROR) {
426 printf(" Printer OK\n");
427 } else {
428 printf(" Printer ERROR\n");
429 }
430
431 return(0);
432}
433
434
435int
436main(int argc, char *argv[])
437{
438 int i; /* Looping var */
439 int retval = 0;
440
441 /* No Args */
442 if (argc == 1) {
443 usage(0);
444 exit(0);
445 }
446
447 for (i = 1; i < argc && !retval; i ++) {
448
449 if (argv[i][0] != '-') {
450 continue;
451 }
452
453 if (!strcmp(argv[i], "-get_status")) {
454 if (display_printer_status()) {
455 retval = 1;
456 }
457
458 } else if (!strcmp(argv[i], "-paper_loaded")) {
459 if (set_printer_status(PRINTER_PAPER_EMPTY, 1)) {
460 retval = 1;
461 }
462
463 } else if (!strcmp(argv[i], "-paper_out")) {
464 if (set_printer_status(PRINTER_PAPER_EMPTY, 0)) {
465 retval = 1;
466 }
467
468 } else if (!strcmp(argv[i], "-selected")) {
469 if (set_printer_status(PRINTER_SELECTED, 0)) {
470 retval = 1;
471 }
472
473 } else if (!strcmp(argv[i], "-not_selected")) {
474 if (set_printer_status(PRINTER_SELECTED, 1)) {
475 retval = 1;
476 }
477
478 } else if (!strcmp(argv[i], "-error")) {
479 if (set_printer_status(PRINTER_NOT_ERROR, 1)) {
480 retval = 1;
481 }
482
483 } else if (!strcmp(argv[i], "-no_error")) {
484 if (set_printer_status(PRINTER_NOT_ERROR, 0)) {
485 retval = 1;
486 }
487
488 } else if (!strcmp(argv[i], "-read_data")) {
489 if (read_printer_data()) {
490 retval = 1;
491 }
492
493 } else if (!strcmp(argv[i], "-write_data")) {
494 if (write_printer_data()) {
495 retval = 1;
496 }
497
498 } else if (!strcmp(argv[i], "-NB_read_data")) {
499 if (read_NB_printer_data()) {
500 retval = 1;
501 }
502
503 } else {
504 usage(argv[i]);
505 retval = 1;
506 }
507 }
508
509 exit(retval);
510}
diff --git a/Documentation/usb/iuu_phoenix.txt b/Documentation/usb/iuu_phoenix.txt
new file mode 100644
index 000000000000..e5f048067da4
--- /dev/null
+++ b/Documentation/usb/iuu_phoenix.txt
@@ -0,0 +1,84 @@
1Infinity Usb Unlimited Readme
2-----------------------------
3
4Hi all,
5
6
7This module provide a serial interface to use your
8IUU unit in phoenix mode. Loading this module will
9bring a ttyUSB[0-x] interface. This driver must be
10used by your favorite application to pilot the IUU
11
12This driver is still in beta stage, so bugs can
13occur and your system may freeze. As far I now,
14I never had any problem with it, but I'm not a real
15guru, so don't blame me if your system is unstable
16
17You can plug more than one IUU. Every unit will
18have his own device file(/dev/ttyUSB0,/dev/ttyUSB1,...)
19
20
21
22How to tune the reader speed ?
23
24 A few parameters can be used at load time
25 To use parameters, just unload the module if it is
26 already loaded and use modprobe iuu_phoenix param=value.
27 In case of prebuilt module, use the command
28 insmod iuu_phoenix param=value.
29
30 Example:
31
32 modprobe iuu_phoenix clockmode=3
33
34 The parameters are:
35
36 parm: clockmode:1=3Mhz579,2=3Mhz680,3=6Mhz (int)
37 parm: boost:overclock boost percent 100 to 500 (int)
38 parm: cdmode:Card detect mode 0=none, 1=CD, 2=!CD, 3=DSR, 4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING (int)
39 parm: xmas:xmas color enabled or not (bool)
40 parm: debug:Debug enabled or not (bool)
41
42- clockmode will provide 3 different base settings commonly adopted by
43 different software:
44 1. 3Mhz579
45 2. 3Mhz680
46 3. 6Mhz
47
48- boost provide a way to overclock the reader ( my favorite :-) )
49 For example to have best performance than a simple clockmode=3, try this:
50
51 modprobe boost=195
52
53 This will put the reader in a base of 3Mhz579 but boosted a 195 % !
54 the real clock will be now : 6979050 Hz ( 6Mhz979 ) and will increase
55 the speed to a score 10 to 20% better than the simple clockmode=3 !!!
56
57
58- cdmode permit to setup the signal used to inform the userland ( ioctl answer )
59 if the card is present or not. Eight signals are possible.
60
61- xmas is completely useless except for your eyes. This is one of my friend who was
62 so sad to have a nice device like the iuu without seeing all color range available.
63 So I have added this option to permit him to see a lot of color ( each activity change the color
64 and the frequency randomly )
65
66- debug will produce a lot of debugging messages...
67
68
69 Last notes:
70
71 Don't worry about the serial settings, the serial emulation
72 is an abstraction, so use any speed or parity setting will
73 work. ( This will not change anything ).Later I will perhaps
74 use this settings to deduce de boost but is that feature
75 really necessary ?
76 The autodetect feature used is the serial CD. If that doesn't
77 work for your software, disable detection mechanism in it.
78
79
80 Have fun !
81
82 Alain Degreffe
83
84 eczema(at)ecze.com
diff --git a/Documentation/w1/masters/00-INDEX b/Documentation/w1/masters/00-INDEX
index 752613c4cea2..7b0ceaaad7af 100644
--- a/Documentation/w1/masters/00-INDEX
+++ b/Documentation/w1/masters/00-INDEX
@@ -4,3 +4,5 @@ ds2482
4 - The Maxim/Dallas Semiconductor DS2482 provides 1-wire busses. 4 - The Maxim/Dallas Semiconductor DS2482 provides 1-wire busses.
5ds2490 5ds2490
6 - The Maxim/Dallas Semiconductor DS2490 builds USB <-> W1 bridges. 6 - The Maxim/Dallas Semiconductor DS2490 builds USB <-> W1 bridges.
7w1-gpio
8 - GPIO 1-wire bus master driver.
diff --git a/Documentation/w1/masters/w1-gpio b/Documentation/w1/masters/w1-gpio
new file mode 100644
index 000000000000..af5d3b4aa851
--- /dev/null
+++ b/Documentation/w1/masters/w1-gpio
@@ -0,0 +1,33 @@
1Kernel driver w1-gpio
2=====================
3
4Author: Ville Syrjala <syrjala@sci.fi>
5
6
7Description
8-----------
9
10GPIO 1-wire bus master driver. The driver uses the GPIO API to control the
11wire and the GPIO pin can be specified using platform data.
12
13
14Example (mach-at91)
15-------------------
16
17#include <linux/w1-gpio.h>
18
19static struct w1_gpio_platform_data foo_w1_gpio_pdata = {
20 .pin = AT91_PIN_PB20,
21 .is_open_drain = 1,
22};
23
24static struct platform_device foo_w1_device = {
25 .name = "w1-gpio",
26 .id = -1,
27 .dev.platform_data = &foo_w1_gpio_pdata,
28};
29
30...
31 at91_set_GPIO_periph(foo_w1_gpio_pdata.pin, 1);
32 at91_set_multi_drive(foo_w1_gpio_pdata.pin, 1);
33 platform_device_register(&foo_w1_device);
diff --git a/Documentation/x86_64/00-INDEX b/Documentation/x86_64/00-INDEX
new file mode 100644
index 000000000000..92fc20ab5f0e
--- /dev/null
+++ b/Documentation/x86_64/00-INDEX
@@ -0,0 +1,16 @@
100-INDEX
2 - This file
3boot-options.txt
4 - AMD64-specific boot options.
5cpu-hotplug-spec
6 - Firmware support for CPU hotplug under Linux/x86-64
7fake-numa-for-cpusets
8 - Using numa=fake and CPUSets for Resource Management
9kernel-stacks
10 - Context-specific per-processor interrupt stacks.
11machinecheck
12 - Configurable sysfs parameters for the x86-64 machine check code.
13mm.txt
14 - Memory layout of x86-64 (4 level page tables, 46 bits physical).
15uefi.txt
16 - Booting Linux via Unified Extensible Firmware Interface.