diff options
Diffstat (limited to 'Documentation')
159 files changed, 10595 insertions, 2215 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 299615d821ac..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. |
15 | ABI/ | 15 | ABI/ |
16 | - info on kernel <-> userspace ABI and relative interface stability. | 16 | - info on kernel <-> userspace ABI and relative interface stability. |
17 | |||
17 | BUG-HUNTING | 18 | BUG-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. |
19 | Changes | 20 | Changes |
@@ -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. |
67 | accounting/ | 68 | accounting/ |
68 | - documentation on accounting and taskstats. | 69 | - documentation on accounting and taskstats. |
70 | acpi/ | ||
71 | - info on ACPI-specific hooks in the kernel. | ||
69 | aoe/ | 72 | aoe/ |
70 | - description of AoE (ATA over Ethernet) along with config examples. | 73 | - description of AoE (ATA over Ethernet) along with config examples. |
71 | applying-patches.txt | 74 | applying-patches.txt |
@@ -154,7 +157,7 @@ firmware_class/ | |||
154 | - request_firmware() hotplug interface info. | 157 | - request_firmware() hotplug interface info. |
155 | floppy.txt | 158 | floppy.txt |
156 | - notes and driver options for the floppy disk driver. | 159 | - notes and driver options for the floppy disk driver. |
157 | fujitsu/ | 160 | frv/ |
158 | - Fujitsu FR-V Linux documentation. | 161 | - Fujitsu FR-V Linux documentation. |
159 | gpio.txt | 162 | gpio.txt |
160 | - overview of GPIO (General Purpose Input/Output) access conventions. | 163 | - overview of GPIO (General Purpose Input/Output) access conventions. |
@@ -262,6 +265,8 @@ mtrr.txt | |||
262 | - how to use PPro Memory Type Range Registers to increase performance. | 265 | - how to use PPro Memory Type Range Registers to increase performance. |
263 | mutex-design.txt | 266 | mutex-design.txt |
264 | - info on the generic mutex subsystem. | 267 | - info on the generic mutex subsystem. |
268 | namespaces/ | ||
269 | - directory with various information about namespaces | ||
265 | nbd.txt | 270 | nbd.txt |
266 | - info on a TCP implementation of a network block device. | 271 | - info on a TCP implementation of a network block device. |
267 | netlabel/ | 272 | netlabel/ |
@@ -362,8 +367,6 @@ sharedsubtree.txt | |||
362 | - a description of shared subtrees for namespaces. | 367 | - a description of shared subtrees for namespaces. |
363 | smart-config.txt | 368 | smart-config.txt |
364 | - description of the Smart Config makefile feature. | 369 | - description of the Smart Config makefile feature. |
365 | smp.txt | ||
366 | - a few notes on symmetric multi-processing. | ||
367 | sony-laptop.txt | 370 | sony-laptop.txt |
368 | - Sony Notebook Control Driver (SNC) Readme. | 371 | - Sony Notebook Control Driver (SNC) Readme. |
369 | sonypi.txt | 372 | sonypi.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 | |||
56 | What: /sys/bus/usb/device/.../power/connected_duration | ||
57 | Date: January 2008 | ||
58 | KernelVersion: 2.6.25 | ||
59 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | ||
60 | Description: | ||
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. | ||
65 | Users: | ||
66 | PowerTOP <power@bughost.org> | ||
67 | http://www.lesswatts.org/projects/powertop/ | ||
68 | |||
69 | What: /sys/bus/usb/device/.../power/active_duration | ||
70 | Date: January 2008 | ||
71 | KernelVersion: 2.6.25 | ||
72 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | ||
73 | Description: | ||
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. | ||
85 | Users: | ||
86 | PowerTOP <power@bughost.org> | ||
87 | http://www.lesswatts.org/projects/powertop/ | ||
diff --git a/Documentation/ABI/testing/sysfs-kernel-uids b/Documentation/ABI/testing/sysfs-kernel-uids new file mode 100644 index 000000000000..648d65dbc0e7 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-kernel-uids | |||
@@ -0,0 +1,14 @@ | |||
1 | What: /sys/kernel/uids/<uid>/cpu_shares | ||
2 | Date: December 2007 | ||
3 | Contact: Dhaval Giani <dhaval@linux.vnet.ibm.com> | ||
4 | Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> | ||
5 | Description: | ||
6 | The /sys/kernel/uids/<uid>/cpu_shares tunable is used | ||
7 | to set the cpu bandwidth a user is allowed. This is a | ||
8 | propotional value. What that means is that if there | ||
9 | are two users logged in, each with an equal number of | ||
10 | shares, then they will get equal CPU bandwidth. Another | ||
11 | example would be, if User A has shares = 1024 and user | ||
12 | B has shares = 2048, User B will get twice the CPU | ||
13 | bandwidth user A will. For more details refer | ||
14 | Documentation/sched-design-CFS.txt | ||
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 | ||
56 | This is how to track down a bug if you know nothing about kernel hacking. | 56 | This is how to track down a bug if you know nothing about kernel hacking. |
57 | It's a brute force approach but it works pretty well. | 57 | It's a brute force approach but it works pretty well. |
58 | 58 | ||
59 | You need: | 59 | You 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 | ||
132 | Finally, you take all the info that you have, kernel revisions, bug | 132 | Finally, you take all the info that you have, kernel revisions, bug |
133 | description, the extent to which you have narrowed it down, and pass | 133 | description, the extent to which you have narrowed it down, and pass |
134 | that off to whomever you believe is the maintainer of that section. | 134 | that off to whomever you believe is the maintainer of that section. |
135 | A post to linux.dev.kernel isn't such a bad idea if you've done some | 135 | A post to linux.dev.kernel isn't such a bad idea if you've done some |
136 | work to narrow it down. | 136 | work 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) |
217 | or, as one command | ||
218 | (gdb) l *(vt_ioctl + 0xda8) | ||
219 | |||
220 | If 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 | > ... | ||
226 | this shows the problem in the :jbd: module. You can load that module in gdb | ||
227 | and list the relevant code. | ||
228 | gdb fs/jbd/jbd.ko | ||
229 | (gdb) p log_wait_commit | ||
230 | (gdb) l *(0x<address> + 0xa3) | ||
231 | or | ||
232 | (gdb) l *(log_wait_commit + 0xa3) | ||
233 | |||
217 | 234 | ||
218 | Another very useful option of the Kernel Hacking section in menuconfig is | 235 | Another very useful option of the Kernel Hacking section in menuconfig is |
219 | Debug memory allocations. This will help you see whether data has been | 236 | Debug memory allocations. This will help you see whether data has been |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 054a7ecf64c6..6a0ad4715e9f 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ | |||
11 | procfs-guide.xml writing_usb_driver.xml \ | 11 | procfs-guide.xml writing_usb_driver.xml \ |
12 | kernel-api.xml filesystems.xml lsm.xml usb.xml \ | 12 | kernel-api.xml filesystems.xml lsm.xml usb.xml \ |
13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ | 13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ |
14 | genericirq.xml s390-drivers.xml | 14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml |
15 | 15 | ||
16 | ### | 16 | ### |
17 | # The build process is as follows (targets): | 17 | # The build process is as follows (targets): |
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index aa38cc5692a0..059aaf20951a 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -165,6 +165,7 @@ X!Ilib/string.c | |||
165 | !Emm/vmalloc.c | 165 | !Emm/vmalloc.c |
166 | !Imm/page_alloc.c | 166 | !Imm/page_alloc.c |
167 | !Emm/mempool.c | 167 | !Emm/mempool.c |
168 | !Emm/dmapool.c | ||
168 | !Emm/page-writeback.c | 169 | !Emm/page-writeback.c |
169 | !Emm/truncate.c | 170 | !Emm/truncate.c |
170 | </sect1> | 171 | </sect1> |
@@ -371,7 +372,6 @@ X!Iinclude/linux/device.h | |||
371 | !Edrivers/base/class.c | 372 | !Edrivers/base/class.c |
372 | !Edrivers/base/firmware_class.c | 373 | !Edrivers/base/firmware_class.c |
373 | !Edrivers/base/transport_class.c | 374 | !Edrivers/base/transport_class.c |
374 | !Edrivers/base/dmapool.c | ||
375 | <!-- Cannot be included, because | 375 | <!-- Cannot be included, because |
376 | attribute_container_add_class_device_adapter | 376 | attribute_container_add_class_device_adapter |
377 | and attribute_container_classdev_to_container | 377 | and attribute_container_classdev_to_container |
@@ -419,7 +419,13 @@ X!Edrivers/pnp/system.c | |||
419 | 419 | ||
420 | <chapter id="blkdev"> | 420 | <chapter id="blkdev"> |
421 | <title>Block Devices</title> | 421 | <title>Block Devices</title> |
422 | !Eblock/ll_rw_blk.c | 422 | !Eblock/blk-core.c |
423 | !Eblock/blk-map.c | ||
424 | !Iblock/blk-sysfs.c | ||
425 | !Eblock/blk-settings.c | ||
426 | !Eblock/blk-exec.c | ||
427 | !Eblock/blk-barrier.c | ||
428 | !Eblock/blk-tag.c | ||
423 | </chapter> | 429 | </chapter> |
424 | 430 | ||
425 | <chapter id="chrdev"> | 431 | <chapter id="chrdev"> |
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl index 01825ee7db64..2e9d6b41f034 100644 --- a/Documentation/DocBook/kernel-locking.tmpl +++ b/Documentation/DocBook/kernel-locking.tmpl | |||
@@ -717,7 +717,7 @@ used, and when it gets full, throws out the least used one. | |||
717 | <para> | 717 | <para> |
718 | For our first example, we assume that all operations are in user | 718 | For our first example, we assume that all operations are in user |
719 | context (ie. from system calls), so we can sleep. This means we can | 719 | context (ie. from system calls), so we can sleep. This means we can |
720 | use a semaphore to protect the cache and all the objects within | 720 | use a mutex to protect the cache and all the objects within |
721 | it. Here's the code: | 721 | it. Here's the code: |
722 | </para> | 722 | </para> |
723 | 723 | ||
@@ -725,7 +725,7 @@ it. Here's the code: | |||
725 | #include <linux/list.h> | 725 | #include <linux/list.h> |
726 | #include <linux/slab.h> | 726 | #include <linux/slab.h> |
727 | #include <linux/string.h> | 727 | #include <linux/string.h> |
728 | #include <asm/semaphore.h> | 728 | #include <linux/mutex.h> |
729 | #include <asm/errno.h> | 729 | #include <asm/errno.h> |
730 | 730 | ||
731 | struct object | 731 | struct 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 */ |
740 | static DECLARE_MUTEX(cache_lock); | 740 | static DEFINE_MUTEX(cache_lock); |
741 | static LIST_HEAD(cache); | 741 | static LIST_HEAD(cache); |
742 | static unsigned int cache_num = 0; | 742 | static 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->id = id; | 789 | obj->id = id; |
790 | obj->popularity = 0; | 790 | obj->popularity = 0; |
791 | 791 | ||
792 | down(&cache_lock); | 792 | mutex_lock(&cache_lock); |
793 | __cache_add(obj); | 793 | __cache_add(obj); |
794 | up(&cache_lock); | 794 | mutex_unlock(&cache_lock); |
795 | return 0; | 795 | return 0; |
796 | } | 796 | } |
797 | 797 | ||
798 | void cache_delete(int id) | 798 | void cache_delete(int id) |
799 | { | 799 | { |
800 | down(&cache_lock); | 800 | mutex_lock(&cache_lock); |
801 | __cache_delete(__cache_find(id)); | 801 | __cache_delete(__cache_find(id)); |
802 | up(&cache_lock); | 802 | mutex_unlock(&cache_lock); |
803 | } | 803 | } |
804 | 804 | ||
805 | int cache_find(int id, char *name) | 805 | int 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(&cache_lock); | 810 | mutex_lock(&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->name); | 814 | strcpy(name, obj->name); |
815 | } | 815 | } |
816 | up(&cache_lock); | 816 | mutex_unlock(&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->id = id; | 870 | obj->id = id; |
871 | obj->popularity = 0; | 871 | obj->popularity = 0; |
872 | 872 | ||
873 | - down(&cache_lock); | 873 | - mutex_lock(&cache_lock); |
874 | + spin_lock_irqsave(&cache_lock, flags); | 874 | + spin_lock_irqsave(&cache_lock, flags); |
875 | __cache_add(obj); | 875 | __cache_add(obj); |
876 | - up(&cache_lock); | 876 | - mutex_unlock(&cache_lock); |
877 | + spin_unlock_irqrestore(&cache_lock, flags); | 877 | + spin_unlock_irqrestore(&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(&cache_lock); | 883 | - mutex_lock(&cache_lock); |
884 | + unsigned long flags; | 884 | + unsigned long flags; |
885 | + | 885 | + |
886 | + spin_lock_irqsave(&cache_lock, flags); | 886 | + spin_lock_irqsave(&cache_lock, flags); |
887 | __cache_delete(__cache_find(id)); | 887 | __cache_delete(__cache_find(id)); |
888 | - up(&cache_lock); | 888 | - mutex_unlock(&cache_lock); |
889 | + spin_unlock_irqrestore(&cache_lock, flags); | 889 | + spin_unlock_irqrestore(&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(&cache_lock); | 898 | - mutex_lock(&cache_lock); |
899 | + spin_lock_irqsave(&cache_lock, flags); | 899 | + spin_lock_irqsave(&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->name); | 903 | strcpy(name, obj->name); |
904 | } | 904 | } |
905 | - up(&cache_lock); | 905 | - mutex_unlock(&cache_lock); |
906 | + spin_unlock_irqrestore(&cache_lock, flags); | 906 | + spin_unlock_irqrestore(&cache_lock, flags); |
907 | return ret; | 907 | return ret; |
908 | } | 908 | } |
diff --git a/Documentation/DocBook/rapidio.tmpl b/Documentation/DocBook/rapidio.tmpl index 1becf27ba27e..a8b88c47e809 100644 --- a/Documentation/DocBook/rapidio.tmpl +++ b/Documentation/DocBook/rapidio.tmpl | |||
@@ -133,9 +133,9 @@ | |||
133 | !Idrivers/rapidio/rio-sysfs.c | 133 | !Idrivers/rapidio/rio-sysfs.c |
134 | </sect1> | 134 | </sect1> |
135 | <sect1><title>PPC32 support</title> | 135 | <sect1><title>PPC32 support</title> |
136 | !Iarch/ppc/kernel/rio.c | 136 | !Iarch/powerpc/kernel/rio.c |
137 | !Earch/ppc/syslib/ppc85xx_rio.c | 137 | !Earch/powerpc/sysdev/fsl_rio.c |
138 | !Iarch/ppc/syslib/ppc85xx_rio.c | 138 | !Iarch/powerpc/sysdev/fsl_rio.c |
139 | </sect1> | 139 | </sect1> |
140 | </chapter> | 140 | </chapter> |
141 | 141 | ||
diff --git a/Documentation/DocBook/s390-drivers.tmpl b/Documentation/DocBook/s390-drivers.tmpl index 254e769282a4..4acc73240a6d 100644 --- a/Documentation/DocBook/s390-drivers.tmpl +++ b/Documentation/DocBook/s390-drivers.tmpl | |||
@@ -59,7 +59,7 @@ | |||
59 | <title>Introduction</title> | 59 | <title>Introduction</title> |
60 | <para> | 60 | <para> |
61 | This document describes the interfaces available for device drivers that | 61 | This document describes the interfaces available for device drivers that |
62 | drive s390 based channel attached devices. This includes interfaces for | 62 | drive s390 based channel attached I/O devices. This includes interfaces for |
63 | interaction with the hardware and interfaces for interacting with the | 63 | interaction with the hardware and interfaces for interacting with the |
64 | common driver core. Those interfaces are provided by the s390 common I/O | 64 | common driver core. Those interfaces are provided by the s390 common I/O |
65 | layer. | 65 | layer. |
@@ -86,9 +86,10 @@ | |||
86 | The ccw bus typically contains the majority of devices available to | 86 | The ccw bus typically contains the majority of devices available to |
87 | a s390 system. Named after the channel command word (ccw), the basic | 87 | a s390 system. Named after the channel command word (ccw), the basic |
88 | command structure used to address its devices, the ccw bus contains | 88 | command structure used to address its devices, the ccw bus contains |
89 | so-called channel attached devices. They are addressed via subchannels, | 89 | so-called channel attached devices. They are addressed via I/O |
90 | visible on the css bus. A device driver, however, will never interact | 90 | subchannels, visible on the css bus. A device driver for |
91 | with the subchannel directly, but only via the device on the ccw bus, | 91 | channel-attached devices, however, will never interact with the |
92 | subchannel directly, but only via the I/O device on the ccw bus, | ||
92 | the ccw device. | 93 | the ccw device. |
93 | </para> | 94 | </para> |
94 | <sect1 id="channelIO"> | 95 | <sect1 id="channelIO"> |
@@ -146,4 +147,15 @@ | |||
146 | </sect1> | 147 | </sect1> |
147 | </chapter> | 148 | </chapter> |
148 | 149 | ||
150 | <chapter id="genericinterfaces"> | ||
151 | <title>Generic interfaces</title> | ||
152 | <para> | ||
153 | Some interfaces are available to other drivers that do not necessarily | ||
154 | have anything to do with the busses described above, but still are | ||
155 | indirectly using basic infrastructure in the common I/O layer. | ||
156 | One example is the support for adapter interrupts. | ||
157 | </para> | ||
158 | !Edrivers/s390/cio/airq.c | ||
159 | </chapter> | ||
160 | |||
149 | </book> | 161 | </book> |
diff --git a/Documentation/DocBook/scsi.tmpl b/Documentation/DocBook/scsi.tmpl new file mode 100644 index 000000000000..f299ab182bbe --- /dev/null +++ b/Documentation/DocBook/scsi.tmpl | |||
@@ -0,0 +1,409 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="scsimid"> | ||
6 | <bookinfo> | ||
7 | <title>SCSI Interfaces Guide</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>James</firstname> | ||
12 | <surname>Bottomley</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>James.Bottomley@steeleye.com</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | |||
20 | <author> | ||
21 | <firstname>Rob</firstname> | ||
22 | <surname>Landley</surname> | ||
23 | <affiliation> | ||
24 | <address> | ||
25 | <email>rob@landley.net</email> | ||
26 | </address> | ||
27 | </affiliation> | ||
28 | </author> | ||
29 | |||
30 | </authorgroup> | ||
31 | |||
32 | <copyright> | ||
33 | <year>2007</year> | ||
34 | <holder>Linux Foundation</holder> | ||
35 | </copyright> | ||
36 | |||
37 | <legalnotice> | ||
38 | <para> | ||
39 | This documentation is free software; you can redistribute | ||
40 | it and/or modify it under the terms of the GNU General Public | ||
41 | License version 2. | ||
42 | </para> | ||
43 | |||
44 | <para> | ||
45 | This program is distributed in the hope that it will be | ||
46 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
47 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
48 | For more details see the file COPYING in the source | ||
49 | distribution of Linux. | ||
50 | </para> | ||
51 | </legalnotice> | ||
52 | </bookinfo> | ||
53 | |||
54 | <toc></toc> | ||
55 | |||
56 | <chapter id="intro"> | ||
57 | <title>Introduction</title> | ||
58 | <sect1 id="protocol_vs_bus"> | ||
59 | <title>Protocol vs bus</title> | ||
60 | <para> | ||
61 | Once upon a time, the Small Computer Systems Interface defined both | ||
62 | a parallel I/O bus and a data protocol to connect a wide variety of | ||
63 | peripherals (disk drives, tape drives, modems, printers, scanners, | ||
64 | optical drives, test equipment, and medical devices) to a host | ||
65 | computer. | ||
66 | </para> | ||
67 | <para> | ||
68 | Although the old parallel (fast/wide/ultra) SCSI bus has largely | ||
69 | fallen out of use, the SCSI command set is more widely used than ever | ||
70 | to communicate with devices over a number of different busses. | ||
71 | </para> | ||
72 | <para> | ||
73 | The <ulink url='http://www.t10.org/scsi-3.htm'>SCSI protocol</ulink> | ||
74 | is a big-endian peer-to-peer packet based protocol. SCSI commands | ||
75 | are 6, 10, 12, or 16 bytes long, often followed by an associated data | ||
76 | payload. | ||
77 | </para> | ||
78 | <para> | ||
79 | SCSI commands can be transported over just about any kind of bus, and | ||
80 | are the default protocol for storage devices attached to USB, SATA, | ||
81 | SAS, Fibre Channel, FireWire, and ATAPI devices. SCSI packets are | ||
82 | also commonly exchanged over Infiniband, | ||
83 | <ulink url='http://i2o.shadowconnect.com/faq.php'>I20</ulink>, TCP/IP | ||
84 | (<ulink url='http://en.wikipedia.org/wiki/ISCSI'>iSCSI</ulink>), even | ||
85 | <ulink url='http://cyberelk.net/tim/parport/parscsi.html'>Parallel | ||
86 | ports</ulink>. | ||
87 | </para> | ||
88 | </sect1> | ||
89 | <sect1 id="subsystem_design"> | ||
90 | <title>Design of the Linux SCSI subsystem</title> | ||
91 | <para> | ||
92 | The SCSI subsystem uses a three layer design, with upper, mid, and low | ||
93 | layers. Every operation involving the SCSI subsystem (such as reading | ||
94 | a sector from a disk) uses one driver at each of the 3 levels: one | ||
95 | upper layer driver, one lower layer driver, and the SCSI midlayer. | ||
96 | </para> | ||
97 | <para> | ||
98 | The SCSI upper layer provides the interface between userspace and the | ||
99 | kernel, in the form of block and char device nodes for I/O and | ||
100 | ioctl(). The SCSI lower layer contains drivers for specific hardware | ||
101 | devices. | ||
102 | </para> | ||
103 | <para> | ||
104 | In between is the SCSI mid-layer, analogous to a network routing | ||
105 | layer such as the IPv4 stack. The SCSI mid-layer routes a packet | ||
106 | based data protocol between the upper layer's /dev nodes and the | ||
107 | corresponding devices in the lower layer. It manages command queues, | ||
108 | provides error handling and power management functions, and responds | ||
109 | to ioctl() requests. | ||
110 | </para> | ||
111 | </sect1> | ||
112 | </chapter> | ||
113 | |||
114 | <chapter id="upper_layer"> | ||
115 | <title>SCSI upper layer</title> | ||
116 | <para> | ||
117 | The upper layer supports the user-kernel interface by providing | ||
118 | device nodes. | ||
119 | </para> | ||
120 | <sect1 id="sd"> | ||
121 | <title>sd (SCSI Disk)</title> | ||
122 | <para>sd (sd_mod.o)</para> | ||
123 | <!-- !Idrivers/scsi/sd.c --> | ||
124 | </sect1> | ||
125 | <sect1 id="sr"> | ||
126 | <title>sr (SCSI CD-ROM)</title> | ||
127 | <para>sr (sr_mod.o)</para> | ||
128 | </sect1> | ||
129 | <sect1 id="st"> | ||
130 | <title>st (SCSI Tape)</title> | ||
131 | <para>st (st.o)</para> | ||
132 | </sect1> | ||
133 | <sect1 id="sg"> | ||
134 | <title>sg (SCSI Generic)</title> | ||
135 | <para>sg (sg.o)</para> | ||
136 | </sect1> | ||
137 | <sect1 id="ch"> | ||
138 | <title>ch (SCSI Media Changer)</title> | ||
139 | <para>ch (ch.c)</para> | ||
140 | </sect1> | ||
141 | </chapter> | ||
142 | |||
143 | <chapter id="mid_layer"> | ||
144 | <title>SCSI mid layer</title> | ||
145 | |||
146 | <sect1 id="midlayer_implementation"> | ||
147 | <title>SCSI midlayer implementation</title> | ||
148 | <sect2 id="scsi_device.h"> | ||
149 | <title>include/scsi/scsi_device.h</title> | ||
150 | <para> | ||
151 | </para> | ||
152 | !Iinclude/scsi/scsi_device.h | ||
153 | </sect2> | ||
154 | |||
155 | <sect2 id="scsi.c"> | ||
156 | <title>drivers/scsi/scsi.c</title> | ||
157 | <para>Main file for the SCSI midlayer.</para> | ||
158 | !Edrivers/scsi/scsi.c | ||
159 | </sect2> | ||
160 | <sect2 id="scsicam.c"> | ||
161 | <title>drivers/scsi/scsicam.c</title> | ||
162 | <para> | ||
163 | <ulink url='http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf'>SCSI | ||
164 | Common Access Method</ulink> support functions, for use with | ||
165 | HDIO_GETGEO, etc. | ||
166 | </para> | ||
167 | !Edrivers/scsi/scsicam.c | ||
168 | </sect2> | ||
169 | <sect2 id="scsi_error.c"> | ||
170 | <title>drivers/scsi/scsi_error.c</title> | ||
171 | <para>Common SCSI error/timeout handling routines.</para> | ||
172 | !Edrivers/scsi/scsi_error.c | ||
173 | </sect2> | ||
174 | <sect2 id="scsi_devinfo.c"> | ||
175 | <title>drivers/scsi/scsi_devinfo.c</title> | ||
176 | <para> | ||
177 | Manage scsi_dev_info_list, which tracks blacklisted and whitelisted | ||
178 | devices. | ||
179 | </para> | ||
180 | !Idrivers/scsi/scsi_devinfo.c | ||
181 | </sect2> | ||
182 | <sect2 id="scsi_ioctl.c"> | ||
183 | <title>drivers/scsi/scsi_ioctl.c</title> | ||
184 | <para> | ||
185 | Handle ioctl() calls for SCSI devices. | ||
186 | </para> | ||
187 | !Edrivers/scsi/scsi_ioctl.c | ||
188 | </sect2> | ||
189 | <sect2 id="scsi_lib.c"> | ||
190 | <title>drivers/scsi/scsi_lib.c</title> | ||
191 | <para> | ||
192 | SCSI queuing library. | ||
193 | </para> | ||
194 | !Edrivers/scsi/scsi_lib.c | ||
195 | </sect2> | ||
196 | <sect2 id="scsi_lib_dma.c"> | ||
197 | <title>drivers/scsi/scsi_lib_dma.c</title> | ||
198 | <para> | ||
199 | SCSI library functions depending on DMA | ||
200 | (map and unmap scatter-gather lists). | ||
201 | </para> | ||
202 | !Edrivers/scsi/scsi_lib_dma.c | ||
203 | </sect2> | ||
204 | <sect2 id="scsi_module.c"> | ||
205 | <title>drivers/scsi/scsi_module.c</title> | ||
206 | <para> | ||
207 | The file drivers/scsi/scsi_module.c contains legacy support for | ||
208 | old-style host templates. It should never be used by any new driver. | ||
209 | </para> | ||
210 | </sect2> | ||
211 | <sect2 id="scsi_proc.c"> | ||
212 | <title>drivers/scsi/scsi_proc.c</title> | ||
213 | <para> | ||
214 | The functions in this file provide an interface between | ||
215 | the PROC file system and the SCSI device drivers | ||
216 | It is mainly used for debugging, statistics and to pass | ||
217 | information directly to the lowlevel driver. | ||
218 | |||
219 | I.E. plumbing to manage /proc/scsi/* | ||
220 | </para> | ||
221 | !Idrivers/scsi/scsi_proc.c | ||
222 | </sect2> | ||
223 | <sect2 id="scsi_netlink.c"> | ||
224 | <title>drivers/scsi/scsi_netlink.c</title> | ||
225 | <para> | ||
226 | Infrastructure to provide async events from transports to userspace | ||
227 | via netlink, using a single NETLINK_SCSITRANSPORT protocol for all | ||
228 | transports. | ||
229 | |||
230 | See <ulink url='http://marc.info/?l=linux-scsi&m=115507374832500&w=2'>the | ||
231 | original patch submission</ulink> for more details. | ||
232 | </para> | ||
233 | !Idrivers/scsi/scsi_netlink.c | ||
234 | </sect2> | ||
235 | <sect2 id="scsi_scan.c"> | ||
236 | <title>drivers/scsi/scsi_scan.c</title> | ||
237 | <para> | ||
238 | Scan a host to determine which (if any) devices are attached. | ||
239 | |||
240 | The general scanning/probing algorithm is as follows, exceptions are | ||
241 | made to it depending on device specific flags, compilation options, | ||
242 | and global variable (boot or module load time) settings. | ||
243 | |||
244 | A specific LUN is scanned via an INQUIRY command; if the LUN has a | ||
245 | device attached, a scsi_device is allocated and setup for it. | ||
246 | |||
247 | For every id of every channel on the given host, start by scanning | ||
248 | LUN 0. Skip hosts that don't respond at all to a scan of LUN 0. | ||
249 | Otherwise, if LUN 0 has a device attached, allocate and setup a | ||
250 | scsi_device for it. If target is SCSI-3 or up, issue a REPORT LUN, | ||
251 | and scan all of the LUNs returned by the REPORT LUN; else, | ||
252 | sequentially scan LUNs up until some maximum is reached, or a LUN is | ||
253 | seen that cannot have a device attached to it. | ||
254 | </para> | ||
255 | !Idrivers/scsi/scsi_scan.c | ||
256 | </sect2> | ||
257 | <sect2 id="scsi_sysctl.c"> | ||
258 | <title>drivers/scsi/scsi_sysctl.c</title> | ||
259 | <para> | ||
260 | Set up the sysctl entry: "/dev/scsi/logging_level" | ||
261 | (DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level. | ||
262 | </para> | ||
263 | </sect2> | ||
264 | <sect2 id="scsi_sysfs.c"> | ||
265 | <title>drivers/scsi/scsi_sysfs.c</title> | ||
266 | <para> | ||
267 | SCSI sysfs interface routines. | ||
268 | </para> | ||
269 | !Edrivers/scsi/scsi_sysfs.c | ||
270 | </sect2> | ||
271 | <sect2 id="hosts.c"> | ||
272 | <title>drivers/scsi/hosts.c</title> | ||
273 | <para> | ||
274 | mid to lowlevel SCSI driver interface | ||
275 | </para> | ||
276 | !Edrivers/scsi/hosts.c | ||
277 | </sect2> | ||
278 | <sect2 id="constants.c"> | ||
279 | <title>drivers/scsi/constants.c</title> | ||
280 | <para> | ||
281 | mid to lowlevel SCSI driver interface | ||
282 | </para> | ||
283 | !Edrivers/scsi/constants.c | ||
284 | </sect2> | ||
285 | </sect1> | ||
286 | |||
287 | <sect1 id="Transport_classes"> | ||
288 | <title>Transport classes</title> | ||
289 | <para> | ||
290 | Transport classes are service libraries for drivers in the SCSI | ||
291 | lower layer, which expose transport attributes in sysfs. | ||
292 | </para> | ||
293 | <sect2 id="Fibre_Channel_transport"> | ||
294 | <title>Fibre Channel transport</title> | ||
295 | <para> | ||
296 | The file drivers/scsi/scsi_transport_fc.c defines transport attributes | ||
297 | for Fibre Channel. | ||
298 | </para> | ||
299 | !Edrivers/scsi/scsi_transport_fc.c | ||
300 | </sect2> | ||
301 | <sect2 id="iSCSI_transport"> | ||
302 | <title>iSCSI transport class</title> | ||
303 | <para> | ||
304 | The file drivers/scsi/scsi_transport_iscsi.c defines transport | ||
305 | attributes for the iSCSI class, which sends SCSI packets over TCP/IP | ||
306 | connections. | ||
307 | </para> | ||
308 | !Edrivers/scsi/scsi_transport_iscsi.c | ||
309 | </sect2> | ||
310 | <sect2 id="SAS_transport"> | ||
311 | <title>Serial Attached SCSI (SAS) transport class</title> | ||
312 | <para> | ||
313 | The file drivers/scsi/scsi_transport_sas.c defines transport | ||
314 | attributes for Serial Attached SCSI, a variant of SATA aimed at | ||
315 | large high-end systems. | ||
316 | </para> | ||
317 | <para> | ||
318 | The SAS transport class contains common code to deal with SAS HBAs, | ||
319 | an aproximated representation of SAS topologies in the driver model, | ||
320 | and various sysfs attributes to expose these topologies and managment | ||
321 | interfaces to userspace. | ||
322 | </para> | ||
323 | <para> | ||
324 | In addition to the basic SCSI core objects this transport class | ||
325 | introduces two additional intermediate objects: The SAS PHY | ||
326 | as represented by struct sas_phy defines an "outgoing" PHY on | ||
327 | a SAS HBA or Expander, and the SAS remote PHY represented by | ||
328 | struct sas_rphy defines an "incoming" PHY on a SAS Expander or | ||
329 | end device. Note that this is purely a software concept, the | ||
330 | underlying hardware for a PHY and a remote PHY is the exactly | ||
331 | the same. | ||
332 | </para> | ||
333 | <para> | ||
334 | There is no concept of a SAS port in this code, users can see | ||
335 | what PHYs form a wide port based on the port_identifier attribute, | ||
336 | which is the same for all PHYs in a port. | ||
337 | </para> | ||
338 | !Edrivers/scsi/scsi_transport_sas.c | ||
339 | </sect2> | ||
340 | <sect2 id="SATA_transport"> | ||
341 | <title>SATA transport class</title> | ||
342 | <para> | ||
343 | The SATA transport is handled by libata, which has its own book of | ||
344 | documentation in this directory. | ||
345 | </para> | ||
346 | </sect2> | ||
347 | <sect2 id="SPI_transport"> | ||
348 | <title>Parallel SCSI (SPI) transport class</title> | ||
349 | <para> | ||
350 | The file drivers/scsi/scsi_transport_spi.c defines transport | ||
351 | attributes for traditional (fast/wide/ultra) SCSI busses. | ||
352 | </para> | ||
353 | !Edrivers/scsi/scsi_transport_spi.c | ||
354 | </sect2> | ||
355 | <sect2 id="SRP_transport"> | ||
356 | <title>SCSI RDMA (SRP) transport class</title> | ||
357 | <para> | ||
358 | The file drivers/scsi/scsi_transport_srp.c defines transport | ||
359 | attributes for SCSI over Remote Direct Memory Access. | ||
360 | </para> | ||
361 | !Edrivers/scsi/scsi_transport_srp.c | ||
362 | </sect2> | ||
363 | </sect1> | ||
364 | |||
365 | </chapter> | ||
366 | |||
367 | <chapter id="lower_layer"> | ||
368 | <title>SCSI lower layer</title> | ||
369 | <sect1 id="hba_drivers"> | ||
370 | <title>Host Bus Adapter transport types</title> | ||
371 | <para> | ||
372 | Many modern device controllers use the SCSI command set as a protocol to | ||
373 | communicate with their devices through many different types of physical | ||
374 | connections. | ||
375 | </para> | ||
376 | <para> | ||
377 | In SCSI language a bus capable of carrying SCSI commands is | ||
378 | called a "transport", and a controller connecting to such a bus is | ||
379 | called a "host bus adapter" (HBA). | ||
380 | </para> | ||
381 | <sect2 id="scsi_debug.c"> | ||
382 | <title>Debug transport</title> | ||
383 | <para> | ||
384 | The file drivers/scsi/scsi_debug.c simulates a host adapter with a | ||
385 | variable number of disks (or disk like devices) attached, sharing a | ||
386 | common amount of RAM. Does a lot of checking to make sure that we are | ||
387 | not getting blocks mixed up, and panics the kernel if anything out of | ||
388 | the ordinary is seen. | ||
389 | </para> | ||
390 | <para> | ||
391 | To be more realistic, the simulated devices have the transport | ||
392 | attributes of SAS disks. | ||
393 | </para> | ||
394 | <para> | ||
395 | For documentation see | ||
396 | <ulink url='http://www.torque.net/sg/sdebug26.html'>http://www.torque.net/sg/sdebug26.html</ulink> | ||
397 | </para> | ||
398 | <!-- !Edrivers/scsi/scsi_debug.c --> | ||
399 | </sect2> | ||
400 | <sect2 id="todo"> | ||
401 | <title>todo</title> | ||
402 | <para>Parallel (fast/wide/ultra) SCSI, USB, SATA, | ||
403 | SAS, Fibre Channel, FireWire, ATAPI devices, Infiniband, | ||
404 | I20, iSCSI, Parallel ports, netlink... | ||
405 | </para> | ||
406 | </sect2> | ||
407 | </sect1> | ||
408 | </chapter> | ||
409 | </book> | ||
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index c119484258b8..fdd7f4f887b7 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -30,6 +30,12 @@ | |||
30 | 30 | ||
31 | <revhistory> | 31 | <revhistory> |
32 | <revision> | 32 | <revision> |
33 | <revnumber>0.4</revnumber> | ||
34 | <date>2007-11-26</date> | ||
35 | <authorinitials>hjk</authorinitials> | ||
36 | <revremark>Removed section about uio_dummy.</revremark> | ||
37 | </revision> | ||
38 | <revision> | ||
33 | <revnumber>0.3</revnumber> | 39 | <revnumber>0.3</revnumber> |
34 | <date>2007-04-29</date> | 40 | <date>2007-04-29</date> |
35 | <authorinitials>hjk</authorinitials> | 41 | <authorinitials>hjk</authorinitials> |
@@ -94,6 +100,26 @@ interested in translating it, please email me | |||
94 | user space. This simplifies development and reduces the risk of | 100 | user space. This simplifies development and reduces the risk of |
95 | serious bugs within a kernel module. | 101 | serious bugs within a kernel module. |
96 | </para> | 102 | </para> |
103 | <para> | ||
104 | Please note that UIO is not an universal driver interface. Devices | ||
105 | that are already handled well by other kernel subsystems (like | ||
106 | networking or serial or USB) are no candidates for an UIO driver. | ||
107 | Hardware that is ideally suited for an UIO driver fulfills all of | ||
108 | the following: | ||
109 | </para> | ||
110 | <itemizedlist> | ||
111 | <listitem> | ||
112 | <para>The device has memory that can be mapped. The device can be | ||
113 | controlled completely by writing to this memory.</para> | ||
114 | </listitem> | ||
115 | <listitem> | ||
116 | <para>The device usually generates interrupts.</para> | ||
117 | </listitem> | ||
118 | <listitem> | ||
119 | <para>The device does not fit into one of the standard kernel | ||
120 | subsystems.</para> | ||
121 | </listitem> | ||
122 | </itemizedlist> | ||
97 | </sect1> | 123 | </sect1> |
98 | 124 | ||
99 | <sect1 id="thanks"> | 125 | <sect1 id="thanks"> |
@@ -174,8 +200,9 @@ interested in translating it, please email me | |||
174 | For cards that don't generate interrupts but need to be | 200 | For cards that don't generate interrupts but need to be |
175 | polled, there is the possibility to set up a timer that | 201 | polled, there is the possibility to set up a timer that |
176 | triggers the interrupt handler at configurable time intervals. | 202 | triggers the interrupt handler at configurable time intervals. |
177 | See <filename>drivers/uio/uio_dummy.c</filename> for an | 203 | This interrupt simulation is done by calling |
178 | example of this technique. | 204 | <function>uio_event_notify()</function> |
205 | from the timer's event handler. | ||
179 | </para> | 206 | </para> |
180 | 207 | ||
181 | <para> | 208 | <para> |
@@ -263,63 +290,11 @@ offset = N * getpagesize(); | |||
263 | </sect1> | 290 | </sect1> |
264 | </chapter> | 291 | </chapter> |
265 | 292 | ||
266 | <chapter id="using-uio_dummy" xreflabel="Using uio_dummy"> | ||
267 | <?dbhtml filename="using-uio_dummy.html"?> | ||
268 | <title>Using uio_dummy</title> | ||
269 | <para> | ||
270 | Well, there is no real use for uio_dummy. Its only purpose is | ||
271 | to test most parts of the UIO system (everything except | ||
272 | hardware interrupts), and to serve as an example for the | ||
273 | kernel module that you will have to write yourself. | ||
274 | </para> | ||
275 | |||
276 | <sect1 id="what_uio_dummy_does"> | ||
277 | <title>What uio_dummy does</title> | ||
278 | <para> | ||
279 | The kernel module <filename>uio_dummy.ko</filename> creates a | ||
280 | device that uses a timer to generate periodic interrupts. The | ||
281 | interrupt handler does nothing but increment a counter. The | ||
282 | driver adds two custom attributes, <varname>count</varname> | ||
283 | and <varname>freq</varname>, that appear under | ||
284 | <filename>/sys/devices/platform/uio_dummy/</filename>. | ||
285 | </para> | ||
286 | |||
287 | <para> | ||
288 | The attribute <varname>count</varname> can be read and | ||
289 | written. The associated file | ||
290 | <filename>/sys/devices/platform/uio_dummy/count</filename> | ||
291 | appears as a normal text file and contains the total number of | ||
292 | timer interrupts. If you look at it (e.g. using | ||
293 | <function>cat</function>), you'll notice it is slowly counting | ||
294 | up. | ||
295 | </para> | ||
296 | |||
297 | <para> | ||
298 | The attribute <varname>freq</varname> can be read and written. | ||
299 | The content of | ||
300 | <filename>/sys/devices/platform/uio_dummy/freq</filename> | ||
301 | represents the number of system timer ticks between two timer | ||
302 | interrupts. The default value of <varname>freq</varname> is | ||
303 | the value of the kernel variable <varname>HZ</varname>, which | ||
304 | gives you an interval of one second. Lower values will | ||
305 | increase the frequency. Try the following: | ||
306 | </para> | ||
307 | <programlisting format="linespecific"> | ||
308 | cd /sys/devices/platform/uio_dummy/ | ||
309 | echo 100 > freq | ||
310 | </programlisting> | ||
311 | <para> | ||
312 | Use <function>cat count</function> to see how the interrupt | ||
313 | frequency changes. | ||
314 | </para> | ||
315 | </sect1> | ||
316 | </chapter> | ||
317 | |||
318 | <chapter id="custom_kernel_module" xreflabel="Writing your own kernel module"> | 293 | <chapter id="custom_kernel_module" xreflabel="Writing your own kernel module"> |
319 | <?dbhtml filename="custom_kernel_module.html"?> | 294 | <?dbhtml filename="custom_kernel_module.html"?> |
320 | <title>Writing your own kernel module</title> | 295 | <title>Writing your own kernel module</title> |
321 | <para> | 296 | <para> |
322 | Please have a look at <filename>uio_dummy.c</filename> as an | 297 | Please have a look at <filename>uio_cif.c</filename> as an |
323 | example. The following paragraphs explain the different | 298 | example. The following paragraphs explain the different |
324 | sections of this file. | 299 | sections of this file. |
325 | </para> | 300 | </para> |
@@ -354,9 +329,8 @@ See the description below for details. | |||
354 | interrupt, it's your modules task to determine the irq number during | 329 | interrupt, it's your modules task to determine the irq number during |
355 | initialization. If you don't have a hardware generated interrupt but | 330 | initialization. If you don't have a hardware generated interrupt but |
356 | want to trigger the interrupt handler in some other way, set | 331 | want to trigger the interrupt handler in some other way, set |
357 | <varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>. The | 332 | <varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>. |
358 | uio_dummy module does this as it triggers the event mechanism in a timer | 333 | If you had no interrupt at all, you could set |
359 | routine. If you had no interrupt at all, you could set | ||
360 | <varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this | 334 | <varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this |
361 | rarely makes sense. | 335 | rarely makes sense. |
362 | </para></listitem> | 336 | </para></listitem> |
diff --git a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl index b629da33951d..b3d93ee27693 100644 --- a/Documentation/DocBook/videobook.tmpl +++ b/Documentation/DocBook/videobook.tmpl | |||
@@ -96,7 +96,6 @@ static struct video_device my_radio | |||
96 | { | 96 | { |
97 | "My radio", | 97 | "My radio", |
98 | VID_TYPE_TUNER, | 98 | VID_TYPE_TUNER, |
99 | VID_HARDWARE_MYRADIO, | ||
100 | radio_open. | 99 | radio_open. |
101 | radio_close, | 100 | radio_close, |
102 | NULL, /* no read */ | 101 | NULL, /* no read */ |
@@ -119,13 +118,6 @@ static struct video_device my_radio | |||
119 | way to change channel so it is tuneable. | 118 | way to change channel so it is tuneable. |
120 | </para> | 119 | </para> |
121 | <para> | 120 | <para> |
122 | The VID_HARDWARE_ types are unique to each device. Numbers are assigned by | ||
123 | <email>alan@redhat.com</email> when device drivers are going to be released. Until then you | ||
124 | can pull a suitably large number out of your hat and use it. 10000 should be | ||
125 | safe for a very long time even allowing for the huge number of vendors | ||
126 | making new and different radio cards at the moment. | ||
127 | </para> | ||
128 | <para> | ||
129 | We declare an open and close routine, but we do not need read or write, | 121 | We declare an open and close routine, but we do not need read or write, |
130 | which are used to read and write video data to or from the card itself. As | 122 | which are used to read and write video data to or from the card itself. As |
131 | we have no read or write there is no poll function. | 123 | we have no read or write there is no poll function. |
@@ -844,7 +836,6 @@ static struct video_device my_camera | |||
844 | "My Camera", | 836 | "My Camera", |
845 | VID_TYPE_OVERLAY|VID_TYPE_SCALES|\ | 837 | VID_TYPE_OVERLAY|VID_TYPE_SCALES|\ |
846 | VID_TYPE_CAPTURE|VID_TYPE_CHROMAKEY, | 838 | VID_TYPE_CAPTURE|VID_TYPE_CHROMAKEY, |
847 | VID_HARDWARE_MYCAMERA, | ||
848 | camera_open. | 839 | camera_open. |
849 | camera_close, | 840 | camera_close, |
850 | camera_read, /* no read */ | 841 | camera_read, /* no read */ |
diff --git a/Documentation/RCU/RTFP.txt b/Documentation/RCU/RTFP.txt index 6221464d1a7e..39ad8f56783a 100644 --- a/Documentation/RCU/RTFP.txt +++ b/Documentation/RCU/RTFP.txt | |||
@@ -9,8 +9,8 @@ The first thing resembling RCU was published in 1980, when Kung and Lehman | |||
9 | [Kung80] recommended use of a garbage collector to defer destruction | 9 | [Kung80] recommended use of a garbage collector to defer destruction |
10 | of nodes in a parallel binary search tree in order to simplify its | 10 | of nodes in a parallel binary search tree in order to simplify its |
11 | implementation. This works well in environments that have garbage | 11 | implementation. This works well in environments that have garbage |
12 | collectors, but current production garbage collectors incur significant | 12 | collectors, but most production garbage collectors incur significant |
13 | read-side overhead. | 13 | overhead. |
14 | 14 | ||
15 | In 1982, Manber and Ladner [Manber82,Manber84] recommended deferring | 15 | In 1982, Manber and Ladner [Manber82,Manber84] recommended deferring |
16 | destruction until all threads running at that time have terminated, again | 16 | destruction until all threads running at that time have terminated, again |
@@ -99,16 +99,25 @@ locking, reduces contention, reduces memory latency for readers, and | |||
99 | parallelizes pipeline stalls and memory latency for writers. However, | 99 | parallelizes pipeline stalls and memory latency for writers. However, |
100 | these techniques still impose significant read-side overhead in the | 100 | these techniques still impose significant read-side overhead in the |
101 | form of memory barriers. Researchers at Sun worked along similar lines | 101 | form of memory barriers. Researchers at Sun worked along similar lines |
102 | in the same timeframe [HerlihyLM02,HerlihyLMS03]. These techniques | 102 | in the same timeframe [HerlihyLM02]. These techniques can be thought |
103 | can be thought of as inside-out reference counts, where the count is | 103 | of as inside-out reference counts, where the count is represented by the |
104 | represented by the number of hazard pointers referencing a given data | 104 | number of hazard pointers referencing a given data structure (rather than |
105 | structure (rather than the more conventional counter field within the | 105 | the more conventional counter field within the data structure itself). |
106 | data structure itself). | 106 | |
107 | By the same token, RCU can be thought of as a "bulk reference count", | ||
108 | where some form of reference counter covers all reference by a given CPU | ||
109 | or thread during a set timeframe. This timeframe is related to, but | ||
110 | not necessarily exactly the same as, an RCU grace period. In classic | ||
111 | RCU, the reference counter is the per-CPU bit in the "bitmask" field, | ||
112 | and each such bit covers all references that might have been made by | ||
113 | the corresponding CPU during the prior grace period. Of course, RCU | ||
114 | can be thought of in other terms as well. | ||
107 | 115 | ||
108 | In 2003, the K42 group described how RCU could be used to create | 116 | In 2003, the K42 group described how RCU could be used to create |
109 | hot-pluggable implementations of operating-system functions. Later that | 117 | hot-pluggable implementations of operating-system functions [Appavoo03a]. |
110 | year saw a paper describing an RCU implementation of System V IPC | 118 | Later that year saw a paper describing an RCU implementation of System |
111 | [Arcangeli03], and an introduction to RCU in Linux Journal [McKenney03a]. | 119 | V IPC [Arcangeli03], and an introduction to RCU in Linux Journal |
120 | [McKenney03a]. | ||
112 | 121 | ||
113 | 2004 has seen a Linux-Journal article on use of RCU in dcache | 122 | 2004 has seen a Linux-Journal article on use of RCU in dcache |
114 | [McKenney04a], a performance comparison of locking to RCU on several | 123 | [McKenney04a], a performance comparison of locking to RCU on several |
@@ -117,10 +126,19 @@ number of operating-system kernels [PaulEdwardMcKenneyPhD], a paper | |||
117 | describing how to make RCU safe for soft-realtime applications [Sarma04c], | 126 | describing how to make RCU safe for soft-realtime applications [Sarma04c], |
118 | and a paper describing SELinux performance with RCU [JamesMorris04b]. | 127 | and a paper describing SELinux performance with RCU [JamesMorris04b]. |
119 | 128 | ||
120 | 2005 has seen further adaptation of RCU to realtime use, permitting | 129 | 2005 brought further adaptation of RCU to realtime use, permitting |
121 | preemption of RCU realtime critical sections [PaulMcKenney05a, | 130 | preemption of RCU realtime critical sections [PaulMcKenney05a, |
122 | PaulMcKenney05b]. | 131 | PaulMcKenney05b]. |
123 | 132 | ||
133 | 2006 saw the first best-paper award for an RCU paper [ThomasEHart2006a], | ||
134 | as well as further work on efficient implementations of preemptible | ||
135 | RCU [PaulEMcKenney2006b], but priority-boosting of RCU read-side critical | ||
136 | sections proved elusive. An RCU implementation permitting general | ||
137 | blocking in read-side critical sections appeared [PaulEMcKenney2006c], | ||
138 | Robert Olsson described an RCU-protected trie-hash combination | ||
139 | [RobertOlsson2006a]. | ||
140 | |||
141 | |||
124 | Bibtex Entries | 142 | Bibtex Entries |
125 | 143 | ||
126 | @article{Kung80 | 144 | @article{Kung80 |
@@ -203,6 +221,41 @@ Bibtex Entries | |||
203 | ,Address="New Orleans, LA" | 221 | ,Address="New Orleans, LA" |
204 | } | 222 | } |
205 | 223 | ||
224 | @conference{Pu95a, | ||
225 | Author = "Calton Pu and Tito Autrey and Andrew Black and Charles Consel and | ||
226 | Crispin Cowan and Jon Inouye and Lakshmi Kethana and Jonathan Walpole and | ||
227 | Ke Zhang", | ||
228 | Title = "Optimistic Incremental Specialization: Streamlining a Commercial | ||
229 | Operating System", | ||
230 | Booktitle = "15\textsuperscript{th} ACM Symposium on | ||
231 | Operating Systems Principles (SOSP'95)", | ||
232 | address = "Copper Mountain, CO", | ||
233 | month="December", | ||
234 | year="1995", | ||
235 | pages="314-321", | ||
236 | annotation=" | ||
237 | Uses a replugger, but with a flag to signal when people are | ||
238 | using the resource at hand. Only one reader at a time. | ||
239 | " | ||
240 | } | ||
241 | |||
242 | @conference{Cowan96a, | ||
243 | Author = "Crispin Cowan and Tito Autrey and Charles Krasic and | ||
244 | Calton Pu and Jonathan Walpole", | ||
245 | Title = "Fast Concurrent Dynamic Linking for an Adaptive Operating System", | ||
246 | Booktitle = "International Conference on Configurable Distributed Systems | ||
247 | (ICCDS'96)", | ||
248 | address = "Annapolis, MD", | ||
249 | month="May", | ||
250 | year="1996", | ||
251 | pages="108", | ||
252 | isbn="0-8186-7395-8", | ||
253 | annotation=" | ||
254 | Uses a replugger, but with a counter to signal when people are | ||
255 | using the resource at hand. Allows multiple readers. | ||
256 | " | ||
257 | } | ||
258 | |||
206 | @techreport{Slingwine95 | 259 | @techreport{Slingwine95 |
207 | ,author="John D. Slingwine and Paul E. McKenney" | 260 | ,author="John D. Slingwine and Paul E. McKenney" |
208 | ,title="Apparatus and Method for Achieving Reduced Overhead Mutual | 261 | ,title="Apparatus and Method for Achieving Reduced Overhead Mutual |
@@ -312,6 +365,49 @@ Andrea Arcangeli and Andi Kleen and Orran Krieger and Rusty Russell" | |||
312 | [Viewed June 23, 2004]" | 365 | [Viewed June 23, 2004]" |
313 | } | 366 | } |
314 | 367 | ||
368 | @conference{Michael02a | ||
369 | ,author="Maged M. Michael" | ||
370 | ,title="Safe Memory Reclamation for Dynamic Lock-Free Objects Using Atomic | ||
371 | Reads and Writes" | ||
372 | ,Year="2002" | ||
373 | ,Month="August" | ||
374 | ,booktitle="{Proceedings of the 21\textsuperscript{st} Annual ACM | ||
375 | Symposium on Principles of Distributed Computing}" | ||
376 | ,pages="21-30" | ||
377 | ,annotation=" | ||
378 | Each thread keeps an array of pointers to items that it is | ||
379 | currently referencing. Sort of an inside-out garbage collection | ||
380 | mechanism, but one that requires the accessing code to explicitly | ||
381 | state its needs. Also requires read-side memory barriers on | ||
382 | most architectures. | ||
383 | " | ||
384 | } | ||
385 | |||
386 | @conference{Michael02b | ||
387 | ,author="Maged M. Michael" | ||
388 | ,title="High Performance Dynamic Lock-Free Hash Tables and List-Based Sets" | ||
389 | ,Year="2002" | ||
390 | ,Month="August" | ||
391 | ,booktitle="{Proceedings of the 14\textsuperscript{th} Annual ACM | ||
392 | Symposium on Parallel | ||
393 | Algorithms and Architecture}" | ||
394 | ,pages="73-82" | ||
395 | ,annotation=" | ||
396 | Like the title says... | ||
397 | " | ||
398 | } | ||
399 | |||
400 | @InProceedings{HerlihyLM02 | ||
401 | ,author={Maurice Herlihy and Victor Luchangco and Mark Moir} | ||
402 | ,title="The Repeat Offender Problem: A Mechanism for Supporting Dynamic-Sized, | ||
403 | Lock-Free Data Structures" | ||
404 | ,booktitle={Proceedings of 16\textsuperscript{th} International | ||
405 | Symposium on Distributed Computing} | ||
406 | ,year=2002 | ||
407 | ,month="October" | ||
408 | ,pages="339-353" | ||
409 | } | ||
410 | |||
315 | @article{Appavoo03a | 411 | @article{Appavoo03a |
316 | ,author="J. Appavoo and K. Hui and C. A. N. Soules and R. W. Wisniewski and | 412 | ,author="J. Appavoo and K. Hui and C. A. N. Soules and R. W. Wisniewski and |
317 | D. M. {Da Silva} and O. Krieger and M. A. Auslander and D. J. Edelsohn and | 413 | D. M. {Da Silva} and O. Krieger and M. A. Auslander and D. J. Edelsohn and |
@@ -447,3 +543,95 @@ Oregon Health and Sciences University" | |||
447 | Realtime turns into making RCU yet more realtime friendly. | 543 | Realtime turns into making RCU yet more realtime friendly. |
448 | " | 544 | " |
449 | } | 545 | } |
546 | |||
547 | @conference{ThomasEHart2006a | ||
548 | ,Author="Thomas E. Hart and Paul E. McKenney and Angela Demke Brown" | ||
549 | ,Title="Making Lockless Synchronization Fast: Performance Implications | ||
550 | of Memory Reclamation" | ||
551 | ,Booktitle="20\textsuperscript{th} {IEEE} International Parallel and | ||
552 | Distributed Processing Symposium" | ||
553 | ,month="April" | ||
554 | ,year="2006" | ||
555 | ,day="25-29" | ||
556 | ,address="Rhodes, Greece" | ||
557 | ,annotation=" | ||
558 | Compares QSBR (AKA "classic RCU"), HPBR, EBR, and lock-free | ||
559 | reference counting. | ||
560 | " | ||
561 | } | ||
562 | |||
563 | @Conference{PaulEMcKenney2006b | ||
564 | ,Author="Paul E. McKenney and Dipankar Sarma and Ingo Molnar and | ||
565 | Suparna Bhattacharya" | ||
566 | ,Title="Extending RCU for Realtime and Embedded Workloads" | ||
567 | ,Booktitle="{Ottawa Linux Symposium}" | ||
568 | ,Month="July" | ||
569 | ,Year="2006" | ||
570 | ,pages="v2 123-138" | ||
571 | ,note="Available: | ||
572 | \url{http://www.linuxsymposium.org/2006/view_abstract.php?content_key=184} | ||
573 | \url{http://www.rdrop.com/users/paulmck/RCU/OLSrtRCU.2006.08.11a.pdf} | ||
574 | [Viewed January 1, 2007]" | ||
575 | ,annotation=" | ||
576 | Described how to improve the -rt implementation of realtime RCU. | ||
577 | " | ||
578 | } | ||
579 | |||
580 | @unpublished{PaulEMcKenney2006c | ||
581 | ,Author="Paul E. McKenney" | ||
582 | ,Title="Sleepable {RCU}" | ||
583 | ,month="October" | ||
584 | ,day="9" | ||
585 | ,year="2006" | ||
586 | ,note="Available: | ||
587 | \url{http://lwn.net/Articles/202847/} | ||
588 | Revised: | ||
589 | \url{http://www.rdrop.com/users/paulmck/RCU/srcu.2007.01.14a.pdf} | ||
590 | [Viewed August 21, 2006]" | ||
591 | ,annotation=" | ||
592 | LWN article introducing SRCU. | ||
593 | " | ||
594 | } | ||
595 | |||
596 | @unpublished{RobertOlsson2006a | ||
597 | ,Author="Robert Olsson and Stefan Nilsson" | ||
598 | ,Title="{TRASH}: A dynamic {LC}-trie and hash data structure" | ||
599 | ,month="August" | ||
600 | ,day="18" | ||
601 | ,year="2006" | ||
602 | ,note="Available: | ||
603 | \url{http://www.nada.kth.se/~snilsson/public/papers/trash/trash.pdf} | ||
604 | [Viewed February 24, 2007]" | ||
605 | ,annotation=" | ||
606 | RCU-protected dynamic trie-hash combination. | ||
607 | " | ||
608 | } | ||
609 | |||
610 | @unpublished{ThomasEHart2007a | ||
611 | ,Author="Thomas E. Hart and Paul E. McKenney and Angela Demke Brown and Jonathan Walpole" | ||
612 | ,Title="Performance of memory reclamation for lockless synchronization" | ||
613 | ,journal="J. Parallel Distrib. Comput." | ||
614 | ,year="2007" | ||
615 | ,note="To appear in J. Parallel Distrib. Comput. | ||
616 | \url{doi=10.1016/j.jpdc.2007.04.010}" | ||
617 | ,annotation={ | ||
618 | Compares QSBR (AKA "classic RCU"), HPBR, EBR, and lock-free | ||
619 | reference counting. Journal version of ThomasEHart2006a. | ||
620 | } | ||
621 | } | ||
622 | |||
623 | @unpublished{PaulEMcKenney2007QRCUspin | ||
624 | ,Author="Paul E. McKenney" | ||
625 | ,Title="Using Promela and Spin to verify parallel algorithms" | ||
626 | ,month="August" | ||
627 | ,day="1" | ||
628 | ,year="2007" | ||
629 | ,note="Available: | ||
630 | \url{http://lwn.net/Articles/243851/} | ||
631 | [Viewed September 8, 2007]" | ||
632 | ,annotation=" | ||
633 | LWN article describing Promela and spin, and also using Oleg | ||
634 | Nesterov's QRCU as an example (with Paul McKenney's fastpath). | ||
635 | " | ||
636 | } | ||
637 | |||
diff --git a/Documentation/RCU/rcu.txt b/Documentation/RCU/rcu.txt index f84407cba816..95821a29ae41 100644 --- a/Documentation/RCU/rcu.txt +++ b/Documentation/RCU/rcu.txt | |||
@@ -36,6 +36,14 @@ o How can the updater tell when a grace period has completed | |||
36 | executed in user mode, or executed in the idle loop, we can | 36 | executed in user mode, or executed in the idle loop, we can |
37 | safely free up that item. | 37 | safely free up that item. |
38 | 38 | ||
39 | Preemptible variants of RCU (CONFIG_PREEMPT_RCU) get the | ||
40 | same effect, but require that the readers manipulate CPU-local | ||
41 | counters. These counters allow limited types of blocking | ||
42 | within RCU read-side critical sections. SRCU also uses | ||
43 | CPU-local counters, and permits general blocking within | ||
44 | RCU read-side critical sections. These two variants of | ||
45 | RCU detect grace periods by sampling these counters. | ||
46 | |||
39 | o If I am running on a uniprocessor kernel, which can only do one | 47 | o If I am running on a uniprocessor kernel, which can only do one |
40 | thing at a time, why should I wait for a grace period? | 48 | thing at a time, why should I wait for a grace period? |
41 | 49 | ||
@@ -46,7 +54,10 @@ o How can I see where RCU is currently used in the Linux kernel? | |||
46 | Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu", | 54 | Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu", |
47 | "rcu_read_lock_bh", "rcu_read_unlock_bh", "call_rcu_bh", | 55 | "rcu_read_lock_bh", "rcu_read_unlock_bh", "call_rcu_bh", |
48 | "srcu_read_lock", "srcu_read_unlock", "synchronize_rcu", | 56 | "srcu_read_lock", "srcu_read_unlock", "synchronize_rcu", |
49 | "synchronize_net", and "synchronize_srcu". | 57 | "synchronize_net", "synchronize_srcu", and the other RCU |
58 | primitives. Or grab one of the cscope databases from: | ||
59 | |||
60 | http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html | ||
50 | 61 | ||
51 | o What guidelines should I follow when writing code that uses RCU? | 62 | o What guidelines should I follow when writing code that uses RCU? |
52 | 63 | ||
@@ -67,7 +78,11 @@ o I hear that RCU is patented? What is with that? | |||
67 | 78 | ||
68 | o I hear that RCU needs work in order to support realtime kernels? | 79 | o I hear that RCU needs work in order to support realtime kernels? |
69 | 80 | ||
70 | Yes, work in progress. | 81 | This work is largely completed. Realtime-friendly RCU can be |
82 | enabled via the CONFIG_PREEMPT_RCU kernel configuration parameter. | ||
83 | However, work is in progress for enabling priority boosting of | ||
84 | preempted RCU read-side critical sections.This is needed if you | ||
85 | have CPU-bound realtime threads. | ||
71 | 86 | ||
72 | o Where can I find more information on RCU? | 87 | o Where can I find more information on RCU? |
73 | 88 | ||
diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt index 25a3c3f7d378..2967a65269d8 100644 --- a/Documentation/RCU/torture.txt +++ b/Documentation/RCU/torture.txt | |||
@@ -46,12 +46,13 @@ stat_interval The number of seconds between output of torture | |||
46 | 46 | ||
47 | shuffle_interval | 47 | shuffle_interval |
48 | The number of seconds to keep the test threads affinitied | 48 | The number of seconds to keep the test threads affinitied |
49 | to a particular subset of the CPUs. Used in conjunction | 49 | to a particular subset of the CPUs, defaults to 5 seconds. |
50 | with test_no_idle_hz. | 50 | Used in conjunction with test_no_idle_hz. |
51 | 51 | ||
52 | test_no_idle_hz Whether or not to test the ability of RCU to operate in | 52 | test_no_idle_hz Whether or not to test the ability of RCU to operate in |
53 | a kernel that disables the scheduling-clock interrupt to | 53 | a kernel that disables the scheduling-clock interrupt to |
54 | idle CPUs. Boolean parameter, "1" to test, "0" otherwise. | 54 | idle CPUs. Boolean parameter, "1" to test, "0" otherwise. |
55 | Defaults to omitting this test. | ||
55 | 56 | ||
56 | torture_type The type of RCU to test: "rcu" for the rcu_read_lock() API, | 57 | torture_type The type of RCU to test: "rcu" for the rcu_read_lock() API, |
57 | "rcu_sync" for rcu_read_lock() with synchronous reclamation, | 58 | "rcu_sync" for rcu_read_lock() with synchronous reclamation, |
@@ -82,8 +83,6 @@ be evident. ;-) | |||
82 | 83 | ||
83 | The entries are as follows: | 84 | The entries are as follows: |
84 | 85 | ||
85 | o "ggp": The number of counter flips (or batches) since boot. | ||
86 | |||
87 | o "rtc": The hexadecimal address of the structure currently visible | 86 | o "rtc": The hexadecimal address of the structure currently visible |
88 | to readers. | 87 | to readers. |
89 | 88 | ||
@@ -117,8 +116,8 @@ o "Reader Pipe": Histogram of "ages" of structures seen by readers. | |||
117 | o "Reader Batch": Another histogram of "ages" of structures seen | 116 | o "Reader Batch": Another histogram of "ages" of structures seen |
118 | by readers, but in terms of counter flips (or batches) rather | 117 | by readers, but in terms of counter flips (or batches) rather |
119 | than in terms of grace periods. The legal number of non-zero | 118 | than in terms of grace periods. The legal number of non-zero |
120 | entries is again two. The reason for this separate view is | 119 | entries is again two. The reason for this separate view is that |
121 | that it is easier to get the third entry to show up in the | 120 | it is sometimes easier to get the third entry to show up in the |
122 | "Reader Batch" list than in the "Reader Pipe" list. | 121 | "Reader Batch" list than in the "Reader Pipe" list. |
123 | 122 | ||
124 | o "Free-Block Circulation": Shows the number of torture structures | 123 | o "Free-Block Circulation": Shows the number of torture structures |
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 | |||
6 | Smack is the the Simplified Mandatory Access Control Kernel. | ||
7 | Smack is a kernel based implementation of mandatory access | ||
8 | control that includes simplicity in its primary design goals. | ||
9 | |||
10 | Smack is not the only Mandatory Access Control scheme | ||
11 | available for Linux. Those new to Mandatory Access Control | ||
12 | are encouraged to compare Smack with the other mechanisms | ||
13 | available to determine which is best suited to the problem | ||
14 | at hand. | ||
15 | |||
16 | Smack consists of three major components: | ||
17 | - The kernel | ||
18 | - A start-up script and a few modified applications | ||
19 | - Configuration data | ||
20 | |||
21 | The kernel component of Smack is implemented as a Linux | ||
22 | Security Modules (LSM) module. It requires netlabel and | ||
23 | works best with file systems that support extended attributes, | ||
24 | although xattr support is not strictly required. | ||
25 | It is safe to run a Smack kernel under a "vanilla" distribution. | ||
26 | Smack kernels use the CIPSO IP option. Some network | ||
27 | configurations are intolerant of IP options and can impede | ||
28 | access to systems that use them as Smack does. | ||
29 | |||
30 | The startup script etc-init.d-smack should be installed | ||
31 | in /etc/init.d/smack and should be invoked early in the | ||
32 | start-up process. On Fedora rc5.d/S02smack is recommended. | ||
33 | This script ensures that certain devices have the correct | ||
34 | Smack attributes and loads the Smack configuration if | ||
35 | any is defined. This script invokes two programs that | ||
36 | ensure configuration data is properly formatted. These | ||
37 | programs are /usr/sbin/smackload and /usr/sin/smackcipso. | ||
38 | The system will run just fine without these programs, | ||
39 | but it will be difficult to set access rules properly. | ||
40 | |||
41 | A version of "ls" that provides a "-M" option to display | ||
42 | Smack labels on long listing is available. | ||
43 | |||
44 | A hacked version of sshd that allows network logins by users | ||
45 | with specific Smack labels is available. This version does | ||
46 | not work for scp. You must set the /etc/ssh/sshd_config | ||
47 | line: | ||
48 | UsePrivilegeSeparation no | ||
49 | |||
50 | The format of /etc/smack/usr is: | ||
51 | |||
52 | username smack | ||
53 | |||
54 | In keeping with the intent of Smack, configuration data is | ||
55 | minimal and not strictly required. The most important | ||
56 | configuration step is mounting the smackfs pseudo filesystem. | ||
57 | |||
58 | Add this line to /etc/fstab: | ||
59 | |||
60 | smackfs /smack smackfs smackfsdef=* 0 0 | ||
61 | |||
62 | and create the /smack directory for mounting. | ||
63 | |||
64 | Smack uses extended attributes (xattrs) to store file labels. | ||
65 | The command to set a Smack label on a file is: | ||
66 | |||
67 | # attr -S -s SMACK64 -V "value" path | ||
68 | |||
69 | NOTE: 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 | |||
73 | If you don't do anything special all users will get the floor ("_") | ||
74 | label when they log in. If you do want to log in via the hacked ssh | ||
75 | at other labels use the attr command to set the smack value on the | ||
76 | home directory and it's contents. | ||
77 | |||
78 | You can add access rules in /etc/smack/accesses. They take the form: | ||
79 | |||
80 | subjectlabel objectlabel access | ||
81 | |||
82 | access is a combination of the letters rwxa which specify the | ||
83 | kind of access permitted a subject with subjectlabel on an | ||
84 | object with objectlabel. If there is no rule no access is allowed. | ||
85 | |||
86 | A process can see the smack label it is running with by | ||
87 | reading /proc/self/attr/current. A privileged process can | ||
88 | set the process smack by writing there. | ||
89 | |||
90 | Look for additional programs on http://schaufler-ca.com | ||
91 | |||
92 | From the Smack Whitepaper: | ||
93 | |||
94 | The Simplified Mandatory Access Control Kernel | ||
95 | |||
96 | Casey Schaufler | ||
97 | casey@schaufler-ca.com | ||
98 | |||
99 | Mandatory Access Control | ||
100 | |||
101 | Computer systems employ a variety of schemes to constrain how information is | ||
102 | shared among the people and services using the machine. Some of these schemes | ||
103 | allow the program or user to decide what other programs or users are allowed | ||
104 | access to pieces of data. These schemes are called discretionary access | ||
105 | control mechanisms because the access control is specified at the discretion | ||
106 | of the user. Other schemes do not leave the decision regarding what a user or | ||
107 | program can access up to users or programs. These schemes are called mandatory | ||
108 | access control mechanisms because you don't have a choice regarding the users | ||
109 | or programs that have access to pieces of data. | ||
110 | |||
111 | Bell & LaPadula | ||
112 | |||
113 | From the middle of the 1980's until the turn of the century Mandatory Access | ||
114 | Control (MAC) was very closely associated with the Bell & LaPadula security | ||
115 | model, a mathematical description of the United States Department of Defense | ||
116 | policy for marking paper documents. MAC in this form enjoyed a following | ||
117 | within the Capital Beltway and Scandinavian supercomputer centers but was | ||
118 | often sited as failing to address general needs. | ||
119 | |||
120 | Domain Type Enforcement | ||
121 | |||
122 | Around the turn of the century Domain Type Enforcement (DTE) became popular. | ||
123 | This scheme organizes users, programs, and data into domains that are | ||
124 | protected from each other. This scheme has been widely deployed as a component | ||
125 | of popular Linux distributions. The administrative overhead required to | ||
126 | maintain this scheme and the detailed understanding of the whole system | ||
127 | necessary to provide a secure domain mapping leads to the scheme being | ||
128 | disabled or used in limited ways in the majority of cases. | ||
129 | |||
130 | Smack | ||
131 | |||
132 | Smack is a Mandatory Access Control mechanism designed to provide useful MAC | ||
133 | while avoiding the pitfalls of its predecessors. The limitations of Bell & | ||
134 | LaPadula are addressed by providing a scheme whereby access can be controlled | ||
135 | according to the requirements of the system and its purpose rather than those | ||
136 | imposed by an arcane government policy. The complexity of Domain Type | ||
137 | Enforcement and avoided by defining access controls in terms of the access | ||
138 | modes already in use. | ||
139 | |||
140 | Smack Terminology | ||
141 | |||
142 | The jargon used to talk about Smack will be familiar to those who have dealt | ||
143 | with other MAC systems and shouldn't be too difficult for the uninitiated to | ||
144 | pick up. There are four terms that are used in a specific way and that are | ||
145 | especially 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 | |||
160 | These definitions are consistent with the traditional use in the security | ||
161 | community. 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 | |||
174 | Smack Basics | ||
175 | |||
176 | Smack is an extension to a Linux system. It enforces additional restrictions | ||
177 | on what subjects can access which objects, based on the labels attached to | ||
178 | each of the subject and the object. | ||
179 | |||
180 | Labels | ||
181 | |||
182 | Smack labels are ASCII character strings, one to twenty-three characters in | ||
183 | length. Single character labels using special characters, that being anything | ||
184 | other than a letter or digit, are reserved for use by the Smack development | ||
185 | team. Smack labels are unstructured, case sensitive, and the only operation | ||
186 | ever performed on them is comparison for equality. Smack labels cannot | ||
187 | contain unprintable characters or the "/" (slash) character. | ||
188 | |||
189 | There 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 | |||
196 | Every task on a Smack system is assigned a label. System tasks, such as | ||
197 | init(8) and systems daemons, are run with the floor ("_") label. User tasks | ||
198 | are assigned labels according to the specification found in the | ||
199 | /etc/smack/user configuration file. | ||
200 | |||
201 | Access Rules | ||
202 | |||
203 | Smack uses the traditional access modes of Linux. These modes are read, | ||
204 | execute, write, and occasionally append. There are a few cases where the | ||
205 | access 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 | |||
212 | Smack restricts access based on the label attached to a subject and the label | ||
213 | attached to the object it is trying to access. The rules enforced are, in | ||
214 | order: | ||
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 | |||
228 | Smack Access Rules | ||
229 | |||
230 | With the isolation provided by Smack access separation is simple. There are | ||
231 | many interesting cases where limited access by subjects to objects with | ||
232 | different labels is desired. One example is the familiar spy model of | ||
233 | sensitivity, where a scientist working on a highly classified project would be | ||
234 | able to read documents of lower classifications and anything she writes will | ||
235 | be "born" highly classified. To accommodate such schemes Smack includes a | ||
236 | mechanism for specifying rules allowing access between labels. | ||
237 | |||
238 | Access Rule Format | ||
239 | |||
240 | The format of an access rule is: | ||
241 | |||
242 | subject-label object-label access | ||
243 | |||
244 | Where subject-label is the Smack label of the task, object-label is the Smack | ||
245 | label of the thing being accessed, and access is a string specifying the sort | ||
246 | of access allowed. The Smack labels are limited to 23 characters. The access | ||
247 | specification 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 | |||
254 | Uppercase values for the specification letters are allowed as well. | ||
255 | Access mode specifications can be in any order. Examples of acceptable rules | ||
256 | are: | ||
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 | |||
265 | Examples of unacceptable rules are: | ||
266 | |||
267 | Top Secret Secret rx | ||
268 | Ace Ace r | ||
269 | Odd spells waxbeans | ||
270 | |||
271 | Spaces are not allowed in labels. Since a subject always has access to files | ||
272 | with the same label specifying a rule for that case is pointless. Only | ||
273 | valid letters (rwxaRWXA) and the dash ('-') character are allowed in | ||
274 | access specifications. The dash is a placeholder, so "a-r" is the same | ||
275 | as "ar". A lone dash is used to specify that no access should be allowed. | ||
276 | |||
277 | Applying Access Rules | ||
278 | |||
279 | The developers of Linux rarely define new sorts of things, usually importing | ||
280 | schemes and concepts from other systems. Most often, the other systems are | ||
281 | variants of Unix. Unix has many endearing properties, but consistency of | ||
282 | access control models is not one of them. Smack strives to treat accesses as | ||
283 | uniformly as is sensible while keeping with the spirit of the underlying | ||
284 | mechanism. | ||
285 | |||
286 | File system objects including files, directories, named pipes, symbolic links, | ||
287 | and devices require access permissions that closely match those used by mode | ||
288 | bit access. To open a file for reading read access is required on the file. To | ||
289 | search a directory requires execute access. Creating a file with write access | ||
290 | requires both read and write access on the containing directory. Deleting a | ||
291 | file requires read and write access to the file and to the containing | ||
292 | directory. It is possible that a user may be able to see that a file exists | ||
293 | but not any of its attributes by the circumstance of having read access to the | ||
294 | containing directory but not to the differently labeled file. This is an | ||
295 | artifact of the file name being data in the directory, not a part of the file. | ||
296 | |||
297 | IPC objects, message queues, semaphore sets, and memory segments exist in flat | ||
298 | namespaces and access requests are only required to match the object in | ||
299 | question. | ||
300 | |||
301 | Process objects reflect tasks on the system and the Smack label used to access | ||
302 | them is the same Smack label that the task would use for its own access | ||
303 | attempts. Sending a signal via the kill() system call is a write operation | ||
304 | from the signaler to the recipient. Debugging a process requires both reading | ||
305 | and writing. Creating a new task is an internal operation that results in two | ||
306 | tasks with identical Smack labels and requires no access checks. | ||
307 | |||
308 | Sockets are data structures attached to processes and sending a packet from | ||
309 | one process to another requires that the sender have write access to the | ||
310 | receiver. The receiver is not required to have read access to the sender. | ||
311 | |||
312 | Setting Access Rules | ||
313 | |||
314 | The configuration file /etc/smack/accesses contains the rules to be set at | ||
315 | system startup. The contents are written to the special file /smack/load. | ||
316 | Rules can be written to /smack/load at any time and take effect immediately. | ||
317 | For any pair of subject and object labels there can be only one rule, with the | ||
318 | most recently specified overriding any earlier specification. | ||
319 | |||
320 | The program smackload is provided to ensure data is formatted | ||
321 | properly when written to /smack/load. This program reads lines | ||
322 | of the form | ||
323 | |||
324 | subjectlabel objectlabel mode. | ||
325 | |||
326 | Task Attribute | ||
327 | |||
328 | The Smack label of a process can be read from /proc/<pid>/attr/current. A | ||
329 | process can read its own Smack label from /proc/self/attr/current. A | ||
330 | privileged process can change its own Smack label by writing to | ||
331 | /proc/self/attr/current but not the label of another process. | ||
332 | |||
333 | File Attribute | ||
334 | |||
335 | The Smack label of a filesystem object is stored as an extended attribute | ||
336 | named SMACK64 on the file. This attribute is in the security namespace. It can | ||
337 | only be changed by a process with privilege. | ||
338 | |||
339 | Privilege | ||
340 | |||
341 | A process with CAP_MAC_OVERRIDE is privileged. | ||
342 | |||
343 | Smack Networking | ||
344 | |||
345 | As mentioned before, Smack enforces access control on network protocol | ||
346 | transmissions. Every packet sent by a Smack process is tagged with its Smack | ||
347 | label. This is done by adding a CIPSO tag to the header of the IP packet. Each | ||
348 | packet received is expected to have a CIPSO tag that identifies the label and | ||
349 | if it lacks such a tag the network ambient label is assumed. Before the packet | ||
350 | is delivered a check is made to determine that a subject with the label on the | ||
351 | packet has write access to the receiving process and if that is not the case | ||
352 | the packet is dropped. | ||
353 | |||
354 | CIPSO Configuration | ||
355 | |||
356 | It is normally unnecessary to specify the CIPSO configuration. The default | ||
357 | values used by the system handle all internal cases. Smack will compose CIPSO | ||
358 | label values to match the Smack labels being used without administrative | ||
359 | intervention. Unlabeled packets that come into the system will be given the | ||
360 | ambient label. | ||
361 | |||
362 | Smack requires configuration in the case where packets from a system that is | ||
363 | not smack that speaks CIPSO may be encountered. Usually this will be a Trusted | ||
364 | Solaris system, but there are other, less widely deployed systems out there. | ||
365 | CIPSO provides 3 important values, a Domain Of Interpretation (DOI), a level, | ||
366 | and a category set with each packet. The DOI is intended to identify a group | ||
367 | of systems that use compatible labeling schemes, and the DOI specified on the | ||
368 | smack system must match that of the remote system or packets will be | ||
369 | discarded. The DOI is 3 by default. The value can be read from /smack/doi and | ||
370 | can be changed by writing to /smack/doi. | ||
371 | |||
372 | The label and category set are mapped to a Smack label as defined in | ||
373 | /etc/smack/cipso. | ||
374 | |||
375 | A Smack/CIPSO mapping has the form: | ||
376 | |||
377 | smack level [category [category]*] | ||
378 | |||
379 | Smack does not expect the level or category sets to be related in any | ||
380 | particular way and does not assume or assign accesses based on them. Some | ||
381 | examples 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 | |||
388 | The ":" and "," characters are permitted in a Smack label but have no special | ||
389 | meaning. | ||
390 | |||
391 | The 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 | ||
393 | is highly restrictive, so the program smackcipso is provided to | ||
394 | ensure the writes are done properly. This program takes mappings | ||
395 | on the standard input and sends them to /smack/cipso properly. | ||
396 | |||
397 | In addition to explicit mappings Smack supports direct CIPSO mappings. One | ||
398 | CIPSO level is used to indicate that the category set passed in the packet is | ||
399 | in fact an encoding of the Smack label. The level used is 250 by default. The | ||
400 | value can be read from /smack/direct and changed by writing to /smack/direct. | ||
401 | |||
402 | Socket Attributes | ||
403 | |||
404 | There are two attributes that are associated with sockets. These attributes | ||
405 | can only be set by privileged tasks, but any task can read them for their own | ||
406 | sockets. | ||
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 | |||
415 | Writing Applications for Smack | ||
416 | |||
417 | There are three sorts of applications that will run on a Smack system. How an | ||
418 | application interacts with Smack will determine what it will have to do to | ||
419 | work properly under Smack. | ||
420 | |||
421 | Smack Ignorant Applications | ||
422 | |||
423 | By far the majority of applications have no reason whatever to care about the | ||
424 | unique properties of Smack. Since invoking a program has no impact on the | ||
425 | Smack label associated with the process the only concern likely to arise is | ||
426 | whether the process has execute access to the program. | ||
427 | |||
428 | Smack Relevant Applications | ||
429 | |||
430 | Some programs can be improved by teaching them about Smack, but do not make | ||
431 | any security decisions themselves. The utility ls(1) is one example of such a | ||
432 | program. | ||
433 | |||
434 | Smack Enforcing Applications | ||
435 | |||
436 | These are special programs that not only know about Smack, but participate in | ||
437 | the enforcement of system policy. In most cases these are the programs that | ||
438 | set up user sessions. There are also network services that provide information | ||
439 | to processes running with various labels. | ||
440 | |||
441 | File System Interfaces | ||
442 | |||
443 | Smack maintains labels on file system objects using extended attributes. The | ||
444 | Smack label of a file, directory, or other file system object can be obtained | ||
445 | using getxattr(2). | ||
446 | |||
447 | len = getxattr("/", "security.SMACK64", value, sizeof (value)); | ||
448 | |||
449 | will put the Smack label of the root directory into value. A privileged | ||
450 | process 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 | |||
455 | will set the Smack label of /foo to "Rubble" if the program has appropriate | ||
456 | privilege. | ||
457 | |||
458 | Socket Interfaces | ||
459 | |||
460 | The socket attributes can be read using fgetxattr(2). | ||
461 | |||
462 | A privileged process can set the Smack label of outgoing packets with | ||
463 | fsetxattr(2). | ||
464 | |||
465 | len = strlen("Rubble"); | ||
466 | rc = fsetxattr(fd, "security.SMACK64IPOUT", "Rubble", len, 0); | ||
467 | |||
468 | will set the Smack label "Rubble" on packets going out from the socket if the | ||
469 | program has appropriate privilege. | ||
470 | |||
471 | rc = fsetxattr(fd, "security.SMACK64IPIN, "*", strlen("*"), 0); | ||
472 | |||
473 | will set the Smack label "*" as the object label against which incoming | ||
474 | packets will be checked if the program has appropriate privilege. | ||
475 | |||
476 | Administration | ||
477 | |||
478 | Smack 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 | |||
492 | These 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. | |||
220 | Exception: If your mailer is mangling patches then someone may ask | 220 | Exception: If your mailer is mangling patches then someone may ask |
221 | you to re-send them using MIME. | 221 | you to re-send them using MIME. |
222 | 222 | ||
223 | 223 | See Documentation/email-clients.txt for hints about configuring | |
224 | WARNING: Some mailers like Mozilla send your messages with | 224 | your e-mail client so that it sends your patches untouched. |
225 | ---- message header ---- | ||
226 | Content-Type: text/plain; charset=us-ascii; format=flowed | ||
227 | ---- message header ---- | ||
228 | The problem is that "format=flowed" makes some of the mailers | ||
229 | on receiving side to replace TABs with spaces and do similar | ||
230 | changes. Thus the patches from you can look corrupted. | ||
231 | |||
232 | To fix this just make your mozilla defaults/pref/mailnews.js file to look like: | ||
233 | pref("mailnews.send_plaintext_flowed", false); // RFC 2646======= | ||
234 | pref("mailnews.display.disable_format_flowed_support", true); | ||
235 | |||
236 | |||
237 | 225 | ||
238 | 8) E-mail size. | 226 | 8) 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 | |||
3 | trace_method_name | ||
4 | The AML method name that the user wants to trace | ||
5 | |||
6 | trace_debug_layer | ||
7 | The temporary debug_layer used when tracing the method. | ||
8 | Using 0xffffffff by default if it is 0. | ||
9 | |||
10 | trace_debug_level | ||
11 | The temporary debug_level used when tracing the method. | ||
12 | Using 0x00ffffff by default if it is 0. | ||
13 | |||
14 | trace_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 | |||
32 | only needs occurs after the SMC IO write cycle. The routines that | 32 | only needs occurs after the SMC IO write cycle. The routines that |
33 | implement this work-around make an additional concession which is to | 33 | implement this work-around make an additional concession which is to |
34 | disable interrupts during the IO sequence. Other hardware devices | 34 | disable 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 |
36 | region as the SMC chip. An interrupt might allow an access to one of | 36 | region as the SMC chip. An interrupt might allow an access to one of |
37 | those registers while SMC IO is being performed. | 37 | those registers while SMC IO is being performed. |
38 | 38 | ||
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt index 555c8cf3650a..af3b925ece08 100644 --- a/Documentation/cpu-freq/user-guide.txt +++ b/Documentation/cpu-freq/user-guide.txt | |||
@@ -45,6 +45,7 @@ The following ARM processors are supported by cpufreq: | |||
45 | ARM Integrator | 45 | ARM Integrator |
46 | ARM-SA1100 | 46 | ARM-SA1100 |
47 | ARM-SA1110 | 47 | ARM-SA1110 |
48 | Intel PXA | ||
48 | 49 | ||
49 | 50 | ||
50 | 1.2 x86 | 51 | 1.2 x86 |
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt index a741f658a3c9..ba0aacde94fb 100644 --- a/Documentation/cpu-hotplug.txt +++ b/Documentation/cpu-hotplug.txt | |||
@@ -50,7 +50,7 @@ additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets | |||
50 | cpu_possible_map = cpu_present_map + additional_cpus | 50 | cpu_possible_map = cpu_present_map + additional_cpus |
51 | 51 | ||
52 | (*) Option valid only for following architectures | 52 | (*) Option valid only for following architectures |
53 | - x86_64, ia64, s390 | 53 | - x86_64, ia64 |
54 | 54 | ||
55 | ia64 and x86_64 use the number of disabled local apics in ACPI tables MADT | 55 | ia64 and x86_64 use the number of disabled local apics in ACPI tables MADT |
56 | to determine the number of potentially hot-pluggable cpus. The implementation | 56 | to determine the number of potentially hot-pluggable cpus. The implementation |
@@ -109,12 +109,13 @@ Never use anything other than cpumask_t to represent bitmap of CPUs. | |||
109 | for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. | 109 | for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. |
110 | 110 | ||
111 | #include <linux/cpu.h> | 111 | #include <linux/cpu.h> |
112 | lock_cpu_hotplug() and unlock_cpu_hotplug(): | 112 | get_online_cpus() and put_online_cpus(): |
113 | 113 | ||
114 | The above calls are used to inhibit cpu hotplug operations. While holding the | 114 | The above calls are used to inhibit cpu hotplug operations. While the |
115 | cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid | 115 | cpu_hotplug.refcount is non zero, the cpu_online_map will not change. |
116 | cpus going away, you could also use preempt_disable() and preempt_enable() | 116 | If you merely need to avoid cpus going away, you could also use |
117 | for those sections. Just remember the critical section cannot call any | 117 | preempt_disable() and preempt_enable() for those sections. |
118 | Just remember the critical section cannot call any | ||
118 | function that can sleep or schedule this process away. The preempt_disable() | 119 | function that can sleep or schedule this process away. The preempt_disable() |
119 | will work as long as stop_machine_run() is used to take a cpu down. | 120 | will work as long as stop_machine_run() is used to take a cpu down. |
120 | 121 | ||
diff --git a/Documentation/crypto/api-intro.txt b/Documentation/crypto/api-intro.txt index a2ac6d294793..8b49302712a8 100644 --- a/Documentation/crypto/api-intro.txt +++ b/Documentation/crypto/api-intro.txt | |||
@@ -33,9 +33,16 @@ The idea is to make the user interface and algorithm registration API | |||
33 | very simple, while hiding the core logic from both. Many good ideas | 33 | very simple, while hiding the core logic from both. Many good ideas |
34 | from existing APIs such as Cryptoapi and Nettle have been adapted for this. | 34 | from existing APIs such as Cryptoapi and Nettle have been adapted for this. |
35 | 35 | ||
36 | The API currently supports three types of transforms: Ciphers, Digests and | 36 | The API currently supports five main types of transforms: AEAD (Authenticated |
37 | Compressors. The compression algorithms especially seem to be performing | 37 | Encryption with Associated Data), Block Ciphers, Ciphers, Compressors and |
38 | very well so far. | 38 | Hashes. |
39 | |||
40 | Please note that Block Ciphers is somewhat of a misnomer. It is in fact | ||
41 | meant to support all ciphers including stream ciphers. The difference | ||
42 | between Block Ciphers and Ciphers is that the latter operates on exactly | ||
43 | one block while the former can operate on an arbitrary amount of data, | ||
44 | subject to block size requirements (i.e., non-stream ciphers can only | ||
45 | process multiples of blocks). | ||
39 | 46 | ||
40 | Support for hardware crypto devices via an asynchronous interface is | 47 | Support for hardware crypto devices via an asynchronous interface is |
41 | under development. | 48 | under development. |
@@ -69,29 +76,12 @@ Here's an example of how to use the API: | |||
69 | Many real examples are available in the regression test module (tcrypt.c). | 76 | Many real examples are available in the regression test module (tcrypt.c). |
70 | 77 | ||
71 | 78 | ||
72 | CONFIGURATION NOTES | ||
73 | |||
74 | As Triple DES is part of the DES module, for those using modular builds, | ||
75 | add the following line to /etc/modprobe.conf: | ||
76 | |||
77 | alias des3_ede des | ||
78 | |||
79 | The Null algorithms reside in the crypto_null module, so these lines | ||
80 | should also be added: | ||
81 | |||
82 | alias cipher_null crypto_null | ||
83 | alias digest_null crypto_null | ||
84 | alias compress_null crypto_null | ||
85 | |||
86 | The SHA384 algorithm shares code within the SHA512 module, so you'll | ||
87 | also need: | ||
88 | alias sha384 sha512 | ||
89 | |||
90 | |||
91 | DEVELOPER NOTES | 79 | DEVELOPER NOTES |
92 | 80 | ||
93 | Transforms may only be allocated in user context, and cryptographic | 81 | Transforms may only be allocated in user context, and cryptographic |
94 | methods may only be called from softirq and user contexts. | 82 | methods may only be called from softirq and user contexts. For |
83 | transforms with a setkey method it too should only be called from | ||
84 | user context. | ||
95 | 85 | ||
96 | When using the API for ciphers, performance will be optimal if each | 86 | When using the API for ciphers, performance will be optimal if each |
97 | scatterlist contains data which is a multiple of the cipher's block | 87 | scatterlist contains data which is a multiple of the cipher's block |
@@ -130,8 +120,9 @@ might already be working on. | |||
130 | BUGS | 120 | BUGS |
131 | 121 | ||
132 | Send bug reports to: | 122 | Send bug reports to: |
133 | Herbert Xu <herbert@gondor.apana.org.au> | 123 | linux-crypto@vger.kernel.org |
134 | Cc: David S. Miller <davem@redhat.com> | 124 | Cc: Herbert Xu <herbert@gondor.apana.org.au>, |
125 | David S. Miller <davem@redhat.com> | ||
135 | 126 | ||
136 | 127 | ||
137 | FURTHER INFORMATION | 128 | FURTHER INFORMATION |
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 | |||
16 | echo 'exec /sbin/modprobe "$@"' >> /tmp/modprobe | 16 | echo 'exec /sbin/modprobe "$@"' >> /tmp/modprobe |
17 | chmod a+x /tmp/modprobe | 17 | chmod a+x /tmp/modprobe |
18 | echo /tmp/modprobe > /proc/sys/kernel/modprobe | 18 | echo /tmp/modprobe > /proc/sys/kernel/modprobe |
19 | |||
20 | Note that the above applies only when the *kernel* is requesting | ||
21 | that the module be loaded -- it won't have any effect if that module | ||
22 | is being loaded explicitly using "modprobe" from userspace. | ||
diff --git a/Documentation/debugging-via-ohci1394.txt b/Documentation/debugging-via-ohci1394.txt new file mode 100644 index 000000000000..de4804e8b396 --- /dev/null +++ b/Documentation/debugging-via-ohci1394.txt | |||
@@ -0,0 +1,179 @@ | |||
1 | |||
2 | Using physical DMA provided by OHCI-1394 FireWire controllers for debugging | ||
3 | --------------------------------------------------------------------------- | ||
4 | |||
5 | Introduction | ||
6 | ------------ | ||
7 | |||
8 | Basically all FireWire controllers which are in use today are compliant | ||
9 | to the OHCI-1394 specification which defines the controller to be a PCI | ||
10 | bus master which uses DMA to offload data transfers from the CPU and has | ||
11 | a "Physical Response Unit" which executes specific requests by employing | ||
12 | PCI-Bus master DMA after applying filters defined by the OHCI-1394 driver. | ||
13 | |||
14 | Once properly configured, remote machines can send these requests to | ||
15 | ask the OHCI-1394 controller to perform read and write requests on | ||
16 | physical system memory and, for read requests, send the result of | ||
17 | the physical memory read back to the requester. | ||
18 | |||
19 | With that, it is possible to debug issues by reading interesting memory | ||
20 | locations such as buffers like the printk buffer or the process table. | ||
21 | |||
22 | Retrieving a full system memory dump is also possible over the FireWire, | ||
23 | using data transfer rates in the order of 10MB/s or more. | ||
24 | |||
25 | Memory access is currently limited to the low 4G of physical address | ||
26 | space which can be a problem on IA64 machines where memory is located | ||
27 | mostly above that limit, but it is rarely a problem on more common | ||
28 | hardware such as hardware based on x86, x86-64 and PowerPC. | ||
29 | |||
30 | Together with a early initialization of the OHCI-1394 controller for debugging, | ||
31 | this facility proved most useful for examining long debugs logs in the printk | ||
32 | buffer on to debug early boot problems in areas like ACPI where the system | ||
33 | fails to boot and other means for debugging (serial port) are either not | ||
34 | available (notebooks) or too slow for extensive debug information (like ACPI). | ||
35 | |||
36 | Drivers | ||
37 | ------- | ||
38 | |||
39 | The OHCI-1394 drivers in drivers/firewire and drivers/ieee1394 initialize | ||
40 | the OHCI-1394 controllers to a working state and can be used to enable | ||
41 | physical DMA. By default you only have to load the driver, and physical | ||
42 | DMA access will be granted to all remote nodes, but it can be turned off | ||
43 | when using the ohci1394 driver. | ||
44 | |||
45 | Because these drivers depend on the PCI enumeration to be completed, an | ||
46 | initialization routine which can runs pretty early (long before console_init(), | ||
47 | which makes the printk buffer appear on the console can be called) was written. | ||
48 | |||
49 | To activate it, enable CONFIG_PROVIDE_OHCI1394_DMA_INIT (Kernel hacking menu: | ||
50 | Provide code for enabling DMA over FireWire early on boot) and pass the | ||
51 | parameter "ohci1394_dma=early" to the recompiled kernel on boot. | ||
52 | |||
53 | Tools | ||
54 | ----- | ||
55 | |||
56 | firescope - Originally developed by Benjamin Herrenschmidt, Andi Kleen ported | ||
57 | it from PowerPC to x86 and x86_64 and added functionality, firescope can now | ||
58 | be used to view the printk buffer of a remote machine, even with live update. | ||
59 | |||
60 | Bernhard Kaindl enhanced firescope to support accessing 64-bit machines | ||
61 | from 32-bit firescope and vice versa: | ||
62 | - ftp://ftp.suse.de/private/bk/firewire/tools/firescope-0.2.2.tar.bz2 | ||
63 | |||
64 | and he implemented fast system dump (alpha version - read README.txt): | ||
65 | - ftp://ftp.suse.de/private/bk/firewire/tools/firedump-0.1.tar.bz2 | ||
66 | |||
67 | There is also a gdb proxy for firewire which allows to use gdb to access | ||
68 | data which can be referenced from symbols found by gdb in vmlinux: | ||
69 | - ftp://ftp.suse.de/private/bk/firewire/tools/fireproxy-0.33.tar.bz2 | ||
70 | |||
71 | The latest version of this gdb proxy (fireproxy-0.34) can communicate (not | ||
72 | yet stable) with kgdb over an memory-based communication module (kgdbom). | ||
73 | |||
74 | Getting Started | ||
75 | --------------- | ||
76 | |||
77 | The OHCI-1394 specification regulates that the OHCI-1394 controller must | ||
78 | disable all physical DMA on each bus reset. | ||
79 | |||
80 | This means that if you want to debug an issue in a system state where | ||
81 | interrupts are disabled and where no polling of the OHCI-1394 controller | ||
82 | for bus resets takes place, you have to establish any FireWire cable | ||
83 | connections and fully initialize all FireWire hardware __before__ the | ||
84 | system enters such state. | ||
85 | |||
86 | Step-by-step instructions for using firescope with early OHCI initialization: | ||
87 | |||
88 | 1) Verify that your hardware is supported: | ||
89 | |||
90 | Load the ohci1394 or the fw-ohci module and check your kernel logs. | ||
91 | You should see a line similar to | ||
92 | |||
93 | ohci1394: fw-host0: OHCI-1394 1.1 (PCI): IRQ=[18] MMIO=[fe9ff800-fe9fffff] | ||
94 | ... Max Packet=[2048] IR/IT contexts=[4/8] | ||
95 | |||
96 | when loading the driver. If you have no supported controller, many PCI, | ||
97 | CardBus and even some Express cards which are fully compliant to OHCI-1394 | ||
98 | specification are available. If it requires no driver for Windows operating | ||
99 | systems, it most likely is. Only specialized shops have cards which are not | ||
100 | compliant, they are based on TI PCILynx chips and require drivers for Win- | ||
101 | dows operating systems. | ||
102 | |||
103 | 2) Establish a working FireWire cable connection: | ||
104 | |||
105 | Any FireWire cable, as long at it provides electrically and mechanically | ||
106 | stable connection and has matching connectors (there are small 4-pin and | ||
107 | large 6-pin FireWire ports) will do. | ||
108 | |||
109 | If an driver is running on both machines you should see a line like | ||
110 | |||
111 | ieee1394: Node added: ID:BUS[0-01:1023] GUID[0090270001b84bba] | ||
112 | |||
113 | on both machines in the kernel log when the cable is plugged in | ||
114 | and connects the two machines. | ||
115 | |||
116 | 3) Test physical DMA using firescope: | ||
117 | |||
118 | On the debug host, | ||
119 | - load the raw1394 module, | ||
120 | - make sure that /dev/raw1394 is accessible, | ||
121 | then start firescope: | ||
122 | |||
123 | $ firescope | ||
124 | Port 0 (ohci1394) opened, 2 nodes detected | ||
125 | |||
126 | FireScope | ||
127 | --------- | ||
128 | Target : <unspecified> | ||
129 | Gen : 1 | ||
130 | [Ctrl-T] choose target | ||
131 | [Ctrl-H] this menu | ||
132 | [Ctrl-Q] quit | ||
133 | |||
134 | ------> Press Ctrl-T now, the output should be similar to: | ||
135 | |||
136 | 2 nodes available, local node is: 0 | ||
137 | 0: ffc0, uuid: 00000000 00000000 [LOCAL] | ||
138 | 1: ffc1, uuid: 00279000 ba4bb801 | ||
139 | |||
140 | Besides the [LOCAL] node, it must show another node without error message. | ||
141 | |||
142 | 4) Prepare for debugging with early OHCI-1394 initialization: | ||
143 | |||
144 | 4.1) Kernel compilation and installation on debug target | ||
145 | |||
146 | Compile the kernel to be debugged with CONFIG_PROVIDE_OHCI1394_DMA_INIT | ||
147 | (Kernel hacking: Provide code for enabling DMA over FireWire early on boot) | ||
148 | enabled and install it on the machine to be debugged (debug target). | ||
149 | |||
150 | 4.2) Transfer the System.map of the debugged kernel to the debug host | ||
151 | |||
152 | Copy the System.map of the kernel be debugged to the debug host (the host | ||
153 | which is connected to the debugged machine over the FireWire cable). | ||
154 | |||
155 | 5) Retrieving the printk buffer contents: | ||
156 | |||
157 | With the FireWire cable connected, the OHCI-1394 driver on the debugging | ||
158 | host loaded, reboot the debugged machine, booting the kernel which has | ||
159 | CONFIG_PROVIDE_OHCI1394_DMA_INIT enabled, with the option ohci1394_dma=early. | ||
160 | |||
161 | Then, on the debugging host, run firescope, for example by using -A: | ||
162 | |||
163 | firescope -A System.map-of-debug-target-kernel | ||
164 | |||
165 | Note: -A automatically attaches to the first non-local node. It only works | ||
166 | reliably if only connected two machines are connected using FireWire. | ||
167 | |||
168 | After having attached to the debug target, press Ctrl-D to view the | ||
169 | complete printk buffer or Ctrl-U to enter auto update mode and get an | ||
170 | updated live view of recent kernel messages logged on the debug target. | ||
171 | |||
172 | Call "firescope -h" to get more information on firescope's options. | ||
173 | |||
174 | Notes | ||
175 | ----- | ||
176 | Documentation and specifications: ftp://ftp.suse.de/private/bk/firewire/docs | ||
177 | |||
178 | FireWire is a trademark of Apple Inc. - for more information please refer to: | ||
179 | http://en.wikipedia.org/wiki/FireWire | ||
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index f2d658a6a942..c09a96b99354 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -46,8 +46,6 @@ | |||
46 | .mailmap | 46 | .mailmap |
47 | .mm | 47 | .mm |
48 | 53c700_d.h | 48 | 53c700_d.h |
49 | 53c7xx_d.h | ||
50 | 53c7xx_u.h | ||
51 | 53c8xx_d.h* | 49 | 53c8xx_d.h* |
52 | BitKeeper | 50 | BitKeeper |
53 | COPYING | 51 | COPYING |
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 | |||
122 | using these calls except with such hotplug-deficient drivers. | 122 | using 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 | ||
127 | You can use platform_device_alloc() to dynamically allocate a device, which | 127 | You can use platform_device_alloc() to dynamically allocate a device, which |
128 | you will then initialize with resources and platform_device_register(). | 128 | you will then initialize with resources and platform_device_register(). |
129 | A better solution is usually: | 129 | A 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 | ||
135 | You can use platform_device_register_simple() as a one-step call to allocate | 135 | You can use platform_device_register_simple() as a one-step call to allocate |
136 | and register a device. | 136 | and register a device. |
diff --git a/Documentation/dvb/bt8xx.txt b/Documentation/dvb/bt8xx.txt index ecb47adda063..b7b1d1b1da46 100644 --- a/Documentation/dvb/bt8xx.txt +++ b/Documentation/dvb/bt8xx.txt | |||
@@ -78,6 +78,18 @@ Example: | |||
78 | For a full list of card ID's please see Documentation/video4linux/CARDLIST.bttv. | 78 | For a full list of card ID's please see Documentation/video4linux/CARDLIST.bttv. |
79 | In case of further problems please subscribe and send questions to the mailing list: linux-dvb@linuxtv.org. | 79 | In case of further problems please subscribe and send questions to the mailing list: linux-dvb@linuxtv.org. |
80 | 80 | ||
81 | 2c) Probing the cards with broken PCI subsystem ID | ||
82 | -------------------------------------------------- | ||
83 | There are some TwinHan cards that the EEPROM has become corrupted for some | ||
84 | reason. The cards do not have correct PCI subsystem ID. But we can force | ||
85 | probing the cards with broken PCI subsystem ID | ||
86 | |||
87 | $ echo 109e 0878 $subvendor $subdevice > \ | ||
88 | /sys/bus/pci/drivers/bt878/new_id | ||
89 | |||
90 | 109e: PCI_VENDOR_ID_BROOKTREE | ||
91 | 0878: PCI_DEVICE_ID_BROOKTREE_878 | ||
92 | |||
81 | Authors: Richard Walker, | 93 | Authors: Richard Walker, |
82 | Jamie Honan, | 94 | Jamie Honan, |
83 | Michael Hunold, | 95 | Michael Hunold, |
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 | |||
7 | works: | 7 | works: |
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 20c4c8bac9d7..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 | ||
159 | What: USB driver API moves to EXPORT_SYMBOL_GPL | ||
160 | When: February 2008 | ||
161 | Files: include/linux/usb.h, drivers/usb/core/driver.c | ||
162 | Why: 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. | ||
171 | Who: Greg Kroah-Hartman <gregkh@suse.de> | ||
172 | |||
173 | --------------------------- | ||
174 | |||
175 | What: vm_ops.nopage | 159 | What: vm_ops.nopage |
176 | When: Soon, provided in-kernel callers have been converted | 160 | When: Soon, provided in-kernel callers have been converted |
177 | Why: This interface is replaced by vm_ops.fault, but it has been around | 161 | Why: This interface is replaced by vm_ops.fault, but it has been around |
@@ -191,15 +175,6 @@ Who: Kay Sievers <kay.sievers@suse.de> | |||
191 | 175 | ||
192 | --------------------------- | 176 | --------------------------- |
193 | 177 | ||
194 | What: i2c_adapter.list | ||
195 | When: July 2007 | ||
196 | Why: Superfluous, this list duplicates the one maintained by the driver | ||
197 | core. | ||
198 | Who: Jean Delvare <khali@linux-fr.org>, | ||
199 | David Brownell <dbrownell@users.sourceforge.net> | ||
200 | |||
201 | --------------------------- | ||
202 | |||
203 | What: ACPI procfs interface | 178 | What: ACPI procfs interface |
204 | When: July 2008 | 179 | When: July 2008 |
205 | Why: ACPI sysfs conversion should be finished by January 2008. | 180 | Why: ACPI sysfs conversion should be finished by January 2008. |
@@ -225,14 +200,6 @@ Who: Len Brown <len.brown@intel.com> | |||
225 | 200 | ||
226 | --------------------------- | 201 | --------------------------- |
227 | 202 | ||
228 | What: i2c-ixp2000, i2c-ixp4xx and scx200_i2c drivers | ||
229 | When: September 2007 | ||
230 | Why: Obsolete. The new i2c-gpio driver replaces all hardware-specific | ||
231 | I2C-over-GPIO drivers. | ||
232 | Who: Jean Delvare <khali@linux-fr.org> | ||
233 | |||
234 | --------------------------- | ||
235 | |||
236 | What: 'time' kernel boot parameter | 203 | What: 'time' kernel boot parameter |
237 | When: January 2008 | 204 | When: January 2008 |
238 | Why: replaced by 'printk.time=<value>' so that printk timestamps can be | 205 | Why: replaced by 'printk.time=<value>' so that printk timestamps can be |
@@ -241,13 +208,6 @@ Who: Randy Dunlap <randy.dunlap@oracle.com> | |||
241 | 208 | ||
242 | --------------------------- | 209 | --------------------------- |
243 | 210 | ||
244 | What: drivers depending on OSS_OBSOLETE | ||
245 | When: options in 2.6.23, code in 2.6.25 | ||
246 | Why: obsolete OSS drivers | ||
247 | Who: Adrian Bunk <bunk@stusta.de> | ||
248 | |||
249 | --------------------------- | ||
250 | |||
251 | What: libata spindown skipping and warning | 211 | What: libata spindown skipping and warning |
252 | When: Dec 2008 | 212 | When: Dec 2008 |
253 | Why: Some halt(8) implementations synchronize caches for and spin | 213 | Why: Some halt(8) implementations synchronize caches for and spin |
@@ -266,22 +226,6 @@ Who: Tejun Heo <htejun@gmail.com> | |||
266 | 226 | ||
267 | --------------------------- | 227 | --------------------------- |
268 | 228 | ||
269 | What: Legacy RTC drivers (under drivers/i2c/chips) | ||
270 | When: November 2007 | ||
271 | Why: Obsolete. We have a RTC subsystem with better drivers. | ||
272 | Who: Jean Delvare <khali@linux-fr.org> | ||
273 | |||
274 | --------------------------- | ||
275 | |||
276 | What: iptables SAME target | ||
277 | When: 1.1. 2008 | ||
278 | Files: net/ipv4/netfilter/ipt_SAME.c, include/linux/netfilter_ipv4/ipt_SAME.h | ||
279 | Why: Obsolete for multiple years now, NAT core provides the same behaviour. | ||
280 | Unfixable broken wrt. 32/64 bit cleanness. | ||
281 | Who: Patrick McHardy <kaber@trash.net> | ||
282 | |||
283 | --------------------------- | ||
284 | |||
285 | What: The arch/ppc and include/asm-ppc directories | 229 | What: The arch/ppc and include/asm-ppc directories |
286 | When: Jun 2008 | 230 | When: Jun 2008 |
287 | Why: The arch/powerpc tree is the merged architecture for ppc32 and ppc64 | 231 | Why: The arch/powerpc tree is the merged architecture for ppc32 and ppc64 |
@@ -295,16 +239,6 @@ Who: linuxppc-dev@ozlabs.org | |||
295 | 239 | ||
296 | --------------------------- | 240 | --------------------------- |
297 | 241 | ||
298 | What: mthca driver's MSI support | ||
299 | When: January 2008 | ||
300 | Files: drivers/infiniband/hw/mthca/*.[ch] | ||
301 | Why: All mthca hardware also supports MSI-X, which provides | ||
302 | strictly more functionality than MSI. So there is no point in | ||
303 | having both MSI-X and MSI support in the driver. | ||
304 | Who: Roland Dreier <rolandd@cisco.com> | ||
305 | |||
306 | --------------------------- | ||
307 | |||
308 | What: sk98lin network driver | 242 | What: sk98lin network driver |
309 | When: Feburary 2008 | 243 | When: Feburary 2008 |
310 | Why: In kernel tree version of driver is unmaintained. Sk98lin driver | 244 | Why: In kernel tree version of driver is unmaintained. Sk98lin driver |
@@ -323,13 +257,77 @@ Who: Thomas Gleixner <tglx@linutronix.de> | |||
323 | 257 | ||
324 | --------------------------- | 258 | --------------------------- |
325 | 259 | ||
326 | What: shaper network driver | 260 | --------------------------- |
327 | When: January 2008 | 261 | |
328 | Files: drivers/net/shaper.c, include/linux/if_shaper.h | 262 | What: i2c-i810, i2c-prosavage and i2c-savage4 |
329 | Why: This driver has been marked obsolete for many years. | 263 | When: May 2008 |
330 | It was only designed to work on lower speed links and has design | 264 | Why: These drivers are superseded by i810fb, intelfb and savagefb. |
331 | flaws that lead to machine crashes. The qdisc infrastructure in | 265 | Who: Jean Delvare <khali@linux-fr.org> |
332 | 2.4 or later kernels, provides richer features and is more robust. | 266 | |
333 | Who: Stephen Hemminger <shemminger@linux-foundation.org> | 267 | --------------------------- |
268 | |||
269 | What: bcm43xx wireless network driver | ||
270 | When: 2.6.26 | ||
271 | Files: drivers/net/wireless/bcm43xx | ||
272 | Why: This driver's functionality has been replaced by the | ||
273 | mac80211-based b43 and b43legacy drivers. | ||
274 | Who: John W. Linville <linville@tuxdriver.com> | ||
275 | |||
276 | --------------------------- | ||
277 | |||
278 | What: ieee80211 softmac wireless networking component | ||
279 | When: 2.6.26 (or after removal of bcm43xx and port of zd1211rw to mac80211) | ||
280 | Files: net/ieee80211/softmac | ||
281 | Why: No in-kernel drivers will depend on it any longer. | ||
282 | Who: John W. Linville <linville@tuxdriver.com> | ||
283 | |||
284 | --------------------------- | ||
285 | |||
286 | What: rc80211-simple rate control algorithm for mac80211 | ||
287 | When: 2.6.26 | ||
288 | Files: net/mac80211/rc80211-simple.c | ||
289 | Why: This algorithm was provided for reference but always exhibited bad | ||
290 | responsiveness and performance and has some serious flaws. It has been | ||
291 | replaced by rc80211-pid. | ||
292 | Who: Stefano Brivio <stefano.brivio@polimi.it> | ||
334 | 293 | ||
335 | --------------------------- | 294 | --------------------------- |
295 | |||
296 | What (Why): | ||
297 | - include/linux/netfilter_ipv4/ipt_TOS.h ipt_tos.h header files | ||
298 | (superseded by xt_TOS/xt_tos target & match) | ||
299 | |||
300 | - "forwarding" header files like ipt_mac.h in | ||
301 | include/linux/netfilter_ipv4/ and include/linux/netfilter_ipv6/ | ||
302 | |||
303 | - xt_CONNMARK match revision 0 | ||
304 | (superseded by xt_CONNMARK match revision 1) | ||
305 | |||
306 | - xt_MARK target revisions 0 and 1 | ||
307 | (superseded by xt_MARK match revision 2) | ||
308 | |||
309 | - xt_connmark match revision 0 | ||
310 | (superseded by xt_connmark match revision 1) | ||
311 | |||
312 | - xt_conntrack match revision 0 | ||
313 | (superseded by xt_conntrack match revision 1) | ||
314 | |||
315 | - xt_iprange match revision 0, | ||
316 | include/linux/netfilter_ipv4/ipt_iprange.h | ||
317 | (superseded by xt_iprange match revision 1) | ||
318 | |||
319 | - xt_mark match revision 0 | ||
320 | (superseded by xt_mark match revision 1) | ||
321 | |||
322 | When: January 2009 or Linux 2.7.0, whichever comes first | ||
323 | Why: Superseded by newer revisions or modules | ||
324 | Who: Jan Engelhardt <jengelh@computergmbh.de> | ||
325 | |||
326 | --------------------------- | ||
327 | |||
328 | What: b43 support for firmware revision < 410 | ||
329 | When: July 2008 | ||
330 | Why: The support code for the old firmware hurts code readability/maintainability | ||
331 | and slightly hurts runtime performance. Bugfixes for the old firmware | ||
332 | are not provided by Broadcom anymore. | ||
333 | Who: Michael Buesch <mb@bu3sch.de> | ||
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. | |||
377 | Rather than have a group where some items behave differently than | 377 | Rather than have a group where some items behave differently than |
378 | others, configfs provides a method whereby one or many subgroups are | 378 | others, configfs provides a method whereby one or many subgroups are |
379 | automatically created inside the parent at its creation. Thus, | 379 | automatically created inside the parent at its creation. Thus, |
380 | mkdir("parent) results in "parent", "parent/subgroup1", up through | 380 | mkdir("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/ext4.txt b/Documentation/filesystems/ext4.txt index 6a4adcae9f9a..560f88dc7090 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -86,9 +86,21 @@ Alex is working on a new set of patches right now. | |||
86 | When mounting an ext4 filesystem, the following option are accepted: | 86 | When mounting an ext4 filesystem, the following option are accepted: |
87 | (*) == default | 87 | (*) == default |
88 | 88 | ||
89 | extents ext4 will use extents to address file data. The | 89 | extents (*) ext4 will use extents to address file data. The |
90 | file system will no longer be mountable by ext3. | 90 | file system will no longer be mountable by ext3. |
91 | 91 | ||
92 | noextents ext4 will not use extents for newly created files | ||
93 | |||
94 | journal_checksum Enable checksumming of the journal transactions. | ||
95 | This will allow the recovery code in e2fsck and the | ||
96 | kernel to detect corruption in the kernel. It is a | ||
97 | compatible change and will be ignored by older kernels. | ||
98 | |||
99 | journal_async_commit Commit block can be written to disk without waiting | ||
100 | for descriptor blocks. If enabled older kernels cannot | ||
101 | mount the device. This will enable 'journal_checksum' | ||
102 | internally. | ||
103 | |||
92 | journal=update Update the ext4 file system's journal to the current | 104 | journal=update Update the ext4 file system's journal to the current |
93 | format. | 105 | format. |
94 | 106 | ||
@@ -196,6 +208,12 @@ nobh (a) cache disk block mapping information | |||
196 | "nobh" option tries to avoid associating buffer | 208 | "nobh" option tries to avoid associating buffer |
197 | heads (supported only for "writeback" mode). | 209 | heads (supported only for "writeback" mode). |
198 | 210 | ||
211 | mballoc (*) Use the multiple block allocator for block allocation | ||
212 | nomballoc disabled multiple block allocator for block allocation. | ||
213 | stripe=n Number of filesystem blocks that mballoc will try | ||
214 | to use for allocation size and alignment. For RAID5/6 | ||
215 | systems this should be the number of data | ||
216 | disks * RAID chunk size in file system blocks. | ||
199 | 217 | ||
200 | Data Mode | 218 | Data Mode |
201 | --------- | 219 | --------- |
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index ed55238023a9..c318a8bbb1ef 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -35,7 +35,6 @@ Features which OCFS2 does not support yet: | |||
35 | - Directory change notification (F_NOTIFY) | 35 | - Directory change notification (F_NOTIFY) |
36 | - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) | 36 | - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) |
37 | - POSIX ACLs | 37 | - POSIX ACLs |
38 | - readpages / writepages (not user visible) | ||
39 | 38 | ||
40 | Mount options | 39 | Mount options |
41 | ============= | 40 | ============= |
@@ -62,3 +61,18 @@ data=writeback Data ordering is not preserved, data may be written | |||
62 | preferred_slot=0(*) During mount, try to use this filesystem slot first. If | 61 | preferred_slot=0(*) During mount, try to use this filesystem slot first. If |
63 | it is in use by another node, the first empty one found | 62 | it is in use by another node, the first empty one found |
64 | will be chosen. Invalid values will be ignored. | 63 | will be chosen. Invalid values will be ignored. |
64 | commit=nrsec (*) Ocfs2 can be told to sync all its data and metadata | ||
65 | every 'nrsec' seconds. The default value is 5 seconds. | ||
66 | This means that if you lose your power, you will lose | ||
67 | as much as the latest 5 seconds of work (your | ||
68 | filesystem will not be damaged though, thanks to the | ||
69 | journaling). This default value (or any low value) | ||
70 | will hurt performance, but it's good for data-safety. | ||
71 | Setting it to 0 will have the same effect as leaving | ||
72 | it at the default (5 seconds). | ||
73 | Setting it to very large values will improve | ||
74 | performance. | ||
75 | localalloc=8(*) Allows custom localalloc size in MB. If the value is too | ||
76 | large, the fs will silently revert it to the default. | ||
77 | Localalloc is not enabled for local mounts. | ||
78 | localflocks This disables cluster aware flock. | ||
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 @@ | |||
1 | Changes since 2.5.0: | 1 | Changes since 2.5.0: |
2 | 2 | ||
3 | --- | 3 | --- |
4 | [recommended] | 4 | [recommended] |
5 | 5 | ||
6 | New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(), | 6 | New 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 | ||
16 | New methods: ->alloc_inode() and ->destroy_inode(). | 16 | New methods: ->alloc_inode() and ->destroy_inode(). |
@@ -28,7 +28,7 @@ Declare | |||
28 | 28 | ||
29 | Use FOO_I(inode) instead of &inode->u.foo_inode_i; | 29 | Use FOO_I(inode) instead of &inode->u.foo_inode_i; |
30 | 30 | ||
31 | Add foo_alloc_inode() and foo_destory_inode() - the former should allocate | 31 | Add foo_alloc_inode() and foo_destroy_inode() - the former should allocate |
32 | foo_inode_info and return the address of ->vfs_inode, the latter should free | 32 | foo_inode_info and return the address of ->vfs_inode, the latter should free |
33 | FOO_I(inode) (see in-tree filesystems for examples). | 33 | FOO_I(inode) (see in-tree filesystems for examples). |
34 | 34 | ||
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index dec99455321f..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 |
@@ -857,6 +858,45 @@ CPUs. | |||
857 | The "procs_blocked" line gives the number of processes currently blocked, | 858 | The "procs_blocked" line gives the number of processes currently blocked, |
858 | waiting for I/O to complete. | 859 | waiting for I/O to complete. |
859 | 860 | ||
861 | 1.9 Ext4 file system parameters | ||
862 | ------------------------------ | ||
863 | Ext4 file system have one directory per partition under /proc/fs/ext4/ | ||
864 | # ls /proc/fs/ext4/hdc/ | ||
865 | group_prealloc max_to_scan mb_groups mb_history min_to_scan order2_req | ||
866 | stats stream_req | ||
867 | |||
868 | mb_groups: | ||
869 | This file gives the details of mutiblock allocator buddy cache of free blocks | ||
870 | |||
871 | mb_history: | ||
872 | Multiblock allocation history. | ||
873 | |||
874 | stats: | ||
875 | This file indicate whether the multiblock allocator should start collecting | ||
876 | statistics. The statistics are shown during unmount | ||
877 | |||
878 | group_prealloc: | ||
879 | The multiblock allocator normalize the block allocation request to | ||
880 | group_prealloc filesystem blocks if we don't have strip value set. | ||
881 | The stripe value can be specified at mount time or during mke2fs. | ||
882 | |||
883 | max_to_scan: | ||
884 | How long multiblock allocator can look for a best extent (in found extents) | ||
885 | |||
886 | min_to_scan: | ||
887 | How long multiblock allocator must look for a best extent | ||
888 | |||
889 | order2_req: | ||
890 | Multiblock allocator use 2^N search using buddies only for requests greater | ||
891 | than or equal to order2_req. The request size is specfied in file system | ||
892 | blocks. A value of 2 indicate only if the requests are greater than or equal | ||
893 | to 4 blocks. | ||
894 | |||
895 | stream_req: | ||
896 | Files smaller than stream_req are served by the stream allocator, whose | ||
897 | purpose is to pack requests as close each to other as possible to | ||
898 | produce smooth I/O traffic. Avalue of 16 indicate that file smaller than 16 | ||
899 | filesystem block size will use group based preallocation. | ||
860 | 900 | ||
861 | ------------------------------------------------------------------------------ | 901 | ------------------------------------------------------------------------------ |
862 | Summary | 902 | Summary |
@@ -989,6 +1029,14 @@ nr_inodes | |||
989 | Denotes the number of inodes the system has allocated. This number will | 1029 | Denotes the number of inodes the system has allocated. This number will |
990 | grow and shrink dynamically. | 1030 | grow and shrink dynamically. |
991 | 1031 | ||
1032 | nr_open | ||
1033 | ------- | ||
1034 | |||
1035 | Denotes the maximum number of file-handles a process can | ||
1036 | allocate. Default value is 1024*1024 (1048576) which should be | ||
1037 | enough for most machines. Actual limit depends on RLIMIT_NOFILE | ||
1038 | resource limit. | ||
1039 | |||
992 | nr_free_inodes | 1040 | nr_free_inodes |
993 | -------------- | 1041 | -------------- |
994 | 1042 | ||
@@ -1095,13 +1143,6 @@ check the amount of free space (value is in seconds). Default settings are: 4, | |||
1095 | resume it if we have a value of 3 or more percent; consider information about | 1143 | resume it if we have a value of 3 or more percent; consider information about |
1096 | the amount of free space valid for 30 seconds | 1144 | the amount of free space valid for 30 seconds |
1097 | 1145 | ||
1098 | audit_argv_kb | ||
1099 | ------------- | ||
1100 | |||
1101 | The file contains a single value denoting the limit on the argv array size | ||
1102 | for execve (in KiB). This limit is only applied when system call auditing for | ||
1103 | execve is enabled, otherwise the value is ignored. | ||
1104 | |||
1105 | ctrl-alt-del | 1146 | ctrl-alt-del |
1106 | ------------ | 1147 | ------------ |
1107 | 1148 | ||
@@ -1282,13 +1323,28 @@ for writeout by the pdflush daemons. It is expressed in 100'ths of a second. | |||
1282 | Data which has been dirty in-memory for longer than this interval will be | 1323 | Data which has been dirty in-memory for longer than this interval will be |
1283 | written out next time a pdflush daemon wakes up. | 1324 | written out next time a pdflush daemon wakes up. |
1284 | 1325 | ||
1326 | highmem_is_dirtyable | ||
1327 | -------------------- | ||
1328 | |||
1329 | Only present if CONFIG_HIGHMEM is set. | ||
1330 | |||
1331 | This defaults to 0 (false), meaning that the ratios set above are calculated | ||
1332 | as a percentage of lowmem only. This protects against excessive scanning | ||
1333 | in page reclaim, swapping and general VM distress. | ||
1334 | |||
1335 | Setting this to 1 can be useful on 32 bit machines where you want to make | ||
1336 | random changes within an MMAPed file that is larger than your available | ||
1337 | lowmem without causing large quantities of random IO. Is is safe if the | ||
1338 | behavior of all programs running on the machine is known and memory will | ||
1339 | not be otherwise stressed. | ||
1340 | |||
1285 | legacy_va_layout | 1341 | legacy_va_layout |
1286 | ---------------- | 1342 | ---------------- |
1287 | 1343 | ||
1288 | If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel | 1344 | If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel |
1289 | will use the legacy (2.4) layout for all processes. | 1345 | will use the legacy (2.4) layout for all processes. |
1290 | 1346 | ||
1291 | lower_zone_protection | 1347 | lowmem_reserve_ratio |
1292 | --------------------- | 1348 | --------------------- |
1293 | 1349 | ||
1294 | For some specialised workloads on highmem machines it is dangerous for | 1350 | For some specialised workloads on highmem machines it is dangerous for |
@@ -1308,25 +1364,71 @@ captured into pinned user memory. | |||
1308 | mechanism will also defend that region from allocations which could use | 1364 | mechanism will also defend that region from allocations which could use |
1309 | highmem or lowmem). | 1365 | highmem or lowmem). |
1310 | 1366 | ||
1311 | The `lower_zone_protection' tunable determines how aggressive the kernel is | 1367 | The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is |
1312 | in defending these lower zones. The default value is zero - no | 1368 | in defending these lower zones. |
1313 | protection at all. | ||
1314 | 1369 | ||
1315 | If you have a machine which uses highmem or ISA DMA and your | 1370 | If you have a machine which uses highmem or ISA DMA and your |
1316 | applications are using mlock(), or if you are running with no swap then | 1371 | applications are using mlock(), or if you are running with no swap then |
1317 | you probably should increase the lower_zone_protection setting. | 1372 | you probably should change the lowmem_reserve_ratio setting. |
1318 | 1373 | ||
1319 | The units of this tunable are fairly vague. It is approximately equal | 1374 | The lowmem_reserve_ratio is an array. You can see them by reading this file. |
1320 | to "megabytes," so setting lower_zone_protection=100 will protect around 100 | 1375 | - |
1321 | megabytes of the lowmem zone from user allocations. It will also make | 1376 | % cat /proc/sys/vm/lowmem_reserve_ratio |
1322 | those 100 megabytes unavailable for use by applications and by | 1377 | 256 256 32 |
1323 | pagecache, so there is a cost. | 1378 | - |
1324 | 1379 | Note: # of this elements is one fewer than number of zones. Because the highest | |
1325 | The effects of this tunable may be observed by monitoring | 1380 | zone's value is not necessary for following calculation. |
1326 | /proc/meminfo:LowFree. Write a single huge file and observe the point | 1381 | |
1327 | at which LowFree ceases to fall. | 1382 | But, these values are not used directly. The kernel calculates # of protection |
1328 | 1383 | pages for each zones from them. These are shown as array of protection pages | |
1329 | A reasonable value for lower_zone_protection is 100. | 1384 | in /proc/zoneinfo like followings. (This is an example of x86-64 box). |
1385 | Each zone has an array of protection pages like this. | ||
1386 | |||
1387 | - | ||
1388 | Node 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 | - | ||
1402 | These protections are added to score to judge whether this zone should be used | ||
1403 | for page allocation or should be reclaimed. | ||
1404 | |||
1405 | In this example, if normal pages (index=2) are required to this DMA zone and | ||
1406 | pages_high is used for watermark, the kernel judges this zone should not be | ||
1407 | used 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 | ||
1409 | normal page requirement. If requirement is DMA zone(index=0), protection[0] | ||
1410 | (=0) is used. | ||
1411 | |||
1412 | zone[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 | |||
1423 | The default values of lowmem_reserve_ratio[i] are | ||
1424 | 256 (if zone[i] means DMA or DMA32 zone) | ||
1425 | 32 (others). | ||
1426 | As above expression, they are reciprocal number of ratio. | ||
1427 | 256 means 1/256. # of protection pages becomes about "0.39%" of total present | ||
1428 | pages of higher zones on the node. | ||
1429 | |||
1430 | If you would like to protect more pages, smaller values are effective. | ||
1431 | The minimum value is 1 (1/1 -> 100%). | ||
1330 | 1432 | ||
1331 | page-cluster | 1433 | page-cluster |
1332 | ------------ | 1434 | ------------ |
@@ -1880,11 +1982,6 @@ max_size | |||
1880 | Maximum size of the routing cache. Old entries will be purged once the cache | 1982 | Maximum size of the routing cache. Old entries will be purged once the cache |
1881 | reached has this size. | 1983 | reached has this size. |
1882 | 1984 | ||
1883 | max_delay, min_delay | ||
1884 | -------------------- | ||
1885 | |||
1886 | Delays for flushing the routing cache. | ||
1887 | |||
1888 | redirect_load, redirect_number | 1985 | redirect_load, redirect_number |
1889 | ------------------------------ | 1986 | ------------------------------ |
1890 | 1987 | ||
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 | |||
140 | In order for a user application to make use of relay files, the | 140 | In order for a user application to make use of relay files, the |
141 | host filesystem must be mounted. For example, | 141 | host filesystem must be mounted. For example, |
142 | 142 | ||
143 | mount -t debugfs debugfs /debug | 143 | mount -t debugfs debugfs /sys/kernel/debug |
144 | 144 | ||
145 | NOTE: the host filesystem doesn't need to be mounted for kernel | 145 | NOTE: 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 | |||
60 | functionality can be very portable. Other features are platform-specific, | 60 | functionality can be very portable. Other features are platform-specific, |
61 | and that can be critical for glue logic. | 61 | and that can be critical for glue logic. |
62 | 62 | ||
63 | Plus, this doesn't define an implementation framework, just an interface. | 63 | Plus, this doesn't require any implementation framework, just an interface. |
64 | One platform might implement it as simple inline functions accessing chip | 64 | One platform might implement it as simple inline functions accessing chip |
65 | registers; another might implement it by delegating through abstractions | 65 | registers; another might implement it by delegating through abstractions |
66 | used for several very different kinds of GPIO controller. | 66 | used for several very different kinds of GPIO controller. (There is some |
67 | optional code supporting such an implementation strategy, described later | ||
68 | in this document, but drivers acting as clients to the GPIO interface must | ||
69 | not care how it's implemented.) | ||
67 | 70 | ||
68 | That said, if the convention is supported on their platform, drivers should | 71 | That said, if the convention is supported on their platform, drivers should |
69 | use it when possible. Platforms should declare GENERIC_GPIO support in | 72 | use it when possible. Platforms should declare GENERIC_GPIO support in |
@@ -121,6 +124,11 @@ before tasking is enabled, as part of early board setup. | |||
121 | For output GPIOs, the value provided becomes the initial output value. | 124 | For output GPIOs, the value provided becomes the initial output value. |
122 | This helps avoid signal glitching during system startup. | 125 | This helps avoid signal glitching during system startup. |
123 | 126 | ||
127 | For compatibility with legacy interfaces to GPIOs, setting the direction | ||
128 | of a GPIO implicitly requests that GPIO (see below) if it has not been | ||
129 | requested already. That compatibility may be removed in the future; | ||
130 | explicitly requesting GPIOs is strongly preferred. | ||
131 | |||
124 | Setting the direction can fail if the GPIO number is invalid, or when | 132 | Setting the direction can fail if the GPIO number is invalid, or when |
125 | that particular GPIO can't be used in that mode. It's generally a bad | 133 | that particular GPIO can't be used in that mode. It's generally a bad |
126 | idea to rely on boot firmware to have set the direction correctly, since | 134 | idea to rely on boot firmware to have set the direction correctly, since |
@@ -133,6 +141,7 @@ Spinlock-Safe GPIO access | |||
133 | ------------------------- | 141 | ------------------------- |
134 | Most GPIO controllers can be accessed with memory read/write instructions. | 142 | Most GPIO controllers can be accessed with memory read/write instructions. |
135 | That doesn't need to sleep, and can safely be done from inside IRQ handlers. | 143 | That doesn't need to sleep, and can safely be done from inside IRQ handlers. |
144 | (That includes hardirq contexts on RT kernels.) | ||
136 | 145 | ||
137 | Use these calls to access such GPIOs: | 146 | Use these calls to access such GPIOs: |
138 | 147 | ||
@@ -145,7 +154,7 @@ Use these calls to access such GPIOs: | |||
145 | The values are boolean, zero for low, nonzero for high. When reading the | 154 | The values are boolean, zero for low, nonzero for high. When reading the |
146 | value of an output pin, the value returned should be what's seen on the | 155 | value of an output pin, the value returned should be what's seen on the |
147 | pin ... that won't always match the specified output value, because of | 156 | pin ... that won't always match the specified output value, because of |
148 | issues including wire-OR and output latencies. | 157 | issues including open-drain signaling and output latencies. |
149 | 158 | ||
150 | The get/set calls have no error returns because "invalid GPIO" should have | 159 | The get/set calls have no error returns because "invalid GPIO" should have |
151 | been reported earlier from gpio_direction_*(). However, note that not all | 160 | been 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. | |||
170 | This requires sleeping, which can't be done from inside IRQ handlers. | 179 | This requires sleeping, which can't be done from inside IRQ handlers. |
171 | 180 | ||
172 | Platforms that support this type of GPIO distinguish them from other GPIOs | 181 | Platforms that support this type of GPIO distinguish them from other GPIOs |
173 | by returning nonzero from this call: | 182 | by returning nonzero from this call (which requires a valid GPIO number, |
183 | either 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. | |||
209 | These calls serve two basic purposes. One is marking the signals which | 219 | These calls serve two basic purposes. One is marking the signals which |
210 | are actually in use as GPIOs, for better diagnostics; systems may have | 220 | are actually in use as GPIOs, for better diagnostics; systems may have |
211 | several hundred potential GPIOs, but often only a dozen are used on any | 221 | several hundred potential GPIOs, but often only a dozen are used on any |
212 | given board. Another is to catch conflicts between drivers, reporting | 222 | given board. Another is to catch conflicts, identifying errors when |
213 | errors 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 |
224 | signal, or (b) something wrongly believes it's safe to remove drivers | ||
225 | needed to manage a signal that's in active use. That is, requesting a | ||
226 | GPIO can serve as a kind of lock. | ||
214 | 227 | ||
215 | These two calls are optional because not not all current Linux platforms | 228 | These two calls are optional because not not all current Linux platforms |
216 | offer such functionality in their GPIO support; a valid implementation | 229 | offer 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 | |||
223 | way; it just marks that GPIO as in use. Separate code must handle any | 236 | way; it just marks that GPIO as in use. Separate code must handle any |
224 | pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). | 237 | pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). |
225 | 238 | ||
239 | Also note that it's your responsibility to have stopped using a GPIO | ||
240 | before you free it. | ||
241 | |||
226 | 242 | ||
227 | GPIOs mapped to IRQs | 243 | GPIOs mapped to IRQs |
228 | -------------------- | 244 | -------------------- |
@@ -238,7 +254,7 @@ map between them using calls like: | |||
238 | 254 | ||
239 | Those return either the corresponding number in the other namespace, or | 255 | Those return either the corresponding number in the other namespace, or |
240 | else a negative errno code if the mapping can't be done. (For example, | 256 | else a negative errno code if the mapping can't be done. (For example, |
241 | some GPIOs can't used as IRQs.) It is an unchecked error to use a GPIO | 257 | some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO |
242 | number that wasn't set up as an input using gpio_direction_input(), or | 258 | number that wasn't set up as an input using gpio_direction_input(), or |
243 | to use an IRQ number that didn't originally come from gpio_to_irq(). | 259 | to 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 | |||
299 | pulldowns integrated on some platforms. Not all platforms support them, | 315 | pulldowns integrated on some platforms. Not all platforms support them, |
300 | or support them in the same way; and any given board might use external | 316 | or support them in the same way; and any given board might use external |
301 | pullups (or pulldowns) so that the on-chip ones should not be used. | 317 | pullups (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 | ||
303 | There are other system-specific mechanisms that are not specified here, | 320 | There are other system-specific mechanisms that are not specified here, |
304 | like the aforementioned options for input de-glitching and wire-OR output. | 321 | like the aforementioned options for input de-glitching and wire-OR output. |
305 | Hardware may support reading or writing GPIOs in gangs, but that's usually | 322 | Hardware may support reading or writing GPIOs in gangs, but that's usually |
306 | configuration dependent: for GPIOs sharing the same bank. (GPIOs are | 323 | configuration dependent: for GPIOs sharing the same bank. (GPIOs are |
307 | commonly grouped in banks of 16 or 32, with a given SOC having several such | 324 | commonly grouped in banks of 16 or 32, with a given SOC having several such |
308 | banks.) Some systems can trigger IRQs from output GPIOs. Code relying on | 325 | banks.) Some systems can trigger IRQs from output GPIOs, or read values |
309 | such mechanisms will necessarily be nonportable. | 326 | from pins not managed as GPIOs. Code relying on such mechanisms will |
327 | necessarily be nonportable. | ||
310 | 328 | ||
311 | Dynamic definition of GPIOs is not currently supported; for example, as | 329 | Dynamic definition of GPIOs is not currently standard; for example, as |
312 | a side effect of configuring an add-on board with some GPIO expanders. | 330 | a side effect of configuring an add-on board with some GPIO expanders. |
313 | 331 | ||
314 | These calls are purely for kernel space, but a userspace API could be built | 332 | These calls are purely for kernel space, but a userspace API could be built |
315 | on top of it. | 333 | on top of them. |
334 | |||
335 | |||
336 | GPIO implementor's framework (OPTIONAL) | ||
337 | ======================================= | ||
338 | As noted earlier, there is an optional implementation framework making it | ||
339 | easier for platforms to support different kinds of GPIO controller using | ||
340 | the same programming interface. | ||
341 | |||
342 | As a debugging aid, if debugfs is available a /sys/kernel/debug/gpio file | ||
343 | will be found there. That will list all the controllers registered through | ||
344 | this framework, and the state of the GPIOs currently in use. | ||
345 | |||
346 | |||
347 | Controller Drivers: gpio_chip | ||
348 | ----------------------------- | ||
349 | In this framework each GPIO controller is packaged as a "struct gpio_chip" | ||
350 | with 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 | |||
358 | There is also per-instance data, which may come from device.platform_data: | ||
359 | the number of its first GPIO, and how many GPIOs it exposes. | ||
360 | |||
361 | The code implementing a gpio_chip should support multiple instances of the | ||
362 | controller, possibly using the driver model. That code will configure each | ||
363 | gpio_chip and issue gpiochip_add(). Removing a GPIO controller should be | ||
364 | rare; use gpiochip_remove() when it is unavoidable. | ||
365 | |||
366 | Most often a gpio_chip is part of an instance-specific structure with state | ||
367 | not exposed by the GPIO interfaces, such as addressing, power management, | ||
368 | and more. Chips such as codecs will have complex non-GPIO state, | ||
369 | |||
370 | Any debugfs dump method should normally ignore signals which haven't been | ||
371 | requested as GPIOs. They can use gpiochip_is_requested(), which returns | ||
372 | either NULL or the label associated with that GPIO when it was requested. | ||
373 | |||
374 | |||
375 | Platform Support | ||
376 | ---------------- | ||
377 | To support this framework, a platform's Kconfig will "select HAVE_GPIO_LIB" | ||
378 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines | ||
379 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). | ||
380 | They may also want to provide a custom value for ARCH_NR_GPIOS. | ||
381 | |||
382 | Trivial implementations of those functions can directly use framework | ||
383 | code, 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 | |||
389 | Fancier implementations could instead define those as inline functions with | ||
390 | logic optimizing access to specific SOC-based GPIOs. For example, if the | ||
391 | referenced GPIO is the constant "12", getting or setting its value could | ||
392 | cost as little as two or three instructions, never sleeping. When such an | ||
393 | optimization is not possible those calls must delegate to the framework | ||
394 | code, costing at least a few dozen instructions. For bitbanged I/O, such | ||
395 | instruction savings can be significant. | ||
396 | |||
397 | For SOCs, platform-specific code defines and registers gpio_chip instances | ||
398 | for each bank of on-chip GPIOs. Those GPIOs should be numbered/labeled to | ||
399 | match chip vendor documentation, and directly match board schematics. They | ||
400 | may well start at zero and go up to a platform-specific limit. Such GPIOs | ||
401 | are normally integrated into platform initialization to make them always be | ||
402 | available, from arch_initcall() or earlier; they can often serve as IRQs. | ||
403 | |||
404 | |||
405 | Board Support | ||
406 | ------------- | ||
407 | For external GPIO controllers -- such as I2C or SPI expanders, ASICs, multi | ||
408 | function devices, FPGAs or CPLDs -- most often board-specific code handles | ||
409 | registering controller devices and ensures that their drivers know what GPIO | ||
410 | numbers to use with gpiochip_add(). Their numbers often start right after | ||
411 | platform-specific GPIOs. | ||
412 | |||
413 | For example, board setup code could create structures identifying the range | ||
414 | of GPIOs that chip will expose, and passes them to each GPIO expander chip | ||
415 | using platform_data. Then the chip driver's probe() routine could pass that | ||
416 | data to gpiochip_add(). | ||
417 | |||
418 | Initialization order can be important. For example, when a device relies on | ||
419 | an I2C-based GPIO, its probe() routine should only be called after that GPIO | ||
420 | becomes available. That may mean the device should not be registered until | ||
421 | calls for that GPIO can work. One way to address such dependencies is for | ||
422 | such gpio_chip controllers to provide setup() and teardown() callbacks to | ||
423 | board specific code; those board specific callbacks would register devices | ||
424 | once all the necessary resources are available. | ||
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index fde4420e3f75..3bd958360159 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -17,9 +17,8 @@ Supported adapters: | |||
17 | Datasheets: Publicly available at the Intel website | 17 | Datasheets: Publicly available at the Intel website |
18 | 18 | ||
19 | Authors: | 19 | Authors: |
20 | Frodo Looijaard <frodol@dds.nl>, | ||
21 | Philip Edelbrock <phil@netroedge.com>, | ||
22 | Mark Studebaker <mdsxyz123@yahoo.com> | 20 | Mark Studebaker <mdsxyz123@yahoo.com> |
21 | Jean Delvare <khali@linux-fr.org> | ||
23 | 22 | ||
24 | 23 | ||
25 | Module Parameters | 24 | Module Parameters |
@@ -62,7 +61,7 @@ Not supported. | |||
62 | I2C Block Read Support | 61 | I2C Block Read Support |
63 | ---------------------- | 62 | ---------------------- |
64 | 63 | ||
65 | Not supported at the moment. | 64 | I2C block read is supported on the 82801EB (ICH5) and later chips. |
66 | 65 | ||
67 | 66 | ||
68 | SMBus 2.0 Support | 67 | SMBus 2.0 Support |
diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro index 06b4be3ef6d8..1405fb69984c 100644 --- a/Documentation/i2c/busses/i2c-viapro +++ b/Documentation/i2c/busses/i2c-viapro | |||
@@ -10,7 +10,7 @@ Supported adapters: | |||
10 | * VIA Technologies, Inc. VT8231, VT8233, VT8233A | 10 | * VIA Technologies, Inc. VT8231, VT8233, VT8233A |
11 | Datasheet: available on request from VIA | 11 | Datasheet: available on request from VIA |
12 | 12 | ||
13 | * VIA Technologies, Inc. VT8235, VT8237R, VT8237A, VT8251 | 13 | * VIA Technologies, Inc. VT8235, VT8237R, VT8237A, VT8237S, VT8251 |
14 | Datasheet: available on request and under NDA from VIA | 14 | Datasheet: available on request and under NDA from VIA |
15 | 15 | ||
16 | * VIA Technologies, Inc. CX700 | 16 | * VIA Technologies, Inc. CX700 |
@@ -46,6 +46,7 @@ Your lspci -n listing must show one of these : | |||
46 | device 1106:3177 (VT8235) | 46 | device 1106:3177 (VT8235) |
47 | device 1106:3227 (VT8237R) | 47 | device 1106:3227 (VT8237R) |
48 | device 1106:3337 (VT8237A) | 48 | device 1106:3337 (VT8237A) |
49 | device 1106:3372 (VT8237S) | ||
49 | device 1106:3287 (VT8251) | 50 | device 1106:3287 (VT8251) |
50 | device 1106:8324 (CX700) | 51 | device 1106:8324 (CX700) |
51 | 52 | ||
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 @@ | |||
1 | Kernel driver pca9539 | 1 | Kernel driver pca9539 |
2 | ===================== | 2 | ===================== |
3 | 3 | ||
4 | NOTE: this driver is deprecated and will be dropped soon, use | ||
5 | drivers/gpio/pca9539.c instead. | ||
6 | |||
4 | Supported chips: | 7 | Supported chips: |
5 | * Philips PCA9539 | 8 | * Philips PCA9539 |
6 | Prefix: 'pca9539' | 9 | Prefix: 'pca9539' |
diff --git a/Documentation/i2c/chips/pcf8575 b/Documentation/i2c/chips/pcf8575 new file mode 100644 index 000000000000..25f5698a61cf --- /dev/null +++ b/Documentation/i2c/chips/pcf8575 | |||
@@ -0,0 +1,72 @@ | |||
1 | About the PCF8575 chip and the pcf8575 kernel driver | ||
2 | ==================================================== | ||
3 | |||
4 | The PCF8575 chip is produced by the following manufacturers: | ||
5 | |||
6 | * Philips NXP | ||
7 | http://www.nxp.com/#/pip/cb=[type=product,path=50807/41735/41850,final=PCF8575_3]|pip=[pip=PCF8575_3][0] | ||
8 | |||
9 | * Texas Instruments | ||
10 | http://focus.ti.com/docs/prod/folders/print/pcf8575.html | ||
11 | |||
12 | |||
13 | Some vendors sell small PCB's with the PCF8575 mounted on it. You can connect | ||
14 | such a board to a Linux host via e.g. an USB to I2C interface. Examples of | ||
15 | PCB boards with a PCF8575: | ||
16 | |||
17 | * SFE Breakout Board for PCF8575 I2C Expander by RobotShop | ||
18 | http://www.robotshop.ca/home/products/robot-parts/electronics/adapters-converters/sfe-pcf8575-i2c-expander-board.html | ||
19 | |||
20 | * Breakout Board for PCF8575 I2C Expander by Spark Fun Electronics | ||
21 | http://www.sparkfun.com/commerce/product_info.php?products_id=8130 | ||
22 | |||
23 | |||
24 | Description | ||
25 | ----------- | ||
26 | The PCF8575 chip is a 16-bit I/O expander for the I2C bus. Up to eight of | ||
27 | these chips can be connected to the same I2C bus. You can find this | ||
28 | chip on some custom designed hardware, but you won't find it on PC | ||
29 | motherboards. | ||
30 | |||
31 | The PCF8575 chip consists of a 16-bit quasi-bidirectional port and an I2C-bus | ||
32 | interface. Each of the sixteen I/O's can be independently used as an input or | ||
33 | an output. To set up an I/O pin as an input, you have to write a 1 to the | ||
34 | corresponding output. | ||
35 | |||
36 | For more information please see the datasheet. | ||
37 | |||
38 | |||
39 | Detection | ||
40 | --------- | ||
41 | |||
42 | There is no method known to detect whether a chip on a given I2C address is | ||
43 | a PCF8575 or whether it is any other I2C device. So there are two alternatives | ||
44 | to let the driver find the installed PCF8575 devices: | ||
45 | - Load this driver after any other I2C driver for I2C devices with addresses | ||
46 | in the range 0x20 .. 0x27. | ||
47 | - Pass the I2C bus and address of the installed PCF8575 devices explicitly to | ||
48 | the driver at load time via the probe=... or force=... parameters. | ||
49 | |||
50 | /sys interface | ||
51 | -------------- | ||
52 | |||
53 | For each address on which a PCF8575 chip was found or forced the following | ||
54 | files will be created under /sys: | ||
55 | * /sys/bus/i2c/devices/<bus>-<address>/read | ||
56 | * /sys/bus/i2c/devices/<bus>-<address>/write | ||
57 | where bus is the I2C bus number (0, 1, ...) and address is the four-digit | ||
58 | hexadecimal representation of the 7-bit I2C address of the PCF8575 | ||
59 | (0020 .. 0027). | ||
60 | |||
61 | The read file is read-only. Reading it will trigger an I2C read and will hence | ||
62 | report the current input state for the pins configured as inputs, and the | ||
63 | current output value for the pins configured as outputs. | ||
64 | |||
65 | The write file is read-write. Writing a value to it will configure all pins | ||
66 | as output for which the corresponding bit is zero. Reading the write file will | ||
67 | return the value last written, or -EAGAIN if no value has yet been written to | ||
68 | the write file. | ||
69 | |||
70 | On module initialization the configuration of the chip is not changed -- the | ||
71 | chip is left in the state it was already configured in through either power-up | ||
72 | or through previous I2C write actions. | ||
diff --git a/Documentation/i2c/i2c-stub b/Documentation/i2c/i2c-stub index 89e69ad3436c..0d8be1c20c16 100644 --- a/Documentation/i2c/i2c-stub +++ b/Documentation/i2c/i2c-stub | |||
@@ -25,6 +25,9 @@ The typical use-case is like this: | |||
25 | 3. load the target sensors chip driver module | 25 | 3. load the target sensors chip driver module |
26 | 4. observe its behavior in the kernel log | 26 | 4. observe its behavior in the kernel log |
27 | 27 | ||
28 | There's a script named i2c-stub-from-dump in the i2c-tools package which | ||
29 | can load register values automatically from a chip dump. | ||
30 | |||
28 | PARAMETERS: | 31 | PARAMETERS: |
29 | 32 | ||
30 | int chip_addr[10]: | 33 | int chip_addr[10]: |
@@ -32,9 +35,6 @@ int chip_addr[10]: | |||
32 | 35 | ||
33 | CAVEATS: | 36 | CAVEATS: |
34 | 37 | ||
35 | There are independent arrays for byte/data and word/data commands. Depending | ||
36 | on if/how a target driver mixes them, you'll need to be careful. | ||
37 | |||
38 | If your target driver polls some byte or word waiting for it to change, the | 38 | If your target driver polls some byte or word waiting for it to change, the |
39 | stub could lock it up. Use i2cset to unlock it. | 39 | stub could lock it up. Use i2cset to unlock it. |
40 | 40 | ||
diff --git a/Documentation/i2c/summary b/Documentation/i2c/summary index 003c7319b8c7..13ab076dcd92 100644 --- a/Documentation/i2c/summary +++ b/Documentation/i2c/summary | |||
@@ -1,5 +1,3 @@ | |||
1 | This is an explanation of what i2c is, and what is supported in this package. | ||
2 | |||
3 | I2C and SMBus | 1 | I2C and SMBus |
4 | ============= | 2 | ============= |
5 | 3 | ||
@@ -33,52 +31,17 @@ When we talk about I2C, we use the following terms: | |||
33 | Client | 31 | Client |
34 | 32 | ||
35 | An Algorithm driver contains general code that can be used for a whole class | 33 | An Algorithm driver contains general code that can be used for a whole class |
36 | of I2C adapters. Each specific adapter driver depends on one algorithm | 34 | of I2C adapters. Each specific adapter driver either depends on one algorithm |
37 | driver. | 35 | driver, or includes its own implementation. |
38 | 36 | ||
39 | A Driver driver (yes, this sounds ridiculous, sorry) contains the general | 37 | A Driver driver (yes, this sounds ridiculous, sorry) contains the general |
40 | code to access some type of device. Each detected device gets its own | 38 | code to access some type of device. Each detected device gets its own |
41 | data in the Client structure. Usually, Driver and Client are more closely | 39 | data in the Client structure. Usually, Driver and Client are more closely |
42 | integrated than Algorithm and Adapter. | 40 | integrated than Algorithm and Adapter. |
43 | 41 | ||
44 | For a given configuration, you will need a driver for your I2C bus (usually | 42 | For a given configuration, you will need a driver for your I2C bus, and |
45 | a separate Adapter and Algorithm driver), and drivers for your I2C devices | 43 | drivers for your I2C devices (usually one driver for each device). |
46 | (usually one driver for each device). There are no I2C device drivers | ||
47 | in this package. See the lm_sensors project http://www.lm-sensors.nu | ||
48 | for device drivers. | ||
49 | 44 | ||
50 | At this time, Linux only operates I2C (or SMBus) in master mode; you can't | 45 | At this time, Linux only operates I2C (or SMBus) in master mode; you can't |
51 | use these APIs to make a Linux system behave as a slave/device, either to | 46 | use these APIs to make a Linux system behave as a slave/device, either to |
52 | speak a custom protocol or to emulate some other device. | 47 | speak a custom protocol or to emulate some other device. |
53 | |||
54 | |||
55 | Included Bus Drivers | ||
56 | ==================== | ||
57 | Note that only stable drivers are patched into the kernel by 'mkpatch'. | ||
58 | |||
59 | |||
60 | Base modules | ||
61 | ------------ | ||
62 | |||
63 | i2c-core: The basic I2C code, including the /proc/bus/i2c* interface | ||
64 | i2c-dev: The /dev/i2c-* interface | ||
65 | i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers | ||
66 | |||
67 | Algorithm drivers | ||
68 | ----------------- | ||
69 | |||
70 | i2c-algo-bit: A bit-banging algorithm | ||
71 | i2c-algo-pcf: A PCF 8584 style algorithm | ||
72 | i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT) | ||
73 | |||
74 | Adapter drivers | ||
75 | --------------- | ||
76 | |||
77 | i2c-elektor: Elektor ISA card (uses i2c-algo-pcf) | ||
78 | i2c-elv: ELV parallel port adapter (uses i2c-algo-bit) | ||
79 | i2c-pcf-epp: PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched) | ||
80 | i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit) | ||
81 | i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT) | ||
82 | i2c-pport: Primitive parallel port adapter (uses i2c-algo-bit) | ||
83 | i2c-velleman: Velleman K8000 parallel port adapter (uses i2c-algo-bit) | ||
84 | |||
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 2c170032bf37..bfb0a5520817 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -267,9 +267,9 @@ insmod parameter of the form force_<kind>. | |||
267 | Fortunately, as a module writer, you just have to define the `normal_i2c' | 267 | Fortunately, as a module writer, you just have to define the `normal_i2c' |
268 | parameter. The complete declaration could look like this: | 268 | parameter. The complete declaration could look like this: |
269 | 269 | ||
270 | /* Scan 0x37, and 0x48 to 0x4f */ | 270 | /* Scan 0x4c to 0x4f */ |
271 | static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c, | 271 | static const unsigned short normal_i2c[] = { 0x4c, 0x4d, 0x4e, 0x4f, |
272 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; | 272 | I2C_CLIENT_END }; |
273 | 273 | ||
274 | /* Magic definition of all other variables and things */ | 274 | /* Magic definition of all other variables and things */ |
275 | I2C_CLIENT_INSMOD; | 275 | I2C_CLIENT_INSMOD; |
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 | ||
119 | char buf[1024]; | 120 | char 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 | ||
207 | int main() | 208 | int 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.txt b/Documentation/ide.txt index 1d50f23a5cab..94e2e3b9e77f 100644 --- a/Documentation/ide.txt +++ b/Documentation/ide.txt | |||
@@ -30,7 +30,7 @@ | |||
30 | *** | 30 | *** |
31 | *** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT* | 31 | *** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT* |
32 | *** automatically detected by Linux. For safe, reliable operation with such | 32 | *** automatically detected by Linux. For safe, reliable operation with such |
33 | *** interfaces, one *MUST* use the "ide0=cmd640_vlb" kernel option. | 33 | *** interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option. |
34 | *** | 34 | *** |
35 | *** Use of the "serialize" option is no longer necessary. | 35 | *** Use of the "serialize" option is no longer necessary. |
36 | 36 | ||
@@ -244,10 +244,6 @@ Summary of ide driver parameters for kernel command line | |||
244 | 244 | ||
245 | "hdx=nodma" : disallow DMA | 245 | "hdx=nodma" : disallow DMA |
246 | 246 | ||
247 | "hdx=swapdata" : when the drive is a disk, byte swap all data | ||
248 | |||
249 | "hdx=bswap" : same as above.......... | ||
250 | |||
251 | "hdx=scsi" : the return of the ide-scsi flag, this is useful for | 247 | "hdx=scsi" : the return of the ide-scsi flag, this is useful for |
252 | allowing ide-floppy, ide-tape, and ide-cdrom|writers | 248 | allowing ide-floppy, ide-tape, and ide-cdrom|writers |
253 | to use ide-scsi emulation on a device specific option. | 249 | to use ide-scsi emulation on a device specific option. |
@@ -292,9 +288,6 @@ The following are valid ONLY on ide0, which usually corresponds | |||
292 | to the first ATA interface found on the particular host, and the defaults for | 288 | to the first ATA interface found on the particular host, and the defaults for |
293 | the base,ctl ports must not be altered. | 289 | the base,ctl ports must not be altered. |
294 | 290 | ||
295 | "ide0=cmd640_vlb" : *REQUIRED* for VLB cards with the CMD640 chip | ||
296 | (not for PCI -- automatically detected) | ||
297 | |||
298 | "ide=doubler" : probe/support IDE doublers on Amiga | 291 | "ide=doubler" : probe/support IDE doublers on Amiga |
299 | 292 | ||
300 | There may be more options than shown -- use the source, Luke! | 293 | There may be more options than shown -- use the source, Luke! |
@@ -310,6 +303,10 @@ i.e. to enable probing for ALI M14xx chipsets (ali14xx host driver) use: | |||
310 | * "probe" module parameter when ali14xx driver is compiled as module | 303 | * "probe" module parameter when ali14xx driver is compiled as module |
311 | ("modprobe ali14xx probe") | 304 | ("modprobe ali14xx probe") |
312 | 305 | ||
306 | Also for legacy CMD640 host driver (cmd640) you need to use "probe_vlb" | ||
307 | kernel paremeter to enable probing for VLB version of the chipset (PCI ones | ||
308 | are detected automatically). | ||
309 | |||
313 | ================================================================================ | 310 | ================================================================================ |
314 | 311 | ||
315 | IDE ATAPI streaming tape driver | 312 | IDE ATAPI streaming tape driver |
diff --git a/Documentation/ide/ChangeLog.ide-cd.1994-2004 b/Documentation/ide/ChangeLog.ide-cd.1994-2004 new file mode 100644 index 000000000000..190d17bfff62 --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-cd.1994-2004 | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * 1.00 Oct 31, 1994 -- Initial version. | ||
3 | * 1.01 Nov 2, 1994 -- Fixed problem with starting request in | ||
4 | * cdrom_check_status. | ||
5 | * 1.03 Nov 25, 1994 -- leaving unmask_intr[] as a user-setting (as for disks) | ||
6 | * (from mlord) -- minor changes to cdrom_setup() | ||
7 | * -- renamed ide_dev_s to ide_drive_t, enable irq on command | ||
8 | * 2.00 Nov 27, 1994 -- Generalize packet command interface; | ||
9 | * add audio ioctls. | ||
10 | * 2.01 Dec 3, 1994 -- Rework packet command interface to handle devices | ||
11 | * which send an interrupt when ready for a command. | ||
12 | * 2.02 Dec 11, 1994 -- Cache the TOC in the driver. | ||
13 | * Don't use SCMD_PLAYAUDIO_TI; it's not included | ||
14 | * in the current version of ATAPI. | ||
15 | * Try to use LBA instead of track or MSF addressing | ||
16 | * when possible. | ||
17 | * Don't wait for READY_STAT. | ||
18 | * 2.03 Jan 10, 1995 -- Rewrite block read routines to handle block sizes | ||
19 | * other than 2k and to move multiple sectors in a | ||
20 | * single transaction. | ||
21 | * 2.04 Apr 21, 1995 -- Add work-around for Creative Labs CD220E drives. | ||
22 | * Thanks to Nick Saw <cwsaw@pts7.pts.mot.com> for | ||
23 | * help in figuring this out. Ditto for Acer and | ||
24 | * Aztech drives, which seem to have the same problem. | ||
25 | * 2.04b May 30, 1995 -- Fix to match changes in ide.c version 3.16 -ml | ||
26 | * 2.05 Jun 8, 1995 -- Don't attempt to retry after an illegal request | ||
27 | * or data protect error. | ||
28 | * Use HWIF and DEV_HWIF macros as in ide.c. | ||
29 | * Always try to do a request_sense after | ||
30 | * a failed command. | ||
31 | * Include an option to give textual descriptions | ||
32 | * of ATAPI errors. | ||
33 | * Fix a bug in handling the sector cache which | ||
34 | * showed up if the drive returned data in 512 byte | ||
35 | * blocks (like Pioneer drives). Thanks to | ||
36 | * Richard Hirst <srh@gpt.co.uk> for diagnosing this. | ||
37 | * Properly supply the page number field in the | ||
38 | * MODE_SELECT command. | ||
39 | * PLAYAUDIO12 is broken on the Aztech; work around it. | ||
40 | * 2.05x Aug 11, 1995 -- lots of data structure renaming/restructuring in ide.c | ||
41 | * (my apologies to Scott, but now ide-cd.c is independent) | ||
42 | * 3.00 Aug 22, 1995 -- Implement CDROMMULTISESSION ioctl. | ||
43 | * Implement CDROMREADAUDIO ioctl (UNTESTED). | ||
44 | * Use input_ide_data() and output_ide_data(). | ||
45 | * Add door locking. | ||
46 | * Fix usage count leak in cdrom_open, which happened | ||
47 | * when a read-write mount was attempted. | ||
48 | * Try to load the disk on open. | ||
49 | * Implement CDROMEJECT_SW ioctl (off by default). | ||
50 | * Read total cdrom capacity during open. | ||
51 | * Rearrange logic in cdrom_decode_status. Issue | ||
52 | * request sense commands for failed packet commands | ||
53 | * from here instead of from cdrom_queue_packet_command. | ||
54 | * Fix a race condition in retrieving error information. | ||
55 | * Suppress printing normal unit attention errors and | ||
56 | * some drive not ready errors. | ||
57 | * Implement CDROMVOLREAD ioctl. | ||
58 | * Implement CDROMREADMODE1/2 ioctls. | ||
59 | * Fix race condition in setting up interrupt handlers | ||
60 | * when the `serialize' option is used. | ||
61 | * 3.01 Sep 2, 1995 -- Fix ordering of reenabling interrupts in | ||
62 | * cdrom_queue_request. | ||
63 | * Another try at using ide_[input,output]_data. | ||
64 | * 3.02 Sep 16, 1995 -- Stick total disk capacity in partition table as well. | ||
65 | * Make VERBOSE_IDE_CD_ERRORS dump failed command again. | ||
66 | * Dump out more information for ILLEGAL REQUEST errs. | ||
67 | * Fix handling of errors occurring before the | ||
68 | * packet command is transferred. | ||
69 | * Fix transfers with odd bytelengths. | ||
70 | * 3.03 Oct 27, 1995 -- Some Creative drives have an id of just `CD'. | ||
71 | * `DCI-2S10' drives are broken too. | ||
72 | * 3.04 Nov 20, 1995 -- So are Vertos drives. | ||
73 | * 3.05 Dec 1, 1995 -- Changes to go with overhaul of ide.c and ide-tape.c | ||
74 | * 3.06 Dec 16, 1995 -- Add support needed for partitions. | ||
75 | * More workarounds for Vertos bugs (based on patches | ||
76 | * from Holger Dietze <dietze@aix520.informatik.uni-leipzig.de>). | ||
77 | * Try to eliminate byteorder assumptions. | ||
78 | * Use atapi_cdrom_subchnl struct definition. | ||
79 | * Add STANDARD_ATAPI compilation option. | ||
80 | * 3.07 Jan 29, 1996 -- More twiddling for broken drives: Sony 55D, | ||
81 | * Vertos 300. | ||
82 | * Add NO_DOOR_LOCKING configuration option. | ||
83 | * Handle drive_cmd requests w/NULL args (for hdparm -t). | ||
84 | * Work around sporadic Sony55e audio play problem. | ||
85 | * 3.07a Feb 11, 1996 -- check drive->id for NULL before dereferencing, to fix | ||
86 | * problem with "hde=cdrom" with no drive present. -ml | ||
87 | * 3.08 Mar 6, 1996 -- More Vertos workarounds. | ||
88 | * 3.09 Apr 5, 1996 -- Add CDROMCLOSETRAY ioctl. | ||
89 | * Switch to using MSF addressing for audio commands. | ||
90 | * Reformat to match kernel tabbing style. | ||
91 | * Add CDROM_GET_UPC ioctl. | ||
92 | * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI. | ||
93 | * 3.11 Apr 29, 1996 -- Patch from Heiko Eißfeldt <heiko@colossus.escape.de> | ||
94 | * to remove redundant verify_area calls. | ||
95 | * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches | ||
96 | * from Gerhard Zuber <zuber@berlin.snafu.de>. | ||
97 | * Let open succeed even if there's no loaded disc. | ||
98 | * 3.13 May 19, 1996 -- Fixes for changer code. | ||
99 | * 3.14 May 29, 1996 -- Add work-around for Vertos 600. | ||
100 | * (From Hennus Bergman <hennus@sky.ow.nl>.) | ||
101 | * 3.15 July 2, 1996 -- Added support for Sanyo 3 CD changers | ||
102 | * from Ben Galliart <bgallia@luc.edu> with | ||
103 | * special help from Jeff Lightfoot | ||
104 | * <jeffml@pobox.com> | ||
105 | * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification | ||
106 | * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl. | ||
107 | * 3.17 Sep 17, 1996 -- Tweak audio reads for some drives. | ||
108 | * Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC. | ||
109 | * 3.18 Oct 31, 1996 -- Added module and DMA support. | ||
110 | * | ||
111 | * 4.00 Nov 5, 1996 -- New ide-cd maintainer, | ||
112 | * Erik B. Andersen <andersee@debian.org> | ||
113 | * -- Newer Creative drives don't always set the error | ||
114 | * register correctly. Make sure we see media changes | ||
115 | * regardless. | ||
116 | * -- Integrate with generic cdrom driver. | ||
117 | * -- CDROMGETSPINDOWN and CDROMSETSPINDOWN ioctls, based on | ||
118 | * a patch from Ciro Cattuto <>. | ||
119 | * -- Call set_device_ro. | ||
120 | * -- Implement CDROMMECHANISMSTATUS and CDROMSLOTTABLE | ||
121 | * ioctls, based on patch by Erik Andersen | ||
122 | * -- Add some probes of drive capability during setup. | ||
123 | * | ||
124 | * 4.01 Nov 11, 1996 -- Split into ide-cd.c and ide-cd.h | ||
125 | * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE | ||
126 | * ioctls in favor of a generalized approach | ||
127 | * using the generic cdrom driver. | ||
128 | * -- Fully integrated with the 2.1.X kernel. | ||
129 | * -- Other stuff that I forgot (lots of changes) | ||
130 | * | ||
131 | * 4.02 Dec 01, 1996 -- Applied patch from Gadi Oxman <gadio@netvision.net.il> | ||
132 | * to fix the drive door locking problems. | ||
133 | * | ||
134 | * 4.03 Dec 04, 1996 -- Added DSC overlap support. | ||
135 | * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch | ||
136 | * by Ales Makarov (xmakarov@sun.felk.cvut.cz) | ||
137 | * | ||
138 | * 4.05 Nov 20, 1997 -- Modified to print more drive info on init | ||
139 | * Minor other changes | ||
140 | * Fix errors on CDROMSTOP (If you have a "Dolphin", | ||
141 | * you must define IHAVEADOLPHIN) | ||
142 | * Added identifier so new Sanyo CD-changer works | ||
143 | * Better detection if door locking isn't supported | ||
144 | * | ||
145 | * 4.06 Dec 17, 1997 -- fixed endless "tray open" messages -ml | ||
146 | * 4.07 Dec 17, 1997 -- fallback to set pc->stat on "tray open" | ||
147 | * 4.08 Dec 18, 1997 -- spew less noise when tray is empty | ||
148 | * -- fix speed display for ACER 24X, 18X | ||
149 | * 4.09 Jan 04, 1998 -- fix handling of the last block so we return | ||
150 | * an end of file instead of an I/O error (Gadi) | ||
151 | * 4.10 Jan 24, 1998 -- fixed a bug so now changers can change to a new | ||
152 | * slot when there is no disc in the current slot. | ||
153 | * -- Fixed a memory leak where info->changer_info was | ||
154 | * malloc'ed but never free'd when closing the device. | ||
155 | * -- Cleaned up the global namespace a bit by making more | ||
156 | * functions static that should already have been. | ||
157 | * 4.11 Mar 12, 1998 -- Added support for the CDROM_SELECT_SPEED ioctl | ||
158 | * based on a patch for 2.0.33 by Jelle Foks | ||
159 | * <jelle@scintilla.utwente.nl>, a patch for 2.0.33 | ||
160 | * by Toni Giorgino <toni@pcape2.pi.infn.it>, the SCSI | ||
161 | * version, and my own efforts. -erik | ||
162 | * -- Fixed a stupid bug which egcs was kind enough to | ||
163 | * inform me of where "Illegal mode for this track" | ||
164 | * was never returned due to a comparison on data | ||
165 | * types of limited range. | ||
166 | * 4.12 Mar 29, 1998 -- Fixed bug in CDROM_SELECT_SPEED so write speed is | ||
167 | * now set ionly for CD-R and CD-RW drives. I had | ||
168 | * removed this support because it produced errors. | ||
169 | * It produced errors _only_ for non-writers. duh. | ||
170 | * 4.13 May 05, 1998 -- Suppress useless "in progress of becoming ready" | ||
171 | * messages, since this is not an error. | ||
172 | * -- Change error messages to be const | ||
173 | * -- Remove a "\t" which looks ugly in the syslogs | ||
174 | * 4.14 July 17, 1998 -- Change to pointing to .ps version of ATAPI spec | ||
175 | * since the .pdf version doesn't seem to work... | ||
176 | * -- Updated the TODO list to something more current. | ||
177 | * | ||
178 | * 4.15 Aug 25, 1998 -- Updated ide-cd.h to respect mechine endianess, | ||
179 | * patch thanks to "Eddie C. Dost" <ecd@skynet.be> | ||
180 | * | ||
181 | * 4.50 Oct 19, 1998 -- New maintainers! | ||
182 | * Jens Axboe <axboe@image.dk> | ||
183 | * Chris Zwilling <chris@cloudnet.com> | ||
184 | * | ||
185 | * 4.51 Dec 23, 1998 -- Jens Axboe <axboe@image.dk> | ||
186 | * - ide_cdrom_reset enabled since the ide subsystem | ||
187 | * handles resets fine now. <axboe@image.dk> | ||
188 | * - Transfer size fix for Samsung CD-ROMs, thanks to | ||
189 | * "Ville Hallik" <ville.hallik@mail.ee>. | ||
190 | * - other minor stuff. | ||
191 | * | ||
192 | * 4.52 Jan 19, 1999 -- Jens Axboe <axboe@image.dk> | ||
193 | * - Detect DVD-ROM/RAM drives | ||
194 | * | ||
195 | * 4.53 Feb 22, 1999 - Include other model Samsung and one Goldstar | ||
196 | * drive in transfer size limit. | ||
197 | * - Fix the I/O error when doing eject without a medium | ||
198 | * loaded on some drives. | ||
199 | * - CDROMREADMODE2 is now implemented through | ||
200 | * CDROMREADRAW, since many drives don't support | ||
201 | * MODE2 (even though ATAPI 2.6 says they must). | ||
202 | * - Added ignore parameter to ide-cd (as a module), eg | ||
203 | * insmod ide-cd ignore='hda hdb' | ||
204 | * Useful when using ide-cd in conjunction with | ||
205 | * ide-scsi. TODO: non-modular way of doing the | ||
206 | * same. | ||
207 | * | ||
208 | * 4.54 Aug 5, 1999 - Support for MMC2 class commands through the generic | ||
209 | * packet interface to cdrom.c. | ||
210 | * - Unified audio ioctl support, most of it. | ||
211 | * - cleaned up various deprecated verify_area(). | ||
212 | * - Added ide_cdrom_packet() as the interface for | ||
213 | * the Uniform generic_packet(). | ||
214 | * - bunch of other stuff, will fill in logs later. | ||
215 | * - report 1 slot for non-changers, like the other | ||
216 | * cd-rom drivers. don't report select disc for | ||
217 | * non-changers as well. | ||
218 | * - mask out audio playing, if the device can't do it. | ||
219 | * | ||
220 | * 4.55 Sep 1, 1999 - Eliminated the rest of the audio ioctls, except | ||
221 | * for CDROMREADTOC[ENTRY|HEADER]. Some of the drivers | ||
222 | * use this independently of the actual audio handling. | ||
223 | * They will disappear later when I get the time to | ||
224 | * do it cleanly. | ||
225 | * - Minimize the TOC reading - only do it when we | ||
226 | * know a media change has occurred. | ||
227 | * - Moved all the CDROMREADx ioctls to the Uniform layer. | ||
228 | * - Heiko Eißfeldt <heiko@colossus.escape.de> supplied | ||
229 | * some fixes for CDI. | ||
230 | * - CD-ROM leaving door locked fix from Andries | ||
231 | * Brouwer <Andries.Brouwer@cwi.nl> | ||
232 | * - Erik Andersen <andersen@xmission.com> unified | ||
233 | * commands across the various drivers and how | ||
234 | * sense errors are handled. | ||
235 | * | ||
236 | * 4.56 Sep 12, 1999 - Removed changer support - it is now in the | ||
237 | * Uniform layer. | ||
238 | * - Added partition based multisession handling. | ||
239 | * - Mode sense and mode select moved to the | ||
240 | * Uniform layer. | ||
241 | * - Fixed a problem with WPI CDS-32X drive - it | ||
242 | * failed the capabilities | ||
243 | * | ||
244 | * 4.57 Apr 7, 2000 - Fixed sense reporting. | ||
245 | * - Fixed possible oops in ide_cdrom_get_last_session() | ||
246 | * - Fix locking mania and make ide_cdrom_reset relock | ||
247 | * - Stop spewing errors to log when magicdev polls with | ||
248 | * TEST_UNIT_READY on some drives. | ||
249 | * - Various fixes from Tobias Ringstrom: | ||
250 | * tray if it was locked prior to the reset. | ||
251 | * - cdrom_read_capacity returns one frame too little. | ||
252 | * - Fix real capacity reporting. | ||
253 | * | ||
254 | * 4.58 May 1, 2000 - Clean up ACER50 stuff. | ||
255 | * - Fix small problem with ide_cdrom_capacity | ||
256 | * | ||
257 | * 4.59 Aug 11, 2000 - Fix changer problem in cdrom_read_toc, we weren't | ||
258 | * correctly sensing a disc change. | ||
259 | * - Rearranged some code | ||
260 | * - Use extended sense on drives that support it for | ||
261 | * correctly reporting tray status -- from | ||
262 | * Michael D Johnson <johnsom@orst.edu> | ||
263 | * 4.60 Dec 17, 2003 - Add mt rainier support | ||
264 | * - Bump timeout for packet commands, matches sr | ||
265 | * - Odd stuff | ||
266 | * 4.61 Jan 22, 2004 - support hardware sector sizes other than 2kB, | ||
267 | * Pascal Schmidt <der.eremit@email.de> | ||
268 | */ | ||
diff --git a/Documentation/ide/ChangeLog.ide-floppy.1996-2002 b/Documentation/ide/ChangeLog.ide-floppy.1996-2002 new file mode 100644 index 000000000000..46c19ef32a9e --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-floppy.1996-2002 | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Many thanks to Lode Leroy <Lode.Leroy@www.ibase.be>, who tested so many | ||
3 | * ALPHA patches to this driver on an EASYSTOR LS-120 ATAPI floppy drive. | ||
4 | * | ||
5 | * Ver 0.1 Oct 17 96 Initial test version, mostly based on ide-tape.c. | ||
6 | * Ver 0.2 Oct 31 96 Minor changes. | ||
7 | * Ver 0.3 Dec 2 96 Fixed error recovery bug. | ||
8 | * Ver 0.4 Jan 26 97 Add support for the HDIO_GETGEO ioctl. | ||
9 | * Ver 0.5 Feb 21 97 Add partitions support. | ||
10 | * Use the minimum of the LBA and CHS capacities. | ||
11 | * Avoid hwgroup->rq == NULL on the last irq. | ||
12 | * Fix potential null dereferencing with DEBUG_LOG. | ||
13 | * Ver 0.8 Dec 7 97 Increase irq timeout from 10 to 50 seconds. | ||
14 | * Add media write-protect detection. | ||
15 | * Issue START command only if TEST UNIT READY fails. | ||
16 | * Add work-around for IOMEGA ZIP revision 21.D. | ||
17 | * Remove idefloppy_get_capabilities(). | ||
18 | * Ver 0.9 Jul 4 99 Fix a bug which might have caused the number of | ||
19 | * bytes requested on each interrupt to be zero. | ||
20 | * Thanks to <shanos@es.co.nz> for pointing this out. | ||
21 | * Ver 0.9.sv Jan 6 01 Sam Varshavchik <mrsam@courier-mta.com> | ||
22 | * Implement low level formatting. Reimplemented | ||
23 | * IDEFLOPPY_CAPABILITIES_PAGE, since we need the srfp | ||
24 | * bit. My LS-120 drive barfs on | ||
25 | * IDEFLOPPY_CAPABILITIES_PAGE, but maybe it's just me. | ||
26 | * Compromise by not reporting a failure to get this | ||
27 | * mode page. Implemented four IOCTLs in order to | ||
28 | * implement formatting. IOCTls begin with 0x4600, | ||
29 | * 0x46 is 'F' as in Format. | ||
30 | * Jan 9 01 Userland option to select format verify. | ||
31 | * Added PC_SUPPRESS_ERROR flag - some idefloppy drives | ||
32 | * do not implement IDEFLOPPY_CAPABILITIES_PAGE, and | ||
33 | * return a sense error. Suppress error reporting in | ||
34 | * this particular case in order to avoid spurious | ||
35 | * errors in syslog. The culprit is | ||
36 | * idefloppy_get_capability_page(), so move it to | ||
37 | * idefloppy_begin_format() so that it's not used | ||
38 | * unless absolutely necessary. | ||
39 | * If drive does not support format progress indication | ||
40 | * monitor the dsc bit in the status register. | ||
41 | * Also, O_NDELAY on open will allow the device to be | ||
42 | * opened without a disk available. This can be used to | ||
43 | * open an unformatted disk, or get the device capacity. | ||
44 | * Ver 0.91 Dec 11 99 Added IOMEGA Clik! drive support by | ||
45 | * <paul@paulbristow.net> | ||
46 | * Ver 0.92 Oct 22 00 Paul Bristow became official maintainer for this | ||
47 | * driver. Included Powerbook internal zip kludge. | ||
48 | * Ver 0.93 Oct 24 00 Fixed bugs for Clik! drive | ||
49 | * no disk on insert and disk change now works | ||
50 | * Ver 0.94 Oct 27 00 Tidied up to remove strstr(Clik) everywhere | ||
51 | * Ver 0.95 Nov 7 00 Brought across to kernel 2.4 | ||
52 | * Ver 0.96 Jan 7 01 Actually in line with release version of 2.4.0 | ||
53 | * including set_bit patch from Rusty Russell | ||
54 | * Ver 0.97 Jul 22 01 Merge 0.91-0.96 onto 0.9.sv for ac series | ||
55 | * Ver 0.97.sv Aug 3 01 Backported from 2.4.7-ac3 | ||
56 | * Ver 0.98 Oct 26 01 Split idefloppy_transfer_pc into two pieces to | ||
57 | * fix a lost interrupt problem. It appears the busy | ||
58 | * bit was being deasserted by my IOMEGA ATAPI ZIP 100 | ||
59 | * drive before the drive was actually ready. | ||
60 | * Ver 0.98a Oct 29 01 Expose delay value so we can play. | ||
61 | * Ver 0.99 Feb 24 02 Remove duplicate code, modify clik! detection code | ||
62 | * to support new PocketZip drives | ||
63 | */ | ||
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 | |||
85 | disk with the desired initrd content, cd to that directory, and run (as an | 85 | disk with the desired initrd content, cd to that directory, and run (as an |
86 | example): | 86 | example): |
87 | 87 | ||
88 | find . | cpio --quiet -c -o | gzip -9 -n > /boot/imagefile.img | 88 | find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/imagefile.img |
89 | 89 | ||
90 | Examining the contents of an existing image file is just as simple: | 90 | Examining the contents of an existing image file is just as simple: |
91 | 91 | ||
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 5c7fbf9d96b4..c18363bd8d11 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt | |||
@@ -138,6 +138,7 @@ Code Seq# Include File Comments | |||
138 | 'm' 00-1F net/irda/irmod.h conflict! | 138 | 'm' 00-1F net/irda/irmod.h conflict! |
139 | 'n' 00-7F linux/ncp_fs.h | 139 | 'n' 00-7F linux/ncp_fs.h |
140 | 'n' E0-FF video/matrox.h matroxfb | 140 | 'n' E0-FF video/matrox.h matroxfb |
141 | 'o' 00-1F fs/ocfs2/ocfs2_fs.h OCFS2 | ||
141 | 'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this) | 142 | 'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this) |
142 | 'p' 00-3F linux/mc146818rtc.h conflict! | 143 | 'p' 00-3F linux/mc146818rtc.h conflict! |
143 | 'p' 40-7F linux/nvram.h | 144 | 'p' 40-7F linux/nvram.h |
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO index d9d832c010ef..488c77fa3aae 100644 --- a/Documentation/ja_JP/HOWTO +++ b/Documentation/ja_JP/HOWTO | |||
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a | |||
11 | fork. So if you have any comments or updates for this file, please try | 11 | fork. So if you have any comments or updates for this file, please try |
12 | to update the original English file first. | 12 | to update the original English file first. |
13 | 13 | ||
14 | Last Updated: 2007/09/23 | 14 | Last Updated: 2007/11/16 |
15 | ================================== | 15 | ================================== |
16 | これは、 | 16 | これは、 |
17 | linux-2.6.23/Documentation/HOWTO | 17 | linux-2.6.24/Documentation/HOWTO |
18 | の和訳です。 | 18 | の和訳です。 |
19 | 19 | ||
20 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > | 20 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > |
21 | 翻訳日: 2007/09/19 | 21 | 翻訳日: 2007/11/10 |
22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | 22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> |
23 | 校正者: 松倉さん <nbh--mats at nifty dot com> | 23 | 校正者: 松倉さん <nbh--mats at nifty dot com> |
24 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | 24 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> |
@@ -110,7 +110,7 @@ Linux カーネルソースツリーは幅広い範囲のドキュメントを | |||
110 | 新しいドキュメントファイルも追加することを勧めます。 | 110 | 新しいドキュメントファイルも追加することを勧めます。 |
111 | カーネルの変更が、カーネルがユーザ空間に公開しているインターフェイスの | 111 | カーネルの変更が、カーネルがユーザ空間に公開しているインターフェイスの |
112 | 変更を引き起こす場合、その変更を説明するマニュアルページのパッチや情報 | 112 | 変更を引き起こす場合、その変更を説明するマニュアルページのパッチや情報 |
113 | をマニュアルページのメンテナ mtk-manpages@gmx.net に送ることを勧めま | 113 | をマニュアルページのメンテナ mtk.manpages@gmail.com に送ることを勧めま |
114 | す。 | 114 | す。 |
115 | 115 | ||
116 | 以下はカーネルソースツリーに含まれている読んでおくべきファイルの一覧で | 116 | 以下はカーネルソースツリーに含まれている読んでおくべきファイルの一覧で |
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 @@ | |||
1 | NOTE: | ||
2 | This is Japanese translated version of "Documentation/stable_kernel_rules.txt". | ||
3 | This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> | ||
4 | and JF Project team <www.linux.or.jp/JF>. | ||
5 | If you find difference with original file or problem in translation, | ||
6 | please contact maintainer of this file or JF project. | ||
7 | |||
8 | Please also note that purpose of this file is easier to read for non | ||
9 | English natives and do no intended to fork. So, if you have any | ||
10 | comment or update of this file, please try to update Original(English) | ||
11 | file at first. | ||
12 | |||
13 | ================================== | ||
14 | ããã¯ã | ||
15 | linux-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/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 616043a6da99..649cb8799890 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
@@ -24,7 +24,7 @@ visible if its parent entry is also visible. | |||
24 | Menu entries | 24 | Menu entries |
25 | ------------ | 25 | ------------ |
26 | 26 | ||
27 | Most entries define a config option, all other entries help to organize | 27 | Most entries define a config option; all other entries help to organize |
28 | them. A single configuration option is defined like this: | 28 | them. A single configuration option is defined like this: |
29 | 29 | ||
30 | config MODVERSIONS | 30 | config MODVERSIONS |
@@ -50,7 +50,7 @@ applicable everywhere (see syntax). | |||
50 | 50 | ||
51 | - type definition: "bool"/"tristate"/"string"/"hex"/"int" | 51 | - type definition: "bool"/"tristate"/"string"/"hex"/"int" |
52 | Every config option must have a type. There are only two basic types: | 52 | Every config option must have a type. There are only two basic types: |
53 | tristate and string, the other types are based on these two. The type | 53 | tristate and string; the other types are based on these two. The type |
54 | definition optionally accepts an input prompt, so these two examples | 54 | definition optionally accepts an input prompt, so these two examples |
55 | are equivalent: | 55 | are equivalent: |
56 | 56 | ||
@@ -108,7 +108,7 @@ applicable everywhere (see syntax). | |||
108 | equal to 'y' without visiting the dependencies. So abusing | 108 | equal to 'y' without visiting the dependencies. So abusing |
109 | select you are able to select a symbol FOO even if FOO depends | 109 | select you are able to select a symbol FOO even if FOO depends |
110 | on BAR that is not set. In general use select only for | 110 | on BAR that is not set. In general use select only for |
111 | non-visible symbols (no promts anywhere) and for symbols with | 111 | non-visible symbols (no prompts anywhere) and for symbols with |
112 | no dependencies. That will limit the usefulness but on the | 112 | no dependencies. That will limit the usefulness but on the |
113 | other hand avoid the illegal configurations all over. kconfig | 113 | other hand avoid the illegal configurations all over. kconfig |
114 | should one day warn about such things. | 114 | should one day warn about such things. |
@@ -127,6 +127,27 @@ applicable everywhere (see syntax). | |||
127 | used to help visually separate configuration logic from help within | 127 | used to help visually separate configuration logic from help within |
128 | the file as an aid to developers. | 128 | the file as an aid to developers. |
129 | 129 | ||
130 | - misc options: "option" <symbol>[=<value>] | ||
131 | Various less common options can be defined via this option syntax, | ||
132 | which can modify the behaviour of the menu entry and its config | ||
133 | symbol. These options are currently possible: | ||
134 | |||
135 | - "defconfig_list" | ||
136 | This declares a list of default entries which can be used when | ||
137 | looking for the default configuration (which is used when the main | ||
138 | .config doesn't exists yet.) | ||
139 | |||
140 | - "modules" | ||
141 | This declares the symbol to be used as the MODULES symbol, which | ||
142 | enables the third modular state for all config symbols. | ||
143 | |||
144 | - "env"=<value> | ||
145 | This imports the environment variable into Kconfig. It behaves like | ||
146 | a default, except that the value comes from the environment, this | ||
147 | also means that the behaviour when mixing it with normal defaults is | ||
148 | undefined at this point. The symbol is currently not exported back | ||
149 | to the build environment (if this is desired, it can be done via | ||
150 | another symbol). | ||
130 | 151 | ||
131 | Menu dependencies | 152 | Menu dependencies |
132 | ----------------- | 153 | ----------------- |
@@ -162,9 +183,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 | |||
162 | respectively for calculations). A menu entry becomes visible when it's | 183 | respectively for calculations). A menu entry becomes visible when it's |
163 | expression evaluates to 'm' or 'y'. | 184 | expression evaluates to 'm' or 'y'. |
164 | 185 | ||
165 | There are two types of symbols: constant and nonconstant symbols. | 186 | There are two types of symbols: constant and non-constant symbols. |
166 | Nonconstant symbols are the most common ones and are defined with the | 187 | Non-constant symbols are the most common ones and are defined with the |
167 | 'config' statement. Nonconstant symbols consist entirely of alphanumeric | 188 | 'config' statement. Non-constant symbols consist entirely of alphanumeric |
168 | characters or underscores. | 189 | characters or underscores. |
169 | Constant symbols are only part of expressions. Constant symbols are | 190 | Constant symbols are only part of expressions. Constant symbols are |
170 | always surrounded by single or double quotes. Within the quote, any | 191 | always surrounded by single or double quotes. Within the quote, any |
@@ -301,3 +322,81 @@ mainmenu: | |||
301 | 322 | ||
302 | This sets the config program's title bar if the config program chooses | 323 | This sets the config program's title bar if the config program chooses |
303 | to use it. | 324 | to use it. |
325 | |||
326 | |||
327 | Kconfig hints | ||
328 | ------------- | ||
329 | This is a collection of Kconfig tips, most of which aren't obvious at | ||
330 | first glance and most of which have become idioms in several Kconfig | ||
331 | files. | ||
332 | |||
333 | Adding common features and make the usage configurable | ||
334 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
335 | It is a common idiom to implement a feature/functionality that are | ||
336 | relevant for some architectures but not all. | ||
337 | The recommended way to do so is to use a config variable named HAVE_* | ||
338 | that is defined in a common Kconfig file and selected by the relevant | ||
339 | architectures. | ||
340 | An example is the generic IOMAP functionality. | ||
341 | |||
342 | We would in lib/Kconfig see: | ||
343 | |||
344 | # Generic IOMAP is used to ... | ||
345 | config HAVE_GENERIC_IOMAP | ||
346 | |||
347 | config GENERIC_IOMAP | ||
348 | depends on HAVE_GENERIC_IOMAP && FOO | ||
349 | |||
350 | And in lib/Makefile we would see: | ||
351 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | ||
352 | |||
353 | For each architecture using the generic IOMAP functionality we would see: | ||
354 | |||
355 | config X86 | ||
356 | select ... | ||
357 | select HAVE_GENERIC_IOMAP | ||
358 | select ... | ||
359 | |||
360 | Note: we use the existing config option and avoid creating a new | ||
361 | config variable to select HAVE_GENERIC_IOMAP. | ||
362 | |||
363 | Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is | ||
364 | introduced to overcome the limitation of select which will force a | ||
365 | config option to 'y' no matter the dependencies. | ||
366 | The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the | ||
367 | situation where select forces a symbol equals to 'y'. | ||
368 | |||
369 | Build as module only | ||
370 | ~~~~~~~~~~~~~~~~~~~~ | ||
371 | To restrict a component build to module-only, qualify its config symbol | ||
372 | with "depends on m". E.g.: | ||
373 | |||
374 | config FOO | ||
375 | depends on BAR && m | ||
376 | |||
377 | limits FOO to module (=m) or disabled (=n). | ||
378 | |||
379 | |||
380 | Build limited by a third config symbol which may be =y or =m | ||
381 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
382 | A common idiom that we see (and sometimes have problems with) is this: | ||
383 | |||
384 | When option C in B (module or subsystem) uses interfaces from A (module | ||
385 | or subsystem), and both A and B are tristate (could be =y or =m if they | ||
386 | were independent of each other, but they aren't), then we need to limit | ||
387 | C such that it cannot be built statically if A is built as a loadable | ||
388 | module. (C already depends on B, so there is no dependency issue to | ||
389 | take care of here.) | ||
390 | |||
391 | If A is linked statically into the kernel image, C can be built | ||
392 | statically or as loadable module(s). However, if A is built as loadable | ||
393 | module(s), then C must be restricted to loadable module(s) also. This | ||
394 | can be expressed in kconfig language as: | ||
395 | |||
396 | config C | ||
397 | depends on A = y || A = B | ||
398 | |||
399 | or for real examples, use this command in a kernel tree: | ||
400 | |||
401 | $ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig | ||
402 | |||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 33121d6c827c..8fd5aa40585f 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -34,6 +34,7 @@ parameter is applicable: | |||
34 | ALSA ALSA sound support is enabled. | 34 | ALSA ALSA sound support is enabled. |
35 | APIC APIC support is enabled. | 35 | APIC APIC support is enabled. |
36 | APM Advanced Power Management support is enabled. | 36 | APM Advanced Power Management support is enabled. |
37 | AVR32 AVR32 architecture is enabled. | ||
37 | AX25 Appropriate AX.25 support is enabled. | 38 | AX25 Appropriate AX.25 support is enabled. |
38 | BLACKFIN Blackfin architecture is enabled. | 39 | BLACKFIN Blackfin architecture is enabled. |
39 | DRM Direct Rendering Management support is enabled. | 40 | DRM Direct Rendering Management support is enabled. |
@@ -167,6 +168,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
167 | 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 |
168 | Format: <irq>,<irq>... | 169 | Format: <irq>,<irq>... |
169 | 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 | |||
170 | acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT | 176 | acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT |
171 | 177 | ||
172 | 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 |
@@ -369,7 +375,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
369 | configured. Potentially dangerous and should only be | 375 | configured. Potentially dangerous and should only be |
370 | used if you are entirely sure of the consequences. | 376 | used if you are entirely sure of the consequences. |
371 | 377 | ||
372 | chandev= [HW,NET] Generic channel device initialisation | 378 | ccw_timeout_log [S390] |
379 | See Documentation/s390/CommonIO for details. | ||
373 | 380 | ||
374 | checkreqprot [SELINUX] Set initial checkreqprot flag value. | 381 | checkreqprot [SELINUX] Set initial checkreqprot flag value. |
375 | Format: { "0" | "1" } | 382 | Format: { "0" | "1" } |
@@ -381,6 +388,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
381 | Value can be changed at runtime via | 388 | Value can be changed at runtime via |
382 | /selinux/checkreqprot. | 389 | /selinux/checkreqprot. |
383 | 390 | ||
391 | cio_ignore= [S390] | ||
392 | See Documentation/s390/CommonIO for details. | ||
393 | |||
394 | cio_msg= [S390] | ||
395 | See Documentation/s390/CommonIO for details. | ||
396 | |||
384 | clock= [BUGS=X86-32, HW] gettimeofday clocksource override. | 397 | clock= [BUGS=X86-32, HW] gettimeofday clocksource override. |
385 | [Deprecated] | 398 | [Deprecated] |
386 | Forces specified clocksource (if available) to be used | 399 | Forces specified clocksource (if available) to be used |
@@ -408,8 +421,21 @@ and is between 256 and 4096 characters. It is defined in the file | |||
408 | [SPARC64] tick | 421 | [SPARC64] tick |
409 | [X86-64] hpet,tsc | 422 | [X86-64] hpet,tsc |
410 | 423 | ||
411 | code_bytes [IA32] How many bytes of object code to print in an | 424 | clearcpuid=BITNUM [X86] |
412 | oops report. | 425 | Disable CPUID feature X for the kernel. See |
426 | include/asm-x86/cpufeature.h for the valid bit numbers. | ||
427 | Note the Linux specific bits are not necessarily | ||
428 | stable over kernel options, but the vendor specific | ||
429 | ones should be. | ||
430 | Also note that user programs calling CPUID directly | ||
431 | or using the feature without checking anything | ||
432 | will still see it. This just prevents it from | ||
433 | being used by the kernel or shown in /proc/cpuinfo. | ||
434 | Also note the kernel might malfunction if you disable | ||
435 | some critical bits. | ||
436 | |||
437 | code_bytes [IA32/X86_64] How many bytes of object code to print | ||
438 | in an oops report. | ||
413 | Range: 0 - 8192 | 439 | Range: 0 - 8192 |
414 | Default: 64 | 440 | Default: 64 |
415 | 441 | ||
@@ -523,33 +549,34 @@ and is between 256 and 4096 characters. It is defined in the file | |||
523 | 1 will print _a lot_ more information - normally | 549 | 1 will print _a lot_ more information - normally |
524 | only useful to kernel developers. | 550 | only useful to kernel developers. |
525 | 551 | ||
526 | decnet= [HW,NET] | 552 | decnet.addr= [HW,NET] |
527 | Format: <area>[,<node>] | 553 | Format: <area>[,<node>] |
528 | See also Documentation/networking/decnet.txt. | 554 | See also Documentation/networking/decnet.txt. |
529 | 555 | ||
530 | default_blu= [VT] | 556 | vt.default_blu= [VT] |
531 | Format: <blue0>,<blue1>,<blue2>,...,<blue15> | 557 | Format: <blue0>,<blue1>,<blue2>,...,<blue15> |
532 | Change the default blue palette of the console. | 558 | Change the default blue palette of the console. |
533 | This is a 16-member array composed of values | 559 | This is a 16-member array composed of values |
534 | ranging from 0-255. | 560 | ranging from 0-255. |
535 | 561 | ||
536 | default_grn= [VT] | 562 | vt.default_grn= [VT] |
537 | Format: <green0>,<green1>,<green2>,...,<green15> | 563 | Format: <green0>,<green1>,<green2>,...,<green15> |
538 | Change the default green palette of the console. | 564 | Change the default green palette of the console. |
539 | This is a 16-member array composed of values | 565 | This is a 16-member array composed of values |
540 | ranging from 0-255. | 566 | ranging from 0-255. |
541 | 567 | ||
542 | default_red= [VT] | 568 | vt.default_red= [VT] |
543 | Format: <red0>,<red1>,<red2>,...,<red15> | 569 | Format: <red0>,<red1>,<red2>,...,<red15> |
544 | Change the default red palette of the console. | 570 | Change the default red palette of the console. |
545 | This is a 16-member array composed of values | 571 | This is a 16-member array composed of values |
546 | ranging from 0-255. | 572 | ranging from 0-255. |
547 | 573 | ||
548 | default_utf8= [VT] | 574 | vt.default_utf8= |
575 | [VT] | ||
549 | Format=<0|1> | 576 | Format=<0|1> |
550 | Set system-wide default UTF-8 mode for all tty's. | 577 | Set system-wide default UTF-8 mode for all tty's. |
551 | Default is 0 and by setting to 1, it enables UTF-8 | 578 | Default is 1, i.e. UTF-8 mode is enabled for all |
552 | mode for all newly opened or allocated terminals. | 579 | newly opened terminals. |
553 | 580 | ||
554 | dhash_entries= [KNL] | 581 | dhash_entries= [KNL] |
555 | Set number of hash buckets for dentry cache. | 582 | Set number of hash buckets for dentry cache. |
@@ -561,6 +588,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
561 | See drivers/char/README.epca and | 588 | See drivers/char/README.epca and |
562 | Documentation/digiepca.txt. | 589 | Documentation/digiepca.txt. |
563 | 590 | ||
591 | disable_mtrr_trim [X86, Intel and AMD only] | ||
592 | By default the kernel will trim any uncacheable | ||
593 | memory out of your available memory pool based on | ||
594 | MTRR settings. This parameter disables that behavior, | ||
595 | possibly causing your machine to run very slowly. | ||
596 | |||
564 | dmasound= [HW,OSS] Sound subsystem buffers | 597 | dmasound= [HW,OSS] Sound subsystem buffers |
565 | 598 | ||
566 | dscc4.setup= [NET] | 599 | dscc4.setup= [NET] |
@@ -651,6 +684,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
651 | 684 | ||
652 | gamma= [HW,DRM] | 685 | gamma= [HW,DRM] |
653 | 686 | ||
687 | gart_fix_e820= [X86_64] disable the fix e820 for K8 GART | ||
688 | Format: off | on | ||
689 | default: on | ||
690 | |||
654 | gdth= [HW,SCSI] | 691 | gdth= [HW,SCSI] |
655 | See header of drivers/scsi/gdth.c. | 692 | See header of drivers/scsi/gdth.c. |
656 | 693 | ||
@@ -685,6 +722,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
685 | See Documentation/isdn/README.HiSax. | 722 | See Documentation/isdn/README.HiSax. |
686 | 723 | ||
687 | hugepages= [HW,X86-32,IA-64] Maximal number of HugeTLB pages. | 724 | hugepages= [HW,X86-32,IA-64] Maximal number of HugeTLB pages. |
725 | hugepagesz= [HW,IA-64,PPC] The size of the HugeTLB pages. | ||
688 | 726 | ||
689 | i8042.direct [HW] Put keyboard port into non-translated mode | 727 | i8042.direct [HW] Put keyboard port into non-translated mode |
690 | i8042.dumbkbd [HW] Pretend that controller can only read data from | 728 | i8042.dumbkbd [HW] Pretend that controller can only read data from |
@@ -742,6 +780,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
742 | 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 |
743 | as idle=poll. | 781 | as idle=poll. |
744 | 782 | ||
783 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem | ||
784 | Claim all unknown PCI IDE storage controllers. | ||
785 | |||
745 | ignore_loglevel [KNL] | 786 | ignore_loglevel [KNL] |
746 | Ignore loglevel setting - this will print /all/ | 787 | Ignore loglevel setting - this will print /all/ |
747 | kernel messages to the console. Useful for debugging. | 788 | kernel messages to the console. Useful for debugging. |
@@ -785,6 +826,16 @@ and is between 256 and 4096 characters. It is defined in the file | |||
785 | for translation below 32 bit and if not available | 826 | for translation below 32 bit and if not available |
786 | then look in the higher range. | 827 | then look in the higher range. |
787 | 828 | ||
829 | io_delay= [X86-32,X86-64] I/O delay method | ||
830 | 0x80 | ||
831 | Standard port 0x80 based delay | ||
832 | 0xed | ||
833 | Alternate port 0xed based delay (needed on some systems) | ||
834 | udelay | ||
835 | Simple two microseconds delay | ||
836 | none | ||
837 | No delay | ||
838 | |||
788 | io7= [HW] IO7 for Marvel based alpha systems | 839 | io7= [HW] IO7 for Marvel based alpha systems |
789 | See comment before marvel_specify_io7 in | 840 | See comment before marvel_specify_io7 in |
790 | arch/alpha/kernel/core_marvel.c. | 841 | arch/alpha/kernel/core_marvel.c. |
@@ -882,6 +933,14 @@ and is between 256 and 4096 characters. It is defined in the file | |||
882 | lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in | 933 | lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in |
883 | C2 power state. | 934 | C2 power state. |
884 | 935 | ||
936 | libata.dma= [LIBATA] DMA control | ||
937 | libata.dma=0 Disable all PATA and SATA DMA | ||
938 | libata.dma=1 PATA and SATA Disk DMA only | ||
939 | libata.dma=2 ATAPI (CDROM) DMA only | ||
940 | libata.dma=4 Compact Flash DMA only | ||
941 | Combinations also work, so libata.dma=3 enables DMA | ||
942 | for disks and CDROMs, but not CFs. | ||
943 | |||
885 | libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume | 944 | libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume |
886 | when set. | 945 | when set. |
887 | Format: <int> | 946 | Format: <int> |
@@ -1042,6 +1101,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1042 | Multi-Function General Purpose Timers on AMD Geode | 1101 | Multi-Function General Purpose Timers on AMD Geode |
1043 | platforms. | 1102 | platforms. |
1044 | 1103 | ||
1104 | mfgptfix [X86-32] Fix MFGPT timers on AMD Geode platforms when | ||
1105 | the BIOS has incorrectly applied a workaround. TinyBIOS | ||
1106 | version 0.98 is known to be affected, 0.99 fixes the | ||
1107 | problem by letting the user disable the workaround. | ||
1108 | |||
1045 | mga= [HW,DRM] | 1109 | mga= [HW,DRM] |
1046 | 1110 | ||
1047 | mousedev.tap_time= | 1111 | mousedev.tap_time= |
@@ -1114,6 +1178,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1114 | of returning the full 64-bit number. | 1178 | of returning the full 64-bit number. |
1115 | The default is to return 64-bit inode numbers. | 1179 | The default is to return 64-bit inode numbers. |
1116 | 1180 | ||
1181 | nmi_debug= [KNL,AVR32] Specify one or more actions to take | ||
1182 | when a NMI is triggered. | ||
1183 | Format: [state][,regs][,debounce][,die] | ||
1184 | |||
1117 | nmi_watchdog= [KNL,BUGS=X86-32] Debugging features for SMP kernels | 1185 | nmi_watchdog= [KNL,BUGS=X86-32] Debugging features for SMP kernels |
1118 | 1186 | ||
1119 | no387 [BUGS=X86-32] Tells the kernel to use the 387 maths | 1187 | no387 [BUGS=X86-32] Tells the kernel to use the 387 maths |
@@ -1138,6 +1206,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1138 | 1206 | ||
1139 | nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. | 1207 | nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. |
1140 | 1208 | ||
1209 | noefi [X86-32,X86-64] Disable EFI runtime services support. | ||
1210 | |||
1141 | noexec [IA-64] | 1211 | noexec [IA-64] |
1142 | 1212 | ||
1143 | noexec [X86-32,X86-64] | 1213 | noexec [X86-32,X86-64] |
@@ -1148,6 +1218,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1148 | register save and restore. The kernel will only save | 1218 | register save and restore. The kernel will only save |
1149 | legacy floating-point registers on task switch. | 1219 | legacy floating-point registers on task switch. |
1150 | 1220 | ||
1221 | noclflush [BUGS=X86] Don't use the CLFLUSH instruction | ||
1222 | |||
1151 | nohlt [BUGS=ARM] | 1223 | nohlt [BUGS=ARM] |
1152 | 1224 | ||
1153 | no-hlt [BUGS=X86-32] Tells the kernel that the hlt | 1225 | no-hlt [BUGS=X86-32] Tells the kernel that the hlt |
@@ -1492,14 +1564,17 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1492 | ramdisk_size= [RAM] Sizes of RAM disks in kilobytes | 1564 | ramdisk_size= [RAM] Sizes of RAM disks in kilobytes |
1493 | See Documentation/ramdisk.txt. | 1565 | See Documentation/ramdisk.txt. |
1494 | 1566 | ||
1495 | rcu.blimit= [KNL,BOOT] Set maximum number of finished | 1567 | rcupdate.blimit= [KNL,BOOT] |
1496 | RCU callbacks to process in one batch. | 1568 | Set maximum number of finished RCU callbacks to process |
1569 | in one batch. | ||
1497 | 1570 | ||
1498 | rcu.qhimark= [KNL,BOOT] Set threshold of queued | 1571 | rcupdate.qhimark= [KNL,BOOT] |
1572 | Set threshold of queued | ||
1499 | RCU callbacks over which batch limiting is disabled. | 1573 | RCU callbacks over which batch limiting is disabled. |
1500 | 1574 | ||
1501 | rcu.qlowmark= [KNL,BOOT] Set threshold of queued | 1575 | rcupdate.qlowmark= [KNL,BOOT] |
1502 | RCU callbacks below which batch limiting is re-enabled. | 1576 | Set threshold of queued RCU callbacks below which |
1577 | batch limiting is re-enabled. | ||
1503 | 1578 | ||
1504 | rdinit= [KNL] | 1579 | rdinit= [KNL] |
1505 | Format: <full_path> | 1580 | Format: <full_path> |
@@ -1584,7 +1659,13 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1584 | Format: <vendor>:<model>:<flags> | 1659 | Format: <vendor>:<model>:<flags> |
1585 | (flags are integer value) | 1660 | (flags are integer value) |
1586 | 1661 | ||
1587 | scsi_logging= [SCSI] | 1662 | scsi_logging_level= [SCSI] a bit mask of logging levels |
1663 | See drivers/scsi/scsi_logging.h for bits. Also | ||
1664 | settable via sysctl at dev.scsi.logging_level | ||
1665 | (/proc/sys/dev/scsi/logging_level). | ||
1666 | There is also a nice 'scsi_logging_level' script in the | ||
1667 | S390-tools package, available for download at | ||
1668 | http://www-128.ibm.com/developerworks/linux/linux390/s390-tools-1.5.4.html | ||
1588 | 1669 | ||
1589 | scsi_mod.scan= [SCSI] sync (default) scans SCSI busses as they are | 1670 | scsi_mod.scan= [SCSI] sync (default) scans SCSI busses as they are |
1590 | discovered. async scans them in kernel threads, | 1671 | discovered. async scans them in kernel threads, |
@@ -1813,9 +1894,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1813 | st= [HW,SCSI] SCSI tape parameters (buffers, etc.) | 1894 | st= [HW,SCSI] SCSI tape parameters (buffers, etc.) |
1814 | See Documentation/scsi/st.txt. | 1895 | See Documentation/scsi/st.txt. |
1815 | 1896 | ||
1816 | st0x= [HW,SCSI] | ||
1817 | See header of drivers/scsi/seagate.c. | ||
1818 | |||
1819 | sti= [PARISC,HW] | 1897 | sti= [PARISC,HW] |
1820 | Format: <num> | 1898 | Format: <num> |
1821 | Set the STI (builtin display/keyboard on the HP-PARISC | 1899 | Set the STI (builtin display/keyboard on the HP-PARISC |
@@ -1900,9 +1978,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1900 | tipar.delay= [HW,PPT] | 1978 | tipar.delay= [HW,PPT] |
1901 | Set inter-bit delay in microseconds (default 10). | 1979 | Set inter-bit delay in microseconds (default 10). |
1902 | 1980 | ||
1903 | tmc8xx= [HW,SCSI] | ||
1904 | See header of drivers/scsi/seagate.c. | ||
1905 | |||
1906 | tmscsim= [HW,SCSI] | 1981 | tmscsim= [HW,SCSI] |
1907 | See comment before function dc390_setup() in | 1982 | See comment before function dc390_setup() in |
1908 | drivers/scsi/tmscsim.c. | 1983 | drivers/scsi/tmscsim.c. |
@@ -1951,6 +2026,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1951 | vdso=1: enable VDSO (default) | 2026 | vdso=1: enable VDSO (default) |
1952 | vdso=0: disable VDSO mapping | 2027 | vdso=0: disable VDSO mapping |
1953 | 2028 | ||
2029 | vdso32= [X86-32,X86-64] | ||
2030 | vdso32=2: enable compat VDSO (default with COMPAT_VDSO) | ||
2031 | vdso32=1: enable 32-bit VDSO (default) | ||
2032 | vdso32=0: disable 32-bit VDSO mapping | ||
2033 | |||
1954 | vector= [IA-64,SMP] | 2034 | vector= [IA-64,SMP] |
1955 | vector=percpu: enable percpu vector domain | 2035 | vector=percpu: enable percpu vector domain |
1956 | 2036 | ||
diff --git a/Documentation/ko_KR/HOWTO b/Documentation/ko_KR/HOWTO index b51d7ca842ba..029fca914c05 100644 --- a/Documentation/ko_KR/HOWTO +++ b/Documentation/ko_KR/HOWTO | |||
@@ -1,6 +1,6 @@ | |||
1 | NOTE: | 1 | NOTE: |
2 | This is a version of Documentation/HOWTO translated into korean | 2 | This is a version of Documentation/HOWTO translated into korean |
3 | This document is maintained by minchan Kim < minchan.kim@gmail.com> | 3 | This document is maintained by minchan Kim <minchan.kim@gmail.com> |
4 | If you find any difference between this document and the original file or | 4 | If you find any difference between this document and the original file or |
5 | a problem with the translation, please contact the maintainer of this file. | 5 | a problem with the translation, please contact the maintainer of this file. |
6 | 6 | ||
@@ -14,7 +14,7 @@ try to update the original English file first. | |||
14 | Documentation/HOWTO | 14 | Documentation/HOWTO |
15 | 의 한글 번역입니다. | 15 | 의 한글 번역입니다. |
16 | 16 | ||
17 | 역자: 김민찬 <minchan.kim@gmail.com > | 17 | 역자: 김민찬 <minchan.kim@gmail.com> |
18 | 감수: 이제이미 <jamee.lee@samsung.com> | 18 | 감수: 이제이미 <jamee.lee@samsung.com> |
19 | ================================== | 19 | ================================== |
20 | 20 | ||
@@ -23,11 +23,11 @@ Documentation/HOWTO | |||
23 | 23 | ||
24 | 이 문서는 커널 개발에 있어 가장 중요한 문서이다. 이 문서는 | 24 | 이 문서는 커널 개발에 있어 가장 중요한 문서이다. 이 문서는 |
25 | 리눅스 커널 개발자가 되는 법과 리눅스 커널 개발 커뮤니티와 일하는 | 25 | 리눅스 커널 개발자가 되는 법과 리눅스 커널 개발 커뮤니티와 일하는 |
26 | 법을 담고있다. 커널 프로그래밍의기술적인 측면과 관련된 내용들은 | 26 | 법을 담고있다. 커널 프로그래밍의 기술적인 측면과 관련된 내용들은 |
27 | 포함하지 않으려고 하였지만 올바으로 여러분을 안내하는 데 도움이 | 27 | 포함하지 않으려고 하였지만 올바 길 여러분을 안내하는 데는 도움이 |
28 | 될 것이다. | 28 | 될 것이다. |
29 | 29 | ||
30 | 이 문서에서 오래된 것을 발견하면 문서의 아래쪽에 나열된 메인너에게 | 30 | 이 문서에서 오래된 것을 발견하면 문서의 아래쪽에 나열된 메인이너에게 |
31 | 패치를 보내달라. | 31 | 패치를 보내달라. |
32 | 32 | ||
33 | 33 | ||
@@ -36,12 +36,12 @@ Documentation/HOWTO | |||
36 | 36 | ||
37 | 자, 여러분은 리눅스 커널 개발자가 되는 법을 배우고 싶은가? 아니면 | 37 | 자, 여러분은 리눅스 커널 개발자가 되는 법을 배우고 싶은가? 아니면 |
38 | 상사로부터"이 장치를 위한 리눅스 드라이버를 작성하시오"라는 말을 | 38 | 상사로부터"이 장치를 위한 리눅스 드라이버를 작성하시오"라는 말을 |
39 | 들었는가? 이 문서 여러분이 겪게 될 과정과 커뮤니티와 일하는 법을 | 39 | 들었는가? 이 문서의 적은 여러분이 겪게 될 과정과 커뮤니티와 력는 |
40 | 조언하여 여러분의 목적을 달성하기 위해 필요한 것 모두를 알려주는 | 40 | 법 언하여 여러분의 목적을 달성하기 위해 필요한 것 모두를 알려주기 |
41 | 것이다. | 41 | 함다. |
42 | 42 | ||
43 | 커널은 대부분은 C로 작성되고 몇몇 아키텍쳐의 의존적인 부분은 | 43 | 커널은 대부분은 C로 작성되어 있고 몇몇 아키텍쳐의 의존적인 부분은 |
44 | 어셈블리로 작성되다. 커널 개발을 위해 C를 잘 이해하고 있어야 한다. | 44 | 어셈블리로 작성되 다. 커널 개발을 위해 C를 잘 이해하고 있어야 한다. |
45 | 여러분이 특정 아키텍쳐의 low-level 개발을 할 것이 아니라면 | 45 | 여러분이 특정 아키텍쳐의 low-level 개발을 할 것이 아니라면 |
46 | 어셈블리(특정 아키텍쳐)는 잘 알아야 할 필요는 없다. | 46 | 어셈블리(특정 아키텍쳐)는 잘 알아야 할 필요는 없다. |
47 | 다음의 참고서적들은 기본에 충실한 C 교육이나 수년간의 경험에 견주지는 | 47 | 다음의 참고서적들은 기본에 충실한 C 교육이나 수년간의 경험에 견주지는 |
@@ -59,11 +59,11 @@ Documentation/HOWTO | |||
59 | 어떤 참고문서도 있지 않다. 정보를 얻기 위해서는 gcc info (`info gcc`)페이지를 | 59 | 어떤 참고문서도 있지 않다. 정보를 얻기 위해서는 gcc info (`info gcc`)페이지를 |
60 | 살펴보라. | 60 | 살펴보라. |
61 | 61 | ||
62 | 여러분은 기존의 개발 커뮤니티와 일하는 법을 배우려고 하고 있다는 것을 | 62 | 여러분은 기존의 개발 커뮤니티와 력는 법을 배우려고 하고 있다는 것을 |
63 | 기억하라. 코딩, 스타일, 관한 훌륭한 표준을 가진 사람들이 모인 | 63 | 기억하라. 코딩, 스타일, 함에 관한 훌륭한 표준을 가진 사람들이 모인 |
64 | 다양한 그룹이 있다. 이 표준들은 오랜동안 크고 지역적으로 분산된 팀들에 | 64 | 다양한 그룹이 있다. 이 표준들은 오랜동안 크고 지역적으로 분산된 팀들에 |
65 | 의해 가장 좋은 방법으로 일하기위하여 찾은 것을 기초로 만들어져왔다. | 65 | 의해 가장 좋은 방법으로 일하기 위하여 찾은 것을 기초로 만들어져 왔다. |
66 | 그 표준들은 문서화가 잘 되어 있기 때문에 가능한한 미리 많은 표준들에 | 66 | 그 표준들은 문서화가 잘 되어있기 때문에 가능한한 미리 많은 표준들에 |
67 | 관하여 배우려고 시도하라. 다른 사람들은 여러분이나 여러분의 회사가 | 67 | 관하여 배우려고 시도하라. 다른 사람들은 여러분이나 여러분의 회사가 |
68 | 일하는 방식에 적응하는 것을 원하지는 않는다. | 68 | 일하는 방식에 적응하는 것을 원하지는 않는다. |
69 | 69 | ||
@@ -73,7 +73,7 @@ Documentation/HOWTO | |||
73 | 73 | ||
74 | 리눅스 커널 소스 코드는 GPL로 배포(release)되었다. 소스트리의 메인 | 74 | 리눅스 커널 소스 코드는 GPL로 배포(release)되었다. 소스트리의 메인 |
75 | 디렉토리에 있는 라이센스에 관하여 상세하게 쓰여 있는 COPYING이라는 | 75 | 디렉토리에 있는 라이센스에 관하여 상세하게 쓰여 있는 COPYING이라는 |
76 | 파일을 봐라.여러분이 라이센스에 관한 더 깊은 문제를 가지고 있다면 | 76 | 파일을 봐라. 여러분이 라이센스에 관한 더 깊은 문제를 가지고 있다면 |
77 | 리눅스 커널 메일링 리스트에 묻지말고 변호사와 연락하라. 메일링 | 77 | 리눅스 커널 메일링 리스트에 묻지말고 변호사와 연락하라. 메일링 |
78 | 리스트들에 있는 사람들은 변호사가 아니기 때문에 법적 문제에 관하여 | 78 | 리스트들에 있는 사람들은 변호사가 아니기 때문에 법적 문제에 관하여 |
79 | 그들의 말에 의지해서는 안된다. | 79 | 그들의 말에 의지해서는 안된다. |
@@ -85,12 +85,12 @@ GPL에 관한 잦은 질문들과 답변들은 다음을 참조하라. | |||
85 | 문서 | 85 | 문서 |
86 | ---- | 86 | ---- |
87 | 87 | ||
88 | 리눅스 커널 소스 트리는 커널 커뮤니티와 일하는 법을 배우기 위 은 | 88 | 리눅스 커널 소스 트리는 커널 커뮤니티와 력는 법을 배우기위 훌한 |
89 | 귀한 문서들을 가지고 있다. 새로운 기능들이 커널에 들어가게 될 때, | 89 | 한 문서들을 가지고 있다. 새로운 기능들이 커널에 들어가게 될 때, |
90 | 그 기능을 어떻게 사용하는지에 관한 설명을 위하여 새로운 문서 파일을 | 90 | 그 기능을 어떻게 사용하는지에 관한 설명을 위하여 새로운 문서 파일을 |
91 | 추가하는 것을 권장한다. 커널이 유저스페이스로 노출하는 인터페이스를 | 91 | 추가하는 것을 권장한다. 커널이 유저스페이스로 노출하는 인터페이스를 |
92 | 변경하게 되면 변경을 설명하는 메뉴얼 페이지들에 대한 패치나 정보를 | 92 | 변경하게 되면 변경을 설명하는 메뉴얼 페이지들에 대한 패치나 정보를 |
93 | mtk-manpages@gmx.net의 메인너에게 보낼 것을 권장한다. | 93 | mtk.manpages@gmail.com의 메인이너에게 보낼 것을 권장한다. |
94 | 94 | ||
95 | 다음은 커널 소스 트리에 있는 읽어야 할 파일들의 리스트이다. | 95 | 다음은 커널 소스 트리에 있는 읽어야 할 파일들의 리스트이다. |
96 | README | 96 | README |
@@ -105,7 +105,7 @@ mtk-manpages@gmx.net의 메인트너에게 보낼 것을 권장한다. | |||
105 | Documentation/CodingStyle | 105 | Documentation/CodingStyle |
106 | 이 문서는 리눅스 커널 코딩 스타일과 그렇게 한 몇몇 이유를 설명한다. | 106 | 이 문서는 리눅스 커널 코딩 스타일과 그렇게 한 몇몇 이유를 설명한다. |
107 | 모든 새로운 코드는 이 문서에 가이드라인들을 따라야 한다. 대부분의 | 107 | 모든 새로운 코드는 이 문서에 가이드라인들을 따라야 한다. 대부분의 |
108 | 메인너들은 이 규칙을 따르는 패치들만을 받아들일 것이고 많은 사람들이 | 108 | 메인이너들은 이 규칙을 따르는 패치들만을 받아들일 것이고 많은 사람들이 |
109 | 그 패치가 올바른 스타일일 경우만 코드를 검토할 것이다. | 109 | 그 패치가 올바른 스타일일 경우만 코드를 검토할 것이다. |
110 | 110 | ||
111 | Documentation/SubmittingPatches | 111 | Documentation/SubmittingPatches |
@@ -115,9 +115,10 @@ mtk-manpages@gmx.net의 메인트너에게 보낼 것을 권장한다. | |||
115 | - Email 내용들 | 115 | - Email 내용들 |
116 | - Email 양식 | 116 | - Email 양식 |
117 | - 그것을 누구에게 보낼지 | 117 | - 그것을 누구에게 보낼지 |
118 | 이러한 규칙들을 따르는 것이 성공을 보장하진 않는다(왜냐하면 모든 | 118 | 이러한 규칙들을 따르는 것이 성공(역자주: 패치가 받아들여 지는 것)을 |
119 | 패치들은 내용과 스타일에 관하여 면밀히 검토되기 때문이다). | 119 | 보장하진 않는다(왜냐하면 모든 패치들은 내용과 스타일에 관하여 |
120 | 그러나 규칙을 따르지 않는다면 거의 성공하지도 못할 것이다. | 120 | 면밀히 검토되기 때문이다). 그러나 규칙을 따르지 않는다면 거의 |
121 | 성공하지도 못할 것이다. | ||
121 | 122 | ||
122 | 올바른 패치들을 만드는 법에 관한 훌륭한 다른 문서들이 있다. | 123 | 올바른 패치들을 만드는 법에 관한 훌륭한 다른 문서들이 있다. |
123 | "The Perfect Patch" | 124 | "The Perfect Patch" |
@@ -126,13 +127,13 @@ mtk-manpages@gmx.net의 메인트너에게 보낼 것을 권장한다. | |||
126 | http://linux.yyz.us/patch-format.html | 127 | http://linux.yyz.us/patch-format.html |
127 | 128 | ||
128 | Documentation/stable_api_nonsense.txt | 129 | Documentation/stable_api_nonsense.txt |
129 | 이 문서는 의도적으로 커널이 변하지 않는 API를 갖지 않도록 결정한 | 130 | 이 문서는 의도적으로 커널이 하는 API를 갖지 않도록 결정한 |
130 | 이유를 설명하며 다음과 같은 것들을 포함한다. | 131 | 이유를 설명하며 다음과 같은 것들을 포함한다. |
131 | - 서브시스템 shim-layer(호환성을 위해?) | 132 | - 서브시스템 shim-layer(호환성을 위해?) |
132 | - 운영 체제들 간의 드라이버 이식성 | 133 | - 운영체제들간의 드라이버 이식성 |
133 | - 커널 소스 트리내에 빠른 변화를 늦추는 것(또는 빠른 변화를 막는 것) | 134 | - 커널 소스 트리내에 빠른 변화를 늦추는 것(또는 빠른 변화를 막는 것) |
134 | 이 문서는 리눅스 개발 철학을 이해하는데 필수적이며 다른 운영체제에서 | 135 | 이 문서는 리눅스 개발 철학을 이해하는데 필수적이며 다른 운영체제에서 |
135 | 리눅스로 겨오는 사람들에게는 매우 중요하다. | 136 | 리눅스로 향는 사람들에게는 매우 중요하다. |
136 | 137 | ||
137 | 138 | ||
138 | Documentation/SecurityBugs | 139 | Documentation/SecurityBugs |
@@ -141,10 +142,10 @@ mtk-manpages@gmx.net의 메인트너에게 보낼 것을 권장한다. | |||
141 | 도와 달라. | 142 | 도와 달라. |
142 | 143 | ||
143 | Documentation/ManagementStyle | 144 | Documentation/ManagementStyle |
144 | 이 문서는 리눅스 커널 메인너들이 어떻 들의 방법론 신 | 145 | 이 문서는 리눅스 커널 메인이너들이 그들의 방법론 녹아 있는 |
145 | 어떻게 공유하고 운영하는지를 설명한다. 이것은 커널 개발에 입문하는 | 146 | 신을 떻게 공유하고 운영하는지를 설명한다. 이것은 커널 개발에 입문하는 |
146 | 모든 사람들(또는 커널 개발에 작은 호기심이라도 있는 사람들)이 | 147 | 모든 사람들(또는 커널 개발에 작은 호기심이라도 있는 사람들)이 |
147 | 읽어야 할 중요한 문서이다. 왜냐하면 이 문서는 커널 메인너들의 | 148 | 읽어야 할 중요한 문서이다. 왜냐하면 이 문서는 커널 메인이너들의 |
148 | 독특한 행동에 관하여 흔히 있는 오해들과 혼란들을 해소하고 있기 | 149 | 독특한 행동에 관하여 흔히 있는 오해들과 혼란들을 해소하고 있기 |
149 | 때문이다. | 150 | 때문이다. |
150 | 151 | ||
@@ -160,7 +161,7 @@ mtk-manpages@gmx.net의 메인트너에게 보낼 것을 권장한다. | |||
160 | 161 | ||
161 | Documentation/applying-patches.txt | 162 | Documentation/applying-patches.txt |
162 | 패치가 무엇이며 그것을 커널의 다른 개발 브랜치들에 어떻게 | 163 | 패치가 무엇이며 그것을 커널의 다른 개발 브랜치들에 어떻게 |
163 | 적용하는지에 관하여 자세히 설명 하고 있는 좋은 입문서이다. | 164 | 적용하는지에 관하여 자세히 설명하고 있는 좋은 입문서이다. |
164 | 165 | ||
165 | 커널은 소스 코드 그 자체에서 자동적으로 만들어질 수 있는 많은 문서들을 | 166 | 커널은 소스 코드 그 자체에서 자동적으로 만들어질 수 있는 많은 문서들을 |
166 | 가지고 있다. 이것은 커널 내의 API에 대한 모든 설명, 그리고 락킹을 | 167 | 가지고 있다. 이것은 커널 내의 API에 대한 모든 설명, 그리고 락킹을 |
@@ -192,7 +193,7 @@ Documentation/DocBook/ 디렉토리 내에서 만들어지며 PDF, Postscript, H | |||
192 | 여러분이 어디서 시작해야 할진 모르지만 커널 개발 커뮤니티에 참여할 수 | 193 | 여러분이 어디서 시작해야 할진 모르지만 커널 개발 커뮤니티에 참여할 수 |
193 | 있는 일들을 찾길 원한다면 리눅스 커널 Janitor 프로젝트를 살펴봐라. | 194 | 있는 일들을 찾길 원한다면 리눅스 커널 Janitor 프로젝트를 살펴봐라. |
194 | http://janitor.kernelnewbies.org/ | 195 | http://janitor.kernelnewbies.org/ |
195 | 그곳은 시작하기에 아주 곳이다. 그곳은 리눅스 커널 소스 트리내에 | 196 | 그곳은 시작하기에 훌한 이다. 그곳은 리눅스 커널 소스 트리내에 |
196 | 간단히 정리되고 수정될 수 있는 문제들에 관하여 설명한다. 여러분은 이 | 197 | 간단히 정리되고 수정될 수 있는 문제들에 관하여 설명한다. 여러분은 이 |
197 | 프로젝트를 대표하는 개발자들과 일하면서 자신의 패치를 리눅스 커널 트리에 | 198 | 프로젝트를 대표하는 개발자들과 일하면서 자신의 패치를 리눅스 커널 트리에 |
198 | 반영하기 위한 기본적인 것들을 배우게 될것이며 여러분이 아직 아이디어를 | 199 | 반영하기 위한 기본적인 것들을 배우게 될것이며 여러분이 아직 아이디어를 |
@@ -212,7 +213,7 @@ Documentation/DocBook/ 디렉토리 내에서 만들어지며 PDF, Postscript, H | |||
212 | 것은 Linux Cross-Reference project이며 그것은 자기 참조 방식이며 | 213 | 것은 Linux Cross-Reference project이며 그것은 자기 참조 방식이며 |
213 | 소스코드를 인덱스된 웹 페이지들의 형태로 보여준다. 최신의 멋진 커널 | 214 | 소스코드를 인덱스된 웹 페이지들의 형태로 보여준다. 최신의 멋진 커널 |
214 | 코드 저장소는 다음을 통하여 참조할 수 있다. | 215 | 코드 저장소는 다음을 통하여 참조할 수 있다. |
215 | http://sosdg.org/~coywolf/lxr/ | 216 | http://users.sosdg.org/~qiyong/lxr/ |
216 | 217 | ||
217 | 218 | ||
218 | 개발 프로세스 | 219 | 개발 프로세스 |
@@ -233,44 +234,45 @@ Documentation/DocBook/ 디렉토리 내에서 만들어지며 PDF, Postscript, H | |||
233 | 2.6.x 커널들은 Linux Torvalds가 관리하며 kernel.org의 pub/linux/kernel/v2.6/ | 234 | 2.6.x 커널들은 Linux Torvalds가 관리하며 kernel.org의 pub/linux/kernel/v2.6/ |
234 | 디렉토리에서 참조될 수 있다.개발 프로세스는 다음과 같다. | 235 | 디렉토리에서 참조될 수 있다.개발 프로세스는 다음과 같다. |
235 | - 새로운 커널이 배포되자마자 2주의 시간이 주어진다. 이 기간동은 | 236 | - 새로운 커널이 배포되자마자 2주의 시간이 주어진다. 이 기간동은 |
236 | 메인너들은 큰 diff들을 Linus에게 제출할 수 있다. 대개 이 패치들은 | 237 | 메인이너들은 큰 diff들을 Linus에게 제출할 수 있다. 대개 이 패치들은 |
237 | 몇 주 동안 -mm 커널내에 이미 있었던 것들이다. 큰 변경들을 제출하는 데 | 238 | 몇 주 동안 -mm 커널내에 이미 있었던 것들이다. 큰 변경들을 제출하는 데 |
238 | 선호되는 방법은 git(커널의 소스 관리 툴, 더 많은 정보들은 http://git.or.cz/ | 239 | 선호되는 방법은 git(커널의 소스 관리 툴, 더 많은 정보들은 http://git.or.cz/ |
239 | 에서 참조할 수 있다)를 사용하는 것이지만 순수한 패치파일의 형식으로 보내 | 240 | 에서 참조할 수 있다)를 사용하는 것이지만 순수한 패치파일의 형식으로 보내 |
240 | 것도 무관하다. | 241 | 것도 무관하다. |
241 | - 2주 후에 -rc1 커널이 배포되며 지금부터는 전체 커널의 안정성에 영향을 | 242 | - 2주 후에 -rc1 커널이 배포되며 지금부터는 전체 커널의 안정성에 영향을 |
242 | 미칠수 있는 새로운 기능들을 포함하지 않는 패치들만 추가될 수 있다. | 243 | 미칠수 있는 새로운 기능들을 포함하지 않는 패치들만 추가될 수 있다. |
243 | 완전히 새로운 드라이버(혹은 파일시스템)는 -rc1 이후에만 받아들여진다는 | 244 | 완전히 새로운 드라이버(혹은 파일시스템)는 -rc1 이후에만 받아들여진다는 |
244 | 것을 기억해라. 왜냐하면 변경이 자체내에서만 발생하고 추가된 코드가 | 245 | 것을 기억해라. 왜냐하면 변경이 자체내에서만 발생하고 추가된 코드가 |
245 | 드라이버 외부의 다른 부분에는 영향을 주지 않으므로 그런 변경은 | 246 | 드라이버 외부의 다른 부분에는 영향을 주지 않으므로 그런 변경은 |
246 | 퇴보(regression)를 일으킬 만한 위험을 가지고 있지 않기 때문이다. -rc1이 | 247 | 회귀(역자주: 이전에는 존재하지 않았지만 새로운 기능추가나 변경으로 인해 |
248 | 생겨난 버그)를 일으킬 만한 위험을 가지고 있지 않기 때문이다. -rc1이 | ||
247 | 배포된 이후에 git를 사용하여 패치들을 Linus에게 보낼수 있지만 패치들은 | 249 | 배포된 이후에 git를 사용하여 패치들을 Linus에게 보낼수 있지만 패치들은 |
248 | 공식적인 메일링 리스트로 보내서 검토를 받을 필요가 있다. | 250 | 공식적인 메일링 리스트로 보내서 검토를 받을 필요가 있다. |
249 | - 새로운 -rc는 Linus는 현재 git tree가 테스트 하기에 충분히 안정된 상태에 | 251 | - 새로운 -rc는 Linus가 현재 git tree가 테스트 하기에 충분히 안정된 상태에 |
250 | 있다고 판단될 때마다 배포된다. 목표는 새로운 -rc 커널을 매주 배포하는 | 252 | 있다고 판단될 때마다 배포된다. 목표는 새로운 -rc 커널을 매주 배포하는 |
251 | 것이다. | 253 | 것이다. |
252 | - 이러한 프로세스는 커널이 "준비"되었다고 여겨질때까지 계속된다. | 254 | - 이러한 프로세스는 커널이 "준비(ready)"되었다고 여겨질때까지 계속된다. |
253 | 프로세스는 대체로 6주간 지속된다. | 255 | 프로세스는 대체로 6주간 지속된다. |
254 | - 각 -rc 배포에 있는 알려진 보의 목록들은 다음 URI에 남겨진다. | 256 | - 각 -rc 배포에 있는 알려진 귀의 목록들은 다음 URI에 남겨진다. |
255 | http://kernelnewbies.org/known_regressions | 257 | http://kernelnewbies.org/known_regressions |
256 | 258 | ||
257 | 커널 배포에 있어서 언급할만한 가치가 있는 리눅스 커널 메일링 리스트의 | 259 | 커널 배포에 있어서 언급할만한 가치가 있는 리눅스 커널 메일링 리스트의 |
258 | Andrew Morton의 글이 있다. | 260 | Andrew Morton의 글이 있다. |
259 | "커널이 언제 배포될지는 아무 모른다. 왜냐하면 배포는 알려진 | 261 | "커널이 언제 배포될지는 아무 모른다. 왜냐하면 배포는 알려진 |
260 | 버그의 상황에 따라 배포되는 것이지 미리정해 놓은 시간에 따라 | 262 | 버그의 상황에 따라 배포되는 것이지 미리정해 놓은 시간에 따라 |
261 | 배포되는 것은 아니기 때문이다." | 263 | 배포되는 것은 아니기 때문이다." |
262 | 264 | ||
263 | 2.6.x.y - 안정 커널 트리 | 265 | 2.6.x.y - 안정 커널 트리 |
264 | ------------------------ | 266 | ------------------------ |
265 | 267 | ||
266 | 4 자리 숫자로 이루어진 버젼의 커널들은 -stable 커널들이다. 그것들은 2.6.x | 268 | 4 자리 숫자로 이루어진 버젼의 커널들은 -stable 커널들이다. 그것들은 2.6.x |
267 | 커널에서 발견된 큰 이나 보안 문제들 중 비교적 작고 중요한 수정들을 | 269 | 커널에서 발견된 큰 귀들이나 보안 문제들 중 비교적 작고 중요한 수정들을 |
268 | 포함한다. | 270 | 포함한다. |
269 | 271 | ||
270 | 이것은 가장 최근의 안정적인 커널을 원하는 사용자에게 추천되는 브랜치이며, | 272 | 이것은 가장 최근의 안정적인 커널을 원하는 사용자에게 추천되는 브랜치이며, |
271 | 개발/실험적 버젼을 테스트하는 것을 돕는는 별로 관 없다. | 273 | 개발/실험적 버젼을 테스트하는 것을 돕고자 하는 사용자과는 별로 관련이 없다. |
272 | 274 | ||
273 | 어떤 2.6.x.y 커널도 사용가능 다면 그때는 가장 높은 숫자의 2.6.x | 275 | 어떤 2.6.x.y 커널도 사용 다면 그때는 가장 높은 숫자의 2.6.x |
274 | 커널이 현재의 안정 커널이다. | 276 | 커널이 현재의 안정 커널이다. |
275 | 277 | ||
276 | 2.6.x.y는 "stable" 팀<stable@kernel.org>에 의해 관리되며 거의 매번 격주로 | 278 | 2.6.x.y는 "stable" 팀<stable@kernel.org>에 의해 관리되며 거의 매번 격주로 |
@@ -294,7 +296,7 @@ Andrew Morton에 의해 배포된 실험적인 커널 패치들이다. Andrew는 | |||
294 | 서브시스템 커널 트리와 패치들을 가져와서 리눅스 커널 메일링 리스트로 | 296 | 서브시스템 커널 트리와 패치들을 가져와서 리눅스 커널 메일링 리스트로 |
295 | 온 많은 패치들과 한데 묶는다. 이 트리는 새로운 기능들과 패치들을 위한 | 297 | 온 많은 패치들과 한데 묶는다. 이 트리는 새로운 기능들과 패치들을 위한 |
296 | 장소를 제공하는 역할을 한다. 하나의 패치가 -mm에 한동안 있으면서 그 가치가 | 298 | 장소를 제공하는 역할을 한다. 하나의 패치가 -mm에 한동안 있으면서 그 가치가 |
297 | 증명되게 되면 Andrew나 서브시스템 메인너는 그것을 메인라인에 포함시키기 | 299 | 증명되게 되면 Andrew나 서브시스템 메인이너는 그것을 메인라인에 포함시키기 |
298 | 위하여 Linus에게 보낸다. | 300 | 위하여 Linus에게 보낸다. |
299 | 301 | ||
300 | 커널 트리에 포함하고 싶은 모든 새로운 패치들은 Linus에게 보내지기 전에 | 302 | 커널 트리에 포함하고 싶은 모든 새로운 패치들은 Linus에게 보내지기 전에 |
@@ -327,7 +329,7 @@ Andrew Morton에 의해 배포된 실험적인 커널 패치들이다. Andrew는 | |||
327 | - ACPI development tree, Len Brown <len.brown@intel.com > | 329 | - ACPI development tree, Len Brown <len.brown@intel.com > |
328 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | 330 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git |
329 | 331 | ||
330 | - Block development tree, Jens Axboe <axboe@suse.de> | 332 | - Block development tree, Jens Axboe <jens.axboe@oracle.com> |
331 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | 333 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git |
332 | 334 | ||
333 | - DRM development tree, Dave Airlie <airlied@linux.ie> | 335 | - DRM development tree, Dave Airlie <airlied@linux.ie> |
@@ -367,8 +369,8 @@ bugzilla.kernel.org는 리눅스 커널 개발자들이 커널의 버그를 추 | |||
367 | kernel bugzilla를 사용하는 자세한 방법은 다음을 참조하라. | 369 | kernel bugzilla를 사용하는 자세한 방법은 다음을 참조하라. |
368 | http://test.kernel.org/bugzilla/faq.html | 370 | http://test.kernel.org/bugzilla/faq.html |
369 | 371 | ||
370 | 메인 커널 소스 디렉토리에 있는 REPORTING-BUGS 파일은 커널 버그 같 | 372 | 메인 커널 소스 디렉토리에 있는 REPORTING-BUGS 파일은 커널 버그 각되는 |
371 | 것을 보고하는는 법에 관한 좋은 템플릿이고 문제를 추적하기 위해서 커널 | 373 | 것을 보고하는 에 관한 좋은 템플릿이며 문제를 추적하기 위해서 커널 |
372 | 개발자들이 필요로 하는 정보가 무엇들인지를 상세히 설명하고 있다. | 374 | 개발자들이 필요로 하는 정보가 무엇들인지를 상세히 설명하고 있다. |
373 | 375 | ||
374 | 376 | ||
@@ -383,7 +385,7 @@ kernel bugzilla를 사용하는 자세한 방법은 다음을 참조하라. | |||
383 | 점수를 얻을 수 있는 가장 좋은 방법중의 하나이다. 왜냐하면 많은 사람들은 | 385 | 점수를 얻을 수 있는 가장 좋은 방법중의 하나이다. 왜냐하면 많은 사람들은 |
384 | 다른 사람들의 버그들을 수정하기 위하여 시간을 낭비하지 않기 때문이다. | 386 | 다른 사람들의 버그들을 수정하기 위하여 시간을 낭비하지 않기 때문이다. |
385 | 387 | ||
386 | 이미 보고된 버그 리포트들을 가지고 작업하기 위해서 http://bugzilla.kernelorg를 | 388 | 이미 보고된 버그 리포트들을 가지고 작업하기 위해서 http://bugzilla.kernel.org를 |
387 | 참조하라. 여러분이 앞으로 생겨날 버그 리포트들의 조언자가 되길 원한다면 | 389 | 참조하라. 여러분이 앞으로 생겨날 버그 리포트들의 조언자가 되길 원한다면 |
388 | bugme-new 메일링 리스트나(새로운 버그 리포트들만이 이곳에서 메일로 전해진다) | 390 | bugme-new 메일링 리스트나(새로운 버그 리포트들만이 이곳에서 메일로 전해진다) |
389 | bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메일로 전해진다) | 391 | bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메일로 전해진다) |
@@ -404,8 +406,8 @@ bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메 | |||
404 | 웹상의 많은 다른 곳에도 메일링 리스트의 아카이브들이 있다. | 406 | 웹상의 많은 다른 곳에도 메일링 리스트의 아카이브들이 있다. |
405 | 이러한 아카이브들을 찾으려면 검색 엔진을 사용하라. 예를 들어: | 407 | 이러한 아카이브들을 찾으려면 검색 엔진을 사용하라. 예를 들어: |
406 | http://dir.gmane.org/gmane.linux.kernel | 408 | http://dir.gmane.org/gmane.linux.kernel |
407 | 여러분이 새로운 문제에 관해 리스트에 올리기 전에 말하고 싶은 주제에 한 | 409 | 여러분이 새로운 문제에 관해 리스트에 올리기 전에 말하고 싶은 주제에 한 |
408 | 것을 아카이브에서 먼저 찾기를 강력히 권장한다. 이미 상세하게 토론된 많은 | 410 | 것을 아카이브에서 먼저 찾아보기를 강력히 권장한다. 이미 상세하게 토론된 많은 |
409 | 것들이 메일링 리스트의 아카이브에 기록되어 있다. | 411 | 것들이 메일링 리스트의 아카이브에 기록되어 있다. |
410 | 412 | ||
411 | 각각의 커널 서브시스템들의 대부분은 자신들의 개발에 관한 노력들로 이루어진 | 413 | 각각의 커널 서브시스템들의 대부분은 자신들의 개발에 관한 노력들로 이루어진 |
@@ -443,7 +445,7 @@ bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메 | |||
443 | 무엇보다도 메일링 리스트의 다른 구독자들에게 보여주려 한다는 것을 기억하라. | 445 | 무엇보다도 메일링 리스트의 다른 구독자들에게 보여주려 한다는 것을 기억하라. |
444 | 446 | ||
445 | 447 | ||
446 | 커뮤니티와 일하는 법 | 448 | 커뮤니티와 력는 법 |
447 | -------------------- | 449 | -------------------- |
448 | 450 | ||
449 | 커널 커뮤니티의 목적은 가능한한 가장 좋은 커널을 제공하는 것이다. 여러분이 | 451 | 커널 커뮤니티의 목적은 가능한한 가장 좋은 커널을 제공하는 것이다. 여러분이 |
@@ -474,7 +476,7 @@ bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메 | |||
474 | 올바른 방향의 해결책으로 이끌어갈 의지가 있다면 받아들여질 것이라는 점을 | 476 | 올바른 방향의 해결책으로 이끌어갈 의지가 있다면 받아들여질 것이라는 점을 |
475 | 기억하라. | 477 | 기억하라. |
476 | 478 | ||
477 | 여러분의 첫 패치에 여러분이 수정해야하는 십여개 정도의 회신이 오는 | 479 | 여러분의 첫 패치에 여러분이 수정해야하는 십여개 정도의 회신이 오는 |
478 | 경우도 흔하다. 이것은 여러분의 패치가 받아들여지지 않을 것이라는 것을 | 480 | 경우도 흔하다. 이것은 여러분의 패치가 받아들여지지 않을 것이라는 것을 |
479 | 의미하는 것이 아니고 개인적으로 여러분에게 감정이 있어서 그러는 것도 | 481 | 의미하는 것이 아니고 개인적으로 여러분에게 감정이 있어서 그러는 것도 |
480 | 아니다. 간단히 여러분의 패치에 제기된 문제들을 수정하고 그것을 다시 | 482 | 아니다. 간단히 여러분의 패치에 제기된 문제들을 수정하고 그것을 다시 |
@@ -486,12 +488,12 @@ bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메 | |||
486 | 커널 커뮤니티는 가장 전통적인 회사의 개발 환경과는 다르다. 여기에 여러분들의 | 488 | 커널 커뮤니티는 가장 전통적인 회사의 개발 환경과는 다르다. 여기에 여러분들의 |
487 | 문제를 피하기 위한 목록이 있다. | 489 | 문제를 피하기 위한 목록이 있다. |
488 | 여러분들이 제안한 변경들에 관하여 말할 때 좋은 것들 : | 490 | 여러분들이 제안한 변경들에 관하여 말할 때 좋은 것들 : |
489 | - " 이것은 여러 문제들을 해겹합니다." | 491 | - "이것은 여러 문제들을 해겹합니다." |
490 | - "이것은 2000 라인의 코드를 제거합니다." | 492 | - "이것은 2000 라인의 코드를 제거합니다." |
491 | - "이것은 내가 말하려는 것에 관해 설명하는 패치입니다." | 493 | - "이것은 내가 말하려는 것에 관해 설명하는 패치입니다." |
492 | - "나는 5개의 다른 아키텍쳐에서 그것을 테스트했슴으로..." | 494 | - "나는 5개의 다른 아키텍쳐에서 그것을 테스트했슴으로..." |
493 | - "여기에 일련의 작은 패치들이 있음로..." | 495 | - "여기에 일련의 작은 패치들이 있음로..." |
494 | - "이것은 일반적인 머신에서 성능을 향상시..." | 496 | - "이것은 일반적인 머신에서 성능을 향상시으로..." |
495 | 497 | ||
496 | 여러분들이 말할 때 피해야 할 좋지 않은 것들 : | 498 | 여러분들이 말할 때 피해야 할 좋지 않은 것들 : |
497 | - "우리를 그것을 AIT/ptx/Solaris에서 이러한 방법으로 했다. 그러므로 그것은 좋은 것임에 틀립없다..." | 499 | - "우리를 그것을 AIT/ptx/Solaris에서 이러한 방법으로 했다. 그러므로 그것은 좋은 것임에 틀립없다..." |
@@ -500,7 +502,7 @@ bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메 | |||
500 | - "이것은 우리의 엔터프라이즈 상품 라인을 위한 것이다." | 502 | - "이것은 우리의 엔터프라이즈 상품 라인을 위한 것이다." |
501 | - "여기에 나의 생각을 말하고 있는 1000 페이지 설계 문서가 있다." | 503 | - "여기에 나의 생각을 말하고 있는 1000 페이지 설계 문서가 있다." |
502 | - "나는 6달동안 이것을 했으니..." | 504 | - "나는 6달동안 이것을 했으니..." |
503 | - "여기 5000라인 짜리 패치가 있으니..." | 505 | - "여기 5000라인 짜리 패치가 있으니..." |
504 | - "나는 현재 뒤죽박죽인 것을 재작성했다. 그리고 여기에..." | 506 | - "나는 현재 뒤죽박죽인 것을 재작성했다. 그리고 여기에..." |
505 | - "나는 마감시한을 가지고 있으므로 이 패치는 지금 적용될 필요가 있다." | 507 | - "나는 마감시한을 가지고 있으므로 이 패치는 지금 적용될 필요가 있다." |
506 | 508 | ||
@@ -510,13 +512,13 @@ bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메 | |||
510 | 없다는 것이다. 리눅스 커널의 작업 환경에서는 단지 이메일 주소만 | 512 | 없다는 것이다. 리눅스 커널의 작업 환경에서는 단지 이메일 주소만 |
511 | 알수 있기 때문에 여성과 소수 민족들도 모두 받아들여진다. 국제적으로 | 513 | 알수 있기 때문에 여성과 소수 민족들도 모두 받아들여진다. 국제적으로 |
512 | 일하게 되는 측면은 사람의 이름에 근거하여 성별을 추측할 수 없게 | 514 | 일하게 되는 측면은 사람의 이름에 근거하여 성별을 추측할 수 없게 |
513 | 하기때문에 차별을 없애는 데 도움을 준다. Andrea라는 이름을 가진 남자와 | 515 | 하기때문에 차별을 없애는 데 도움을 준다. Andrea라는 이름을 가진 남자와 |
514 | Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅스 커널에서 | 516 | Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅스 커널에서 |
515 | 작업하며 생각을 표현해왔던 대부분의 여성들은 긍정적인 경험을 가지고 | 517 | 작업하며 생각을 표현해왔던 대부분의 여성들은 긍정적인 경험을 가지고 |
516 | 있다. | 518 | 있다. |
517 | 519 | ||
518 | 언어 장벽은 영어에 익숙하지 않은 몇몇 사람들에게 문제가 될 수도 있다. | 520 | 언어 장벽은 영어에 익숙하지 않은 몇몇 사람들에게 문제가 될 수도 있다. |
519 | 언어의 훌륭한 구사는 메일링 리스트에서 올바르게 자신의 생각을 | 521 | 언어의 훌륭한 구사는 메일링 리스트에서 올바르게 자신의 생각을 |
520 | 표현하기 위하여 필요하다. 그래서 여러분은 이메일을 보내기 전에 | 522 | 표현하기 위하여 필요하다. 그래서 여러분은 이메일을 보내기 전에 |
521 | 영어를 올바르게 사용하고 있는지를 체크하는 것이 바람직하다. | 523 | 영어를 올바르게 사용하고 있는지를 체크하는 것이 바람직하다. |
522 | 524 | ||
@@ -524,13 +526,13 @@ Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅 | |||
524 | 여러분의 변경을 나누어라 | 526 | 여러분의 변경을 나누어라 |
525 | ------------------------ | 527 | ------------------------ |
526 | 528 | ||
527 | 리눅스 커널 커뮤니티는 한꺼번에 굉장히 큰 코드의 묶음을 쉽게 | 529 | 리눅스 커널 커뮤니티는 한꺼번에 굉장히 큰 코드의 묶음(chunk)을 쉽게 |
528 | 받아들이지 않는다. 변경은 적절하게 소개되고, 검토되고, 각각의 | 530 | 받아들이지 않는다. 변경은 적절하게 소개되고, 검토되고, 각각의 |
529 | 부분으로 작게 나누어져야 한다. 이것은 회사에서 하는 것과는 정확히 | 531 | 부분으로 작게 나누어져야 한다. 이것은 회사에서 하는 것과는 정확히 |
530 | 반대되는 것이다. 여러분들의 제안은 개발 초기에 일찍이 소개되야 한다. | 532 | 반대되는 것이다. 여러분들의 제안은 개발 초기에 일찍이 소개되야 한다. |
531 | 그래서 여러분들은 자신이 하고 있는 것에 관하여 피드백을 받을 수 있게 | 533 | 그래서 여러분들은 자신이 하고 있는 것에 관하여 피드백을 받을 수 있게 |
532 | 된다. 커뮤니티가 여러분들이 커뮤니티와 함께 일하고 있다는 것을 | 534 | 된다. 커뮤니티가 여러분들이 커뮤니티와 함께 일하고 있다는 것을 |
533 | 느끼도록 만들고 커뮤니티가 여러분의 기능을 위한 쓰레기 장으로 | 535 | 느끼도록 만들고 커뮤니티가 여러분의 기능을 위한 쓰레기 장으로 |
534 | 사용되지 않고 있다는 것을 느끼게 하자. 그러나 메일링 리스트에 한번에 | 536 | 사용되지 않고 있다는 것을 느끼게 하자. 그러나 메일링 리스트에 한번에 |
535 | 50개의 이메일을 보내지는 말아라. 여러분들의 일련의 패치들은 항상 | 537 | 50개의 이메일을 보내지는 말아라. 여러분들의 일련의 패치들은 항상 |
536 | 더 작아야 한다. | 538 | 더 작아야 한다. |
@@ -539,7 +541,7 @@ Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅 | |||
539 | 541 | ||
540 | 1) 작은 패치들은 여러분의 패치들이 적용될 수 있는 확률을 높여준다. | 542 | 1) 작은 패치들은 여러분의 패치들이 적용될 수 있는 확률을 높여준다. |
541 | 왜냐하면 다른 사람들은 정확성을 검증하기 위하여 많은 시간과 노력을 | 543 | 왜냐하면 다른 사람들은 정확성을 검증하기 위하여 많은 시간과 노력을 |
542 | 들이기를 원하지 않는다. 5줄의 패치는 메인너가 거의 몇 초간 힐끗 | 544 | 들이기를 원하지 않는다. 5줄의 패치는 메인이너가 거의 몇 초간 힐끗 |
543 | 보면 적용될 수 있다. 그러나 500 줄의 패치는 정확성을 검토하기 위하여 | 545 | 보면 적용될 수 있다. 그러나 500 줄의 패치는 정확성을 검토하기 위하여 |
544 | 몇시간이 걸릴 수도 있다(걸리는 시간은 패치의 크기 혹은 다른 것에 | 546 | 몇시간이 걸릴 수도 있다(걸리는 시간은 패치의 크기 혹은 다른 것에 |
545 | 비례하여 기하급수적으로 늘어난다). | 547 | 비례하여 기하급수적으로 늘어난다). |
@@ -558,18 +560,18 @@ Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅 | |||
558 | 간결하고 가장 뛰어난 답을 보길 원한다. 훌륭한 학생은 이것을 알고 | 560 | 간결하고 가장 뛰어난 답을 보길 원한다. 훌륭한 학생은 이것을 알고 |
559 | 마지막으로 답을 얻기 전 중간 과정들을 제출하진 않는다. | 561 | 마지막으로 답을 얻기 전 중간 과정들을 제출하진 않는다. |
560 | 562 | ||
561 | 커널 개발도 마찬가지이다. 메인너들과 검토하는 사람들은 문제를 | 563 | 커널 개발도 마찬가지이다. 메인이너들과 검토하는 사람들은 문제를 |
562 | 풀어나가는 과정속에 숨겨진 과정을 보길 원하진 않는다. 그들은 | 564 | 풀어나가는 과정속에 숨겨진 과정을 보길 원하진 않는다. 그들은 |
563 | 간결하고 멋진 답을 보길 원한다." | 565 | 간결하고 멋진 답을 보길 원한다." |
564 | 566 | ||
565 | 커뮤니티와 일하며 뛰어난 답을 찾 여러분들의 완성지 은 들 | 567 | 커뮤니티와 력하며 뛰어난 답을 찾는 여러분들의 마지 못 업들 |
566 | 사이에 균형을 유지해야 하는 어려 있 수 있다. 그러므로 프로세스의 | 568 | 사이에 균형을 유지해야 하는 것 려 른. 그러므로 프로세스의 |
567 | 초반에 여러분의 을 향상시키기위한 피드백을 얻는 것 뿐만 아니라 | 569 | 초반에 여러분의 향상시키기위한 피드백을 얻는 것 뿐만 아니라 |
568 | 여러분들의 변경들을 작은 묶음으로 유지해서 심지어는 여러분의 작업의 | 570 | 여러분들의 변경들을 작은 묶음으로 유지해서 심지어는 여러분의 작업의 |
569 | 모든 부분이 지금은 포함될 준비가 되어있지 않지만 작은 부분은 이 | 571 | 모든 부분이 지금은 포함될 준비가 되어있지 않지만 작은 부분은 써 |
570 | 받아들여질 수 있도록 유지하는 것이 바람직하다. | 572 | 받아들여질 수 있도록 유지하는 것이 바람직하다. |
571 | 573 | ||
572 | 또한 완성되지 않았고 "나중에 수정될 것이다." 와 같은 것들 포함하는 | 574 | 또한 완성되지 않았고 "나중에 수정될 것이다." 와 같은 것들 포함하는 |
573 | 패치들은 받아들여지지 않을 것이라는 점을 유념하라. | 575 | 패치들은 받아들여지지 않을 것이라는 점을 유념하라. |
574 | 576 | ||
575 | 변경을 정당화해라 | 577 | 변경을 정당화해라 |
@@ -577,7 +579,7 @@ Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅 | |||
577 | 579 | ||
578 | 여러분들의 나누어진 패치들을 리눅스 커뮤니티가 왜 반영해야 하는지를 | 580 | 여러분들의 나누어진 패치들을 리눅스 커뮤니티가 왜 반영해야 하는지를 |
579 | 알도록 하는 것은 매우 중요하다. 새로운 기능들이 필요하고 유용하다는 | 581 | 알도록 하는 것은 매우 중요하다. 새로운 기능들이 필요하고 유용하다는 |
580 | 것은 반드시 그에 는 이유가 있어야 한다. | 582 | 것은 반드시 그에 합한 이유가 있어야 한다. |
581 | 583 | ||
582 | 584 | ||
583 | 변경을 문서화해라 | 585 | 변경을 문서화해라 |
@@ -588,7 +590,7 @@ Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅 | |||
588 | 것이다. 그리고 항상 그 내용을 보길 원하는 모든 사람들을 위해 보존될 | 590 | 것이다. 그리고 항상 그 내용을 보길 원하는 모든 사람들을 위해 보존될 |
589 | 것이다. 패치는 완벽하게 다음과 같은 내용들을 포함하여 설명해야 한다. | 591 | 것이다. 패치는 완벽하게 다음과 같은 내용들을 포함하여 설명해야 한다. |
590 | - 변경이 왜 필요한지 | 592 | - 변경이 왜 필요한지 |
591 | - 패치에 관한 전체 설계 프로치 | 593 | - 패치에 관한 전체 설계 근(approach) |
592 | - 구현 상세들 | 594 | - 구현 상세들 |
593 | - 테스트 결과들 | 595 | - 테스트 결과들 |
594 | 596 | ||
@@ -600,7 +602,7 @@ Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅 | |||
600 | 602 | ||
601 | 603 | ||
602 | 이 모든 것을 하는 것은 매우 어려운 일이다. 완벽히 소화하는 데는 적어도 몇년이 | 604 | 이 모든 것을 하는 것은 매우 어려운 일이다. 완벽히 소화하는 데는 적어도 몇년이 |
603 | 걸릴 수도 있다. 많은 인내와 결가 필요한 계속되는 개선의 과정이다. 그러나 | 605 | 걸릴 수도 있다. 많은 인내와 결 필요한 계속되는 개선의 과정이다. 그러나 |
604 | 가능한한 포기하지 말라. 많은 사람들은 이전부터 해왔던 것이고 그 사람들도 | 606 | 가능한한 포기하지 말라. 많은 사람들은 이전부터 해왔던 것이고 그 사람들도 |
605 | 정확하게 여러분들이 지금 서 있는 그 곳부터 시작했었다. | 607 | 정확하게 여러분들이 지금 서 있는 그 곳부터 시작했었다. |
606 | 608 | ||
@@ -620,4 +622,4 @@ David A. Wheeler, Junio Hamano, Michael Kerrisk, and Alex Shepard에게도 감 | |||
620 | 622 | ||
621 | 623 | ||
622 | 624 | ||
623 | 메인너: Greg Kroah-Hartman <greg@kroah.com> | 625 | 메인이너: Greg Kroah-Hartman <greg@kroah.com> |
diff --git a/Documentation/ko_KR/stable_api_nonsense.txt b/Documentation/ko_KR/stable_api_nonsense.txt new file mode 100644 index 000000000000..8f2b0e1d98c4 --- /dev/null +++ b/Documentation/ko_KR/stable_api_nonsense.txt | |||
@@ -0,0 +1,195 @@ | |||
1 | NOTE: | ||
2 | This is a version of Documentation/stable_api_nonsense.txt translated | ||
3 | into korean | ||
4 | This document is maintained by barrios <minchan.kim@gmail.com> | ||
5 | If you find any difference between this document and the original file or | ||
6 | a problem with the translation, please contact the maintainer of this file. | ||
7 | |||
8 | Please also note that the purpose of this file is to be easier to | ||
9 | read for non English (read: korean) speakers and is not intended as | ||
10 | a fork. So if you have any comments or updates for this file please | ||
11 | try to update the original English file first. | ||
12 | |||
13 | ================================== | ||
14 | 이 문서는 | ||
15 | Documentation/stable_api_nonsense.txt | ||
16 | 의 한글 번역입니다. | ||
17 | |||
18 | 역자: 김민찬 <minchan.kim@gmail.com> | ||
19 | 감수: 이제이미 <jamee.lee@samsung.com> | ||
20 | ================================== | ||
21 | |||
22 | 리눅스 커널 드라이버 인터페이스 | ||
23 | (여러분들의 모든 질문에 대한 답 그리고 다른 몇가지) | ||
24 | |||
25 | Greg Kroah-Hartman <greg@kroah.com> | ||
26 | |||
27 | 이 문서는 리눅스가 왜 바이너리 커널 인터페이스를 갖지 않는지, 왜 변하지 | ||
28 | 않는(stable) 커널 인터페이스를 갖지 않는지를 설명하기 위해 쓰여졌다. | ||
29 | 이 문서는 커널과 유저공간 사이의 인터페이스가 아니라 커널 내부의 | ||
30 | 인터페이스들을 설명하고 있다는 것을 유념하라. 커널과 유저공간 사이의 | ||
31 | 인터페이스는 응용프로그램이 사용하는 syscall 인터페이스이다. 그 인터페이스는 | ||
32 | 오랫동안 거의 변하지 않았고 앞으로도 변하지 않을 것이다. 나는 pre 0.9에서 | ||
33 | 만들어졌지만 최신의 2.6 커널 배포에서도 잘 동작하는 프로그램을 가지고 | ||
34 | 있다. 이 인터페이스는 사용자와 응용프로그램 개발자들이 변하지 않을 것이라고 | ||
35 | 여길수 있는 것이다. | ||
36 | |||
37 | |||
38 | 초록 | ||
39 | ---- | ||
40 | 여러분은 변하지 않는 커널 인터페이스를 원한다고 생각하지만 실제로는 | ||
41 | 그렇지 않으며 심지어는 그것을 알아채지 못한다. 여러분이 원하는 것은 | ||
42 | 안정되게 실행되는 드라이버이며 드라이버가 메인 커널 트리에 있을 때 | ||
43 | 그런 안정적인 드라이버를 얻을 수 있게 된다. 또한 여러분의 드라이버가 | ||
44 | 메인 커널 트리에 있다면 다른 많은 좋은 이점들을 얻게 된다. 그러한 것들이 | ||
45 | 리눅스를 강건하고, 안정적이며, 성숙한 운영체제로 만들어 놓음으로써 | ||
46 | 여러분들로 하여금 바로 리눅스를 사용하게 만드는 이유이다. | ||
47 | |||
48 | |||
49 | 소개 | ||
50 | ---- | ||
51 | |||
52 | 커널 내부의 인터페이스가 바뀌는 것을 걱정하며 커널 드라이버를 작성하고 | ||
53 | 싶어하는 사람은 정말 이상한 사람이다. 세상의 대다수의 사람들은 이 인터페이스를 | ||
54 | 보지못할 것이며 전혀 걱정하지도 않는다. | ||
55 | |||
56 | 먼저, 나는 closed 소스, hidden 소스, binary blobs, 소스 wrappers, 또는 GPL로 | ||
57 | 배포되었지만 소스 코드를 갖고 있지 않은 커널 드라이버들을 설명하는 어떤 다른 | ||
58 | 용어들에 관한 어떤 법적인 문제에 관해서는 언급하지 않을 것이다. 어떤 법적인 | ||
59 | 질문들을 가지고 있다면 변호사와 연락하라. 나는 프로그래머이므로 여기서 기술적인 | ||
60 | 문제들만을 설명하려고 한다. (법적인 문제를 경시하는 것은 아니다. 그런 문제들은 | ||
61 | 엄연히 현실에 있고 여러분들은 항상 그 문제들을 인식하고 있을 필요는 있다.) | ||
62 | |||
63 | 자, 두가지의 주요 주제가 있다. 바이너리 커널 인터페이스들과 변하지 않는 | ||
64 | 커널 소스 인터페이들. 그것들은 서로 의존성을 가지고 있지만 바이너리 | ||
65 | 문제를 먼저 풀고 넘어갈 것이다. | ||
66 | |||
67 | |||
68 | |||
69 | 바이너리 커널 인터페이스 | ||
70 | ------------------------ | ||
71 | 우리가 변하지 않는 커널 소스 인터페이스를 가지고 있다고 가정하자. 그러면 | ||
72 | 바이너리 인터페이스 또한 자연적으로 변하지 않을까? 틀렸다. 리눅스 커널에 | ||
73 | 관한 다음 사실들을 생각해보라. | ||
74 | - 여러분들이 사용하는 C 컴파일러의 버젼에 따라 다른 커널 자료 구조들은 | ||
75 | 다른 alignmnet들을 갖게 될것이고 다른 방법으로(함수들을 inline으로 | ||
76 | 했느냐, 아니냐) 다른 함수들을 포함하는 것도 가능한다. 중요한 것은 | ||
77 | 개별적인 함수 구성이 아니라 자료 구조 패딩이 달라진다는 점이다. | ||
78 | - 여러분이 선택한 커널 빌드 옵션에 따라서 커널은 다양한 것들을 가정할 | ||
79 | 수 있다. | ||
80 | - 다른 구조체들은 다른 필드들을 포함할 수 있다. | ||
81 | - 몇몇 함수들은 전혀 구현되지 않을 수도 있다(즉, 몇몇 lock들은 | ||
82 | non-SMP 빌드에서는 사라져 버릴수도 있다). | ||
83 | - 커널내에 메모리는 build optoin들에 따라 다른 방법으로 align될수 | ||
84 | 있다. | ||
85 | - 리눅스는 많은 다양한 프로세서 아키텍쳐에서 실행된다. 한 아키텍쳐의 | ||
86 | 바이너리 드라이버를 다른 아키텍쳐에서 정상적으로 실행시킬 방법은 | ||
87 | 없다. | ||
88 | |||
89 | 커널을 빌드했던 C 컴파일러와 정확하게 같은 것을 사용하고 정확하게 같은 | ||
90 | 커널 구성(configuration)을 사용하여 여러분들의 모듈을 빌드하면 간단히 | ||
91 | 많은 문제들을 해결할 수 있다. 이렇게 하는 것은 여러분들이 하나의 리눅스 | ||
92 | 배포판의 하나의 배포 버젼을 위한 모듈만을 제공한다면 별일 아닐 것이다. | ||
93 | 그러나 각기 다른 리눅스 배포판마다 한번씩 빌드하는 수를 각 리눅스 배포판마다 | ||
94 | 제공하는 다른 릴리즈의 수와 곱하게 되면 이번에는 각 릴리즈들의 다른 빌드 | ||
95 | 옵션의 악몽과 마주하게 것이다. 또한 각 리눅스 배포판들은 다른 하드웨어 | ||
96 | 종류에(다른 프로세서 타입과 다른 옵션들) 맞춰져 있는 많은 다른 커널들을 | ||
97 | 배포한다. 그러므로 한번의 배포에서조차 여러분들의 모듈은 여러 버젼을 | ||
98 | 만들 필요가 있다. | ||
99 | |||
100 | 나를 믿어라. 여러분들은 이러한 종류의 배포를 지원하려고 시도한다면 시간이 | ||
101 | 지나면 미칠지경이 될 것이다. 난 이러한 것을 오래전에 아주 어렵게 배웠다... | ||
102 | |||
103 | |||
104 | |||
105 | 변하지않는 커널 소스 인터페이스들 | ||
106 | --------------------------------- | ||
107 | |||
108 | 리눅스 커널 드라이버를 계속해서 메인 커널 트리에 반영하지 않고 | ||
109 | 유지보수하려고 하는 사름들과 이 문제를 논의하게 되면 훨씬 더 | ||
110 | "논란의 여지가 많은" 주제가 될 것이다. | ||
111 | |||
112 | 리눅스 커널 개발은 끊임없이 빠른 속도로 이루어지고 있으며 결코 | ||
113 | 느슨해진 적이 없다. 커널 개발자들이 현재 인터페이스들에서 버그를 | ||
114 | 발견하거나 무엇인가 할수 있는 더 좋은 방법을 찾게 되었다고 하자. | ||
115 | 그들이 발견한 것을 실행한다면 아마도 더 잘 동작하도록 현재 인터페이스들을 | ||
116 | 수정하게 될 것이다. 그들이 그런 일을 하게되면 함수 이름들은 변하게 되고, | ||
117 | 구조체들은 늘어나거나 줄어들게 되고, 함수 파라미터들은 재작업될 것이다. | ||
118 | 이러한 일이 발생되면 커널 내에 이 인터페이스를 사용했던 인스턴스들이 동시에 | ||
119 | 수정될 것이며 이러한 과정은 모든 것이 계속해서 올바르게 동작할 것이라는 | ||
120 | 것을 보장한다. | ||
121 | |||
122 | 이러한 것의 한 예로써, 커널 내부의 USB 인터페이스들은 이 서브시스템이 | ||
123 | 생긴 이후로 적어도 3번의 다른 재작업을 겪었다. 이 재작업들은 많은 다른 | ||
124 | 문제들을 풀었다. | ||
125 | - 데이터 스트림들의 동기적인 모델에서 비동기적인 모델로의 변화. 이것은 | ||
126 | 많은 드라이버들의 복잡성을 줄이고 처리량을 향상시켜 현재는 거의 모든 | ||
127 | USB 장치들의 거의 최대 속도로 실행되고 있다. | ||
128 | - USB 드라이버가 USB 코어로부터 데이터 패킷들을 할당받로록 한 변경으로 | ||
129 | 인해서 지금의 모든 드라이버들은 많은 문서화된 데드락을 수정하기 위하여 | ||
130 | USB 코어에게 더 많은 정보를 제공해야만 한다. | ||
131 | |||
132 | 이것은 오랫동안 자신의 오래된 USB 인터페이스들을 유지해야 하는 closed 운영체제들과는 | ||
133 | 완전히 반대되는 것이다. closed된 운영체제들은 새로운 개발자들에게 우연히 낡은 | ||
134 | 인터페이스를 사용하게 할 기회를 주게되며, 적절하지 못한 방법으로 처리하게 되어 | ||
135 | 운영체제의 안정성을 해치는 문제를 야기하게 된다. | ||
136 | |||
137 | 이 두가지의 예들 모두, 모든 개발자들은 꼭 이루어져야 하는 중요한 변화들이라고 | ||
138 | 동의를 하였고 비교적 적은 고통으로 변경되어졌다. 리눅스가 변하지 않는 소스 | ||
139 | 인터페이스를 고집한다면, 새로운 인터페이스가 만들어지게 되며 반면 기존의 오래된 | ||
140 | 것들, 그리고 깨진 것들은 계속해서 유지되어야 하며 이러한 일들은 USB 개발자들에게 | ||
141 | 또 다른 일거리를 주게 된다. 모든 리눅스 USB 개발자들에게 자신의 그들의 업무를 | ||
142 | 마친 후 시간을 투자하여 아무 득도 없는 무료 봉사를 해달라고 하는 것은 가능성이 | ||
143 | 희박한 일이다. | ||
144 | |||
145 | 보안 문제 역시 리눅스에게는 매우 중요하다. 보안 문제가 발견되면 그것은 | ||
146 | 매우 짧은 시간 안에 수정된다. 보안 문제는 그 문제를 해결하기 위하여 | ||
147 | 여러번 내부 커널 인터페이스들을 재작업하게 만들었다. 이러한 문제가 | ||
148 | 발생하였을 때 그 인터페이스들을 사용하는 모든 드라이버들도 동시에 | ||
149 | 수정되어 보안 문제가 앞으로 갑작스럽게 생기지는 않을 것이라는 것을 | ||
150 | 보장한다. 내부 인터페이스들의 변경이 허락되지 않으면 이러한 종류의 보안 | ||
151 | 문제를 수정하고 그것이 다시 발생하지 않을 것이라고 보장하는 것은 가능하지 | ||
152 | 않을 것이다. | ||
153 | |||
154 | 커널 인터페이스들은 계속해서 정리되고 있다. 현재 인터페이스를 사용하는 | ||
155 | 사람이 한명도 없다면 그것은 삭제된다. 이것은 커널이 가능한한 가장 작게 | ||
156 | 유지되며 존재하는 모든 가능성이 있는 인터페이스들이 테스트된다는 것을 | ||
157 | 보장한다(사용되지 않는 인터페이스들은 유효성 검증을 하기가 거의 불가능하다). | ||
158 | |||
159 | |||
160 | 무엇을 해야 하나 | ||
161 | --------------- | ||
162 | 자, 여러분이 메인 커널 트리에 있지 않은 리눅스 커널 드라이버를 가지고 | ||
163 | 있다면 여러분은 즉, 개발자는 무엇을 해야 하나? 모든 배포판마다 다른 | ||
164 | 커널 버젼을 위한 바이너리 드라이버를 배포하는 것은 악몽이며 계속해서 | ||
165 | 변하고 있는 커널 인터페이스들의 맞처 유지보수하려고 시도하는 것은 힘든 | ||
166 | 일이다. | ||
167 | |||
168 | 간단하다. 여러분의 커널 드라이버를 메인 커널 트리에 반영하라(우리는 여기서 | ||
169 | GPL을 따르는 배포 드라이버에 관해 얘기하고 있다는 것을 상기하라. 여러분의 | ||
170 | 코드가 이러한 분류에 해당되지 않는다면 행운을 빈다. 여러분 스스로 어떻게든 | ||
171 | 해야만 한다). 여러분의 드라이버가 트리에 있게되면 커널 인터페이스가 | ||
172 | 변경되더라도 가장 먼저 커널에 변경을 가했던 사람에 의해서 수정될 것이다. | ||
173 | 이것은 여러분의 드라이버가 여러분의 별다른 노력없이 항상 빌드가 가능하며 | ||
174 | 동작하는 것을 보장한다. | ||
175 | |||
176 | 메인 커널 트리에 여러분의 드라이버를 반영하면 얻게 되는 장점들은 다음과 같다. | ||
177 | - 관리의 드는 비용(원래 개발자의)은 줄어줄면서 드라이버의 질은 향상될 것이다. | ||
178 | - 다른 개발자들이 여러분의 드라이버에 기능들을 추가 할 것이다. | ||
179 | - 다른 사람들은 여러분의 드라이버에 버그를 발견하고 수정할 것이다. | ||
180 | - 다른 사람들은 여러분의 드라이버의 개선점을 찾을 줄 것이다. | ||
181 | - 외부 인터페이스 변경으로 인해 여러분의 드라이버의 수정이 필요하다면 다른 | ||
182 | 사람들이 드라이버를 업데이트할 것이다. | ||
183 | - 여러분의 드라이버는 별다른 노력 없이 모든 리눅스 배포판에 자동적으로 | ||
184 | 추가될 것이다. | ||
185 | |||
186 | 리눅스는 다른 운영 체제보다 "쉽게 쓸수 있는(out of the box)" 많은 다른 장치들을 | ||
187 | 지원하고 어떤 다른 운영 체제보다 다양한 아키텍쳐위에서 이러한 장치들을 지원하기 때문에 | ||
188 | 이러한 증명된 개발 모델은 틀림없이 바로 가고 있는 것이다. | ||
189 | |||
190 | |||
191 | |||
192 | ------ | ||
193 | |||
194 | 이 문서의 초안을 검토해주고 코멘트 해준 Randy Dunlap, Andrew Morton, David Brownell, | ||
195 | Hanna Linder, Robert Love, 그리고 Nishanth Aravamudan에게 감사한다. | ||
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index ca86a885ad8f..bf3256e04027 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt | |||
@@ -1,289 +1,386 @@ | |||
1 | The kobject Infrastructure | 1 | Everything you never wanted to know about kobjects, ksets, and ktypes |
2 | 2 | ||
3 | Patrick Mochel <mochel@osdl.org> | 3 | Greg Kroah-Hartman <gregkh@suse.de> |
4 | 4 | ||
5 | Updated: 3 June 2003 | 5 | Based on an original article by Jon Corbet for lwn.net written October 1, |
6 | 2003 and located at http://lwn.net/Articles/51437/ | ||
6 | 7 | ||
8 | Last updated December 19, 2007 | ||
7 | 9 | ||
8 | Copyright (c) 2003 Patrick Mochel | ||
9 | Copyright (c) 2003 Open Source Development Labs | ||
10 | 10 | ||
11 | Part of the difficulty in understanding the driver model - and the kobject | ||
12 | abstraction upon which it is built - is that there is no obvious starting | ||
13 | place. Dealing with kobjects requires understanding a few different types, | ||
14 | all of which make reference to each other. In an attempt to make things | ||
15 | easier, we'll take a multi-pass approach, starting with vague terms and | ||
16 | adding detail as we go. To that end, here are some quick definitions of | ||
17 | some terms we will be working with. | ||
11 | 18 | ||
12 | 0. Introduction | 19 | - A kobject is an object of type struct kobject. Kobjects have a name |
20 | and a reference count. A kobject also has a parent pointer (allowing | ||
21 | objects to be arranged into hierarchies), a specific type, and, | ||
22 | usually, a representation in the sysfs virtual filesystem. | ||
13 | 23 | ||
14 | The kobject infrastructure performs basic object management that larger | 24 | Kobjects are generally not interesting on their own; instead, they are |
15 | data structures and subsystems can leverage, rather than reimplement | 25 | usually embedded within some other structure which contains the stuff |
16 | similar functionality. This functionality primarily concerns: | 26 | the code is really interested in. |
17 | 27 | ||
18 | - Object reference counting. | 28 | No structure should EVER have more than one kobject embedded within it. |
19 | - Maintaining lists (sets) of objects. | 29 | If it does, the reference counting for the object is sure to be messed |
20 | - Object set locking. | 30 | up and incorrect, and your code will be buggy. So do not do this. |
21 | - Userspace representation. | ||
22 | 31 | ||
23 | The infrastructure consists of a number of object types to support | 32 | - A ktype is the type of object that embeds a kobject. Every structure |
24 | this functionality. Their programming interfaces are described below | 33 | that embeds a kobject needs a corresponding ktype. The ktype controls |
25 | in detail, and briefly here: | 34 | what happens to the kobject when it is created and destroyed. |
26 | 35 | ||
27 | - kobjects a simple object. | 36 | - A kset is a group of kobjects. These kobjects can be of the same ktype |
28 | - kset a set of objects of a certain type. | 37 | or belong to different ktypes. The kset is the basic container type for |
29 | - ktype a set of helpers for objects of a common type. | 38 | collections of kobjects. Ksets contain their own kobjects, but you can |
39 | safely ignore that implementation detail as the kset core code handles | ||
40 | this kobject automatically. | ||
30 | 41 | ||
42 | When you see a sysfs directory full of other directories, generally each | ||
43 | of those directories corresponds to a kobject in the same kset. | ||
31 | 44 | ||
32 | The kobject infrastructure maintains a close relationship with the | 45 | We'll look at how to create and manipulate all of these types. A bottom-up |
33 | sysfs filesystem. Each kobject that is registered with the kobject | 46 | approach will be taken, so we'll go back to kobjects. |
34 | core receives a directory in sysfs. Attributes about the kobject can | ||
35 | then be exported. Please see Documentation/filesystems/sysfs.txt for | ||
36 | more information. | ||
37 | 47 | ||
38 | The kobject infrastructure provides a flexible programming interface, | ||
39 | and allows kobjects and ksets to be used without being registered | ||
40 | (i.e. with no sysfs representation). This is also described later. | ||
41 | 48 | ||
49 | Embedding kobjects | ||
42 | 50 | ||
43 | 1. kobjects | 51 | It is rare for kernel code to create a standalone kobject, with one major |
52 | exception explained below. Instead, kobjects are used to control access to | ||
53 | a larger, domain-specific object. To this end, kobjects will be found | ||
54 | embedded in other structures. If you are used to thinking of things in | ||
55 | object-oriented terms, kobjects can be seen as a top-level, abstract class | ||
56 | from which other classes are derived. A kobject implements a set of | ||
57 | capabilities which are not particularly useful by themselves, but which are | ||
58 | nice to have in other objects. The C language does not allow for the | ||
59 | direct expression of inheritance, so other techniques - such as structure | ||
60 | embedding - must be used. | ||
44 | 61 | ||
45 | 1.1 Description | 62 | So, for example, the UIO code has a structure that defines the memory |
63 | region associated with a uio device: | ||
46 | 64 | ||
65 | struct uio_mem { | ||
66 | struct kobject kobj; | ||
67 | unsigned long addr; | ||
68 | unsigned long size; | ||
69 | int memtype; | ||
70 | void __iomem *internal_addr; | ||
71 | }; | ||
47 | 72 | ||
48 | struct kobject is a simple data type that provides a foundation for | 73 | If you have a struct uio_mem structure, finding its embedded kobject is |
49 | more complex object types. It provides a set of basic fields that | 74 | just a matter of using the kobj member. Code that works with kobjects will |
50 | almost all complex data types share. kobjects are intended to be | 75 | often have the opposite problem, however: given a struct kobject pointer, |
51 | embedded in larger data structures and replace fields they duplicate. | 76 | what is the pointer to the containing structure? You must avoid tricks |
77 | (such as assuming that the kobject is at the beginning of the structure) | ||
78 | and, instead, use the container_of() macro, found in <linux/kernel.h>: | ||
52 | 79 | ||
53 | 1.2 Definition | 80 | container_of(pointer, type, member) |
54 | 81 | ||
55 | struct kobject { | 82 | where pointer is the pointer to the embedded kobject, type is the type of |
56 | const char * k_name; | 83 | the containing structure, and member is the name of the structure field to |
57 | struct kref kref; | 84 | which pointer points. The return value from container_of() is a pointer to |
58 | struct list_head entry; | 85 | the given type. So, for example, a pointer "kp" to a struct kobject |
59 | struct kobject * parent; | 86 | embedded within a struct uio_mem could be converted to a pointer to the |
60 | struct kset * kset; | 87 | containing uio_mem structure with: |
61 | struct kobj_type * ktype; | ||
62 | struct sysfs_dirent * sd; | ||
63 | wait_queue_head_t poll; | ||
64 | }; | ||
65 | 88 | ||
66 | void kobject_init(struct kobject *); | 89 | struct uio_mem *u_mem = container_of(kp, struct uio_mem, kobj); |
67 | int kobject_add(struct kobject *); | ||
68 | int kobject_register(struct kobject *); | ||
69 | 90 | ||
70 | void kobject_del(struct kobject *); | 91 | Programmers often define a simple macro for "back-casting" kobject pointers |
71 | void kobject_unregister(struct kobject *); | 92 | to the containing type. |
72 | 93 | ||
73 | struct kobject * kobject_get(struct kobject *); | ||
74 | void kobject_put(struct kobject *); | ||
75 | 94 | ||
95 | Initialization of kobjects | ||
76 | 96 | ||
77 | 1.3 kobject Programming Interface | 97 | Code which creates a kobject must, of course, initialize that object. Some |
98 | of the internal fields are setup with a (mandatory) call to kobject_init(): | ||
78 | 99 | ||
79 | kobjects may be dynamically added and removed from the kobject core | 100 | void kobject_init(struct kobject *kobj, struct kobj_type *ktype); |
80 | using kobject_register() and kobject_unregister(). Registration | ||
81 | includes inserting the kobject in the list of its dominant kset and | ||
82 | creating a directory for it in sysfs. | ||
83 | 101 | ||
84 | Alternatively, one may use a kobject without adding it to its kset's list | 102 | The ktype is required for a kobject to be created properly, as every kobject |
85 | or exporting it via sysfs, by simply calling kobject_init(). An | 103 | must have an associated kobj_type. After calling kobject_init(), to |
86 | initialized kobject may later be added to the object hierarchy by | 104 | register the kobject with sysfs, the function kobject_add() must be called: |
87 | calling kobject_add(). An initialized kobject may be used for | ||
88 | reference counting. | ||
89 | 105 | ||
90 | Note: calling kobject_init() then kobject_add() is functionally | 106 | int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...); |
91 | equivalent to calling kobject_register(). | ||
92 | 107 | ||
93 | When a kobject is unregistered, it is removed from its kset's list, | 108 | This sets up the parent of the kobject and the name for the kobject |
94 | removed from the sysfs filesystem, and its reference count is decremented. | 109 | properly. If the kobject is to be associated with a specific kset, |
95 | List and sysfs removal happen in kobject_del(), and may be called | 110 | kobj->kset must be assigned before calling kobject_add(). If a kset is |
96 | manually. kobject_put() decrements the reference count, and may also | 111 | associated with a kobject, then the parent for the kobject can be set to |
97 | be called manually. | 112 | NULL in the call to kobject_add() and then the kobject's parent will be the |
113 | kset itself. | ||
98 | 114 | ||
99 | A kobject's reference count may be incremented with kobject_get(), | 115 | As the name of the kobject is set when it is added to the kernel, the name |
100 | which returns a valid reference to a kobject; and decremented with | 116 | of the kobject should never be manipulated directly. If you must change |
101 | kobject_put(). An object's reference count may only be incremented if | 117 | the name of the kobject, call kobject_rename(): |
102 | it is already positive. | ||
103 | 118 | ||
104 | When a kobject's reference count reaches 0, the method struct | 119 | int kobject_rename(struct kobject *kobj, const char *new_name); |
105 | kobj_type::release() (which the kobject's kset points to) is called. | ||
106 | This allows any memory allocated for the object to be freed. | ||
107 | 120 | ||
121 | There is a function called kobject_set_name() but that is legacy cruft and | ||
122 | is being removed. If your code needs to call this function, it is | ||
123 | incorrect and needs to be fixed. | ||
108 | 124 | ||
109 | NOTE!!! | 125 | To properly access the name of the kobject, use the function |
126 | kobject_name(): | ||
110 | 127 | ||
111 | It is _imperative_ that you supply a destructor for dynamically | 128 | const char *kobject_name(const struct kobject * kobj); |
112 | allocated kobjects to free them if you are using kobject reference | ||
113 | counts. The reference count controls the lifetime of the object. | ||
114 | If it goes to 0, then it is assumed that the object will | ||
115 | be freed and cannot be used. | ||
116 | 129 | ||
117 | More importantly, you must free the object there, and not immediately | 130 | There is a helper function to both initialize and add the kobject to the |
118 | after an unregister call. If someone else is referencing the object | 131 | kernel at the same time, called supprisingly enough kobject_init_and_add(): |
119 | (e.g. through a sysfs file), they will obtain a reference to the | ||
120 | object, assume it's valid and operate on it. If the object is | ||
121 | unregistered and freed in the meantime, the operation will then | ||
122 | reference freed memory and go boom. | ||
123 | 132 | ||
124 | This can be prevented, in the simplest case, by defining a release | 133 | int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, |
125 | method and freeing the object from there only. Note that this will not | 134 | struct kobject *parent, const char *fmt, ...); |
126 | secure reference count/object management models that use a dual | ||
127 | reference count or do other wacky things with the reference count | ||
128 | (like the networking layer). | ||
129 | 135 | ||
136 | The arguments are the same as the individual kobject_init() and | ||
137 | kobject_add() functions described above. | ||
130 | 138 | ||
131 | 1.4 sysfs | ||
132 | 139 | ||
133 | Each kobject receives a directory in sysfs. This directory is created | 140 | Uevents |
134 | under the kobject's parent directory. | ||
135 | 141 | ||
136 | If a kobject does not have a parent when it is registered, its parent | 142 | After a kobject has been registered with the kobject core, you need to |
137 | becomes its dominant kset. | 143 | announce to the world that it has been created. This can be done with a |
144 | call to kobject_uevent(): | ||
138 | 145 | ||
139 | If a kobject does not have a parent nor a dominant kset, its directory | 146 | int kobject_uevent(struct kobject *kobj, enum kobject_action action); |
140 | is created at the top-level of the sysfs partition. | ||
141 | 147 | ||
148 | Use the KOBJ_ADD action for when the kobject is first added to the kernel. | ||
149 | This should be done only after any attributes or children of the kobject | ||
150 | have been initialized properly, as userspace will instantly start to look | ||
151 | for them when this call happens. | ||
142 | 152 | ||
153 | When the kobject is removed from the kernel (details on how to do that is | ||
154 | below), the uevent for KOBJ_REMOVE will be automatically created by the | ||
155 | kobject core, so the caller does not have to worry about doing that by | ||
156 | hand. | ||
143 | 157 | ||
144 | 2. ksets | ||
145 | 158 | ||
146 | 2.1 Description | 159 | Reference counts |
147 | 160 | ||
148 | A kset is a set of kobjects that are embedded in the same type. | 161 | One of the key functions of a kobject is to serve as a reference counter |
162 | for the object in which it is embedded. As long as references to the object | ||
163 | exist, the object (and the code which supports it) must continue to exist. | ||
164 | The low-level functions for manipulating a kobject's reference counts are: | ||
149 | 165 | ||
166 | struct kobject *kobject_get(struct kobject *kobj); | ||
167 | void kobject_put(struct kobject *kobj); | ||
150 | 168 | ||
151 | struct kset { | 169 | A successful call to kobject_get() will increment the kobject's reference |
152 | struct kobj_type * ktype; | 170 | counter and return the pointer to the kobject. |
153 | struct list_head list; | ||
154 | struct kobject kobj; | ||
155 | struct kset_uevent_ops * uevent_ops; | ||
156 | }; | ||
157 | 171 | ||
172 | When a reference is released, the call to kobject_put() will decrement the | ||
173 | reference count and, possibly, free the object. Note that kobject_init() | ||
174 | sets the reference count to one, so the code which sets up the kobject will | ||
175 | need to do a kobject_put() eventually to release that reference. | ||
158 | 176 | ||
159 | void kset_init(struct kset * k); | 177 | Because kobjects are dynamic, they must not be declared statically or on |
160 | int kset_add(struct kset * k); | 178 | the stack, but instead, always allocated dynamically. Future versions of |
161 | int kset_register(struct kset * k); | 179 | the kernel will contain a run-time check for kobjects that are created |
162 | void kset_unregister(struct kset * k); | 180 | statically and will warn the developer of this improper usage. |
163 | 181 | ||
164 | struct kset * kset_get(struct kset * k); | 182 | If all that you want to use a kobject for is to provide a reference counter |
165 | void kset_put(struct kset * k); | 183 | for your structure, please use the struct kref instead; a kobject would be |
184 | overkill. For more information on how to use struct kref, please see the | ||
185 | file Documentation/kref.txt in the Linux kernel source tree. | ||
166 | 186 | ||
167 | struct kobject * kset_find_obj(struct kset *, char *); | ||
168 | 187 | ||
188 | Creating "simple" kobjects | ||
169 | 189 | ||
170 | The type that the kobjects are embedded in is described by the ktype | 190 | Sometimes all that a developer wants is a way to create a simple directory |
171 | pointer. | 191 | in the sysfs hierarchy, and not have to mess with the whole complication of |
192 | ksets, show and store functions, and other details. This is the one | ||
193 | exception where a single kobject should be created. To create such an | ||
194 | entry, use the function: | ||
172 | 195 | ||
173 | A kset contains a kobject itself, meaning that it may be registered in | 196 | struct kobject *kobject_create_and_add(char *name, struct kobject *parent); |
174 | the kobject hierarchy and exported via sysfs. More importantly, the | ||
175 | kset may be embedded in a larger data type, and may be part of another | ||
176 | kset (of that object type). | ||
177 | 197 | ||
178 | For example, a block device is an object (struct gendisk) that is | 198 | This function will create a kobject and place it in sysfs in the location |
179 | contained in a set of block devices. It may also contain a set of | 199 | underneath the specified parent kobject. To create simple attributes |
180 | partitions (struct hd_struct) that have been found on the device. The | 200 | associated with this kobject, use: |
181 | following code snippet illustrates how to express this properly. | ||
182 | 201 | ||
183 | struct gendisk * disk; | 202 | int sysfs_create_file(struct kobject *kobj, struct attribute *attr); |
184 | ... | 203 | or |
185 | disk->kset.kobj.kset = &block_kset; | 204 | int sysfs_create_group(struct kobject *kobj, struct attribute_group *grp); |
186 | disk->kset.ktype = &partition_ktype; | ||
187 | kset_register(&disk->kset); | ||
188 | 205 | ||
189 | - The kset that the disk's embedded object belongs to is the | 206 | Both types of attributes used here, with a kobject that has been created |
190 | block_kset, and is pointed to by disk->kset.kobj.kset. | 207 | with the kobject_create_and_add(), can be of type kobj_attribute, so no |
208 | special custom attribute is needed to be created. | ||
191 | 209 | ||
192 | - The type of objects on the disk's _subordinate_ list are partitions, | 210 | See the example module, samples/kobject/kobject-example.c for an |
193 | and is set in disk->kset.ktype. | 211 | implementation of a simple kobject and attributes. |
194 | 212 | ||
195 | - The kset is then registered, which handles initializing and adding | ||
196 | the embedded kobject to the hierarchy. | ||
197 | 213 | ||
198 | 214 | ||
199 | 2.2 kset Programming Interface | 215 | ktypes and release methods |
200 | 216 | ||
201 | All kset functions, except kset_find_obj(), eventually forward the | 217 | One important thing still missing from the discussion is what happens to a |
202 | calls to their embedded kobjects after performing kset-specific | 218 | kobject when its reference count reaches zero. The code which created the |
203 | operations. ksets offer a similar programming model to kobjects: they | 219 | kobject generally does not know when that will happen; if it did, there |
204 | may be used after they are initialized, without registering them in | 220 | would be little point in using a kobject in the first place. Even |
205 | the hierarchy. | 221 | predictable object lifecycles become more complicated when sysfs is brought |
222 | in as other portions of the kernel can get a reference on any kobject that | ||
223 | is registered in the system. | ||
206 | 224 | ||
207 | kset_find_obj() may be used to locate a kobject with a particular | 225 | The end result is that a structure protected by a kobject cannot be freed |
208 | name. The kobject, if found, is returned. | 226 | before its reference count goes to zero. The reference count is not under |
227 | the direct control of the code which created the kobject. So that code must | ||
228 | be notified asynchronously whenever the last reference to one of its | ||
229 | kobjects goes away. | ||
209 | 230 | ||
210 | There are also some helper functions which names point to the formerly | 231 | Once you registered your kobject via kobject_add(), you must never use |
211 | existing "struct subsystem", whose functions have been taken over by | 232 | kfree() to free it directly. The only safe way is to use kobject_put(). It |
212 | ksets. | 233 | is good practice to always use kobject_put() after kobject_init() to avoid |
234 | errors creeping in. | ||
213 | 235 | ||
236 | This notification is done through a kobject's release() method. Usually | ||
237 | such a method has a form like: | ||
214 | 238 | ||
215 | decl_subsys(name,type,uevent_ops) | 239 | void my_object_release(struct kobject *kobj) |
240 | { | ||
241 | struct my_object *mine = container_of(kobj, struct my_object, kobj); | ||
216 | 242 | ||
217 | Declares a kset named '<name>_subsys' of type <type> with | 243 | /* Perform any additional cleanup on this object, then... */ |
218 | uevent_ops <uevent_ops>. For example, | 244 | kfree(mine); |
245 | } | ||
219 | 246 | ||
220 | decl_subsys(devices, &ktype_device, &device_uevent_ops); | 247 | One important point cannot be overstated: every kobject must have a |
248 | release() method, and the kobject must persist (in a consistent state) | ||
249 | until that method is called. If these constraints are not met, the code is | ||
250 | flawed. Note that the kernel will warn you if you forget to provide a | ||
251 | release() method. Do not try to get rid of this warning by providing an | ||
252 | "empty" release function; you will be mocked mercilessly by the kobject | ||
253 | maintainer if you attempt this. | ||
221 | 254 | ||
222 | is equivalent to doing: | 255 | Note, the name of the kobject is available in the release function, but it |
256 | must NOT be changed within this callback. Otherwise there will be a memory | ||
257 | leak in the kobject core, which makes people unhappy. | ||
223 | 258 | ||
224 | struct kset devices_subsys = { | 259 | Interestingly, the release() method is not stored in the kobject itself; |
225 | .ktype = &ktype_devices, | 260 | instead, it is associated with the ktype. So let us introduce struct |
226 | .uevent_ops = &device_uevent_ops, | 261 | kobj_type: |
227 | }; | 262 | |
228 | kobject_set_name(&devices_subsys, name); | 263 | struct kobj_type { |
264 | void (*release)(struct kobject *); | ||
265 | struct sysfs_ops *sysfs_ops; | ||
266 | struct attribute **default_attrs; | ||
267 | }; | ||
229 | 268 | ||
230 | The objects that are registered with a subsystem that use the | 269 | This structure is used to describe a particular type of kobject (or, more |
231 | subsystem's default list must have their kset ptr set properly. These | 270 | correctly, of containing object). Every kobject needs to have an associated |
232 | objects may have embedded kobjects or ksets. The | 271 | kobj_type structure; a pointer to that structure must be specified when you |
233 | following helper makes setting the kset easier: | 272 | call kobject_init() or kobject_init_and_add(). |
234 | 273 | ||
274 | The release field in struct kobj_type is, of course, a pointer to the | ||
275 | release() method for this type of kobject. The other two fields (sysfs_ops | ||
276 | and default_attrs) control how objects of this type are represented in | ||
277 | sysfs; they are beyond the scope of this document. | ||
235 | 278 | ||
236 | kobj_set_kset_s(obj,subsys) | 279 | The default_attrs pointer is a list of default attributes that will be |
280 | automatically created for any kobject that is registered with this ktype. | ||
237 | 281 | ||
238 | - Assumes that obj->kobj exists, and is a struct kobject. | ||
239 | - Sets the kset of that kobject to the kset <subsys>. | ||
240 | 282 | ||
241 | int subsystem_register(struct kset *s); | 283 | ksets |
242 | void subsystem_unregister(struct kset *s); | ||
243 | 284 | ||
244 | These are just wrappers around the respective kset_* functions. | 285 | A kset is merely a collection of kobjects that want to be associated with |
286 | each other. There is no restriction that they be of the same ktype, but be | ||
287 | very careful if they are not. | ||
245 | 288 | ||
246 | 2.3 sysfs | 289 | A kset serves these functions: |
247 | 290 | ||
248 | ksets are represented in sysfs when their embedded kobjects are | 291 | - It serves as a bag containing a group of objects. A kset can be used by |
249 | registered. They follow the same rules of parenting, with one | 292 | the kernel to track "all block devices" or "all PCI device drivers." |
250 | exception. If a kset does not have a parent, nor is its embedded | ||
251 | kobject part of another kset, the kset's parent becomes its dominant | ||
252 | subsystem. | ||
253 | 293 | ||
254 | If the kset does not have a parent, its directory is created at the | 294 | - A kset is also a subdirectory in sysfs, where the associated kobjects |
255 | sysfs root. This should only happen when the kset registered is | 295 | with the kset can show up. Every kset contains a kobject which can be |
256 | embedded in a subsystem itself. | 296 | set up to be the parent of other kobjects; the top-level directories of |
297 | the sysfs hierarchy are constructed in this way. | ||
257 | 298 | ||
299 | - Ksets can support the "hotplugging" of kobjects and influence how | ||
300 | uevent events are reported to user space. | ||
258 | 301 | ||
259 | 3. struct ktype | 302 | In object-oriented terms, "kset" is the top-level container class; ksets |
303 | contain their own kobject, but that kobject is managed by the kset code and | ||
304 | should not be manipulated by any other user. | ||
260 | 305 | ||
261 | 3.1. Description | 306 | A kset keeps its children in a standard kernel linked list. Kobjects point |
307 | back to their containing kset via their kset field. In almost all cases, | ||
308 | the kobjects belonging to a ket have that kset (or, strictly, its embedded | ||
309 | kobject) in their parent. | ||
262 | 310 | ||
263 | struct kobj_type { | 311 | As a kset contains a kobject within it, it should always be dynamically |
264 | void (*release)(struct kobject *); | 312 | created and never declared statically or on the stack. To create a new |
265 | struct sysfs_ops * sysfs_ops; | 313 | kset use: |
266 | struct attribute ** default_attrs; | 314 | struct kset *kset_create_and_add(const char *name, |
315 | struct kset_uevent_ops *u, | ||
316 | struct kobject *parent); | ||
317 | |||
318 | When you are finished with the kset, call: | ||
319 | void kset_unregister(struct kset *kset); | ||
320 | to destroy it. | ||
321 | |||
322 | An example of using a kset can be seen in the | ||
323 | samples/kobject/kset-example.c file in the kernel tree. | ||
324 | |||
325 | If a kset wishes to control the uevent operations of the kobjects | ||
326 | associated with it, it can use the struct kset_uevent_ops to handle it: | ||
327 | |||
328 | struct kset_uevent_ops { | ||
329 | int (*filter)(struct kset *kset, struct kobject *kobj); | ||
330 | const char *(*name)(struct kset *kset, struct kobject *kobj); | ||
331 | int (*uevent)(struct kset *kset, struct kobject *kobj, | ||
332 | struct kobj_uevent_env *env); | ||
267 | }; | 333 | }; |
268 | 334 | ||
269 | 335 | ||
270 | Object types require specific functions for converting between the | 336 | The filter function allows a kset to prevent a uevent from being emitted to |
271 | generic object and the more complex type. struct kobj_type provides | 337 | userspace for a specific kobject. If the function returns 0, the uevent |
272 | the object-specific fields, which include: | 338 | will not be emitted. |
339 | |||
340 | The name function will be called to override the default name of the kset | ||
341 | that the uevent sends to userspace. By default, the name will be the same | ||
342 | as the kset itself, but this function, if present, can override that name. | ||
343 | |||
344 | The uevent function will be called when the uevent is about to be sent to | ||
345 | userspace to allow more environment variables to be added to the uevent. | ||
346 | |||
347 | One might ask how, exactly, a kobject is added to a kset, given that no | ||
348 | functions which perform that function have been presented. The answer is | ||
349 | that this task is handled by kobject_add(). When a kobject is passed to | ||
350 | kobject_add(), its kset member should point to the kset to which the | ||
351 | kobject will belong. kobject_add() will handle the rest. | ||
352 | |||
353 | If the kobject belonging to a kset has no parent kobject set, it will be | ||
354 | added to the kset's directory. Not all members of a kset do necessarily | ||
355 | live in the kset directory. If an explicit parent kobject is assigned | ||
356 | before the kobject is added, the kobject is registered with the kset, but | ||
357 | added below the parent kobject. | ||
358 | |||
359 | |||
360 | Kobject removal | ||
273 | 361 | ||
274 | - release: Called when the kobject's reference count reaches 0. This | 362 | After a kobject has been registered with the kobject core successfully, it |
275 | should convert the object to the more complex type and free it. | 363 | must be cleaned up when the code is finished with it. To do that, call |
364 | kobject_put(). By doing this, the kobject core will automatically clean up | ||
365 | all of the memory allocated by this kobject. If a KOBJ_ADD uevent has been | ||
366 | sent for the object, a corresponding KOBJ_REMOVE uevent will be sent, and | ||
367 | any other sysfs housekeeping will be handled for the caller properly. | ||
276 | 368 | ||
277 | - sysfs_ops: Provides conversion functions for sysfs access. Please | 369 | If you need to do a two-stage delete of the kobject (say you are not |
278 | see the sysfs documentation for more information. | 370 | allowed to sleep when you need to destroy the object), then call |
371 | kobject_del() which will unregister the kobject from sysfs. This makes the | ||
372 | kobject "invisible", but it is not cleaned up, and the reference count of | ||
373 | the object is still the same. At a later time call kobject_put() to finish | ||
374 | the cleanup of the memory associated with the kobject. | ||
279 | 375 | ||
280 | - default_attrs: Default attributes to be exported via sysfs when the | 376 | kobject_del() can be used to drop the reference to the parent object, if |
281 | object is registered.Note that the last attribute has to be | 377 | circular references are constructed. It is valid in some cases, that a |
282 | initialized to NULL ! You can find a complete implementation | 378 | parent objects references a child. Circular references _must_ be broken |
283 | in block/genhd.c | 379 | with an explicit call to kobject_del(), so that a release functions will be |
380 | called, and the objects in the former circle release each other. | ||
284 | 381 | ||
285 | 382 | ||
286 | Instances of struct kobj_type are not registered; only referenced by | 383 | Example code to copy from |
287 | the kset. A kobj_type may be referenced by an arbitrary number of | ||
288 | ksets, as there may be disparate sets of identical objects. | ||
289 | 384 | ||
385 | For a more complete example of using ksets and kobjects properly, see the | ||
386 | sample/kobject/kset-example.c code. | ||
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index cb12ae175aa2..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). | |||
96 | The jprobe will work in either case, so long as the handler's | 96 | The jprobe will work in either case, so long as the handler's |
97 | prototype matches that of the probed function. | 97 | prototype matches that of the probed function. |
98 | 98 | ||
99 | 1.3 How Does a Return Probe Work? | 99 | 1.3 Return Probes |
100 | |||
101 | 1.3.1 How Does a Return Probe Work? | ||
100 | 102 | ||
101 | When you call register_kretprobe(), Kprobes establishes a kprobe at | 103 | When you call register_kretprobe(), Kprobes establishes a kprobe at |
102 | the entry to the function. When the probed function is called and this | 104 | the 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 | ||
108 | When the probed function executes its return instruction, control | 110 | When the probed function executes its return instruction, control |
109 | passes to the trampoline and that probe is hit. Kprobes' trampoline | 111 | passes to the trampoline and that probe is hit. Kprobes' trampoline |
110 | handler calls the user-specified handler associated with the kretprobe, | 112 | handler calls the user-specified return handler associated with the |
111 | then sets the saved instruction pointer to the saved return address, | 113 | kretprobe, then sets the saved instruction pointer to the saved return |
112 | and that's where execution resumes upon return from the trap. | 114 | address, and that's where execution resumes upon return from the trap. |
113 | 115 | ||
114 | While the probed function is executing, its return address is | 116 | While the probed function is executing, its return address is |
115 | stored in an object of type kretprobe_instance. Before calling | 117 | stored in an object of type kretprobe_instance. Before calling |
@@ -131,6 +133,30 @@ zero when the return probe is registered, and is incremented every | |||
131 | time the probed function is entered but there is no kretprobe_instance | 133 | time the probed function is entered but there is no kretprobe_instance |
132 | object available for establishing the return probe. | 134 | object available for establishing the return probe. |
133 | 135 | ||
136 | 1.3.2 Kretprobe entry-handler | ||
137 | |||
138 | Kretprobes also provides an optional user-specified handler which runs | ||
139 | on function entry. This handler is specified by setting the entry_handler | ||
140 | field of the kretprobe struct. Whenever the kprobe placed by kretprobe at the | ||
141 | function entry is hit, the user-defined entry_handler, if any, is invoked. | ||
142 | If the entry_handler returns 0 (success) then a corresponding return handler | ||
143 | is guaranteed to be called upon function return. If the entry_handler | ||
144 | returns a non-zero error then Kprobes leaves the return address as is, and | ||
145 | the kretprobe has no further effect for that particular function instance. | ||
146 | |||
147 | Multiple entry and return handler invocations are matched using the unique | ||
148 | kretprobe_instance object associated with them. Additionally, a user | ||
149 | may also specify per return-instance private data to be part of each | ||
150 | kretprobe_instance object. This is especially useful when sharing private | ||
151 | data between corresponding user entry and return handlers. The size of each | ||
152 | private data object can be specified at kretprobe registration time by | ||
153 | setting the data_size field of the kretprobe struct. This data can be | ||
154 | accessed through the data field of each kretprobe_instance object. | ||
155 | |||
156 | In case probed function is entered but there is no kretprobe_instance | ||
157 | object available, then in addition to incrementing the nmissed count, | ||
158 | the user entry_handler invocation is also skipped. | ||
159 | |||
134 | 2. Architectures Supported | 160 | 2. Architectures Supported |
135 | 161 | ||
136 | Kprobes, jprobes, and return probes are implemented on the following | 162 | Kprobes, jprobes, and return probes are implemented on the following |
@@ -141,6 +167,7 @@ architectures: | |||
141 | - ppc64 | 167 | - ppc64 |
142 | - ia64 (Does not support probes on instruction slot1.) | 168 | - ia64 (Does not support probes on instruction slot1.) |
143 | - sparc64 (Return probes not yet implemented.) | 169 | - sparc64 (Return probes not yet implemented.) |
170 | - arm | ||
144 | 171 | ||
145 | 3. Configuring Kprobes | 172 | 3. Configuring Kprobes |
146 | 173 | ||
@@ -273,6 +300,8 @@ of interest: | |||
273 | - ret_addr: the return address | 300 | - ret_addr: the return address |
274 | - rp: points to the corresponding kretprobe object | 301 | - rp: points to the corresponding kretprobe object |
275 | - 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. | ||
276 | 305 | ||
277 | The regs_return_value(regs) macro provides a simple abstraction to | 306 | The regs_return_value(regs) macro provides a simple abstraction to |
278 | extract the return value from the appropriate register as defined by | 307 | extract the return value from the appropriate register as defined by |
@@ -555,23 +584,52 @@ report failed calls to sys_open(). | |||
555 | #include <linux/kernel.h> | 584 | #include <linux/kernel.h> |
556 | #include <linux/module.h> | 585 | #include <linux/module.h> |
557 | #include <linux/kprobes.h> | 586 | #include <linux/kprobes.h> |
587 | #include <linux/ktime.h> | ||
588 | |||
589 | /* per-instance private data */ | ||
590 | struct my_data { | ||
591 | ktime_t entry_stamp; | ||
592 | }; | ||
558 | 593 | ||
559 | static const char *probed_func = "sys_open"; | 594 | static const char *probed_func = "sys_open"; |
560 | 595 | ||
561 | /* Return-probe handler: If the probed function fails, log the return value. */ | 596 | /* Timestamp function entry. */ |
562 | static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) | 597 | static 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. */ | ||
612 | static int return_handler(struct kretprobe_instance *ri, struct pt_regs *regs) | ||
563 | { | 613 | { |
564 | 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 | |||
565 | if (retval < 0) { | 619 | if (retval < 0) { |
566 | 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); | ||
567 | } | 624 | } |
568 | return 0; | 625 | return 0; |
569 | } | 626 | } |
570 | 627 | ||
571 | static struct kretprobe my_kretprobe = { | 628 | static struct kretprobe my_kretprobe = { |
572 | .handler = ret_handler, | 629 | .handler = return_handler, |
573 | /* Probe up to 20 instances concurrently. */ | 630 | .entry_handler = entry_handler, |
574 | .maxactive = 20 | 631 | .data_size = sizeof(struct my_data), |
632 | .maxactive = 20, /* probe up to 20 instances concurrently */ | ||
575 | }; | 633 | }; |
576 | 634 | ||
577 | static int __init kretprobe_init(void) | 635 | static int __init kretprobe_init(void) |
@@ -583,7 +641,7 @@ static int __init kretprobe_init(void) | |||
583 | printk("register_kretprobe failed, returned %d\n", ret); | 641 | printk("register_kretprobe failed, returned %d\n", ret); |
584 | return -1; | 642 | return -1; |
585 | } | 643 | } |
586 | printk("Planted return probe at %p\n", my_kretprobe.kp.addr); | 644 | printk("Kretprobe active on %s\n", my_kretprobe.kp.symbol_name); |
587 | return 0; | 645 | return 0; |
588 | } | 646 | } |
589 | 647 | ||
@@ -593,7 +651,7 @@ static void __exit kretprobe_exit(void) | |||
593 | printk("kretprobe unregistered\n"); | 651 | printk("kretprobe unregistered\n"); |
594 | /* nmissed > 0 suggests that maxactive was set too low. */ | 652 | /* nmissed > 0 suggests that maxactive was set too low. */ |
595 | printk("Missed probing %d instances of %s\n", | 653 | printk("Missed probing %d instances of %s\n", |
596 | my_kretprobe.nmissed, probed_func); | 654 | my_kretprobe.nmissed, probed_func); |
597 | } | 655 | } |
598 | 656 | ||
599 | module_init(kretprobe_init) | 657 | module_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 | |||
141 | instance, you have a list of items that are each kref-ed, and you wish | 141 | instance, you have a list of items that are each kref-ed, and you wish |
142 | to get the first one. You can't just pull the first item off the list | 142 | to get the first one. You can't just pull the first item off the list |
143 | and kref_get() it. That violates rule 3 because you are not already | 143 | and kref_get() it. That violates rule 3 because you are not already |
144 | holding a valid pointer. You must add locks or semaphores. For | 144 | holding a valid pointer. You must add a mutex (or some other lock). |
145 | instance: | 145 | For instance: |
146 | 146 | ||
147 | static DECLARE_MUTEX(sem); | 147 | static DEFINE_MUTEX(mutex); |
148 | static LIST_HEAD(q); | 148 | static LIST_HEAD(q); |
149 | struct my_data | 149 | struct my_data |
150 | { | 150 | { |
@@ -155,12 +155,12 @@ struct my_data | |||
155 | static struct my_data *get_entry() | 155 | static 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 | ||
175 | static void put_entry(struct my_data *entry) | 175 | static 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 | ||
182 | The kref_put() return value is useful if you do not want to hold the | 182 | The 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 | ||
192 | static void put_entry(struct my_data *entry) | 192 | static 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 | ||
203 | This is really more useful if you have to call other routines as part | 203 | This 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 42008395534d..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" |
@@ -79,6 +81,9 @@ static void *guest_base; | |||
79 | /* The maximum guest physical address allowed, and maximum possible. */ | 81 | /* The maximum guest physical address allowed, and maximum possible. */ |
80 | static unsigned long guest_limit, guest_max; | 82 | static unsigned long guest_limit, guest_max; |
81 | 83 | ||
84 | /* a per-cpu variable indicating whose vcpu is currently running */ | ||
85 | static unsigned int __thread cpu_id; | ||
86 | |||
82 | /* This is our list of devices. */ | 87 | /* This is our list of devices. */ |
83 | struct device_list | 88 | struct device_list |
84 | { | 89 | { |
@@ -96,13 +101,11 @@ struct device_list | |||
96 | /* The descriptor page for the devices. */ | 101 | /* The descriptor page for the devices. */ |
97 | u8 *descpage; | 102 | u8 *descpage; |
98 | 103 | ||
99 | /* The tail of the last descriptor. */ | ||
100 | unsigned int desc_used; | ||
101 | |||
102 | /* A single linked list of devices. */ | 104 | /* A single linked list of devices. */ |
103 | struct device *dev; | 105 | struct device *dev; |
104 | /* ... 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 |
105 | struct device **lastdev; | 107 | * configuration appending. */ |
108 | struct device *lastdev; | ||
106 | }; | 109 | }; |
107 | 110 | ||
108 | /* The list of Guest devices, based on command line arguments. */ | 111 | /* The list of Guest devices, based on command line arguments. */ |
@@ -153,6 +156,9 @@ struct virtqueue | |||
153 | void (*handle_output)(int fd, struct virtqueue *me); | 156 | void (*handle_output)(int fd, struct virtqueue *me); |
154 | }; | 157 | }; |
155 | 158 | ||
159 | /* Remember the arguments to the program so we can "reboot" */ | ||
160 | static char **main_args; | ||
161 | |||
156 | /* Since guest is UP and we don't run at the same time, we don't need barriers. | 162 | /* Since guest is UP and we don't run at the same time, we don't need barriers. |
157 | * But I include them in the code in case others copy it. */ | 163 | * But I include them in the code in case others copy it. */ |
158 | #define wmb() | 164 | #define wmb() |
@@ -185,7 +191,14 @@ static void *_convert(struct iovec *iov, size_t size, size_t align, | |||
185 | #define cpu_to_le64(v64) (v64) | 191 | #define cpu_to_le64(v64) (v64) |
186 | #define le16_to_cpu(v16) (v16) | 192 | #define le16_to_cpu(v16) (v16) |
187 | #define le32_to_cpu(v32) (v32) | 193 | #define le32_to_cpu(v32) (v32) |
188 | #define le64_to_cpu(v32) (v64) | 194 | #define le64_to_cpu(v64) (v64) |
195 | |||
196 | /* The device virtqueue descriptors are followed by feature bitmasks. */ | ||
197 | static u8 *get_feature_bits(struct device *dev) | ||
198 | { | ||
199 | return (u8 *)(dev->desc + 1) | ||
200 | + dev->desc->num_vq * sizeof(struct lguest_vqconfig); | ||
201 | } | ||
189 | 202 | ||
190 | /*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 |
191 | * where pointers run wild and free! Unfortunately, like most userspace | 204 | * where pointers run wild and free! Unfortunately, like most userspace |
@@ -554,7 +567,7 @@ static void wake_parent(int pipefd, int lguest_fd) | |||
554 | else | 567 | else |
555 | FD_CLR(-fd - 1, &devices.infds); | 568 | FD_CLR(-fd - 1, &devices.infds); |
556 | } else /* Send LHREQ_BREAK command. */ | 569 | } else /* Send LHREQ_BREAK command. */ |
557 | write(lguest_fd, args, sizeof(args)); | 570 | pwrite(lguest_fd, args, sizeof(args), cpu_id); |
558 | } | 571 | } |
559 | } | 572 | } |
560 | 573 | ||
@@ -908,21 +921,58 @@ static void enable_fd(int fd, struct virtqueue *vq) | |||
908 | write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); | 921 | write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); |
909 | } | 922 | } |
910 | 923 | ||
924 | /* Resetting a device is fairly easy. */ | ||
925 | static 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 | |||
911 | /* 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. */ |
912 | static void handle_output(int fd, unsigned long addr) | 946 | static void handle_output(int fd, unsigned long addr) |
913 | { | 947 | { |
914 | struct device *i; | 948 | struct device *i; |
915 | struct virtqueue *vq; | 949 | struct virtqueue *vq; |
916 | 950 | ||
917 | /* Check each virtqueue. */ | 951 | /* Check each device and virtqueue. */ |
918 | 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. */ | ||
919 | for (vq = i->vq; vq; vq = vq->next) { | 960 | for (vq = i->vq; vq; vq = vq->next) { |
920 | if (vq->config.pfn == addr/getpagesize() | 961 | if (vq->config.pfn != addr/getpagesize()) |
921 | && vq->handle_output) { | 962 | continue; |
922 | verbose("Output to %s\n", vq->dev->name); | 963 | |
923 | 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); | ||
924 | return; | 968 | return; |
925 | } | 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; | ||
926 | } | 976 | } |
927 | } | 977 | } |
928 | 978 | ||
@@ -980,54 +1030,44 @@ static void handle_input(int fd) | |||
980 | * | 1030 | * |
981 | * 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 |
982 | * 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 |
983 | * routines to allocate them. | 1033 | * routines to allocate and manage them. */ |
984 | * | ||
985 | * This routine allocates a new "struct lguest_device_desc" from descriptor | ||
986 | * table just above the Guest's normal memory. It returns a pointer to that | ||
987 | * descriptor. */ | ||
988 | static struct lguest_device_desc *new_dev_desc(u16 type) | ||
989 | { | ||
990 | struct lguest_device_desc *d; | ||
991 | |||
992 | /* We only have one page for all the descriptors. */ | ||
993 | if (devices.desc_used + sizeof(*d) > getpagesize()) | ||
994 | errx(1, "Too many devices"); | ||
995 | 1034 | ||
996 | /* We don't need to set config_len or status: page is 0 already. */ | 1035 | /* The layout of the device page is a "struct lguest_device_desc" followed by a |
997 | d = (void *)devices.descpage + devices.desc_used; | 1036 | * number of virtqueue descriptors, then two sets of feature bits, then an |
998 | d->type = type; | 1037 | * array of configuration bytes. This routine returns the configuration |
999 | devices.desc_used += sizeof(*d); | 1038 | * pointer. */ |
1000 | 1039 | static u8 *device_config(const struct device *dev) | |
1001 | return d; | 1040 | { |
1041 | return (void *)(dev->desc + 1) | ||
1042 | + dev->desc->num_vq * sizeof(struct lguest_vqconfig) | ||
1043 | + dev->desc->feature_len * 2; | ||
1002 | } | 1044 | } |
1003 | 1045 | ||
1004 | /* Each device descriptor is followed by some configuration information. | 1046 | /* This routine allocates a new "struct lguest_device_desc" from descriptor |
1005 | * 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 |
1006 | * | 1048 | * that descriptor. */ |
1007 | * This routine adds a new field to an existing device's descriptor. It only | 1049 | static struct lguest_device_desc *new_dev_desc(u16 type) |
1008 | * works for the last device, but that's OK because that's how we use it. */ | ||
1009 | static void add_desc_field(struct device *dev, u8 type, u8 len, const void *c) | ||
1010 | { | 1050 | { |
1011 | /* This is the last descriptor, right? */ | 1051 | struct lguest_device_desc d = { .type = type }; |
1012 | assert(devices.descpage + devices.desc_used | 1052 | void *p; |
1013 | == (u8 *)(dev->desc + 1) + dev->desc->config_len); | ||
1014 | 1053 | ||
1015 | /* We only have one page of device descriptions. */ | 1054 | /* Figure out where the next device config is, based on the last one. */ |
1016 | if (devices.desc_used + 2 + len > getpagesize()) | 1055 | if (devices.lastdev) |
1017 | errx(1, "Too many devices"); | 1056 | p = device_config(devices.lastdev) |
1057 | + devices.lastdev->desc->config_len; | ||
1058 | else | ||
1059 | p = devices.descpage; | ||
1018 | 1060 | ||
1019 | /* Copy in the new config header: type then length. */ | 1061 | /* We only have one page for all the descriptors. */ |
1020 | devices.descpage[devices.desc_used++] = type; | 1062 | if (p + sizeof(d) > (void *)devices.descpage + getpagesize()) |
1021 | devices.descpage[devices.desc_used++] = len; | 1063 | errx(1, "Too many devices"); |
1022 | memcpy(devices.descpage + devices.desc_used, c, len); | ||
1023 | devices.desc_used += len; | ||
1024 | 1064 | ||
1025 | /* Update the device descriptor length: two byte head then data. */ | 1065 | /* p might not be aligned, so we memcpy in. */ |
1026 | dev->desc->config_len += 2 + len; | 1066 | return memcpy(p, &d, sizeof(d)); |
1027 | } | 1067 | } |
1028 | 1068 | ||
1029 | /* 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 |
1030 | * the virtqueue is to have. */ | 1070 | * specify how many descriptors the virtqueue is to have. */ |
1031 | static void add_virtqueue(struct device *dev, unsigned int num_descs, | 1071 | static void add_virtqueue(struct device *dev, unsigned int num_descs, |
1032 | void (*handle_output)(int fd, struct virtqueue *me)) | 1072 | void (*handle_output)(int fd, struct virtqueue *me)) |
1033 | { | 1073 | { |
@@ -1040,6 +1080,11 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1040 | / getpagesize(); | 1080 | / getpagesize(); |
1041 | p = get_pages(pages); | 1081 | p = get_pages(pages); |
1042 | 1082 | ||
1083 | /* Initialize the virtqueue */ | ||
1084 | vq->next = NULL; | ||
1085 | vq->last_avail_idx = 0; | ||
1086 | vq->dev = dev; | ||
1087 | |||
1043 | /* Initialize the configuration. */ | 1088 | /* Initialize the configuration. */ |
1044 | vq->config.num = num_descs; | 1089 | vq->config.num = num_descs; |
1045 | vq->config.irq = devices.next_irq++; | 1090 | vq->config.irq = devices.next_irq++; |
@@ -1048,27 +1093,60 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1048 | /* Initialize the vring. */ | 1093 | /* Initialize the vring. */ |
1049 | vring_init(&vq->vring, num_descs, p, getpagesize()); | 1094 | vring_init(&vq->vring, num_descs, p, getpagesize()); |
1050 | 1095 | ||
1051 | /* Add the configuration information to this device's descriptor. */ | 1096 | /* Append virtqueue to this device's descriptor. We use |
1052 | add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE, | 1097 | * device_config() to get the end of the device's current virtqueues; |
1053 | 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)); | ||
1054 | 1105 | ||
1055 | /* 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 |
1056 | * second. */ | 1107 | * second. */ |
1057 | for (i = &dev->vq; *i; i = &(*i)->next); | 1108 | for (i = &dev->vq; *i; i = &(*i)->next); |
1058 | *i = vq; | 1109 | *i = vq; |
1059 | 1110 | ||
1060 | /* Link virtqueue back to device. */ | ||
1061 | vq->dev = dev; | ||
1062 | |||
1063 | /* Set the routine to call when the Guest does something to this | 1111 | /* Set the routine to call when the Guest does something to this |
1064 | * virtqueue. */ | 1112 | * virtqueue. */ |
1065 | vq->handle_output = handle_output; | 1113 | vq->handle_output = handle_output; |
1066 | 1114 | ||
1067 | /* 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 */ | ||
1068 | if (!handle_output) | 1117 | if (!handle_output) |
1069 | vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; | 1118 | vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; |
1070 | } | 1119 | } |
1071 | 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. */ | ||
1123 | static 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. */ | ||
1139 | static 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 | |||
1072 | /* 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 |
1073 | * calling new_dev_desc() to allocate the descriptor and device memory. */ | 1151 | * calling new_dev_desc() to allocate the descriptor and device memory. */ |
1074 | static struct device *new_device(const char *name, u16 type, int fd, | 1152 | static struct device *new_device(const char *name, u16 type, int fd, |
@@ -1076,14 +1154,6 @@ static struct device *new_device(const char *name, u16 type, int fd, | |||
1076 | { | 1154 | { |
1077 | struct device *dev = malloc(sizeof(*dev)); | 1155 | struct device *dev = malloc(sizeof(*dev)); |
1078 | 1156 | ||
1079 | /* Append to device list. Prepending to a single-linked list is | ||
1080 | * easier, but the user expects the devices to be arranged on the bus | ||
1081 | * in command-line order. The first network device on the command line | ||
1082 | * is eth0, the first block device /dev/vda, etc. */ | ||
1083 | *devices.lastdev = dev; | ||
1084 | dev->next = NULL; | ||
1085 | devices.lastdev = &dev->next; | ||
1086 | |||
1087 | /* Now we populate the fields one at a time. */ | 1157 | /* Now we populate the fields one at a time. */ |
1088 | dev->fd = fd; | 1158 | dev->fd = fd; |
1089 | /* 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 |
@@ -1093,6 +1163,18 @@ static struct device *new_device(const char *name, u16 type, int fd, | |||
1093 | dev->desc = new_dev_desc(type); | 1163 | dev->desc = new_dev_desc(type); |
1094 | dev->handle_input = handle_input; | 1164 | dev->handle_input = handle_input; |
1095 | dev->name = name; | 1165 | dev->name = name; |
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 | |||
1096 | return dev; | 1178 | return dev; |
1097 | } | 1179 | } |
1098 | 1180 | ||
@@ -1217,7 +1299,7 @@ static void setup_tun_net(const char *arg) | |||
1217 | int netfd, ipfd; | 1299 | int netfd, ipfd; |
1218 | u32 ip; | 1300 | u32 ip; |
1219 | const char *br_name = NULL; | 1301 | const char *br_name = NULL; |
1220 | u8 hwaddr[6]; | 1302 | struct virtio_net_config conf; |
1221 | 1303 | ||
1222 | /* 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 |
1223 | * 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 |
@@ -1256,12 +1338,13 @@ static void setup_tun_net(const char *arg) | |||
1256 | ip = str2ip(arg); | 1338 | ip = str2ip(arg); |
1257 | 1339 | ||
1258 | /* 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. */ |
1259 | configure_device(ipfd, ifr.ifr_name, ip, hwaddr); | 1341 | configure_device(ipfd, ifr.ifr_name, ip, conf.mac); |
1260 | 1342 | ||
1261 | /* Tell Guest what MAC address to use. */ | 1343 | /* Tell Guest what MAC address to use. */ |
1262 | 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); | ||
1263 | 1346 | ||
1264 | /* We don't seed the socket any more; setup is done. */ | 1347 | /* We don't need the socket any more; setup is done. */ |
1265 | close(ipfd); | 1348 | close(ipfd); |
1266 | 1349 | ||
1267 | verbose("device %u: tun net %u.%u.%u.%u\n", | 1350 | verbose("device %u: tun net %u.%u.%u.%u\n", |
@@ -1449,8 +1532,7 @@ static void setup_block_file(const char *filename) | |||
1449 | struct device *dev; | 1532 | struct device *dev; |
1450 | struct vblk_info *vblk; | 1533 | struct vblk_info *vblk; |
1451 | void *stack; | 1534 | void *stack; |
1452 | u64 cap; | 1535 | struct virtio_blk_config conf; |
1453 | unsigned int val; | ||
1454 | 1536 | ||
1455 | /* 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. */ |
1456 | pipe(p); | 1538 | pipe(p); |
@@ -1468,14 +1550,18 @@ static void setup_block_file(const char *filename) | |||
1468 | vblk->fd = open_or_die(filename, O_RDWR|O_LARGEFILE); | 1550 | vblk->fd = open_or_die(filename, O_RDWR|O_LARGEFILE); |
1469 | vblk->len = lseek64(vblk->fd, 0, SEEK_END); | 1551 | vblk->len = lseek64(vblk->fd, 0, SEEK_END); |
1470 | 1552 | ||
1553 | /* We support barriers. */ | ||
1554 | add_feature(dev, VIRTIO_BLK_F_BARRIER); | ||
1555 | |||
1471 | /* Tell Guest how many sectors this device has. */ | 1556 | /* Tell Guest how many sectors this device has. */ |
1472 | cap = cpu_to_le64(vblk->len / 512); | 1557 | conf.capacity = cpu_to_le64(vblk->len / 512); |
1473 | add_desc_field(dev, VIRTIO_CONFIG_BLK_F_CAPACITY, sizeof(cap), &cap); | ||
1474 | 1558 | ||
1475 | /* 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 |
1476 | * for the in and out elements. */ | 1560 | * for the in and out elements. */ |
1477 | val = cpu_to_le32(VIRTQUEUE_NUM - 2); | 1561 | add_feature(dev, VIRTIO_BLK_F_SEG_MAX); |
1478 | 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); | ||
1479 | 1565 | ||
1480 | /* 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. */ |
1481 | vblk->done_fd = p[1]; | 1567 | vblk->done_fd = p[1]; |
@@ -1486,7 +1572,9 @@ static void setup_block_file(const char *filename) | |||
1486 | 1572 | ||
1487 | /* Create stack for thread and run it */ | 1573 | /* Create stack for thread and run it */ |
1488 | stack = malloc(32768); | 1574 | stack = malloc(32768); |
1489 | if (clone(io_thread, stack + 32768, CLONE_VM, dev) == -1) | 1575 | /* SIGCHLD - We dont "wait" for our cloned thread, so prevent it from |
1576 | * becoming a zombie. */ | ||
1577 | if (clone(io_thread, stack + 32768, CLONE_VM | SIGCHLD, dev) == -1) | ||
1490 | err(1, "Creating clone"); | 1578 | err(1, "Creating clone"); |
1491 | 1579 | ||
1492 | /* We don't need to keep the I/O thread's end of the pipes open. */ | 1580 | /* We don't need to keep the I/O thread's end of the pipes open. */ |
@@ -1494,9 +1582,23 @@ static void setup_block_file(const char *filename) | |||
1494 | close(vblk->workpipe[0]); | 1582 | close(vblk->workpipe[0]); |
1495 | 1583 | ||
1496 | verbose("device %u: virtblock %llu sectors\n", | 1584 | verbose("device %u: virtblock %llu sectors\n", |
1497 | devices.device_num, cap); | 1585 | devices.device_num, le64_to_cpu(conf.capacity)); |
1586 | } | ||
1587 | /* That's the end of device setup. :*/ | ||
1588 | |||
1589 | /* Reboot */ | ||
1590 | static void __attribute__((noreturn)) restart_guest(void) | ||
1591 | { | ||
1592 | unsigned int i; | ||
1593 | |||
1594 | /* Closing pipes causes the waker thread and io_threads to die, and | ||
1595 | * closing /dev/lguest cleans up the Guest. Since we don't track all | ||
1596 | * open fds, we simply close everything beyond stderr. */ | ||
1597 | for (i = 3; i < FD_SETSIZE; i++) | ||
1598 | close(i); | ||
1599 | execv(main_args[0], main_args); | ||
1600 | err(1, "Could not exec %s", main_args[0]); | ||
1498 | } | 1601 | } |
1499 | /* That's the end of device setup. */ | ||
1500 | 1602 | ||
1501 | /*L:220 Finally we reach the core of the Launcher, which runs the Guest, serves | 1603 | /*L:220 Finally we reach the core of the Launcher, which runs the Guest, serves |
1502 | * its input and output, and finally, lays it to rest. */ | 1604 | * its input and output, and finally, lays it to rest. */ |
@@ -1508,7 +1610,8 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd) | |||
1508 | int readval; | 1610 | int readval; |
1509 | 1611 | ||
1510 | /* We read from the /dev/lguest device to run the Guest. */ | 1612 | /* We read from the /dev/lguest device to run the Guest. */ |
1511 | readval = read(lguest_fd, ¬ify_addr, sizeof(notify_addr)); | 1613 | readval = pread(lguest_fd, ¬ify_addr, |
1614 | sizeof(notify_addr), cpu_id); | ||
1512 | 1615 | ||
1513 | /* One unsigned long means the Guest did HCALL_NOTIFY */ | 1616 | /* One unsigned long means the Guest did HCALL_NOTIFY */ |
1514 | if (readval == sizeof(notify_addr)) { | 1617 | if (readval == sizeof(notify_addr)) { |
@@ -1518,16 +1621,23 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd) | |||
1518 | /* ENOENT means the Guest died. Reading tells us why. */ | 1621 | /* ENOENT means the Guest died. Reading tells us why. */ |
1519 | } else if (errno == ENOENT) { | 1622 | } else if (errno == ENOENT) { |
1520 | char reason[1024] = { 0 }; | 1623 | char reason[1024] = { 0 }; |
1521 | read(lguest_fd, reason, sizeof(reason)-1); | 1624 | pread(lguest_fd, reason, sizeof(reason)-1, cpu_id); |
1522 | errx(1, "%s", reason); | 1625 | errx(1, "%s", reason); |
1626 | /* ERESTART means that we need to reboot the guest */ | ||
1627 | } else if (errno == ERESTART) { | ||
1628 | restart_guest(); | ||
1523 | /* EAGAIN means the Waker wanted us to look at some input. | 1629 | /* EAGAIN means the Waker wanted us to look at some input. |
1524 | * Anything else means a bug or incompatible change. */ | 1630 | * Anything else means a bug or incompatible change. */ |
1525 | } else if (errno != EAGAIN) | 1631 | } else if (errno != EAGAIN) |
1526 | err(1, "Running guest failed"); | 1632 | err(1, "Running guest failed"); |
1527 | 1633 | ||
1634 | /* Only service input on thread for CPU 0. */ | ||
1635 | if (cpu_id != 0) | ||
1636 | continue; | ||
1637 | |||
1528 | /* Service input, then unset the BREAK to release the Waker. */ | 1638 | /* Service input, then unset the BREAK to release the Waker. */ |
1529 | handle_input(lguest_fd); | 1639 | handle_input(lguest_fd); |
1530 | if (write(lguest_fd, args, sizeof(args)) < 0) | 1640 | if (pwrite(lguest_fd, args, sizeof(args), cpu_id) < 0) |
1531 | err(1, "Resetting break"); | 1641 | err(1, "Resetting break"); |
1532 | } | 1642 | } |
1533 | } | 1643 | } |
@@ -1568,17 +1678,24 @@ int main(int argc, char *argv[]) | |||
1568 | /* If they specify an initrd file to load. */ | 1678 | /* If they specify an initrd file to load. */ |
1569 | const char *initrd_name = NULL; | 1679 | const char *initrd_name = NULL; |
1570 | 1680 | ||
1681 | /* Save the args: we "reboot" by execing ourselves again. */ | ||
1682 | main_args = argv; | ||
1683 | /* We don't "wait" for the children, so prevent them from becoming | ||
1684 | * zombies. */ | ||
1685 | signal(SIGCHLD, SIG_IGN); | ||
1686 | |||
1571 | /* First we initialize the device list. Since console and network | 1687 | /* First we initialize the device list. Since console and network |
1572 | * device receive input from a file descriptor, we keep an fdset | 1688 | * device receive input from a file descriptor, we keep an fdset |
1573 | * (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 |
1574 | * 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 |
1575 | * 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 |
1576 | * (1: remember that 0 is used by the timer). */ | 1692 | * the timer). */ |
1577 | FD_ZERO(&devices.infds); | 1693 | FD_ZERO(&devices.infds); |
1578 | devices.max_infd = -1; | 1694 | devices.max_infd = -1; |
1579 | devices.lastdev = &devices.dev; | 1695 | devices.lastdev = NULL; |
1580 | devices.next_irq = 1; | 1696 | devices.next_irq = 1; |
1581 | 1697 | ||
1698 | cpu_id = 0; | ||
1582 | /* We need to know how much memory so we can set up the device | 1699 | /* We need to know how much memory so we can set up the device |
1583 | * descriptor and memory pages for the devices as we parse the command | 1700 | * descriptor and memory pages for the devices as we parse the command |
1584 | * line. So we quickly look through the arguments to find the amount | 1701 | * line. So we quickly look through the arguments to find the amount |
diff --git a/Documentation/lguest/lguest.txt b/Documentation/lguest/lguest.txt index 7885ab2d5f53..722d4e7fbebe 100644 --- a/Documentation/lguest/lguest.txt +++ b/Documentation/lguest/lguest.txt | |||
@@ -109,10 +109,6 @@ Running Lguest: | |||
109 | See http://linux-net.osdl.org/index.php/Bridge for general information | 109 | See http://linux-net.osdl.org/index.php/Bridge for general information |
110 | on how to get bridging working. | 110 | on how to get bridging working. |
111 | 111 | ||
112 | - You can also create an inter-guest network using | ||
113 | "--sharenet=<filename>": any two guests using the same file are on | ||
114 | the same network. This file is created if it does not exist. | ||
115 | |||
116 | There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest | 112 | There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest |
117 | 113 | ||
118 | Good luck! | 114 | Good luck! |
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt index 1a45f11e645e..4269a1105b37 100644 --- a/Documentation/local_ops.txt +++ b/Documentation/local_ops.txt | |||
@@ -68,29 +68,6 @@ typedef struct { atomic_long_t a; } local_t; | |||
68 | variable can be read when reading some _other_ cpu's variables. | 68 | variable can be read when reading some _other_ cpu's variables. |
69 | 69 | ||
70 | 70 | ||
71 | * Rules to follow when using local atomic operations | ||
72 | |||
73 | - Variables touched by local ops must be per cpu variables. | ||
74 | - _Only_ the CPU owner of these variables must write to them. | ||
75 | - This CPU can use local ops from any context (process, irq, softirq, nmi, ...) | ||
76 | to update its local_t variables. | ||
77 | - Preemption (or interrupts) must be disabled when using local ops in | ||
78 | process context to make sure the process won't be migrated to a | ||
79 | different CPU between getting the per-cpu variable and doing the | ||
80 | actual local op. | ||
81 | - When using local ops in interrupt context, no special care must be | ||
82 | taken on a mainline kernel, since they will run on the local CPU with | ||
83 | preemption already disabled. I suggest, however, to explicitly | ||
84 | disable preemption anyway to make sure it will still work correctly on | ||
85 | -rt kernels. | ||
86 | - Reading the local cpu variable will provide the current copy of the | ||
87 | variable. | ||
88 | - Reads of these variables can be done from any CPU, because updates to | ||
89 | "long", aligned, variables are always atomic. Since no memory | ||
90 | synchronization is done by the writer CPU, an outdated copy of the | ||
91 | variable can be read when reading some _other_ cpu's variables. | ||
92 | |||
93 | |||
94 | * How to use local atomic operations | 71 | * How to use local atomic operations |
95 | 72 | ||
96 | #include <linux/percpu.h> | 73 | #include <linux/percpu.h> |
diff --git a/Documentation/m68k/kernel-options.txt b/Documentation/m68k/kernel-options.txt index 248589e8bcf5..c93bed66e25d 100644 --- a/Documentation/m68k/kernel-options.txt +++ b/Documentation/m68k/kernel-options.txt | |||
@@ -867,66 +867,6 @@ controller and should be autodetected by the driver. An example is the | |||
867 | 24 bit region which is specified by a mask of 0x00fffffe. | 867 | 24 bit region which is specified by a mask of 0x00fffffe. |
868 | 868 | ||
869 | 869 | ||
870 | 5.5) 53c7xx= | ||
871 | ------------ | ||
872 | |||
873 | Syntax: 53c7xx=<sub-options...> | ||
874 | |||
875 | These options affect the A4000T, A4091, WarpEngine, Blizzard 603e+, | ||
876 | and GForce 040/060 SCSI controllers on the Amiga, as well as the | ||
877 | builtin MVME 16x SCSI controller. | ||
878 | |||
879 | The <sub-options> is a comma-separated list of the sub-options listed | ||
880 | below. | ||
881 | |||
882 | 5.5.1) nosync | ||
883 | ------------- | ||
884 | |||
885 | Syntax: nosync:0 | ||
886 | |||
887 | Disables sync negotiation for all devices. Any value after the | ||
888 | colon is acceptable (and has the same effect). | ||
889 | |||
890 | 5.5.2) noasync | ||
891 | -------------- | ||
892 | |||
893 | [OBSOLETE, REMOVED] | ||
894 | |||
895 | 5.5.3) nodisconnect | ||
896 | ------------------- | ||
897 | |||
898 | Syntax: nodisconnect:0 | ||
899 | |||
900 | Disables SCSI disconnects. Any value after the colon is acceptable | ||
901 | (and has the same effect). | ||
902 | |||
903 | 5.5.4) validids | ||
904 | --------------- | ||
905 | |||
906 | Syntax: validids:0xNN | ||
907 | |||
908 | Specify which SCSI ids the driver should pay attention to. This is | ||
909 | a bitmask (i.e. to only pay attention to ID#4, you'd use 0x10). | ||
910 | Default is 0x7f (devices 0-6). | ||
911 | |||
912 | 5.5.5) opthi | ||
913 | 5.5.6) optlo | ||
914 | ------------ | ||
915 | |||
916 | Syntax: opthi:M,optlo:N | ||
917 | |||
918 | Specify options for "hostdata->options". The acceptable definitions | ||
919 | are listed in drivers/scsi/53c7xx.h; the 32 high bits should be in | ||
920 | opthi and the 32 low bits in optlo. They must be specified in the | ||
921 | order opthi=M,optlo=N. | ||
922 | |||
923 | 5.5.7) next | ||
924 | ----------- | ||
925 | |||
926 | No argument. Used to separate blocks of keywords when there's more | ||
927 | than one 53c7xx host adapter in the system. | ||
928 | |||
929 | |||
930 | /* Local Variables: */ | 870 | /* Local Variables: */ |
931 | /* mode: text */ | 871 | /* mode: text */ |
932 | /* End: */ | 872 | /* End: */ |
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/mips/00-INDEX b/Documentation/mips/00-INDEX index 3f13bf8043d2..8ae9cffc2262 100644 --- a/Documentation/mips/00-INDEX +++ b/Documentation/mips/00-INDEX | |||
@@ -2,5 +2,3 @@ | |||
2 | - this file. | 2 | - this file. |
3 | AU1xxx_IDE.README | 3 | AU1xxx_IDE.README |
4 | - README for MIPS AU1XXX IDE driver. | 4 | - README for MIPS AU1XXX IDE driver. |
5 | GT64120.README | ||
6 | - README for dir with info on MIPS boards using GT-64120 or GT-64120A. | ||
diff --git a/Documentation/mips/GT64120.README b/Documentation/mips/GT64120.README deleted file mode 100644 index 2d0eec91dc59..000000000000 --- a/Documentation/mips/GT64120.README +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | README for arch/mips/gt64120 directory and subdirectories | ||
2 | |||
3 | Jun Sun, jsun@mvista.com or jsun@junsun.net | ||
4 | 01/27, 2001 | ||
5 | |||
6 | MOTIVATION | ||
7 | ---------- | ||
8 | |||
9 | Many MIPS boards share the same system controller (or CPU companian chip), | ||
10 | such as GT-64120. It is highly desirable to let these boards share | ||
11 | the same controller code instead of duplicating them. | ||
12 | |||
13 | This directory is meant to hold all MIPS boards that use GT-64120 or GT-64120A. | ||
14 | |||
15 | |||
16 | HOW TO ADD A BOARD | ||
17 | ------------------ | ||
18 | |||
19 | . Create a subdirectory include/asm/gt64120/<board>. | ||
20 | |||
21 | . Create a file called gt64120_dep.h under that directory. | ||
22 | |||
23 | . Modify include/asm/gt64120/gt64120.h file to include the new gt64120_dep.h | ||
24 | based on config options. The board-dep section is at the end of | ||
25 | include/asm/gt64120/gt64120.h file. There you can find all required | ||
26 | definitions include/asm/gt64120/<board>/gt64120_dep.h file must supply. | ||
27 | |||
28 | . Create a subdirectory arch/mips/gt64120/<board> directory to hold | ||
29 | board specific routines. | ||
30 | |||
31 | . The GT-64120 common code is supplied under arch/mips/gt64120/common directory. | ||
32 | It includes: | ||
33 | 1) arch/mips/gt64120/pci.c - | ||
34 | common PCI routine, include the top-level pcibios_init() | ||
35 | 2) arch/mips/gt64120/irq.c - | ||
36 | common IRQ routine, include the top-level do_IRQ() | ||
37 | [This part really belongs to arch/mips/kernel. jsun] | ||
38 | 3) arch/mips/gt64120/gt_irq.c - | ||
39 | common IRQ routines for GT-64120 chip. Currently it only handles | ||
40 | the timer interrupt. | ||
41 | |||
42 | . Board-specific routines are supplied under arch/mips/gt64120/<board> dir. | ||
43 | 1) arch/mips/gt64120/<board>/pci.c - it provides bus fixup routine | ||
44 | 2) arch/mips/gt64120/<board>/irq.c - it provides enable/disable irqs | ||
45 | and board irq setup routine (irq_setup) | ||
46 | 3) arch/mips/gt64120/<board>/int-handler.S - | ||
47 | The first-level interrupt dispatching routine. | ||
48 | 4) a bunch of other "normal" stuff (setup, prom, dbg_io, reset, etc) | ||
49 | |||
50 | . Follow other "normal" procedure to modify configuration files, etc. | ||
51 | |||
52 | |||
53 | TO-DO LIST | ||
54 | ---------- | ||
55 | |||
56 | . Expand arch/mips/gt64120/gt_irq.c to handle all GT-64120 interrupts. | ||
57 | We probably need to introduce GT_IRQ_BASE in board-dep header file, | ||
58 | which is used the starting irq_nr for all GT irqs. | ||
59 | |||
60 | A function, gt64120_handle_irq(), will be added so that the first-level | ||
61 | irq dispatcher will call this function if it detects an interrupt | ||
62 | from GT-64120. | ||
63 | |||
64 | . More support for GT-64120 PCI features (2nd PCI bus, perhaps) | ||
65 | |||
diff --git a/Documentation/namespaces/compatibility-list.txt b/Documentation/namespaces/compatibility-list.txt new file mode 100644 index 000000000000..defc5589bfcd --- /dev/null +++ b/Documentation/namespaces/compatibility-list.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | Namespaces compatibility list | ||
2 | |||
3 | This document contains the information about the problems user | ||
4 | may have when creating tasks living in different namespaces. | ||
5 | |||
6 | Here's the summary. This matrix shows the known problems, that | ||
7 | occur when tasks share some namespace (the columns) while living | ||
8 | in different other namespaces (the rows): | ||
9 | |||
10 | UTS IPC VFS PID User Net | ||
11 | UTS X | ||
12 | IPC X 1 | ||
13 | VFS X | ||
14 | PID 1 1 X | ||
15 | User 2 2 X | ||
16 | Net X | ||
17 | |||
18 | 1. Both the IPC and the PID namespaces provide IDs to address | ||
19 | object inside the kernel. E.g. semaphore with IPCID or | ||
20 | process group with pid. | ||
21 | |||
22 | In both cases, tasks shouldn't try exposing this ID to some | ||
23 | other task living in a different namespace via a shared filesystem | ||
24 | or IPC shmem/message. The fact is that this ID is only valid | ||
25 | within the namespace it was obtained in and may refer to some | ||
26 | other object in another namespace. | ||
27 | |||
28 | 2. Intentionally, two equal user IDs in different user namespaces | ||
29 | should not be equal from the VFS point of view. In other | ||
30 | words, user 10 in one user namespace shouldn't have the same | ||
31 | access permissions to files, belonging to user 10 in another | ||
32 | namespace. | ||
33 | |||
34 | The same is true for the IPC namespaces being shared - two users | ||
35 | from different user namespaces should not access the same IPC objects | ||
36 | even having equal UIDs. | ||
37 | |||
38 | But currently this is not so. | ||
39 | |||
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX index 563e442f2d42..02e56d447a8f 100644 --- a/Documentation/networking/00-INDEX +++ b/Documentation/networking/00-INDEX | |||
@@ -24,6 +24,8 @@ baycom.txt | |||
24 | - info on the driver for Baycom style amateur radio modems | 24 | - info on the driver for Baycom style amateur radio modems |
25 | bridge.txt | 25 | bridge.txt |
26 | - where to get user space programs for ethernet bridging with Linux. | 26 | - where to get user space programs for ethernet bridging with Linux. |
27 | can.txt | ||
28 | - documentation on CAN protocol family. | ||
27 | cops.txt | 29 | cops.txt |
28 | - info on the COPS LocalTalk Linux driver | 30 | - info on the COPS LocalTalk Linux driver |
29 | cs89x0.txt | 31 | cs89x0.txt |
@@ -82,8 +84,6 @@ policy-routing.txt | |||
82 | - IP policy-based routing | 84 | - IP policy-based routing |
83 | ray_cs.txt | 85 | ray_cs.txt |
84 | - Raylink Wireless LAN card driver info. | 86 | - Raylink Wireless LAN card driver info. |
85 | shaper.txt | ||
86 | - info on the module that can shape/limit transmitted traffic. | ||
87 | sk98lin.txt | 87 | sk98lin.txt |
88 | - Marvell Yukon Chipset / SysKonnect SK-98xx compliant Gigabit | 88 | - Marvell Yukon Chipset / SysKonnect SK-98xx compliant Gigabit |
89 | Ethernet Adapter family driver info | 89 | Ethernet Adapter family driver info |
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 11340625e363..a0cda062bc33 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | Linux Ethernet Bonding Driver HOWTO | 2 | Linux Ethernet Bonding Driver HOWTO |
3 | 3 | ||
4 | Latest update: 24 April 2006 | 4 | Latest update: 12 November 2007 |
5 | 5 | ||
6 | Initial release : Thomas Davis <tadavis at lbl.gov> | 6 | Initial release : Thomas Davis <tadavis at lbl.gov> |
7 | Corrections, HA extensions : 2000/10/03-15 : | 7 | Corrections, HA extensions : 2000/10/03-15 : |
@@ -166,12 +166,17 @@ to use ifenslave. | |||
166 | 2. Bonding Driver Options | 166 | 2. Bonding Driver Options |
167 | ========================= | 167 | ========================= |
168 | 168 | ||
169 | Options for the bonding driver are supplied as parameters to | 169 | Options for the bonding driver are supplied as parameters to the |
170 | the bonding module at load time. They may be given as command line | 170 | bonding module at load time, or are specified via sysfs. |
171 | arguments to the insmod or modprobe command, but are usually specified | 171 | |
172 | in either the /etc/modules.conf or /etc/modprobe.conf configuration | 172 | Module options may be given as command line arguments to the |
173 | file, or in a distro-specific configuration file (some of which are | 173 | insmod or modprobe command, but are usually specified in either the |
174 | detailed in the next section). | 174 | /etc/modules.conf or /etc/modprobe.conf configuration file, or in a |
175 | distro-specific configuration file (some of which are detailed in the next | ||
176 | section). | ||
177 | |||
178 | Details on bonding support for sysfs is provided in the | ||
179 | "Configuring Bonding Manually via Sysfs" section, below. | ||
175 | 180 | ||
176 | The available bonding driver parameters are listed below. If a | 181 | The available bonding driver parameters are listed below. If a |
177 | parameter is not specified the default value is used. When initially | 182 | parameter is not specified the default value is used. When initially |
@@ -554,6 +559,30 @@ xmit_hash_policy | |||
554 | 559 | ||
555 | This algorithm is 802.3ad compliant. | 560 | This algorithm is 802.3ad compliant. |
556 | 561 | ||
562 | layer2+3 | ||
563 | |||
564 | This policy uses a combination of layer2 and layer3 | ||
565 | protocol information to generate the hash. | ||
566 | |||
567 | Uses XOR of hardware MAC addresses and IP addresses to | ||
568 | generate the hash. The formula is | ||
569 | |||
570 | (((source IP XOR dest IP) AND 0xffff) XOR | ||
571 | ( source MAC XOR destination MAC )) | ||
572 | modulo slave count | ||
573 | |||
574 | This algorithm will place all traffic to a particular | ||
575 | network peer on the same slave. For non-IP traffic, | ||
576 | the formula is the same as for the layer2 transmit | ||
577 | hash policy. | ||
578 | |||
579 | This policy is intended to provide a more balanced | ||
580 | distribution of traffic than layer2 alone, especially | ||
581 | in environments where a layer3 gateway device is | ||
582 | required to reach most destinations. | ||
583 | |||
584 | This algorithm is 802.3ad complient. | ||
585 | |||
557 | layer3+4 | 586 | layer3+4 |
558 | 587 | ||
559 | This policy uses upper layer protocol information, | 588 | This policy uses upper layer protocol information, |
@@ -589,8 +618,9 @@ xmit_hash_policy | |||
589 | or may not tolerate this noncompliance. | 618 | or may not tolerate this noncompliance. |
590 | 619 | ||
591 | The default value is layer2. This option was added in bonding | 620 | The default value is layer2. This option was added in bonding |
592 | version 2.6.3. In earlier versions of bonding, this parameter does | 621 | version 2.6.3. In earlier versions of bonding, this parameter |
593 | not exist, and the layer2 policy is the only policy. | 622 | does not exist, and the layer2 policy is the only policy. The |
623 | layer2+3 value was added for bonding version 3.2.2. | ||
594 | 624 | ||
595 | 625 | ||
596 | 3. Configuring Bonding Devices | 626 | 3. Configuring Bonding Devices |
@@ -787,11 +817,13 @@ the system /etc/modules.conf or /etc/modprobe.conf configuration file. | |||
787 | 3.2 Configuration with Initscripts Support | 817 | 3.2 Configuration with Initscripts Support |
788 | ------------------------------------------ | 818 | ------------------------------------------ |
789 | 819 | ||
790 | This section applies to distros using a version of initscripts | 820 | This section applies to distros using a recent version of |
791 | with bonding support, for example, Red Hat Linux 9 or Red Hat | 821 | initscripts with bonding support, for example, Red Hat Enterprise Linux |
792 | Enterprise Linux version 3 or 4. On these systems, the network | 822 | version 3 or later, Fedora, etc. On these systems, the network |
793 | initialization scripts have some knowledge of bonding, and can be | 823 | initialization scripts have knowledge of bonding, and can be configured to |
794 | configured to control bonding devices. | 824 | control bonding devices. Note that older versions of the initscripts |
825 | package have lower levels of support for bonding; this will be noted where | ||
826 | applicable. | ||
795 | 827 | ||
796 | These distros will not automatically load the network adapter | 828 | These distros will not automatically load the network adapter |
797 | driver unless the ethX device is configured with an IP address. | 829 | driver unless the ethX device is configured with an IP address. |
@@ -839,11 +871,31 @@ USERCTL=no | |||
839 | Be sure to change the networking specific lines (IPADDR, | 871 | Be sure to change the networking specific lines (IPADDR, |
840 | NETMASK, NETWORK and BROADCAST) to match your network configuration. | 872 | NETMASK, NETWORK and BROADCAST) to match your network configuration. |
841 | 873 | ||
842 | Finally, it is necessary to edit /etc/modules.conf (or | 874 | For later versions of initscripts, such as that found with Fedora |
843 | /etc/modprobe.conf, depending upon your distro) to load the bonding | 875 | 7 and Red Hat Enterprise Linux version 5 (or later), it is possible, and, |
844 | module with your desired options when the bond0 interface is brought | 876 | indeed, preferable, to specify the bonding options in the ifcfg-bond0 |
845 | up. The following lines in /etc/modules.conf (or modprobe.conf) will | 877 | file, e.g. a line of the format: |
846 | load the bonding module, and select its options: | 878 | |
879 | BONDING_OPTS="mode=active-backup arp_interval=60 arp_ip_target=+192.168.1.254" | ||
880 | |||
881 | will configure the bond with the specified options. The options | ||
882 | specified in BONDING_OPTS are identical to the bonding module parameters | ||
883 | except for the arp_ip_target field. Each target should be included as a | ||
884 | separate option and should be preceded by a '+' to indicate it should be | ||
885 | added to the list of queried targets, e.g., | ||
886 | |||
887 | arp_ip_target=+192.168.1.1 arp_ip_target=+192.168.1.2 | ||
888 | |||
889 | is the proper syntax to specify multiple targets. When specifying | ||
890 | options via BONDING_OPTS, it is not necessary to edit /etc/modules.conf or | ||
891 | /etc/modprobe.conf. | ||
892 | |||
893 | For older versions of initscripts that do not support | ||
894 | BONDING_OPTS, it is necessary to edit /etc/modules.conf (or | ||
895 | /etc/modprobe.conf, depending upon your distro) to load the bonding module | ||
896 | with your desired options when the bond0 interface is brought up. The | ||
897 | following lines in /etc/modules.conf (or modprobe.conf) will load the | ||
898 | bonding module, and select its options: | ||
847 | 899 | ||
848 | alias bond0 bonding | 900 | alias bond0 bonding |
849 | options bond0 mode=balance-alb miimon=100 | 901 | options bond0 mode=balance-alb miimon=100 |
@@ -858,9 +910,10 @@ up and running. | |||
858 | 3.2.1 Using DHCP with Initscripts | 910 | 3.2.1 Using DHCP with Initscripts |
859 | --------------------------------- | 911 | --------------------------------- |
860 | 912 | ||
861 | Recent versions of initscripts (the version supplied with | 913 | Recent versions of initscripts (the versions supplied with Fedora |
862 | Fedora Core 3 and Red Hat Enterprise Linux 4 is reported to work) do | 914 | Core 3 and Red Hat Enterprise Linux 4, or later versions, are reported to |
863 | have support for assigning IP information to bonding devices via DHCP. | 915 | work) have support for assigning IP information to bonding devices via |
916 | DHCP. | ||
864 | 917 | ||
865 | To configure bonding for DHCP, configure it as described | 918 | To configure bonding for DHCP, configure it as described |
866 | above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp" | 919 | above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp" |
@@ -870,18 +923,14 @@ is case sensitive. | |||
870 | 3.2.2 Configuring Multiple Bonds with Initscripts | 923 | 3.2.2 Configuring Multiple Bonds with Initscripts |
871 | ------------------------------------------------- | 924 | ------------------------------------------------- |
872 | 925 | ||
873 | At this writing, the initscripts package does not directly | 926 | Initscripts packages that are included with Fedora 7 and Red Hat |
874 | support loading the bonding driver multiple times, so the process for | 927 | Enterprise Linux 5 support multiple bonding interfaces by simply |
875 | doing so is the same as described in the "Configuring Multiple Bonds | 928 | specifying the appropriate BONDING_OPTS= in ifcfg-bondX where X is the |
876 | Manually" section, below. | 929 | number of the bond. This support requires sysfs support in the kernel, |
877 | 930 | and a bonding driver of version 3.0.0 or later. Other configurations may | |
878 | NOTE: It has been observed that some Red Hat supplied kernels | 931 | not support this method for specifying multiple bonding interfaces; for |
879 | are apparently unable to rename modules at load time (the "-o bond1" | 932 | those instances, see the "Configuring Multiple Bonds Manually" section, |
880 | part). Attempts to pass that option to modprobe will produce an | 933 | below. |
881 | "Operation not permitted" error. This has been reported on some | ||
882 | Fedora Core kernels, and has been seen on RHEL 4 as well. On kernels | ||
883 | exhibiting this problem, it will be impossible to configure multiple | ||
884 | bonds with differing parameters. | ||
885 | 934 | ||
886 | 3.3 Configuring Bonding Manually with Ifenslave | 935 | 3.3 Configuring Bonding Manually with Ifenslave |
887 | ----------------------------------------------- | 936 | ----------------------------------------------- |
@@ -952,15 +1001,58 @@ initialization scripts lack support for configuring multiple bonds. | |||
952 | options, you may wish to use the "max_bonds" module parameter, | 1001 | options, you may wish to use the "max_bonds" module parameter, |
953 | documented above. | 1002 | documented above. |
954 | 1003 | ||
955 | To create multiple bonding devices with differing options, it | 1004 | To create multiple bonding devices with differing options, it is |
956 | is necessary to use bonding parameters exported by sysfs, documented | 1005 | preferrable to use bonding parameters exported by sysfs, documented in the |
957 | in the section below. | 1006 | section below. |
1007 | |||
1008 | For versions of bonding without sysfs support, the only means to | ||
1009 | provide multiple instances of bonding with differing options is to load | ||
1010 | the bonding driver multiple times. Note that current versions of the | ||
1011 | sysconfig network initialization scripts handle this automatically; if | ||
1012 | your distro uses these scripts, no special action is needed. See the | ||
1013 | section Configuring Bonding Devices, above, if you're not sure about your | ||
1014 | network initialization scripts. | ||
1015 | |||
1016 | To load multiple instances of the module, it is necessary to | ||
1017 | specify a different name for each instance (the module loading system | ||
1018 | requires that every loaded module, even multiple instances of the same | ||
1019 | module, have a unique name). This is accomplished by supplying multiple | ||
1020 | sets of bonding options in /etc/modprobe.conf, for example: | ||
1021 | |||
1022 | alias bond0 bonding | ||
1023 | options bond0 -o bond0 mode=balance-rr miimon=100 | ||
1024 | |||
1025 | alias bond1 bonding | ||
1026 | options bond1 -o bond1 mode=balance-alb miimon=50 | ||
1027 | |||
1028 | will load the bonding module two times. The first instance is | ||
1029 | named "bond0" and creates the bond0 device in balance-rr mode with an | ||
1030 | miimon of 100. The second instance is named "bond1" and creates the | ||
1031 | bond1 device in balance-alb mode with an miimon of 50. | ||
1032 | |||
1033 | In some circumstances (typically with older distributions), | ||
1034 | the above does not work, and the second bonding instance never sees | ||
1035 | its options. In that case, the second options line can be substituted | ||
1036 | as follows: | ||
1037 | |||
1038 | install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \ | ||
1039 | mode=balance-alb miimon=50 | ||
958 | 1040 | ||
1041 | This may be repeated any number of times, specifying a new and | ||
1042 | unique name in place of bond1 for each subsequent instance. | ||
1043 | |||
1044 | It has been observed that some Red Hat supplied kernels are unable | ||
1045 | to rename modules at load time (the "-o bond1" part). Attempts to pass | ||
1046 | that option to modprobe will produce an "Operation not permitted" error. | ||
1047 | This has been reported on some Fedora Core kernels, and has been seen on | ||
1048 | RHEL 4 as well. On kernels exhibiting this problem, it will be impossible | ||
1049 | to configure multiple bonds with differing parameters (as they are older | ||
1050 | kernels, and also lack sysfs support). | ||
959 | 1051 | ||
960 | 3.4 Configuring Bonding Manually via Sysfs | 1052 | 3.4 Configuring Bonding Manually via Sysfs |
961 | ------------------------------------------ | 1053 | ------------------------------------------ |
962 | 1054 | ||
963 | Starting with version 3.0, Channel Bonding may be configured | 1055 | Starting with version 3.0.0, Channel Bonding may be configured |
964 | via the sysfs interface. This interface allows dynamic configuration | 1056 | via the sysfs interface. This interface allows dynamic configuration |
965 | of all bonds in the system without unloading the module. It also | 1057 | of all bonds in the system without unloading the module. It also |
966 | allows for adding and removing bonds at runtime. Ifenslave is no | 1058 | allows for adding and removing bonds at runtime. Ifenslave is no |
@@ -1005,9 +1097,6 @@ To enslave interface eth0 to bond bond0: | |||
1005 | To free slave eth0 from bond bond0: | 1097 | To free slave eth0 from bond bond0: |
1006 | # echo -eth0 > /sys/class/net/bond0/bonding/slaves | 1098 | # echo -eth0 > /sys/class/net/bond0/bonding/slaves |
1007 | 1099 | ||
1008 | NOTE: The bond must be up before slaves can be added. All | ||
1009 | slaves are freed when the interface is brought down. | ||
1010 | |||
1011 | When an interface is enslaved to a bond, symlinks between the | 1100 | When an interface is enslaved to a bond, symlinks between the |
1012 | two are created in the sysfs filesystem. In this case, you would get | 1101 | two are created in the sysfs filesystem. In this case, you would get |
1013 | /sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and | 1102 | /sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and |
@@ -1597,6 +1686,15 @@ one for each switch in the network). This will insure that, | |||
1597 | regardless of which switch is active, the ARP monitor has a suitable | 1686 | regardless of which switch is active, the ARP monitor has a suitable |
1598 | target to query. | 1687 | target to query. |
1599 | 1688 | ||
1689 | Note, also, that of late many switches now support a functionality | ||
1690 | generally referred to as "trunk failover." This is a feature of the | ||
1691 | switch that causes the link state of a particular switch port to be set | ||
1692 | down (or up) when the state of another switch port goes down (or up). | ||
1693 | It's purpose is to propogate link failures from logically "exterior" ports | ||
1694 | to the logically "interior" ports that bonding is able to monitor via | ||
1695 | miimon. Availability and configuration for trunk failover varies by | ||
1696 | switch, but this can be a viable alternative to the ARP monitor when using | ||
1697 | suitable switches. | ||
1600 | 1698 | ||
1601 | 12. Configuring Bonding for Maximum Throughput | 1699 | 12. Configuring Bonding for Maximum Throughput |
1602 | ============================================== | 1700 | ============================================== |
@@ -1684,7 +1782,7 @@ balance-rr: This mode is the only mode that will permit a single | |||
1684 | interfaces. It is therefore the only mode that will allow a | 1782 | interfaces. It is therefore the only mode that will allow a |
1685 | single TCP/IP stream to utilize more than one interface's | 1783 | single TCP/IP stream to utilize more than one interface's |
1686 | worth of throughput. This comes at a cost, however: the | 1784 | worth of throughput. This comes at a cost, however: the |
1687 | striping often results in peer systems receiving packets out | 1785 | striping generally results in peer systems receiving packets out |
1688 | of order, causing TCP/IP's congestion control system to kick | 1786 | of order, causing TCP/IP's congestion control system to kick |
1689 | in, often by retransmitting segments. | 1787 | in, often by retransmitting segments. |
1690 | 1788 | ||
@@ -1696,22 +1794,20 @@ balance-rr: This mode is the only mode that will permit a single | |||
1696 | interface's worth of throughput, even after adjusting | 1794 | interface's worth of throughput, even after adjusting |
1697 | tcp_reordering. | 1795 | tcp_reordering. |
1698 | 1796 | ||
1699 | Note that this out of order delivery occurs when both the | 1797 | Note that the fraction of packets that will be delivered out of |
1700 | sending and receiving systems are utilizing a multiple | 1798 | order is highly variable, and is unlikely to be zero. The level |
1701 | interface bond. Consider a configuration in which a | 1799 | of reordering depends upon a variety of factors, including the |
1702 | balance-rr bond feeds into a single higher capacity network | 1800 | networking interfaces, the switch, and the topology of the |
1703 | channel (e.g., multiple 100Mb/sec ethernets feeding a single | 1801 | configuration. Speaking in general terms, higher speed network |
1704 | gigabit ethernet via an etherchannel capable switch). In this | 1802 | cards produce more reordering (due to factors such as packet |
1705 | configuration, traffic sent from the multiple 100Mb devices to | 1803 | coalescing), and a "many to many" topology will reorder at a |
1706 | a destination connected to the gigabit device will not see | 1804 | higher rate than a "many slow to one fast" configuration. |
1707 | packets out of order. However, traffic sent from the gigabit | 1805 | |
1708 | device to the multiple 100Mb devices may or may not see | 1806 | Many switches do not support any modes that stripe traffic |
1709 | traffic out of order, depending upon the balance policy of the | 1807 | (instead choosing a port based upon IP or MAC level addresses); |
1710 | switch. Many switches do not support any modes that stripe | 1808 | for those devices, traffic for a particular connection flowing |
1711 | traffic (instead choosing a port based upon IP or MAC level | 1809 | through the switch to a balance-rr bond will not utilize greater |
1712 | addresses); for those devices, traffic flowing from the | 1810 | than one interface's worth of bandwidth. |
1713 | gigabit device to the many 100Mb devices will only utilize one | ||
1714 | interface. | ||
1715 | 1811 | ||
1716 | If you are utilizing protocols other than TCP/IP, UDP for | 1812 | If you are utilizing protocols other than TCP/IP, UDP for |
1717 | example, and your application can tolerate out of order | 1813 | example, and your application can tolerate out of order |
@@ -1911,6 +2007,10 @@ Failover may be delayed via the downdelay bonding module option. | |||
1911 | 13.2 Duplicated Incoming Packets | 2007 | 13.2 Duplicated Incoming Packets |
1912 | -------------------------------- | 2008 | -------------------------------- |
1913 | 2009 | ||
2010 | NOTE: Starting with version 3.0.2, the bonding driver has logic to | ||
2011 | suppress duplicate packets, which should largely eliminate this problem. | ||
2012 | The following description is kept for reference. | ||
2013 | |||
1914 | It is not uncommon to observe a short burst of duplicated | 2014 | It is not uncommon to observe a short burst of duplicated |
1915 | traffic when the bonding device is first used, or after it has been | 2015 | traffic when the bonding device is first used, or after it has been |
1916 | idle for some period of time. This is most easily observed by issuing | 2016 | idle for some period of time. This is most easily observed by issuing |
@@ -2071,6 +2171,9 @@ The new driver was designed to be SMP safe from the start. | |||
2071 | EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes, | 2171 | EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes, |
2072 | devices need not be of the same speed. | 2172 | devices need not be of the same speed. |
2073 | 2173 | ||
2174 | Starting with version 3.2.1, bonding also supports Infiniband | ||
2175 | slaves in active-backup mode. | ||
2176 | |||
2074 | 3. How many bonding devices can I have? | 2177 | 3. How many bonding devices can I have? |
2075 | 2178 | ||
2076 | There is no limit. | 2179 | There is no limit. |
@@ -2129,11 +2232,15 @@ switches currently available support 802.3ad. | |||
2129 | 2232 | ||
2130 | 8. Where does a bonding device get its MAC address from? | 2233 | 8. Where does a bonding device get its MAC address from? |
2131 | 2234 | ||
2132 | If not explicitly configured (with ifconfig or ip link), the | 2235 | When using slave devices that have fixed MAC addresses, or when |
2133 | MAC address of the bonding device is taken from its first slave | 2236 | the fail_over_mac option is enabled, the bonding device's MAC address is |
2134 | device. This MAC address is then passed to all following slaves and | 2237 | the MAC address of the active slave. |
2135 | remains persistent (even if the first slave is removed) until the | 2238 | |
2136 | bonding device is brought down or reconfigured. | 2239 | For other configurations, if not explicitly configured (with |
2240 | ifconfig or ip link), the MAC address of the bonding device is taken from | ||
2241 | its first slave device. This MAC address is then passed to all following | ||
2242 | slaves and remains persistent (even if the first slave is removed) until | ||
2243 | the bonding device is brought down or reconfigured. | ||
2137 | 2244 | ||
2138 | If you wish to change the MAC address, you can set it with | 2245 | If you wish to change the MAC address, you can set it with |
2139 | ifconfig or ip link: | 2246 | ifconfig or ip link: |
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt new file mode 100644 index 000000000000..f1b2de170929 --- /dev/null +++ b/Documentation/networking/can.txt | |||
@@ -0,0 +1,629 @@ | |||
1 | ============================================================================ | ||
2 | |||
3 | can.txt | ||
4 | |||
5 | Readme file for the Controller Area Network Protocol Family (aka Socket CAN) | ||
6 | |||
7 | This file contains | ||
8 | |||
9 | 1 Overview / What is Socket CAN | ||
10 | |||
11 | 2 Motivation / Why using the socket API | ||
12 | |||
13 | 3 Socket CAN concept | ||
14 | 3.1 receive lists | ||
15 | 3.2 local loopback of sent frames | ||
16 | 3.3 network security issues (capabilities) | ||
17 | 3.4 network problem notifications | ||
18 | |||
19 | 4 How to use Socket CAN | ||
20 | 4.1 RAW protocol sockets with can_filters (SOCK_RAW) | ||
21 | 4.1.1 RAW socket option CAN_RAW_FILTER | ||
22 | 4.1.2 RAW socket option CAN_RAW_ERR_FILTER | ||
23 | 4.1.3 RAW socket option CAN_RAW_LOOPBACK | ||
24 | 4.1.4 RAW socket option CAN_RAW_RECV_OWN_MSGS | ||
25 | 4.2 Broadcast Manager protocol sockets (SOCK_DGRAM) | ||
26 | 4.3 connected transport protocols (SOCK_SEQPACKET) | ||
27 | 4.4 unconnected transport protocols (SOCK_DGRAM) | ||
28 | |||
29 | 5 Socket CAN core module | ||
30 | 5.1 can.ko module params | ||
31 | 5.2 procfs content | ||
32 | 5.3 writing own CAN protocol modules | ||
33 | |||
34 | 6 CAN network drivers | ||
35 | 6.1 general settings | ||
36 | 6.2 local loopback of sent frames | ||
37 | 6.3 CAN controller hardware filters | ||
38 | 6.4 currently supported CAN hardware | ||
39 | 6.5 todo | ||
40 | |||
41 | 7 Credits | ||
42 | |||
43 | ============================================================================ | ||
44 | |||
45 | 1. Overview / What is Socket CAN | ||
46 | -------------------------------- | ||
47 | |||
48 | The socketcan package is an implementation of CAN protocols | ||
49 | (Controller Area Network) for Linux. CAN is a networking technology | ||
50 | which has widespread use in automation, embedded devices, and | ||
51 | automotive fields. While there have been other CAN implementations | ||
52 | for Linux based on character devices, Socket CAN uses the Berkeley | ||
53 | socket API, the Linux network stack and implements the CAN device | ||
54 | drivers as network interfaces. The CAN socket API has been designed | ||
55 | as similar as possible to the TCP/IP protocols to allow programmers, | ||
56 | familiar with network programming, to easily learn how to use CAN | ||
57 | sockets. | ||
58 | |||
59 | 2. Motivation / Why using the socket API | ||
60 | ---------------------------------------- | ||
61 | |||
62 | There have been CAN implementations for Linux before Socket CAN so the | ||
63 | question arises, why we have started another project. Most existing | ||
64 | implementations come as a device driver for some CAN hardware, they | ||
65 | are based on character devices and provide comparatively little | ||
66 | functionality. Usually, there is only a hardware-specific device | ||
67 | driver which provides a character device interface to send and | ||
68 | receive raw CAN frames, directly to/from the controller hardware. | ||
69 | Queueing of frames and higher-level transport protocols like ISO-TP | ||
70 | have to be implemented in user space applications. Also, most | ||
71 | character-device implementations support only one single process to | ||
72 | open the device at a time, similar to a serial interface. Exchanging | ||
73 | the CAN controller requires employment of another device driver and | ||
74 | often the need for adaption of large parts of the application to the | ||
75 | new driver's API. | ||
76 | |||
77 | Socket CAN was designed to overcome all of these limitations. A new | ||
78 | protocol family has been implemented which provides a socket interface | ||
79 | to user space applications and which builds upon the Linux network | ||
80 | layer, so to use all of the provided queueing functionality. A device | ||
81 | driver for CAN controller hardware registers itself with the Linux | ||
82 | network layer as a network device, so that CAN frames from the | ||
83 | controller can be passed up to the network layer and on to the CAN | ||
84 | protocol family module and also vice-versa. Also, the protocol family | ||
85 | module provides an API for transport protocol modules to register, so | ||
86 | that any number of transport protocols can be loaded or unloaded | ||
87 | dynamically. In fact, the can core module alone does not provide any | ||
88 | protocol and cannot be used without loading at least one additional | ||
89 | protocol module. Multiple sockets can be opened at the same time, | ||
90 | on different or the same protocol module and they can listen/send | ||
91 | frames on different or the same CAN IDs. Several sockets listening on | ||
92 | the same interface for frames with the same CAN ID are all passed the | ||
93 | same received matching CAN frames. An application wishing to | ||
94 | communicate using a specific transport protocol, e.g. ISO-TP, just | ||
95 | selects that protocol when opening the socket, and then can read and | ||
96 | write application data byte streams, without having to deal with | ||
97 | CAN-IDs, frames, etc. | ||
98 | |||
99 | Similar functionality visible from user-space could be provided by a | ||
100 | character device, too, but this would lead to a technically inelegant | ||
101 | solution for a couple of reasons: | ||
102 | |||
103 | * Intricate usage. Instead of passing a protocol argument to | ||
104 | socket(2) and using bind(2) to select a CAN interface and CAN ID, an | ||
105 | application would have to do all these operations using ioctl(2)s. | ||
106 | |||
107 | * Code duplication. A character device cannot make use of the Linux | ||
108 | network queueing code, so all that code would have to be duplicated | ||
109 | for CAN networking. | ||
110 | |||
111 | * Abstraction. In most existing character-device implementations, the | ||
112 | hardware-specific device driver for a CAN controller directly | ||
113 | provides the character device for the application to work with. | ||
114 | This is at least very unusual in Unix systems for both, char and | ||
115 | block devices. For example you don't have a character device for a | ||
116 | certain UART of a serial interface, a certain sound chip in your | ||
117 | computer, a SCSI or IDE controller providing access to your hard | ||
118 | disk or tape streamer device. Instead, you have abstraction layers | ||
119 | which provide a unified character or block device interface to the | ||
120 | application on the one hand, and a interface for hardware-specific | ||
121 | device drivers on the other hand. These abstractions are provided | ||
122 | by subsystems like the tty layer, the audio subsystem or the SCSI | ||
123 | and IDE subsystems for the devices mentioned above. | ||
124 | |||
125 | The easiest way to implement a CAN device driver is as a character | ||
126 | device without such a (complete) abstraction layer, as is done by most | ||
127 | existing drivers. The right way, however, would be to add such a | ||
128 | layer with all the functionality like registering for certain CAN | ||
129 | IDs, supporting several open file descriptors and (de)multiplexing | ||
130 | CAN frames between them, (sophisticated) queueing of CAN frames, and | ||
131 | providing an API for device drivers to register with. However, then | ||
132 | it would be no more difficult, or may be even easier, to use the | ||
133 | networking framework provided by the Linux kernel, and this is what | ||
134 | Socket CAN does. | ||
135 | |||
136 | The use of the networking framework of the Linux kernel is just the | ||
137 | natural and most appropriate way to implement CAN for Linux. | ||
138 | |||
139 | 3. Socket CAN concept | ||
140 | --------------------- | ||
141 | |||
142 | As described in chapter 2 it is the main goal of Socket CAN to | ||
143 | provide a socket interface to user space applications which builds | ||
144 | upon the Linux network layer. In contrast to the commonly known | ||
145 | TCP/IP and ethernet networking, the CAN bus is a broadcast-only(!) | ||
146 | medium that has no MAC-layer addressing like ethernet. The CAN-identifier | ||
147 | (can_id) is used for arbitration on the CAN-bus. Therefore the CAN-IDs | ||
148 | have to be chosen uniquely on the bus. When designing a CAN-ECU | ||
149 | network the CAN-IDs are mapped to be sent by a specific ECU. | ||
150 | For this reason a CAN-ID can be treated best as a kind of source address. | ||
151 | |||
152 | 3.1 receive lists | ||
153 | |||
154 | The network transparent access of multiple applications leads to the | ||
155 | problem that different applications may be interested in the same | ||
156 | CAN-IDs from the same CAN network interface. The Socket CAN core | ||
157 | module - which implements the protocol family CAN - provides several | ||
158 | high efficient receive lists for this reason. If e.g. a user space | ||
159 | application opens a CAN RAW socket, the raw protocol module itself | ||
160 | requests the (range of) CAN-IDs from the Socket CAN core that are | ||
161 | requested by the user. The subscription and unsubscription of | ||
162 | CAN-IDs can be done for specific CAN interfaces or for all(!) known | ||
163 | CAN interfaces with the can_rx_(un)register() functions provided to | ||
164 | CAN protocol modules by the SocketCAN core (see chapter 5). | ||
165 | To optimize the CPU usage at runtime the receive lists are split up | ||
166 | into several specific lists per device that match the requested | ||
167 | filter complexity for a given use-case. | ||
168 | |||
169 | 3.2 local loopback of sent frames | ||
170 | |||
171 | As known from other networking concepts the data exchanging | ||
172 | applications may run on the same or different nodes without any | ||
173 | change (except for the according addressing information): | ||
174 | |||
175 | ___ ___ ___ _______ ___ | ||
176 | | _ | | _ | | _ | | _ _ | | _ | | ||
177 | ||A|| ||B|| ||C|| ||A| |B|| ||C|| | ||
178 | |___| |___| |___| |_______| |___| | ||
179 | | | | | | | ||
180 | -----------------(1)- CAN bus -(2)--------------- | ||
181 | |||
182 | To ensure that application A receives the same information in the | ||
183 | example (2) as it would receive in example (1) there is need for | ||
184 | some kind of local loopback of the sent CAN frames on the appropriate | ||
185 | node. | ||
186 | |||
187 | The Linux network devices (by default) just can handle the | ||
188 | transmission and reception of media dependent frames. Due to the | ||
189 | arbritration on the CAN bus the transmission of a low prio CAN-ID | ||
190 | may be delayed by the reception of a high prio CAN frame. To | ||
191 | reflect the correct* traffic on the node the loopback of the sent | ||
192 | data has to be performed right after a successful transmission. If | ||
193 | the CAN network interface is not capable of performing the loopback for | ||
194 | some reason the SocketCAN core can do this task as a fallback solution. | ||
195 | See chapter 6.2 for details (recommended). | ||
196 | |||
197 | The loopback functionality is enabled by default to reflect standard | ||
198 | networking behaviour for CAN applications. Due to some requests from | ||
199 | the RT-SocketCAN group the loopback optionally may be disabled for each | ||
200 | separate socket. See sockopts from the CAN RAW sockets in chapter 4.1. | ||
201 | |||
202 | * = you really like to have this when you're running analyser tools | ||
203 | like 'candump' or 'cansniffer' on the (same) node. | ||
204 | |||
205 | 3.3 network security issues (capabilities) | ||
206 | |||
207 | The Controller Area Network is a local field bus transmitting only | ||
208 | broadcast messages without any routing and security concepts. | ||
209 | In the majority of cases the user application has to deal with | ||
210 | raw CAN frames. Therefore it might be reasonable NOT to restrict | ||
211 | the CAN access only to the user root, as known from other networks. | ||
212 | Since the currently implemented CAN_RAW and CAN_BCM sockets can only | ||
213 | send and receive frames to/from CAN interfaces it does not affect | ||
214 | security of others networks to allow all users to access the CAN. | ||
215 | To enable non-root users to access CAN_RAW and CAN_BCM protocol | ||
216 | sockets the Kconfig options CAN_RAW_USER and/or CAN_BCM_USER may be | ||
217 | selected at kernel compile time. | ||
218 | |||
219 | 3.4 network problem notifications | ||
220 | |||
221 | The use of the CAN bus may lead to several problems on the physical | ||
222 | and media access control layer. Detecting and logging of these lower | ||
223 | layer problems is a vital requirement for CAN users to identify | ||
224 | hardware issues on the physical transceiver layer as well as | ||
225 | arbitration problems and error frames caused by the different | ||
226 | ECUs. The occurrence of detected errors are important for diagnosis | ||
227 | and have to be logged together with the exact timestamp. For this | ||
228 | reason the CAN interface driver can generate so called Error Frames | ||
229 | that can optionally be passed to the user application in the same | ||
230 | way as other CAN frames. Whenever an error on the physical layer | ||
231 | or the MAC layer is detected (e.g. by the CAN controller) the driver | ||
232 | creates an appropriate error frame. Error frames can be requested by | ||
233 | the user application using the common CAN filter mechanisms. Inside | ||
234 | this filter definition the (interested) type of errors may be | ||
235 | selected. The reception of error frames is disabled by default. | ||
236 | |||
237 | 4. How to use Socket CAN | ||
238 | ------------------------ | ||
239 | |||
240 | Like TCP/IP, you first need to open a socket for communicating over a | ||
241 | CAN network. Since Socket CAN implements a new protocol family, you | ||
242 | need to pass PF_CAN as the first argument to the socket(2) system | ||
243 | call. Currently, there are two CAN protocols to choose from, the raw | ||
244 | socket protocol and the broadcast manager (BCM). So to open a socket, | ||
245 | you would write | ||
246 | |||
247 | s = socket(PF_CAN, SOCK_RAW, CAN_RAW); | ||
248 | |||
249 | and | ||
250 | |||
251 | s = socket(PF_CAN, SOCK_DGRAM, CAN_BCM); | ||
252 | |||
253 | respectively. After the successful creation of the socket, you would | ||
254 | normally use the bind(2) system call to bind the socket to a CAN | ||
255 | interface (which is different from TCP/IP due to different addressing | ||
256 | - see chapter 3). After binding (CAN_RAW) or connecting (CAN_BCM) | ||
257 | the socket, you can read(2) and write(2) from/to the socket or use | ||
258 | send(2), sendto(2), sendmsg(2) and the recv* counterpart operations | ||
259 | on the socket as usual. There are also CAN specific socket options | ||
260 | described below. | ||
261 | |||
262 | The basic CAN frame structure and the sockaddr structure are defined | ||
263 | in include/linux/can.h: | ||
264 | |||
265 | struct can_frame { | ||
266 | canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ | ||
267 | __u8 can_dlc; /* data length code: 0 .. 8 */ | ||
268 | __u8 data[8] __attribute__((aligned(8))); | ||
269 | }; | ||
270 | |||
271 | The alignment of the (linear) payload data[] to a 64bit boundary | ||
272 | allows the user to define own structs and unions to easily access the | ||
273 | CAN payload. There is no given byteorder on the CAN bus by | ||
274 | default. A read(2) system call on a CAN_RAW socket transfers a | ||
275 | struct can_frame to the user space. | ||
276 | |||
277 | The sockaddr_can structure has an interface index like the | ||
278 | PF_PACKET socket, that also binds to a specific interface: | ||
279 | |||
280 | struct sockaddr_can { | ||
281 | sa_family_t can_family; | ||
282 | int can_ifindex; | ||
283 | union { | ||
284 | struct { canid_t rx_id, tx_id; } tp16; | ||
285 | struct { canid_t rx_id, tx_id; } tp20; | ||
286 | struct { canid_t rx_id, tx_id; } mcnet; | ||
287 | struct { canid_t rx_id, tx_id; } isotp; | ||
288 | } can_addr; | ||
289 | }; | ||
290 | |||
291 | To determine the interface index an appropriate ioctl() has to | ||
292 | be used (example for CAN_RAW sockets without error checking): | ||
293 | |||
294 | int s; | ||
295 | struct sockaddr_can addr; | ||
296 | struct ifreq ifr; | ||
297 | |||
298 | s = socket(PF_CAN, SOCK_RAW, CAN_RAW); | ||
299 | |||
300 | strcpy(ifr.ifr_name, "can0" ); | ||
301 | ioctl(s, SIOCGIFINDEX, &ifr); | ||
302 | |||
303 | addr.can_family = AF_CAN; | ||
304 | addr.can_ifindex = ifr.ifr_ifindex; | ||
305 | |||
306 | bind(s, (struct sockaddr *)&addr, sizeof(addr)); | ||
307 | |||
308 | (..) | ||
309 | |||
310 | To bind a socket to all(!) CAN interfaces the interface index must | ||
311 | be 0 (zero). In this case the socket receives CAN frames from every | ||
312 | enabled CAN interface. To determine the originating CAN interface | ||
313 | the system call recvfrom(2) may be used instead of read(2). To send | ||
314 | on a socket that is bound to 'any' interface sendto(2) is needed to | ||
315 | specify the outgoing interface. | ||
316 | |||
317 | Reading CAN frames from a bound CAN_RAW socket (see above) consists | ||
318 | of reading a struct can_frame: | ||
319 | |||
320 | struct can_frame frame; | ||
321 | |||
322 | nbytes = read(s, &frame, sizeof(struct can_frame)); | ||
323 | |||
324 | if (nbytes < 0) { | ||
325 | perror("can raw socket read"); | ||
326 | return 1; | ||
327 | } | ||
328 | |||
329 | /* paraniod check ... */ | ||
330 | if (nbytes < sizeof(struct can_frame)) { | ||
331 | fprintf(stderr, "read: incomplete CAN frame\n"); | ||
332 | return 1; | ||
333 | } | ||
334 | |||
335 | /* do something with the received CAN frame */ | ||
336 | |||
337 | Writing CAN frames can be done similarly, with the write(2) system call: | ||
338 | |||
339 | nbytes = write(s, &frame, sizeof(struct can_frame)); | ||
340 | |||
341 | When the CAN interface is bound to 'any' existing CAN interface | ||
342 | (addr.can_ifindex = 0) it is recommended to use recvfrom(2) if the | ||
343 | information about the originating CAN interface is needed: | ||
344 | |||
345 | struct sockaddr_can addr; | ||
346 | struct ifreq ifr; | ||
347 | socklen_t len = sizeof(addr); | ||
348 | struct can_frame frame; | ||
349 | |||
350 | nbytes = recvfrom(s, &frame, sizeof(struct can_frame), | ||
351 | 0, (struct sockaddr*)&addr, &len); | ||
352 | |||
353 | /* get interface name of the received CAN frame */ | ||
354 | ifr.ifr_ifindex = addr.can_ifindex; | ||
355 | ioctl(s, SIOCGIFNAME, &ifr); | ||
356 | printf("Received a CAN frame from interface %s", ifr.ifr_name); | ||
357 | |||
358 | To write CAN frames on sockets bound to 'any' CAN interface the | ||
359 | outgoing interface has to be defined certainly. | ||
360 | |||
361 | strcpy(ifr.ifr_name, "can0"); | ||
362 | ioctl(s, SIOCGIFINDEX, &ifr); | ||
363 | addr.can_ifindex = ifr.ifr_ifindex; | ||
364 | addr.can_family = AF_CAN; | ||
365 | |||
366 | nbytes = sendto(s, &frame, sizeof(struct can_frame), | ||
367 | 0, (struct sockaddr*)&addr, sizeof(addr)); | ||
368 | |||
369 | 4.1 RAW protocol sockets with can_filters (SOCK_RAW) | ||
370 | |||
371 | Using CAN_RAW sockets is extensively comparable to the commonly | ||
372 | known access to CAN character devices. To meet the new possibilities | ||
373 | provided by the multi user SocketCAN approach, some reasonable | ||
374 | defaults are set at RAW socket binding time: | ||
375 | |||
376 | - The filters are set to exactly one filter receiving everything | ||
377 | - The socket only receives valid data frames (=> no error frames) | ||
378 | - The loopback of sent CAN frames is enabled (see chapter 3.2) | ||
379 | - The socket does not receive its own sent frames (in loopback mode) | ||
380 | |||
381 | These default settings may be changed before or after binding the socket. | ||
382 | To use the referenced definitions of the socket options for CAN_RAW | ||
383 | sockets, include <linux/can/raw.h>. | ||
384 | |||
385 | 4.1.1 RAW socket option CAN_RAW_FILTER | ||
386 | |||
387 | The reception of CAN frames using CAN_RAW sockets can be controlled | ||
388 | by defining 0 .. n filters with the CAN_RAW_FILTER socket option. | ||
389 | |||
390 | The CAN filter structure is defined in include/linux/can.h: | ||
391 | |||
392 | struct can_filter { | ||
393 | canid_t can_id; | ||
394 | canid_t can_mask; | ||
395 | }; | ||
396 | |||
397 | A filter matches, when | ||
398 | |||
399 | <received_can_id> & mask == can_id & mask | ||
400 | |||
401 | which is analogous to known CAN controllers hardware filter semantics. | ||
402 | The filter can be inverted in this semantic, when the CAN_INV_FILTER | ||
403 | bit is set in can_id element of the can_filter structure. In | ||
404 | contrast to CAN controller hardware filters the user may set 0 .. n | ||
405 | receive filters for each open socket separately: | ||
406 | |||
407 | struct can_filter rfilter[2]; | ||
408 | |||
409 | rfilter[0].can_id = 0x123; | ||
410 | rfilter[0].can_mask = CAN_SFF_MASK; | ||
411 | rfilter[1].can_id = 0x200; | ||
412 | rfilter[1].can_mask = 0x700; | ||
413 | |||
414 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter, sizeof(rfilter)); | ||
415 | |||
416 | To disable the reception of CAN frames on the selected CAN_RAW socket: | ||
417 | |||
418 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0); | ||
419 | |||
420 | To set the filters to zero filters is quite obsolete as not read | ||
421 | data causes the raw socket to discard the received CAN frames. But | ||
422 | having this 'send only' use-case we may remove the receive list in the | ||
423 | Kernel to save a little (really a very little!) CPU usage. | ||
424 | |||
425 | 4.1.2 RAW socket option CAN_RAW_ERR_FILTER | ||
426 | |||
427 | As described in chapter 3.4 the CAN interface driver can generate so | ||
428 | called Error Frames that can optionally be passed to the user | ||
429 | application in the same way as other CAN frames. The possible | ||
430 | errors are divided into different error classes that may be filtered | ||
431 | using the appropriate error mask. To register for every possible | ||
432 | error condition CAN_ERR_MASK can be used as value for the error mask. | ||
433 | The values for the error mask are defined in linux/can/error.h . | ||
434 | |||
435 | can_err_mask_t err_mask = ( CAN_ERR_TX_TIMEOUT | CAN_ERR_BUSOFF ); | ||
436 | |||
437 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, | ||
438 | &err_mask, sizeof(err_mask)); | ||
439 | |||
440 | 4.1.3 RAW socket option CAN_RAW_LOOPBACK | ||
441 | |||
442 | To meet multi user needs the local loopback is enabled by default | ||
443 | (see chapter 3.2 for details). But in some embedded use-cases | ||
444 | (e.g. when only one application uses the CAN bus) this loopback | ||
445 | functionality can be disabled (separately for each socket): | ||
446 | |||
447 | int loopback = 0; /* 0 = disabled, 1 = enabled (default) */ | ||
448 | |||
449 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &loopback, sizeof(loopback)); | ||
450 | |||
451 | 4.1.4 RAW socket option CAN_RAW_RECV_OWN_MSGS | ||
452 | |||
453 | When the local loopback is enabled, all the sent CAN frames are | ||
454 | looped back to the open CAN sockets that registered for the CAN | ||
455 | frames' CAN-ID on this given interface to meet the multi user | ||
456 | needs. The reception of the CAN frames on the same socket that was | ||
457 | sending the CAN frame is assumed to be unwanted and therefore | ||
458 | disabled by default. This default behaviour may be changed on | ||
459 | demand: | ||
460 | |||
461 | int recv_own_msgs = 1; /* 0 = disabled (default), 1 = enabled */ | ||
462 | |||
463 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, | ||
464 | &recv_own_msgs, sizeof(recv_own_msgs)); | ||
465 | |||
466 | 4.2 Broadcast Manager protocol sockets (SOCK_DGRAM) | ||
467 | 4.3 connected transport protocols (SOCK_SEQPACKET) | ||
468 | 4.4 unconnected transport protocols (SOCK_DGRAM) | ||
469 | |||
470 | |||
471 | 5. Socket CAN core module | ||
472 | ------------------------- | ||
473 | |||
474 | The Socket CAN core module implements the protocol family | ||
475 | PF_CAN. CAN protocol modules are loaded by the core module at | ||
476 | runtime. The core module provides an interface for CAN protocol | ||
477 | modules to subscribe needed CAN IDs (see chapter 3.1). | ||
478 | |||
479 | 5.1 can.ko module params | ||
480 | |||
481 | - stats_timer: To calculate the Socket CAN core statistics | ||
482 | (e.g. current/maximum frames per second) this 1 second timer is | ||
483 | invoked at can.ko module start time by default. This timer can be | ||
484 | disabled by using stattimer=0 on the module comandline. | ||
485 | |||
486 | - debug: (removed since SocketCAN SVN r546) | ||
487 | |||
488 | 5.2 procfs content | ||
489 | |||
490 | As described in chapter 3.1 the Socket CAN core uses several filter | ||
491 | lists to deliver received CAN frames to CAN protocol modules. These | ||
492 | receive lists, their filters and the count of filter matches can be | ||
493 | checked in the appropriate receive list. All entries contain the | ||
494 | device and a protocol module identifier: | ||
495 | |||
496 | foo@bar:~$ cat /proc/net/can/rcvlist_all | ||
497 | |||
498 | receive list 'rx_all': | ||
499 | (vcan3: no entry) | ||
500 | (vcan2: no entry) | ||
501 | (vcan1: no entry) | ||
502 | device can_id can_mask function userdata matches ident | ||
503 | vcan0 000 00000000 f88e6370 f6c6f400 0 raw | ||
504 | (any: no entry) | ||
505 | |||
506 | In this example an application requests any CAN traffic from vcan0. | ||
507 | |||
508 | rcvlist_all - list for unfiltered entries (no filter operations) | ||
509 | rcvlist_eff - list for single extended frame (EFF) entries | ||
510 | rcvlist_err - list for error frames masks | ||
511 | rcvlist_fil - list for mask/value filters | ||
512 | rcvlist_inv - list for mask/value filters (inverse semantic) | ||
513 | rcvlist_sff - list for single standard frame (SFF) entries | ||
514 | |||
515 | Additional procfs files in /proc/net/can | ||
516 | |||
517 | stats - Socket CAN core statistics (rx/tx frames, match ratios, ...) | ||
518 | reset_stats - manual statistic reset | ||
519 | version - prints the Socket CAN core version and the ABI version | ||
520 | |||
521 | 5.3 writing own CAN protocol modules | ||
522 | |||
523 | To implement a new protocol in the protocol family PF_CAN a new | ||
524 | protocol has to be defined in include/linux/can.h . | ||
525 | The prototypes and definitions to use the Socket CAN core can be | ||
526 | accessed by including include/linux/can/core.h . | ||
527 | In addition to functions that register the CAN protocol and the | ||
528 | CAN device notifier chain there are functions to subscribe CAN | ||
529 | frames received by CAN interfaces and to send CAN frames: | ||
530 | |||
531 | can_rx_register - subscribe CAN frames from a specific interface | ||
532 | can_rx_unregister - unsubscribe CAN frames from a specific interface | ||
533 | can_send - transmit a CAN frame (optional with local loopback) | ||
534 | |||
535 | For details see the kerneldoc documentation in net/can/af_can.c or | ||
536 | the source code of net/can/raw.c or net/can/bcm.c . | ||
537 | |||
538 | 6. CAN network drivers | ||
539 | ---------------------- | ||
540 | |||
541 | Writing a CAN network device driver is much easier than writing a | ||
542 | CAN character device driver. Similar to other known network device | ||
543 | drivers you mainly have to deal with: | ||
544 | |||
545 | - TX: Put the CAN frame from the socket buffer to the CAN controller. | ||
546 | - RX: Put the CAN frame from the CAN controller to the socket buffer. | ||
547 | |||
548 | See e.g. at Documentation/networking/netdevices.txt . The differences | ||
549 | for writing CAN network device driver are described below: | ||
550 | |||
551 | 6.1 general settings | ||
552 | |||
553 | dev->type = ARPHRD_CAN; /* the netdevice hardware type */ | ||
554 | dev->flags = IFF_NOARP; /* CAN has no arp */ | ||
555 | |||
556 | dev->mtu = sizeof(struct can_frame); | ||
557 | |||
558 | The struct can_frame is the payload of each socket buffer in the | ||
559 | protocol family PF_CAN. | ||
560 | |||
561 | 6.2 local loopback of sent frames | ||
562 | |||
563 | As described in chapter 3.2 the CAN network device driver should | ||
564 | support a local loopback functionality similar to the local echo | ||
565 | e.g. of tty devices. In this case the driver flag IFF_ECHO has to be | ||
566 | set to prevent the PF_CAN core from locally echoing sent frames | ||
567 | (aka loopback) as fallback solution: | ||
568 | |||
569 | dev->flags = (IFF_NOARP | IFF_ECHO); | ||
570 | |||
571 | 6.3 CAN controller hardware filters | ||
572 | |||
573 | To reduce the interrupt load on deep embedded systems some CAN | ||
574 | controllers support the filtering of CAN IDs or ranges of CAN IDs. | ||
575 | These hardware filter capabilities vary from controller to | ||
576 | controller and have to be identified as not feasible in a multi-user | ||
577 | networking approach. The use of the very controller specific | ||
578 | hardware filters could make sense in a very dedicated use-case, as a | ||
579 | filter on driver level would affect all users in the multi-user | ||
580 | system. The high efficient filter sets inside the PF_CAN core allow | ||
581 | to set different multiple filters for each socket separately. | ||
582 | Therefore the use of hardware filters goes to the category 'handmade | ||
583 | tuning on deep embedded systems'. The author is running a MPC603e | ||
584 | @133MHz with four SJA1000 CAN controllers from 2002 under heavy bus | ||
585 | load without any problems ... | ||
586 | |||
587 | 6.4 currently supported CAN hardware (September 2007) | ||
588 | |||
589 | On the project website http://developer.berlios.de/projects/socketcan | ||
590 | there are different drivers available: | ||
591 | |||
592 | vcan: Virtual CAN interface driver (if no real hardware is available) | ||
593 | sja1000: Philips SJA1000 CAN controller (recommended) | ||
594 | i82527: Intel i82527 CAN controller | ||
595 | mscan: Motorola/Freescale CAN controller (e.g. inside SOC MPC5200) | ||
596 | ccan: CCAN controller core (e.g. inside SOC h7202) | ||
597 | slcan: For a bunch of CAN adaptors that are attached via a | ||
598 | serial line ASCII protocol (for serial / USB adaptors) | ||
599 | |||
600 | Additionally the different CAN adaptors (ISA/PCI/PCMCIA/USB/Parport) | ||
601 | from PEAK Systemtechnik support the CAN netdevice driver model | ||
602 | since Linux driver v6.0: http://www.peak-system.com/linux/index.htm | ||
603 | |||
604 | Please check the Mailing Lists on the berlios OSS project website. | ||
605 | |||
606 | 6.5 todo (September 2007) | ||
607 | |||
608 | The configuration interface for CAN network drivers is still an open | ||
609 | issue that has not been finalized in the socketcan project. Also the | ||
610 | idea of having a library module (candev.ko) that holds functions | ||
611 | that are needed by all CAN netdevices is not ready to ship. | ||
612 | Your contribution is welcome. | ||
613 | |||
614 | 7. Credits | ||
615 | ---------- | ||
616 | |||
617 | Oliver Hartkopp (PF_CAN core, filters, drivers, bcm) | ||
618 | Urs Thuermann (PF_CAN core, kernel integration, socket interfaces, raw, vcan) | ||
619 | Jan Kizka (RT-SocketCAN core, Socket-API reconciliation) | ||
620 | Wolfgang Grandegger (RT-SocketCAN core & drivers, Raw Socket-API reviews) | ||
621 | Robert Schwebel (design reviews, PTXdist integration) | ||
622 | Marc Kleine-Budde (design reviews, Kernel 2.6 cleanups, drivers) | ||
623 | Benedikt Spranger (reviews) | ||
624 | Thomas Gleixner (LKML reviews, coding style, posting hints) | ||
625 | Andrey Volkov (kernel subtree structure, ioctls, mscan driver) | ||
626 | Matthias Brukner (first SJA1000 CAN netdevice implementation Q2/2003) | ||
627 | Klaus Hitschler (PEAK driver integration) | ||
628 | Uwe Koppe (CAN netdevices with PF_PACKET approach) | ||
629 | Michael Schulze (driver layer loopback requirement, RT CAN drivers review) | ||
diff --git a/Documentation/networking/dccp.txt b/Documentation/networking/dccp.txt index afb66f9a8aff..39131a3c78f8 100644 --- a/Documentation/networking/dccp.txt +++ b/Documentation/networking/dccp.txt | |||
@@ -14,24 +14,35 @@ Introduction | |||
14 | ============ | 14 | ============ |
15 | 15 | ||
16 | Datagram Congestion Control Protocol (DCCP) is an unreliable, connection | 16 | Datagram Congestion Control Protocol (DCCP) is an unreliable, connection |
17 | based protocol designed to solve issues present in UDP and TCP particularly | 17 | oriented protocol designed to solve issues present in UDP and TCP, particularly |
18 | for real time and multimedia traffic. | 18 | for real-time and multimedia (streaming) traffic. |
19 | It divides into a base protocol (RFC 4340) and plugable congestion control | ||
20 | modules called CCIDs. Like plugable TCP congestion control, at least one CCID | ||
21 | needs to be enabled in order for the protocol to function properly. In the Linux | ||
22 | implementation, this is the TCP-like CCID2 (RFC 4341). Additional CCIDs, such as | ||
23 | the TCP-friendly CCID3 (RFC 4342), are optional. | ||
24 | For a brief introduction to CCIDs and suggestions for choosing a CCID to match | ||
25 | given applications, see section 10 of RFC 4340. | ||
19 | 26 | ||
20 | It has a base protocol and pluggable congestion control IDs (CCIDs). | 27 | It has a base protocol and pluggable congestion control IDs (CCIDs). |
21 | 28 | ||
22 | It is at proposed standard RFC status and the homepage for DCCP as a protocol | 29 | DCCP is a Proposed Standard (RFC 2026), and the homepage for DCCP as a protocol |
23 | is at: | 30 | is at http://www.ietf.org/html.charters/dccp-charter.html |
24 | http://www.read.cs.ucla.edu/dccp/ | ||
25 | 31 | ||
26 | Missing features | 32 | Missing features |
27 | ================ | 33 | ================ |
28 | 34 | ||
29 | The DCCP implementation does not currently have all the features that are in | 35 | The Linux DCCP implementation does not currently support all the features that are |
30 | the RFC. | 36 | specified in RFCs 4340...42. |
31 | 37 | ||
32 | The known bugs are at: | 38 | The known bugs are at: |
33 | http://linux-net.osdl.org/index.php/TODO#DCCP | 39 | http://linux-net.osdl.org/index.php/TODO#DCCP |
34 | 40 | ||
41 | For more up-to-date versions of the DCCP implementation, please consider using | ||
42 | the experimental DCCP test tree; instructions for checking this out are on: | ||
43 | http://linux-net.osdl.org/index.php/DCCP_Testing#Experimental_DCCP_source_tree | ||
44 | |||
45 | |||
35 | Socket options | 46 | Socket options |
36 | ============== | 47 | ============== |
37 | 48 | ||
@@ -46,6 +57,12 @@ can be set before calling bind(). | |||
46 | DCCP_SOCKOPT_GET_CUR_MPS is read-only and retrieves the current maximum packet | 57 | DCCP_SOCKOPT_GET_CUR_MPS is read-only and retrieves the current maximum packet |
47 | size (application payload size) in bytes, see RFC 4340, section 14. | 58 | size (application payload size) in bytes, see RFC 4340, section 14. |
48 | 59 | ||
60 | DCCP_SOCKOPT_SERVER_TIMEWAIT enables the server (listening socket) to hold | ||
61 | timewait state when closing the connection (RFC 4340, 8.3). The usual case is | ||
62 | that the closing server sends a CloseReq, whereupon the client holds timewait | ||
63 | state. When this boolean socket option is on, the server sends a Close instead | ||
64 | and will enter TIMEWAIT. This option must be set after accept() returns. | ||
65 | |||
49 | DCCP_SOCKOPT_SEND_CSCOV and DCCP_SOCKOPT_RECV_CSCOV are used for setting the | 66 | DCCP_SOCKOPT_SEND_CSCOV and DCCP_SOCKOPT_RECV_CSCOV are used for setting the |
50 | partial checksum coverage (RFC 4340, sec. 9.2). The default is that checksums | 67 | partial checksum coverage (RFC 4340, sec. 9.2). The default is that checksums |
51 | always cover the entire packet and that only fully covered application data is | 68 | always cover the entire packet and that only fully covered application data is |
@@ -72,6 +89,8 @@ DCCP_SOCKOPT_CCID_TX_INFO | |||
72 | Returns a `struct tfrc_tx_info' in optval; the buffer for optval and | 89 | Returns a `struct tfrc_tx_info' in optval; the buffer for optval and |
73 | optlen must be set to at least sizeof(struct tfrc_tx_info). | 90 | optlen must be set to at least sizeof(struct tfrc_tx_info). |
74 | 91 | ||
92 | On unidirectional connections it is useful to close the unused half-connection | ||
93 | via shutdown (SHUT_WR or SHUT_RD): this will reduce per-packet processing costs. | ||
75 | 94 | ||
76 | Sysctl variables | 95 | Sysctl variables |
77 | ================ | 96 | ================ |
@@ -123,6 +142,12 @@ sync_ratelimit = 125 ms | |||
123 | sequence-invalid packets on the same socket (RFC 4340, 7.5.4). The unit | 142 | sequence-invalid packets on the same socket (RFC 4340, 7.5.4). The unit |
124 | of this parameter is milliseconds; a value of 0 disables rate-limiting. | 143 | of this parameter is milliseconds; a value of 0 disables rate-limiting. |
125 | 144 | ||
145 | IOCTLS | ||
146 | ====== | ||
147 | FIONREAD | ||
148 | Works as in udp(7): returns in the `int' argument pointer the size of | ||
149 | the next pending datagram in bytes, or 0 when no datagram is pending. | ||
150 | |||
126 | Notes | 151 | Notes |
127 | ===== | 152 | ===== |
128 | 153 | ||
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 | ||
61 | The kernel command line takes options looking like the following: | 61 | The kernel command line takes options looking like the following: |
62 | 62 | ||
63 | decnet=1,2 | 63 | decnet.addr=1,2 |
64 | 64 | ||
65 | the two numbers are the node address 1,2 = 1.2 For 2.2.xx kernels | 65 | the two numbers are the node address 1,2 = 1.2 For 2.2.xx kernels |
66 | and early 2.3.xx kernels, you must use a comma when specifying the | 66 | and early 2.3.xx kernels, you must use a comma when specifying the |
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt index 4f7da5a2bf4f..ea72d2e66ca8 100644 --- a/Documentation/networking/driver.txt +++ b/Documentation/networking/driver.txt | |||
@@ -61,7 +61,10 @@ Transmit path guidelines: | |||
61 | 2) Do not forget to update netdev->trans_start to jiffies after | 61 | 2) Do not forget to update netdev->trans_start to jiffies after |
62 | each new tx packet is given to the hardware. | 62 | each new tx packet is given to the hardware. |
63 | 63 | ||
64 | 3) Do not forget that once you return 0 from your hard_start_xmit | 64 | 3) A hard_start_xmit method must not modify the shared parts of a |
65 | cloned SKB. | ||
66 | |||
67 | 4) Do not forget that once you return 0 from your hard_start_xmit | ||
65 | method, it is your driver's responsibility to free up the SKB | 68 | method, it is your driver's responsibility to free up the SKB |
66 | and in some finite amount of time. | 69 | and in some finite amount of time. |
67 | 70 | ||
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 6f7872ba1def..17a6e46fbd43 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -446,6 +446,33 @@ tcp_dma_copybreak - INTEGER | |||
446 | and CONFIG_NET_DMA is enabled. | 446 | and CONFIG_NET_DMA is enabled. |
447 | Default: 4096 | 447 | Default: 4096 |
448 | 448 | ||
449 | UDP variables: | ||
450 | |||
451 | udp_mem - vector of 3 INTEGERs: min, pressure, max | ||
452 | Number of pages allowed for queueing by all UDP sockets. | ||
453 | |||
454 | min: Below this number of pages UDP is not bothered about its | ||
455 | memory appetite. When amount of memory allocated by UDP exceeds | ||
456 | this number, UDP starts to moderate memory usage. | ||
457 | |||
458 | pressure: This value was introduced to follow format of tcp_mem. | ||
459 | |||
460 | max: Number of pages allowed for queueing by all UDP sockets. | ||
461 | |||
462 | Default is calculated at boot time from amount of available memory. | ||
463 | |||
464 | udp_rmem_min - INTEGER | ||
465 | Minimal size of receive buffer used by UDP sockets in moderation. | ||
466 | Each UDP socket is able to use the size for receiving data, even if | ||
467 | total pages of UDP sockets exceed udp_mem pressure. The unit is byte. | ||
468 | Default: 4096 | ||
469 | |||
470 | udp_wmem_min - INTEGER | ||
471 | Minimal size of send buffer used by UDP sockets in moderation. | ||
472 | Each UDP socket is able to use the size for sending data, even if | ||
473 | total pages of UDP sockets exceed udp_mem pressure. The unit is byte. | ||
474 | Default: 4096 | ||
475 | |||
449 | CIPSOv4 Variables: | 476 | CIPSOv4 Variables: |
450 | 477 | ||
451 | cipso_cache_enable - BOOLEAN | 478 | cipso_cache_enable - BOOLEAN |
diff --git a/Documentation/networking/shaper.txt b/Documentation/networking/shaper.txt deleted file mode 100644 index 6c4ebb66a906..000000000000 --- a/Documentation/networking/shaper.txt +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | Traffic Shaper For Linux | ||
2 | |||
3 | This is the current BETA release of the traffic shaper for Linux. It works | ||
4 | within the following limits: | ||
5 | |||
6 | o Minimum shaping speed is currently about 9600 baud (it can only | ||
7 | shape down to 1 byte per clock tick) | ||
8 | |||
9 | o Maximum is about 256K, it will go above this but get a bit blocky. | ||
10 | |||
11 | o If you ifconfig the master device that a shaper is attached to down | ||
12 | then your machine will follow. | ||
13 | |||
14 | o The shaper must be a module. | ||
15 | |||
16 | |||
17 | Setup: | ||
18 | |||
19 | A shaper device is configured using the shapeconfig program. | ||
20 | Typically you will do something like this | ||
21 | |||
22 | shapecfg attach shaper0 eth1 | ||
23 | shapecfg speed shaper0 64000 | ||
24 | ifconfig shaper0 myhost netmask 255.255.255.240 broadcast 1.2.3.4.255 up | ||
25 | route add -net some.network netmask a.b.c.d dev shaper0 | ||
26 | |||
27 | The shaper should have the same IP address as the device it is attached to | ||
28 | for normal use. | ||
29 | |||
30 | Gotchas: | ||
31 | |||
32 | The shaper shapes transmitted traffic. It's rather impossible to | ||
33 | shape received traffic except at the end (or a router) transmitting it. | ||
34 | |||
35 | Gated/routed/rwhod/mrouted all see the shaper as an additional device | ||
36 | and will treat it as such unless patched. Note that for mrouted you can run | ||
37 | mrouted tunnels via a traffic shaper to control bandwidth usage. | ||
38 | |||
39 | The shaper is device/route based. This makes it very easy to use | ||
40 | with any setup BUT less flexible. You may need to use iproute2 to set up | ||
41 | multiple route tables to get the flexibility. | ||
42 | |||
43 | There is no "borrowing" or "sharing" scheme. This is a simple | ||
44 | traffic limiter. We implement Van Jacobson and Sally Floyd's CBQ | ||
45 | architecture into Linux 2.2. This is the preferred solution. Shaper is | ||
46 | for simple or back compatible setups. | ||
47 | |||
48 | Alan | ||
diff --git a/Documentation/networking/udplite.txt b/Documentation/networking/udplite.txt index b6409cab075c..3870f280280b 100644 --- a/Documentation/networking/udplite.txt +++ b/Documentation/networking/udplite.txt | |||
@@ -236,7 +236,7 @@ | |||
236 | 236 | ||
237 | This displays UDP-Lite statistics variables, whose meaning is as follows. | 237 | This displays UDP-Lite statistics variables, whose meaning is as follows. |
238 | 238 | ||
239 | InDatagrams: Total number of received datagrams. | 239 | InDatagrams: The total number of datagrams delivered to users. |
240 | 240 | ||
241 | NoPorts: Number of packets received to an unknown port. | 241 | NoPorts: Number of packets received to an unknown port. |
242 | These cases are counted separately (not as InErrors). | 242 | These cases are counted separately (not as InErrors). |
diff --git a/Documentation/networking/wavelan.txt b/Documentation/networking/wavelan.txt index c1acf5eb3712..afa6e521c685 100644 --- a/Documentation/networking/wavelan.txt +++ b/Documentation/networking/wavelan.txt | |||
@@ -12,8 +12,8 @@ and many Linux driver to support it. | |||
12 | "wavelan" driver (old ISA Wavelan) | 12 | "wavelan" driver (old ISA Wavelan) |
13 | ---------------- | 13 | ---------------- |
14 | o Config : Network device -> Wireless LAN -> AT&T WaveLAN | 14 | o Config : Network device -> Wireless LAN -> AT&T WaveLAN |
15 | o Location : .../drivers/net/wavelan* | 15 | o Location : .../drivers/net/wireless/wavelan* |
16 | o in-line doc : .../drivers/net/wavelan.p.h | 16 | o in-line doc : .../drivers/net/wireless/wavelan.p.h |
17 | o on-line doc : | 17 | o on-line doc : |
18 | http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html | 18 | http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html |
19 | 19 | ||
diff --git a/Documentation/networking/xfrm_proc.txt b/Documentation/networking/xfrm_proc.txt new file mode 100644 index 000000000000..d0d8bafa9016 --- /dev/null +++ b/Documentation/networking/xfrm_proc.txt | |||
@@ -0,0 +1,74 @@ | |||
1 | XFRM proc - /proc/net/xfrm_* files | ||
2 | ================================== | ||
3 | Masahide NAKAMURA <nakam@linux-ipv6.org> | ||
4 | |||
5 | |||
6 | Transformation Statistics | ||
7 | ------------------------- | ||
8 | xfrm_proc is a statistics shown factor dropped by transformation | ||
9 | for developer. | ||
10 | It is a counter designed from current transformation source code | ||
11 | and defined like linux private MIB. | ||
12 | |||
13 | Inbound statistics | ||
14 | ~~~~~~~~~~~~~~~~~~ | ||
15 | XfrmInError: | ||
16 | All errors which is not matched others | ||
17 | XfrmInBufferError: | ||
18 | No buffer is left | ||
19 | XfrmInHdrError: | ||
20 | Header error | ||
21 | XfrmInNoStates: | ||
22 | No state is found | ||
23 | i.e. Either inbound SPI, address, or IPsec protocol at SA is wrong | ||
24 | XfrmInStateProtoError: | ||
25 | Transformation protocol specific error | ||
26 | e.g. SA key is wrong | ||
27 | XfrmInStateModeError: | ||
28 | Transformation mode specific error | ||
29 | XfrmInStateSeqError: | ||
30 | Sequence error | ||
31 | i.e. Sequence number is out of window | ||
32 | XfrmInStateExpired: | ||
33 | State is expired | ||
34 | XfrmInStateMismatch: | ||
35 | State has mismatch option | ||
36 | e.g. UDP encapsulation type is mismatch | ||
37 | XfrmInStateInvalid: | ||
38 | State is invalid | ||
39 | XfrmInTmplMismatch: | ||
40 | No matching template for states | ||
41 | e.g. Inbound SAs are correct but SP rule is wrong | ||
42 | XfrmInNoPols: | ||
43 | No policy is found for states | ||
44 | e.g. Inbound SAs are correct but no SP is found | ||
45 | XfrmInPolBlock: | ||
46 | Policy discards | ||
47 | XfrmInPolError: | ||
48 | Policy error | ||
49 | |||
50 | Outbound errors | ||
51 | ~~~~~~~~~~~~~~~ | ||
52 | XfrmOutError: | ||
53 | All errors which is not matched others | ||
54 | XfrmOutBundleGenError: | ||
55 | Bundle generation error | ||
56 | XfrmOutBundleCheckError: | ||
57 | Bundle check error | ||
58 | XfrmOutNoStates: | ||
59 | No state is found | ||
60 | XfrmOutStateProtoError: | ||
61 | Transformation protocol specific error | ||
62 | XfrmOutStateModeError: | ||
63 | Transformation mode specific error | ||
64 | XfrmOutStateSeqError: | ||
65 | Sequence error | ||
66 | i.e. Sequence number overflow | ||
67 | XfrmOutStateExpired: | ||
68 | State is expired | ||
69 | XfrmOutPolBlock: | ||
70 | Policy discards | ||
71 | XfrmOutPolDead: | ||
72 | Policy is dead | ||
73 | XfrmOutPolError: | ||
74 | Policy error | ||
diff --git a/Documentation/nfsroot.txt b/Documentation/nfsroot.txt index 16a7cae2721d..31b329172343 100644 --- a/Documentation/nfsroot.txt +++ b/Documentation/nfsroot.txt | |||
@@ -92,8 +92,10 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> | |||
92 | autoconfiguration. | 92 | autoconfiguration. |
93 | 93 | ||
94 | The <autoconf> parameter can appear alone as the value to the `ip' | 94 | The <autoconf> parameter can appear alone as the value to the `ip' |
95 | parameter (without all the ':' characters before) in which case auto- | 95 | parameter (without all the ':' characters before). If the value is |
96 | configuration is used. | 96 | "ip=off" or "ip=none", no autoconfiguration will take place, otherwise |
97 | autoconfiguration will take place. The most common way to use this | ||
98 | is "ip=dhcp". | ||
97 | 99 | ||
98 | <client-ip> IP address of the client. | 100 | <client-ip> IP address of the client. |
99 | 101 | ||
@@ -142,8 +144,10 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> | |||
142 | into the kernel will be used, regardless of the value of | 144 | into the kernel will be used, regardless of the value of |
143 | this option. | 145 | this option. |
144 | 146 | ||
145 | off or none: don't use autoconfiguration (default) | 147 | off or none: don't use autoconfiguration |
148 | (do static IP assignment instead) | ||
146 | on or any: use any protocol available in the kernel | 149 | on or any: use any protocol available in the kernel |
150 | (default) | ||
147 | dhcp: use DHCP | 151 | dhcp: use DHCP |
148 | bootp: use BOOTP | 152 | bootp: use BOOTP |
149 | rarp: use RARP | 153 | rarp: use RARP |
diff --git a/Documentation/parport-lowlevel.txt b/Documentation/parport-lowlevel.txt index 265fcdcb8e5f..120eb20dbb09 100644 --- a/Documentation/parport-lowlevel.txt +++ b/Documentation/parport-lowlevel.txt | |||
@@ -339,6 +339,10 @@ Use this function to register your device driver on a parallel port | |||
339 | ('port'). Once you have done that, you will be able to use | 339 | ('port'). Once you have done that, you will be able to use |
340 | parport_claim and parport_release in order to use the port. | 340 | parport_claim and parport_release in order to use the port. |
341 | 341 | ||
342 | The ('name') argument is the name of the device that appears in /proc | ||
343 | filesystem. The string must be valid for the whole lifetime of the | ||
344 | device (until parport_unregister_device is called). | ||
345 | |||
342 | This function will register three callbacks into your driver: | 346 | This function will register three callbacks into your driver: |
343 | 'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to | 347 | 'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to |
344 | indicate that you do not want a callback. | 348 | indicate that you do not want a callback. |
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 | ||
276 | NOTE: pci_enable_device() can fail! Check the return value. | 276 | NOTE: pci_enable_device() can fail! Check the return value. |
277 | NOTE2: 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 | ||
608 | 10. pci_enable_device_bars() and Legacy I/O Port space | 606 | 10. MMIO Space and "Write Posting" |
609 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
610 | |||
611 | Large servers may not be able to provide I/O port resources to all PCI | ||
612 | devices. I/O Port space is only 64KB on Intel Architecture[1] and is | ||
613 | likely also fragmented since the I/O base register of PCI-to-PCI | ||
614 | bridge will usually be aligned to a 4KB boundary[2]. On such systems, | ||
615 | pci_enable_device() and pci_request_region() will fail when | ||
616 | attempting to enable I/O Port regions that don't have I/O Port | ||
617 | resources assigned. | ||
618 | |||
619 | Fortunately, many PCI devices which request I/O Port resources also | ||
620 | provide access to the same registers via MMIO BARs. These devices can | ||
621 | be handled without using I/O port space and the drivers typically | ||
622 | offer a CONFIG_ option to only use MMIO regions | ||
623 | (e.g. CONFIG_TULIP_MMIO). PCI devices typically provide I/O port | ||
624 | interface for legacy OSes and will work when I/O port resources are not | ||
625 | assigned. The "PCI Local Bus Specification Revision 3.0" discusses | ||
626 | this on p.44, "IMPLEMENTATION NOTE". | ||
627 | |||
628 | If your PCI device driver doesn't need I/O port resources assigned to | ||
629 | I/O Port BARs, you should use pci_enable_device_bars() instead of | ||
630 | pci_enable_device() in order not to enable I/O port regions for the | ||
631 | corresponding devices. In addition, you should use | ||
632 | pci_request_selected_regions() and pci_release_selected_regions() | ||
633 | instead of pci_request_regions()/pci_release_regions() in order not to | ||
634 | request/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 | |||
641 | 11. MMIO Space and "Write Posting" | ||
642 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 607 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
643 | 608 | ||
644 | Converting a driver from using I/O Port space to using MMIO space | 609 | Converting 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 @@ | |||
1 | PM quality of Service interface. | ||
2 | |||
3 | This interface provides a kernel and user mode interface for registering | ||
4 | performance expectations by drivers, subsystems and user space applications on | ||
5 | one of the parameters. | ||
6 | |||
7 | Currently we have {cpu_dma_latency, network_latency, network_throughput} as the | ||
8 | initial set of pm_qos parameters. | ||
9 | |||
10 | The infrastructure exposes multiple misc device nodes one per implemented | ||
11 | parameter. The set of parameters implement is defined by pm_qos_power_init() | ||
12 | and pm_qos_params.h. This is done because having the available parameters | ||
13 | being runtime configurable or changeable from a driver was seen as too easy to | ||
14 | abuse. | ||
15 | |||
16 | For each parameter a list of performance requirements is maintained along with | ||
17 | an aggregated target value. The aggregated target value is updated with | ||
18 | changes to the requirement list or elements of the list. Typically the | ||
19 | aggregated target value is simply the max or min of the requirement values held | ||
20 | in the parameter list elements. | ||
21 | |||
22 | From kernel mode the use of this interface is simple: | ||
23 | pm_qos_add_requirement(param_id, name, target_value): | ||
24 | Will insert a named element in the list for that identified PM_QOS parameter | ||
25 | with the target value. Upon change to this list the new target is recomputed | ||
26 | and any registered notifiers are called only if the target value is now | ||
27 | different. | ||
28 | |||
29 | pm_qos_update_requirement(param_id, name, new_target_value): | ||
30 | Will search the list identified by the param_id for the named list element and | ||
31 | then update its target value, calling the notification tree if the aggregated | ||
32 | target is changed. with that name is already registered. | ||
33 | |||
34 | pm_qos_remove_requirement(param_id, name): | ||
35 | Will search the identified list for the named element and remove it, after | ||
36 | removal it will update the aggregate target and call the notification tree if | ||
37 | the target was changed as a result of removing the named requirement. | ||
38 | |||
39 | |||
40 | From user mode: | ||
41 | Only processes can register a pm_qos requirement. To provide for automatic | ||
42 | cleanup for process the interface requires the process to register its | ||
43 | parameter requirements in the following way: | ||
44 | |||
45 | To register the default pm_qos target for the specific parameter, the process | ||
46 | must open one of /dev/[cpu_dma_latency, network_latency, network_throughput] | ||
47 | |||
48 | As long as the device node is held open that process has a registered | ||
49 | requirement on the parameter. The name of the requirement is "process_<PID>" | ||
50 | derived from the current->pid from within the open system call. | ||
51 | |||
52 | To change the requested target value the process needs to write a s32 value to | ||
53 | the open device node. This translates to a pm_qos_update_requirement call. | ||
54 | |||
55 | To remove the user mode request for a target value simply close the device | ||
56 | node. | ||
57 | |||
58 | |||
59 | |||
diff --git a/Documentation/pnp.txt b/Documentation/pnp.txt index 481faf515d53..a327db67782a 100644 --- a/Documentation/pnp.txt +++ b/Documentation/pnp.txt | |||
@@ -17,9 +17,9 @@ The User Interface | |||
17 | ------------------ | 17 | ------------------ |
18 | The Linux Plug and Play user interface provides a means to activate PnP devices | 18 | The Linux Plug and Play user interface provides a means to activate PnP devices |
19 | for legacy and user level drivers that do not support Linux Plug and Play. The | 19 | for legacy and user level drivers that do not support Linux Plug and Play. The |
20 | user interface is integrated into driverfs. | 20 | user interface is integrated into sysfs. |
21 | 21 | ||
22 | In addition to the standard driverfs file the following are created in each | 22 | In addition to the standard sysfs file the following are created in each |
23 | device's directory: | 23 | device's directory: |
24 | id - displays a list of support EISA IDs | 24 | id - displays a list of support EISA IDs |
25 | options - displays possible resource configurations | 25 | options - displays possible resource configurations |
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 @@ | |||
1 | Debugging suspend and resume | 1 | Debugging 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 | ||
4 | 1. Testing suspend to disk (STD) | 4 | 1. Testing hibernation (aka suspend to disk or STD) |
5 | 5 | ||
6 | To verify that the STD works, you can try to suspend in the "reboot" mode: | 6 | To 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 | ||
11 | and the system should suspend, reboot, resume and get back to the command prompt | 11 | and the system should create a hibernation image, reboot, resume and get back to |
12 | where you have started the transition. If that happens, the STD is most likely | 12 | the command prompt where you have started the transition. If that happens, |
13 | to work correctly, but you need to repeat the test at least a couple of times in | 13 | hibernation is most likely to work correctly. Still, you need to repeat the |
14 | a row for confidence. This is necessary, because some problems only show up on | 14 | test at least a couple of times in a row for confidence. [This is necessary, |
15 | a second attempt at suspending and resuming the system. You should also test | 15 | because some problems only show up on a second attempt at suspending and |
16 | the "platform" and "shutdown" modes of suspend: | 16 | resuming the system.] Moreover, hibernating in the "reboot" and "shutdown" |
17 | modes causes the PM core to skip some platform-related callbacks which on ACPI | ||
18 | systems might be necessary to make hibernation work. Thus, if you machine fails | ||
19 | to 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 | ||
21 | or | 24 | which is the default and recommended mode of hibernation. |
25 | |||
26 | Unfortunately, the "platform" mode of hibernation does not work on some systems | ||
27 | with broken BIOSes. In such cases the "shutdown" mode of hibernation might | ||
28 | work: | ||
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 | ||
26 | in 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 |
27 | resume. If that does not work, you will need to identify what goes wrong. | 34 | button to make the system resume). |
35 | |||
36 | If neither "platform" nor "shutdown" hibernation mode works, you will need to | ||
37 | identify what goes wrong. | ||
38 | |||
39 | a) Test modes of hibernation | ||
40 | |||
41 | To find out why hibernation fails on your system, you can use a special testing | ||
42 | facility available if the kernel is compiled with CONFIG_PM_DEBUG set. Then, | ||
43 | there is the file /sys/power/pm_test that can be used to make the hibernation | ||
44 | core run in a test mode. There are 5 test modes available: | ||
45 | |||
46 | freezer | ||
47 | - test the freezing of processes | ||
48 | |||
49 | devices | ||
50 | - test the freezing of processes and suspending of devices | ||
28 | 51 | ||
29 | a) Test mode of STD | 52 | platform |
53 | - test the freezing of processes, suspending of devices and platform | ||
54 | global control methods(*) | ||
30 | 55 | ||
31 | To verify if there are any drivers that cause problems you can run the STD | 56 | processors |
32 | in 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 | 60 | core |
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 | |||
68 | To 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 | ||
70 | suspending devices) and issue the standard hibernation commands. For example, | ||
71 | to use the "devices" test mode along with the "platform" mode of hibernation, | ||
72 | you 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 | ||
37 | in which case the system should freeze tasks, suspend devices, disable nonboot | 78 | Then, the kernel will try to freeze processes, suspend devices, wait 5 seconds, |
38 | CPUs (if any), wait for 5 seconds, enable nonboot CPUs, resume devices, thaw | 79 | resume devices and thaw processes. If "platform" is written to |
39 | tasks 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 |
40 | a driver that fails to either suspend or resume (in the latter case the system | 81 | invoke the global control methods (eg. ACPI global control methods) used to |
41 | may hang or be unstable after the test, so please take that into consideration). | 82 | prepare the platform firmware for hibernation. Next, it will wait 5 seconds and |
42 | To find this driver, you can carry out a binary search according to the rules: | 83 | invoke the platform (eg. ACPI) global methods used to cancel hibernation etc. |
84 | |||
85 | Writing "none" to /sys/power/pm_test causes the kernel to switch to the normal | ||
86 | hibernation/suspend operations. Also, when open for reading, /sys/power/pm_test | ||
87 | contains a space-separated list of all available tests (including "none" that | ||
88 | represents the normal functionality) in which the current test level is | ||
89 | indicated by square brackets. | ||
90 | |||
91 | Generally, as you can see, each test level is more "invasive" than the previous | ||
92 | one and the "core" level tests the hardware and drivers as deeply as possible | ||
93 | without creating a hibernation image. Obviously, if the "devices" test fails, | ||
94 | the "platform" test will fail as well and so on. Thus, as a rule of thumb, you | ||
95 | should try the test modes starting from "freezer", through "devices", "platform" | ||
96 | and "processors" up to "core" (repeat the test on each level a couple of times | ||
97 | to make sure that any random factors are avoided). | ||
98 | |||
99 | If the "freezer" test fails, there is a task that cannot be frozen (in that case | ||
100 | it usually is possible to identify the offending task by analysing the output of | ||
101 | dmesg obtained after the failing test). Failure at this level usually means | ||
102 | that there is a problem with the tasks freezer subsystem that should be | ||
103 | reported. | ||
104 | |||
105 | If the "devices" test fails, most likely there is a driver that cannot suspend | ||
106 | or resume its device (in the latter case the system may hang or become unstable | ||
107 | after the test, so please take that into consideration). To find this driver, | ||
108 | you 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 |
45 | have been loaded before the test), | 111 | have been loaded before the test), |
@@ -47,23 +113,46 @@ have been loaded before the test), | |||
47 | recently and repeat. | 113 | recently and repeat. |
48 | 114 | ||
49 | Once you have found the failing driver (there can be more than just one of | 115 | Once you have found the failing driver (there can be more than just one of |
50 | them), you have to unload it every time before the STD transition. In that case | 116 | them), you have to unload it every time before hibernation. In that case please |
51 | please make sure to report the problem with the driver. | 117 | make sure to report the problem with the driver. |
52 | 118 | ||
53 | It is also possible that a cycle can still fail after you have unloaded | 119 | It is also possible that the "devices" test will still fail after you have |
54 | all modules. In that case, you would want to look in your kernel configuration | 120 | unloaded all modules. In that case, you may want to look in your kernel |
55 | for the drivers that can be compiled as modules (testing again with them as | 121 | configuration for the drivers that can be compiled as modules (and test again |
56 | modules), and possibly also try boot time options such as "noapic" or "noacpi". | 122 | with these drivers compiled as modules). You may also try to use some special |
123 | kernel command line options such as "noapic", "noacpi" or even "acpi=off". | ||
124 | |||
125 | If the "platform" test fails, there is a problem with the handling of the | ||
126 | platform (eg. ACPI) firmware on your system. In that case the "platform" mode | ||
127 | of hibernation is not likely to work. You can try the "shutdown" mode, but that | ||
128 | is rather a poor man's workaround. | ||
129 | |||
130 | If the "processors" test fails, the disabling/enabling of nonboot CPUs does not | ||
131 | work (of course, this only may be an issue on SMP systems) and the problem | ||
132 | should be reported. In that case you can also try to switch the nonboot CPUs | ||
133 | off and on using the /sys/devices/system/cpu/cpu*/online sysfs attributes and | ||
134 | see if that works. | ||
135 | |||
136 | If the "core" test fails, which means that suspending of the system/platform | ||
137 | devices has failed (these devices are suspended on one CPU with interrupts off), | ||
138 | the problem is most probably hardware-related and serious, so it should be | ||
139 | reported. | ||
140 | |||
141 | A failure of any of the "platform", "processors" or "core" tests may cause your | ||
142 | system to hang or become unstable, so please beware. Such a failure usually | ||
143 | indicates a serious problem that very well may be related to the hardware, but | ||
144 | please report it anyway. | ||
57 | 145 | ||
58 | b) Testing minimal configuration | 146 | b) Testing minimal configuration |
59 | 147 | ||
60 | If the test mode of STD works, you can boot the system with "init=/bin/bash" | 148 | If all of the hibernation test modes work, you can boot the system with the |
61 | and attempt to suspend in the "reboot", "shutdown" and "platform" modes. If | 149 | "init=/bin/bash" command line parameter and attempt to hibernate in the |
62 | that does not work, there probably is a problem with a driver statically | 150 | "reboot", "shutdown" and "platform" modes. If that does not work, there |
63 | compiled into the kernel and you can try to compile more drivers as modules, | 151 | probably is a problem with a driver statically compiled into the kernel and you |
64 | so that they can be tested individually. Otherwise, there is a problem with a | 152 | can try to compile more drivers as modules, so that they can be tested |
65 | modular driver and you can find it by loading a half of the modules you normally | 153 | individually. Otherwise, there is a problem with a modular driver and you can |
66 | use and binary searching in accordance with the algorithm: | 154 | find it by loading a half of the modules you normally use and binary searching |
155 | in 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, |
68 | unload n/2 of the modules and try again (that would probably involve rebooting | 157 | unload n/2 of the modules and try again (that would probably involve rebooting |
69 | the system), | 158 | the system), |
@@ -71,19 +160,19 @@ the system), | |||
71 | load n/2 modules more and try again. | 160 | load n/2 modules more and try again. |
72 | 161 | ||
73 | Again, if you find the offending module(s), it(they) must be unloaded every time | 162 | Again, if you find the offending module(s), it(they) must be unloaded every time |
74 | before the STD transition, and please report the problem with it(them). | 163 | before hibernation, and please report the problem with it(them). |
75 | 164 | ||
76 | c) Advanced debugging | 165 | c) Advanced debugging |
77 | 166 | ||
78 | In case the STD does not work on your system even in the minimal configuration | 167 | In case that hibernation does not work on your system even in the minimal |
79 | and compiling more drivers as modules is not practical or some modules cannot | 168 | configuration and compiling more drivers as modules is not practical or some |
80 | be unloaded, you can use one of the more advanced debugging techniques to find | 169 | modules cannot be unloaded, you can use one of the more advanced debugging |
81 | the problem. First, if there is a serial port in your box, you can boot the | 170 | techniques to find the problem. First, if there is a serial port in your box, |
82 | kernel with the 'no_console_suspend' parameter and try to log kernel | 171 | you can boot the kernel with the 'no_console_suspend' parameter and try to log |
83 | messages using the serial console. This may provide you with some information | 172 | kernel messages using the serial console. This may provide you with some |
84 | about the reasons of the suspend (resume) failure. Alternatively, it may be | 173 | information about the reasons of the suspend (resume) failure. Alternatively, |
85 | possible to use a FireWire port for debugging with firescope | 174 | it 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 |
87 | use the PM_TRACE mechanism documented in Documentation/s2ram.txt . | 176 | use the PM_TRACE mechanism documented in Documentation/s2ram.txt . |
88 | 177 | ||
89 | 2. Testing suspend to RAM (STR) | 178 | 2. Testing suspend to RAM (STR) |
@@ -91,16 +180,25 @@ use the PM_TRACE mechanism documented in Documentation/s2ram.txt . | |||
91 | To verify that the STR works, it is generally more convenient to use the s2ram | 180 | To verify that the STR works, it is generally more convenient to use the s2ram |
92 | tool available from http://suspend.sf.net and documented at | 181 | tool available from http://suspend.sf.net and documented at |
93 | http://en.opensuse.org/s2ram . However, before doing that it is recommended to | 182 | http://en.opensuse.org/s2ram . However, before doing that it is recommended to |
94 | carry out the procedure described in section 1. | 183 | carry out STR testing using the facility described in section 1. |
95 | 184 | ||
96 | Assume you have resolved the problems with the STD and you have found some | 185 | Namely, after writing "freezer", "devices", "platform", "processors", or "core" |
97 | failing drivers. These drivers are also likely to fail during the STR or | 186 | into /sys/power/pm_test (available if the kernel is compiled with |
98 | during the resume, so it is better to unload them every time before the STR | 187 | CONFIG_PM_DEBUG set) the suspend code will work in the test mode corresponding |
99 | transition. Now, you can follow the instructions at | 188 | to given string. The STR test modes are defined in the same way as for |
100 | http://en.opensuse.org/s2ram to test the system, but if it does not work | 189 | hibernation, 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 | 190 | particular, the "core" test allows you to test everything except for the actual |
102 | s2ram in the minimal configuration. In that case, you may be able to search | 191 | invocation of the platform firmware in order to put the system into the sleep |
103 | for failing drivers by following the procedure analogous to the one described in | 192 | state. |
104 | 1b). If you find some failing drivers, you will have to unload them every time | 193 | |
105 | before the STR transition (ie. before you run s2ram), and please report the | 194 | Among other things, the testing with the help of /sys/power/pm_test may allow |
106 | problems with them. | 195 | you to identify drivers that fail to suspend or resume their devices. They |
196 | should be unloaded every time before an STR transition. | ||
197 | |||
198 | Next, you can follow the instructions at http://en.opensuse.org/s2ram to test | ||
199 | the system, but if it does not work "out of the box", you may need to boot it | ||
200 | with "init=/bin/bash" and test s2ram in the minimal configuration. In that | ||
201 | case, you may be able to search for failing drivers by following the procedure | ||
202 | analogous to the one described in section 1. If you find some failing drivers, | ||
203 | you will have to unload them every time before an STR transition (ie. before | ||
204 | you 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 | |||
502 | to shift to lower voltage settings and reduce the power cost of executing | 502 | to shift to lower voltage settings and reduce the power cost of executing |
503 | a given number of instructions. (Without voltage adjustment, it's rare | 503 | a given number of instructions. (Without voltage adjustment, it's rare |
504 | for cpufreq to save much power; the cost-per-instruction must go down.) | 504 | for cpufreq to save much power; the cost-per-instruction must go down.) |
505 | |||
506 | |||
507 | /sys/devices/.../power/state files | ||
508 | ================================== | ||
509 | For 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 | |||
517 | In each device's directory, there is a 'power' directory, which contains | ||
518 | at least a 'state' file. The value of this field is effectively boolean, | ||
519 | PM_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 | |||
531 | On writes, the PM core relies on that recorded event code and the device/bus | ||
532 | capabilities to determine whether it uses a partial suspend() or resume() | ||
533 | sequence to change things so that the recorded event corresponds to the | ||
534 | numeric 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 | |||
548 | Drivers have no way to tell whether their suspend() and resume() calls | ||
549 | have come through the sysfs power/state file or as part of entering a | ||
550 | system sleep state, except that when accessed through sysfs the normal | ||
551 | parent/child sequencing rules are ignored. Drivers (such as bus, bridge, | ||
552 | or hub drivers) which expose child devices may need to enforce those rules | ||
553 | on their own. | ||
diff --git a/Documentation/power/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 | |||
6 | Unfortunately, to effectively test the support for the system-wide suspend and | 6 | Unfortunately, to effectively test the support for the system-wide suspend and |
7 | resume transitions in a driver, it is necessary to suspend and resume a fully | 7 | resume transitions in a driver, it is necessary to suspend and resume a fully |
8 | functional system with this driver loaded. Moreover, that should be done | 8 | functional system with this driver loaded. Moreover, that should be done |
9 | several times, preferably several times in a row, and separately for the suspend | 9 | several times, preferably several times in a row, and separately for hibernation |
10 | to 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 |
11 | cases involves different ordering of operations and different interactions with | 11 | cases involves slightly different operations and different interactions with |
12 | the machine's BIOS. | 12 | the machine's BIOS. |
13 | 13 | ||
14 | Of course, for this purpose the test system has to be known to suspend and | 14 | Of 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. | |||
22 | Once you have resolved the suspend/resume-related problems with your test system | 22 | Once you have resolved the suspend/resume-related problems with your test system |
23 | without the new driver, you are ready to test it: | 23 | without the new driver, you are ready to test it: |
24 | 24 | ||
25 | a) Build the driver as a module, load it and try the STD in the test mode (see: | 25 | a) Build the driver as a module, load it and try the test modes of hibernation |
26 | Documents/power/basic-pm-debugging.txt, 1a)). | 26 | (see: Documents/power/basic-pm-debugging.txt, 1). |
27 | 27 | ||
28 | b) Load the driver and attempt to suspend to disk in the "reboot", "shutdown" | 28 | b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and |
29 | and "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). | 29 | "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). |
30 | 30 | ||
31 | c) Compile the driver directly into the kernel and try the STD in the test mode. | 31 | c) Compile the driver directly into the kernel and try the test modes of |
32 | hibernation. | ||
32 | 33 | ||
33 | d) Attempt to suspend to disk with the driver compiled directly into the kernel | 34 | d) Attempt to hibernate with the driver compiled directly into the kernel |
34 | in the "reboot", "shutdown" and "platform" modes. | 35 | in the "reboot", "shutdown" and "platform" modes. |
35 | 36 | ||
36 | e) Attempt to suspend to RAM using the s2ram tool with the driver loaded (see: | 37 | e) Try the test modes of suspend (see: Documents/power/basic-pm-debugging.txt, |
37 | Documents/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 |
38 | concerned, it should not matter whether or not the driver is built as a module. | 39 | not the driver is built as a module.] |
40 | |||
41 | f) Attempt to suspend to RAM using the s2ram tool with the driver loaded | ||
42 | (see: Documents/power/basic-pm-debugging.txt, 2). | ||
39 | 43 | ||
40 | Each of the above tests should be repeated several times and the STD tests | 44 | Each of the above tests should be repeated several times and the STD tests |
41 | should be mixed with the STR tests. If any of them fails, the driver cannot be | 45 | should 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 | ||
31 | PM_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 | |||
35 | PM_POST_RESTORE An error occurred during the hibernation restore. | ||
36 | Device drivers' .resume() callbacks have been executed | ||
37 | and tasks have been thawed. | ||
38 | |||
31 | PM_SUSPEND_PREPARE The system is preparing for a suspend. | 39 | PM_SUSPEND_PREPARE The system is preparing for a suspend. |
32 | 40 | ||
33 | PM_POST_SUSPEND The system has just resumed or an error occured during | 41 | PM_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 | ||
15 | The interface consists of a character device providing the open(), | 15 | The interface consists of a character device providing the open(), |
16 | release(), read(), and write() operations as well as several ioctl() | 16 | release(), read(), and write() operations as well as several ioctl() |
17 | commands defined in kernel/power/power.h. The major and minor | 17 | commands defined in include/linux/suspend_ioctls.h . The major and minor |
18 | numbers of the device are, respectively, 10 and 231, and they can | 18 | numbers of the device are, respectively, 10 and 231, and they can |
19 | be read from /sys/class/misc/snapshot/dev. | 19 | be read from /sys/class/misc/snapshot/dev. |
20 | 20 | ||
@@ -27,17 +27,17 @@ once at a time. | |||
27 | The ioctl() commands recognized by the device are: | 27 | The ioctl() commands recognized by the device are: |
28 | 28 | ||
29 | SNAPSHOT_FREEZE - freeze user space processes (the current process is | 29 | SNAPSHOT_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 | ||
33 | SNAPSHOT_UNFREEZE - thaw user space processes frozen by SNAPSHOT_FREEZE | 33 | SNAPSHOT_UNFREEZE - thaw user space processes frozen by SNAPSHOT_FREEZE |
34 | 34 | ||
35 | SNAPSHOT_ATOMIC_SNAPSHOT - create a snapshot of the system memory; the | 35 | SNAPSHOT_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 | ||
50 | SNAPSHOT_FREE - free memory allocated for the snapshot image | 50 | SNAPSHOT_FREE - free memory allocated for the snapshot image |
51 | 51 | ||
52 | SNAPSHOT_SET_IMAGE_SIZE - set the preferred maximum size of the image | 52 | SNAPSHOT_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 | ||
57 | SNAPSHOT_AVAIL_SWAP - return the amount of available swap in bytes (the last | 57 | SNAPSHOT_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 | |
59 | SNAPSHOT_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 | ||
61 | SNAPSHOT_GET_SWAP_PAGE - allocate a swap page from the resume partition | 63 | SNAPSHOT_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 | ||
65 | SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated with | 67 | SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated by |
66 | SNAPSHOT_GET_SWAP_PAGE | 68 | SNAPSHOT_ALLOC_SWAP_PAGE |
67 | |||
68 | SNAPSHOT_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 | ||
73 | SNAPSHOT_SET_SWAP_AREA - set the resume partition and the offset (in <PAGE_SIZE> | 70 | SNAPSHOT_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 | 78 | SNAPSHOT_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 | 81 | SNAPSHOT_POWER_OFF - make the kernel transition the system to the hibernation |
82 | state (eg. ACPI S4) using the platform (eg. ACPI) driver | ||
85 | 83 | ||
86 | SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to | 84 | SNAPSHOT_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 | ||
96 | SNAPSHOT_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 | |||
114 | The device's read() operation can be used to transfer the snapshot image from | 94 | The device's read() operation can be used to transfer the snapshot image from |
115 | the kernel. It has the following limitations: | 95 | the 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 | |||
122 | into the kernel. It has the same limitations as the read() operation. | 102 | into the kernel. It has the same limitations as the read() operation. |
123 | 103 | ||
124 | The release() operation frees all memory allocated for the snapshot image | 104 | The release() operation frees all memory allocated for the snapshot image |
125 | and all swap pages allocated with SNAPSHOT_GET_SWAP_PAGE (if any). | 105 | and all swap pages allocated with SNAPSHOT_ALLOC_SWAP_PAGE (if any). |
126 | Thus it is not necessary to use either SNAPSHOT_FREE or | 106 | Thus it is not necessary to use either SNAPSHOT_FREE or |
127 | SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also | 107 | SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also |
128 | unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are | 108 | unfreeze 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 | |||
133 | partition, or a swap file as storage space (if a swap file is used, the resume | 113 | partition, or a swap file as storage space (if a swap file is used, the resume |
134 | partition is the partition that holds this file). However, this is not really | 114 | partition is the partition that holds this file). However, this is not really |
135 | required, as they can use, for example, a special (blank) suspend partition or | 115 | required, as they can use, for example, a special (blank) suspend partition or |
136 | a file on a partition that is unmounted before SNAPSHOT_ATOMIC_SNAPSHOT and | 116 | a file on a partition that is unmounted before SNAPSHOT_CREATE_IMAGE and |
137 | mounted afterwards. | 117 | mounted afterwards. |
138 | 118 | ||
139 | These utilities SHOULD NOT make any assumptions regarding the ordering of | 119 | These utilities MUST NOT make any assumptions regarding the ordering of |
140 | data within the snapshot image, except for the image header that MAY be | 120 | data within the snapshot image. The contents of the image are entirely owned |
141 | assumed to start with an swsusp_info structure, as specified in | 121 | by the kernel and its structure may be changed in future kernel releases. |
142 | kernel/power/power.h. This structure MAY be used by the userland utilities | ||
143 | to obtain some information about the snapshot image, such as the size | ||
144 | of the snapshot image, including the metadata and the header itself, | ||
145 | contained in the .size member of swsusp_info. | ||
146 | 122 | ||
147 | The snapshot image MUST be written to the kernel unaltered (ie. all of the image | 123 | The snapshot image MUST be written to the kernel unaltered (ie. all of the image |
148 | data, metadata and header MUST be written in _exactly_ the same amount, form | 124 | data, 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. | |||
159 | The suspending and resuming utilities MUST lock themselves in memory, | 135 | The suspending and resuming utilities MUST lock themselves in memory, |
160 | preferrably using mlockall(), before calling SNAPSHOT_FREEZE. | 136 | preferrably using mlockall(), before calling SNAPSHOT_FREEZE. |
161 | 137 | ||
162 | The suspending utility MUST check the value stored by SNAPSHOT_ATOMIC_SNAPSHOT | 138 | The suspending utility MUST check the value stored by SNAPSHOT_CREATE_IMAGE |
163 | in the memory location pointed to by the last argument of ioctl() and proceed | 139 | in the memory location pointed to by the last argument of ioctl() and proceed |
164 | in accordance with it: | 140 | in accordance with it: |
165 | 1. If the value is 1 (ie. the system memory snapshot has just been | 141 | 1. 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. | |||
87 | Battery driver also can use this attribute just to inform userspace | 87 | Battery driver also can use this attribute just to inform userspace |
88 | about maximal and minimal voltage thresholds of a given battery. | 88 | about maximal and minimal voltage thresholds of a given battery. |
89 | 89 | ||
90 | VOLTAGE_MAX, VOLTAGE_MIN - same as _DESIGN voltage values except that | ||
91 | these ones should be used if hardware could only guess (measure and | ||
92 | retain) the thresholds of a given power supply. | ||
93 | |||
90 | CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when | 94 | CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when |
91 | battery considered full/empty. | 95 | battery considered full/empty. |
92 | 96 | ||
@@ -100,8 +104,6 @@ age)". I.e. these attributes represents real thresholds, not design values. | |||
100 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. | 104 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. |
101 | 105 | ||
102 | CAPACITY - capacity in percents. | 106 | CAPACITY - capacity in percents. |
103 | CAPACITY_LEVEL - capacity level. This corresponds to | ||
104 | POWER_SUPPLY_CAPACITY_LEVEL_*. | ||
105 | 107 | ||
106 | TEMP - temperature of the power supply. | 108 | TEMP - temperature of the power supply. |
107 | TEMP_AMBIENT - ambient temperature. | 109 | TEMP_AMBIENT - ambient temperature. |
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX index 94a3c577b083..3be84aa38dfe 100644 --- a/Documentation/powerpc/00-INDEX +++ b/Documentation/powerpc/00-INDEX | |||
@@ -28,3 +28,6 @@ sound.txt | |||
28 | - info on sound support under Linux/PPC | 28 | - info on sound support under Linux/PPC |
29 | zImage_layout.txt | 29 | zImage_layout.txt |
30 | - info on the kernel images for Linux/PPC | 30 | - info on the kernel images for Linux/PPC |
31 | qe_firmware.txt | ||
32 | - describes the layout of firmware binaries for the Freescale QUICC | ||
33 | Engine and the code that parses and uploads the microcode therein. | ||
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index ac1be25c1e25..b5e46efeba84 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
@@ -52,7 +52,11 @@ Table of Contents | |||
52 | i) Freescale QUICC Engine module (QE) | 52 | i) Freescale QUICC Engine module (QE) |
53 | j) CFI or JEDEC memory-mapped NOR flash | 53 | j) CFI or JEDEC memory-mapped NOR flash |
54 | k) Global Utilities Block | 54 | k) Global Utilities Block |
55 | l) Xilinx IP cores | 55 | l) Freescale Communications Processor Module |
56 | m) Chipselect/Local Bus | ||
57 | n) 4xx/Axon EMAC ethernet nodes | ||
58 | o) Xilinx IP cores | ||
59 | p) Freescale Synchronous Serial Interface | ||
56 | 60 | ||
57 | VII - Specifying interrupt information for devices | 61 | VII - Specifying interrupt information for devices |
58 | 1) interrupts property | 62 | 1) interrupts property |
@@ -671,10 +675,10 @@ device or bus to be described by the device tree. | |||
671 | 675 | ||
672 | In general, the format of an address for a device is defined by the | 676 | In general, the format of an address for a device is defined by the |
673 | parent bus type, based on the #address-cells and #size-cells | 677 | parent bus type, based on the #address-cells and #size-cells |
674 | property. In the absence of such a property, the parent's parent | 678 | properties. Note that the parent's parent definitions of #address-cells |
675 | values are used, etc... The kernel requires the root node to have | 679 | and #size-cells are not inhereted so every node with children must specify |
676 | those properties defining addresses format for devices directly mapped | 680 | them. The kernel requires the root node to have those properties defining |
677 | on the processor bus. | 681 | addresses format for devices directly mapped on the processor bus. |
678 | 682 | ||
679 | Those 2 properties define 'cells' for representing an address and a | 683 | Those 2 properties define 'cells' for representing an address and a |
680 | size. A "cell" is a 32-bit number. For example, if both contain 2 | 684 | size. A "cell" is a 32-bit number. For example, if both contain 2 |
@@ -711,13 +715,14 @@ define a bus type with a more complex address format, including things | |||
711 | like address space bits, you'll have to add a bus translator to the | 715 | like address space bits, you'll have to add a bus translator to the |
712 | prom_parse.c file of the recent kernels for your bus type. | 716 | prom_parse.c file of the recent kernels for your bus type. |
713 | 717 | ||
714 | The "reg" property only defines addresses and sizes (if #size-cells | 718 | The "reg" property only defines addresses and sizes (if #size-cells is |
715 | is non-0) within a given bus. In order to translate addresses upward | 719 | non-0) within a given bus. In order to translate addresses upward |
716 | (that is into parent bus addresses, and possibly into CPU physical | 720 | (that is into parent bus addresses, and possibly into CPU physical |
717 | addresses), all busses must contain a "ranges" property. If the | 721 | addresses), all busses must contain a "ranges" property. If the |
718 | "ranges" property is missing at a given level, it's assumed that | 722 | "ranges" property is missing at a given level, it's assumed that |
719 | translation isn't possible. The format of the "ranges" property for a | 723 | translation isn't possible, i.e., the registers are not visible on the |
720 | bus is a list of: | 724 | parent bus. The format of the "ranges" property for a bus is a list |
725 | of: | ||
721 | 726 | ||
722 | bus address, parent bus address, size | 727 | bus address, parent bus address, size |
723 | 728 | ||
@@ -735,6 +740,10 @@ fit in a single 32-bit word. New 32-bit powerpc boards should use a | |||
735 | 1/1 format, unless the processor supports physical addresses greater | 740 | 1/1 format, unless the processor supports physical addresses greater |
736 | than 32-bits, in which case a 2/1 format is recommended. | 741 | than 32-bits, in which case a 2/1 format is recommended. |
737 | 742 | ||
743 | Alternatively, the "ranges" property may be empty, indicating that the | ||
744 | registers are visible on the parent bus using an identity mapping | ||
745 | translation. In other words, the parent bus address space is the same | ||
746 | as the child bus address space. | ||
738 | 747 | ||
739 | 2) Note about "compatible" properties | 748 | 2) Note about "compatible" properties |
740 | ------------------------------------- | 749 | ------------------------------------- |
@@ -1218,16 +1227,14 @@ platforms are moved over to use the flattened-device-tree model. | |||
1218 | 1227 | ||
1219 | Required properties: | 1228 | Required properties: |
1220 | - reg : Offset and length of the register set for the device | 1229 | - reg : Offset and length of the register set for the device |
1221 | - device_type : Should be "mdio" | ||
1222 | - compatible : Should define the compatible device type for the | 1230 | - compatible : Should define the compatible device type for the |
1223 | mdio. Currently, this is most likely to be "gianfar" | 1231 | mdio. Currently, this is most likely to be "fsl,gianfar-mdio" |
1224 | 1232 | ||
1225 | Example: | 1233 | Example: |
1226 | 1234 | ||
1227 | mdio@24520 { | 1235 | mdio@24520 { |
1228 | reg = <24520 20>; | 1236 | reg = <24520 20>; |
1229 | device_type = "mdio"; | 1237 | compatible = "fsl,gianfar-mdio"; |
1230 | compatible = "gianfar"; | ||
1231 | 1238 | ||
1232 | ethernet-phy@0 { | 1239 | ethernet-phy@0 { |
1233 | ...... | 1240 | ...... |
@@ -1254,6 +1261,10 @@ platforms are moved over to use the flattened-device-tree model. | |||
1254 | services interrupts for this device. | 1261 | services interrupts for this device. |
1255 | - phy-handle : The phandle for the PHY connected to this ethernet | 1262 | - phy-handle : The phandle for the PHY connected to this ethernet |
1256 | controller. | 1263 | controller. |
1264 | - fixed-link : <a b c d e> where a is emulated phy id - choose any, | ||
1265 | but unique to the all specified fixed-links, b is duplex - 0 half, | ||
1266 | 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no | ||
1267 | pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause. | ||
1257 | 1268 | ||
1258 | Recommended properties: | 1269 | Recommended properties: |
1259 | 1270 | ||
@@ -1408,7 +1419,6 @@ platforms are moved over to use the flattened-device-tree model. | |||
1408 | 1419 | ||
1409 | Example multi port host USB controller device node : | 1420 | Example multi port host USB controller device node : |
1410 | usb@22000 { | 1421 | usb@22000 { |
1411 | device_type = "usb"; | ||
1412 | compatible = "fsl-usb2-mph"; | 1422 | compatible = "fsl-usb2-mph"; |
1413 | reg = <22000 1000>; | 1423 | reg = <22000 1000>; |
1414 | #address-cells = <1>; | 1424 | #address-cells = <1>; |
@@ -1422,7 +1432,6 @@ platforms are moved over to use the flattened-device-tree model. | |||
1422 | 1432 | ||
1423 | Example dual role USB controller device node : | 1433 | Example dual role USB controller device node : |
1424 | usb@23000 { | 1434 | usb@23000 { |
1425 | device_type = "usb"; | ||
1426 | compatible = "fsl-usb2-dr"; | 1435 | compatible = "fsl-usb2-dr"; |
1427 | reg = <23000 1000>; | 1436 | reg = <23000 1000>; |
1428 | #address-cells = <1>; | 1437 | #address-cells = <1>; |
@@ -1534,7 +1543,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1534 | i) Root QE device | 1543 | i) Root QE device |
1535 | 1544 | ||
1536 | Required properties: | 1545 | Required properties: |
1537 | - device_type : should be "qe"; | 1546 | - compatible : should be "fsl,qe"; |
1538 | - model : precise model of the QE, Can be "QE", "CPM", or "CPM2" | 1547 | - model : precise model of the QE, Can be "QE", "CPM", or "CPM2" |
1539 | - reg : offset and length of the device registers. | 1548 | - reg : offset and length of the device registers. |
1540 | - bus-frequency : the clock frequency for QUICC Engine. | 1549 | - bus-frequency : the clock frequency for QUICC Engine. |
@@ -1548,8 +1557,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1548 | #address-cells = <1>; | 1557 | #address-cells = <1>; |
1549 | #size-cells = <1>; | 1558 | #size-cells = <1>; |
1550 | #interrupt-cells = <2>; | 1559 | #interrupt-cells = <2>; |
1551 | device_type = "qe"; | 1560 | compatible = "fsl,qe"; |
1552 | model = "QE"; | ||
1553 | ranges = <0 e0100000 00100000>; | 1561 | ranges = <0 e0100000 00100000>; |
1554 | reg = <e0100000 480>; | 1562 | reg = <e0100000 480>; |
1555 | brg-frequency = <0>; | 1563 | brg-frequency = <0>; |
@@ -1560,8 +1568,8 @@ platforms are moved over to use the flattened-device-tree model. | |||
1560 | ii) SPI (Serial Peripheral Interface) | 1568 | ii) SPI (Serial Peripheral Interface) |
1561 | 1569 | ||
1562 | Required properties: | 1570 | Required properties: |
1563 | - device_type : should be "spi". | 1571 | - cell-index : SPI controller index. |
1564 | - compatible : should be "fsl_spi". | 1572 | - compatible : should be "fsl,spi". |
1565 | - mode : the SPI operation mode, it can be "cpu" or "cpu-qe". | 1573 | - mode : the SPI operation mode, it can be "cpu" or "cpu-qe". |
1566 | - reg : Offset and length of the register set for the device | 1574 | - reg : Offset and length of the register set for the device |
1567 | - interrupts : <a b> where a is the interrupt number and b is a | 1575 | - interrupts : <a b> where a is the interrupt number and b is a |
@@ -1574,8 +1582,8 @@ platforms are moved over to use the flattened-device-tree model. | |||
1574 | 1582 | ||
1575 | Example: | 1583 | Example: |
1576 | spi@4c0 { | 1584 | spi@4c0 { |
1577 | device_type = "spi"; | 1585 | cell-index = <0>; |
1578 | compatible = "fsl_spi"; | 1586 | compatible = "fsl,spi"; |
1579 | reg = <4c0 40>; | 1587 | reg = <4c0 40>; |
1580 | interrupts = <82 0>; | 1588 | interrupts = <82 0>; |
1581 | interrupt-parent = <700>; | 1589 | interrupt-parent = <700>; |
@@ -1586,7 +1594,6 @@ platforms are moved over to use the flattened-device-tree model. | |||
1586 | iii) USB (Universal Serial Bus Controller) | 1594 | iii) USB (Universal Serial Bus Controller) |
1587 | 1595 | ||
1588 | Required properties: | 1596 | Required properties: |
1589 | - device_type : should be "usb". | ||
1590 | - compatible : could be "qe_udc" or "fhci-hcd". | 1597 | - compatible : could be "qe_udc" or "fhci-hcd". |
1591 | - mode : the could be "host" or "slave". | 1598 | - mode : the could be "host" or "slave". |
1592 | - reg : Offset and length of the register set for the device | 1599 | - reg : Offset and length of the register set for the device |
@@ -1600,7 +1607,6 @@ platforms are moved over to use the flattened-device-tree model. | |||
1600 | 1607 | ||
1601 | Example(slave): | 1608 | Example(slave): |
1602 | usb@6c0 { | 1609 | usb@6c0 { |
1603 | device_type = "usb"; | ||
1604 | compatible = "qe_udc"; | 1610 | compatible = "qe_udc"; |
1605 | reg = <6c0 40>; | 1611 | reg = <6c0 40>; |
1606 | interrupts = <8b 0>; | 1612 | interrupts = <8b 0>; |
@@ -1613,7 +1619,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1613 | 1619 | ||
1614 | Required properties: | 1620 | Required properties: |
1615 | - device_type : should be "network", "hldc", "uart", "transparent" | 1621 | - device_type : should be "network", "hldc", "uart", "transparent" |
1616 | "bisync" or "atm". | 1622 | "bisync", "atm", or "serial". |
1617 | - compatible : could be "ucc_geth" or "fsl_atm" and so on. | 1623 | - compatible : could be "ucc_geth" or "fsl_atm" and so on. |
1618 | - model : should be "UCC". | 1624 | - model : should be "UCC". |
1619 | - device-id : the ucc number(1-8), corresponding to UCCx in UM. | 1625 | - device-id : the ucc number(1-8), corresponding to UCCx in UM. |
@@ -1626,6 +1632,26 @@ platforms are moved over to use the flattened-device-tree model. | |||
1626 | - interrupt-parent : the phandle for the interrupt controller that | 1632 | - interrupt-parent : the phandle for the interrupt controller that |
1627 | services interrupts for this device. | 1633 | services interrupts for this device. |
1628 | - pio-handle : The phandle for the Parallel I/O port configuration. | 1634 | - pio-handle : The phandle for the Parallel I/O port configuration. |
1635 | - port-number : for UART drivers, the port number to use, between 0 and 3. | ||
1636 | This usually corresponds to the /dev/ttyQE device, e.g. <0> = /dev/ttyQE0. | ||
1637 | The port number is added to the minor number of the device. Unlike the | ||
1638 | CPM UART driver, the port-number is required for the QE UART driver. | ||
1639 | - soft-uart : for UART drivers, if specified this means the QE UART device | ||
1640 | driver should use "Soft-UART" mode, which is needed on some SOCs that have | ||
1641 | broken UART hardware. Soft-UART is provided via a microcode upload. | ||
1642 | - rx-clock-name: the UCC receive clock source | ||
1643 | "none": clock source is disabled | ||
1644 | "brg1" through "brg16": clock source is BRG1-BRG16, respectively | ||
1645 | "clk1" through "clk24": clock source is CLK1-CLK24, respectively | ||
1646 | - tx-clock-name: the UCC transmit clock source | ||
1647 | "none": clock source is disabled | ||
1648 | "brg1" through "brg16": clock source is BRG1-BRG16, respectively | ||
1649 | "clk1" through "clk24": clock source is CLK1-CLK24, respectively | ||
1650 | The following two properties are deprecated. rx-clock has been replaced | ||
1651 | with rx-clock-name, and tx-clock has been replaced with tx-clock-name. | ||
1652 | Drivers that currently use the deprecated properties should continue to | ||
1653 | do so, in order to support older device trees, but they should be updated | ||
1654 | to check for the new properties first. | ||
1629 | - rx-clock : represents the UCC receive clock source. | 1655 | - rx-clock : represents the UCC receive clock source. |
1630 | 0x00 : clock source is disabled; | 1656 | 0x00 : clock source is disabled; |
1631 | 0x1~0x10 : clock source is BRG1~BRG16 respectively; | 1657 | 0x1~0x10 : clock source is BRG1~BRG16 respectively; |
@@ -1645,8 +1671,9 @@ platforms are moved over to use the flattened-device-tree model. | |||
1645 | MAC addresses passed by the firmware when no information other | 1671 | MAC addresses passed by the firmware when no information other |
1646 | than indices is available to associate an address with a device. | 1672 | than indices is available to associate an address with a device. |
1647 | - phy-connection-type : a string naming the controller/PHY interface type, | 1673 | - phy-connection-type : a string naming the controller/PHY interface type, |
1648 | i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "tbi", | 1674 | i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id" (Internal |
1649 | or "rtbi". | 1675 | Delay), "rgmii-txid" (delay on TX only), "rgmii-rxid" (delay on RX only), |
1676 | "tbi", or "rtbi". | ||
1650 | 1677 | ||
1651 | Example: | 1678 | Example: |
1652 | ucc@2000 { | 1679 | ucc@2000 { |
@@ -1753,7 +1780,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1753 | vii) Multi-User RAM (MURAM) | 1780 | vii) Multi-User RAM (MURAM) |
1754 | 1781 | ||
1755 | Required properties: | 1782 | Required properties: |
1756 | - device_type : should be "muram". | 1783 | - compatible : should be "fsl,qe-muram", "fsl,cpm-muram". |
1757 | - mode : the could be "host" or "slave". | 1784 | - mode : the could be "host" or "slave". |
1758 | - ranges : Should be defined as specified in 1) to describe the | 1785 | - ranges : Should be defined as specified in 1) to describe the |
1759 | translation of MURAM addresses. | 1786 | translation of MURAM addresses. |
@@ -1763,14 +1790,42 @@ platforms are moved over to use the flattened-device-tree model. | |||
1763 | Example: | 1790 | Example: |
1764 | 1791 | ||
1765 | muram@10000 { | 1792 | muram@10000 { |
1766 | device_type = "muram"; | 1793 | compatible = "fsl,qe-muram", "fsl,cpm-muram"; |
1767 | ranges = <0 00010000 0000c000>; | 1794 | ranges = <0 00010000 0000c000>; |
1768 | 1795 | ||
1769 | data-only@0{ | 1796 | data-only@0{ |
1797 | compatible = "fsl,qe-muram-data", | ||
1798 | "fsl,cpm-muram-data"; | ||
1770 | reg = <0 c000>; | 1799 | reg = <0 c000>; |
1771 | }; | 1800 | }; |
1772 | }; | 1801 | }; |
1773 | 1802 | ||
1803 | viii) Uploaded QE firmware | ||
1804 | |||
1805 | If a new firwmare has been uploaded to the QE (usually by the | ||
1806 | boot loader), then a 'firmware' child node should be added to the QE | ||
1807 | node. This node provides information on the uploaded firmware that | ||
1808 | device drivers may need. | ||
1809 | |||
1810 | Required properties: | ||
1811 | - id: The string name of the firmware. This is taken from the 'id' | ||
1812 | member of the qe_firmware structure of the uploaded firmware. | ||
1813 | Device drivers can search this string to determine if the | ||
1814 | firmware they want is already present. | ||
1815 | - extended-modes: The Extended Modes bitfield, taken from the | ||
1816 | firmware binary. It is a 64-bit number represented | ||
1817 | as an array of two 32-bit numbers. | ||
1818 | - virtual-traps: The virtual traps, taken from the firmware binary. | ||
1819 | It is an array of 8 32-bit numbers. | ||
1820 | |||
1821 | Example: | ||
1822 | |||
1823 | firmware { | ||
1824 | id = "Soft-UART"; | ||
1825 | extended-modes = <0 0>; | ||
1826 | virtual-traps = <0 0 0 0 0 0 0 0>; | ||
1827 | } | ||
1828 | |||
1774 | j) CFI or JEDEC memory-mapped NOR flash | 1829 | j) CFI or JEDEC memory-mapped NOR flash |
1775 | 1830 | ||
1776 | Flash chips (Memory Technology Devices) are often used for solid state | 1831 | Flash chips (Memory Technology Devices) are often used for solid state |
@@ -2074,8 +2129,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
2074 | 2129 | ||
2075 | Example: | 2130 | Example: |
2076 | localbus@f0010100 { | 2131 | localbus@f0010100 { |
2077 | compatible = "fsl,mpc8272ads-localbus", | 2132 | compatible = "fsl,mpc8272-localbus", |
2078 | "fsl,mpc8272-localbus", | ||
2079 | "fsl,pq2-localbus"; | 2133 | "fsl,pq2-localbus"; |
2080 | #address-cells = <2>; | 2134 | #address-cells = <2>; |
2081 | #size-cells = <1>; | 2135 | #size-cells = <1>; |
@@ -2253,7 +2307,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
2253 | available. | 2307 | available. |
2254 | For Axon: 0x0000012a | 2308 | For Axon: 0x0000012a |
2255 | 2309 | ||
2256 | l) Xilinx IP cores | 2310 | o) Xilinx IP cores |
2257 | 2311 | ||
2258 | The Xilinx EDK toolchain ships with a set of IP cores (devices) for use | 2312 | The Xilinx EDK toolchain ships with a set of IP cores (devices) for use |
2259 | in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range | 2313 | in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range |
@@ -2275,7 +2329,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
2275 | properties of the device node. In general, device nodes for IP-cores | 2329 | properties of the device node. In general, device nodes for IP-cores |
2276 | will take the following form: | 2330 | will take the following form: |
2277 | 2331 | ||
2278 | (name)@(base-address) { | 2332 | (name): (generic-name)@(base-address) { |
2279 | compatible = "xlnx,(ip-core-name)-(HW_VER)" | 2333 | compatible = "xlnx,(ip-core-name)-(HW_VER)" |
2280 | [, (list of compatible devices), ...]; | 2334 | [, (list of compatible devices), ...]; |
2281 | reg = <(baseaddr) (size)>; | 2335 | reg = <(baseaddr) (size)>; |
@@ -2285,6 +2339,9 @@ platforms are moved over to use the flattened-device-tree model. | |||
2285 | xlnx,(parameter2) = <(int-value)>; | 2339 | xlnx,(parameter2) = <(int-value)>; |
2286 | }; | 2340 | }; |
2287 | 2341 | ||
2342 | (generic-name): an open firmware-style name that describes the | ||
2343 | generic class of device. Preferably, this is one word, such | ||
2344 | as 'serial' or 'ethernet'. | ||
2288 | (ip-core-name): the name of the ip block (given after the BEGIN | 2345 | (ip-core-name): the name of the ip block (given after the BEGIN |
2289 | directive in system.mhs). Should be in lowercase | 2346 | directive in system.mhs). Should be in lowercase |
2290 | and all underscores '_' converted to dashes '-'. | 2347 | and all underscores '_' converted to dashes '-'. |
@@ -2293,9 +2350,9 @@ platforms are moved over to use the flattened-device-tree model. | |||
2293 | dropped from the parameter name, the name is converted | 2350 | dropped from the parameter name, the name is converted |
2294 | to lowercase and all underscore '_' characters are | 2351 | to lowercase and all underscore '_' characters are |
2295 | converted to dashes '-'. | 2352 | converted to dashes '-'. |
2296 | (baseaddr): the C_BASEADDR parameter. | 2353 | (baseaddr): the baseaddr parameter value (often named C_BASEADDR). |
2297 | (HW_VER): from the HW_VER parameter. | 2354 | (HW_VER): from the HW_VER parameter. |
2298 | (size): equals C_HIGHADDR - C_BASEADDR + 1 | 2355 | (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1). |
2299 | 2356 | ||
2300 | Typically, the compatible list will include the exact IP core version | 2357 | Typically, the compatible list will include the exact IP core version |
2301 | followed by an older IP core version which implements the same | 2358 | followed by an older IP core version which implements the same |
@@ -2325,11 +2382,11 @@ platforms are moved over to use the flattened-device-tree model. | |||
2325 | 2382 | ||
2326 | becomes the following device tree node: | 2383 | becomes the following device tree node: |
2327 | 2384 | ||
2328 | opb-uartlite-0@ec100000 { | 2385 | opb_uartlite_0: serial@ec100000 { |
2329 | device_type = "serial"; | 2386 | device_type = "serial"; |
2330 | compatible = "xlnx,opb-uartlite-1.00.b"; | 2387 | compatible = "xlnx,opb-uartlite-1.00.b"; |
2331 | reg = <ec100000 10000>; | 2388 | reg = <ec100000 10000>; |
2332 | interrupt-parent = <&opb-intc>; | 2389 | interrupt-parent = <&opb_intc_0>; |
2333 | interrupts = <1 0>; // got this from the opb_intc parameters | 2390 | interrupts = <1 0>; // got this from the opb_intc parameters |
2334 | current-speed = <d#115200>; // standard serial device prop | 2391 | current-speed = <d#115200>; // standard serial device prop |
2335 | clock-frequency = <d#50000000>; // standard serial device prop | 2392 | clock-frequency = <d#50000000>; // standard serial device prop |
@@ -2338,16 +2395,19 @@ platforms are moved over to use the flattened-device-tree model. | |||
2338 | xlnx,use-parity = <0>; | 2395 | xlnx,use-parity = <0>; |
2339 | }; | 2396 | }; |
2340 | 2397 | ||
2341 | Some IP cores actually implement 2 or more logical devices. In this case, | 2398 | Some IP cores actually implement 2 or more logical devices. In |
2342 | the device should still describe the whole IP core with a single node | 2399 | this case, the device should still describe the whole IP core with |
2343 | and add a child node for each logical device. The ranges property can | 2400 | a single node and add a child node for each logical device. The |
2344 | be used to translate from parent IP-core to the registers of each device. | 2401 | ranges property can be used to translate from parent IP-core to the |
2345 | (Note: this makes the assumption that both logical devices have the same | 2402 | registers of each device. In addition, the parent node should be |
2346 | bus binding. If this is not true, then separate nodes should be used for | 2403 | compatible with the bus type 'xlnx,compound', and should contain |
2347 | each logical device). The 'cell-index' property can be used to enumerate | 2404 | #address-cells and #size-cells, as with any other bus. (Note: this |
2348 | logical devices within an IP core. For example, the following is the | 2405 | makes the assumption that both logical devices have the same bus |
2349 | system.mhs entry for the dual ps2 controller found on the ml403 reference | 2406 | binding. If this is not true, then separate nodes should be used |
2350 | design. | 2407 | for each logical device). The 'cell-index' property can be used to |
2408 | enumerate logical devices within an IP core. For example, the | ||
2409 | following is the system.mhs entry for the dual ps2 controller found | ||
2410 | on the ml403 reference design. | ||
2351 | 2411 | ||
2352 | BEGIN opb_ps2_dual_ref | 2412 | BEGIN opb_ps2_dual_ref |
2353 | PARAMETER INSTANCE = opb_ps2_dual_ref_0 | 2413 | PARAMETER INSTANCE = opb_ps2_dual_ref_0 |
@@ -2369,21 +2429,24 @@ platforms are moved over to use the flattened-device-tree model. | |||
2369 | 2429 | ||
2370 | It would result in the following device tree nodes: | 2430 | It would result in the following device tree nodes: |
2371 | 2431 | ||
2372 | opb_ps2_dual_ref_0@a9000000 { | 2432 | opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 { |
2433 | #address-cells = <1>; | ||
2434 | #size-cells = <1>; | ||
2435 | compatible = "xlnx,compound"; | ||
2373 | ranges = <0 a9000000 2000>; | 2436 | ranges = <0 a9000000 2000>; |
2374 | // If this device had extra parameters, then they would | 2437 | // If this device had extra parameters, then they would |
2375 | // go here. | 2438 | // go here. |
2376 | ps2@0 { | 2439 | ps2@0 { |
2377 | compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; | 2440 | compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; |
2378 | reg = <0 40>; | 2441 | reg = <0 40>; |
2379 | interrupt-parent = <&opb-intc>; | 2442 | interrupt-parent = <&opb_intc_0>; |
2380 | interrupts = <3 0>; | 2443 | interrupts = <3 0>; |
2381 | cell-index = <0>; | 2444 | cell-index = <0>; |
2382 | }; | 2445 | }; |
2383 | ps2@1000 { | 2446 | ps2@1000 { |
2384 | compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; | 2447 | compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; |
2385 | reg = <1000 40>; | 2448 | reg = <1000 40>; |
2386 | interrupt-parent = <&opb-intc>; | 2449 | interrupt-parent = <&opb_intc_0>; |
2387 | interrupts = <3 0>; | 2450 | interrupts = <3 0>; |
2388 | cell-index = <0>; | 2451 | cell-index = <0>; |
2389 | }; | 2452 | }; |
@@ -2446,17 +2509,18 @@ platforms are moved over to use the flattened-device-tree model. | |||
2446 | 2509 | ||
2447 | Gives this device tree (some properties removed for clarity): | 2510 | Gives this device tree (some properties removed for clarity): |
2448 | 2511 | ||
2449 | plb-v34-0 { | 2512 | plb@0 { |
2450 | #address-cells = <1>; | 2513 | #address-cells = <1>; |
2451 | #size-cells = <1>; | 2514 | #size-cells = <1>; |
2515 | compatible = "xlnx,plb-v34-1.02.a"; | ||
2452 | device_type = "ibm,plb"; | 2516 | device_type = "ibm,plb"; |
2453 | ranges; // 1:1 translation | 2517 | ranges; // 1:1 translation |
2454 | 2518 | ||
2455 | plb-bram-if-cntrl-0@ffff0000 { | 2519 | plb_bram_if_cntrl_0: bram@ffff0000 { |
2456 | reg = <ffff0000 10000>; | 2520 | reg = <ffff0000 10000>; |
2457 | } | 2521 | } |
2458 | 2522 | ||
2459 | opb-v20-0 { | 2523 | opb@20000000 { |
2460 | #address-cells = <1>; | 2524 | #address-cells = <1>; |
2461 | #size-cells = <1>; | 2525 | #size-cells = <1>; |
2462 | ranges = <20000000 20000000 20000000 | 2526 | ranges = <20000000 20000000 20000000 |
@@ -2464,11 +2528,11 @@ platforms are moved over to use the flattened-device-tree model. | |||
2464 | 80000000 80000000 40000000 | 2528 | 80000000 80000000 40000000 |
2465 | c0000000 c0000000 20000000>; | 2529 | c0000000 c0000000 20000000>; |
2466 | 2530 | ||
2467 | opb-uart16550-0@a0000000 { | 2531 | opb_uart16550_0: serial@a0000000 { |
2468 | reg = <a00000000 2000>; | 2532 | reg = <a00000000 2000>; |
2469 | }; | 2533 | }; |
2470 | 2534 | ||
2471 | opb-intc-0@d1000fc0 { | 2535 | opb_intc_0: interrupt-controller@d1000fc0 { |
2472 | reg = <d1000fc0 20>; | 2536 | reg = <d1000fc0 20>; |
2473 | }; | 2537 | }; |
2474 | }; | 2538 | }; |
@@ -2513,6 +2577,204 @@ platforms are moved over to use the flattened-device-tree model. | |||
2513 | Requred properties: | 2577 | Requred properties: |
2514 | - current-speed : Baud rate of uartlite | 2578 | - current-speed : Baud rate of uartlite |
2515 | 2579 | ||
2580 | p) Freescale Synchronous Serial Interface | ||
2581 | |||
2582 | The SSI is a serial device that communicates with audio codecs. It can | ||
2583 | be programmed in AC97, I2S, left-justified, or right-justified modes. | ||
2584 | |||
2585 | Required properties: | ||
2586 | - compatible : compatible list, containing "fsl,ssi" | ||
2587 | - cell-index : the SSI, <0> = SSI1, <1> = SSI2, and so on | ||
2588 | - reg : offset and length of the register set for the device | ||
2589 | - interrupts : <a b> where a is the interrupt number and b is a | ||
2590 | field that represents an encoding of the sense and | ||
2591 | level information for the interrupt. This should be | ||
2592 | encoded based on the information in section 2) | ||
2593 | depending on the type of interrupt controller you | ||
2594 | have. | ||
2595 | - interrupt-parent : the phandle for the interrupt controller that | ||
2596 | services interrupts for this device. | ||
2597 | - fsl,mode : the operating mode for the SSI interface | ||
2598 | "i2s-slave" - I2S mode, SSI is clock slave | ||
2599 | "i2s-master" - I2S mode, SSI is clock master | ||
2600 | "lj-slave" - left-justified mode, SSI is clock slave | ||
2601 | "lj-master" - l.j. mode, SSI is clock master | ||
2602 | "rj-slave" - right-justified mode, SSI is clock slave | ||
2603 | "rj-master" - r.j., SSI is clock master | ||
2604 | "ac97-slave" - AC97 mode, SSI is clock slave | ||
2605 | "ac97-master" - AC97 mode, SSI is clock master | ||
2606 | |||
2607 | Optional properties: | ||
2608 | - codec-handle : phandle to a 'codec' node that defines an audio | ||
2609 | codec connected to this SSI. This node is typically | ||
2610 | a child of an I2C or other control node. | ||
2611 | |||
2612 | Child 'codec' node required properties: | ||
2613 | - compatible : compatible list, contains the name of the codec | ||
2614 | |||
2615 | Child 'codec' node optional properties: | ||
2616 | - clock-frequency : The frequency of the input clock, which typically | ||
2617 | comes from an on-board dedicated oscillator. | ||
2618 | |||
2619 | * Freescale 83xx DMA Controller | ||
2620 | |||
2621 | Freescale PowerPC 83xx have on chip general purpose DMA controllers. | ||
2622 | |||
2623 | Required properties: | ||
2624 | |||
2625 | - compatible : compatible list, contains 2 entries, first is | ||
2626 | "fsl,CHIP-dma", where CHIP is the processor | ||
2627 | (mpc8349, mpc8360, etc.) and the second is | ||
2628 | "fsl,elo-dma" | ||
2629 | - reg : <registers mapping for DMA general status reg> | ||
2630 | - ranges : Should be defined as specified in 1) to describe the | ||
2631 | DMA controller channels. | ||
2632 | - cell-index : controller index. 0 for controller @ 0x8100 | ||
2633 | - interrupts : <interrupt mapping for DMA IRQ> | ||
2634 | - interrupt-parent : optional, if needed for interrupt mapping | ||
2635 | |||
2636 | |||
2637 | - DMA channel nodes: | ||
2638 | - compatible : compatible list, contains 2 entries, first is | ||
2639 | "fsl,CHIP-dma-channel", where CHIP is the processor | ||
2640 | (mpc8349, mpc8350, etc.) and the second is | ||
2641 | "fsl,elo-dma-channel" | ||
2642 | - reg : <registers mapping for channel> | ||
2643 | - cell-index : dma channel index starts at 0. | ||
2644 | |||
2645 | Optional properties: | ||
2646 | - interrupts : <interrupt mapping for DMA channel IRQ> | ||
2647 | (on 83xx this is expected to be identical to | ||
2648 | the interrupts property of the parent node) | ||
2649 | - interrupt-parent : optional, if needed for interrupt mapping | ||
2650 | |||
2651 | Example: | ||
2652 | dma@82a8 { | ||
2653 | #address-cells = <1>; | ||
2654 | #size-cells = <1>; | ||
2655 | compatible = "fsl,mpc8349-dma", "fsl,elo-dma"; | ||
2656 | reg = <82a8 4>; | ||
2657 | ranges = <0 8100 1a4>; | ||
2658 | interrupt-parent = <&ipic>; | ||
2659 | interrupts = <47 8>; | ||
2660 | cell-index = <0>; | ||
2661 | dma-channel@0 { | ||
2662 | compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; | ||
2663 | cell-index = <0>; | ||
2664 | reg = <0 80>; | ||
2665 | }; | ||
2666 | dma-channel@80 { | ||
2667 | compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; | ||
2668 | cell-index = <1>; | ||
2669 | reg = <80 80>; | ||
2670 | }; | ||
2671 | dma-channel@100 { | ||
2672 | compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; | ||
2673 | cell-index = <2>; | ||
2674 | reg = <100 80>; | ||
2675 | }; | ||
2676 | dma-channel@180 { | ||
2677 | compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; | ||
2678 | cell-index = <3>; | ||
2679 | reg = <180 80>; | ||
2680 | }; | ||
2681 | }; | ||
2682 | |||
2683 | * Freescale 85xx/86xx DMA Controller | ||
2684 | |||
2685 | Freescale PowerPC 85xx/86xx have on chip general purpose DMA controllers. | ||
2686 | |||
2687 | Required properties: | ||
2688 | |||
2689 | - compatible : compatible list, contains 2 entries, first is | ||
2690 | "fsl,CHIP-dma", where CHIP is the processor | ||
2691 | (mpc8540, mpc8540, etc.) and the second is | ||
2692 | "fsl,eloplus-dma" | ||
2693 | - reg : <registers mapping for DMA general status reg> | ||
2694 | - cell-index : controller index. 0 for controller @ 0x21000, | ||
2695 | 1 for controller @ 0xc000 | ||
2696 | - ranges : Should be defined as specified in 1) to describe the | ||
2697 | DMA controller channels. | ||
2698 | |||
2699 | - DMA channel nodes: | ||
2700 | - compatible : compatible list, contains 2 entries, first is | ||
2701 | "fsl,CHIP-dma-channel", where CHIP is the processor | ||
2702 | (mpc8540, mpc8560, etc.) and the second is | ||
2703 | "fsl,eloplus-dma-channel" | ||
2704 | - cell-index : dma channel index starts at 0. | ||
2705 | - reg : <registers mapping for channel> | ||
2706 | - interrupts : <interrupt mapping for DMA channel IRQ> | ||
2707 | - interrupt-parent : optional, if needed for interrupt mapping | ||
2708 | |||
2709 | Example: | ||
2710 | dma@21300 { | ||
2711 | #address-cells = <1>; | ||
2712 | #size-cells = <1>; | ||
2713 | compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma"; | ||
2714 | reg = <21300 4>; | ||
2715 | ranges = <0 21100 200>; | ||
2716 | cell-index = <0>; | ||
2717 | dma-channel@0 { | ||
2718 | compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel"; | ||
2719 | reg = <0 80>; | ||
2720 | cell-index = <0>; | ||
2721 | interrupt-parent = <&mpic>; | ||
2722 | interrupts = <14 2>; | ||
2723 | }; | ||
2724 | dma-channel@80 { | ||
2725 | compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel"; | ||
2726 | reg = <80 80>; | ||
2727 | cell-index = <1>; | ||
2728 | interrupt-parent = <&mpic>; | ||
2729 | interrupts = <15 2>; | ||
2730 | }; | ||
2731 | dma-channel@100 { | ||
2732 | compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel"; | ||
2733 | reg = <100 80>; | ||
2734 | cell-index = <2>; | ||
2735 | interrupt-parent = <&mpic>; | ||
2736 | interrupts = <16 2>; | ||
2737 | }; | ||
2738 | dma-channel@180 { | ||
2739 | compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel"; | ||
2740 | reg = <180 80>; | ||
2741 | cell-index = <3>; | ||
2742 | interrupt-parent = <&mpic>; | ||
2743 | interrupts = <17 2>; | ||
2744 | }; | ||
2745 | }; | ||
2746 | |||
2747 | * Freescale 8xxx/3.0 Gb/s SATA nodes | ||
2748 | |||
2749 | SATA nodes are defined to describe on-chip Serial ATA controllers. | ||
2750 | Each SATA port should have its own node. | ||
2751 | |||
2752 | Required properties: | ||
2753 | - compatible : compatible list, contains 2 entries, first is | ||
2754 | "fsl,CHIP-sata", where CHIP is the processor | ||
2755 | (mpc8315, mpc8379, etc.) and the second is | ||
2756 | "fsl,pq-sata" | ||
2757 | - interrupts : <interrupt mapping for SATA IRQ> | ||
2758 | - cell-index : controller index. | ||
2759 | 1 for controller @ 0x18000 | ||
2760 | 2 for controller @ 0x19000 | ||
2761 | 3 for controller @ 0x1a000 | ||
2762 | 4 for controller @ 0x1b000 | ||
2763 | |||
2764 | Optional properties: | ||
2765 | - interrupt-parent : optional, if needed for interrupt mapping | ||
2766 | - reg : <registers mapping> | ||
2767 | |||
2768 | Example: | ||
2769 | |||
2770 | sata@18000 { | ||
2771 | compatible = "fsl,mpc8379-sata", "fsl,pq-sata"; | ||
2772 | reg = <0x18000 0x1000>; | ||
2773 | cell-index = <1>; | ||
2774 | interrupts = <2c 8>; | ||
2775 | interrupt-parent = < &ipic >; | ||
2776 | }; | ||
2777 | |||
2516 | More devices will be defined as this spec matures. | 2778 | More devices will be defined as this spec matures. |
2517 | 2779 | ||
2518 | VII - Specifying interrupt information for devices | 2780 | VII - Specifying interrupt information for devices |
diff --git a/Documentation/powerpc/qe_firmware.txt b/Documentation/powerpc/qe_firmware.txt new file mode 100644 index 000000000000..896266432d33 --- /dev/null +++ b/Documentation/powerpc/qe_firmware.txt | |||
@@ -0,0 +1,295 @@ | |||
1 | Freescale QUICC Engine Firmware Uploading | ||
2 | ----------------------------------------- | ||
3 | |||
4 | (c) 2007 Timur Tabi <timur at freescale.com>, | ||
5 | Freescale Semiconductor | ||
6 | |||
7 | Table of Contents | ||
8 | ================= | ||
9 | |||
10 | I - Software License for Firmware | ||
11 | |||
12 | II - Microcode Availability | ||
13 | |||
14 | III - Description and Terminology | ||
15 | |||
16 | IV - Microcode Programming Details | ||
17 | |||
18 | V - Firmware Structure Layout | ||
19 | |||
20 | VI - Sample Code for Creating Firmware Files | ||
21 | |||
22 | Revision Information | ||
23 | ==================== | ||
24 | |||
25 | November 30, 2007: Rev 1.0 - Initial version | ||
26 | |||
27 | I - Software License for Firmware | ||
28 | ================================= | ||
29 | |||
30 | Each firmware file comes with its own software license. For information on | ||
31 | the particular license, please see the license text that is distributed with | ||
32 | the firmware. | ||
33 | |||
34 | II - Microcode Availability | ||
35 | =========================== | ||
36 | |||
37 | Firmware files are distributed through various channels. Some are available on | ||
38 | http://opensource.freescale.com. For other firmware files, please contact | ||
39 | your Freescale representative or your operating system vendor. | ||
40 | |||
41 | III - Description and Terminology | ||
42 | ================================ | ||
43 | |||
44 | In this document, the term 'microcode' refers to the sequence of 32-bit | ||
45 | integers that compose the actual QE microcode. | ||
46 | |||
47 | The term 'firmware' refers to a binary blob that contains the microcode as | ||
48 | well as other data that | ||
49 | |||
50 | 1) describes the microcode's purpose | ||
51 | 2) describes how and where to upload the microcode | ||
52 | 3) specifies the values of various registers | ||
53 | 4) includes additional data for use by specific device drivers | ||
54 | |||
55 | Firmware files are binary files that contain only a firmware. | ||
56 | |||
57 | IV - Microcode Programming Details | ||
58 | =================================== | ||
59 | |||
60 | The QE architecture allows for only one microcode present in I-RAM for each | ||
61 | RISC processor. To replace any current microcode, a full QE reset (which | ||
62 | disables the microcode) must be performed first. | ||
63 | |||
64 | QE microcode is uploaded using the following procedure: | ||
65 | |||
66 | 1) The microcode is placed into I-RAM at a specific location, using the | ||
67 | IRAM.IADD and IRAM.IDATA registers. | ||
68 | |||
69 | 2) The CERCR.CIR bit is set to 0 or 1, depending on whether the firmware | ||
70 | needs split I-RAM. Split I-RAM is only meaningful for SOCs that have | ||
71 | QEs with multiple RISC processors, such as the 8360. Splitting the I-RAM | ||
72 | allows each processor to run a different microcode, effectively creating an | ||
73 | asymmetric multiprocessing (AMP) system. | ||
74 | |||
75 | 3) The TIBCR trap registers are loaded with the addresses of the trap handlers | ||
76 | in the microcode. | ||
77 | |||
78 | 4) The RSP.ECCR register is programmed with the value provided. | ||
79 | |||
80 | 5) If necessary, device drivers that need the virtual traps and extended mode | ||
81 | data will use them. | ||
82 | |||
83 | Virtual Microcode Traps | ||
84 | |||
85 | These virtual traps are conditional branches in the microcode. These are | ||
86 | "soft" provisional introduced in the ROMcode in order to enable higher | ||
87 | flexibility and save h/w traps If new features are activated or an issue is | ||
88 | being fixed in the RAM package utilizing they should be activated. This data | ||
89 | structure signals the microcode which of these virtual traps is active. | ||
90 | |||
91 | This structure contains 6 words that the application should copy to some | ||
92 | specific been defined. This table describes the structure. | ||
93 | |||
94 | --------------------------------------------------------------- | ||
95 | | Offset in | | Destination Offset | Size of | | ||
96 | | array | Protocol | within PRAM | Operand | | ||
97 | --------------------------------------------------------------| | ||
98 | | 0 | Ethernet | 0xF8 | 4 bytes | | ||
99 | | | interworking | | | | ||
100 | --------------------------------------------------------------- | ||
101 | | 4 | ATM | 0xF8 | 4 bytes | | ||
102 | | | interworking | | | | ||
103 | --------------------------------------------------------------- | ||
104 | | 8 | PPP | 0xF8 | 4 bytes | | ||
105 | | | interworking | | | | ||
106 | --------------------------------------------------------------- | ||
107 | | 12 | Ethernet RX | 0x22 | 1 byte | | ||
108 | | | Distributor Page | | | | ||
109 | --------------------------------------------------------------- | ||
110 | | 16 | ATM Globtal | 0x28 | 1 byte | | ||
111 | | | Params Table | | | | ||
112 | --------------------------------------------------------------- | ||
113 | | 20 | Insert Frame | 0xF8 | 4 bytes | | ||
114 | --------------------------------------------------------------- | ||
115 | |||
116 | |||
117 | Extended Modes | ||
118 | |||
119 | This is a double word bit array (64 bits) that defines special functionality | ||
120 | which has an impact on the softwarew drivers. Each bit has its own impact | ||
121 | and has special instructions for the s/w associated with it. This structure is | ||
122 | described in this table: | ||
123 | |||
124 | ----------------------------------------------------------------------- | ||
125 | | Bit # | Name | Description | | ||
126 | ----------------------------------------------------------------------- | ||
127 | | 0 | General | Indicates that prior to each host command | | ||
128 | | | push command | given by the application, the software must | | ||
129 | | | | assert a special host command (push command)| | ||
130 | | | | CECDR = 0x00800000. | | ||
131 | | | | CECR = 0x01c1000f. | | ||
132 | ----------------------------------------------------------------------- | ||
133 | | 1 | UCC ATM | Indicates that after issuing ATM RX INIT | | ||
134 | | | RX INIT | command, the host must issue another special| | ||
135 | | | push command | command (push command) and immediately | | ||
136 | | | | following that re-issue the ATM RX INIT | | ||
137 | | | | command. (This makes the sequence of | | ||
138 | | | | initializing the ATM receiver a sequence of | | ||
139 | | | | three host commands) | | ||
140 | | | | CECDR = 0x00800000. | | ||
141 | | | | CECR = 0x01c1000f. | | ||
142 | ----------------------------------------------------------------------- | ||
143 | | 2 | Add/remove | Indicates that following the specific host | | ||
144 | | | command | command: "Add/Remove entry in Hash Lookup | | ||
145 | | | validation | Table" used in Interworking setup, the user | | ||
146 | | | | must issue another command. | | ||
147 | | | | CECDR = 0xce000003. | | ||
148 | | | | CECR = 0x01c10f58. | | ||
149 | ----------------------------------------------------------------------- | ||
150 | | 3 | General push | Indicates that the s/w has to initialize | | ||
151 | | | command | some pointers in the Ethernet thread pages | | ||
152 | | | | which are used when Header Compression is | | ||
153 | | | | activated. The full details of these | | ||
154 | | | | pointers is located in the software drivers.| | ||
155 | ----------------------------------------------------------------------- | ||
156 | | 4 | General push | Indicates that after issuing Ethernet TX | | ||
157 | | | command | INIT command, user must issue this command | | ||
158 | | | | for each SNUM of Ethernet TX thread. | | ||
159 | | | | CECDR = 0x00800003. | | ||
160 | | | | CECR = 0x7'b{0}, 8'b{Enet TX thread SNUM}, | | ||
161 | | | | 1'b{1}, 12'b{0}, 4'b{1} | | ||
162 | ----------------------------------------------------------------------- | ||
163 | | 5 - 31 | N/A | Reserved, set to zero. | | ||
164 | ----------------------------------------------------------------------- | ||
165 | |||
166 | V - Firmware Structure Layout | ||
167 | ============================== | ||
168 | |||
169 | QE microcode from Freescale is typically provided as a header file. This | ||
170 | header file contains macros that define the microcode binary itself as well as | ||
171 | some other data used in uploading that microcode. The format of these files | ||
172 | do not lend themselves to simple inclusion into other code. Hence, | ||
173 | the need for a more portable format. This section defines that format. | ||
174 | |||
175 | Instead of distributing a header file, the microcode and related data are | ||
176 | embedded into a binary blob. This blob is passed to the qe_upload_firmware() | ||
177 | function, which parses the blob and performs everything necessary to upload | ||
178 | the microcode. | ||
179 | |||
180 | All integers are big-endian. See the comments for function | ||
181 | qe_upload_firmware() for up-to-date implementation information. | ||
182 | |||
183 | This structure supports versioning, where the version of the structure is | ||
184 | embedded into the structure itself. To ensure forward and backwards | ||
185 | compatibility, all versions of the structure must use the same 'qe_header' | ||
186 | structure at the beginning. | ||
187 | |||
188 | 'header' (type: struct qe_header): | ||
189 | The 'length' field is the size, in bytes, of the entire structure, | ||
190 | including all the microcode embedded in it, as well as the CRC (if | ||
191 | present). | ||
192 | |||
193 | The 'magic' field is an array of three bytes that contains the letters | ||
194 | 'Q', 'E', and 'F'. This is an identifier that indicates that this | ||
195 | structure is a QE Firmware structure. | ||
196 | |||
197 | The 'version' field is a single byte that indicates the version of this | ||
198 | structure. If the layout of the structure should ever need to be | ||
199 | changed to add support for additional types of microcode, then the | ||
200 | version number should also be changed. | ||
201 | |||
202 | The 'id' field is a null-terminated string(suitable for printing) that | ||
203 | identifies the firmware. | ||
204 | |||
205 | The 'count' field indicates the number of 'microcode' structures. There | ||
206 | must be one and only one 'microcode' structure for each RISC processor. | ||
207 | Therefore, this field also represents the number of RISC processors for this | ||
208 | SOC. | ||
209 | |||
210 | The 'soc' structure contains the SOC numbers and revisions used to match | ||
211 | the microcode to the SOC itself. Normally, the microcode loader should | ||
212 | check the data in this structure with the SOC number and revisions, and | ||
213 | only upload the microcode if there's a match. However, this check is not | ||
214 | made on all platforms. | ||
215 | |||
216 | Although it is not recommended, you can specify '0' in the soc.model | ||
217 | field to skip matching SOCs altogether. | ||
218 | |||
219 | The 'model' field is a 16-bit number that matches the actual SOC. The | ||
220 | 'major' and 'minor' fields are the major and minor revision numbrs, | ||
221 | respectively, of the SOC. | ||
222 | |||
223 | For example, to match the 8323, revision 1.0: | ||
224 | soc.model = 8323 | ||
225 | soc.major = 1 | ||
226 | soc.minor = 0 | ||
227 | |||
228 | 'padding' is neccessary for structure alignment. This field ensures that the | ||
229 | 'extended_modes' field is aligned on a 64-bit boundary. | ||
230 | |||
231 | 'extended_modes' is a bitfield that defines special functionality which has an | ||
232 | impact on the device drivers. Each bit has its own impact and has special | ||
233 | instructions for the driver associated with it. This field is stored in | ||
234 | the QE library and available to any driver that calles qe_get_firmware_info(). | ||
235 | |||
236 | 'vtraps' is an array of 8 words that contain virtual trap values for each | ||
237 | virtual traps. As with 'extended_modes', this field is stored in the QE | ||
238 | library and available to any driver that calles qe_get_firmware_info(). | ||
239 | |||
240 | 'microcode' (type: struct qe_microcode): | ||
241 | For each RISC processor there is one 'microcode' structure. The first | ||
242 | 'microcode' structure is for the first RISC, and so on. | ||
243 | |||
244 | The 'id' field is a null-terminated string suitable for printing that | ||
245 | identifies this particular microcode. | ||
246 | |||
247 | 'traps' is an array of 16 words that contain hardware trap values | ||
248 | for each of the 16 traps. If trap[i] is 0, then this particular | ||
249 | trap is to be ignored (i.e. not written to TIBCR[i]). The entire value | ||
250 | is written as-is to the TIBCR[i] register, so be sure to set the EN | ||
251 | and T_IBP bits if necessary. | ||
252 | |||
253 | 'eccr' is the value to program into the ECCR register. | ||
254 | |||
255 | 'iram_offset' is the offset into IRAM to start writing the | ||
256 | microcode. | ||
257 | |||
258 | 'count' is the number of 32-bit words in the microcode. | ||
259 | |||
260 | 'code_offset' is the offset, in bytes, from the beginning of this | ||
261 | structure where the microcode itself can be found. The first | ||
262 | microcode binary should be located immediately after the 'microcode' | ||
263 | array. | ||
264 | |||
265 | 'major', 'minor', and 'revision' are the major, minor, and revision | ||
266 | version numbers, respectively, of the microcode. If all values are 0, | ||
267 | then these fields are ignored. | ||
268 | |||
269 | 'reserved' is necessary for structure alignment. Since 'microcode' | ||
270 | is an array, the 64-bit 'extended_modes' field needs to be aligned | ||
271 | on a 64-bit boundary, and this can only happen if the size of | ||
272 | 'microcode' is a multiple of 8 bytes. To ensure that, we add | ||
273 | 'reserved'. | ||
274 | |||
275 | After the last microcode is a 32-bit CRC. It can be calculated using | ||
276 | this algorithm: | ||
277 | |||
278 | u32 crc32(const u8 *p, unsigned int len) | ||
279 | { | ||
280 | unsigned int i; | ||
281 | u32 crc = 0; | ||
282 | |||
283 | while (len--) { | ||
284 | crc ^= *p++; | ||
285 | for (i = 0; i < 8; i++) | ||
286 | crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0); | ||
287 | } | ||
288 | return crc; | ||
289 | } | ||
290 | |||
291 | VI - Sample Code for Creating Firmware Files | ||
292 | ============================================ | ||
293 | |||
294 | A Python program that creates firmware binaries from the header files normally | ||
295 | distributed by Freescale can be found on http://opensource.freescale.com. | ||
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 | ||
188 | If all else fails, check out the rtc-test.c driver! | 188 | If 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/s390/CommonIO b/Documentation/s390/CommonIO index 86320aa3fb0b..8fbc0a852870 100644 --- a/Documentation/s390/CommonIO +++ b/Documentation/s390/CommonIO | |||
@@ -4,6 +4,11 @@ S/390 common I/O-Layer - command line parameters, procfs and debugfs entries | |||
4 | Command line parameters | 4 | Command line parameters |
5 | ----------------------- | 5 | ----------------------- |
6 | 6 | ||
7 | * ccw_timeout_log | ||
8 | |||
9 | Enable logging of debug information in case of ccw device timeouts. | ||
10 | |||
11 | |||
7 | * cio_msg = yes | no | 12 | * cio_msg = yes | no |
8 | 13 | ||
9 | Determines whether information on found devices and sensed device | 14 | Determines whether information on found devices and sensed device |
diff --git a/Documentation/s390/cds.txt b/Documentation/s390/cds.txt index 3081927cc2d6..c4b7b2bd369a 100644 --- a/Documentation/s390/cds.txt +++ b/Documentation/s390/cds.txt | |||
@@ -133,7 +133,7 @@ During its startup the Linux/390 system checks for peripheral devices. Each | |||
133 | of those devices is uniquely defined by a so called subchannel by the ESA/390 | 133 | of those devices is uniquely defined by a so called subchannel by the ESA/390 |
134 | channel subsystem. While the subchannel numbers are system generated, each | 134 | channel subsystem. While the subchannel numbers are system generated, each |
135 | subchannel also takes a user defined attribute, the so called device number. | 135 | subchannel also takes a user defined attribute, the so called device number. |
136 | Both subchannel number and device number cannot exceed 65535. During driverfs | 136 | Both subchannel number and device number cannot exceed 65535. During sysfs |
137 | initialisation, the information about control unit type and device types that | 137 | initialisation, the information about control unit type and device types that |
138 | imply specific I/O commands (channel command words - CCWs) in order to operate | 138 | imply specific I/O commands (channel command words - CCWs) in order to operate |
139 | the device are gathered. Device drivers can retrieve this set of hardware | 139 | the device are gathered. Device drivers can retrieve this set of hardware |
diff --git a/Documentation/scsi/00-INDEX b/Documentation/scsi/00-INDEX index aa1f7e927834..c2e18e109858 100644 --- a/Documentation/scsi/00-INDEX +++ b/Documentation/scsi/00-INDEX | |||
@@ -64,8 +64,6 @@ lpfc.txt | |||
64 | - LPFC driver release notes | 64 | - LPFC driver release notes |
65 | megaraid.txt | 65 | megaraid.txt |
66 | - Common Management Module, shared code handling ioctls for LSI drivers | 66 | - Common Management Module, shared code handling ioctls for LSI drivers |
67 | ncr53c7xx.txt | ||
68 | - info on driver for NCR53c7xx based adapters | ||
69 | ncr53c8xx.txt | 67 | ncr53c8xx.txt |
70 | - info on driver for NCR53c8xx based adapters | 68 | - info on driver for NCR53c8xx based adapters |
71 | osst.txt | 69 | osst.txt |
diff --git a/Documentation/scsi/ChangeLog.megaraid_sas b/Documentation/scsi/ChangeLog.megaraid_sas index 5eb927544990..91c81db0ba71 100644 --- a/Documentation/scsi/ChangeLog.megaraid_sas +++ b/Documentation/scsi/ChangeLog.megaraid_sas | |||
@@ -1,3 +1,162 @@ | |||
1 | 1 Release Date : Thur. Nov. 07 16:30:43 PST 2007 - | ||
2 | (emaild-id:megaraidlinux@lsi.com) | ||
3 | Sumant Patro | ||
4 | Bo Yang | ||
5 | |||
6 | 2 Current Version : 00.00.03.16 | ||
7 | 3 Older Version : 00.00.03.15 | ||
8 | |||
9 | 1. Increased MFI_POLL_TIMEOUT_SECS to 60 seconds from 10. FW may take | ||
10 | a max of 60 seconds to respond to the INIT cmd. | ||
11 | |||
12 | 1 Release Date : Fri. Sep. 07 16:30:43 PST 2007 - | ||
13 | (emaild-id:megaraidlinux@lsi.com) | ||
14 | Sumant Patro | ||
15 | Bo Yang | ||
16 | |||
17 | 2 Current Version : 00.00.03.15 | ||
18 | 3 Older Version : 00.00.03.14 | ||
19 | |||
20 | 1. Added module parameter "poll_mode_io" to support for "polling" | ||
21 | (reduced interrupt operation). In this mode, IO completion | ||
22 | interrupts are delayed. At the end of initiating IOs, the | ||
23 | driver schedules for cmd completion if there are pending cmds | ||
24 | to be completed. A timer-based interrupt has also been added | ||
25 | to prevent IO completion processing from being delayed | ||
26 | indefinitely in the case that no new IOs are initiated. | ||
27 | |||
28 | 1 Release Date : Fri. Sep. 07 16:30:43 PST 2007 - | ||
29 | (emaild-id:megaraidlinux@lsi.com) | ||
30 | Sumant Patro | ||
31 | Bo Yang | ||
32 | |||
33 | 2 Current Version : 00.00.03.14 | ||
34 | 3 Older Version : 00.00.03.13 | ||
35 | |||
36 | 1. Setting the max_sectors_per_req based on max SGL supported by the | ||
37 | FW. Prior versions calculated this value from controller info | ||
38 | (max_sectors_1, max_sectors_2). For certain controllers/FW, | ||
39 | this was resulting in a value greater than max SGL supported | ||
40 | by the FW. Issue was first reported by users running LUKS+XFS | ||
41 | with megaraid_sas. Thanks to RB for providing the logs and | ||
42 | duplication steps that helped to get to the root cause of the | ||
43 | issue. 2. Increased MFI_POLL_TIMEOUT_SECS to 60 seconds from | ||
44 | 10. FW may take a max of 60 seconds to respond to the INIT | ||
45 | cmd. | ||
46 | |||
47 | 1 Release Date : Fri. June. 15 16:30:43 PST 2007 - | ||
48 | (emaild-id:megaraidlinux@lsi.com) | ||
49 | Sumant Patro | ||
50 | Bo Yang | ||
51 | |||
52 | 2 Current Version : 00.00.03.13 | ||
53 | 3 Older Version : 00.00.03.12 | ||
54 | |||
55 | 1. Added the megasas_reset_timer routine to intercept cmd timeout and throttle io. | ||
56 | |||
57 | On Fri, 2007-03-16 at 16:44 -0600, James Bottomley wrote: | ||
58 | It looks like megaraid_sas at least needs this to throttle its commands | ||
59 | > as they begin to time out. The code keeps the existing transport | ||
60 | > template use of eh_timed_out (and allows the transport to override the | ||
61 | > host if they both have this callback). | ||
62 | > | ||
63 | > James | ||
64 | |||
65 | 1 Release Date : Sat May. 12 16:30:43 PST 2007 - | ||
66 | (emaild-id:megaraidlinux@lsi.com) | ||
67 | Sumant Patro | ||
68 | Bo Yang | ||
69 | |||
70 | 2 Current Version : 00.00.03.12 | ||
71 | 3 Older Version : 00.00.03.11 | ||
72 | |||
73 | 1. When MegaSAS driver receives reset call from OS, driver waits in reset | ||
74 | routine for max 3 minutes for all pending command completion. Now driver will | ||
75 | call completion routine every 5 seconds from the reset routine instead of | ||
76 | waiting for depending on cmd completion from isr path. | ||
77 | |||
78 | 1 Release Date : Mon Apr. 30 10:25:52 PST 2007 - | ||
79 | (emaild-id:megaraidlinux@lsi.com) | ||
80 | Sumant Patro | ||
81 | Bo Yang | ||
82 | |||
83 | 2 Current Version : 00.00.03.11 | ||
84 | 3 Older Version : 00.00.03.09 | ||
85 | |||
86 | 1. Memory Manager for IOCTL removed for 2.6 kernels. | ||
87 | pci_alloc_consistent replaced by dma_alloc_coherent. With this | ||
88 | change there is no need of memory manager in the driver code | ||
89 | |||
90 | On Wed, 2007-02-07 at 13:30 -0800, Andrew Morton wrote: | ||
91 | > I suspect all this horror is due to stupidity in the DMA API. | ||
92 | > | ||
93 | > pci_alloc_consistent() just goes and assumes GFP_ATOMIC, whereas | ||
94 | > the caller (megasas_mgmt_fw_ioctl) would have been perfectly happy | ||
95 | > to use GFP_KERNEL. | ||
96 | > | ||
97 | > I bet this fixes it | ||
98 | |||
99 | It does, but the DMA API was expanded to cope with this exact case, so | ||
100 | use dma_alloc_coherent() directly in the megaraid code instead. The dev | ||
101 | is just &pci_dev->dev. | ||
102 | |||
103 | James <James.Bottomley@SteelEye.com> | ||
104 | |||
105 | 3. SYNCHRONIZE_CACHE is not supported by FW and thus blocked by driver. | ||
106 | 4. Hibernation support added | ||
107 | 5. Performing diskdump while running IO in RHEL 4 was failing. Fixed. | ||
108 | |||
109 | 1 Release Date : Fri Feb. 09 14:36:28 PST 2007 - | ||
110 | (emaild-id:megaraidlinux@lsi.com) | ||
111 | Sumant Patro | ||
112 | Bo Yang | ||
113 | |||
114 | 2 Current Version : 00.00.03.09 | ||
115 | 3 Older Version : 00.00.03.08 | ||
116 | |||
117 | i. Under heavy IO mid-layer prints "DRIVER_TIMEOUT" errors | ||
118 | |||
119 | The driver now waits for 10 seconds to elapse instead of 5 (as in | ||
120 | previous release) to resume IO. | ||
121 | |||
122 | 1 Release Date : Mon Feb. 05 11:35:24 PST 2007 - | ||
123 | (emaild-id:megaraidlinux@lsi.com) | ||
124 | Sumant Patro | ||
125 | Bo Yang | ||
126 | 2 Current Version : 00.00.03.08 | ||
127 | 3 Older Version : 00.00.03.07 | ||
128 | |||
129 | i. Under heavy IO mid-layer prints "DRIVER_TIMEOUT" errors | ||
130 | |||
131 | Fix: The driver is now throttling IO. | ||
132 | Checks added in megasas_queue_command to know if FW is able to | ||
133 | process commands within timeout period. If number of retries | ||
134 | is 2 or greater,the driver stops sending cmd to FW temporarily. IO is | ||
135 | resumed if pending cmd count reduces to 16 or 5 seconds has elapsed | ||
136 | from the time cmds were last sent to FW. | ||
137 | |||
138 | ii. FW enables WCE bit in Mode Sense cmd for drives that are configured | ||
139 | as WriteBack. The OS may send "SYNCHRONIZE_CACHE" cmd when Logical | ||
140 | Disks are exposed with WCE=1. User is advised to enable Write Back | ||
141 | mode only when the controller has battery backup. At this time | ||
142 | Synhronize cache is not supported by the FW. Driver will short-cycle | ||
143 | the cmd and return sucess without sending down to FW. | ||
144 | |||
145 | 1 Release Date : Sun Jan. 14 11:21:32 PDT 2007 - | ||
146 | Sumant Patro <Sumant.Patro@lsil.com>/Bo Yang | ||
147 | 2 Current Version : 00.00.03.07 | ||
148 | 3 Older Version : 00.00.03.06 | ||
149 | |||
150 | i. bios_param entry added in scsi_host_template that returns disk geometry | ||
151 | information. | ||
152 | |||
153 | 1 Release Date : Fri Oct 20 11:21:32 PDT 2006 - Sumant Patro <Sumant.Patro@lsil.com>/Bo Yang | ||
154 | 2 Current Version : 00.00.03.06 | ||
155 | 3 Older Version : 00.00.03.05 | ||
156 | |||
157 | 1. Added new memory management module to support the IOCTL memory allocation. For IOCTL we try to allocate from the memory pool created during driver initialization. If mem pool is empty then we allocate at run time. | ||
158 | 2. Added check in megasas_queue_command and dpc/isr routine to see if we have already declared adapter dead | ||
159 | (hw_crit_error=1). If hw_crit_error==1, now we donot accept any processing of pending cmds/accept any cmd from OS | ||
1 | 160 | ||
2 | 1 Release Date : Mon Oct 02 11:21:32 PDT 2006 - Sumant Patro <Sumant.Patro@lsil.com> | 161 | 1 Release Date : Mon Oct 02 11:21:32 PDT 2006 - Sumant Patro <Sumant.Patro@lsil.com> |
3 | 2 Current Version : 00.00.03.05 | 162 | 2 Current Version : 00.00.03.05 |
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt index a8257840695a..d16011a8618e 100644 --- a/Documentation/scsi/aacraid.txt +++ b/Documentation/scsi/aacraid.txt | |||
@@ -56,6 +56,10 @@ Supported Cards/Chipsets | |||
56 | 9005:0285:9005:02d1 Adaptec 5405 (Voodoo40) | 56 | 9005:0285:9005:02d1 Adaptec 5405 (Voodoo40) |
57 | 9005:0285:15d9:02d2 SMC AOC-USAS-S8i-LP | 57 | 9005:0285:15d9:02d2 SMC AOC-USAS-S8i-LP |
58 | 9005:0285:15d9:02d3 SMC AOC-USAS-S8iR-LP | 58 | 9005:0285:15d9:02d3 SMC AOC-USAS-S8iR-LP |
59 | 9005:0285:9005:02d4 Adaptec 2045 (Voodoo04 Lite) | ||
60 | 9005:0285:9005:02d5 Adaptec 2405 (Voodoo40 Lite) | ||
61 | 9005:0285:9005:02d6 Adaptec 2445 (Voodoo44 Lite) | ||
62 | 9005:0285:9005:02d7 Adaptec 2805 (Voodoo80 Lite) | ||
59 | 1011:0046:9005:0364 Adaptec 5400S (Mustang) | 63 | 1011:0046:9005:0364 Adaptec 5400S (Mustang) |
60 | 9005:0287:9005:0800 Adaptec Themisto (Jupiter) | 64 | 9005:0287:9005:0800 Adaptec Themisto (Jupiter) |
61 | 9005:0200:9005:0200 Adaptec Themisto (Jupiter) | 65 | 9005:0200:9005:0200 Adaptec Themisto (Jupiter) |
diff --git a/Documentation/scsi/hptiop.txt b/Documentation/scsi/hptiop.txt index d28a31247d4c..a6eb4add1be6 100644 --- a/Documentation/scsi/hptiop.txt +++ b/Documentation/scsi/hptiop.txt | |||
@@ -1,9 +1,9 @@ | |||
1 | HIGHPOINT ROCKETRAID 3xxx RAID DRIVER (hptiop) | 1 | HIGHPOINT ROCKETRAID 3xxx/4xxx ADAPTER DRIVER (hptiop) |
2 | 2 | ||
3 | Controller Register Map | 3 | Controller Register Map |
4 | ------------------------- | 4 | ------------------------- |
5 | 5 | ||
6 | The controller IOP is accessed via PCI BAR0. | 6 | For Intel IOP based adapters, the controller IOP is accessed via PCI BAR0: |
7 | 7 | ||
8 | BAR0 offset Register | 8 | BAR0 offset Register |
9 | 0x10 Inbound Message Register 0 | 9 | 0x10 Inbound Message Register 0 |
@@ -18,6 +18,24 @@ The controller IOP is accessed via PCI BAR0. | |||
18 | 0x40 Inbound Queue Port | 18 | 0x40 Inbound Queue Port |
19 | 0x44 Outbound Queue Port | 19 | 0x44 Outbound Queue Port |
20 | 20 | ||
21 | For Marvell IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1: | ||
22 | |||
23 | BAR0 offset Register | ||
24 | 0x20400 Inbound Doorbell Register | ||
25 | 0x20404 Inbound Interrupt Mask Register | ||
26 | 0x20408 Outbound Doorbell Register | ||
27 | 0x2040C Outbound Interrupt Mask Register | ||
28 | |||
29 | BAR1 offset Register | ||
30 | 0x0 Inbound Queue Head Pointer | ||
31 | 0x4 Inbound Queue Tail Pointer | ||
32 | 0x8 Outbound Queue Head Pointer | ||
33 | 0xC Outbound Queue Tail Pointer | ||
34 | 0x10 Inbound Message Register | ||
35 | 0x14 Outbound Message Register | ||
36 | 0x40-0x1040 Inbound Queue | ||
37 | 0x1040-0x2040 Outbound Queue | ||
38 | |||
21 | 39 | ||
22 | I/O Request Workflow | 40 | I/O Request Workflow |
23 | ---------------------- | 41 | ---------------------- |
@@ -73,15 +91,9 @@ The driver exposes following sysfs attributes: | |||
73 | driver-version R driver version string | 91 | driver-version R driver version string |
74 | firmware-version R firmware version string | 92 | firmware-version R firmware version string |
75 | 93 | ||
76 | The driver registers char device "hptiop" to communicate with HighPoint RAID | ||
77 | management software. Its ioctl routine acts as a general binary interface | ||
78 | between the IOP firmware and HighPoint RAID management software. New management | ||
79 | functions can be implemented in application/firmware without modification | ||
80 | in driver code. | ||
81 | |||
82 | 94 | ||
83 | ----------------------------------------------------------------------------- | 95 | ----------------------------------------------------------------------------- |
84 | Copyright (C) 2006 HighPoint Technologies, Inc. All Rights Reserved. | 96 | Copyright (C) 2006-2007 HighPoint Technologies, Inc. All Rights Reserved. |
85 | 97 | ||
86 | This file is distributed in the hope that it will be useful, | 98 | This file is distributed in the hope that it will be useful, |
87 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 99 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/Documentation/scsi/ncr53c7xx.txt b/Documentation/scsi/ncr53c7xx.txt deleted file mode 100644 index 91e9552d63e5..000000000000 --- a/Documentation/scsi/ncr53c7xx.txt +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | README for WarpEngine/A4000T/A4091 SCSI kernels. | ||
2 | |||
3 | Use the following options to disable options in the SCSI driver. | ||
4 | |||
5 | Using amiboot for example..... | ||
6 | |||
7 | To disable Synchronous Negotiation.... | ||
8 | |||
9 | amiboot -k kernel 53c7xx=nosync:0 | ||
10 | |||
11 | To disable Disconnection.... | ||
12 | |||
13 | amiboot -k kernel 53c7xx=nodisconnect:0 | ||
14 | |||
15 | To disable certain SCSI devices... | ||
16 | |||
17 | amiboot -k kernel 53c7xx=validids:0x3F | ||
18 | |||
19 | this allows only device ID's 0,1,2,3,4 and 5 for linux to handle. | ||
20 | (this is a bitmasked field - i.e. each bit represents a SCSI ID) | ||
21 | |||
22 | These commands work on a per controller basis and use the option 'next' to | ||
23 | move to the next controller in the system. | ||
24 | |||
25 | e.g. | ||
26 | amiboot -k kernel 53c7xx=nodisconnect:0,next,nosync:0 | ||
27 | |||
28 | this uses No Disconnection on the first controller and Asynchronous | ||
29 | SCSI on the second controller. | ||
30 | |||
31 | Known Issues: | ||
32 | |||
33 | Two devices are known not to function with the default settings of using | ||
34 | synchronous SCSI. These are the Archive Viper 150 Tape Drive and the | ||
35 | SyQuest SQ555 removeable hard drive. When using these devices on a controller | ||
36 | use the 'nosync:0' option. | ||
37 | |||
38 | Please try these options and post any problems/successes to me. | ||
39 | |||
40 | Alan Hourihane <alanh@fairlite.demon.co.uk> | ||
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 @@ | |||
1 | To set up SMP | ||
2 | |||
3 | Configure the kernel and answer Y to CONFIG_SMP. | ||
4 | |||
5 | If you are using LILO, it is handy to have both SMP and non-SMP | ||
6 | kernel images on hand. Edit /etc/lilo.conf to create an entry | ||
7 | for another kernel image called "linux-smp" or something. | ||
8 | |||
9 | The next time you compile the kernel, when running a SMP kernel, | ||
10 | edit 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 | ||
13 | with this one. | ||
14 | |||
15 | Of course you should time how long each build takes :-) | ||
16 | Example: | ||
17 | make config | ||
18 | time -v sh -c 'make clean install modules modules_install' | ||
19 | |||
20 | If you are using some Compaq MP compliant machines you will need to set | ||
21 | the operating system in the BIOS settings to "Unixware" - don't ask me | ||
22 | why Compaqs don't work otherwise. | ||
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 4b48c2e82c3c..e985cf5e0410 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -57,7 +57,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
57 | - Default: 1 | 57 | - Default: 1 |
58 | - For auto-loading more than one card, specify this | 58 | - For auto-loading more than one card, specify this |
59 | option together with snd-card-X aliases. | 59 | option together with snd-card-X aliases. |
60 | 60 | slots - Reserve the slot index for the given driver. | |
61 | This option takes multiple strings. | ||
62 | See "Module Autoloading Support" section for details. | ||
61 | 63 | ||
62 | Module snd-pcm-oss | 64 | Module snd-pcm-oss |
63 | ------------------ | 65 | ------------------ |
@@ -148,13 +150,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
148 | 150 | ||
149 | Module for sound cards based on Analog Devices AD1816A/AD1815 ISA chips. | 151 | Module for sound cards based on Analog Devices AD1816A/AD1815 ISA chips. |
150 | 152 | ||
151 | port - port # for AD1816A chip (PnP setup) | ||
152 | mpu_port - port # for MPU-401 UART (PnP setup) | ||
153 | fm_port - port # for OPL3 (PnP setup) | ||
154 | irq - IRQ # for AD1816A chip (PnP setup) | ||
155 | mpu_irq - IRQ # for MPU-401 UART (PnP setup) | ||
156 | dma1 - first DMA # for AD1816A chip (PnP setup) | ||
157 | dma2 - second DMA # for AD1816A chip (PnP setup) | ||
158 | clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz) | 153 | clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz) |
159 | 154 | ||
160 | This module supports multiple cards, autoprobe and PnP. | 155 | This module supports multiple cards, autoprobe and PnP. |
@@ -201,14 +196,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
201 | 196 | ||
202 | Module for sound cards based on Avance Logic ALS100/ALS120 ISA chips. | 197 | Module for sound cards based on Avance Logic ALS100/ALS120 ISA chips. |
203 | 198 | ||
204 | port - port # for ALS100 (SB16) chip (PnP setup) | ||
205 | irq - IRQ # for ALS100 (SB16) chip (PnP setup) | ||
206 | dma8 - 8-bit DMA # for ALS100 (SB16) chip (PnP setup) | ||
207 | dma16 - 16-bit DMA # for ALS100 (SB16) chip (PnP setup) | ||
208 | mpu_port - port # for MPU-401 UART (PnP setup) | ||
209 | mpu_irq - IRQ # for MPU-401 (PnP setup) | ||
210 | fm_port - port # for OPL3 FM (PnP setup) | ||
211 | |||
212 | This module supports multiple cards, autoprobe and PnP. | 199 | This module supports multiple cards, autoprobe and PnP. |
213 | 200 | ||
214 | The power-management is supported. | 201 | The power-management is supported. |
@@ -302,15 +289,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
302 | 289 | ||
303 | Module for sound cards based on Aztech System AZT2320 ISA chip (PnP only). | 290 | Module for sound cards based on Aztech System AZT2320 ISA chip (PnP only). |
304 | 291 | ||
305 | port - port # for AZT2320 chip (PnP setup) | ||
306 | wss_port - port # for WSS (PnP setup) | ||
307 | mpu_port - port # for MPU-401 UART (PnP setup) | ||
308 | fm_port - FM port # for AZT2320 chip (PnP setup) | ||
309 | irq - IRQ # for AZT2320 (WSS) chip (PnP setup) | ||
310 | mpu_irq - IRQ # for MPU-401 UART (PnP setup) | ||
311 | dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup) | ||
312 | dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup) | ||
313 | |||
314 | This module supports multiple cards, PnP and autoprobe. | 292 | This module supports multiple cards, PnP and autoprobe. |
315 | 293 | ||
316 | The power-management is supported. | 294 | The power-management is supported. |
@@ -350,6 +328,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
350 | 328 | ||
351 | Module for sound cards based on C-Media CMI8330 ISA chips. | 329 | Module for sound cards based on C-Media CMI8330 ISA chips. |
352 | 330 | ||
331 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
332 | |||
333 | with isapnp=0, the following options are available: | ||
334 | |||
353 | wssport - port # for CMI8330 chip (WSS) | 335 | wssport - port # for CMI8330 chip (WSS) |
354 | wssirq - IRQ # for CMI8330 chip (WSS) | 336 | wssirq - IRQ # for CMI8330 chip (WSS) |
355 | wssdma - first DMA # for CMI8330 chip (WSS) | 337 | wssdma - first DMA # for CMI8330 chip (WSS) |
@@ -404,6 +386,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
404 | 386 | ||
405 | Module for sound cards based on CS4232/CS4232A ISA chips. | 387 | Module for sound cards based on CS4232/CS4232A ISA chips. |
406 | 388 | ||
389 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
390 | |||
391 | with isapnp=0, the following options are available: | ||
392 | |||
407 | port - port # for CS4232 chip (PnP setup - 0x534) | 393 | port - port # for CS4232 chip (PnP setup - 0x534) |
408 | cport - control port # for CS4232 chip (PnP setup - 0x120,0x210,0xf00) | 394 | cport - control port # for CS4232 chip (PnP setup - 0x120,0x210,0xf00) |
409 | mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable | 395 | mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable |
@@ -412,10 +398,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
412 | mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) | 398 | mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) |
413 | dma1 - first DMA # for CS4232 chip (0,1,3) | 399 | dma1 - first DMA # for CS4232 chip (0,1,3) |
414 | dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable | 400 | dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable |
415 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
416 | 401 | ||
417 | This module supports multiple cards. This module does not support autoprobe | 402 | This module supports multiple cards. This module does not support autoprobe |
418 | thus main port must be specified!!! Other ports are optional. | 403 | (if ISA PnP is not used) thus main port must be specified!!! Other ports are |
404 | optional. | ||
419 | 405 | ||
420 | The power-management is supported. | 406 | The power-management is supported. |
421 | 407 | ||
@@ -425,6 +411,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
425 | Module for sound cards based on CS4235/CS4236/CS4236B/CS4237B/ | 411 | Module for sound cards based on CS4235/CS4236/CS4236B/CS4237B/ |
426 | CS4238B/CS4239 ISA chips. | 412 | CS4238B/CS4239 ISA chips. |
427 | 413 | ||
414 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
415 | |||
416 | with isapnp=0, the following options are available: | ||
417 | |||
428 | port - port # for CS4236 chip (PnP setup - 0x534) | 418 | port - port # for CS4236 chip (PnP setup - 0x534) |
429 | cport - control port # for CS4236 chip (PnP setup - 0x120,0x210,0xf00) | 419 | cport - control port # for CS4236 chip (PnP setup - 0x120,0x210,0xf00) |
430 | mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable | 420 | mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable |
@@ -433,7 +423,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
433 | mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) | 423 | mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) |
434 | dma1 - first DMA # for CS4236 chip (0,1,3) | 424 | dma1 - first DMA # for CS4236 chip (0,1,3) |
435 | dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable | 425 | dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable |
436 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
437 | 426 | ||
438 | This module supports multiple cards. This module does not support autoprobe | 427 | This module supports multiple cards. This module does not support autoprobe |
439 | (if ISA PnP is not used) thus main port and control port must be | 428 | (if ISA PnP is not used) thus main port and control port must be |
@@ -503,13 +492,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
503 | Module for Diamond Technologies DT-019X / Avance Logic ALS-007 (PnP | 492 | Module for Diamond Technologies DT-019X / Avance Logic ALS-007 (PnP |
504 | only) | 493 | only) |
505 | 494 | ||
506 | port - Port # (PnP setup) | ||
507 | mpu_port - Port # for MPU-401 (PnP setup) | ||
508 | fm_port - Port # for FM OPL-3 (PnP setup) | ||
509 | irq - IRQ # (PnP setup) | ||
510 | mpu_irq - IRQ # for MPU-401 (PnP setup) | ||
511 | dma8 - DMA # (PnP setup) | ||
512 | |||
513 | This module supports multiple cards. This module is enabled only with | 495 | This module supports multiple cards. This module is enabled only with |
514 | ISA PnP support. | 496 | ISA PnP support. |
515 | 497 | ||
@@ -607,10 +589,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
607 | 589 | ||
608 | Module for sound cards based on ESS ES968 chip (PnP only). | 590 | Module for sound cards based on ESS ES968 chip (PnP only). |
609 | 591 | ||
610 | port - port # for ES968 (SB8) chip (PnP setup) | ||
611 | irq - IRQ # for ES968 (SB8) chip (PnP setup) | ||
612 | dma1 - DMA # for ES968 (SB8) chip (PnP setup) | ||
613 | |||
614 | This module supports multiple cards, PnP and autoprobe. | 592 | This module supports multiple cards, PnP and autoprobe. |
615 | 593 | ||
616 | The power-management is supported. | 594 | The power-management is supported. |
@@ -633,13 +611,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
633 | 611 | ||
634 | Module for ESS AudioDrive ES-18xx sound cards. | 612 | Module for ESS AudioDrive ES-18xx sound cards. |
635 | 613 | ||
614 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
615 | |||
616 | with isapnp=0, the following options are available: | ||
617 | |||
636 | port - port # for ES-18xx chip (0x220,0x240,0x260) | 618 | port - port # for ES-18xx chip (0x220,0x240,0x260) |
637 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default) | 619 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default) |
638 | fm_port - port # for FM (optional, not used) | 620 | fm_port - port # for FM (optional, not used) |
639 | irq - IRQ # for ES-18xx chip (5,7,9,10) | 621 | irq - IRQ # for ES-18xx chip (5,7,9,10) |
640 | dma1 - first DMA # for ES-18xx chip (0,1,3) | 622 | dma1 - first DMA # for ES-18xx chip (0,1,3) |
641 | dma2 - first DMA # for ES-18xx chip (0,1,3) | 623 | dma2 - first DMA # for ES-18xx chip (0,1,3) |
642 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
643 | 624 | ||
644 | This module supports multiple cards, ISA PnP and autoprobe (without MPU-401 | 625 | This module supports multiple cards, ISA PnP and autoprobe (without MPU-401 |
645 | port if native ISA PnP routines are not used). | 626 | port if native ISA PnP routines are not used). |
@@ -763,9 +744,12 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
763 | VIA VT8251/VT8237A, | 744 | VIA VT8251/VT8237A, |
764 | SIS966, ULI M5461 | 745 | SIS966, ULI M5461 |
765 | 746 | ||
747 | [Multiple options for each card instance] | ||
766 | model - force the model name | 748 | model - force the model name |
767 | position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size) | 749 | position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size) |
768 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) | 750 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) |
751 | |||
752 | [Single (global) options] | ||
769 | single_cmd - Use single immediate commands to communicate with | 753 | single_cmd - Use single immediate commands to communicate with |
770 | codecs (for debugging only) | 754 | codecs (for debugging only) |
771 | enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) | 755 | enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) |
@@ -774,8 +758,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
774 | power_save_controller - Reset HD-audio controller in power-saving mode | 758 | power_save_controller - Reset HD-audio controller in power-saving mode |
775 | (default = on) | 759 | (default = on) |
776 | 760 | ||
777 | This module supports one card and autoprobe. | 761 | This module supports multiple cards and autoprobe. |
778 | 762 | ||
779 | Each codec may have a model table for different configurations. | 763 | Each codec may have a model table for different configurations. |
780 | If your machine isn't listed there, the default (usually minimal) | 764 | If your machine isn't listed there, the default (usually minimal) |
781 | configuration is set up. You can pass "model=<name>" option to | 765 | configuration is set up. You can pass "model=<name>" option to |
@@ -817,17 +801,23 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
817 | will Will laptops (PB V7900) | 801 | will Will laptops (PB V7900) |
818 | replacer Replacer 672V | 802 | replacer Replacer 672V |
819 | basic fixed pin assignment (old default model) | 803 | basic fixed pin assignment (old default model) |
804 | test for testing/debugging purpose, almost all controls can | ||
805 | adjusted. Appearing only when compiled with | ||
806 | $CONFIG_SND_DEBUG=y | ||
820 | auto auto-config reading BIOS (default) | 807 | auto auto-config reading BIOS (default) |
821 | 808 | ||
822 | ALC262 | 809 | ALC262 |
823 | fujitsu Fujitsu Laptop | 810 | fujitsu Fujitsu Laptop |
824 | hp-bpc HP xw4400/6400/8400/9400 laptops | 811 | hp-bpc HP xw4400/6400/8400/9400 laptops |
825 | hp-bpc-d7000 HP BPC D7000 | 812 | hp-bpc-d7000 HP BPC D7000 |
813 | hp-tc-t5735 HP Thin Client T5735 | ||
814 | hp-rp5700 HP RP5700 | ||
826 | benq Benq ED8 | 815 | benq Benq ED8 |
827 | benq-t31 Benq T31 | 816 | benq-t31 Benq T31 |
828 | hippo Hippo (ATI) with jack detection, Sony UX-90s | 817 | hippo Hippo (ATI) with jack detection, Sony UX-90s |
829 | hippo_1 Hippo (Benq) with jack detection | 818 | hippo_1 Hippo (Benq) with jack detection |
830 | sony-assamd Sony ASSAMD | 819 | sony-assamd Sony ASSAMD |
820 | ultra Samsung Q1 Ultra Vista model | ||
831 | basic fixed pin assignment w/o SPDIF | 821 | basic fixed pin assignment w/o SPDIF |
832 | auto auto-config reading BIOS (default) | 822 | auto auto-config reading BIOS (default) |
833 | 823 | ||
@@ -835,6 +825,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
835 | 3stack 3-stack model | 825 | 3stack 3-stack model |
836 | toshiba Toshiba A205 | 826 | toshiba Toshiba A205 |
837 | acer Acer laptops | 827 | acer Acer laptops |
828 | dell Dell OEM laptops (Vostro 1200) | ||
829 | test for testing/debugging purpose, almost all controls can | ||
830 | adjusted. Appearing only when compiled with | ||
831 | $CONFIG_SND_DEBUG=y | ||
838 | auto auto-config reading BIOS (default) | 832 | auto auto-config reading BIOS (default) |
839 | 833 | ||
840 | ALC662 | 834 | ALC662 |
@@ -843,6 +837,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
843 | 3stack-6ch-dig 3-stack (6-channel) with SPDIF | 837 | 3stack-6ch-dig 3-stack (6-channel) with SPDIF |
844 | 6stack-dig 6-stack with SPDIF | 838 | 6stack-dig 6-stack with SPDIF |
845 | lenovo-101e Lenovo laptop | 839 | lenovo-101e Lenovo laptop |
840 | eeepc-p701 ASUS Eeepc P701 | ||
841 | eeepc-ep20 ASUS Eeepc EP20 | ||
846 | auto auto-config reading BIOS (default) | 842 | auto auto-config reading BIOS (default) |
847 | 843 | ||
848 | ALC882/885 | 844 | ALC882/885 |
@@ -877,6 +873,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
877 | haier-w66 Haier W66 | 873 | haier-w66 Haier W66 |
878 | 6stack-hp HP machines with 6stack (Nettle boards) | 874 | 6stack-hp HP machines with 6stack (Nettle boards) |
879 | 3stack-hp HP machines with 3stack (Lucknow, Samba boards) | 875 | 3stack-hp HP machines with 3stack (Lucknow, Samba boards) |
876 | 6stack-dell Dell machines with 6stack (Inspiron 530) | ||
877 | mitac Mitac 8252D | ||
880 | auto auto-config reading BIOS (default) | 878 | auto auto-config reading BIOS (default) |
881 | 879 | ||
882 | ALC861/660 | 880 | ALC861/660 |
@@ -928,6 +926,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
928 | AD1984 | 926 | AD1984 |
929 | basic default configuration | 927 | basic default configuration |
930 | thinkpad Lenovo Thinkpad T61/X61 | 928 | thinkpad Lenovo Thinkpad T61/X61 |
929 | dell Dell T3400 | ||
931 | 930 | ||
932 | AD1986A | 931 | AD1986A |
933 | 6stack 6-jack, separate surrounds (default) | 932 | 6stack 6-jack, separate surrounds (default) |
@@ -947,7 +946,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
947 | auto auto-config reading BIOS (default) | 946 | auto auto-config reading BIOS (default) |
948 | 947 | ||
949 | Conexant 5045 | 948 | Conexant 5045 |
950 | laptop Laptop config | 949 | laptop-hpsense Laptop with HP sense (old model laptop) |
950 | laptop-micsense Laptop with Mic sense (old model fujitsu) | ||
951 | laptop-hpmicsense Laptop with HP and Mic senses | ||
952 | benq Benq R55E | ||
951 | test for testing/debugging purpose, almost all controls | 953 | test for testing/debugging purpose, almost all controls |
952 | can be adjusted. Appearing only when compiled with | 954 | can be adjusted. Appearing only when compiled with |
953 | $CONFIG_SND_DEBUG=y | 955 | $CONFIG_SND_DEBUG=y |
@@ -960,6 +962,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
960 | can be adjusted. Appearing only when compiled with | 962 | can be adjusted. Appearing only when compiled with |
961 | $CONFIG_SND_DEBUG=y | 963 | $CONFIG_SND_DEBUG=y |
962 | 964 | ||
965 | Conexant 5051 | ||
966 | laptop Basic Laptop config (default) | ||
967 | hp HP Spartan laptop | ||
968 | |||
963 | STAC9200 | 969 | STAC9200 |
964 | ref Reference board | 970 | ref Reference board |
965 | dell-d21 Dell (unknown) | 971 | dell-d21 Dell (unknown) |
@@ -1091,6 +1097,15 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1091 | 1097 | ||
1092 | See hdspm.txt for details. | 1098 | See hdspm.txt for details. |
1093 | 1099 | ||
1100 | Module snd-hifier | ||
1101 | ----------------- | ||
1102 | |||
1103 | Module for the MediaTek/TempoTec HiFier Fantasia sound card. | ||
1104 | |||
1105 | This module supports autoprobe and multiple cards. | ||
1106 | |||
1107 | Power management is _not_ supported. | ||
1108 | |||
1094 | Module snd-ice1712 | 1109 | Module snd-ice1712 |
1095 | ------------------ | 1110 | ------------------ |
1096 | 1111 | ||
@@ -1156,11 +1171,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1156 | * Chaintech 9CJS | 1171 | * Chaintech 9CJS |
1157 | * Chaintech AV-710 | 1172 | * Chaintech AV-710 |
1158 | * Shuttle SN25P | 1173 | * Shuttle SN25P |
1174 | * Onkyo SE-90PCI | ||
1175 | * Onkyo SE-200PCI | ||
1159 | 1176 | ||
1160 | model - Use the given board model, one of the following: | 1177 | model - Use the given board model, one of the following: |
1161 | revo51, revo71, amp2000, prodigy71, prodigy71lt, | 1178 | revo51, revo71, amp2000, prodigy71, prodigy71lt, |
1162 | prodigy192, aureon51, aureon71, universe, ap192, | 1179 | prodigy192, aureon51, aureon71, universe, ap192, |
1163 | k8x800, phase22, phase28, ms300, av710 | 1180 | k8x800, phase22, phase28, ms300, av710, se200pci, |
1181 | se90pci | ||
1164 | 1182 | ||
1165 | This module supports multiple cards and autoprobe. | 1183 | This module supports multiple cards and autoprobe. |
1166 | 1184 | ||
@@ -1257,15 +1275,19 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1257 | Module for Gravis UltraSound PnP, Dynasonic 3-D/Pro, STB Sound Rage 32 | 1275 | Module for Gravis UltraSound PnP, Dynasonic 3-D/Pro, STB Sound Rage 32 |
1258 | and other sound cards based on AMD InterWave (tm) chip. | 1276 | and other sound cards based on AMD InterWave (tm) chip. |
1259 | 1277 | ||
1260 | port - port # for InterWave chip (0x210,0x220,0x230,0x240,0x250,0x260) | ||
1261 | irq - IRQ # for InterWave chip (3,5,9,11,12,15) | ||
1262 | dma1 - DMA # for InterWave chip (0,1,3,5,6,7) | ||
1263 | dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable) | ||
1264 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | 1278 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) |
1265 | midi - 1 = MIDI UART enable, 0 = MIDI UART disable (default) | 1279 | midi - 1 = MIDI UART enable, 0 = MIDI UART disable (default) |
1266 | pcm_voices - reserved PCM voices for the synthesizer (default 2) | 1280 | pcm_voices - reserved PCM voices for the synthesizer (default 2) |
1267 | effect - 1 = InterWave effects enable (default 0); | 1281 | effect - 1 = InterWave effects enable (default 0); |
1268 | requires 8 voices | 1282 | requires 8 voices |
1283 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1284 | |||
1285 | with isapnp=0, the following options are available: | ||
1286 | |||
1287 | port - port # for InterWave chip (0x210,0x220,0x230,0x240,0x250,0x260) | ||
1288 | irq - IRQ # for InterWave chip (3,5,9,11,12,15) | ||
1289 | dma1 - DMA # for InterWave chip (0,1,3,5,6,7) | ||
1290 | dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable) | ||
1269 | 1291 | ||
1270 | This module supports multiple cards, autoprobe and ISA PnP. | 1292 | This module supports multiple cards, autoprobe and ISA PnP. |
1271 | 1293 | ||
@@ -1276,16 +1298,20 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1276 | and other sound cards based on AMD InterWave (tm) chip with TEA6330T | 1298 | and other sound cards based on AMD InterWave (tm) chip with TEA6330T |
1277 | circuit for extended control of bass, treble and master volume. | 1299 | circuit for extended control of bass, treble and master volume. |
1278 | 1300 | ||
1279 | port - port # for InterWave chip (0x210,0x220,0x230,0x240,0x250,0x260) | ||
1280 | port_tc - tone control (i2c bus) port # for TEA6330T chip (0x350,0x360,0x370,0x380) | ||
1281 | irq - IRQ # for InterWave chip (3,5,9,11,12,15) | ||
1282 | dma1 - DMA # for InterWave chip (0,1,3,5,6,7) | ||
1283 | dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable) | ||
1284 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | 1301 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) |
1285 | midi - 1 = MIDI UART enable, 0 = MIDI UART disable (default) | 1302 | midi - 1 = MIDI UART enable, 0 = MIDI UART disable (default) |
1286 | pcm_voices - reserved PCM voices for the synthesizer (default 2) | 1303 | pcm_voices - reserved PCM voices for the synthesizer (default 2) |
1287 | effect - 1 = InterWave effects enable (default 0); | 1304 | effect - 1 = InterWave effects enable (default 0); |
1288 | requires 8 voices | 1305 | requires 8 voices |
1306 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1307 | |||
1308 | with isapnp=0, the following options are available: | ||
1309 | |||
1310 | port - port # for InterWave chip (0x210,0x220,0x230,0x240,0x250,0x260) | ||
1311 | port_tc - tone control (i2c bus) port # for TEA6330T chip (0x350,0x360,0x370,0x380) | ||
1312 | irq - IRQ # for InterWave chip (3,5,9,11,12,15) | ||
1313 | dma1 - DMA # for InterWave chip (0,1,3,5,6,7) | ||
1314 | dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable) | ||
1289 | 1315 | ||
1290 | This module supports multiple cards, autoprobe and ISA PnP. | 1316 | This module supports multiple cards, autoprobe and ISA PnP. |
1291 | 1317 | ||
@@ -1473,6 +1499,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1473 | 1499 | ||
1474 | Module for Yamaha OPL3-SA2/SA3 sound cards. | 1500 | Module for Yamaha OPL3-SA2/SA3 sound cards. |
1475 | 1501 | ||
1502 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1503 | |||
1504 | with isapnp=0, the following options are available: | ||
1505 | |||
1476 | port - control port # for OPL3-SA chip (0x370) | 1506 | port - control port # for OPL3-SA chip (0x370) |
1477 | sb_port - SB port # for OPL3-SA chip (0x220,0x240) | 1507 | sb_port - SB port # for OPL3-SA chip (0x220,0x240) |
1478 | wss_port - WSS port # for OPL3-SA chip (0x530,0xe80,0xf40,0x604) | 1508 | wss_port - WSS port # for OPL3-SA chip (0x530,0xe80,0xf40,0x604) |
@@ -1481,7 +1511,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1481 | irq - IRQ # for OPL3-SA chip (5,7,9,10) | 1511 | irq - IRQ # for OPL3-SA chip (5,7,9,10) |
1482 | dma1 - first DMA # for Yamaha OPL3-SA chip (0,1,3) | 1512 | dma1 - first DMA # for Yamaha OPL3-SA chip (0,1,3) |
1483 | dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable | 1513 | dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable |
1484 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1485 | 1514 | ||
1486 | This module supports multiple cards and ISA PnP. It does not support | 1515 | This module supports multiple cards and ISA PnP. It does not support |
1487 | autoprobe (if ISA PnP is not used) thus all ports must be specified!!! | 1516 | autoprobe (if ISA PnP is not used) thus all ports must be specified!!! |
@@ -1494,6 +1523,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1494 | Module for sound cards based on OPTi 82c92x and Analog Devices AD1848 chips. | 1523 | Module for sound cards based on OPTi 82c92x and Analog Devices AD1848 chips. |
1495 | Module works with OAK Mozart cards as well. | 1524 | Module works with OAK Mozart cards as well. |
1496 | 1525 | ||
1526 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1527 | |||
1528 | with isapnp=0, the following options are available: | ||
1529 | |||
1497 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) | 1530 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) |
1498 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) | 1531 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) |
1499 | fm_port - port # for OPL3 device (0x388) | 1532 | fm_port - port # for OPL3 device (0x388) |
@@ -1508,6 +1541,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1508 | 1541 | ||
1509 | Module for sound cards based on OPTi 82c92x and Crystal CS4231 chips. | 1542 | Module for sound cards based on OPTi 82c92x and Crystal CS4231 chips. |
1510 | 1543 | ||
1544 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1545 | |||
1546 | with isapnp=0, the following options are available: | ||
1547 | |||
1511 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) | 1548 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) |
1512 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) | 1549 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) |
1513 | fm_port - port # for OPL3 device (0x388) | 1550 | fm_port - port # for OPL3 device (0x388) |
@@ -1523,6 +1560,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1523 | 1560 | ||
1524 | Module for sound cards based on OPTi 82c93x chips. | 1561 | Module for sound cards based on OPTi 82c93x chips. |
1525 | 1562 | ||
1563 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1564 | |||
1565 | with isapnp=0, the following options are available: | ||
1566 | |||
1526 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) | 1567 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) |
1527 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) | 1568 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) |
1528 | fm_port - port # for OPL3 device (0x388) | 1569 | fm_port - port # for OPL3 device (0x388) |
@@ -1533,6 +1574,22 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1533 | 1574 | ||
1534 | This module supports only one card, autoprobe and PnP. | 1575 | This module supports only one card, autoprobe and PnP. |
1535 | 1576 | ||
1577 | Module snd-oxygen | ||
1578 | ----------------- | ||
1579 | |||
1580 | Module for sound cards based on the C-Media CMI8788 chip: | ||
1581 | * Asound A-8788 | ||
1582 | * AuzenTech X-Meridian | ||
1583 | * Bgears b-Enspirer | ||
1584 | * Club3D Theatron DTS | ||
1585 | * HT-Omega Claro | ||
1586 | * Razer Barracuda AC-1 | ||
1587 | * Sondigo Inferno | ||
1588 | |||
1589 | This module supports autoprobe and multiple cards. | ||
1590 | |||
1591 | Power management is _not_ supported. | ||
1592 | |||
1536 | Module snd-pcxhr | 1593 | Module snd-pcxhr |
1537 | ---------------- | 1594 | ---------------- |
1538 | 1595 | ||
@@ -1647,6 +1704,12 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1647 | SoundBlaster AWE 32 (PnP), | 1704 | SoundBlaster AWE 32 (PnP), |
1648 | SoundBlaster AWE 64 PnP | 1705 | SoundBlaster AWE 64 PnP |
1649 | 1706 | ||
1707 | mic_agc - Mic Auto-Gain-Control - 0 = disable, 1 = enable (default) | ||
1708 | csp - ASP/CSP chip support - 0 = disable (default), 1 = enable | ||
1709 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1710 | |||
1711 | with isapnp=0, the following options are available: | ||
1712 | |||
1650 | port - port # for SB DSP 4.x chip (0x220,0x240,0x260) | 1713 | port - port # for SB DSP 4.x chip (0x220,0x240,0x260) |
1651 | mpu_port - port # for MPU-401 UART (0x300,0x330), -1 = disable | 1714 | mpu_port - port # for MPU-401 UART (0x300,0x330), -1 = disable |
1652 | awe_port - base port # for EMU8000 synthesizer (0x620,0x640,0x660) | 1715 | awe_port - base port # for EMU8000 synthesizer (0x620,0x640,0x660) |
@@ -1654,9 +1717,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1654 | irq - IRQ # for SB DSP 4.x chip (5,7,9,10) | 1717 | irq - IRQ # for SB DSP 4.x chip (5,7,9,10) |
1655 | dma8 - 8-bit DMA # for SB DSP 4.x chip (0,1,3) | 1718 | dma8 - 8-bit DMA # for SB DSP 4.x chip (0,1,3) |
1656 | dma16 - 16-bit DMA # for SB DSP 4.x chip (5,6,7) | 1719 | dma16 - 16-bit DMA # for SB DSP 4.x chip (5,6,7) |
1657 | mic_agc - Mic Auto-Gain-Control - 0 = disable, 1 = enable (default) | ||
1658 | csp - ASP/CSP chip support - 0 = disable (default), 1 = enable | ||
1659 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1660 | 1720 | ||
1661 | This module supports multiple cards, autoprobe and ISA PnP. | 1721 | This module supports multiple cards, autoprobe and ISA PnP. |
1662 | 1722 | ||
@@ -1739,18 +1799,21 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1739 | 1799 | ||
1740 | Module for Turtle Beach Maui, Tropez and Tropez+ sound cards. | 1800 | Module for Turtle Beach Maui, Tropez and Tropez+ sound cards. |
1741 | 1801 | ||
1802 | use_cs4232_midi - Use CS4232 MPU-401 interface | ||
1803 | (inaccessibly located inside your computer) | ||
1804 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1805 | |||
1806 | with isapnp=0, the following options are available: | ||
1807 | |||
1742 | cs4232_pcm_port - Port # for CS4232 PCM interface. | 1808 | cs4232_pcm_port - Port # for CS4232 PCM interface. |
1743 | cs4232_pcm_irq - IRQ # for CS4232 PCM interface (5,7,9,11,12,15). | 1809 | cs4232_pcm_irq - IRQ # for CS4232 PCM interface (5,7,9,11,12,15). |
1744 | cs4232_mpu_port - Port # for CS4232 MPU-401 interface. | 1810 | cs4232_mpu_port - Port # for CS4232 MPU-401 interface. |
1745 | cs4232_mpu_irq - IRQ # for CS4232 MPU-401 interface (9,11,12,15). | 1811 | cs4232_mpu_irq - IRQ # for CS4232 MPU-401 interface (9,11,12,15). |
1746 | use_cs4232_midi - Use CS4232 MPU-401 interface | ||
1747 | (inaccessibly located inside your computer) | ||
1748 | ics2115_port - Port # for ICS2115 | 1812 | ics2115_port - Port # for ICS2115 |
1749 | ics2115_irq - IRQ # for ICS2115 | 1813 | ics2115_irq - IRQ # for ICS2115 |
1750 | fm_port - FM OPL-3 Port # | 1814 | fm_port - FM OPL-3 Port # |
1751 | dma1 - DMA1 # for CS4232 PCM interface. | 1815 | dma1 - DMA1 # for CS4232 PCM interface. |
1752 | dma2 - DMA2 # for CS4232 PCM interface. | 1816 | dma2 - DMA2 # for CS4232 PCM interface. |
1753 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1754 | 1817 | ||
1755 | The below are options for wavefront_synth features: | 1818 | The below are options for wavefront_synth features: |
1756 | wf_raw - Assume that we need to boot the OS (default:no) | 1819 | wf_raw - Assume that we need to boot the OS (default:no) |
@@ -1965,6 +2028,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1965 | 2028 | ||
1966 | This module supports multiple cards. | 2029 | This module supports multiple cards. |
1967 | 2030 | ||
2031 | Module snd-virtuoso | ||
2032 | ------------------- | ||
2033 | |||
2034 | Module for sound cards based on the Asus AV200 chip, i.e., | ||
2035 | Xonar D2 and Xonar D2X. | ||
2036 | |||
2037 | This module supports autoprobe and multiple cards. | ||
2038 | |||
2039 | Power management is _not_ supported. | ||
2040 | |||
1968 | Module snd-vx222 | 2041 | Module snd-vx222 |
1969 | ---------------- | 2042 | ---------------- |
1970 | 2043 | ||
@@ -2135,6 +2208,23 @@ alias sound-slot-1 snd-ens1371 | |||
2135 | In this example, the interwave card is always loaded as the first card | 2208 | In this example, the interwave card is always loaded as the first card |
2136 | (index 0) and ens1371 as the second (index 1). | 2209 | (index 0) and ens1371 as the second (index 1). |
2137 | 2210 | ||
2211 | Alternative (and new) way to fixate the slot assignment is to use | ||
2212 | "slots" option of snd module. In the case above, specify like the | ||
2213 | following: | ||
2214 | |||
2215 | options snd slots=snd-interwave,snd-ens1371 | ||
2216 | |||
2217 | Then, the first slot (#0) is reserved for snd-interwave driver, and | ||
2218 | the second (#1) for snd-ens1371. You can omit index option in each | ||
2219 | driver if slots option is used (although you can still have them at | ||
2220 | the same time as long as they don't conflict). | ||
2221 | |||
2222 | The slots option is especially useful for avoiding the possible | ||
2223 | hot-plugging and the resultant slot conflict. For example, in the | ||
2224 | case above again, the first two slots are already reserved. If any | ||
2225 | other driver (e.g. snd-usb-audio) is loaded before snd-interwave or | ||
2226 | snd-ens1371, it will be assigned to the third or later slot. | ||
2227 | |||
2138 | 2228 | ||
2139 | ALSA PCM devices to OSS devices mapping | 2229 | ALSA PCM devices to OSS devices mapping |
2140 | ======================================= | 2230 | ======================================= |
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 2c3fc3cb3b6b..b03df4d4795c 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -18,7 +18,7 @@ | |||
18 | </affiliation> | 18 | </affiliation> |
19 | </author> | 19 | </author> |
20 | 20 | ||
21 | <date>September 10, 2007</date> | 21 | <date>Oct 15, 2007</date> |
22 | <edition>0.3.7</edition> | 22 | <edition>0.3.7</edition> |
23 | 23 | ||
24 | <abstract> | 24 | <abstract> |
@@ -67,7 +67,7 @@ | |||
67 | This document describes how to write an | 67 | This document describes how to write an |
68 | <ulink url="http://www.alsa-project.org/"><citetitle> | 68 | <ulink url="http://www.alsa-project.org/"><citetitle> |
69 | ALSA (Advanced Linux Sound Architecture)</citetitle></ulink> | 69 | ALSA (Advanced Linux Sound Architecture)</citetitle></ulink> |
70 | driver. The document focuses mainly on the PCI soundcard. | 70 | driver. The document focuses mainly on PCI soundcards. |
71 | In the case of other device types, the API might | 71 | In the case of other device types, the API might |
72 | be different, too. However, at least the ALSA kernel API is | 72 | be different, too. However, at least the ALSA kernel API is |
73 | consistent, and therefore it would be still a bit help for | 73 | consistent, and therefore it would be still a bit help for |
@@ -75,23 +75,23 @@ | |||
75 | </para> | 75 | </para> |
76 | 76 | ||
77 | <para> | 77 | <para> |
78 | The target of this document is ones who already have enough | 78 | This document targets people who already have enough |
79 | skill of C language and have the basic knowledge of linux | 79 | C language skills and have basic linux kernel programming |
80 | kernel programming. This document doesn't explain the general | 80 | knowledge. This document doesn't explain the general |
81 | topics of linux kernel codes and doesn't cover the detail of | 81 | topic of linux kernel coding and doesn't cover low-level |
82 | implementation of each low-level driver. It describes only how is | 82 | driver implementation details. It only describes |
83 | the standard way to write a PCI sound driver on ALSA. | 83 | the standard way to write a PCI sound driver on ALSA. |
84 | </para> | 84 | </para> |
85 | 85 | ||
86 | <para> | 86 | <para> |
87 | If you are already familiar with the older ALSA ver.0.5.x, you | 87 | If you are already familiar with the older ALSA ver.0.5.x API, you |
88 | can check the drivers such as <filename>es1938.c</filename> or | 88 | can check the drivers such as <filename>sound/pci/es1938.c</filename> or |
89 | <filename>maestro3.c</filename> which have also almost the same | 89 | <filename>sound/pci/maestro3.c</filename> which have also almost the same |
90 | code-base in the ALSA 0.5.x tree, so you can compare the differences. | 90 | code-base in the ALSA 0.5.x tree, so you can compare the differences. |
91 | </para> | 91 | </para> |
92 | 92 | ||
93 | <para> | 93 | <para> |
94 | This document is still a draft version. Any feedbacks and | 94 | This document is still a draft version. Any feedback and |
95 | corrections, please!! | 95 | corrections, please!! |
96 | </para> | 96 | </para> |
97 | </preface> | 97 | </preface> |
@@ -106,7 +106,7 @@ | |||
106 | <section id="file-tree-general"> | 106 | <section id="file-tree-general"> |
107 | <title>General</title> | 107 | <title>General</title> |
108 | <para> | 108 | <para> |
109 | The ALSA drivers are provided in the two ways. | 109 | The ALSA drivers are provided in two ways. |
110 | </para> | 110 | </para> |
111 | 111 | ||
112 | <para> | 112 | <para> |
@@ -114,15 +114,14 @@ | |||
114 | ALSA's ftp site, and another is the 2.6 (or later) Linux kernel | 114 | ALSA's ftp site, and another is the 2.6 (or later) Linux kernel |
115 | tree. To synchronize both, the ALSA driver tree is split into | 115 | tree. To synchronize both, the ALSA driver tree is split into |
116 | two different trees: alsa-kernel and alsa-driver. The former | 116 | two different trees: alsa-kernel and alsa-driver. The former |
117 | contains purely the source codes for the Linux 2.6 (or later) | 117 | contains purely the source code for the Linux 2.6 (or later) |
118 | tree. This tree is designed only for compilation on 2.6 or | 118 | tree. This tree is designed only for compilation on 2.6 or |
119 | later environment. The latter, alsa-driver, contains many subtle | 119 | later environment. The latter, alsa-driver, contains many subtle |
120 | files for compiling the ALSA driver on the outside of Linux | 120 | files for compiling ALSA drivers outside of the Linux kernel tree, |
121 | kernel like configure script, the wrapper functions for older, | 121 | wrapper functions for older 2.2 and 2.4 kernels, to adapt the latest kernel API, |
122 | 2.2 and 2.4 kernels, to adapt the latest kernel API, | ||
123 | and additional drivers which are still in development or in | 122 | and additional drivers which are still in development or in |
124 | tests. The drivers in alsa-driver tree will be moved to | 123 | tests. The drivers in alsa-driver tree will be moved to |
125 | alsa-kernel (eventually 2.6 kernel tree) once when they are | 124 | alsa-kernel (and eventually to the 2.6 kernel tree) when they are |
126 | finished and confirmed to work fine. | 125 | finished and confirmed to work fine. |
127 | </para> | 126 | </para> |
128 | 127 | ||
@@ -168,7 +167,7 @@ | |||
168 | <section id="file-tree-core-directory"> | 167 | <section id="file-tree-core-directory"> |
169 | <title>core directory</title> | 168 | <title>core directory</title> |
170 | <para> | 169 | <para> |
171 | This directory contains the middle layer, that is, the heart | 170 | This directory contains the middle layer which is the heart |
172 | of ALSA drivers. In this directory, the native ALSA modules are | 171 | of ALSA drivers. In this directory, the native ALSA modules are |
173 | stored. The sub-directories contain different modules and are | 172 | stored. The sub-directories contain different modules and are |
174 | dependent upon the kernel config. | 173 | dependent upon the kernel config. |
@@ -181,7 +180,7 @@ | |||
181 | The codes for PCM and mixer OSS emulation modules are stored | 180 | The codes for PCM and mixer OSS emulation modules are stored |
182 | in this directory. The rawmidi OSS emulation is included in | 181 | in this directory. The rawmidi OSS emulation is included in |
183 | the ALSA rawmidi code since it's quite small. The sequencer | 182 | the ALSA rawmidi code since it's quite small. The sequencer |
184 | code is stored in core/seq/oss directory (see | 183 | code is stored in <filename>core/seq/oss</filename> directory (see |
185 | <link linkend="file-tree-core-directory-seq-oss"><citetitle> | 184 | <link linkend="file-tree-core-directory-seq-oss"><citetitle> |
186 | below</citetitle></link>). | 185 | below</citetitle></link>). |
187 | </para> | 186 | </para> |
@@ -200,7 +199,7 @@ | |||
200 | <section id="file-tree-core-directory-seq"> | 199 | <section id="file-tree-core-directory-seq"> |
201 | <title>core/seq</title> | 200 | <title>core/seq</title> |
202 | <para> | 201 | <para> |
203 | This and its sub-directories are for the ALSA | 202 | This directory and its sub-directories are for the ALSA |
204 | sequencer. This directory contains the sequencer core and | 203 | sequencer. This directory contains the sequencer core and |
205 | primary sequencer modules such like snd-seq-midi, | 204 | primary sequencer modules such like snd-seq-midi, |
206 | snd-seq-virmidi, etc. They are compiled only when | 205 | snd-seq-virmidi, etc. They are compiled only when |
@@ -229,22 +228,22 @@ | |||
229 | <title>include directory</title> | 228 | <title>include directory</title> |
230 | <para> | 229 | <para> |
231 | This is the place for the public header files of ALSA drivers, | 230 | This is the place for the public header files of ALSA drivers, |
232 | which are to be exported to the user-space, or included by | 231 | which are to be exported to user-space, or included by |
233 | several files at different directories. Basically, the private | 232 | several files at different directories. Basically, the private |
234 | header files should not be placed in this directory, but you may | 233 | header files should not be placed in this directory, but you may |
235 | still find files there, due to historical reason :) | 234 | still find files there, due to historical reasons :) |
236 | </para> | 235 | </para> |
237 | </section> | 236 | </section> |
238 | 237 | ||
239 | <section id="file-tree-drivers-directory"> | 238 | <section id="file-tree-drivers-directory"> |
240 | <title>drivers directory</title> | 239 | <title>drivers directory</title> |
241 | <para> | 240 | <para> |
242 | This directory contains the codes shared among different drivers | 241 | This directory contains code shared among different drivers |
243 | on the different architectures. They are hence supposed not to be | 242 | on different architectures. They are hence supposed not to be |
244 | architecture-specific. | 243 | architecture-specific. |
245 | For example, the dummy pcm driver and the serial MIDI | 244 | For example, the dummy pcm driver and the serial MIDI |
246 | driver are found in this directory. In the sub-directories, | 245 | driver are found in this directory. In the sub-directories, |
247 | there are the codes for components which are independent from | 246 | there is code for components which are independent from |
248 | bus and cpu architectures. | 247 | bus and cpu architectures. |
249 | </para> | 248 | </para> |
250 | 249 | ||
@@ -271,7 +270,7 @@ | |||
271 | 270 | ||
272 | <para> | 271 | <para> |
273 | Although there is a standard i2c layer on Linux, ALSA has its | 272 | Although there is a standard i2c layer on Linux, ALSA has its |
274 | own i2c codes for some cards, because the soundcard needs only a | 273 | own i2c code for some cards, because the soundcard needs only a |
275 | simple operation and the standard i2c API is too complicated for | 274 | simple operation and the standard i2c API is too complicated for |
276 | such a purpose. | 275 | such a purpose. |
277 | </para> | 276 | </para> |
@@ -292,28 +291,28 @@ | |||
292 | 291 | ||
293 | <para> | 292 | <para> |
294 | So far, there is only Emu8000/Emu10k1 synth driver under | 293 | So far, there is only Emu8000/Emu10k1 synth driver under |
295 | synth/emux sub-directory. | 294 | the <filename>synth/emux</filename> sub-directory. |
296 | </para> | 295 | </para> |
297 | </section> | 296 | </section> |
298 | 297 | ||
299 | <section id="file-tree-pci-directory"> | 298 | <section id="file-tree-pci-directory"> |
300 | <title>pci directory</title> | 299 | <title>pci directory</title> |
301 | <para> | 300 | <para> |
302 | This and its sub-directories hold the top-level card modules | 301 | This directory and its sub-directories hold the top-level card modules |
303 | for PCI soundcards and the codes specific to the PCI BUS. | 302 | for PCI soundcards and the code specific to the PCI BUS. |
304 | </para> | 303 | </para> |
305 | 304 | ||
306 | <para> | 305 | <para> |
307 | The drivers compiled from a single file is stored directly on | 306 | The drivers compiled from a single file are stored directly |
308 | pci directory, while the drivers with several source files are | 307 | in the pci directory, while the drivers with several source files are |
309 | stored on its own sub-directory (e.g. emu10k1, ice1712). | 308 | stored on their own sub-directory (e.g. emu10k1, ice1712). |
310 | </para> | 309 | </para> |
311 | </section> | 310 | </section> |
312 | 311 | ||
313 | <section id="file-tree-isa-directory"> | 312 | <section id="file-tree-isa-directory"> |
314 | <title>isa directory</title> | 313 | <title>isa directory</title> |
315 | <para> | 314 | <para> |
316 | This and its sub-directories hold the top-level card modules | 315 | This directory and its sub-directories hold the top-level card modules |
317 | for ISA soundcards. | 316 | for ISA soundcards. |
318 | </para> | 317 | </para> |
319 | </section> | 318 | </section> |
@@ -321,16 +320,16 @@ | |||
321 | <section id="file-tree-arm-ppc-sparc-directories"> | 320 | <section id="file-tree-arm-ppc-sparc-directories"> |
322 | <title>arm, ppc, and sparc directories</title> | 321 | <title>arm, ppc, and sparc directories</title> |
323 | <para> | 322 | <para> |
324 | These are for the top-level card modules which are | 323 | They are used for top-level card modules which are |
325 | specific to each given architecture. | 324 | specific to one of these architectures. |
326 | </para> | 325 | </para> |
327 | </section> | 326 | </section> |
328 | 327 | ||
329 | <section id="file-tree-usb-directory"> | 328 | <section id="file-tree-usb-directory"> |
330 | <title>usb directory</title> | 329 | <title>usb directory</title> |
331 | <para> | 330 | <para> |
332 | This contains the USB-audio driver. On the latest version, the | 331 | This directory contains the USB-audio driver. In the latest version, the |
333 | USB MIDI driver is integrated together with usb-audio driver. | 332 | USB MIDI driver is integrated in the usb-audio driver. |
334 | </para> | 333 | </para> |
335 | </section> | 334 | </section> |
336 | 335 | ||
@@ -338,16 +337,17 @@ | |||
338 | <title>pcmcia directory</title> | 337 | <title>pcmcia directory</title> |
339 | <para> | 338 | <para> |
340 | The PCMCIA, especially PCCard drivers will go here. CardBus | 339 | The PCMCIA, especially PCCard drivers will go here. CardBus |
341 | drivers will be on pci directory, because its API is identical | 340 | drivers will be in the pci directory, because their API is identical |
342 | with the standard PCI cards. | 341 | to that of standard PCI cards. |
343 | </para> | 342 | </para> |
344 | </section> | 343 | </section> |
345 | 344 | ||
346 | <section id="file-tree-oss-directory"> | 345 | <section id="file-tree-oss-directory"> |
347 | <title>oss directory</title> | 346 | <title>oss directory</title> |
348 | <para> | 347 | <para> |
349 | The OSS/Lite source files are stored here on Linux 2.6 (or | 348 | The OSS/Lite source files are stored here in Linux 2.6 (or |
350 | later) tree. (In the ALSA driver tarball, it's empty, of course :) | 349 | later) tree. In the ALSA driver tarball, this directory is empty, |
350 | of course :) | ||
351 | </para> | 351 | </para> |
352 | </section> | 352 | </section> |
353 | </chapter> | 353 | </chapter> |
@@ -362,7 +362,7 @@ | |||
362 | <section id="basic-flow-outline"> | 362 | <section id="basic-flow-outline"> |
363 | <title>Outline</title> | 363 | <title>Outline</title> |
364 | <para> | 364 | <para> |
365 | The minimum flow of PCI soundcard is like the following: | 365 | The minimum flow for PCI soundcards is as follows: |
366 | 366 | ||
367 | <itemizedlist> | 367 | <itemizedlist> |
368 | <listitem><para>define the PCI ID table (see the section | 368 | <listitem><para>define the PCI ID table (see the section |
@@ -370,9 +370,13 @@ | |||
370 | </citetitle></link>).</para></listitem> | 370 | </citetitle></link>).</para></listitem> |
371 | <listitem><para>create <function>probe()</function> callback.</para></listitem> | 371 | <listitem><para>create <function>probe()</function> callback.</para></listitem> |
372 | <listitem><para>create <function>remove()</function> callback.</para></listitem> | 372 | <listitem><para>create <function>remove()</function> callback.</para></listitem> |
373 | <listitem><para>create pci_driver table which contains the three pointers above.</para></listitem> | 373 | <listitem><para>create a <structname>pci_driver</structname> structure |
374 | <listitem><para>create <function>init()</function> function just calling <function>pci_register_driver()</function> to register the pci_driver table defined above.</para></listitem> | 374 | containing the three pointers above.</para></listitem> |
375 | <listitem><para>create <function>exit()</function> function to call <function>pci_unregister_driver()</function> function.</para></listitem> | 375 | <listitem><para>create an <function>init()</function> function just calling |
376 | the <function>pci_register_driver()</function> to register the pci_driver table | ||
377 | defined above.</para></listitem> | ||
378 | <listitem><para>create an <function>exit()</function> function to call | ||
379 | the <function>pci_unregister_driver()</function> function.</para></listitem> | ||
376 | </itemizedlist> | 380 | </itemizedlist> |
377 | </para> | 381 | </para> |
378 | </section> | 382 | </section> |
@@ -382,15 +386,14 @@ | |||
382 | <para> | 386 | <para> |
383 | The code example is shown below. Some parts are kept | 387 | The code example is shown below. Some parts are kept |
384 | unimplemented at this moment but will be filled in the | 388 | unimplemented at this moment but will be filled in the |
385 | succeeding sections. The numbers in comment lines of | 389 | next sections. The numbers in the comment lines of the |
386 | <function>snd_mychip_probe()</function> function are the | 390 | <function>snd_mychip_probe()</function> function |
387 | markers. | 391 | refer to details explained in the following section. |
388 | 392 | ||
389 | <example> | 393 | <example> |
390 | <title>Basic Flow for PCI Drivers Example</title> | 394 | <title>Basic Flow for PCI Drivers - Example</title> |
391 | <programlisting> | 395 | <programlisting> |
392 | <![CDATA[ | 396 | <![CDATA[ |
393 | #include <sound/driver.h> | ||
394 | #include <linux/init.h> | 397 | #include <linux/init.h> |
395 | #include <linux/pci.h> | 398 | #include <linux/pci.h> |
396 | #include <linux/slab.h> | 399 | #include <linux/slab.h> |
@@ -398,6 +401,7 @@ | |||
398 | #include <sound/initval.h> | 401 | #include <sound/initval.h> |
399 | 402 | ||
400 | /* module parameters (see "Module Parameters") */ | 403 | /* module parameters (see "Module Parameters") */ |
404 | /* SNDRV_CARDS: maximum number of cards supported by this module */ | ||
401 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 405 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
402 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 406 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
403 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 407 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; |
@@ -405,13 +409,13 @@ | |||
405 | /* definition of the chip-specific record */ | 409 | /* definition of the chip-specific record */ |
406 | struct mychip { | 410 | struct mychip { |
407 | struct snd_card *card; | 411 | struct snd_card *card; |
408 | /* rest of implementation will be in the section | 412 | /* the rest of the implementation will be in section |
409 | * "PCI Resource Managements" | 413 | * "PCI Resource Management" |
410 | */ | 414 | */ |
411 | }; | 415 | }; |
412 | 416 | ||
413 | /* chip-specific destructor | 417 | /* chip-specific destructor |
414 | * (see "PCI Resource Managements") | 418 | * (see "PCI Resource Management") |
415 | */ | 419 | */ |
416 | static int snd_mychip_free(struct mychip *chip) | 420 | static int snd_mychip_free(struct mychip *chip) |
417 | { | 421 | { |
@@ -442,7 +446,7 @@ | |||
442 | *rchip = NULL; | 446 | *rchip = NULL; |
443 | 447 | ||
444 | /* check PCI availability here | 448 | /* check PCI availability here |
445 | * (see "PCI Resource Managements") | 449 | * (see "PCI Resource Management") |
446 | */ | 450 | */ |
447 | .... | 451 | .... |
448 | 452 | ||
@@ -454,7 +458,7 @@ | |||
454 | chip->card = card; | 458 | chip->card = card; |
455 | 459 | ||
456 | /* rest of initialization here; will be implemented | 460 | /* rest of initialization here; will be implemented |
457 | * later, see "PCI Resource Managements" | 461 | * later, see "PCI Resource Management" |
458 | */ | 462 | */ |
459 | .... | 463 | .... |
460 | 464 | ||
@@ -521,7 +525,7 @@ | |||
521 | return 0; | 525 | return 0; |
522 | } | 526 | } |
523 | 527 | ||
524 | /* destructor -- see "Destructor" sub-section */ | 528 | /* destructor -- see the "Destructor" sub-section */ |
525 | static void __devexit snd_mychip_remove(struct pci_dev *pci) | 529 | static void __devexit snd_mychip_remove(struct pci_dev *pci) |
526 | { | 530 | { |
527 | snd_card_free(pci_get_drvdata(pci)); | 531 | snd_card_free(pci_get_drvdata(pci)); |
@@ -536,16 +540,16 @@ | |||
536 | <section id="basic-flow-constructor"> | 540 | <section id="basic-flow-constructor"> |
537 | <title>Constructor</title> | 541 | <title>Constructor</title> |
538 | <para> | 542 | <para> |
539 | The real constructor of PCI drivers is probe callback. The | 543 | The real constructor of PCI drivers is the <function>probe</function> callback. |
540 | probe callback and other component-constructors which are called | 544 | The <function>probe</function> callback and other component-constructors which are called |
541 | from probe callback should be defined with | 545 | from the <function>probe</function> callback should be defined with |
542 | <parameter>__devinit</parameter> prefix. You | 546 | the <parameter>__devinit</parameter> prefix. You |
543 | cannot use <parameter>__init</parameter> prefix for them, | 547 | cannot use the <parameter>__init</parameter> prefix for them, |
544 | because any PCI device could be a hotplug device. | 548 | because any PCI device could be a hotplug device. |
545 | </para> | 549 | </para> |
546 | 550 | ||
547 | <para> | 551 | <para> |
548 | In the probe callback, the following scheme is often used. | 552 | In the <function>probe</function> callback, the following scheme is often used. |
549 | </para> | 553 | </para> |
550 | 554 | ||
551 | <section id="basic-flow-constructor-device-index"> | 555 | <section id="basic-flow-constructor-device-index"> |
@@ -570,7 +574,7 @@ | |||
570 | </para> | 574 | </para> |
571 | 575 | ||
572 | <para> | 576 | <para> |
573 | At each time probe callback is called, check the | 577 | Each time the <function>probe</function> callback is called, check the |
574 | availability of the device. If not available, simply increment | 578 | availability of the device. If not available, simply increment |
575 | the device index and returns. dev will be incremented also | 579 | the device index and returns. dev will be incremented also |
576 | later (<link | 580 | later (<link |
@@ -594,7 +598,7 @@ | |||
594 | </para> | 598 | </para> |
595 | 599 | ||
596 | <para> | 600 | <para> |
597 | The detail will be explained in the section | 601 | The details will be explained in the section |
598 | <link linkend="card-management-card-instance"><citetitle> | 602 | <link linkend="card-management-card-instance"><citetitle> |
599 | Management of Cards and Components</citetitle></link>. | 603 | Management of Cards and Components</citetitle></link>. |
600 | </para> | 604 | </para> |
@@ -619,9 +623,9 @@ | |||
619 | </programlisting> | 623 | </programlisting> |
620 | </informalexample> | 624 | </informalexample> |
621 | 625 | ||
622 | The detail will be explained in the section <link | 626 | The details will be explained in the section <link |
623 | linkend="pci-resource"><citetitle>PCI Resource | 627 | linkend="pci-resource"><citetitle>PCI Resource |
624 | Managements</citetitle></link>. | 628 | Management</citetitle></link>. |
625 | </para> | 629 | </para> |
626 | </section> | 630 | </section> |
627 | 631 | ||
@@ -640,7 +644,7 @@ | |||
640 | </informalexample> | 644 | </informalexample> |
641 | 645 | ||
642 | The driver field holds the minimal ID string of the | 646 | The driver field holds the minimal ID string of the |
643 | chip. This is referred by alsa-lib's configurator, so keep it | 647 | chip. This is used by alsa-lib's configurator, so keep it |
644 | simple but unique. | 648 | simple but unique. |
645 | Even the same driver can have different driver IDs to | 649 | Even the same driver can have different driver IDs to |
646 | distinguish the functionality of each chip type. | 650 | distinguish the functionality of each chip type. |
@@ -648,7 +652,7 @@ | |||
648 | 652 | ||
649 | <para> | 653 | <para> |
650 | The shortname field is a string shown as more verbose | 654 | The shortname field is a string shown as more verbose |
651 | name. The longname field contains the information which is | 655 | name. The longname field contains the information |
652 | shown in <filename>/proc/asound/cards</filename>. | 656 | shown in <filename>/proc/asound/cards</filename>. |
653 | </para> | 657 | </para> |
654 | </section> | 658 | </section> |
@@ -703,7 +707,7 @@ | |||
703 | </informalexample> | 707 | </informalexample> |
704 | 708 | ||
705 | In the above, the card record is stored. This pointer is | 709 | In the above, the card record is stored. This pointer is |
706 | referred in the remove callback and power-management | 710 | used in the remove callback and power-management |
707 | callbacks, too. | 711 | callbacks, too. |
708 | </para> | 712 | </para> |
709 | </section> | 713 | </section> |
@@ -746,7 +750,6 @@ | |||
746 | <informalexample> | 750 | <informalexample> |
747 | <programlisting> | 751 | <programlisting> |
748 | <![CDATA[ | 752 | <![CDATA[ |
749 | #include <sound/driver.h> | ||
750 | #include <linux/init.h> | 753 | #include <linux/init.h> |
751 | #include <linux/pci.h> | 754 | #include <linux/pci.h> |
752 | #include <linux/slab.h> | 755 | #include <linux/slab.h> |
@@ -757,22 +760,22 @@ | |||
757 | </informalexample> | 760 | </informalexample> |
758 | 761 | ||
759 | where the last one is necessary only when module options are | 762 | where the last one is necessary only when module options are |
760 | defined in the source file. If the codes are split to several | 763 | defined in the source file. If the code is split into several |
761 | files, the file without module options don't need them. | 764 | files, the files without module options don't need them. |
762 | </para> | 765 | </para> |
763 | 766 | ||
764 | <para> | 767 | <para> |
765 | In addition to them, you'll need | 768 | In addition to these headers, you'll need |
766 | <filename><linux/interrupt.h></filename> for the interrupt | 769 | <filename><linux/interrupt.h></filename> for interrupt |
767 | handling, and <filename><asm/io.h></filename> for the i/o | 770 | handling, and <filename><asm/io.h></filename> for I/O |
768 | access. If you use <function>mdelay()</function> or | 771 | access. If you use the <function>mdelay()</function> or |
769 | <function>udelay()</function> functions, you'll need to include | 772 | <function>udelay()</function> functions, you'll need to include |
770 | <filename><linux/delay.h></filename>, too. | 773 | <filename><linux/delay.h></filename> too. |
771 | </para> | 774 | </para> |
772 | 775 | ||
773 | <para> | 776 | <para> |
774 | The ALSA interfaces like PCM or control API are defined in other | 777 | The ALSA interfaces like the PCM and control APIs are defined in other |
775 | header files as <filename><sound/xxx.h></filename>. | 778 | <filename><sound/xxx.h></filename> header files. |
776 | They have to be included after | 779 | They have to be included after |
777 | <filename><sound/core.h></filename>. | 780 | <filename><sound/core.h></filename>. |
778 | </para> | 781 | </para> |
@@ -795,12 +798,12 @@ | |||
795 | 798 | ||
796 | <para> | 799 | <para> |
797 | A card record is the headquarters of the soundcard. It manages | 800 | A card record is the headquarters of the soundcard. It manages |
798 | the list of whole devices (components) on the soundcard, such as | 801 | the whole list of devices (components) on the soundcard, such as |
799 | PCM, mixers, MIDI, synthesizer, and so on. Also, the card | 802 | PCM, mixers, MIDI, synthesizer, and so on. Also, the card |
800 | record holds the ID and the name strings of the card, manages | 803 | record holds the ID and the name strings of the card, manages |
801 | the root of proc files, and controls the power-management states | 804 | the root of proc files, and controls the power-management states |
802 | and hotplug disconnections. The component list on the card | 805 | and hotplug disconnections. The component list on the card |
803 | record is used to manage the proper releases of resources at | 806 | record is used to manage the correct release of resources at |
804 | destruction. | 807 | destruction. |
805 | </para> | 808 | </para> |
806 | 809 | ||
@@ -824,9 +827,8 @@ | |||
824 | <constant>THIS_MODULE</constant>), | 827 | <constant>THIS_MODULE</constant>), |
825 | and the size of extra-data space. The last argument is used to | 828 | and the size of extra-data space. The last argument is used to |
826 | allocate card->private_data for the | 829 | allocate card->private_data for the |
827 | chip-specific data. Note that this data | 830 | chip-specific data. Note that these data |
828 | <emphasis>is</emphasis> allocated by | 831 | are allocated by <function>snd_card_new()</function>. |
829 | <function>snd_card_new()</function>. | ||
830 | </para> | 832 | </para> |
831 | </section> | 833 | </section> |
832 | 834 | ||
@@ -834,10 +836,10 @@ | |||
834 | <title>Components</title> | 836 | <title>Components</title> |
835 | <para> | 837 | <para> |
836 | After the card is created, you can attach the components | 838 | After the card is created, you can attach the components |
837 | (devices) to the card instance. On ALSA driver, a component is | 839 | (devices) to the card instance. In an ALSA driver, a component is |
838 | represented as a struct <structname>snd_device</structname> object. | 840 | represented as a struct <structname>snd_device</structname> object. |
839 | A component can be a PCM instance, a control interface, a raw | 841 | A component can be a PCM instance, a control interface, a raw |
840 | MIDI interface, etc. Each of such instances has one component | 842 | MIDI interface, etc. Each such instance has one component |
841 | entry. | 843 | entry. |
842 | </para> | 844 | </para> |
843 | 845 | ||
@@ -859,7 +861,7 @@ | |||
859 | (<constant>SNDRV_DEV_XXX</constant>), the data pointer, and the | 861 | (<constant>SNDRV_DEV_XXX</constant>), the data pointer, and the |
860 | callback pointers (<parameter>&ops</parameter>). The | 862 | callback pointers (<parameter>&ops</parameter>). The |
861 | device-level defines the type of components and the order of | 863 | device-level defines the type of components and the order of |
862 | registration and de-registration. For most of components, the | 864 | registration and de-registration. For most components, the |
863 | device-level is already defined. For a user-defined component, | 865 | device-level is already defined. For a user-defined component, |
864 | you can use <constant>SNDRV_DEV_LOWLEVEL</constant>. | 866 | you can use <constant>SNDRV_DEV_LOWLEVEL</constant>. |
865 | </para> | 867 | </para> |
@@ -867,13 +869,13 @@ | |||
867 | <para> | 869 | <para> |
868 | This function itself doesn't allocate the data space. The data | 870 | This function itself doesn't allocate the data space. The data |
869 | must be allocated manually beforehand, and its pointer is passed | 871 | must be allocated manually beforehand, and its pointer is passed |
870 | as the argument. This pointer is used as the identifier | 872 | as the argument. This pointer is used as the |
871 | (<parameter>chip</parameter> in the above example) for the | 873 | (<parameter>chip</parameter> identifier in the above example) |
872 | instance. | 874 | for the instance. |
873 | </para> | 875 | </para> |
874 | 876 | ||
875 | <para> | 877 | <para> |
876 | Each ALSA pre-defined component such as ac97 or pcm calls | 878 | Each pre-defined ALSA component such as ac97 and pcm calls |
877 | <function>snd_device_new()</function> inside its | 879 | <function>snd_device_new()</function> inside its |
878 | constructor. The destructor for each component is defined in the | 880 | constructor. The destructor for each component is defined in the |
879 | callback pointers. Hence, you don't need to take care of | 881 | callback pointers. Hence, you don't need to take care of |
@@ -881,19 +883,19 @@ | |||
881 | </para> | 883 | </para> |
882 | 884 | ||
883 | <para> | 885 | <para> |
884 | If you would like to create your own component, you need to | 886 | If you wish to create your own component, you need to |
885 | set the destructor function to dev_free callback in | 887 | set the destructor function to the dev_free callback in |
886 | <parameter>ops</parameter>, so that it can be released | 888 | the <parameter>ops</parameter>, so that it can be released |
887 | automatically via <function>snd_card_free()</function>. The | 889 | automatically via <function>snd_card_free()</function>. |
888 | example will be shown later as an implementation of a | 890 | The next example will show an implementation of chip-specific |
889 | chip-specific data. | 891 | data. |
890 | </para> | 892 | </para> |
891 | </section> | 893 | </section> |
892 | 894 | ||
893 | <section id="card-management-chip-specific"> | 895 | <section id="card-management-chip-specific"> |
894 | <title>Chip-Specific Data</title> | 896 | <title>Chip-Specific Data</title> |
895 | <para> | 897 | <para> |
896 | The chip-specific information, e.g. the i/o port address, its | 898 | Chip-specific information, e.g. the I/O port address, its |
897 | resource pointer, or the irq number, is stored in the | 899 | resource pointer, or the irq number, is stored in the |
898 | chip-specific record. | 900 | chip-specific record. |
899 | 901 | ||
@@ -909,13 +911,14 @@ | |||
909 | </para> | 911 | </para> |
910 | 912 | ||
911 | <para> | 913 | <para> |
912 | In general, there are two ways to allocate the chip record. | 914 | In general, there are two ways of allocating the chip record. |
913 | </para> | 915 | </para> |
914 | 916 | ||
915 | <section id="card-management-chip-specific-snd-card-new"> | 917 | <section id="card-management-chip-specific-snd-card-new"> |
916 | <title>1. Allocating via <function>snd_card_new()</function>.</title> | 918 | <title>1. Allocating via <function>snd_card_new()</function>.</title> |
917 | <para> | 919 | <para> |
918 | As mentioned above, you can pass the extra-data-length to the 4th argument of <function>snd_card_new()</function>, i.e. | 920 | As mentioned above, you can pass the extra-data-length |
921 | to the 4th argument of <function>snd_card_new()</function>, i.e. | ||
919 | 922 | ||
920 | <informalexample> | 923 | <informalexample> |
921 | <programlisting> | 924 | <programlisting> |
@@ -925,7 +928,7 @@ | |||
925 | </programlisting> | 928 | </programlisting> |
926 | </informalexample> | 929 | </informalexample> |
927 | 930 | ||
928 | whether struct <structname>mychip</structname> is the type of the chip record. | 931 | struct <structname>mychip</structname> is the type of the chip record. |
929 | </para> | 932 | </para> |
930 | 933 | ||
931 | <para> | 934 | <para> |
@@ -1037,8 +1040,8 @@ | |||
1037 | <title>Registration and Release</title> | 1040 | <title>Registration and Release</title> |
1038 | <para> | 1041 | <para> |
1039 | After all components are assigned, register the card instance | 1042 | After all components are assigned, register the card instance |
1040 | by calling <function>snd_card_register()</function>. The access | 1043 | by calling <function>snd_card_register()</function>. Access |
1041 | to the device files are enabled at this point. That is, before | 1044 | to the device files is enabled at this point. That is, before |
1042 | <function>snd_card_register()</function> is called, the | 1045 | <function>snd_card_register()</function> is called, the |
1043 | components are safely inaccessible from external side. If this | 1046 | components are safely inaccessible from external side. If this |
1044 | call fails, exit the probe function after releasing the card via | 1047 | call fails, exit the probe function after releasing the card via |
@@ -1047,7 +1050,7 @@ | |||
1047 | 1050 | ||
1048 | <para> | 1051 | <para> |
1049 | For releasing the card instance, you can call simply | 1052 | For releasing the card instance, you can call simply |
1050 | <function>snd_card_free()</function>. As already mentioned, all | 1053 | <function>snd_card_free()</function>. As mentioned earlier, all |
1051 | components are released automatically by this call. | 1054 | components are released automatically by this call. |
1052 | </para> | 1055 | </para> |
1053 | 1056 | ||
@@ -1055,7 +1058,7 @@ | |||
1055 | As further notes, the destructors (both | 1058 | As further notes, the destructors (both |
1056 | <function>snd_mychip_dev_free</function> and | 1059 | <function>snd_mychip_dev_free</function> and |
1057 | <function>snd_mychip_free</function>) cannot be defined with | 1060 | <function>snd_mychip_free</function>) cannot be defined with |
1058 | <parameter>__devexit</parameter> prefix, because they may be | 1061 | the <parameter>__devexit</parameter> prefix, because they may be |
1059 | called from the constructor, too, at the false path. | 1062 | called from the constructor, too, at the false path. |
1060 | </para> | 1063 | </para> |
1061 | 1064 | ||
@@ -1071,20 +1074,20 @@ | |||
1071 | 1074 | ||
1072 | 1075 | ||
1073 | <!-- ****************************************************** --> | 1076 | <!-- ****************************************************** --> |
1074 | <!-- PCI Resource Managements --> | 1077 | <!-- PCI Resource Management --> |
1075 | <!-- ****************************************************** --> | 1078 | <!-- ****************************************************** --> |
1076 | <chapter id="pci-resource"> | 1079 | <chapter id="pci-resource"> |
1077 | <title>PCI Resource Managements</title> | 1080 | <title>PCI Resource Management</title> |
1078 | 1081 | ||
1079 | <section id="pci-resource-example"> | 1082 | <section id="pci-resource-example"> |
1080 | <title>Full Code Example</title> | 1083 | <title>Full Code Example</title> |
1081 | <para> | 1084 | <para> |
1082 | In this section, we'll finish the chip-specific constructor, | 1085 | In this section, we'll complete the chip-specific constructor, |
1083 | destructor and PCI entries. The example code is shown first, | 1086 | destructor and PCI entries. Example code is shown first, |
1084 | below. | 1087 | below. |
1085 | 1088 | ||
1086 | <example> | 1089 | <example> |
1087 | <title>PCI Resource Managements Example</title> | 1090 | <title>PCI Resource Management Example</title> |
1088 | <programlisting> | 1091 | <programlisting> |
1089 | <![CDATA[ | 1092 | <![CDATA[ |
1090 | struct mychip { | 1093 | struct mychip { |
@@ -1103,7 +1106,7 @@ | |||
1103 | /* release the irq */ | 1106 | /* release the irq */ |
1104 | if (chip->irq >= 0) | 1107 | if (chip->irq >= 0) |
1105 | free_irq(chip->irq, chip); | 1108 | free_irq(chip->irq, chip); |
1106 | /* release the i/o ports & memory */ | 1109 | /* release the I/O ports & memory */ |
1107 | pci_release_regions(chip->pci); | 1110 | pci_release_regions(chip->pci); |
1108 | /* disable the PCI entry */ | 1111 | /* disable the PCI entry */ |
1109 | pci_disable_device(chip->pci); | 1112 | pci_disable_device(chip->pci); |
@@ -1196,13 +1199,13 @@ | |||
1196 | .remove = __devexit_p(snd_mychip_remove), | 1199 | .remove = __devexit_p(snd_mychip_remove), |
1197 | }; | 1200 | }; |
1198 | 1201 | ||
1199 | /* initialization of the module */ | 1202 | /* module initialization */ |
1200 | static int __init alsa_card_mychip_init(void) | 1203 | static int __init alsa_card_mychip_init(void) |
1201 | { | 1204 | { |
1202 | return pci_register_driver(&driver); | 1205 | return pci_register_driver(&driver); |
1203 | } | 1206 | } |
1204 | 1207 | ||
1205 | /* clean up the module */ | 1208 | /* module clean up */ |
1206 | static void __exit alsa_card_mychip_exit(void) | 1209 | static void __exit alsa_card_mychip_exit(void) |
1207 | { | 1210 | { |
1208 | pci_unregister_driver(&driver); | 1211 | pci_unregister_driver(&driver); |
@@ -1228,10 +1231,10 @@ | |||
1228 | </para> | 1231 | </para> |
1229 | 1232 | ||
1230 | <para> | 1233 | <para> |
1231 | In the case of PCI devices, you have to call at first | 1234 | In the case of PCI devices, you first have to call |
1232 | <function>pci_enable_device()</function> function before | 1235 | the <function>pci_enable_device()</function> function before |
1233 | allocating resources. Also, you need to set the proper PCI DMA | 1236 | allocating resources. Also, you need to set the proper PCI DMA |
1234 | mask to limit the accessed i/o range. In some cases, you might | 1237 | mask to limit the accessed I/O range. In some cases, you might |
1235 | need to call <function>pci_set_master()</function> function, | 1238 | need to call <function>pci_set_master()</function> function, |
1236 | too. | 1239 | too. |
1237 | </para> | 1240 | </para> |
@@ -1261,15 +1264,15 @@ | |||
1261 | <section id="pci-resource-resource-allocation"> | 1264 | <section id="pci-resource-resource-allocation"> |
1262 | <title>Resource Allocation</title> | 1265 | <title>Resource Allocation</title> |
1263 | <para> | 1266 | <para> |
1264 | The allocation of I/O ports and irqs are done via standard kernel | 1267 | The allocation of I/O ports and irqs is done via standard kernel |
1265 | functions. Unlike ALSA ver.0.5.x., there are no helpers for | 1268 | functions. Unlike ALSA ver.0.5.x., there are no helpers for |
1266 | that. And these resources must be released in the destructor | 1269 | that. And these resources must be released in the destructor |
1267 | function (see below). Also, on ALSA 0.9.x, you don't need to | 1270 | function (see below). Also, on ALSA 0.9.x, you don't need to |
1268 | allocate (pseudo-)DMA for PCI like ALSA 0.5.x. | 1271 | allocate (pseudo-)DMA for PCI like in ALSA 0.5.x. |
1269 | </para> | 1272 | </para> |
1270 | 1273 | ||
1271 | <para> | 1274 | <para> |
1272 | Now assume that this PCI device has an I/O port with 8 bytes | 1275 | Now assume that the PCI device has an I/O port with 8 bytes |
1273 | and an interrupt. Then struct <structname>mychip</structname> will have the | 1276 | and an interrupt. Then struct <structname>mychip</structname> will have the |
1274 | following fields: | 1277 | following fields: |
1275 | 1278 | ||
@@ -1288,7 +1291,7 @@ | |||
1288 | </para> | 1291 | </para> |
1289 | 1292 | ||
1290 | <para> | 1293 | <para> |
1291 | For an i/o port (and also a memory region), you need to have | 1294 | For an I/O port (and also a memory region), you need to have |
1292 | the resource pointer for the standard resource management. For | 1295 | the resource pointer for the standard resource management. For |
1293 | an irq, you have to keep only the irq number (integer). But you | 1296 | an irq, you have to keep only the irq number (integer). But you |
1294 | need to initialize this number as -1 before actual allocation, | 1297 | need to initialize this number as -1 before actual allocation, |
@@ -1299,7 +1302,7 @@ | |||
1299 | </para> | 1302 | </para> |
1300 | 1303 | ||
1301 | <para> | 1304 | <para> |
1302 | The allocation of an i/o port is done like this: | 1305 | The allocation of an I/O port is done like this: |
1303 | 1306 | ||
1304 | <informalexample> | 1307 | <informalexample> |
1305 | <programlisting> | 1308 | <programlisting> |
@@ -1318,12 +1321,12 @@ | |||
1318 | 1321 | ||
1319 | <para> | 1322 | <para> |
1320 | <!-- obsolete --> | 1323 | <!-- obsolete --> |
1321 | It will reserve the i/o port region of 8 bytes of the given | 1324 | It will reserve the I/O port region of 8 bytes of the given |
1322 | PCI device. The returned value, chip->res_port, is allocated | 1325 | PCI device. The returned value, chip->res_port, is allocated |
1323 | via <function>kmalloc()</function> by | 1326 | via <function>kmalloc()</function> by |
1324 | <function>request_region()</function>. The pointer must be | 1327 | <function>request_region()</function>. The pointer must be |
1325 | released via <function>kfree()</function>, but there is some | 1328 | released via <function>kfree()</function>, but there is a |
1326 | problem regarding this. This issue will be explained more below. | 1329 | problem with this. This issue will be explained later. |
1327 | </para> | 1330 | </para> |
1328 | 1331 | ||
1329 | <para> | 1332 | <para> |
@@ -1351,8 +1354,8 @@ | |||
1351 | </para> | 1354 | </para> |
1352 | 1355 | ||
1353 | <para> | 1356 | <para> |
1354 | On the PCI bus, the interrupts can be shared. Thus, | 1357 | On the PCI bus, interrupts can be shared. Thus, |
1355 | <constant>IRQF_SHARED</constant> is given as the interrupt flag of | 1358 | <constant>IRQF_SHARED</constant> is used as the interrupt flag of |
1356 | <function>request_irq()</function>. | 1359 | <function>request_irq()</function>. |
1357 | </para> | 1360 | </para> |
1358 | 1361 | ||
@@ -1364,7 +1367,7 @@ | |||
1364 | </para> | 1367 | </para> |
1365 | 1368 | ||
1366 | <para> | 1369 | <para> |
1367 | I won't define the detail of the interrupt handler at this | 1370 | I won't give details about the interrupt handler at this |
1368 | point, but at least its appearance can be explained now. The | 1371 | point, but at least its appearance can be explained now. The |
1369 | interrupt handler looks usually like the following: | 1372 | interrupt handler looks usually like the following: |
1370 | 1373 | ||
@@ -1386,11 +1389,11 @@ | |||
1386 | Now let's write the corresponding destructor for the resources | 1389 | Now let's write the corresponding destructor for the resources |
1387 | above. The role of destructor is simple: disable the hardware | 1390 | above. The role of destructor is simple: disable the hardware |
1388 | (if already activated) and release the resources. So far, we | 1391 | (if already activated) and release the resources. So far, we |
1389 | have no hardware part, so the disabling is not written here. | 1392 | have no hardware part, so the disabling code is not written here. |
1390 | </para> | 1393 | </para> |
1391 | 1394 | ||
1392 | <para> | 1395 | <para> |
1393 | For releasing the resources, <quote>check-and-release</quote> | 1396 | To release the resources, the <quote>check-and-release</quote> |
1394 | method is a safer way. For the interrupt, do like this: | 1397 | method is a safer way. For the interrupt, do like this: |
1395 | 1398 | ||
1396 | <informalexample> | 1399 | <informalexample> |
@@ -1410,7 +1413,7 @@ | |||
1410 | <para> | 1413 | <para> |
1411 | When you requested I/O ports or memory regions via | 1414 | When you requested I/O ports or memory regions via |
1412 | <function>pci_request_region()</function> or | 1415 | <function>pci_request_region()</function> or |
1413 | <function>pci_request_regions()</function> like this example, | 1416 | <function>pci_request_regions()</function> like in this example, |
1414 | release the resource(s) using the corresponding function, | 1417 | release the resource(s) using the corresponding function, |
1415 | <function>pci_release_region()</function> or | 1418 | <function>pci_release_region()</function> or |
1416 | <function>pci_release_regions()</function>. | 1419 | <function>pci_release_regions()</function>. |
@@ -1429,7 +1432,7 @@ | |||
1429 | or <function>request_mem_region</function>, you can release it via | 1432 | or <function>request_mem_region</function>, you can release it via |
1430 | <function>release_resource()</function>. Suppose that you keep | 1433 | <function>release_resource()</function>. Suppose that you keep |
1431 | the resource pointer returned from <function>request_region()</function> | 1434 | the resource pointer returned from <function>request_region()</function> |
1432 | in chip->res_port, the release procedure looks like below: | 1435 | in chip->res_port, the release procedure looks like: |
1433 | 1436 | ||
1434 | <informalexample> | 1437 | <informalexample> |
1435 | <programlisting> | 1438 | <programlisting> |
@@ -1442,7 +1445,7 @@ | |||
1442 | 1445 | ||
1443 | <para> | 1446 | <para> |
1444 | Don't forget to call <function>pci_disable_device()</function> | 1447 | Don't forget to call <function>pci_disable_device()</function> |
1445 | before all finished. | 1448 | before the end. |
1446 | </para> | 1449 | </para> |
1447 | 1450 | ||
1448 | <para> | 1451 | <para> |
@@ -1459,14 +1462,14 @@ | |||
1459 | 1462 | ||
1460 | <para> | 1463 | <para> |
1461 | Again, remember that you cannot | 1464 | Again, remember that you cannot |
1462 | set <parameter>__devexit</parameter> prefix for this destructor. | 1465 | use the <parameter>__devexit</parameter> prefix for this destructor. |
1463 | </para> | 1466 | </para> |
1464 | 1467 | ||
1465 | <para> | 1468 | <para> |
1466 | We didn't implement the hardware-disabling part in the above. | 1469 | We didn't implement the hardware disabling part in the above. |
1467 | If you need to do this, please note that the destructor may be | 1470 | If you need to do this, please note that the destructor may be |
1468 | called even before the initialization of the chip is completed. | 1471 | called even before the initialization of the chip is completed. |
1469 | It would be better to have a flag to skip the hardware-disabling | 1472 | It would be better to have a flag to skip hardware disabling |
1470 | if the hardware was not initialized yet. | 1473 | if the hardware was not initialized yet. |
1471 | </para> | 1474 | </para> |
1472 | 1475 | ||
@@ -1475,14 +1478,14 @@ | |||
1475 | <function>snd_device_new()</function> with | 1478 | <function>snd_device_new()</function> with |
1476 | <constant>SNDRV_DEV_LOWLELVEL</constant> , its destructor is | 1479 | <constant>SNDRV_DEV_LOWLELVEL</constant> , its destructor is |
1477 | called at the last. That is, it is assured that all other | 1480 | called at the last. That is, it is assured that all other |
1478 | components like PCMs and controls have been already released. | 1481 | components like PCMs and controls have already been released. |
1479 | You don't have to call stopping PCMs, etc. explicitly, but just | 1482 | You don't have to stop PCMs, etc. explicitly, but just |
1480 | stop the hardware in the low-level. | 1483 | call low-level hardware stopping. |
1481 | </para> | 1484 | </para> |
1482 | 1485 | ||
1483 | <para> | 1486 | <para> |
1484 | The management of a memory-mapped region is almost as same as | 1487 | The management of a memory-mapped region is almost as same as |
1485 | the management of an i/o port. You'll need three fields like | 1488 | the management of an I/O port. You'll need three fields like |
1486 | the following: | 1489 | the following: |
1487 | 1490 | ||
1488 | <informalexample> | 1491 | <informalexample> |
@@ -1561,8 +1564,8 @@ | |||
1561 | <section id="pci-resource-entries"> | 1564 | <section id="pci-resource-entries"> |
1562 | <title>PCI Entries</title> | 1565 | <title>PCI Entries</title> |
1563 | <para> | 1566 | <para> |
1564 | So far, so good. Let's finish the rest of missing PCI | 1567 | So far, so good. Let's finish the missing PCI |
1565 | stuffs. At first, we need a | 1568 | stuff. At first, we need a |
1566 | <structname>pci_device_id</structname> table for this | 1569 | <structname>pci_device_id</structname> table for this |
1567 | chipset. It's a table of PCI vendor/device ID number, and some | 1570 | chipset. It's a table of PCI vendor/device ID number, and some |
1568 | masks. | 1571 | masks. |
@@ -1588,13 +1591,13 @@ | |||
1588 | 1591 | ||
1589 | <para> | 1592 | <para> |
1590 | The first and second fields of | 1593 | The first and second fields of |
1591 | <structname>pci_device_id</structname> struct are the vendor and | 1594 | the <structname>pci_device_id</structname> structure are the vendor and |
1592 | device IDs. If you have nothing special to filter the matching | 1595 | device IDs. If you have no reason to filter the matching |
1593 | devices, you can use the rest of fields like above. The last | 1596 | devices, you can leave the remaining fields as above. The last |
1594 | field of <structname>pci_device_id</structname> struct is a | 1597 | field of the <structname>pci_device_id</structname> struct contains |
1595 | private data for this entry. You can specify any value here, for | 1598 | private data for this entry. You can specify any value here, for |
1596 | example, to tell the type of different operations per each | 1599 | example, to define specific operations for supported device IDs. |
1597 | device IDs. Such an example is found in intel8x0 driver. | 1600 | Such an example is found in the intel8x0 driver. |
1598 | </para> | 1601 | </para> |
1599 | 1602 | ||
1600 | <para> | 1603 | <para> |
@@ -1621,10 +1624,10 @@ | |||
1621 | 1624 | ||
1622 | <para> | 1625 | <para> |
1623 | The <structfield>probe</structfield> and | 1626 | The <structfield>probe</structfield> and |
1624 | <structfield>remove</structfield> functions are what we already | 1627 | <structfield>remove</structfield> functions have already |
1625 | defined in | 1628 | been defined in the previous sections. |
1626 | the previous sections. The <structfield>remove</structfield> should | 1629 | The <structfield>remove</structfield> function should |
1627 | be defined with | 1630 | be defined with the |
1628 | <function>__devexit_p()</function> macro, so that it's not | 1631 | <function>__devexit_p()</function> macro, so that it's not |
1629 | defined for built-in (and non-hot-pluggable) case. The | 1632 | defined for built-in (and non-hot-pluggable) case. The |
1630 | <structfield>name</structfield> | 1633 | <structfield>name</structfield> |
@@ -1665,8 +1668,7 @@ | |||
1665 | 1668 | ||
1666 | <para> | 1669 | <para> |
1667 | Oh, one thing was forgotten. If you have no exported symbols, | 1670 | Oh, one thing was forgotten. If you have no exported symbols, |
1668 | you need to declare it on 2.2 or 2.4 kernels (on 2.6 kernels | 1671 | you need to declare it in 2.2 or 2.4 kernels (it's not necessary in 2.6 kernels). |
1669 | it's not necessary, though). | ||
1670 | 1672 | ||
1671 | <informalexample> | 1673 | <informalexample> |
1672 | <programlisting> | 1674 | <programlisting> |
@@ -1698,7 +1700,7 @@ | |||
1698 | 1700 | ||
1699 | <para> | 1701 | <para> |
1700 | For accessing to the PCM layer, you need to include | 1702 | For accessing to the PCM layer, you need to include |
1701 | <filename><sound/pcm.h></filename> above all. In addition, | 1703 | <filename><sound/pcm.h></filename> first. In addition, |
1702 | <filename><sound/pcm_params.h></filename> might be needed | 1704 | <filename><sound/pcm_params.h></filename> might be needed |
1703 | if you access to some functions related with hw_param. | 1705 | if you access to some functions related with hw_param. |
1704 | </para> | 1706 | </para> |
@@ -1707,21 +1709,21 @@ | |||
1707 | Each card device can have up to four pcm instances. A pcm | 1709 | Each card device can have up to four pcm instances. A pcm |
1708 | instance corresponds to a pcm device file. The limitation of | 1710 | instance corresponds to a pcm device file. The limitation of |
1709 | number of instances comes only from the available bit size of | 1711 | number of instances comes only from the available bit size of |
1710 | the linux's device number. Once when 64bit device number is | 1712 | the Linux's device numbers. Once when 64bit device number is |
1711 | used, we'll have more available pcm instances. | 1713 | used, we'll have more pcm instances available. |
1712 | </para> | 1714 | </para> |
1713 | 1715 | ||
1714 | <para> | 1716 | <para> |
1715 | A pcm instance consists of pcm playback and capture streams, | 1717 | A pcm instance consists of pcm playback and capture streams, |
1716 | and each pcm stream consists of one or more pcm substreams. Some | 1718 | and each pcm stream consists of one or more pcm substreams. Some |
1717 | soundcard supports the multiple-playback function. For example, | 1719 | soundcards support multiple playback functions. For example, |
1718 | emu10k1 has a PCM playback of 32 stereo substreams. In this case, at | 1720 | emu10k1 has a PCM playback of 32 stereo substreams. In this case, at |
1719 | each open, a free substream is (usually) automatically chosen | 1721 | each open, a free substream is (usually) automatically chosen |
1720 | and opened. Meanwhile, when only one substream exists and it was | 1722 | and opened. Meanwhile, when only one substream exists and it was |
1721 | already opened, the succeeding open will result in the blocking | 1723 | already opened, the successful open will either block |
1722 | or the error with <constant>EAGAIN</constant> according to the | 1724 | or error with <constant>EAGAIN</constant> according to the |
1723 | file open mode. But you don't have to know the detail in your | 1725 | file open mode. But you don't have to care about such details in your |
1724 | driver. The PCM middle layer will take all such jobs. | 1726 | driver. The PCM middle layer will take care of such work. |
1725 | </para> | 1727 | </para> |
1726 | </section> | 1728 | </section> |
1727 | 1729 | ||
@@ -1944,7 +1946,7 @@ | |||
1944 | <section id="pcm-interface-constructor"> | 1946 | <section id="pcm-interface-constructor"> |
1945 | <title>Constructor</title> | 1947 | <title>Constructor</title> |
1946 | <para> | 1948 | <para> |
1947 | A pcm instance is allocated by <function>snd_pcm_new()</function> | 1949 | A pcm instance is allocated by the <function>snd_pcm_new()</function> |
1948 | function. It would be better to create a constructor for pcm, | 1950 | function. It would be better to create a constructor for pcm, |
1949 | namely, | 1951 | namely, |
1950 | 1952 | ||
@@ -1971,23 +1973,23 @@ | |||
1971 | </para> | 1973 | </para> |
1972 | 1974 | ||
1973 | <para> | 1975 | <para> |
1974 | The <function>snd_pcm_new()</function> function takes the four | 1976 | The <function>snd_pcm_new()</function> function takes four |
1975 | arguments. The first argument is the card pointer to which this | 1977 | arguments. The first argument is the card pointer to which this |
1976 | pcm is assigned, and the second is the ID string. | 1978 | pcm is assigned, and the second is the ID string. |
1977 | </para> | 1979 | </para> |
1978 | 1980 | ||
1979 | <para> | 1981 | <para> |
1980 | The third argument (<parameter>index</parameter>, 0 in the | 1982 | The third argument (<parameter>index</parameter>, 0 in the |
1981 | above) is the index of this new pcm. It begins from zero. When | 1983 | above) is the index of this new pcm. It begins from zero. If |
1982 | you will create more than one pcm instances, specify the | 1984 | you create more than one pcm instances, specify the |
1983 | different numbers in this argument. For example, | 1985 | different numbers in this argument. For example, |
1984 | <parameter>index</parameter> = 1 for the second PCM device. | 1986 | <parameter>index</parameter> = 1 for the second PCM device. |
1985 | </para> | 1987 | </para> |
1986 | 1988 | ||
1987 | <para> | 1989 | <para> |
1988 | The fourth and fifth arguments are the number of substreams | 1990 | The fourth and fifth arguments are the number of substreams |
1989 | for playback and capture, respectively. Here both 1 are given in | 1991 | for playback and capture, respectively. Here 1 is used for |
1990 | the above example. When no playback or no capture is available, | 1992 | both arguments. When no playback or capture substreams are available, |
1991 | pass 0 to the corresponding argument. | 1993 | pass 0 to the corresponding argument. |
1992 | </para> | 1994 | </para> |
1993 | 1995 | ||
@@ -2045,13 +2047,13 @@ | |||
2045 | </programlisting> | 2047 | </programlisting> |
2046 | </informalexample> | 2048 | </informalexample> |
2047 | 2049 | ||
2048 | Each of callbacks is explained in the subsection | 2050 | All the callbacks are described in the |
2049 | <link linkend="pcm-interface-operators"><citetitle> | 2051 | <link linkend="pcm-interface-operators"><citetitle> |
2050 | Operators</citetitle></link>. | 2052 | Operators</citetitle></link> subsection. |
2051 | </para> | 2053 | </para> |
2052 | 2054 | ||
2053 | <para> | 2055 | <para> |
2054 | After setting the operators, most likely you'd like to | 2056 | After setting the operators, you probably will want to |
2055 | pre-allocate the buffer. For the pre-allocation, simply call | 2057 | pre-allocate the buffer. For the pre-allocation, simply call |
2056 | the following: | 2058 | the following: |
2057 | 2059 | ||
@@ -2065,8 +2067,8 @@ | |||
2065 | </programlisting> | 2067 | </programlisting> |
2066 | </informalexample> | 2068 | </informalexample> |
2067 | 2069 | ||
2068 | It will allocate up to 64kB buffer as default. The details of | 2070 | It will allocate a buffer up to 64kB as default. |
2069 | buffer management will be described in the later section <link | 2071 | Buffer management details will be described in the later section <link |
2070 | linkend="buffer-and-memory"><citetitle>Buffer and Memory | 2072 | linkend="buffer-and-memory"><citetitle>Buffer and Memory |
2071 | Management</citetitle></link>. | 2073 | Management</citetitle></link>. |
2072 | </para> | 2074 | </para> |
@@ -2095,13 +2097,13 @@ | |||
2095 | <para> | 2097 | <para> |
2096 | The destructor for a pcm instance is not always | 2098 | The destructor for a pcm instance is not always |
2097 | necessary. Since the pcm device will be released by the middle | 2099 | necessary. Since the pcm device will be released by the middle |
2098 | layer code automatically, you don't have to call destructor | 2100 | layer code automatically, you don't have to call the destructor |
2099 | explicitly. | 2101 | explicitly. |
2100 | </para> | 2102 | </para> |
2101 | 2103 | ||
2102 | <para> | 2104 | <para> |
2103 | The destructor would be necessary when you created some | 2105 | The destructor would be necessary if you created |
2104 | special records internally and need to release them. In such a | 2106 | special records internally and needed to release them. In such a |
2105 | case, set the destructor function to | 2107 | case, set the destructor function to |
2106 | pcm->private_free: | 2108 | pcm->private_free: |
2107 | 2109 | ||
@@ -2141,16 +2143,15 @@ | |||
2141 | When the PCM substream is opened, a PCM runtime instance is | 2143 | When the PCM substream is opened, a PCM runtime instance is |
2142 | allocated and assigned to the substream. This pointer is | 2144 | allocated and assigned to the substream. This pointer is |
2143 | accessible via <constant>substream->runtime</constant>. | 2145 | accessible via <constant>substream->runtime</constant>. |
2144 | This runtime pointer holds the various information; it holds | 2146 | This runtime pointer holds most information you need |
2145 | the copy of hw_params and sw_params configurations, the buffer | 2147 | to control the PCM: the copy of hw_params and sw_params configurations, the buffer |
2146 | pointers, mmap records, spinlocks, etc. Almost everything you | 2148 | pointers, mmap records, spinlocks, etc. |
2147 | need for controlling the PCM can be found there. | ||
2148 | </para> | 2149 | </para> |
2149 | 2150 | ||
2150 | <para> | 2151 | <para> |
2151 | The definition of runtime instance is found in | 2152 | The definition of runtime instance is found in |
2152 | <filename><sound/pcm.h></filename>. Here is the | 2153 | <filename><sound/pcm.h></filename>. Here are |
2153 | copy from the file. | 2154 | the contents of this file: |
2154 | <informalexample> | 2155 | <informalexample> |
2155 | <programlisting> | 2156 | <programlisting> |
2156 | <![CDATA[ | 2157 | <![CDATA[ |
@@ -2185,7 +2186,6 @@ struct _snd_pcm_runtime { | |||
2185 | struct timespec tstamp_mode; /* mmap timestamp is updated */ | 2186 | struct timespec tstamp_mode; /* mmap timestamp is updated */ |
2186 | unsigned int period_step; | 2187 | unsigned int period_step; |
2187 | unsigned int sleep_min; /* min ticks to sleep */ | 2188 | unsigned int sleep_min; /* min ticks to sleep */ |
2188 | snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ | ||
2189 | snd_pcm_uframes_t start_threshold; | 2189 | snd_pcm_uframes_t start_threshold; |
2190 | snd_pcm_uframes_t stop_threshold; | 2190 | snd_pcm_uframes_t stop_threshold; |
2191 | snd_pcm_uframes_t silence_threshold; /* Silence filling happens when | 2191 | snd_pcm_uframes_t silence_threshold; /* Silence filling happens when |
@@ -2244,7 +2244,7 @@ struct _snd_pcm_runtime { | |||
2244 | <para> | 2244 | <para> |
2245 | For the operators (callbacks) of each sound driver, most of | 2245 | For the operators (callbacks) of each sound driver, most of |
2246 | these records are supposed to be read-only. Only the PCM | 2246 | these records are supposed to be read-only. Only the PCM |
2247 | middle-layer changes / updates these info. The exceptions are | 2247 | middle-layer changes / updates them. The exceptions are |
2248 | the hardware description (hw), interrupt callbacks | 2248 | the hardware description (hw), interrupt callbacks |
2249 | (transfer_ack_xxx), DMA buffer information, and the private | 2249 | (transfer_ack_xxx), DMA buffer information, and the private |
2250 | data. Besides, if you use the standard buffer allocation | 2250 | data. Besides, if you use the standard buffer allocation |
@@ -2285,7 +2285,7 @@ struct _snd_pcm_runtime { | |||
2285 | </para> | 2285 | </para> |
2286 | 2286 | ||
2287 | <para> | 2287 | <para> |
2288 | Typically, you'll have a hardware descriptor like below: | 2288 | Typically, you'll have a hardware descriptor as below: |
2289 | <informalexample> | 2289 | <informalexample> |
2290 | <programlisting> | 2290 | <programlisting> |
2291 | <![CDATA[ | 2291 | <![CDATA[ |
@@ -2320,10 +2320,10 @@ struct _snd_pcm_runtime { | |||
2320 | <constant>SNDRV_PCM_INFO_XXX</constant>. Here, at least, you | 2320 | <constant>SNDRV_PCM_INFO_XXX</constant>. Here, at least, you |
2321 | have to specify whether the mmap is supported and which | 2321 | have to specify whether the mmap is supported and which |
2322 | interleaved format is supported. | 2322 | interleaved format is supported. |
2323 | When the mmap is supported, add | 2323 | When the is supported, add the |
2324 | <constant>SNDRV_PCM_INFO_MMAP</constant> flag here. When the | 2324 | <constant>SNDRV_PCM_INFO_MMAP</constant> flag here. When the |
2325 | hardware supports the interleaved or the non-interleaved | 2325 | hardware supports the interleaved or the non-interleaved |
2326 | format, <constant>SNDRV_PCM_INFO_INTERLEAVED</constant> or | 2326 | formats, <constant>SNDRV_PCM_INFO_INTERLEAVED</constant> or |
2327 | <constant>SNDRV_PCM_INFO_NONINTERLEAVED</constant> flag must | 2327 | <constant>SNDRV_PCM_INFO_NONINTERLEAVED</constant> flag must |
2328 | be set, respectively. If both are supported, you can set both, | 2328 | be set, respectively. If both are supported, you can set both, |
2329 | too. | 2329 | too. |
@@ -2331,7 +2331,7 @@ struct _snd_pcm_runtime { | |||
2331 | 2331 | ||
2332 | <para> | 2332 | <para> |
2333 | In the above example, <constant>MMAP_VALID</constant> and | 2333 | In the above example, <constant>MMAP_VALID</constant> and |
2334 | <constant>BLOCK_TRANSFER</constant> are specified for OSS mmap | 2334 | <constant>BLOCK_TRANSFER</constant> are specified for the OSS mmap |
2335 | mode. Usually both are set. Of course, | 2335 | mode. Usually both are set. Of course, |
2336 | <constant>MMAP_VALID</constant> is set only if the mmap is | 2336 | <constant>MMAP_VALID</constant> is set only if the mmap is |
2337 | really supported. | 2337 | really supported. |
@@ -2345,11 +2345,11 @@ struct _snd_pcm_runtime { | |||
2345 | <quote>pause</quote> operation, while the | 2345 | <quote>pause</quote> operation, while the |
2346 | <constant>RESUME</constant> bit means that the pcm supports | 2346 | <constant>RESUME</constant> bit means that the pcm supports |
2347 | the full <quote>suspend/resume</quote> operation. | 2347 | the full <quote>suspend/resume</quote> operation. |
2348 | If <constant>PAUSE</constant> flag is set, | 2348 | If the <constant>PAUSE</constant> flag is set, |
2349 | the <structfield>trigger</structfield> callback below | 2349 | the <structfield>trigger</structfield> callback below |
2350 | must handle the corresponding (pause push/release) commands. | 2350 | must handle the corresponding (pause push/release) commands. |
2351 | The suspend/resume trigger commands can be defined even without | 2351 | The suspend/resume trigger commands can be defined even without |
2352 | <constant>RESUME</constant> flag. See <link | 2352 | the <constant>RESUME</constant> flag. See <link |
2353 | linkend="power-management"><citetitle> | 2353 | linkend="power-management"><citetitle> |
2354 | Power Management</citetitle></link> section for details. | 2354 | Power Management</citetitle></link> section for details. |
2355 | </para> | 2355 | </para> |
@@ -2382,7 +2382,7 @@ struct _snd_pcm_runtime { | |||
2382 | <constant>CONTINUOUS</constant> bit additionally. | 2382 | <constant>CONTINUOUS</constant> bit additionally. |
2383 | The pre-defined rate bits are provided only for typical | 2383 | The pre-defined rate bits are provided only for typical |
2384 | rates. If your chip supports unconventional rates, you need to add | 2384 | rates. If your chip supports unconventional rates, you need to add |
2385 | <constant>KNOT</constant> bit and set up the hardware | 2385 | the <constant>KNOT</constant> bit and set up the hardware |
2386 | constraint manually (explained later). | 2386 | constraint manually (explained later). |
2387 | </para> | 2387 | </para> |
2388 | </listitem> | 2388 | </listitem> |
@@ -2390,8 +2390,8 @@ struct _snd_pcm_runtime { | |||
2390 | <listitem> | 2390 | <listitem> |
2391 | <para> | 2391 | <para> |
2392 | <structfield>rate_min</structfield> and | 2392 | <structfield>rate_min</structfield> and |
2393 | <structfield>rate_max</structfield> define the minimal and | 2393 | <structfield>rate_max</structfield> define the minimum and |
2394 | maximal sample rate. This should correspond somehow to | 2394 | maximum sample rate. This should correspond somehow to |
2395 | <structfield>rates</structfield> bits. | 2395 | <structfield>rates</structfield> bits. |
2396 | </para> | 2396 | </para> |
2397 | </listitem> | 2397 | </listitem> |
@@ -2400,7 +2400,7 @@ struct _snd_pcm_runtime { | |||
2400 | <para> | 2400 | <para> |
2401 | <structfield>channel_min</structfield> and | 2401 | <structfield>channel_min</structfield> and |
2402 | <structfield>channel_max</structfield> | 2402 | <structfield>channel_max</structfield> |
2403 | define, as you might already expected, the minimal and maximal | 2403 | define, as you might already expected, the minimum and maximum |
2404 | number of channels. | 2404 | number of channels. |
2405 | </para> | 2405 | </para> |
2406 | </listitem> | 2406 | </listitem> |
@@ -2408,21 +2408,21 @@ struct _snd_pcm_runtime { | |||
2408 | <listitem> | 2408 | <listitem> |
2409 | <para> | 2409 | <para> |
2410 | <structfield>buffer_bytes_max</structfield> defines the | 2410 | <structfield>buffer_bytes_max</structfield> defines the |
2411 | maximal buffer size in bytes. There is no | 2411 | maximum buffer size in bytes. There is no |
2412 | <structfield>buffer_bytes_min</structfield> field, since | 2412 | <structfield>buffer_bytes_min</structfield> field, since |
2413 | it can be calculated from the minimal period size and the | 2413 | it can be calculated from the minimum period size and the |
2414 | minimal number of periods. | 2414 | minimum number of periods. |
2415 | Meanwhile, <structfield>period_bytes_min</structfield> and | 2415 | Meanwhile, <structfield>period_bytes_min</structfield> and |
2416 | define the minimal and maximal size of the period in bytes. | 2416 | define the minimum and maximum size of the period in bytes. |
2417 | <structfield>periods_max</structfield> and | 2417 | <structfield>periods_max</structfield> and |
2418 | <structfield>periods_min</structfield> define the maximal and | 2418 | <structfield>periods_min</structfield> define the maximum and |
2419 | minimal number of periods in the buffer. | 2419 | minimum number of periods in the buffer. |
2420 | </para> | 2420 | </para> |
2421 | 2421 | ||
2422 | <para> | 2422 | <para> |
2423 | The <quote>period</quote> is a term, that corresponds to | 2423 | The <quote>period</quote> is a term that corresponds to |
2424 | fragment in the OSS world. The period defines the size at | 2424 | a fragment in the OSS world. The period defines the size at |
2425 | which the PCM interrupt is generated. This size strongly | 2425 | which a PCM interrupt is generated. This size strongly |
2426 | depends on the hardware. | 2426 | depends on the hardware. |
2427 | Generally, the smaller period size will give you more | 2427 | Generally, the smaller period size will give you more |
2428 | interrupts, that is, more controls. | 2428 | interrupts, that is, more controls. |
@@ -2435,8 +2435,8 @@ struct _snd_pcm_runtime { | |||
2435 | <listitem> | 2435 | <listitem> |
2436 | <para> | 2436 | <para> |
2437 | There is also a field <structfield>fifo_size</structfield>. | 2437 | There is also a field <structfield>fifo_size</structfield>. |
2438 | This specifies the size of the hardware FIFO, but it's not | 2438 | This specifies the size of the hardware FIFO, but currently it |
2439 | used currently in the driver nor in the alsa-lib. So, you | 2439 | is neither used in the driver nor in the alsa-lib. So, you |
2440 | can ignore this field. | 2440 | can ignore this field. |
2441 | </para> | 2441 | </para> |
2442 | </listitem> | 2442 | </listitem> |
@@ -2450,7 +2450,7 @@ struct _snd_pcm_runtime { | |||
2450 | Ok, let's go back again to the PCM runtime records. | 2450 | Ok, let's go back again to the PCM runtime records. |
2451 | The most frequently referred records in the runtime instance are | 2451 | The most frequently referred records in the runtime instance are |
2452 | the PCM configurations. | 2452 | the PCM configurations. |
2453 | The PCM configurations are stored on runtime instance | 2453 | The PCM configurations are stored in the runtime instance |
2454 | after the application sends <type>hw_params</type> data via | 2454 | after the application sends <type>hw_params</type> data via |
2455 | alsa-lib. There are many fields copied from hw_params and | 2455 | alsa-lib. There are many fields copied from hw_params and |
2456 | sw_params structs. For example, | 2456 | sw_params structs. For example, |
@@ -2461,11 +2461,11 @@ struct _snd_pcm_runtime { | |||
2461 | 2461 | ||
2462 | <para> | 2462 | <para> |
2463 | One thing to be noted is that the configured buffer and period | 2463 | One thing to be noted is that the configured buffer and period |
2464 | sizes are stored in <quote>frames</quote> in the runtime | 2464 | sizes are stored in <quote>frames</quote> in the runtime. |
2465 | In the ALSA world, 1 frame = channels * samples-size. | 2465 | In the ALSA world, 1 frame = channels * samples-size. |
2466 | For conversion between frames and bytes, you can use the | 2466 | For conversion between frames and bytes, you can use the |
2467 | helper functions, <function>frames_to_bytes()</function> and | 2467 | <function>frames_to_bytes()</function> and |
2468 | <function>bytes_to_frames()</function>. | 2468 | <function>bytes_to_frames()</function> helper functions. |
2469 | <informalexample> | 2469 | <informalexample> |
2470 | <programlisting> | 2470 | <programlisting> |
2471 | <![CDATA[ | 2471 | <![CDATA[ |
@@ -2515,7 +2515,7 @@ struct _snd_pcm_runtime { | |||
2515 | <structfield>dma_area</structfield> is necessary when the | 2515 | <structfield>dma_area</structfield> is necessary when the |
2516 | buffer is mmapped. If your driver doesn't support mmap, this | 2516 | buffer is mmapped. If your driver doesn't support mmap, this |
2517 | field is not necessary. <structfield>dma_addr</structfield> | 2517 | field is not necessary. <structfield>dma_addr</structfield> |
2518 | is also not mandatory. You can use | 2518 | is also optional. You can use |
2519 | <structfield>dma_private</structfield> as you like, too. | 2519 | <structfield>dma_private</structfield> as you like, too. |
2520 | </para> | 2520 | </para> |
2521 | </section> | 2521 | </section> |
@@ -2524,14 +2524,14 @@ struct _snd_pcm_runtime { | |||
2524 | <title>Running Status</title> | 2524 | <title>Running Status</title> |
2525 | <para> | 2525 | <para> |
2526 | The running status can be referred via <constant>runtime->status</constant>. | 2526 | The running status can be referred via <constant>runtime->status</constant>. |
2527 | This is the pointer to struct <structname>snd_pcm_mmap_status</structname> | 2527 | This is the pointer to the struct <structname>snd_pcm_mmap_status</structname> |
2528 | record. For example, you can get the current DMA hardware | 2528 | record. For example, you can get the current DMA hardware |
2529 | pointer via <constant>runtime->status->hw_ptr</constant>. | 2529 | pointer via <constant>runtime->status->hw_ptr</constant>. |
2530 | </para> | 2530 | </para> |
2531 | 2531 | ||
2532 | <para> | 2532 | <para> |
2533 | The DMA application pointer can be referred via | 2533 | The DMA application pointer can be referred via |
2534 | <constant>runtime->control</constant>, which points | 2534 | <constant>runtime->control</constant>, which points to the |
2535 | struct <structname>snd_pcm_mmap_control</structname> record. | 2535 | struct <structname>snd_pcm_mmap_control</structname> record. |
2536 | However, accessing directly to this value is not recommended. | 2536 | However, accessing directly to this value is not recommended. |
2537 | </para> | 2537 | </para> |
@@ -2542,14 +2542,14 @@ struct _snd_pcm_runtime { | |||
2542 | <para> | 2542 | <para> |
2543 | You can allocate a record for the substream and store it in | 2543 | You can allocate a record for the substream and store it in |
2544 | <constant>runtime->private_data</constant>. Usually, this | 2544 | <constant>runtime->private_data</constant>. Usually, this |
2545 | done in | 2545 | is done in |
2546 | <link linkend="pcm-interface-operators-open-callback"><citetitle> | 2546 | <link linkend="pcm-interface-operators-open-callback"><citetitle> |
2547 | the open callback</citetitle></link>. | 2547 | the open callback</citetitle></link>. |
2548 | Don't mix this with <constant>pcm->private_data</constant>. | 2548 | Don't mix this with <constant>pcm->private_data</constant>. |
2549 | The <constant>pcm->private_data</constant> usually points the | 2549 | The <constant>pcm->private_data</constant> usually points to the |
2550 | chip instance assigned statically at the creation of PCM, while the | 2550 | chip instance assigned statically at the creation of PCM, while the |
2551 | <constant>runtime->private_data</constant> points a dynamic | 2551 | <constant>runtime->private_data</constant> points to a dynamic |
2552 | data created at the PCM open callback. | 2552 | data structure created at the PCM open callback. |
2553 | 2553 | ||
2554 | <informalexample> | 2554 | <informalexample> |
2555 | <programlisting> | 2555 | <programlisting> |
@@ -2579,7 +2579,7 @@ struct _snd_pcm_runtime { | |||
2579 | <para> | 2579 | <para> |
2580 | The field <structfield>transfer_ack_begin</structfield> and | 2580 | The field <structfield>transfer_ack_begin</structfield> and |
2581 | <structfield>transfer_ack_end</structfield> are called at | 2581 | <structfield>transfer_ack_end</structfield> are called at |
2582 | the beginning and the end of | 2582 | the beginning and at the end of |
2583 | <function>snd_pcm_period_elapsed()</function>, respectively. | 2583 | <function>snd_pcm_period_elapsed()</function>, respectively. |
2584 | </para> | 2584 | </para> |
2585 | </section> | 2585 | </section> |
@@ -2589,17 +2589,18 @@ struct _snd_pcm_runtime { | |||
2589 | <section id="pcm-interface-operators"> | 2589 | <section id="pcm-interface-operators"> |
2590 | <title>Operators</title> | 2590 | <title>Operators</title> |
2591 | <para> | 2591 | <para> |
2592 | OK, now let me explain the detail of each pcm callback | 2592 | OK, now let me give details about each pcm callback |
2593 | (<parameter>ops</parameter>). In general, every callback must | 2593 | (<parameter>ops</parameter>). In general, every callback must |
2594 | return 0 if successful, or a negative number with the error | 2594 | return 0 if successful, or a negative error number |
2595 | number such as <constant>-EINVAL</constant> at any | 2595 | such as <constant>-EINVAL</constant>. To choose an appropriate |
2596 | error. | 2596 | error number, it is advised to check what value other parts of |
2597 | the kernel return when the same kind of request fails. | ||
2597 | </para> | 2598 | </para> |
2598 | 2599 | ||
2599 | <para> | 2600 | <para> |
2600 | The callback function takes at least the argument with | 2601 | The callback function takes at least the argument with |
2601 | <structname>snd_pcm_substream</structname> pointer. For retrieving the | 2602 | <structname>snd_pcm_substream</structname> pointer. To retrieve |
2602 | chip record from the given substream instance, you can use the | 2603 | the chip record from the given substream instance, you can use the |
2603 | following macro. | 2604 | following macro. |
2604 | 2605 | ||
2605 | <informalexample> | 2606 | <informalexample> |
@@ -2616,7 +2617,7 @@ struct _snd_pcm_runtime { | |||
2616 | The macro reads <constant>substream->private_data</constant>, | 2617 | The macro reads <constant>substream->private_data</constant>, |
2617 | which is a copy of <constant>pcm->private_data</constant>. | 2618 | which is a copy of <constant>pcm->private_data</constant>. |
2618 | You can override the former if you need to assign different data | 2619 | You can override the former if you need to assign different data |
2619 | records per PCM substream. For example, cmi8330 driver assigns | 2620 | records per PCM substream. For example, the cmi8330 driver assigns |
2620 | different private_data for playback and capture directions, | 2621 | different private_data for playback and capture directions, |
2621 | because it uses two different codecs (SB- and AD-compatible) for | 2622 | because it uses two different codecs (SB- and AD-compatible) for |
2622 | different directions. | 2623 | different directions. |
@@ -2709,7 +2710,7 @@ struct _snd_pcm_runtime { | |||
2709 | <section id="pcm-interface-operators-ioctl-callback"> | 2710 | <section id="pcm-interface-operators-ioctl-callback"> |
2710 | <title>ioctl callback</title> | 2711 | <title>ioctl callback</title> |
2711 | <para> | 2712 | <para> |
2712 | This is used for any special action to pcm ioctls. But | 2713 | This is used for any special call to pcm ioctls. But |
2713 | usually you can pass a generic ioctl callback, | 2714 | usually you can pass a generic ioctl callback, |
2714 | <function>snd_pcm_lib_ioctl</function>. | 2715 | <function>snd_pcm_lib_ioctl</function>. |
2715 | </para> | 2716 | </para> |
@@ -2726,9 +2727,6 @@ struct _snd_pcm_runtime { | |||
2726 | ]]> | 2727 | ]]> |
2727 | </programlisting> | 2728 | </programlisting> |
2728 | </informalexample> | 2729 | </informalexample> |
2729 | |||
2730 | This and <structfield>hw_free</structfield> callbacks exist | ||
2731 | only on ALSA 0.9.x. | ||
2732 | </para> | 2730 | </para> |
2733 | 2731 | ||
2734 | <para> | 2732 | <para> |
@@ -2740,13 +2738,13 @@ struct _snd_pcm_runtime { | |||
2740 | </para> | 2738 | </para> |
2741 | 2739 | ||
2742 | <para> | 2740 | <para> |
2743 | Many hardware set-up should be done in this callback, | 2741 | Many hardware setups should be done in this callback, |
2744 | including the allocation of buffers. | 2742 | including the allocation of buffers. |
2745 | </para> | 2743 | </para> |
2746 | 2744 | ||
2747 | <para> | 2745 | <para> |
2748 | Parameters to be initialized are retrieved by | 2746 | Parameters to be initialized are retrieved by |
2749 | <function>params_xxx()</function> macros. For allocating a | 2747 | <function>params_xxx()</function> macros. To allocate |
2750 | buffer, you can call a helper function, | 2748 | buffer, you can call a helper function, |
2751 | 2749 | ||
2752 | <informalexample> | 2750 | <informalexample> |
@@ -2772,8 +2770,8 @@ struct _snd_pcm_runtime { | |||
2772 | </para> | 2770 | </para> |
2773 | 2771 | ||
2774 | <para> | 2772 | <para> |
2775 | Thus, you need to take care not to allocate the same buffers | 2773 | Thus, you need to be careful not to allocate the same buffers |
2776 | many times, which will lead to memory leak! Calling the | 2774 | many times, which will lead to memory leaks! Calling the |
2777 | helper function above many times is OK. It will release the | 2775 | helper function above many times is OK. It will release the |
2778 | previous buffer automatically when it was already allocated. | 2776 | previous buffer automatically when it was already allocated. |
2779 | </para> | 2777 | </para> |
@@ -2782,7 +2780,7 @@ struct _snd_pcm_runtime { | |||
2782 | Another note is that this callback is non-atomic | 2780 | Another note is that this callback is non-atomic |
2783 | (schedulable). This is important, because the | 2781 | (schedulable). This is important, because the |
2784 | <structfield>trigger</structfield> callback | 2782 | <structfield>trigger</structfield> callback |
2785 | is atomic (non-schedulable). That is, mutex or any | 2783 | is atomic (non-schedulable). That is, mutexes or any |
2786 | schedule-related functions are not available in | 2784 | schedule-related functions are not available in |
2787 | <structfield>trigger</structfield> callback. | 2785 | <structfield>trigger</structfield> callback. |
2788 | Please see the subsection | 2786 | Please see the subsection |
@@ -2843,15 +2841,15 @@ struct _snd_pcm_runtime { | |||
2843 | <quote>prepared</quote>. You can set the format type, sample | 2841 | <quote>prepared</quote>. You can set the format type, sample |
2844 | rate, etc. here. The difference from | 2842 | rate, etc. here. The difference from |
2845 | <structfield>hw_params</structfield> is that the | 2843 | <structfield>hw_params</structfield> is that the |
2846 | <structfield>prepare</structfield> callback will be called at each | 2844 | <structfield>prepare</structfield> callback will be called each |
2847 | time | 2845 | time |
2848 | <function>snd_pcm_prepare()</function> is called, i.e. when | 2846 | <function>snd_pcm_prepare()</function> is called, i.e. when |
2849 | recovered after underruns, etc. | 2847 | recovering after underruns, etc. |
2850 | </para> | 2848 | </para> |
2851 | 2849 | ||
2852 | <para> | 2850 | <para> |
2853 | Note that this callback became non-atomic since the recent version. | 2851 | Note that this callback is now non-atomic. |
2854 | You can use schedule-related functions safely in this callback now. | 2852 | You can use schedule-related functions safely in this callback. |
2855 | </para> | 2853 | </para> |
2856 | 2854 | ||
2857 | <para> | 2855 | <para> |
@@ -2871,7 +2869,7 @@ struct _snd_pcm_runtime { | |||
2871 | 2869 | ||
2872 | <para> | 2870 | <para> |
2873 | Be careful that this callback will be called many times at | 2871 | Be careful that this callback will be called many times at |
2874 | each set up, too. | 2872 | each setup, too. |
2875 | </para> | 2873 | </para> |
2876 | </section> | 2874 | </section> |
2877 | 2875 | ||
@@ -2893,7 +2891,7 @@ struct _snd_pcm_runtime { | |||
2893 | Which action is specified in the second argument, | 2891 | Which action is specified in the second argument, |
2894 | <constant>SNDRV_PCM_TRIGGER_XXX</constant> in | 2892 | <constant>SNDRV_PCM_TRIGGER_XXX</constant> in |
2895 | <filename><sound/pcm.h></filename>. At least, | 2893 | <filename><sound/pcm.h></filename>. At least, |
2896 | <constant>START</constant> and <constant>STOP</constant> | 2894 | the <constant>START</constant> and <constant>STOP</constant> |
2897 | commands must be defined in this callback. | 2895 | commands must be defined in this callback. |
2898 | 2896 | ||
2899 | <informalexample> | 2897 | <informalexample> |
@@ -2915,8 +2913,8 @@ struct _snd_pcm_runtime { | |||
2915 | </para> | 2913 | </para> |
2916 | 2914 | ||
2917 | <para> | 2915 | <para> |
2918 | When the pcm supports the pause operation (given in info | 2916 | When the pcm supports the pause operation (given in the info |
2919 | field of the hardware table), <constant>PAUSE_PUSE</constant> | 2917 | field of the hardware table), the <constant>PAUSE_PUSE</constant> |
2920 | and <constant>PAUSE_RELEASE</constant> commands must be | 2918 | and <constant>PAUSE_RELEASE</constant> commands must be |
2921 | handled here, too. The former is the command to pause the pcm, | 2919 | handled here, too. The former is the command to pause the pcm, |
2922 | and the latter to restart the pcm again. | 2920 | and the latter to restart the pcm again. |
@@ -2925,21 +2923,21 @@ struct _snd_pcm_runtime { | |||
2925 | <para> | 2923 | <para> |
2926 | When the pcm supports the suspend/resume operation, | 2924 | When the pcm supports the suspend/resume operation, |
2927 | regardless of full or partial suspend/resume support, | 2925 | regardless of full or partial suspend/resume support, |
2928 | <constant>SUSPEND</constant> and <constant>RESUME</constant> | 2926 | the <constant>SUSPEND</constant> and <constant>RESUME</constant> |
2929 | commands must be handled, too. | 2927 | commands must be handled, too. |
2930 | These commands are issued when the power-management status is | 2928 | These commands are issued when the power-management status is |
2931 | changed. Obviously, the <constant>SUSPEND</constant> and | 2929 | changed. Obviously, the <constant>SUSPEND</constant> and |
2932 | <constant>RESUME</constant> | 2930 | <constant>RESUME</constant> commands |
2933 | do suspend and resume of the pcm substream, and usually, they | 2931 | suspend and resume the pcm substream, and usually, they |
2934 | are identical with <constant>STOP</constant> and | 2932 | are identical to the <constant>STOP</constant> and |
2935 | <constant>START</constant> commands, respectively. | 2933 | <constant>START</constant> commands, respectively. |
2936 | See <link linkend="power-management"><citetitle> | 2934 | See the <link linkend="power-management"><citetitle> |
2937 | Power Management</citetitle></link> section for details. | 2935 | Power Management</citetitle></link> section for details. |
2938 | </para> | 2936 | </para> |
2939 | 2937 | ||
2940 | <para> | 2938 | <para> |
2941 | As mentioned, this callback is atomic. You cannot call | 2939 | As mentioned, this callback is atomic. You cannot call |
2942 | the function going to sleep. | 2940 | functions which may sleep. |
2943 | The trigger callback should be as minimal as possible, | 2941 | The trigger callback should be as minimal as possible, |
2944 | just really triggering the DMA. The other stuff should be | 2942 | just really triggering the DMA. The other stuff should be |
2945 | initialized hw_params and prepare callbacks properly | 2943 | initialized hw_params and prepare callbacks properly |
@@ -2960,8 +2958,8 @@ struct _snd_pcm_runtime { | |||
2960 | 2958 | ||
2961 | This callback is called when the PCM middle layer inquires | 2959 | This callback is called when the PCM middle layer inquires |
2962 | the current hardware position on the buffer. The position must | 2960 | the current hardware position on the buffer. The position must |
2963 | be returned in frames (which was in bytes on ALSA 0.5.x), | 2961 | be returned in frames, |
2964 | ranged from 0 to buffer_size - 1. | 2962 | ranging from 0 to buffer_size - 1. |
2965 | </para> | 2963 | </para> |
2966 | 2964 | ||
2967 | <para> | 2965 | <para> |
@@ -2983,7 +2981,7 @@ struct _snd_pcm_runtime { | |||
2983 | <para> | 2981 | <para> |
2984 | These callbacks are not mandatory, and can be omitted in | 2982 | These callbacks are not mandatory, and can be omitted in |
2985 | most cases. These callbacks are used when the hardware buffer | 2983 | most cases. These callbacks are used when the hardware buffer |
2986 | cannot be on the normal memory space. Some chips have their | 2984 | cannot be in the normal memory space. Some chips have their |
2987 | own buffer on the hardware which is not mappable. In such a | 2985 | own buffer on the hardware which is not mappable. In such a |
2988 | case, you have to transfer the data manually from the memory | 2986 | case, you have to transfer the data manually from the memory |
2989 | buffer to the hardware buffer. Or, if the buffer is | 2987 | buffer to the hardware buffer. Or, if the buffer is |
@@ -3018,8 +3016,8 @@ struct _snd_pcm_runtime { | |||
3018 | <title>page callback</title> | 3016 | <title>page callback</title> |
3019 | 3017 | ||
3020 | <para> | 3018 | <para> |
3021 | This callback is also not mandatory. This callback is used | 3019 | This callback is optional too. This callback is used |
3022 | mainly for the non-contiguous buffer. The mmap calls this | 3020 | mainly for non-contiguous buffers. The mmap calls this |
3023 | callback to get the page address. Some examples will be | 3021 | callback to get the page address. Some examples will be |
3024 | explained in the later section <link | 3022 | explained in the later section <link |
3025 | linkend="buffer-and-memory"><citetitle>Buffer and Memory | 3023 | linkend="buffer-and-memory"><citetitle>Buffer and Memory |
@@ -3035,7 +3033,7 @@ struct _snd_pcm_runtime { | |||
3035 | role of PCM interrupt handler in the sound driver is to update | 3033 | role of PCM interrupt handler in the sound driver is to update |
3036 | the buffer position and to tell the PCM middle layer when the | 3034 | the buffer position and to tell the PCM middle layer when the |
3037 | buffer position goes across the prescribed period size. To | 3035 | buffer position goes across the prescribed period size. To |
3038 | inform this, call <function>snd_pcm_period_elapsed()</function> | 3036 | inform this, call the <function>snd_pcm_period_elapsed()</function> |
3039 | function. | 3037 | function. |
3040 | </para> | 3038 | </para> |
3041 | 3039 | ||
@@ -3072,7 +3070,7 @@ struct _snd_pcm_runtime { | |||
3072 | </para> | 3070 | </para> |
3073 | 3071 | ||
3074 | <para> | 3072 | <para> |
3075 | A typical coding would be like: | 3073 | Typical code would be like: |
3076 | 3074 | ||
3077 | <example> | 3075 | <example> |
3078 | <title>Interrupt Handler Case #1</title> | 3076 | <title>Interrupt Handler Case #1</title> |
@@ -3101,21 +3099,21 @@ struct _snd_pcm_runtime { | |||
3101 | </section> | 3099 | </section> |
3102 | 3100 | ||
3103 | <section id="pcm-interface-interrupt-handler-timer"> | 3101 | <section id="pcm-interface-interrupt-handler-timer"> |
3104 | <title>High-frequent timer interrupts</title> | 3102 | <title>High frequency timer interrupts</title> |
3105 | <para> | 3103 | <para> |
3106 | This is the case when the hardware doesn't generate interrupts | 3104 | This happense when the hardware doesn't generate interrupts |
3107 | at the period boundary but do timer-interrupts at the fixed | 3105 | at the period boundary but issues timer interrupts at a fixed |
3108 | timer rate (e.g. es1968 or ymfpci drivers). | 3106 | timer rate (e.g. es1968 or ymfpci drivers). |
3109 | In this case, you need to check the current hardware | 3107 | In this case, you need to check the current hardware |
3110 | position and accumulates the processed sample length at each | 3108 | position and accumulate the processed sample length at each |
3111 | interrupt. When the accumulated size overcomes the period | 3109 | interrupt. When the accumulated size exceeds the period |
3112 | size, call | 3110 | size, call |
3113 | <function>snd_pcm_period_elapsed()</function> and reset the | 3111 | <function>snd_pcm_period_elapsed()</function> and reset the |
3114 | accumulator. | 3112 | accumulator. |
3115 | </para> | 3113 | </para> |
3116 | 3114 | ||
3117 | <para> | 3115 | <para> |
3118 | A typical coding would be like the following. | 3116 | Typical code would be like the following. |
3119 | 3117 | ||
3120 | <example> | 3118 | <example> |
3121 | <title>Interrupt Handler Case #2</title> | 3119 | <title>Interrupt Handler Case #2</title> |
@@ -3178,32 +3176,33 @@ struct _snd_pcm_runtime { | |||
3178 | <section id="pcm-interface-atomicity"> | 3176 | <section id="pcm-interface-atomicity"> |
3179 | <title>Atomicity</title> | 3177 | <title>Atomicity</title> |
3180 | <para> | 3178 | <para> |
3181 | One of the most important (and thus difficult to debug) problem | 3179 | One of the most important (and thus difficult to debug) problems |
3182 | on the kernel programming is the race condition. | 3180 | in kernel programming are race conditions. |
3183 | On linux kernel, usually it's solved via spin-locks or | 3181 | In the Linux kernel, they are usually avoided via spin-locks, mutexes |
3184 | semaphores. In general, if the race condition may | 3182 | or semaphores. In general, if a race condition can happen |
3185 | happen in the interrupt handler, it's handled as atomic, and you | 3183 | in an interrupt handler, it has to be managed atomically, and you |
3186 | have to use spinlock for protecting the critical session. If it | 3184 | have to use a spinlock to protect the critical session. If the |
3187 | never happens in the interrupt and it may take relatively long | 3185 | critical section is not in interrupt handler code and |
3188 | time, you should use semaphore. | 3186 | if taking a relatively long time to execute is acceptable, you |
3187 | should use mutexes or semaphores instead. | ||
3189 | </para> | 3188 | </para> |
3190 | 3189 | ||
3191 | <para> | 3190 | <para> |
3192 | As already seen, some pcm callbacks are atomic and some are | 3191 | As already seen, some pcm callbacks are atomic and some are |
3193 | not. For example, <parameter>hw_params</parameter> callback is | 3192 | not. For example, the <parameter>hw_params</parameter> callback is |
3194 | non-atomic, while <parameter>trigger</parameter> callback is | 3193 | non-atomic, while <parameter>trigger</parameter> callback is |
3195 | atomic. This means, the latter is called already in a spinlock | 3194 | atomic. This means, the latter is called already in a spinlock |
3196 | held by the PCM middle layer. Please take this atomicity into | 3195 | held by the PCM middle layer. Please take this atomicity into |
3197 | account when you use a spinlock or a semaphore in the callbacks. | 3196 | account when you choose a locking scheme in the callbacks. |
3198 | </para> | 3197 | </para> |
3199 | 3198 | ||
3200 | <para> | 3199 | <para> |
3201 | In the atomic callbacks, you cannot use functions which may call | 3200 | In the atomic callbacks, you cannot use functions which may call |
3202 | <function>schedule</function> or go to | 3201 | <function>schedule</function> or go to |
3203 | <function>sleep</function>. The semaphore and mutex do sleep, | 3202 | <function>sleep</function>. Semaphores and mutexes can sleep, |
3204 | and hence they cannot be used inside the atomic callbacks | 3203 | and hence they cannot be used inside the atomic callbacks |
3205 | (e.g. <parameter>trigger</parameter> callback). | 3204 | (e.g. <parameter>trigger</parameter> callback). |
3206 | For taking a certain delay in such a callback, please use | 3205 | To implement some delay in such a callback, please use |
3207 | <function>udelay()</function> or <function>mdelay()</function>. | 3206 | <function>udelay()</function> or <function>mdelay()</function>. |
3208 | </para> | 3207 | </para> |
3209 | 3208 | ||
@@ -3257,7 +3256,7 @@ struct _snd_pcm_runtime { | |||
3257 | 3256 | ||
3258 | <para> | 3257 | <para> |
3259 | There are many different constraints. | 3258 | There are many different constraints. |
3260 | Look in <filename>sound/pcm.h</filename> for a complete list. | 3259 | Look at <filename>sound/pcm.h</filename> for a complete list. |
3261 | You can even define your own constraint rules. | 3260 | You can even define your own constraint rules. |
3262 | For example, let's suppose my_chip can manage a substream of 1 channel | 3261 | For example, let's suppose my_chip can manage a substream of 1 channel |
3263 | if and only if the format is S16_LE, otherwise it supports any format | 3262 | if and only if the format is S16_LE, otherwise it supports any format |
@@ -3346,7 +3345,7 @@ struct _snd_pcm_runtime { | |||
3346 | </para> | 3345 | </para> |
3347 | 3346 | ||
3348 | <para> | 3347 | <para> |
3349 | I won't explain more details here, rather I | 3348 | I won't give more details here, rather I |
3350 | would like to say, <quote>Luke, use the source.</quote> | 3349 | would like to say, <quote>Luke, use the source.</quote> |
3351 | </para> | 3350 | </para> |
3352 | </section> | 3351 | </section> |
@@ -3364,10 +3363,9 @@ struct _snd_pcm_runtime { | |||
3364 | <title>General</title> | 3363 | <title>General</title> |
3365 | <para> | 3364 | <para> |
3366 | The control interface is used widely for many switches, | 3365 | The control interface is used widely for many switches, |
3367 | sliders, etc. which are accessed from the user-space. Its most | 3366 | sliders, etc. which are accessed from user-space. Its most |
3368 | important use is the mixer interface. In other words, on ALSA | 3367 | important use is the mixer interface. In other words, since ALSA |
3369 | 0.9.x, all the mixer stuff is implemented on the control kernel | 3368 | 0.9.x, all the mixer stuff is implemented on the control kernel API. |
3370 | API (while there was an independent mixer kernel API on 0.5.x). | ||
3371 | </para> | 3369 | </para> |
3372 | 3370 | ||
3373 | <para> | 3371 | <para> |
@@ -3379,14 +3377,15 @@ struct _snd_pcm_runtime { | |||
3379 | <para> | 3377 | <para> |
3380 | The control API is defined in | 3378 | The control API is defined in |
3381 | <filename><sound/control.h></filename>. | 3379 | <filename><sound/control.h></filename>. |
3382 | Include this file if you add your own controls. | 3380 | Include this file if you want to add your own controls. |
3383 | </para> | 3381 | </para> |
3384 | </section> | 3382 | </section> |
3385 | 3383 | ||
3386 | <section id="control-interface-definition"> | 3384 | <section id="control-interface-definition"> |
3387 | <title>Definition of Controls</title> | 3385 | <title>Definition of Controls</title> |
3388 | <para> | 3386 | <para> |
3389 | For creating a new control, you need to define the three | 3387 | To create a new control, you need to define the |
3388 | following three | ||
3390 | callbacks: <structfield>info</structfield>, | 3389 | callbacks: <structfield>info</structfield>, |
3391 | <structfield>get</structfield> and | 3390 | <structfield>get</structfield> and |
3392 | <structfield>put</structfield>. Then, define a | 3391 | <structfield>put</structfield>. Then, define a |
@@ -3414,13 +3413,13 @@ struct _snd_pcm_runtime { | |||
3414 | <para> | 3413 | <para> |
3415 | Most likely the control is created via | 3414 | Most likely the control is created via |
3416 | <function>snd_ctl_new1()</function>, and in such a case, you can | 3415 | <function>snd_ctl_new1()</function>, and in such a case, you can |
3417 | add <parameter>__devinitdata</parameter> prefix to the | 3416 | add the <parameter>__devinitdata</parameter> prefix to the |
3418 | definition like above. | 3417 | definition as above. |
3419 | </para> | 3418 | </para> |
3420 | 3419 | ||
3421 | <para> | 3420 | <para> |
3422 | The <structfield>iface</structfield> field specifies the type of | 3421 | The <structfield>iface</structfield> field specifies the control |
3423 | the control, <constant>SNDRV_CTL_ELEM_IFACE_XXX</constant>, which | 3422 | type, <constant>SNDRV_CTL_ELEM_IFACE_XXX</constant>, which |
3424 | is usually <constant>MIXER</constant>. | 3423 | is usually <constant>MIXER</constant>. |
3425 | Use <constant>CARD</constant> for global controls that are not | 3424 | Use <constant>CARD</constant> for global controls that are not |
3426 | logically part of the mixer. | 3425 | logically part of the mixer. |
@@ -3435,12 +3434,11 @@ struct _snd_pcm_runtime { | |||
3435 | 3434 | ||
3436 | <para> | 3435 | <para> |
3437 | The <structfield>name</structfield> is the name identifier | 3436 | The <structfield>name</structfield> is the name identifier |
3438 | string. On ALSA 0.9.x, the control name is very important, | 3437 | string. Since ALSA 0.9.x, the control name is very important, |
3439 | because its role is classified from its name. There are | 3438 | because its role is classified from its name. There are |
3440 | pre-defined standard control names. The details are described in | 3439 | pre-defined standard control names. The details are described in |
3441 | the subsection | 3440 | the <link linkend="control-interface-control-names"><citetitle> |
3442 | <link linkend="control-interface-control-names"><citetitle> | 3441 | Control Names</citetitle></link> subsection. |
3443 | Control Names</citetitle></link>. | ||
3444 | </para> | 3442 | </para> |
3445 | 3443 | ||
3446 | <para> | 3444 | <para> |
@@ -3456,15 +3454,15 @@ struct _snd_pcm_runtime { | |||
3456 | The <structfield>access</structfield> field contains the access | 3454 | The <structfield>access</structfield> field contains the access |
3457 | type of this control. Give the combination of bit masks, | 3455 | type of this control. Give the combination of bit masks, |
3458 | <constant>SNDRV_CTL_ELEM_ACCESS_XXX</constant>, there. | 3456 | <constant>SNDRV_CTL_ELEM_ACCESS_XXX</constant>, there. |
3459 | The detailed will be explained in the subsection | 3457 | The details will be explained in |
3460 | <link linkend="control-interface-access-flags"><citetitle> | 3458 | the <link linkend="control-interface-access-flags"><citetitle> |
3461 | Access Flags</citetitle></link>. | 3459 | Access Flags</citetitle></link> subsection. |
3462 | </para> | 3460 | </para> |
3463 | 3461 | ||
3464 | <para> | 3462 | <para> |
3465 | The <structfield>private_value</structfield> field contains | 3463 | The <structfield>private_value</structfield> field contains |
3466 | an arbitrary long integer value for this record. When using | 3464 | an arbitrary long integer value for this record. When using |
3467 | generic <structfield>info</structfield>, | 3465 | the generic <structfield>info</structfield>, |
3468 | <structfield>get</structfield> and | 3466 | <structfield>get</structfield> and |
3469 | <structfield>put</structfield> callbacks, you can pass a value | 3467 | <structfield>put</structfield> callbacks, you can pass a value |
3470 | through this field. If several small numbers are necessary, you can | 3468 | through this field. If several small numbers are necessary, you can |
@@ -3489,7 +3487,7 @@ struct _snd_pcm_runtime { | |||
3489 | <section id="control-interface-control-names"> | 3487 | <section id="control-interface-control-names"> |
3490 | <title>Control Names</title> | 3488 | <title>Control Names</title> |
3491 | <para> | 3489 | <para> |
3492 | There are some standards for defining the control names. A | 3490 | There are some standards to define the control names. A |
3493 | control is usually defined from the three parts as | 3491 | control is usually defined from the three parts as |
3494 | <quote>SOURCE DIRECTION FUNCTION</quote>. | 3492 | <quote>SOURCE DIRECTION FUNCTION</quote>. |
3495 | </para> | 3493 | </para> |
@@ -3497,7 +3495,7 @@ struct _snd_pcm_runtime { | |||
3497 | <para> | 3495 | <para> |
3498 | The first, <constant>SOURCE</constant>, specifies the source | 3496 | The first, <constant>SOURCE</constant>, specifies the source |
3499 | of the control, and is a string such as <quote>Master</quote>, | 3497 | of the control, and is a string such as <quote>Master</quote>, |
3500 | <quote>PCM</quote>, <quote>CD</quote> or | 3498 | <quote>PCM</quote>, <quote>CD</quote> and |
3501 | <quote>Line</quote>. There are many pre-defined sources. | 3499 | <quote>Line</quote>. There are many pre-defined sources. |
3502 | </para> | 3500 | </para> |
3503 | 3501 | ||
@@ -3575,22 +3573,22 @@ struct _snd_pcm_runtime { | |||
3575 | <title>Access Flags</title> | 3573 | <title>Access Flags</title> |
3576 | 3574 | ||
3577 | <para> | 3575 | <para> |
3578 | The access flag is the bit-flags which specifies the access type | 3576 | The access flag is the bitmask which specifies the access type |
3579 | of the given control. The default access type is | 3577 | of the given control. The default access type is |
3580 | <constant>SNDRV_CTL_ELEM_ACCESS_READWRITE</constant>, | 3578 | <constant>SNDRV_CTL_ELEM_ACCESS_READWRITE</constant>, |
3581 | which means both read and write are allowed to this control. | 3579 | which means both read and write are allowed to this control. |
3582 | When the access flag is omitted (i.e. = 0), it is | 3580 | When the access flag is omitted (i.e. = 0), it is |
3583 | regarded as <constant>READWRITE</constant> access as default. | 3581 | considered as <constant>READWRITE</constant> access as default. |
3584 | </para> | 3582 | </para> |
3585 | 3583 | ||
3586 | <para> | 3584 | <para> |
3587 | When the control is read-only, pass | 3585 | When the control is read-only, pass |
3588 | <constant>SNDRV_CTL_ELEM_ACCESS_READ</constant> instead. | 3586 | <constant>SNDRV_CTL_ELEM_ACCESS_READ</constant> instead. |
3589 | In this case, you don't have to define | 3587 | In this case, you don't have to define |
3590 | <structfield>put</structfield> callback. | 3588 | the <structfield>put</structfield> callback. |
3591 | Similarly, when the control is write-only (although it's a rare | 3589 | Similarly, when the control is write-only (although it's a rare |
3592 | case), you can use <constant>WRITE</constant> flag instead, and | 3590 | case), you can use the <constant>WRITE</constant> flag instead, and |
3593 | you don't need <structfield>get</structfield> callback. | 3591 | you don't need the <structfield>get</structfield> callback. |
3594 | </para> | 3592 | </para> |
3595 | 3593 | ||
3596 | <para> | 3594 | <para> |
@@ -3598,15 +3596,15 @@ struct _snd_pcm_runtime { | |||
3598 | <constant>VOLATILE</constant> flag should be given. This means | 3596 | <constant>VOLATILE</constant> flag should be given. This means |
3599 | that the control may be changed without | 3597 | that the control may be changed without |
3600 | <link linkend="control-interface-change-notification"><citetitle> | 3598 | <link linkend="control-interface-change-notification"><citetitle> |
3601 | notification</citetitle></link>. Applications should poll such | 3599 | notification</citetitle></link>. Applications should poll such |
3602 | a control constantly. | 3600 | a control constantly. |
3603 | </para> | 3601 | </para> |
3604 | 3602 | ||
3605 | <para> | 3603 | <para> |
3606 | When the control is inactive, set | 3604 | When the control is inactive, set |
3607 | <constant>INACTIVE</constant> flag, too. | 3605 | the <constant>INACTIVE</constant> flag, too. |
3608 | There are <constant>LOCK</constant> and | 3606 | There are <constant>LOCK</constant> and |
3609 | <constant>OWNER</constant> flags for changing the write | 3607 | <constant>OWNER</constant> flags to change the write |
3610 | permissions. | 3608 | permissions. |
3611 | </para> | 3609 | </para> |
3612 | 3610 | ||
@@ -3619,10 +3617,10 @@ struct _snd_pcm_runtime { | |||
3619 | <title>info callback</title> | 3617 | <title>info callback</title> |
3620 | <para> | 3618 | <para> |
3621 | The <structfield>info</structfield> callback is used to get | 3619 | The <structfield>info</structfield> callback is used to get |
3622 | the detailed information of this control. This must store the | 3620 | detailed information on this control. This must store the |
3623 | values of the given struct <structname>snd_ctl_elem_info</structname> | 3621 | values of the given struct <structname>snd_ctl_elem_info</structname> |
3624 | object. For example, for a boolean control with a single | 3622 | object. For example, for a boolean control with a single |
3625 | element will be: | 3623 | element: |
3626 | 3624 | ||
3627 | <example> | 3625 | <example> |
3628 | <title>Example of info callback</title> | 3626 | <title>Example of info callback</title> |
@@ -3653,7 +3651,7 @@ struct _snd_pcm_runtime { | |||
3653 | volume would have count = 2. The | 3651 | volume would have count = 2. The |
3654 | <structfield>value</structfield> field is a union, and | 3652 | <structfield>value</structfield> field is a union, and |
3655 | the values stored are depending on the type. The boolean and | 3653 | the values stored are depending on the type. The boolean and |
3656 | integer are identical. | 3654 | integer types are identical. |
3657 | </para> | 3655 | </para> |
3658 | 3656 | ||
3659 | <para> | 3657 | <para> |
@@ -3684,7 +3682,7 @@ struct _snd_pcm_runtime { | |||
3684 | </para> | 3682 | </para> |
3685 | 3683 | ||
3686 | <para> | 3684 | <para> |
3687 | Some common info callbacks are prepared for easy use: | 3685 | Some common info callbacks are available for your convenience: |
3688 | <function>snd_ctl_boolean_mono_info()</function> and | 3686 | <function>snd_ctl_boolean_mono_info()</function> and |
3689 | <function>snd_ctl_boolean_stereo_info()</function>. | 3687 | <function>snd_ctl_boolean_stereo_info()</function>. |
3690 | Obviously, the former is an info callback for a mono channel | 3688 | Obviously, the former is an info callback for a mono channel |
@@ -3699,7 +3697,7 @@ struct _snd_pcm_runtime { | |||
3699 | 3697 | ||
3700 | <para> | 3698 | <para> |
3701 | This callback is used to read the current value of the | 3699 | This callback is used to read the current value of the |
3702 | control and to return to the user-space. | 3700 | control and to return to user-space. |
3703 | </para> | 3701 | </para> |
3704 | 3702 | ||
3705 | <para> | 3703 | <para> |
@@ -3722,11 +3720,11 @@ struct _snd_pcm_runtime { | |||
3722 | </para> | 3720 | </para> |
3723 | 3721 | ||
3724 | <para> | 3722 | <para> |
3725 | The <structfield>value</structfield> field is depending on | 3723 | The <structfield>value</structfield> field depends on |
3726 | the type of control as well as on info callback. For example, | 3724 | the type of control as well as on the info callback. For example, |
3727 | the sb driver uses this field to store the register offset, | 3725 | the sb driver uses this field to store the register offset, |
3728 | the bit-shift and the bit-mask. The | 3726 | the bit-shift and the bit-mask. The |
3729 | <structfield>private_value</structfield> is set like | 3727 | <structfield>private_value</structfield> field is set as follows: |
3730 | <informalexample> | 3728 | <informalexample> |
3731 | <programlisting> | 3729 | <programlisting> |
3732 | <![CDATA[ | 3730 | <![CDATA[ |
@@ -3752,7 +3750,8 @@ struct _snd_pcm_runtime { | |||
3752 | </para> | 3750 | </para> |
3753 | 3751 | ||
3754 | <para> | 3752 | <para> |
3755 | In <structfield>get</structfield> callback, you have to fill all the elements if the | 3753 | In the <structfield>get</structfield> callback, |
3754 | you have to fill all the elements if the | ||
3756 | control has more than one elements, | 3755 | control has more than one elements, |
3757 | i.e. <structfield>count</structfield> > 1. | 3756 | i.e. <structfield>count</structfield> > 1. |
3758 | In the example above, we filled only one element | 3757 | In the example above, we filled only one element |
@@ -3765,7 +3764,7 @@ struct _snd_pcm_runtime { | |||
3765 | <title>put callback</title> | 3764 | <title>put callback</title> |
3766 | 3765 | ||
3767 | <para> | 3766 | <para> |
3768 | This callback is used to write a value from the user-space. | 3767 | This callback is used to write a value from user-space. |
3769 | </para> | 3768 | </para> |
3770 | 3769 | ||
3771 | <para> | 3770 | <para> |
@@ -3799,7 +3798,7 @@ struct _snd_pcm_runtime { | |||
3799 | </para> | 3798 | </para> |
3800 | 3799 | ||
3801 | <para> | 3800 | <para> |
3802 | Like <structfield>get</structfield> callback, | 3801 | As in the <structfield>get</structfield> callback, |
3803 | when the control has more than one elements, | 3802 | when the control has more than one elements, |
3804 | all elements must be evaluated in this callback, too. | 3803 | all elements must be evaluated in this callback, too. |
3805 | </para> | 3804 | </para> |
@@ -3817,7 +3816,7 @@ struct _snd_pcm_runtime { | |||
3817 | <title>Constructor</title> | 3816 | <title>Constructor</title> |
3818 | <para> | 3817 | <para> |
3819 | When everything is ready, finally we can create a new | 3818 | When everything is ready, finally we can create a new |
3820 | control. For creating a control, there are two functions to be | 3819 | control. To create a control, there are two functions to be |
3821 | called, <function>snd_ctl_new1()</function> and | 3820 | called, <function>snd_ctl_new1()</function> and |
3822 | <function>snd_ctl_add()</function>. | 3821 | <function>snd_ctl_add()</function>. |
3823 | </para> | 3822 | </para> |
@@ -3839,14 +3838,14 @@ struct _snd_pcm_runtime { | |||
3839 | struct <structname>snd_kcontrol_new</structname> object defined above, and chip | 3838 | struct <structname>snd_kcontrol_new</structname> object defined above, and chip |
3840 | is the object pointer to be passed to | 3839 | is the object pointer to be passed to |
3841 | kcontrol->private_data | 3840 | kcontrol->private_data |
3842 | which can be referred in callbacks. | 3841 | which can be referred to in callbacks. |
3843 | </para> | 3842 | </para> |
3844 | 3843 | ||
3845 | <para> | 3844 | <para> |
3846 | <function>snd_ctl_new1()</function> allocates a new | 3845 | <function>snd_ctl_new1()</function> allocates a new |
3847 | <structname>snd_kcontrol</structname> instance (that's why the definition | 3846 | <structname>snd_kcontrol</structname> instance (that's why the definition |
3848 | of <parameter>my_control</parameter> can be with | 3847 | of <parameter>my_control</parameter> can be with |
3849 | <parameter>__devinitdata</parameter> | 3848 | the <parameter>__devinitdata</parameter> |
3850 | prefix), and <function>snd_ctl_add</function> assigns the given | 3849 | prefix), and <function>snd_ctl_add</function> assigns the given |
3851 | control component to the card. | 3850 | control component to the card. |
3852 | </para> | 3851 | </para> |
@@ -3941,7 +3940,7 @@ struct _snd_pcm_runtime { | |||
3941 | <title>General</title> | 3940 | <title>General</title> |
3942 | <para> | 3941 | <para> |
3943 | The ALSA AC97 codec layer is a well-defined one, and you don't | 3942 | The ALSA AC97 codec layer is a well-defined one, and you don't |
3944 | have to write many codes to control it. Only low-level control | 3943 | have to write much code to control it. Only low-level control |
3945 | routines are necessary. The AC97 codec API is defined in | 3944 | routines are necessary. The AC97 codec API is defined in |
3946 | <filename><sound/ac97_codec.h></filename>. | 3945 | <filename><sound/ac97_codec.h></filename>. |
3947 | </para> | 3946 | </para> |
@@ -4004,7 +4003,7 @@ struct _snd_pcm_runtime { | |||
4004 | <section id="api-ac97-constructor"> | 4003 | <section id="api-ac97-constructor"> |
4005 | <title>Constructor</title> | 4004 | <title>Constructor</title> |
4006 | <para> | 4005 | <para> |
4007 | For creating an ac97 instance, first call <function>snd_ac97_bus</function> | 4006 | To create an ac97 instance, first call <function>snd_ac97_bus</function> |
4008 | with an <type>ac97_bus_ops_t</type> record with callback functions. | 4007 | with an <type>ac97_bus_ops_t</type> record with callback functions. |
4009 | 4008 | ||
4010 | <informalexample> | 4009 | <informalexample> |
@@ -4042,12 +4041,12 @@ struct _snd_pcm_runtime { | |||
4042 | </programlisting> | 4041 | </programlisting> |
4043 | </informalexample> | 4042 | </informalexample> |
4044 | 4043 | ||
4045 | where chip->ac97 is the pointer of a newly created | 4044 | where chip->ac97 is a pointer to a newly created |
4046 | <type>ac97_t</type> instance. | 4045 | <type>ac97_t</type> instance. |
4047 | In this case, the chip pointer is set as the private data, so that | 4046 | In this case, the chip pointer is set as the private data, so that |
4048 | the read/write callback functions can refer to this chip instance. | 4047 | the read/write callback functions can refer to this chip instance. |
4049 | This instance is not necessarily stored in the chip | 4048 | This instance is not necessarily stored in the chip |
4050 | record. When you need to change the register values from the | 4049 | record. If you need to change the register values from the |
4051 | driver, or need the suspend/resume of ac97 codecs, keep this | 4050 | driver, or need the suspend/resume of ac97 codecs, keep this |
4052 | pointer to pass to the corresponding functions. | 4051 | pointer to pass to the corresponding functions. |
4053 | </para> | 4052 | </para> |
@@ -4098,7 +4097,7 @@ struct _snd_pcm_runtime { | |||
4098 | </para> | 4097 | </para> |
4099 | 4098 | ||
4100 | <para> | 4099 | <para> |
4101 | These callbacks are non-atomic like the callbacks of control API. | 4100 | These callbacks are non-atomic like the control API callbacks. |
4102 | </para> | 4101 | </para> |
4103 | 4102 | ||
4104 | <para> | 4103 | <para> |
@@ -4110,14 +4109,14 @@ struct _snd_pcm_runtime { | |||
4110 | 4109 | ||
4111 | <para> | 4110 | <para> |
4112 | The <structfield>reset</structfield> callback is used to reset | 4111 | The <structfield>reset</structfield> callback is used to reset |
4113 | the codec. If the chip requires a special way of reset, you can | 4112 | the codec. If the chip requires a special kind of reset, you can |
4114 | define this callback. | 4113 | define this callback. |
4115 | </para> | 4114 | </para> |
4116 | 4115 | ||
4117 | <para> | 4116 | <para> |
4118 | The <structfield>wait</structfield> callback is used for a | 4117 | The <structfield>wait</structfield> callback is used to |
4119 | certain wait at the standard initialization of the codec. If the | 4118 | add some waiting time in the standard initialization of the codec. If the |
4120 | chip requires the extra wait-time, define this callback. | 4119 | chip requires the extra waiting time, define this callback. |
4121 | </para> | 4120 | </para> |
4122 | 4121 | ||
4123 | <para> | 4122 | <para> |
@@ -4172,7 +4171,7 @@ struct _snd_pcm_runtime { | |||
4172 | 4171 | ||
4173 | <para> | 4172 | <para> |
4174 | <function>snd_ac97_update_bits()</function> is used to update | 4173 | <function>snd_ac97_update_bits()</function> is used to update |
4175 | some bits of the given register. | 4174 | some bits in the given register. |
4176 | 4175 | ||
4177 | <informalexample> | 4176 | <informalexample> |
4178 | <programlisting> | 4177 | <programlisting> |
@@ -4185,7 +4184,7 @@ struct _snd_pcm_runtime { | |||
4185 | 4184 | ||
4186 | <para> | 4185 | <para> |
4187 | Also, there is a function to change the sample rate (of a | 4186 | Also, there is a function to change the sample rate (of a |
4188 | certain register such as | 4187 | given register such as |
4189 | <constant>AC97_PCM_FRONT_DAC_RATE</constant>) when VRA or | 4188 | <constant>AC97_PCM_FRONT_DAC_RATE</constant>) when VRA or |
4190 | DRA is supported by the codec: | 4189 | DRA is supported by the codec: |
4191 | <function>snd_ac97_set_rate()</function>. | 4190 | <function>snd_ac97_set_rate()</function>. |
@@ -4200,11 +4199,11 @@ struct _snd_pcm_runtime { | |||
4200 | </para> | 4199 | </para> |
4201 | 4200 | ||
4202 | <para> | 4201 | <para> |
4203 | The following registers are available for setting the rate: | 4202 | The following registers are available to set the rate: |
4204 | <constant>AC97_PCM_MIC_ADC_RATE</constant>, | 4203 | <constant>AC97_PCM_MIC_ADC_RATE</constant>, |
4205 | <constant>AC97_PCM_FRONT_DAC_RATE</constant>, | 4204 | <constant>AC97_PCM_FRONT_DAC_RATE</constant>, |
4206 | <constant>AC97_PCM_LR_ADC_RATE</constant>, | 4205 | <constant>AC97_PCM_LR_ADC_RATE</constant>, |
4207 | <constant>AC97_SPDIF</constant>. When the | 4206 | <constant>AC97_SPDIF</constant>. When |
4208 | <constant>AC97_SPDIF</constant> is specified, the register is | 4207 | <constant>AC97_SPDIF</constant> is specified, the register is |
4209 | not really changed but the corresponding IEC958 status bits will | 4208 | not really changed but the corresponding IEC958 status bits will |
4210 | be updated. | 4209 | be updated. |
@@ -4214,12 +4213,11 @@ struct _snd_pcm_runtime { | |||
4214 | <section id="api-ac97-clock-adjustment"> | 4213 | <section id="api-ac97-clock-adjustment"> |
4215 | <title>Clock Adjustment</title> | 4214 | <title>Clock Adjustment</title> |
4216 | <para> | 4215 | <para> |
4217 | On some chip, the clock of the codec isn't 48000 but using a | 4216 | In some chips, the clock of the codec isn't 48000 but using a |
4218 | PCI clock (to save a quartz!). In this case, change the field | 4217 | PCI clock (to save a quartz!). In this case, change the field |
4219 | bus->clock to the corresponding | 4218 | bus->clock to the corresponding |
4220 | value. For example, intel8x0 | 4219 | value. For example, intel8x0 |
4221 | and es1968 drivers have the auto-measurement function of the | 4220 | and es1968 drivers have their own function to read from the clock. |
4222 | clock. | ||
4223 | </para> | 4221 | </para> |
4224 | </section> | 4222 | </section> |
4225 | 4223 | ||
@@ -4239,15 +4237,13 @@ struct _snd_pcm_runtime { | |||
4239 | When there are several codecs on the same card, you need to | 4237 | When there are several codecs on the same card, you need to |
4240 | call <function>snd_ac97_mixer()</function> multiple times with | 4238 | call <function>snd_ac97_mixer()</function> multiple times with |
4241 | ac97.num=1 or greater. The <structfield>num</structfield> field | 4239 | ac97.num=1 or greater. The <structfield>num</structfield> field |
4242 | specifies the codec | 4240 | specifies the codec number. |
4243 | number. | ||
4244 | </para> | 4241 | </para> |
4245 | 4242 | ||
4246 | <para> | 4243 | <para> |
4247 | If you have set up multiple codecs, you need to either write | 4244 | If you set up multiple codecs, you either need to write |
4248 | different callbacks for each codec or check | 4245 | different callbacks for each codec or check |
4249 | ac97->num in the | 4246 | ac97->num in the callback routines. |
4250 | callback routines. | ||
4251 | </para> | 4247 | </para> |
4252 | </section> | 4248 | </section> |
4253 | 4249 | ||
@@ -4271,7 +4267,7 @@ struct _snd_pcm_runtime { | |||
4271 | </para> | 4267 | </para> |
4272 | 4268 | ||
4273 | <para> | 4269 | <para> |
4274 | Some soundchips have similar but a little bit different | 4270 | Some soundchips have a similar but slightly different |
4275 | implementation of mpu401 stuff. For example, emu10k1 has its own | 4271 | implementation of mpu401 stuff. For example, emu10k1 has its own |
4276 | mpu401 routines. | 4272 | mpu401 routines. |
4277 | </para> | 4273 | </para> |
@@ -4280,7 +4276,7 @@ struct _snd_pcm_runtime { | |||
4280 | <section id="midi-interface-constructor"> | 4276 | <section id="midi-interface-constructor"> |
4281 | <title>Constructor</title> | 4277 | <title>Constructor</title> |
4282 | <para> | 4278 | <para> |
4283 | For creating a rawmidi object, call | 4279 | To create a rawmidi object, call |
4284 | <function>snd_mpu401_uart_new()</function>. | 4280 | <function>snd_mpu401_uart_new()</function>. |
4285 | 4281 | ||
4286 | <informalexample> | 4282 | <informalexample> |
@@ -4307,25 +4303,24 @@ struct _snd_pcm_runtime { | |||
4307 | </para> | 4303 | </para> |
4308 | 4304 | ||
4309 | <para> | 4305 | <para> |
4310 | The 4th argument is the i/o port address. Many | 4306 | The 4th argument is the I/O port address. Many |
4311 | backward-compatible MPU401 has an i/o port such as 0x330. Or, it | 4307 | backward-compatible MPU401 have an I/O port such as 0x330. Or, it |
4312 | might be a part of its own PCI i/o region. It depends on the | 4308 | might be a part of its own PCI I/O region. It depends on the |
4313 | chip design. | 4309 | chip design. |
4314 | </para> | 4310 | </para> |
4315 | 4311 | ||
4316 | <para> | 4312 | <para> |
4317 | The 5th argument is bitflags for additional information. | 4313 | The 5th argument is a bitflag for additional information. |
4318 | When the i/o port address above is a part of the PCI i/o | 4314 | When the I/O port address above is part of the PCI I/O |
4319 | region, the MPU401 i/o port might have been already allocated | 4315 | region, the MPU401 I/O port might have been already allocated |
4320 | (reserved) by the driver itself. In such a case, pass a bit flag | 4316 | (reserved) by the driver itself. In such a case, pass a bit flag |
4321 | <constant>MPU401_INFO_INTEGRATED</constant>, | 4317 | <constant>MPU401_INFO_INTEGRATED</constant>, |
4322 | and | 4318 | and the mpu401-uart layer will allocate the I/O ports by itself. |
4323 | the mpu401-uart layer will allocate the i/o ports by itself. | ||
4324 | </para> | 4319 | </para> |
4325 | 4320 | ||
4326 | <para> | 4321 | <para> |
4327 | When the controller supports only the input or output MIDI stream, | 4322 | When the controller supports only the input or output MIDI stream, |
4328 | pass <constant>MPU401_INFO_INPUT</constant> or | 4323 | pass the <constant>MPU401_INFO_INPUT</constant> or |
4329 | <constant>MPU401_INFO_OUTPUT</constant> bitflag, respectively. | 4324 | <constant>MPU401_INFO_OUTPUT</constant> bitflag, respectively. |
4330 | Then the rawmidi instance is created as a single stream. | 4325 | Then the rawmidi instance is created as a single stream. |
4331 | </para> | 4326 | </para> |
@@ -4333,7 +4328,7 @@ struct _snd_pcm_runtime { | |||
4333 | <para> | 4328 | <para> |
4334 | <constant>MPU401_INFO_MMIO</constant> bitflag is used to change | 4329 | <constant>MPU401_INFO_MMIO</constant> bitflag is used to change |
4335 | the access method to MMIO (via readb and writeb) instead of | 4330 | the access method to MMIO (via readb and writeb) instead of |
4336 | iob and outb. In this case, you have to pass the iomapped address | 4331 | iob and outb. In this case, you have to pass the iomapped address |
4337 | to <function>snd_mpu401_uart_new()</function>. | 4332 | to <function>snd_mpu401_uart_new()</function>. |
4338 | </para> | 4333 | </para> |
4339 | 4334 | ||
@@ -4341,7 +4336,7 @@ struct _snd_pcm_runtime { | |||
4341 | When <constant>MPU401_INFO_TX_IRQ</constant> is set, the output | 4336 | When <constant>MPU401_INFO_TX_IRQ</constant> is set, the output |
4342 | stream isn't checked in the default interrupt handler. The driver | 4337 | stream isn't checked in the default interrupt handler. The driver |
4343 | needs to call <function>snd_mpu401_uart_interrupt_tx()</function> | 4338 | needs to call <function>snd_mpu401_uart_interrupt_tx()</function> |
4344 | by itself to start processing the output stream in irq handler. | 4339 | by itself to start processing the output stream in the irq handler. |
4345 | </para> | 4340 | </para> |
4346 | 4341 | ||
4347 | <para> | 4342 | <para> |
@@ -4381,7 +4376,7 @@ struct _snd_pcm_runtime { | |||
4381 | (<parameter>irq_flags</parameter>). Otherwise, pass the flags | 4376 | (<parameter>irq_flags</parameter>). Otherwise, pass the flags |
4382 | for irq allocation | 4377 | for irq allocation |
4383 | (<constant>SA_XXX</constant> bits) to it, and the irq will be | 4378 | (<constant>SA_XXX</constant> bits) to it, and the irq will be |
4384 | reserved by the mpu401-uart layer. If the card doesn't generates | 4379 | reserved by the mpu401-uart layer. If the card doesn't generate |
4385 | UART interrupts, pass -1 as the irq number. Then a timer | 4380 | UART interrupts, pass -1 as the irq number. Then a timer |
4386 | interrupt will be invoked for polling. | 4381 | interrupt will be invoked for polling. |
4387 | </para> | 4382 | </para> |
@@ -4392,8 +4387,8 @@ struct _snd_pcm_runtime { | |||
4392 | <para> | 4387 | <para> |
4393 | When the interrupt is allocated in | 4388 | When the interrupt is allocated in |
4394 | <function>snd_mpu401_uart_new()</function>, the private | 4389 | <function>snd_mpu401_uart_new()</function>, the private |
4395 | interrupt handler is used, hence you don't have to do nothing | 4390 | interrupt handler is used, hence you don't have anything else to do |
4396 | else than creating the mpu401 stuff. Otherwise, you have to call | 4391 | than creating the mpu401 stuff. Otherwise, you have to call |
4397 | <function>snd_mpu401_uart_interrupt()</function> explicitly when | 4392 | <function>snd_mpu401_uart_interrupt()</function> explicitly when |
4398 | a UART interrupt is invoked and checked in your own interrupt | 4393 | a UART interrupt is invoked and checked in your own interrupt |
4399 | handler. | 4394 | handler. |
@@ -4480,8 +4475,8 @@ struct _snd_pcm_runtime { | |||
4480 | 4475 | ||
4481 | <para> | 4476 | <para> |
4482 | The fourth and fifth arguments are the number of output and | 4477 | The fourth and fifth arguments are the number of output and |
4483 | input substreams, respectively, of this device. (A substream is | 4478 | input substreams, respectively, of this device (a substream is |
4484 | the equivalent of a MIDI port.) | 4479 | the equivalent of a MIDI port). |
4485 | </para> | 4480 | </para> |
4486 | 4481 | ||
4487 | <para> | 4482 | <para> |
@@ -4498,7 +4493,7 @@ struct _snd_pcm_runtime { | |||
4498 | <para> | 4493 | <para> |
4499 | After the rawmidi device is created, you need to set the | 4494 | After the rawmidi device is created, you need to set the |
4500 | operators (callbacks) for each substream. There are helper | 4495 | operators (callbacks) for each substream. There are helper |
4501 | functions to set the operators for all substream of a device: | 4496 | functions to set the operators for all the substreams of a device: |
4502 | <informalexample> | 4497 | <informalexample> |
4503 | <programlisting> | 4498 | <programlisting> |
4504 | <![CDATA[ | 4499 | <![CDATA[ |
@@ -4528,8 +4523,8 @@ struct _snd_pcm_runtime { | |||
4528 | </para> | 4523 | </para> |
4529 | 4524 | ||
4530 | <para> | 4525 | <para> |
4531 | If there is more than one substream, you should give each one a | 4526 | If there are more than one substream, you should give a |
4532 | unique name: | 4527 | unique name to each of them: |
4533 | <informalexample> | 4528 | <informalexample> |
4534 | <programlisting> | 4529 | <programlisting> |
4535 | <![CDATA[ | 4530 | <![CDATA[ |
@@ -4550,7 +4545,7 @@ struct _snd_pcm_runtime { | |||
4550 | <title>Callbacks</title> | 4545 | <title>Callbacks</title> |
4551 | 4546 | ||
4552 | <para> | 4547 | <para> |
4553 | In all callbacks, the private data that you've set for the | 4548 | In all the callbacks, the private data that you've set for the |
4554 | rawmidi device can be accessed as | 4549 | rawmidi device can be accessed as |
4555 | substream->rmidi->private_data. | 4550 | substream->rmidi->private_data. |
4556 | <!-- <code> isn't available before DocBook 4.3 --> | 4551 | <!-- <code> isn't available before DocBook 4.3 --> |
@@ -4583,8 +4578,8 @@ struct _snd_pcm_runtime { | |||
4583 | 4578 | ||
4584 | <para> | 4579 | <para> |
4585 | This is called when a substream is opened. | 4580 | This is called when a substream is opened. |
4586 | You can initialize the hardware here, but you should not yet | 4581 | You can initialize the hardware here, but you shouldn't |
4587 | start transmitting/receiving data. | 4582 | start transmitting/receiving data yet. |
4588 | </para> | 4583 | </para> |
4589 | </section> | 4584 | </section> |
4590 | 4585 | ||
@@ -4632,9 +4627,9 @@ struct _snd_pcm_runtime { | |||
4632 | To read data from the buffer, call | 4627 | To read data from the buffer, call |
4633 | <function>snd_rawmidi_transmit_peek</function>. It will | 4628 | <function>snd_rawmidi_transmit_peek</function>. It will |
4634 | return the number of bytes that have been read; this will be | 4629 | return the number of bytes that have been read; this will be |
4635 | less than the number of bytes requested when there is no more | 4630 | less than the number of bytes requested when there are no more |
4636 | data in the buffer. | 4631 | data in the buffer. |
4637 | After the data has been transmitted successfully, call | 4632 | After the data have been transmitted successfully, call |
4638 | <function>snd_rawmidi_transmit_ack</function> to remove the | 4633 | <function>snd_rawmidi_transmit_ack</function> to remove the |
4639 | data from the substream buffer: | 4634 | data from the substream buffer: |
4640 | <informalexample> | 4635 | <informalexample> |
@@ -4655,7 +4650,7 @@ struct _snd_pcm_runtime { | |||
4655 | <para> | 4650 | <para> |
4656 | If you know beforehand that the hardware will accept data, you | 4651 | If you know beforehand that the hardware will accept data, you |
4657 | can use the <function>snd_rawmidi_transmit</function> function | 4652 | can use the <function>snd_rawmidi_transmit</function> function |
4658 | which reads some data and removes it from the buffer at once: | 4653 | which reads some data and removes them from the buffer at once: |
4659 | <informalexample> | 4654 | <informalexample> |
4660 | <programlisting> | 4655 | <programlisting> |
4661 | <![CDATA[ | 4656 | <![CDATA[ |
@@ -4749,13 +4744,13 @@ struct _snd_pcm_runtime { | |||
4749 | 4744 | ||
4750 | <para> | 4745 | <para> |
4751 | This is only used with output substreams. This function should wait | 4746 | This is only used with output substreams. This function should wait |
4752 | until all data read from the substream buffer has been transmitted. | 4747 | until all data read from the substream buffer have been transmitted. |
4753 | This ensures that the device can be closed and the driver unloaded | 4748 | This ensures that the device can be closed and the driver unloaded |
4754 | without losing data. | 4749 | without losing data. |
4755 | </para> | 4750 | </para> |
4756 | 4751 | ||
4757 | <para> | 4752 | <para> |
4758 | This callback is optional. If you do not set | 4753 | This callback is optional. If you do not set |
4759 | <structfield>drain</structfield> in the struct snd_rawmidi_ops | 4754 | <structfield>drain</structfield> in the struct snd_rawmidi_ops |
4760 | structure, ALSA will simply wait for 50 milliseconds | 4755 | structure, ALSA will simply wait for 50 milliseconds |
4761 | instead. | 4756 | instead. |
@@ -4775,24 +4770,24 @@ struct _snd_pcm_runtime { | |||
4775 | <section id="misc-devices-opl3"> | 4770 | <section id="misc-devices-opl3"> |
4776 | <title>FM OPL3</title> | 4771 | <title>FM OPL3</title> |
4777 | <para> | 4772 | <para> |
4778 | The FM OPL3 is still used on many chips (mainly for backward | 4773 | The FM OPL3 is still used in many chips (mainly for backward |
4779 | compatibility). ALSA has a nice OPL3 FM control layer, too. The | 4774 | compatibility). ALSA has a nice OPL3 FM control layer, too. The |
4780 | OPL3 API is defined in | 4775 | OPL3 API is defined in |
4781 | <filename><sound/opl3.h></filename>. | 4776 | <filename><sound/opl3.h></filename>. |
4782 | </para> | 4777 | </para> |
4783 | 4778 | ||
4784 | <para> | 4779 | <para> |
4785 | FM registers can be directly accessed through direct-FM API, | 4780 | FM registers can be directly accessed through the direct-FM API, |
4786 | defined in <filename><sound/asound_fm.h></filename>. In | 4781 | defined in <filename><sound/asound_fm.h></filename>. In |
4787 | ALSA native mode, FM registers are accessed through | 4782 | ALSA native mode, FM registers are accessed through |
4788 | Hardware-Dependant Device direct-FM extension API, whereas in | 4783 | the Hardware-Dependant Device direct-FM extension API, whereas in |
4789 | OSS compatible mode, FM registers can be accessed with OSS | 4784 | OSS compatible mode, FM registers can be accessed with the OSS |
4790 | direct-FM compatible API on <filename>/dev/dmfmX</filename> device. | 4785 | direct-FM compatible API in <filename>/dev/dmfmX</filename> device. |
4791 | </para> | 4786 | </para> |
4792 | 4787 | ||
4793 | <para> | 4788 | <para> |
4794 | For creating the OPL3 component, you have two functions to | 4789 | To create the OPL3 component, you have two functions to |
4795 | call. The first one is a constructor for <type>opl3_t</type> | 4790 | call. The first one is a constructor for the <type>opl3_t</type> |
4796 | instance. | 4791 | instance. |
4797 | 4792 | ||
4798 | <informalexample> | 4793 | <informalexample> |
@@ -4819,12 +4814,12 @@ struct _snd_pcm_runtime { | |||
4819 | <para> | 4814 | <para> |
4820 | When the left and right ports have been already allocated by | 4815 | When the left and right ports have been already allocated by |
4821 | the card driver, pass non-zero to the fifth argument | 4816 | the card driver, pass non-zero to the fifth argument |
4822 | (<parameter>integrated</parameter>). Otherwise, opl3 module will | 4817 | (<parameter>integrated</parameter>). Otherwise, the opl3 module will |
4823 | allocate the specified ports by itself. | 4818 | allocate the specified ports by itself. |
4824 | </para> | 4819 | </para> |
4825 | 4820 | ||
4826 | <para> | 4821 | <para> |
4827 | When the accessing to the hardware requires special method | 4822 | When the accessing the hardware requires special method |
4828 | instead of the standard I/O access, you can create opl3 instance | 4823 | instead of the standard I/O access, you can create opl3 instance |
4829 | separately with <function>snd_opl3_new()</function>. | 4824 | separately with <function>snd_opl3_new()</function>. |
4830 | 4825 | ||
@@ -4845,13 +4840,13 @@ struct _snd_pcm_runtime { | |||
4845 | access function, the private data and the destructor. | 4840 | access function, the private data and the destructor. |
4846 | The l_port and r_port are not necessarily set. Only the | 4841 | The l_port and r_port are not necessarily set. Only the |
4847 | command must be set properly. You can retrieve the data | 4842 | command must be set properly. You can retrieve the data |
4848 | from opl3->private_data field. | 4843 | from the opl3->private_data field. |
4849 | </para> | 4844 | </para> |
4850 | 4845 | ||
4851 | <para> | 4846 | <para> |
4852 | After creating the opl3 instance via <function>snd_opl3_new()</function>, | 4847 | After creating the opl3 instance via <function>snd_opl3_new()</function>, |
4853 | call <function>snd_opl3_init()</function> to initialize the chip to the | 4848 | call <function>snd_opl3_init()</function> to initialize the chip to the |
4854 | proper state. Note that <function>snd_opl3_create()</function> always | 4849 | proper state. Note that <function>snd_opl3_create()</function> always |
4855 | calls it internally. | 4850 | calls it internally. |
4856 | </para> | 4851 | </para> |
4857 | 4852 | ||
@@ -4884,7 +4879,7 @@ struct _snd_pcm_runtime { | |||
4884 | <section id="misc-devices-hardware-dependent"> | 4879 | <section id="misc-devices-hardware-dependent"> |
4885 | <title>Hardware-Dependent Devices</title> | 4880 | <title>Hardware-Dependent Devices</title> |
4886 | <para> | 4881 | <para> |
4887 | Some chips need the access from the user-space for special | 4882 | Some chips need user-space access for special |
4888 | controls or for loading the micro code. In such a case, you can | 4883 | controls or for loading the micro code. In such a case, you can |
4889 | create a hwdep (hardware-dependent) device. The hwdep API is | 4884 | create a hwdep (hardware-dependent) device. The hwdep API is |
4890 | defined in <filename><sound/hwdep.h></filename>. You can | 4885 | defined in <filename><sound/hwdep.h></filename>. You can |
@@ -4893,7 +4888,7 @@ struct _snd_pcm_runtime { | |||
4893 | </para> | 4888 | </para> |
4894 | 4889 | ||
4895 | <para> | 4890 | <para> |
4896 | Creation of the <type>hwdep</type> instance is done via | 4891 | The creation of the <type>hwdep</type> instance is done via |
4897 | <function>snd_hwdep_new()</function>. | 4892 | <function>snd_hwdep_new()</function>. |
4898 | 4893 | ||
4899 | <informalexample> | 4894 | <informalexample> |
@@ -4912,8 +4907,8 @@ struct _snd_pcm_runtime { | |||
4912 | You can then pass any pointer value to the | 4907 | You can then pass any pointer value to the |
4913 | <parameter>private_data</parameter>. | 4908 | <parameter>private_data</parameter>. |
4914 | If you assign a private data, you should define the | 4909 | If you assign a private data, you should define the |
4915 | destructor, too. The destructor function is set to | 4910 | destructor, too. The destructor function is set in |
4916 | <structfield>private_free</structfield> field. | 4911 | the <structfield>private_free</structfield> field. |
4917 | 4912 | ||
4918 | <informalexample> | 4913 | <informalexample> |
4919 | <programlisting> | 4914 | <programlisting> |
@@ -4925,7 +4920,7 @@ struct _snd_pcm_runtime { | |||
4925 | </programlisting> | 4920 | </programlisting> |
4926 | </informalexample> | 4921 | </informalexample> |
4927 | 4922 | ||
4928 | and the implementation of destructor would be: | 4923 | and the implementation of the destructor would be: |
4929 | 4924 | ||
4930 | <informalexample> | 4925 | <informalexample> |
4931 | <programlisting> | 4926 | <programlisting> |
@@ -4943,7 +4938,7 @@ struct _snd_pcm_runtime { | |||
4943 | <para> | 4938 | <para> |
4944 | The arbitrary file operations can be defined for this | 4939 | The arbitrary file operations can be defined for this |
4945 | instance. The file operators are defined in | 4940 | instance. The file operators are defined in |
4946 | <parameter>ops</parameter> table. For example, assume that | 4941 | the <parameter>ops</parameter> table. For example, assume that |
4947 | this chip needs an ioctl. | 4942 | this chip needs an ioctl. |
4948 | 4943 | ||
4949 | <informalexample> | 4944 | <informalexample> |
@@ -4964,7 +4959,7 @@ struct _snd_pcm_runtime { | |||
4964 | <title>IEC958 (S/PDIF)</title> | 4959 | <title>IEC958 (S/PDIF)</title> |
4965 | <para> | 4960 | <para> |
4966 | Usually the controls for IEC958 devices are implemented via | 4961 | Usually the controls for IEC958 devices are implemented via |
4967 | control interface. There is a macro to compose a name string for | 4962 | the control interface. There is a macro to compose a name string for |
4968 | IEC958 controls, <function>SNDRV_CTL_NAME_IEC958()</function> | 4963 | IEC958 controls, <function>SNDRV_CTL_NAME_IEC958()</function> |
4969 | defined in <filename><include/asound.h></filename>. | 4964 | defined in <filename><include/asound.h></filename>. |
4970 | </para> | 4965 | </para> |
@@ -4973,7 +4968,7 @@ struct _snd_pcm_runtime { | |||
4973 | There are some standard controls for IEC958 status bits. These | 4968 | There are some standard controls for IEC958 status bits. These |
4974 | controls use the type <type>SNDRV_CTL_ELEM_TYPE_IEC958</type>, | 4969 | controls use the type <type>SNDRV_CTL_ELEM_TYPE_IEC958</type>, |
4975 | and the size of element is fixed as 4 bytes array | 4970 | and the size of element is fixed as 4 bytes array |
4976 | (value.iec958.status[x]). For <structfield>info</structfield> | 4971 | (value.iec958.status[x]). For the <structfield>info</structfield> |
4977 | callback, you don't specify | 4972 | callback, you don't specify |
4978 | the value field for this type (the count field must be set, | 4973 | the value field for this type (the count field must be set, |
4979 | though). | 4974 | though). |
@@ -5001,7 +4996,7 @@ struct _snd_pcm_runtime { | |||
5001 | enable/disable or to set the raw bit mode. The implementation | 4996 | enable/disable or to set the raw bit mode. The implementation |
5002 | will depend on the chip, but the control should be named as | 4997 | will depend on the chip, but the control should be named as |
5003 | <quote>IEC958 xxx</quote>, preferably using | 4998 | <quote>IEC958 xxx</quote>, preferably using |
5004 | <function>SNDRV_CTL_NAME_IEC958()</function> macro. | 4999 | the <function>SNDRV_CTL_NAME_IEC958()</function> macro. |
5005 | </para> | 5000 | </para> |
5006 | 5001 | ||
5007 | <para> | 5002 | <para> |
@@ -5036,12 +5031,12 @@ struct _snd_pcm_runtime { | |||
5036 | The allocation of pages with fallback is | 5031 | The allocation of pages with fallback is |
5037 | <function>snd_malloc_xxx_pages_fallback()</function>. This | 5032 | <function>snd_malloc_xxx_pages_fallback()</function>. This |
5038 | function tries to allocate the specified pages but if the pages | 5033 | function tries to allocate the specified pages but if the pages |
5039 | are not available, it tries to reduce the page sizes until the | 5034 | are not available, it tries to reduce the page sizes until |
5040 | enough space is found. | 5035 | enough space is found. |
5041 | </para> | 5036 | </para> |
5042 | 5037 | ||
5043 | <para> | 5038 | <para> |
5044 | For releasing the space, call | 5039 | The release the pages, call |
5045 | <function>snd_free_xxx_pages()</function> function. | 5040 | <function>snd_free_xxx_pages()</function> function. |
5046 | </para> | 5041 | </para> |
5047 | 5042 | ||
@@ -5050,8 +5045,8 @@ struct _snd_pcm_runtime { | |||
5050 | a large contiguous physical space | 5045 | a large contiguous physical space |
5051 | at the time the module is loaded for the later use. | 5046 | at the time the module is loaded for the later use. |
5052 | This is called <quote>pre-allocation</quote>. | 5047 | This is called <quote>pre-allocation</quote>. |
5053 | As already written, you can call the following function at the | 5048 | As already written, you can call the following function at |
5054 | construction of pcm instance (in the case of PCI bus). | 5049 | pcm instance construction time (in the case of PCI bus). |
5055 | 5050 | ||
5056 | <informalexample> | 5051 | <informalexample> |
5057 | <programlisting> | 5052 | <programlisting> |
@@ -5063,34 +5058,34 @@ struct _snd_pcm_runtime { | |||
5063 | </informalexample> | 5058 | </informalexample> |
5064 | 5059 | ||
5065 | where <parameter>size</parameter> is the byte size to be | 5060 | where <parameter>size</parameter> is the byte size to be |
5066 | pre-allocated and the <parameter>max</parameter> is the maximal | 5061 | pre-allocated and the <parameter>max</parameter> is the maximum |
5067 | size to be changed via <filename>prealloc</filename> proc file. | 5062 | size to be changed via the <filename>prealloc</filename> proc file. |
5068 | The allocator will try to get as large area as possible | 5063 | The allocator will try to get an area as large as possible |
5069 | within the given size. | 5064 | within the given size. |
5070 | </para> | 5065 | </para> |
5071 | 5066 | ||
5072 | <para> | 5067 | <para> |
5073 | The second argument (type) and the third argument (device pointer) | 5068 | The second argument (type) and the third argument (device pointer) |
5074 | are dependent on the bus. | 5069 | are dependent on the bus. |
5075 | In the case of ISA bus, pass <function>snd_dma_isa_data()</function> | 5070 | In the case of the ISA bus, pass <function>snd_dma_isa_data()</function> |
5076 | as the third argument with <constant>SNDRV_DMA_TYPE_DEV</constant> type. | 5071 | as the third argument with <constant>SNDRV_DMA_TYPE_DEV</constant> type. |
5077 | For the continuous buffer unrelated to the bus can be pre-allocated | 5072 | For the continuous buffer unrelated to the bus can be pre-allocated |
5078 | with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the | 5073 | with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the |
5079 | <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer, | 5074 | <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer, |
5080 | whereh <constant>GFP_KERNEL</constant> is the kernel allocation flag to | 5075 | where <constant>GFP_KERNEL</constant> is the kernel allocation flag to |
5081 | use. For the SBUS, <constant>SNDRV_DMA_TYPE_SBUS</constant> and | 5076 | use. For the SBUS, <constant>SNDRV_DMA_TYPE_SBUS</constant> and |
5082 | <function>snd_dma_sbus_data(sbus_dev)</function> are used instead. | 5077 | <function>snd_dma_sbus_data(sbus_dev)</function> are used instead. |
5083 | For the PCI scatter-gather buffers, use | 5078 | For the PCI scatter-gather buffers, use |
5084 | <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with | 5079 | <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with |
5085 | <function>snd_dma_pci_data(pci)</function> | 5080 | <function>snd_dma_pci_data(pci)</function> |
5086 | (see the section | 5081 | (see the |
5087 | <link linkend="buffer-and-memory-non-contiguous"><citetitle>Non-Contiguous Buffers | 5082 | <link linkend="buffer-and-memory-non-contiguous"><citetitle>Non-Contiguous Buffers |
5088 | </citetitle></link>). | 5083 | </citetitle></link> section). |
5089 | </para> | 5084 | </para> |
5090 | 5085 | ||
5091 | <para> | 5086 | <para> |
5092 | Once when the buffer is pre-allocated, you can use the | 5087 | Once the buffer is pre-allocated, you can use the |
5093 | allocator in the <structfield>hw_params</structfield> callback | 5088 | allocator in the <structfield>hw_params</structfield> callback: |
5094 | 5089 | ||
5095 | <informalexample> | 5090 | <informalexample> |
5096 | <programlisting> | 5091 | <programlisting> |
@@ -5116,8 +5111,8 @@ struct _snd_pcm_runtime { | |||
5116 | </para> | 5111 | </para> |
5117 | 5112 | ||
5118 | <para> | 5113 | <para> |
5119 | The first case works fine if the external hardware buffer is enough | 5114 | The first case works fine if the external hardware buffer is large |
5120 | large. This method doesn't need any extra buffers and thus is | 5115 | enough. This method doesn't need any extra buffers and thus is |
5121 | more effective. You need to define the | 5116 | more effective. You need to define the |
5122 | <structfield>copy</structfield> and | 5117 | <structfield>copy</structfield> and |
5123 | <structfield>silence</structfield> callbacks for | 5118 | <structfield>silence</structfield> callbacks for |
@@ -5127,25 +5122,25 @@ struct _snd_pcm_runtime { | |||
5127 | </para> | 5122 | </para> |
5128 | 5123 | ||
5129 | <para> | 5124 | <para> |
5130 | The second case allows the mmap of the buffer, although you have | 5125 | The second case allows for mmap on the buffer, although you have |
5131 | to handle an interrupt or a tasklet for transferring the data | 5126 | to handle an interrupt or a tasklet to transfer the data |
5132 | from the intermediate buffer to the hardware buffer. You can find an | 5127 | from the intermediate buffer to the hardware buffer. You can find an |
5133 | example in vxpocket driver. | 5128 | example in the vxpocket driver. |
5134 | </para> | 5129 | </para> |
5135 | 5130 | ||
5136 | <para> | 5131 | <para> |
5137 | Another case is that the chip uses a PCI memory-map | 5132 | Another case is when the chip uses a PCI memory-map |
5138 | region for the buffer instead of the host memory. In this case, | 5133 | region for the buffer instead of the host memory. In this case, |
5139 | mmap is available only on certain architectures like intel. In | 5134 | mmap is available only on certain architectures like the Intel one. |
5140 | non-mmap mode, the data cannot be transferred as the normal | 5135 | In non-mmap mode, the data cannot be transferred as in the normal |
5141 | way. Thus you need to define <structfield>copy</structfield> and | 5136 | way. Thus you need to define the <structfield>copy</structfield> and |
5142 | <structfield>silence</structfield> callbacks as well | 5137 | <structfield>silence</structfield> callbacks as well, |
5143 | as in the cases above. The examples are found in | 5138 | as in the cases above. The examples are found in |
5144 | <filename>rme32.c</filename> and <filename>rme96.c</filename>. | 5139 | <filename>rme32.c</filename> and <filename>rme96.c</filename>. |
5145 | </para> | 5140 | </para> |
5146 | 5141 | ||
5147 | <para> | 5142 | <para> |
5148 | The implementation of <structfield>copy</structfield> and | 5143 | The implementation of the <structfield>copy</structfield> and |
5149 | <structfield>silence</structfield> callbacks depends upon | 5144 | <structfield>silence</structfield> callbacks depends upon |
5150 | whether the hardware supports interleaved or non-interleaved | 5145 | whether the hardware supports interleaved or non-interleaved |
5151 | samples. The <structfield>copy</structfield> callback is | 5146 | samples. The <structfield>copy</structfield> callback is |
@@ -5184,8 +5179,8 @@ struct _snd_pcm_runtime { | |||
5184 | 5179 | ||
5185 | <para> | 5180 | <para> |
5186 | What you have to do in this callback is again different | 5181 | What you have to do in this callback is again different |
5187 | between playback and capture directions. In the case of | 5182 | between playback and capture directions. In the |
5188 | playback, you do: copy the given amount of data | 5183 | playback case, you copy the given amount of data |
5189 | (<parameter>count</parameter>) at the specified pointer | 5184 | (<parameter>count</parameter>) at the specified pointer |
5190 | (<parameter>src</parameter>) to the specified offset | 5185 | (<parameter>src</parameter>) to the specified offset |
5191 | (<parameter>pos</parameter>) on the hardware buffer. When | 5186 | (<parameter>pos</parameter>) on the hardware buffer. When |
@@ -5202,7 +5197,7 @@ struct _snd_pcm_runtime { | |||
5202 | </para> | 5197 | </para> |
5203 | 5198 | ||
5204 | <para> | 5199 | <para> |
5205 | For the capture direction, you do: copy the given amount of | 5200 | For the capture direction, you copy the given amount of |
5206 | data (<parameter>count</parameter>) at the specified offset | 5201 | data (<parameter>count</parameter>) at the specified offset |
5207 | (<parameter>pos</parameter>) on the hardware buffer to the | 5202 | (<parameter>pos</parameter>) on the hardware buffer to the |
5208 | specified pointer (<parameter>dst</parameter>). | 5203 | specified pointer (<parameter>dst</parameter>). |
@@ -5216,7 +5211,7 @@ struct _snd_pcm_runtime { | |||
5216 | </programlisting> | 5211 | </programlisting> |
5217 | </informalexample> | 5212 | </informalexample> |
5218 | 5213 | ||
5219 | Note that both of the position and the data amount are given | 5214 | Note that both the position and the amount of data are given |
5220 | in frames. | 5215 | in frames. |
5221 | </para> | 5216 | </para> |
5222 | 5217 | ||
@@ -5247,7 +5242,7 @@ struct _snd_pcm_runtime { | |||
5247 | </para> | 5242 | </para> |
5248 | 5243 | ||
5249 | <para> | 5244 | <para> |
5250 | The meanings of arguments are identical with the | 5245 | The meanings of arguments are the same as in the |
5251 | <structfield>copy</structfield> | 5246 | <structfield>copy</structfield> |
5252 | callback, although there is no <parameter>src/dst</parameter> | 5247 | callback, although there is no <parameter>src/dst</parameter> |
5253 | argument. In the case of interleaved samples, the channel | 5248 | argument. In the case of interleaved samples, the channel |
@@ -5284,8 +5279,8 @@ struct _snd_pcm_runtime { | |||
5284 | <section id="buffer-and-memory-non-contiguous"> | 5279 | <section id="buffer-and-memory-non-contiguous"> |
5285 | <title>Non-Contiguous Buffers</title> | 5280 | <title>Non-Contiguous Buffers</title> |
5286 | <para> | 5281 | <para> |
5287 | If your hardware supports the page table like emu10k1 or the | 5282 | If your hardware supports the page table as in emu10k1 or the |
5288 | buffer descriptors like via82xx, you can use the scatter-gather | 5283 | buffer descriptors as in via82xx, you can use the scatter-gather |
5289 | (SG) DMA. ALSA provides an interface for handling SG-buffers. | 5284 | (SG) DMA. ALSA provides an interface for handling SG-buffers. |
5290 | The API is provided in <filename><sound/pcm.h></filename>. | 5285 | The API is provided in <filename><sound/pcm.h></filename>. |
5291 | </para> | 5286 | </para> |
@@ -5296,7 +5291,7 @@ struct _snd_pcm_runtime { | |||
5296 | <function>snd_pcm_lib_preallocate_pages_for_all()</function> | 5291 | <function>snd_pcm_lib_preallocate_pages_for_all()</function> |
5297 | with <constant>SNDRV_DMA_TYPE_DEV_SG</constant> | 5292 | with <constant>SNDRV_DMA_TYPE_DEV_SG</constant> |
5298 | in the PCM constructor like other PCI pre-allocator. | 5293 | in the PCM constructor like other PCI pre-allocator. |
5299 | You need to pass the <function>snd_dma_pci_data(pci)</function>, | 5294 | You need to pass <function>snd_dma_pci_data(pci)</function>, |
5300 | where pci is the struct <structname>pci_dev</structname> pointer | 5295 | where pci is the struct <structname>pci_dev</structname> pointer |
5301 | of the chip as well. | 5296 | of the chip as well. |
5302 | The <type>struct snd_sg_buf</type> instance is created as | 5297 | The <type>struct snd_sg_buf</type> instance is created as |
@@ -5314,7 +5309,7 @@ struct _snd_pcm_runtime { | |||
5314 | 5309 | ||
5315 | <para> | 5310 | <para> |
5316 | Then call <function>snd_pcm_lib_malloc_pages()</function> | 5311 | Then call <function>snd_pcm_lib_malloc_pages()</function> |
5317 | in <structfield>hw_params</structfield> callback | 5312 | in the <structfield>hw_params</structfield> callback |
5318 | as well as in the case of normal PCI buffer. | 5313 | as well as in the case of normal PCI buffer. |
5319 | The SG-buffer handler will allocate the non-contiguous kernel | 5314 | The SG-buffer handler will allocate the non-contiguous kernel |
5320 | pages of the given size and map them onto the virtually contiguous | 5315 | pages of the given size and map them onto the virtually contiguous |
@@ -5335,7 +5330,7 @@ struct _snd_pcm_runtime { | |||
5335 | </para> | 5330 | </para> |
5336 | 5331 | ||
5337 | <para> | 5332 | <para> |
5338 | For releasing the data, call | 5333 | To release the data, call |
5339 | <function>snd_pcm_lib_free_pages()</function> in the | 5334 | <function>snd_pcm_lib_free_pages()</function> in the |
5340 | <structfield>hw_free</structfield> callback as usual. | 5335 | <structfield>hw_free</structfield> callback as usual. |
5341 | </para> | 5336 | </para> |
@@ -5390,7 +5385,7 @@ struct _snd_pcm_runtime { | |||
5390 | </para> | 5385 | </para> |
5391 | 5386 | ||
5392 | <para> | 5387 | <para> |
5393 | For creating a proc file, call | 5388 | To create a proc file, call |
5394 | <function>snd_card_proc_new()</function>. | 5389 | <function>snd_card_proc_new()</function>. |
5395 | 5390 | ||
5396 | <informalexample> | 5391 | <informalexample> |
@@ -5402,7 +5397,7 @@ struct _snd_pcm_runtime { | |||
5402 | </programlisting> | 5397 | </programlisting> |
5403 | </informalexample> | 5398 | </informalexample> |
5404 | 5399 | ||
5405 | where the second argument specifies the proc-file name to be | 5400 | where the second argument specifies the name of the proc file to be |
5406 | created. The above example will create a file | 5401 | created. The above example will create a file |
5407 | <filename>my-file</filename> under the card directory, | 5402 | <filename>my-file</filename> under the card directory, |
5408 | e.g. <filename>/proc/asound/card0/my-file</filename>. | 5403 | e.g. <filename>/proc/asound/card0/my-file</filename>. |
@@ -5417,8 +5412,8 @@ struct _snd_pcm_runtime { | |||
5417 | 5412 | ||
5418 | <para> | 5413 | <para> |
5419 | When the creation is successful, the function stores a new | 5414 | When the creation is successful, the function stores a new |
5420 | instance at the pointer given in the third argument. | 5415 | instance in the pointer given in the third argument. |
5421 | It is initialized as a text proc file for read only. For using | 5416 | It is initialized as a text proc file for read only. To use |
5422 | this proc file as a read-only text file as it is, set the read | 5417 | this proc file as a read-only text file as it is, set the read |
5423 | callback with a private data via | 5418 | callback with a private data via |
5424 | <function>snd_info_set_text_ops()</function>. | 5419 | <function>snd_info_set_text_ops()</function>. |
@@ -5470,9 +5465,9 @@ struct _snd_pcm_runtime { | |||
5470 | </para> | 5465 | </para> |
5471 | 5466 | ||
5472 | <para> | 5467 | <para> |
5473 | The file permission can be changed afterwards. As default, it's | 5468 | The file permissions can be changed afterwards. As default, it's |
5474 | set as read only for all users. If you want to add the write | 5469 | set as read only for all users. If you want to add write |
5475 | permission to the user (root as default), set like below: | 5470 | permission for the user (root as default), do as follows: |
5476 | 5471 | ||
5477 | <informalexample> | 5472 | <informalexample> |
5478 | <programlisting> | 5473 | <programlisting> |
@@ -5503,7 +5498,7 @@ struct _snd_pcm_runtime { | |||
5503 | </para> | 5498 | </para> |
5504 | 5499 | ||
5505 | <para> | 5500 | <para> |
5506 | For a raw-data proc-file, set the attributes like the following: | 5501 | For a raw-data proc-file, set the attributes as follows: |
5507 | 5502 | ||
5508 | <informalexample> | 5503 | <informalexample> |
5509 | <programlisting> | 5504 | <programlisting> |
@@ -5524,7 +5519,7 @@ struct _snd_pcm_runtime { | |||
5524 | 5519 | ||
5525 | <para> | 5520 | <para> |
5526 | The callback is much more complicated than the text-file | 5521 | The callback is much more complicated than the text-file |
5527 | version. You need to use a low-level i/o functions such as | 5522 | version. You need to use a low-level I/O functions such as |
5528 | <function>copy_from/to_user()</function> to transfer the | 5523 | <function>copy_from/to_user()</function> to transfer the |
5529 | data. | 5524 | data. |
5530 | 5525 | ||
@@ -5560,28 +5555,28 @@ struct _snd_pcm_runtime { | |||
5560 | <title>Power Management</title> | 5555 | <title>Power Management</title> |
5561 | <para> | 5556 | <para> |
5562 | If the chip is supposed to work with suspend/resume | 5557 | If the chip is supposed to work with suspend/resume |
5563 | functions, you need to add the power-management codes to the | 5558 | functions, you need to add power-management code to the |
5564 | driver. The additional codes for the power-management should be | 5559 | driver. The additional code for power-management should be |
5565 | <function>ifdef</function>'ed with | 5560 | <function>ifdef</function>'ed with |
5566 | <constant>CONFIG_PM</constant>. | 5561 | <constant>CONFIG_PM</constant>. |
5567 | </para> | 5562 | </para> |
5568 | 5563 | ||
5569 | <para> | 5564 | <para> |
5570 | If the driver supports the suspend/resume | 5565 | If the driver <emphasis>fully</emphasis> supports suspend/resume |
5571 | <emphasis>fully</emphasis>, that is, the device can be | 5566 | that is, the device can be |
5572 | properly resumed to the status at the suspend is called, | 5567 | properly resumed to its state when suspend was called, |
5573 | you can set <constant>SNDRV_PCM_INFO_RESUME</constant> flag | 5568 | you can set the <constant>SNDRV_PCM_INFO_RESUME</constant> flag |
5574 | to pcm info field. Usually, this is possible when the | 5569 | in the pcm info field. Usually, this is possible when the |
5575 | registers of ths chip can be safely saved and restored to the | 5570 | registers of the chip can be safely saved and restored to |
5576 | RAM. If this is set, the trigger callback is called with | 5571 | RAM. If this is set, the trigger callback is called with |
5577 | <constant>SNDRV_PCM_TRIGGER_RESUME</constant> after resume | 5572 | <constant>SNDRV_PCM_TRIGGER_RESUME</constant> after the resume |
5578 | callback is finished. | 5573 | callback completes. |
5579 | </para> | 5574 | </para> |
5580 | 5575 | ||
5581 | <para> | 5576 | <para> |
5582 | Even if the driver doesn't support PM fully but only the | 5577 | Even if the driver doesn't support PM fully but |
5583 | partial suspend/resume is possible, it's still worthy to | 5578 | partial suspend/resume is still possible, it's still worthy to |
5584 | implement suspend/resume callbacks. In such a case, applications | 5579 | implement suspend/resume callbacks. In such a case, applications |
5585 | would reset the status by calling | 5580 | would reset the status by calling |
5586 | <function>snd_pcm_prepare()</function> and restart the stream | 5581 | <function>snd_pcm_prepare()</function> and restart the stream |
5587 | appropriately. Hence, you can define suspend/resume callbacks | 5582 | appropriately. Hence, you can define suspend/resume callbacks |
@@ -5590,22 +5585,22 @@ struct _snd_pcm_runtime { | |||
5590 | </para> | 5585 | </para> |
5591 | 5586 | ||
5592 | <para> | 5587 | <para> |
5593 | Note that the trigger with SUSPEND can be always called when | 5588 | Note that the trigger with SUSPEND can always be called when |
5594 | <function>snd_pcm_suspend_all</function> is called, | 5589 | <function>snd_pcm_suspend_all</function> is called, |
5595 | regardless of <constant>SNDRV_PCM_INFO_RESUME</constant> flag. | 5590 | regardless of the <constant>SNDRV_PCM_INFO_RESUME</constant> flag. |
5596 | The <constant>RESUME</constant> flag affects only the behavior | 5591 | The <constant>RESUME</constant> flag affects only the behavior |
5597 | of <function>snd_pcm_resume()</function>. | 5592 | of <function>snd_pcm_resume()</function>. |
5598 | (Thus, in theory, | 5593 | (Thus, in theory, |
5599 | <constant>SNDRV_PCM_TRIGGER_RESUME</constant> isn't needed | 5594 | <constant>SNDRV_PCM_TRIGGER_RESUME</constant> isn't needed |
5600 | to be handled in the trigger callback when no | 5595 | to be handled in the trigger callback when no |
5601 | <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set. But, | 5596 | <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set. But, |
5602 | it's better to keep it for compatibility reason.) | 5597 | it's better to keep it for compatibility reasons.) |
5603 | </para> | 5598 | </para> |
5604 | <para> | 5599 | <para> |
5605 | In the earlier version of ALSA drivers, a common | 5600 | In the earlier version of ALSA drivers, a common |
5606 | power-management layer was provided, but it has been removed. | 5601 | power-management layer was provided, but it has been removed. |
5607 | The driver needs to define the suspend/resume hooks according to | 5602 | The driver needs to define the suspend/resume hooks according to |
5608 | the bus the device is assigned. In the case of PCI driver, the | 5603 | the bus the device is connected to. In the case of PCI drivers, the |
5609 | callbacks look like below: | 5604 | callbacks look like below: |
5610 | 5605 | ||
5611 | <informalexample> | 5606 | <informalexample> |
@@ -5629,7 +5624,7 @@ struct _snd_pcm_runtime { | |||
5629 | </para> | 5624 | </para> |
5630 | 5625 | ||
5631 | <para> | 5626 | <para> |
5632 | The scheme of the real suspend job is as following. | 5627 | The scheme of the real suspend job is as follows. |
5633 | 5628 | ||
5634 | <orderedlist> | 5629 | <orderedlist> |
5635 | <listitem><para>Retrieve the card and the chip data.</para></listitem> | 5630 | <listitem><para>Retrieve the card and the chip data.</para></listitem> |
@@ -5679,11 +5674,11 @@ struct _snd_pcm_runtime { | |||
5679 | </para> | 5674 | </para> |
5680 | 5675 | ||
5681 | <para> | 5676 | <para> |
5682 | The scheme of the real resume job is as following. | 5677 | The scheme of the real resume job is as follows. |
5683 | 5678 | ||
5684 | <orderedlist> | 5679 | <orderedlist> |
5685 | <listitem><para>Retrieve the card and the chip data.</para></listitem> | 5680 | <listitem><para>Retrieve the card and the chip data.</para></listitem> |
5686 | <listitem><para>Set up PCI. First, call <function>pci_restore_state()</function>. | 5681 | <listitem><para>Set up PCI. First, call <function>pci_restore_state()</function>. |
5687 | Then enable the pci device again by calling <function>pci_enable_device()</function>. | 5682 | Then enable the pci device again by calling <function>pci_enable_device()</function>. |
5688 | Call <function>pci_set_master()</function> if necessary, too.</para></listitem> | 5683 | Call <function>pci_set_master()</function> if necessary, too.</para></listitem> |
5689 | <listitem><para>Re-initialize the chip.</para></listitem> | 5684 | <listitem><para>Re-initialize the chip.</para></listitem> |
@@ -5734,7 +5729,7 @@ struct _snd_pcm_runtime { | |||
5734 | <function>snd_pcm_suspend_all()</function> or | 5729 | <function>snd_pcm_suspend_all()</function> or |
5735 | <function>snd_pcm_suspend()</function>. It means that the PCM | 5730 | <function>snd_pcm_suspend()</function>. It means that the PCM |
5736 | streams are already stoppped when the register snapshot is | 5731 | streams are already stoppped when the register snapshot is |
5737 | taken. But, remind that you don't have to restart the PCM | 5732 | taken. But, remember that you don't have to restart the PCM |
5738 | stream in the resume callback. It'll be restarted via | 5733 | stream in the resume callback. It'll be restarted via |
5739 | trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant> | 5734 | trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant> |
5740 | when necessary. | 5735 | when necessary. |
@@ -5795,7 +5790,7 @@ struct _snd_pcm_runtime { | |||
5795 | </para> | 5790 | </para> |
5796 | 5791 | ||
5797 | <para> | 5792 | <para> |
5798 | If you need a space for saving the registers, allocate the | 5793 | If you need a space to save the registers, allocate the |
5799 | buffer for it here, too, since it would be fatal | 5794 | buffer for it here, too, since it would be fatal |
5800 | if you cannot allocate a memory in the suspend phase. | 5795 | if you cannot allocate a memory in the suspend phase. |
5801 | The allocated buffer should be released in the corresponding | 5796 | The allocated buffer should be released in the corresponding |
@@ -5833,7 +5828,7 @@ struct _snd_pcm_runtime { | |||
5833 | <title>Module Parameters</title> | 5828 | <title>Module Parameters</title> |
5834 | <para> | 5829 | <para> |
5835 | There are standard module options for ALSA. At least, each | 5830 | There are standard module options for ALSA. At least, each |
5836 | module should have <parameter>index</parameter>, | 5831 | module should have the <parameter>index</parameter>, |
5837 | <parameter>id</parameter> and <parameter>enable</parameter> | 5832 | <parameter>id</parameter> and <parameter>enable</parameter> |
5838 | options. | 5833 | options. |
5839 | </para> | 5834 | </para> |
@@ -5841,8 +5836,8 @@ struct _snd_pcm_runtime { | |||
5841 | <para> | 5836 | <para> |
5842 | If the module supports multiple cards (usually up to | 5837 | If the module supports multiple cards (usually up to |
5843 | 8 = <constant>SNDRV_CARDS</constant> cards), they should be | 5838 | 8 = <constant>SNDRV_CARDS</constant> cards), they should be |
5844 | arrays. The default initial values are defined already as | 5839 | arrays. The default initial values are defined already as |
5845 | constants for ease of programming: | 5840 | constants for easier programming: |
5846 | 5841 | ||
5847 | <informalexample> | 5842 | <informalexample> |
5848 | <programlisting> | 5843 | <programlisting> |
@@ -5858,7 +5853,7 @@ struct _snd_pcm_runtime { | |||
5858 | <para> | 5853 | <para> |
5859 | If the module supports only a single card, they could be single | 5854 | If the module supports only a single card, they could be single |
5860 | variables, instead. <parameter>enable</parameter> option is not | 5855 | variables, instead. <parameter>enable</parameter> option is not |
5861 | always necessary in this case, but it wouldn't be so bad to have a | 5856 | always necessary in this case, but it would be better to have a |
5862 | dummy option for compatibility. | 5857 | dummy option for compatibility. |
5863 | </para> | 5858 | </para> |
5864 | 5859 | ||
@@ -5923,22 +5918,22 @@ struct _snd_pcm_runtime { | |||
5923 | </para> | 5918 | </para> |
5924 | 5919 | ||
5925 | <para> | 5920 | <para> |
5926 | Suppose that you'll create a new PCI driver for the card | 5921 | Suppose that you create a new PCI driver for the card |
5927 | <quote>xyz</quote>. The card module name would be | 5922 | <quote>xyz</quote>. The card module name would be |
5928 | snd-xyz. The new driver is usually put into alsa-driver | 5923 | snd-xyz. The new driver is usually put into the alsa-driver |
5929 | tree, <filename>alsa-driver/pci</filename> directory in | 5924 | tree, <filename>alsa-driver/pci</filename> directory in |
5930 | the case of PCI cards. | 5925 | the case of PCI cards. |
5931 | Then the driver is evaluated, audited and tested | 5926 | Then the driver is evaluated, audited and tested |
5932 | by developers and users. After a certain time, the driver | 5927 | by developers and users. After a certain time, the driver |
5933 | will go to alsa-kernel tree (to the corresponding directory, | 5928 | will go to the alsa-kernel tree (to the corresponding directory, |
5934 | such as <filename>alsa-kernel/pci</filename>) and eventually | 5929 | such as <filename>alsa-kernel/pci</filename>) and eventually |
5935 | integrated into Linux 2.6 tree (the directory would be | 5930 | will be integrated into the Linux 2.6 tree (the directory would be |
5936 | <filename>linux/sound/pci</filename>). | 5931 | <filename>linux/sound/pci</filename>). |
5937 | </para> | 5932 | </para> |
5938 | 5933 | ||
5939 | <para> | 5934 | <para> |
5940 | In the following sections, the driver code is supposed | 5935 | In the following sections, the driver code is supposed |
5941 | to be put into alsa-driver tree. The two cases are assumed: | 5936 | to be put into alsa-driver tree. The two cases are covered: |
5942 | a driver consisting of a single source file and one consisting | 5937 | a driver consisting of a single source file and one consisting |
5943 | of several source files. | 5938 | of several source files. |
5944 | </para> | 5939 | </para> |
@@ -6033,7 +6028,7 @@ struct _snd_pcm_runtime { | |||
6033 | <listitem> | 6028 | <listitem> |
6034 | <para> | 6029 | <para> |
6035 | Add a new directory (<filename>xyz</filename>) in | 6030 | Add a new directory (<filename>xyz</filename>) in |
6036 | <filename>alsa-driver/pci/Makefile</filename> like below | 6031 | <filename>alsa-driver/pci/Makefile</filename> as below |
6037 | 6032 | ||
6038 | <informalexample> | 6033 | <informalexample> |
6039 | <programlisting> | 6034 | <programlisting> |
@@ -6102,7 +6097,7 @@ struct _snd_pcm_runtime { | |||
6102 | <section id="useful-functions-snd-printk"> | 6097 | <section id="useful-functions-snd-printk"> |
6103 | <title><function>snd_printk()</function> and friends</title> | 6098 | <title><function>snd_printk()</function> and friends</title> |
6104 | <para> | 6099 | <para> |
6105 | ALSA provides a verbose version of | 6100 | ALSA provides a verbose version of the |
6106 | <function>printk()</function> function. If a kernel config | 6101 | <function>printk()</function> function. If a kernel config |
6107 | <constant>CONFIG_SND_VERBOSE_PRINTK</constant> is set, this | 6102 | <constant>CONFIG_SND_VERBOSE_PRINTK</constant> is set, this |
6108 | function prints the given message together with the file name | 6103 | function prints the given message together with the file name |
@@ -6170,7 +6165,7 @@ struct _snd_pcm_runtime { | |||
6170 | <section id="useful-functions-snd-bug"> | 6165 | <section id="useful-functions-snd-bug"> |
6171 | <title><function>snd_BUG()</function></title> | 6166 | <title><function>snd_BUG()</function></title> |
6172 | <para> | 6167 | <para> |
6173 | It shows <computeroutput>BUG?</computeroutput> message and | 6168 | It shows the <computeroutput>BUG?</computeroutput> message and |
6174 | stack trace as well as <function>snd_assert</function> at the point. | 6169 | stack trace as well as <function>snd_assert</function> at the point. |
6175 | It's useful to show that a fatal error happens there. | 6170 | It's useful to show that a fatal error happens there. |
6176 | </para> | 6171 | </para> |
@@ -6199,6 +6194,4 @@ struct _snd_pcm_runtime { | |||
6199 | in the hardware constraints section. | 6194 | in the hardware constraints section. |
6200 | </para> | 6195 | </para> |
6201 | </chapter> | 6196 | </chapter> |
6202 | |||
6203 | |||
6204 | </book> | 6197 | </book> |
diff --git a/Documentation/sound/alsa/soc/DAI.txt b/Documentation/sound/alsa/soc/DAI.txt index 3feeb9ecdec4..0ebd7ea9706c 100644 --- a/Documentation/sound/alsa/soc/DAI.txt +++ b/Documentation/sound/alsa/soc/DAI.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | ASoC currently supports the three main Digital Audio Interfaces (DAI) found on | 1 | ASoC currently supports the three main Digital Audio Interfaces (DAI) found on |
2 | SoC controllers and portable audio CODECS today, namely AC97, I2S and PCM. | 2 | SoC controllers and portable audio CODECs today, namely AC97, I2S and PCM. |
3 | 3 | ||
4 | 4 | ||
5 | AC97 | 5 | AC97 |
@@ -25,7 +25,7 @@ left/right clock (LRC) synchronise the link. I2S is flexible in that either the | |||
25 | controller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock | 25 | controller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock |
26 | usually varies depending on the sample rate and the master system clock | 26 | usually varies depending on the sample rate and the master system clock |
27 | (SYSCLK). LRCLK is the same as the sample rate. A few devices support separate | 27 | (SYSCLK). LRCLK is the same as the sample rate. A few devices support separate |
28 | ADC and DAC LRCLK's, this allows for simultaneous capture and playback at | 28 | ADC and DAC LRCLKs, this allows for simultaneous capture and playback at |
29 | different sample rates. | 29 | different sample rates. |
30 | 30 | ||
31 | I2S has several different operating modes:- | 31 | I2S has several different operating modes:- |
@@ -35,7 +35,7 @@ I2S has several different operating modes:- | |||
35 | 35 | ||
36 | o Left Justified - MSB is transmitted on transition of LRC. | 36 | o Left Justified - MSB is transmitted on transition of LRC. |
37 | 37 | ||
38 | o Right Justified - MSB is transmitted sample size BCLK's before LRC | 38 | o Right Justified - MSB is transmitted sample size BCLKs before LRC |
39 | transition. | 39 | transition. |
40 | 40 | ||
41 | PCM | 41 | PCM |
diff --git a/Documentation/sound/alsa/soc/clocking.txt b/Documentation/sound/alsa/soc/clocking.txt index 14930887c25f..b1300162e01c 100644 --- a/Documentation/sound/alsa/soc/clocking.txt +++ b/Documentation/sound/alsa/soc/clocking.txt | |||
@@ -13,7 +13,7 @@ or SYSCLK). This audio master clock can be derived from a number of sources | |||
13 | (e.g. crystal, PLL, CPU clock) and is responsible for producing the correct | 13 | (e.g. crystal, PLL, CPU clock) and is responsible for producing the correct |
14 | audio playback and capture sample rates. | 14 | audio playback and capture sample rates. |
15 | 15 | ||
16 | Some master clocks (e.g. PLL's and CPU based clocks) are configurable in that | 16 | Some master clocks (e.g. PLLs and CPU based clocks) are configurable in that |
17 | their speed can be altered by software (depending on the system use and to save | 17 | their speed can be altered by software (depending on the system use and to save |
18 | power). Other master clocks are fixed at a set frequency (i.e. crystals). | 18 | power). Other master clocks are fixed at a set frequency (i.e. crystals). |
19 | 19 | ||
@@ -41,11 +41,11 @@ BCLK = LRC * x | |||
41 | BCLK = LRC * Channels * Word Size | 41 | BCLK = LRC * Channels * Word Size |
42 | 42 | ||
43 | This relationship depends on the codec or SoC CPU in particular. In general | 43 | This relationship depends on the codec or SoC CPU in particular. In general |
44 | it's best to configure BCLK to the lowest possible speed (depending on your | 44 | it is best to configure BCLK to the lowest possible speed (depending on your |
45 | rate, number of channels and wordsize) to save on power. | 45 | rate, number of channels and word size) to save on power. |
46 | 46 | ||
47 | It's also desirable to use the codec (if possible) to drive (or master) the | 47 | It is also desirable to use the codec (if possible) to drive (or master) the |
48 | audio clocks as it's usually gives more accurate sample rates than the CPU. | 48 | audio clocks as it usually gives more accurate sample rates than the CPU. |
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
diff --git a/Documentation/sound/alsa/soc/codec.txt b/Documentation/sound/alsa/soc/codec.txt index 1e766ad0ebd1..1e95342ed72e 100644 --- a/Documentation/sound/alsa/soc/codec.txt +++ b/Documentation/sound/alsa/soc/codec.txt | |||
@@ -9,7 +9,7 @@ code should be added to the platform and machine drivers respectively. | |||
9 | Each codec driver *must* provide the following features:- | 9 | Each codec driver *must* provide the following features:- |
10 | 10 | ||
11 | 1) Codec DAI and PCM configuration | 11 | 1) Codec DAI and PCM configuration |
12 | 2) Codec control IO - using I2C, 3 Wire(SPI) or both API's | 12 | 2) Codec control IO - using I2C, 3 Wire(SPI) or both APIs |
13 | 3) Mixers and audio controls | 13 | 3) Mixers and audio controls |
14 | 4) Codec audio operations | 14 | 4) Codec audio operations |
15 | 15 | ||
@@ -19,7 +19,7 @@ Optionally, codec drivers can also provide:- | |||
19 | 6) DAPM event handler. | 19 | 6) DAPM event handler. |
20 | 7) DAC Digital mute control. | 20 | 7) DAC Digital mute control. |
21 | 21 | ||
22 | It's probably best to use this guide in conjunction with the existing codec | 22 | Its probably best to use this guide in conjunction with the existing codec |
23 | driver code in sound/soc/codecs/ | 23 | driver code in sound/soc/codecs/ |
24 | 24 | ||
25 | ASoC Codec driver breakdown | 25 | ASoC Codec driver breakdown |
@@ -27,8 +27,8 @@ ASoC Codec driver breakdown | |||
27 | 27 | ||
28 | 1 - Codec DAI and PCM configuration | 28 | 1 - Codec DAI and PCM configuration |
29 | ----------------------------------- | 29 | ----------------------------------- |
30 | Each codec driver must have a struct snd_soc_codec_dai to define it's DAI and | 30 | Each codec driver must have a struct snd_soc_codec_dai to define its DAI and |
31 | PCM's capabilities and operations. This struct is exported so that it can be | 31 | PCM capabilities and operations. This struct is exported so that it can be |
32 | registered with the core by your machine driver. | 32 | registered with the core by your machine driver. |
33 | 33 | ||
34 | e.g. | 34 | e.g. |
@@ -67,18 +67,18 @@ EXPORT_SYMBOL_GPL(wm8731_dai); | |||
67 | 67 | ||
68 | 2 - Codec control IO | 68 | 2 - Codec control IO |
69 | -------------------- | 69 | -------------------- |
70 | The codec can usually be controlled via an I2C or SPI style interface (AC97 | 70 | The codec can usually be controlled via an I2C or SPI style interface |
71 | combines control with data in the DAI). The codec drivers will have to provide | 71 | (AC97 combines control with data in the DAI). The codec drivers provide |
72 | functions to read and write the codec registers along with supplying a register | 72 | functions to read and write the codec registers along with supplying a |
73 | cache:- | 73 | register cache:- |
74 | 74 | ||
75 | /* IO control data and register cache */ | 75 | /* IO control data and register cache */ |
76 | void *control_data; /* codec control (i2c/3wire) data */ | 76 | void *control_data; /* codec control (i2c/3wire) data */ |
77 | void *reg_cache; | 77 | void *reg_cache; |
78 | 78 | ||
79 | Codec read/write should do any data formatting and call the hardware read write | 79 | Codec read/write should do any data formatting and call the hardware |
80 | below to perform the IO. These functions are called by the core and alsa when | 80 | read write below to perform the IO. These functions are called by the |
81 | performing DAPM or changing the mixer:- | 81 | core and ALSA when performing DAPM or changing the mixer:- |
82 | 82 | ||
83 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); | 83 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); |
84 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); | 84 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); |
@@ -131,7 +131,7 @@ Defines a stereo enumerated control | |||
131 | 131 | ||
132 | 4 - Codec Audio Operations | 132 | 4 - Codec Audio Operations |
133 | -------------------------- | 133 | -------------------------- |
134 | The codec driver also supports the following alsa operations:- | 134 | The codec driver also supports the following ALSA operations:- |
135 | 135 | ||
136 | /* SoC audio ops */ | 136 | /* SoC audio ops */ |
137 | struct snd_soc_ops { | 137 | struct snd_soc_ops { |
@@ -142,15 +142,15 @@ struct snd_soc_ops { | |||
142 | int (*prepare)(struct snd_pcm_substream *); | 142 | int (*prepare)(struct snd_pcm_substream *); |
143 | }; | 143 | }; |
144 | 144 | ||
145 | Please refer to the alsa driver PCM documentation for details. | 145 | Please refer to the ALSA driver PCM documentation for details. |
146 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm | 146 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm |
147 | 147 | ||
148 | 148 | ||
149 | 5 - DAPM description. | 149 | 5 - DAPM description. |
150 | --------------------- | 150 | --------------------- |
151 | The Dynamic Audio Power Management description describes the codec's power | 151 | The Dynamic Audio Power Management description describes the codec power |
152 | components, their relationships and registers to the ASoC core. Please read | 152 | components and their relationships and registers to the ASoC core. |
153 | dapm.txt for details of building the description. | 153 | Please read dapm.txt for details of building the description. |
154 | 154 | ||
155 | Please also see the examples in other codec drivers. | 155 | Please also see the examples in other codec drivers. |
156 | 156 | ||
@@ -158,8 +158,8 @@ Please also see the examples in other codec drivers. | |||
158 | 6 - DAPM event handler | 158 | 6 - DAPM event handler |
159 | ---------------------- | 159 | ---------------------- |
160 | This function is a callback that handles codec domain PM calls and system | 160 | This function is a callback that handles codec domain PM calls and system |
161 | domain PM calls (e.g. suspend and resume). It's used to put the codec to sleep | 161 | domain PM calls (e.g. suspend and resume). It is used to put the codec |
162 | when not in use. | 162 | to sleep when not in use. |
163 | 163 | ||
164 | Power states:- | 164 | Power states:- |
165 | 165 | ||
@@ -175,13 +175,14 @@ Power states:- | |||
175 | SNDRV_CTL_POWER_D3cold: /* Everything Off, without power */ | 175 | SNDRV_CTL_POWER_D3cold: /* Everything Off, without power */ |
176 | 176 | ||
177 | 177 | ||
178 | 7 - Codec DAC digital mute control. | 178 | 7 - Codec DAC digital mute control |
179 | ------------------------------------ | 179 | ---------------------------------- |
180 | Most codecs have a digital mute before the DAC's that can be used to minimise | 180 | Most codecs have a digital mute before the DACs that can be used to |
181 | any system noise. The mute stops any digital data from entering the DAC. | 181 | minimise any system noise. The mute stops any digital data from |
182 | entering the DAC. | ||
182 | 183 | ||
183 | A callback can be created that is called by the core for each codec DAI when the | 184 | A callback can be created that is called by the core for each codec DAI |
184 | mute is applied or freed. | 185 | when the mute is applied or freed. |
185 | 186 | ||
186 | i.e. | 187 | i.e. |
187 | 188 | ||
diff --git a/Documentation/sound/alsa/soc/dapm.txt b/Documentation/sound/alsa/soc/dapm.txt index ab0766fd7869..c784a18b94dc 100644 --- a/Documentation/sound/alsa/soc/dapm.txt +++ b/Documentation/sound/alsa/soc/dapm.txt | |||
@@ -4,20 +4,20 @@ Dynamic Audio Power Management for Portable Devices | |||
4 | 1. Description | 4 | 1. Description |
5 | ============== | 5 | ============== |
6 | 6 | ||
7 | Dynamic Audio Power Management (DAPM) is designed to allow portable Linux devices | 7 | Dynamic Audio Power Management (DAPM) is designed to allow portable |
8 | to use the minimum amount of power within the audio subsystem at all times. It | 8 | Linux devices to use the minimum amount of power within the audio |
9 | is independent of other kernel PM and as such, can easily co-exist with the | 9 | subsystem at all times. It is independent of other kernel PM and as |
10 | other PM systems. | 10 | such, can easily co-exist with the other PM systems. |
11 | 11 | ||
12 | DAPM is also completely transparent to all user space applications as all power | 12 | DAPM is also completely transparent to all user space applications as |
13 | switching is done within the ASoC core. No code changes or recompiling are | 13 | all power switching is done within the ASoC core. No code changes or |
14 | required for user space applications. DAPM makes power switching decisions based | 14 | recompiling are required for user space applications. DAPM makes power |
15 | upon any audio stream (capture/playback) activity and audio mixer settings | 15 | switching decisions based upon any audio stream (capture/playback) |
16 | within the device. | 16 | activity and audio mixer settings within the device. |
17 | 17 | ||
18 | DAPM spans the whole machine. It covers power control within the entire audio | 18 | DAPM spans the whole machine. It covers power control within the entire |
19 | subsystem, this includes internal codec power blocks and machine level power | 19 | audio subsystem, this includes internal codec power blocks and machine |
20 | systems. | 20 | level power systems. |
21 | 21 | ||
22 | There are 4 power domains within DAPM | 22 | There are 4 power domains within DAPM |
23 | 23 | ||
@@ -34,7 +34,7 @@ There are 4 power domains within DAPM | |||
34 | Automatically set when mixer and mux settings are changed by the user. | 34 | Automatically set when mixer and mux settings are changed by the user. |
35 | e.g. alsamixer, amixer. | 35 | e.g. alsamixer, amixer. |
36 | 36 | ||
37 | 4. Stream domain - DAC's and ADC's. | 37 | 4. Stream domain - DACs and ADCs. |
38 | Enabled and disabled when stream playback/capture is started and | 38 | Enabled and disabled when stream playback/capture is started and |
39 | stopped respectively. e.g. aplay, arecord. | 39 | stopped respectively. e.g. aplay, arecord. |
40 | 40 | ||
@@ -51,7 +51,7 @@ widgets hereafter. | |||
51 | Audio DAPM widgets fall into a number of types:- | 51 | Audio DAPM widgets fall into a number of types:- |
52 | 52 | ||
53 | o Mixer - Mixes several analog signals into a single analog signal. | 53 | o Mixer - Mixes several analog signals into a single analog signal. |
54 | o Mux - An analog switch that outputs only 1 of it's inputs. | 54 | o Mux - An analog switch that outputs only one of many inputs. |
55 | o PGA - A programmable gain amplifier or attenuation widget. | 55 | o PGA - A programmable gain amplifier or attenuation widget. |
56 | o ADC - Analog to Digital Converter | 56 | o ADC - Analog to Digital Converter |
57 | o DAC - Digital to Analog Converter | 57 | o DAC - Digital to Analog Converter |
@@ -78,14 +78,14 @@ parameters for stream name and kcontrols. | |||
78 | 2.1 Stream Domain Widgets | 78 | 2.1 Stream Domain Widgets |
79 | ------------------------- | 79 | ------------------------- |
80 | 80 | ||
81 | Stream Widgets relate to the stream power domain and only consist of ADC's | 81 | Stream Widgets relate to the stream power domain and only consist of ADCs |
82 | (analog to digital converters) and DAC's (digital to analog converters). | 82 | (analog to digital converters) and DACs (digital to analog converters). |
83 | 83 | ||
84 | Stream widgets have the following format:- | 84 | Stream widgets have the following format:- |
85 | 85 | ||
86 | SND_SOC_DAPM_DAC(name, stream name, reg, shift, invert), | 86 | SND_SOC_DAPM_DAC(name, stream name, reg, shift, invert), |
87 | 87 | ||
88 | NOTE: the stream name must match the corresponding stream name in your codecs | 88 | NOTE: the stream name must match the corresponding stream name in your codec |
89 | snd_soc_codec_dai. | 89 | snd_soc_codec_dai. |
90 | 90 | ||
91 | e.g. stream widgets for HiFi playback and capture | 91 | e.g. stream widgets for HiFi playback and capture |
@@ -97,7 +97,7 @@ SND_SOC_DAPM_ADC("HiFi ADC", "HiFi Capture", REG, 2, 1), | |||
97 | 2.2 Path Domain Widgets | 97 | 2.2 Path Domain Widgets |
98 | ----------------------- | 98 | ----------------------- |
99 | 99 | ||
100 | Path domain widgets have a ability to control or effect the audio signal or | 100 | Path domain widgets have a ability to control or affect the audio signal or |
101 | audio paths within the audio subsystem. They have the following form:- | 101 | audio paths within the audio subsystem. They have the following form:- |
102 | 102 | ||
103 | SND_SOC_DAPM_PGA(name, reg, shift, invert, controls, num_controls) | 103 | SND_SOC_DAPM_PGA(name, reg, shift, invert, controls, num_controls) |
@@ -149,7 +149,7 @@ SND_SOC_DAPM_MIC("Mic Jack", spitz_mic_bias), | |||
149 | 2.4 Codec Domain | 149 | 2.4 Codec Domain |
150 | ---------------- | 150 | ---------------- |
151 | 151 | ||
152 | The Codec power domain has no widgets and is handled by the codecs DAPM event | 152 | The codec power domain has no widgets and is handled by the codecs DAPM event |
153 | handler. This handler is called when the codec powerstate is changed wrt to any | 153 | handler. This handler is called when the codec powerstate is changed wrt to any |
154 | stream event or by kernel PM events. | 154 | stream event or by kernel PM events. |
155 | 155 | ||
@@ -158,8 +158,8 @@ stream event or by kernel PM events. | |||
158 | ------------------- | 158 | ------------------- |
159 | 159 | ||
160 | Sometimes widgets exist in the codec or machine audio map that don't have any | 160 | Sometimes widgets exist in the codec or machine audio map that don't have any |
161 | corresponding register bit for power control. In this case it's necessary to | 161 | corresponding soft power control. In this case it is necessary to create |
162 | create a virtual widget - a widget with no control bits e.g. | 162 | a virtual widget - a widget with no control bits e.g. |
163 | 163 | ||
164 | SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0), | 164 | SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0), |
165 | 165 | ||
@@ -172,13 +172,14 @@ subsystem individually with a call to snd_soc_dapm_new_control(). | |||
172 | 3. Codec Widget Interconnections | 172 | 3. Codec Widget Interconnections |
173 | ================================ | 173 | ================================ |
174 | 174 | ||
175 | Widgets are connected to each other within the codec and machine by audio | 175 | Widgets are connected to each other within the codec and machine by audio paths |
176 | paths (called interconnections). Each interconnection must be defined in order | 176 | (called interconnections). Each interconnection must be defined in order to |
177 | to create a map of all audio paths between widgets. | 177 | create a map of all audio paths between widgets. |
178 | |||
178 | This is easiest with a diagram of the codec (and schematic of the machine audio | 179 | This is easiest with a diagram of the codec (and schematic of the machine audio |
179 | system), as it requires joining widgets together via their audio signal paths. | 180 | system), as it requires joining widgets together via their audio signal paths. |
180 | 181 | ||
181 | i.e. from the WM8731 codec's output mixer (wm8731.c) | 182 | e.g., from the WM8731 output mixer (wm8731.c) |
182 | 183 | ||
183 | The WM8731 output mixer has 3 inputs (sources) | 184 | The WM8731 output mixer has 3 inputs (sources) |
184 | 185 | ||
diff --git a/Documentation/sound/alsa/soc/machine.txt b/Documentation/sound/alsa/soc/machine.txt index 72bd222f2a21..f370e7db86af 100644 --- a/Documentation/sound/alsa/soc/machine.txt +++ b/Documentation/sound/alsa/soc/machine.txt | |||
@@ -16,7 +16,7 @@ struct snd_soc_machine { | |||
16 | int (*remove)(struct platform_device *pdev); | 16 | int (*remove)(struct platform_device *pdev); |
17 | 17 | ||
18 | /* the pre and post PM functions are used to do any PM work before and | 18 | /* the pre and post PM functions are used to do any PM work before and |
19 | * after the codec and DAI's do any PM work. */ | 19 | * after the codec and DAIs do any PM work. */ |
20 | int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); | 20 | int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); |
21 | int (*suspend_post)(struct platform_device *pdev, pm_message_t state); | 21 | int (*suspend_post)(struct platform_device *pdev, pm_message_t state); |
22 | int (*resume_pre)(struct platform_device *pdev); | 22 | int (*resume_pre)(struct platform_device *pdev); |
@@ -38,7 +38,7 @@ probe/remove are optional. Do any machine specific probe here. | |||
38 | suspend()/resume() | 38 | suspend()/resume() |
39 | ------------------ | 39 | ------------------ |
40 | The machine driver has pre and post versions of suspend and resume to take care | 40 | The machine driver has pre and post versions of suspend and resume to take care |
41 | of any machine audio tasks that have to be done before or after the codec, DAI's | 41 | of any machine audio tasks that have to be done before or after the codec, DAIs |
42 | and DMA is suspended and resumed. Optional. | 42 | and DMA is suspended and resumed. Optional. |
43 | 43 | ||
44 | 44 | ||
@@ -49,10 +49,10 @@ The machine specific audio operations can be set here. Again this is optional. | |||
49 | 49 | ||
50 | Machine DAI Configuration | 50 | Machine DAI Configuration |
51 | ------------------------- | 51 | ------------------------- |
52 | The machine DAI configuration glues all the codec and CPU DAI's together. It can | 52 | The machine DAI configuration glues all the codec and CPU DAIs together. It can |
53 | also be used to set up the DAI system clock and for any machine related DAI | 53 | also be used to set up the DAI system clock and for any machine related DAI |
54 | initialisation e.g. the machine audio map can be connected to the codec audio | 54 | initialisation e.g. the machine audio map can be connected to the codec audio |
55 | map, unconnnected codec pins can be set as such. Please see corgi.c, spitz.c | 55 | map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c |
56 | for examples. | 56 | for examples. |
57 | 57 | ||
58 | struct snd_soc_dai_link is used to set up each DAI in your machine. e.g. | 58 | struct snd_soc_dai_link is used to set up each DAI in your machine. e.g. |
@@ -67,7 +67,7 @@ static struct snd_soc_dai_link corgi_dai = { | |||
67 | .ops = &corgi_ops, | 67 | .ops = &corgi_ops, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct snd_soc_machine then sets up the machine with it's DAI's. e.g. | 70 | struct snd_soc_machine then sets up the machine with it's DAIs. e.g. |
71 | 71 | ||
72 | /* corgi audio machine driver */ | 72 | /* corgi audio machine driver */ |
73 | static struct snd_soc_machine snd_soc_machine_corgi = { | 73 | static struct snd_soc_machine snd_soc_machine_corgi = { |
@@ -110,4 +110,4 @@ details. | |||
110 | Machine Controls | 110 | Machine Controls |
111 | ---------------- | 111 | ---------------- |
112 | 112 | ||
113 | Machine specific audio mixer controls can be added in the dai init function. \ No newline at end of file | 113 | Machine specific audio mixer controls can be added in the DAI init function. |
diff --git a/Documentation/sound/alsa/soc/overview.txt b/Documentation/sound/alsa/soc/overview.txt index c47ce9530677..1e4c6d3655f2 100644 --- a/Documentation/sound/alsa/soc/overview.txt +++ b/Documentation/sound/alsa/soc/overview.txt | |||
@@ -1,25 +1,26 @@ | |||
1 | ALSA SoC Layer | 1 | ALSA SoC Layer |
2 | ============== | 2 | ============== |
3 | 3 | ||
4 | The overall project goal of the ALSA System on Chip (ASoC) layer is to provide | 4 | The overall project goal of the ALSA System on Chip (ASoC) layer is to |
5 | better ALSA support for embedded system-on-chip processors (e.g. pxa2xx, au1x00, | 5 | provide better ALSA support for embedded system-on-chip processors (e.g. |
6 | iMX, etc) and portable audio codecs. Currently there is some support in the | 6 | pxa2xx, au1x00, iMX, etc) and portable audio codecs. Prior to the ASoC |
7 | kernel for SoC audio, however it has some limitations:- | 7 | subsystem there was some support in the kernel for SoC audio, however it |
8 | had some limitations:- | ||
8 | 9 | ||
9 | * Currently, codec drivers are often tightly coupled to the underlying SoC | 10 | * Codec drivers were often tightly coupled to the underlying SoC |
10 | CPU. This is not ideal and leads to code duplication i.e. Linux now has 4 | 11 | CPU. This is not ideal and leads to code duplication - for example, |
11 | different wm8731 drivers for 4 different SoC platforms. | 12 | Linux had different wm8731 drivers for 4 different SoC platforms. |
12 | 13 | ||
13 | * There is no standard method to signal user initiated audio events (e.g. | 14 | * There was no standard method to signal user initiated audio events (e.g. |
14 | Headphone/Mic insertion, Headphone/Mic detection after an insertion | 15 | Headphone/Mic insertion, Headphone/Mic detection after an insertion |
15 | event). These are quite common events on portable devices and often require | 16 | event). These are quite common events on portable devices and often require |
16 | machine specific code to re-route audio, enable amps, etc., after such an | 17 | machine specific code to re-route audio, enable amps, etc., after such an |
17 | event. | 18 | event. |
18 | 19 | ||
19 | * Current drivers tend to power up the entire codec when playing | 20 | * Drivers tended to power up the entire codec when playing (or |
20 | (or recording) audio. This is fine for a PC, but tends to waste a lot of | 21 | recording) audio. This is fine for a PC, but tends to waste a lot of |
21 | power on portable devices. There is also no support for saving power via | 22 | power on portable devices. There was also no support for saving |
22 | changing codec oversampling rates, bias currents, etc. | 23 | power via changing codec oversampling rates, bias currents, etc. |
23 | 24 | ||
24 | 25 | ||
25 | ASoC Design | 26 | ASoC Design |
@@ -31,12 +32,13 @@ features :- | |||
31 | * Codec independence. Allows reuse of codec drivers on other platforms | 32 | * Codec independence. Allows reuse of codec drivers on other platforms |
32 | and machines. | 33 | and machines. |
33 | 34 | ||
34 | * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC interface | 35 | * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC |
35 | and codec registers it's audio interface capabilities with the core and are | 36 | interface and codec registers it's audio interface capabilities with the |
36 | subsequently matched and configured when the application hw params are known. | 37 | core and are subsequently matched and configured when the application |
38 | hardware parameters are known. | ||
37 | 39 | ||
38 | * Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to | 40 | * Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to |
39 | it's minimum power state at all times. This includes powering up/down | 41 | its minimum power state at all times. This includes powering up/down |
40 | internal power blocks depending on the internal codec audio routing and any | 42 | internal power blocks depending on the internal codec audio routing and any |
41 | active streams. | 43 | active streams. |
42 | 44 | ||
@@ -45,16 +47,16 @@ features :- | |||
45 | signals the codec when to change power states. | 47 | signals the codec when to change power states. |
46 | 48 | ||
47 | * Machine specific controls: Allow machines to add controls to the sound card | 49 | * Machine specific controls: Allow machines to add controls to the sound card |
48 | (e.g. volume control for speaker amp). | 50 | (e.g. volume control for speaker amplifier). |
49 | 51 | ||
50 | To achieve all this, ASoC basically splits an embedded audio system into 3 | 52 | To achieve all this, ASoC basically splits an embedded audio system into 3 |
51 | components :- | 53 | components :- |
52 | 54 | ||
53 | * Codec driver: The codec driver is platform independent and contains audio | 55 | * Codec driver: The codec driver is platform independent and contains audio |
54 | controls, audio interface capabilities, codec dapm definition and codec IO | 56 | controls, audio interface capabilities, codec DAPM definition and codec IO |
55 | functions. | 57 | functions. |
56 | 58 | ||
57 | * Platform driver: The platform driver contains the audio dma engine and audio | 59 | * Platform driver: The platform driver contains the audio DMA engine and audio |
58 | interface drivers (e.g. I2S, AC97, PCM) for that platform. | 60 | interface drivers (e.g. I2S, AC97, PCM) for that platform. |
59 | 61 | ||
60 | * Machine driver: The machine driver handles any machine specific controls and | 62 | * Machine driver: The machine driver handles any machine specific controls and |
@@ -81,4 +83,4 @@ machine.txt: Machine driver internals. | |||
81 | 83 | ||
82 | pop_clicks.txt: How to minimise audio artifacts. | 84 | pop_clicks.txt: How to minimise audio artifacts. |
83 | 85 | ||
84 | clocking.txt: ASoC clocking for best power performance. \ No newline at end of file | 86 | clocking.txt: ASoC clocking for best power performance. |
diff --git a/Documentation/sound/alsa/soc/platform.txt b/Documentation/sound/alsa/soc/platform.txt index d4678b4dc6c6..b681d17fc388 100644 --- a/Documentation/sound/alsa/soc/platform.txt +++ b/Documentation/sound/alsa/soc/platform.txt | |||
@@ -8,7 +8,7 @@ specific code. | |||
8 | Audio DMA | 8 | Audio DMA |
9 | ========= | 9 | ========= |
10 | 10 | ||
11 | The platform DMA driver optionally supports the following alsa operations:- | 11 | The platform DMA driver optionally supports the following ALSA operations:- |
12 | 12 | ||
13 | /* SoC audio ops */ | 13 | /* SoC audio ops */ |
14 | struct snd_soc_ops { | 14 | struct snd_soc_ops { |
@@ -38,7 +38,7 @@ struct snd_soc_platform { | |||
38 | struct snd_pcm_ops *pcm_ops; | 38 | struct snd_pcm_ops *pcm_ops; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | Please refer to the alsa driver documentation for details of audio DMA. | 41 | Please refer to the ALSA driver documentation for details of audio DMA. |
42 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm | 42 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm |
43 | 43 | ||
44 | An example DMA driver is soc/pxa/pxa2xx-pcm.c | 44 | An example DMA driver is soc/pxa/pxa2xx-pcm.c |
@@ -52,7 +52,7 @@ Each SoC DAI driver must provide the following features:- | |||
52 | 1) Digital audio interface (DAI) description | 52 | 1) Digital audio interface (DAI) description |
53 | 2) Digital audio interface configuration | 53 | 2) Digital audio interface configuration |
54 | 3) PCM's description | 54 | 3) PCM's description |
55 | 4) Sysclk configuration | 55 | 4) SYSCLK configuration |
56 | 5) Suspend and resume (optional) | 56 | 5) Suspend and resume (optional) |
57 | 57 | ||
58 | Please see codec.txt for a description of items 1 - 4. | 58 | Please see codec.txt for a description of items 1 - 4. |
diff --git a/Documentation/sound/alsa/soc/pops_clicks.txt b/Documentation/sound/alsa/soc/pops_clicks.txt index 3371bd9d7cfa..e1e74daa4497 100644 --- a/Documentation/sound/alsa/soc/pops_clicks.txt +++ b/Documentation/sound/alsa/soc/pops_clicks.txt | |||
@@ -15,11 +15,11 @@ click every time a component power state is changed. | |||
15 | Minimising Playback Pops and Clicks | 15 | Minimising Playback Pops and Clicks |
16 | =================================== | 16 | =================================== |
17 | 17 | ||
18 | Playback pops in portable audio subsystems cannot be completely eliminated atm, | 18 | Playback pops in portable audio subsystems cannot be completely eliminated |
19 | however future audio codec hardware will have better pop and click suppression. | 19 | currently, however future audio codec hardware will have better pop and click |
20 | Pops can be reduced within playback by powering the audio components in a | 20 | suppression. Pops can be reduced within playback by powering the audio |
21 | specific order. This order is different for startup and shutdown and follows | 21 | components in a specific order. This order is different for startup and |
22 | some basic rules:- | 22 | shutdown and follows some basic rules:- |
23 | 23 | ||
24 | Startup Order :- DAC --> Mixers --> Output PGA --> Digital Unmute | 24 | Startup Order :- DAC --> Mixers --> Output PGA --> Digital Unmute |
25 | 25 | ||
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 | ||
95 | nr_open: | ||
96 | |||
97 | This denotes the maximum number of file-handles a process can | ||
98 | allocate. Default value is 1024*1024 (1048576) which should be | ||
99 | enough for most machines. Actual limit depends on RLIMIT_NOFILE | ||
100 | resource limit. | ||
101 | |||
102 | ============================================================== | ||
103 | |||
94 | inode-max, inode-nr & inode-state: | 104 | inode-max, inode-nr & inode-state: |
95 | 105 | ||
96 | As with file handles, the kernel allocates the inode structures | 106 | As with file handles, the kernel allocates the inode structures |
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index b89570c30434..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 |
@@ -34,13 +35,15 @@ Currently, these files are in /proc/sys/vm: | |||
34 | - oom_kill_allocating_task | 35 | - oom_kill_allocating_task |
35 | - mmap_min_address | 36 | - mmap_min_address |
36 | - numa_zonelist_order | 37 | - numa_zonelist_order |
38 | - nr_hugepages | ||
39 | - nr_overcommit_hugepages | ||
37 | 40 | ||
38 | ============================================================== | 41 | ============================================================== |
39 | 42 | ||
40 | dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, | 43 | dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, |
41 | dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode, | 44 | dirty_writeback_centisecs, highmem_is_dirtyable, |
42 | block_dump, swap_token_timeout, drop-caches, | 45 | vfs_cache_pressure, laptop_mode, block_dump, swap_token_timeout, |
43 | hugepages_treat_as_movable: | 46 | drop-caches, hugepages_treat_as_movable: |
44 | 47 | ||
45 | See Documentation/filesystems/proc.txt | 48 | See Documentation/filesystems/proc.txt |
46 | 49 | ||
@@ -305,3 +308,20 @@ will select "node" order in following case. | |||
305 | 308 | ||
306 | Otherwise, "zone" order will be selected. Default order is recommended unless | 309 | Otherwise, "zone" order will be selected. Default order is recommended unless |
307 | this is causing problems for your system/application. | 310 | this is causing problems for your system/application. |
311 | |||
312 | ============================================================== | ||
313 | |||
314 | nr_hugepages | ||
315 | |||
316 | Change the minimum size of the hugepage pool. | ||
317 | |||
318 | See Documentation/vm/hugetlbpage.txt | ||
319 | |||
320 | ============================================================== | ||
321 | |||
322 | nr_overcommit_hugepages | ||
323 | |||
324 | Change the maximum size of the hugepage pool. The maximum is | ||
325 | nr_hugepages + nr_overcommit_hugepages. | ||
326 | |||
327 | See Documentation/vm/hugetlbpage.txt | ||
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index ec499265deca..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.16 | 3 | Version 0.19 |
4 | August 2nd, 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 | ||
218 | The procfs interface does not support NVRAM polling control. So as to | ||
219 | maintain maximum bug-to-bug compatibility, it does not report any masks, | ||
220 | nor does it allow one to manipulate the hot key mask when the firmware | ||
221 | does not support masks at all, even if NVRAM polling is in use. | ||
222 | |||
218 | sysfs notes: | 223 | sysfs 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 | |||
280 | input layer notes: | 349 | input layer notes: |
281 | 350 | ||
282 | A Hot key is mapped to a single input layer EV_KEY event, possibly | 351 | A Hot key is mapped to a single input layer EV_KEY event, possibly |
@@ -427,6 +496,23 @@ Non hot-key ACPI HKEY event map: | |||
427 | The above events are not propagated by the driver, except for legacy | 496 | The above events are not propagated by the driver, except for legacy |
428 | compatibility purposes when hotkey_report_mode is set to 1. | 497 | compatibility purposes when hotkey_report_mode is set to 1. |
429 | 498 | ||
499 | 0x2304 System is waking up from suspend to undock | ||
500 | 0x2305 System is waking up from suspend to eject bay | ||
501 | 0x2404 System is waking up from hibernation to undock | ||
502 | 0x2405 System is waking up from hibernation to eject bay | ||
503 | |||
504 | The above events are never propagated by the driver. | ||
505 | |||
506 | 0x3003 Bay ejection (see 0x2x05) complete, can sleep again | ||
507 | 0x4003 Undocked (see 0x2x04), can sleep again | ||
508 | 0x5009 Tablet swivel: switched to tablet mode | ||
509 | 0x500A Tablet swivel: switched to normal mode | ||
510 | 0x500B Tablet pen insterted into its storage bay | ||
511 | 0x500C Tablet pen removed from its storage bay | ||
512 | 0x5010 Brightness level changed (newer Lenovo BIOSes) | ||
513 | |||
514 | The above events are propagated by the driver. | ||
515 | |||
430 | Compatibility notes: | 516 | Compatibility notes: |
431 | 517 | ||
432 | ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never | 518 | ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never |
@@ -923,19 +1009,34 @@ sysfs backlight device "thinkpad_screen" | |||
923 | This feature allows software control of the LCD brightness on ThinkPad | 1009 | This feature allows software control of the LCD brightness on ThinkPad |
924 | models which don't have a hardware brightness slider. | 1010 | models which don't have a hardware brightness slider. |
925 | 1011 | ||
926 | It has some limitations: the LCD backlight cannot be actually turned on or off | 1012 | It has some limitations: the LCD backlight cannot be actually turned on or |
927 | by this interface, and in many ThinkPad models, the "dim while on battery" | 1013 | off by this interface, and in many ThinkPad models, the "dim while on |
928 | functionality will be enabled by the BIOS when this interface is used, and | 1014 | battery" functionality will be enabled by the BIOS when this interface is |
929 | cannot be controlled. | 1015 | used, and cannot be controlled. |
930 | 1016 | ||
931 | The backlight control has eight levels, ranging from 0 to 7. Some of the | 1017 | On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control |
932 | levels may not be distinct. | 1018 | has eight brightness levels, ranging from 0 to 7. Some of the levels |
933 | 1019 | may not be distinct. Later Lenovo models that implement the ACPI | |
934 | There are two interfaces to the firmware for brightness control, EC and CMOS. | 1020 | display backlight brightness control methods have 16 levels, ranging |
935 | To select which one should be used, use the brightness_mode module parameter: | 1021 | from 0 to 15. |
936 | brightness_mode=1 selects EC mode, brightness_mode=2 selects CMOS mode, | 1022 | |
937 | brightness_mode=3 selects both EC and CMOS. The driver tries to autodetect | 1023 | There are two interfaces to the firmware for direct brightness control, |
938 | which interface to use. | 1024 | EC and CMOS. To select which one should be used, use the |
1025 | brightness_mode module parameter: brightness_mode=1 selects EC mode, | ||
1026 | brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC | ||
1027 | and CMOS. The driver tries to autodetect which interface to use. | ||
1028 | |||
1029 | When display backlight brightness controls are available through the | ||
1030 | standard ACPI interface, it is best to use it instead of this direct | ||
1031 | ThinkPad-specific interface. The driver will disable its native | ||
1032 | backlight brightness control interface if it detects that the standard | ||
1033 | ACPI interface is available in the ThinkPad. | ||
1034 | |||
1035 | The brightness_enable module parameter can be used to control whether | ||
1036 | the LCD brightness control feature will be enabled when available. | ||
1037 | brightness_enable=0 forces it to be disabled. brightness_enable=1 | ||
1038 | forces it to be enabled when available, even if the standard ACPI | ||
1039 | interface is also available. | ||
939 | 1040 | ||
940 | Procfs notes: | 1041 | Procfs notes: |
941 | 1042 | ||
@@ -947,11 +1048,11 @@ Procfs notes: | |||
947 | 1048 | ||
948 | Sysfs notes: | 1049 | Sysfs notes: |
949 | 1050 | ||
950 | The interface is implemented through the backlight sysfs class, which is poorly | 1051 | The interface is implemented through the backlight sysfs class, which is |
951 | documented at this time. | 1052 | poorly documented at this time. |
952 | 1053 | ||
953 | Locate the thinkpad_screen device under /sys/class/backlight, and inside it | 1054 | Locate the thinkpad_screen device under /sys/class/backlight, and inside |
954 | there will be the following attributes: | 1055 | it there will be the following attributes: |
955 | 1056 | ||
956 | max_brightness: | 1057 | max_brightness: |
957 | Reads the maximum brightness the hardware can be set to. | 1058 | Reads the maximum brightness the hardware can be set to. |
@@ -961,17 +1062,19 @@ there will be the following attributes: | |||
961 | Reads what brightness the screen is set to at this instant. | 1062 | Reads what brightness the screen is set to at this instant. |
962 | 1063 | ||
963 | brightness: | 1064 | brightness: |
964 | Writes request the driver to change brightness to the given | 1065 | Writes request the driver to change brightness to the |
965 | value. Reads will tell you what brightness the driver is trying | 1066 | given value. Reads will tell you what brightness the |
966 | to set the display to when "power" is set to zero and the display | 1067 | driver is trying to set the display to when "power" is set |
967 | has not been dimmed by a kernel power management event. | 1068 | to zero and the display has not been dimmed by a kernel |
1069 | power management event. | ||
968 | 1070 | ||
969 | power: | 1071 | power: |
970 | power management mode, where 0 is "display on", and 1 to 3 will | 1072 | power management mode, where 0 is "display on", and 1 to 3 |
971 | dim the display backlight to brightness level 0 because | 1073 | will dim the display backlight to brightness level 0 |
972 | thinkpad-acpi cannot really turn the backlight off. Kernel | 1074 | because thinkpad-acpi cannot really turn the backlight |
973 | power management events can temporarily increase the current | 1075 | off. Kernel power management events can temporarily |
974 | power management level, i.e. they can dim the display. | 1076 | increase the current power management level, i.e. they can |
1077 | dim the display. | ||
975 | 1078 | ||
976 | 1079 | ||
977 | Volume control -- /proc/acpi/ibm/volume | 1080 | Volume control -- /proc/acpi/ibm/volume |
@@ -1246,3 +1349,17 @@ Sysfs interface changelog: | |||
1246 | and the hwmon class for libsensors4 (lm-sensors 3) | 1349 | and the hwmon class for libsensors4 (lm-sensors 3) |
1247 | compatibility. Moved all hwmon attributes to this | 1350 | compatibility. Moved all hwmon attributes to this |
1248 | new platform device. | 1351 | new platform device. |
1352 | |||
1353 | 0x020100: 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). | ||
1358 | 0x020101: 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 | |||
1364 | 0x020200: Add poll()/select() support to the following attributes: | ||
1365 | hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason | ||
diff --git a/Documentation/tipar.txt b/Documentation/tipar.txt deleted file mode 100644 index 67133baef6ef..000000000000 --- a/Documentation/tipar.txt +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | |||
2 | Parallel link cable for Texas Instruments handhelds | ||
3 | =================================================== | ||
4 | |||
5 | |||
6 | Author: Romain Lievin | ||
7 | Homepage: http://lpg.ticalc.org/prj_tidev/index.html | ||
8 | |||
9 | |||
10 | INTRODUCTION: | ||
11 | |||
12 | This is a driver for the very common home-made parallel link cable, a cable | ||
13 | designed for connecting TI8x/9x graphing calculators (handhelds) to a computer | ||
14 | or workstation (Alpha, Sparc). Given that driver is built on parport, the | ||
15 | parallel port abstraction layer, this driver is architecture-independent. | ||
16 | |||
17 | It can also be used with another device plugged on the same port (such as a | ||
18 | ZIP drive). I have a 100MB ZIP and both of them work fine! | ||
19 | |||
20 | If you need more information, please visit the 'TI drivers' homepage at the URL | ||
21 | above. | ||
22 | |||
23 | WHAT YOU NEED: | ||
24 | |||
25 | A TI calculator and a program capable of communicating with your calculator. | ||
26 | |||
27 | TiLP will work for sure (since I am its developer!). yal92 may be able to use | ||
28 | it by changing tidev for tipar (may require some hacking...). | ||
29 | |||
30 | HOW TO USE IT: | ||
31 | |||
32 | You must have first compiled parport support (CONFIG_PARPORT_DEV): either | ||
33 | compiled in your kernel, either as a module. | ||
34 | |||
35 | Next, (as root): | ||
36 | |||
37 | modprobe parport | ||
38 | modprobe tipar | ||
39 | |||
40 | If it is not already there (it usually is), create the device: | ||
41 | |||
42 | mknod /dev/tipar0 c 115 0 | ||
43 | mknod /dev/tipar1 c 115 1 | ||
44 | mknod /dev/tipar2 c 115 2 | ||
45 | |||
46 | You will have to set permissions on this device to allow you to read/write | ||
47 | from it: | ||
48 | |||
49 | chmod 666 /dev/tipar[0..2] | ||
50 | |||
51 | Now you are ready to run a linking program such as TiLP. Be sure to configure | ||
52 | it properly (RTFM). | ||
53 | |||
54 | MODULE PARAMETERS: | ||
55 | |||
56 | You can set these with: modprobe tipar NAME=VALUE | ||
57 | There is currently no way to set these on a per-cable basis. | ||
58 | |||
59 | NAME: timeout | ||
60 | TYPE: integer | ||
61 | DEFAULT: 15 | ||
62 | DESC: Timeout value in tenth of seconds. If no data is available once this | ||
63 | time has expired then the driver will return with a timeout error. | ||
64 | |||
65 | NAME: delay | ||
66 | TYPE: integer | ||
67 | DEFAULT: 10 | ||
68 | DESC: Inter-bit delay in micro-seconds. A lower value gives an higher data | ||
69 | rate but makes transmission less reliable. | ||
70 | |||
71 | These parameters can be changed at run time by any program via ioctl(2) calls | ||
72 | as listed in ./include/linux/ticable.h. | ||
73 | |||
74 | Rather than write 50 pages describing the ioctl() and so on, it is | ||
75 | perhaps more useful you look at ticables library (dev_link.c) that demonstrates | ||
76 | how to use them, and demonstrates the features of the driver. This is | ||
77 | probably a lot more useful to people interested in writing applications | ||
78 | that will be using this driver. | ||
79 | |||
80 | QUIRKS/BUGS: | ||
81 | |||
82 | None. | ||
83 | |||
84 | HOW TO CONTACT US: | ||
85 | |||
86 | You can email me at roms@lpg.ticalc.org. Please prefix the subject line | ||
87 | with "TIPAR: " so that I am certain to notice your message. | ||
88 | You can also mail JB at jb@jblache.org. He packaged these drivers for Debian. | ||
89 | |||
90 | CREDITS: | ||
91 | |||
92 | The code is based on tidev.c & parport.c. | ||
93 | The driver has been developed independently of Texas Instruments. | ||
diff --git a/Documentation/tty.txt b/Documentation/tty.txt index 048a8762cfb5..8e65c4498c52 100644 --- a/Documentation/tty.txt +++ b/Documentation/tty.txt | |||
@@ -132,6 +132,14 @@ set_termios() Notify the tty driver that the device's termios | |||
132 | tty->termios. Previous settings should be passed in | 132 | tty->termios. Previous settings should be passed in |
133 | the "old" argument. | 133 | the "old" argument. |
134 | 134 | ||
135 | The API is defined such that the driver should return | ||
136 | the actual modes selected. This means that the | ||
137 | driver function is responsible for modifying any | ||
138 | bits in the request it cannot fulfill to indicate | ||
139 | the actual modes being used. A device with no | ||
140 | hardware capability for change (eg a USB dongle or | ||
141 | virtual port) can provide NULL for this method. | ||
142 | |||
135 | throttle() Notify the tty driver that input buffers for the | 143 | throttle() Notify the tty driver that input buffers for the |
136 | line discipline are close to full, and it should | 144 | line discipline are close to full, and it should |
137 | somehow signal that no more characters should be | 145 | somehow signal that no more characters should be |
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 @@ | |||
1 | UNALIGNED MEMORY ACCESSES | ||
2 | ========================= | ||
3 | |||
4 | Linux runs on a wide variety of architectures which have varying behaviour | ||
5 | when it comes to memory access. This document presents some details about | ||
6 | unaligned accesses, why you need to write code that doesn't cause them, | ||
7 | and how to write such code! | ||
8 | |||
9 | |||
10 | The definition of an unaligned access | ||
11 | ===================================== | ||
12 | |||
13 | Unaligned memory accesses occur when you try to read N bytes of data starting | ||
14 | from an address that is not evenly divisible by N (i.e. addr % N != 0). | ||
15 | For example, reading 4 bytes of data from address 0x10004 is fine, but | ||
16 | reading 4 bytes of data from address 0x10005 would be an unaligned memory | ||
17 | access. | ||
18 | |||
19 | The above may seem a little vague, as memory access can happen in different | ||
20 | ways. The context here is at the machine code level: certain instructions read | ||
21 | or write a number of bytes to or from memory (e.g. movb, movw, movl in x86 | ||
22 | assembly). As will become clear, it is relatively easy to spot C statements | ||
23 | which will compile to multiple-byte memory access instructions, namely when | ||
24 | dealing with types such as u16, u32 and u64. | ||
25 | |||
26 | |||
27 | Natural alignment | ||
28 | ================= | ||
29 | |||
30 | The rule mentioned above forms what we refer to as natural alignment: | ||
31 | When accessing N bytes of memory, the base memory address must be evenly | ||
32 | divisible by N, i.e. addr % N == 0. | ||
33 | |||
34 | When writing code, assume the target architecture has natural alignment | ||
35 | requirements. | ||
36 | |||
37 | In reality, only a few architectures require natural alignment on all sizes | ||
38 | of memory access. However, we must consider ALL supported architectures; | ||
39 | writing code that satisfies natural alignment requirements is the easiest way | ||
40 | to achieve full portability. | ||
41 | |||
42 | |||
43 | Why unaligned access is bad | ||
44 | =========================== | ||
45 | |||
46 | The effects of performing an unaligned memory access vary from architecture | ||
47 | to architecture. It would be easy to write a whole document on the differences | ||
48 | here; 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 | |||
62 | It should be obvious from the above that if your code causes unaligned | ||
63 | memory accesses to happen, your code will not work correctly on certain | ||
64 | platforms and will cause performance problems on others. | ||
65 | |||
66 | |||
67 | Code that does not cause unaligned access | ||
68 | ========================================= | ||
69 | |||
70 | At first, the concepts above may seem a little hard to relate to actual | ||
71 | coding practice. After all, you don't have a great deal of control over | ||
72 | memory addresses of certain variables, etc. | ||
73 | |||
74 | Fortunately things are not too complex, as in most cases, the compiler | ||
75 | ensures that things will work for you. For example, take the following | ||
76 | structure: | ||
77 | |||
78 | struct foo { | ||
79 | u16 field1; | ||
80 | u32 field2; | ||
81 | u8 field3; | ||
82 | }; | ||
83 | |||
84 | Let us assume that an instance of the above structure resides in memory | ||
85 | starting at address 0x10000. With a basic level of understanding, it would | ||
86 | not be unreasonable to expect that accessing field2 would cause an unaligned | ||
87 | access. You'd be expecting field2 to be located at offset 2 bytes into the | ||
88 | structure, i.e. address 0x10002, but that address is not evenly divisible | ||
89 | by 4 (remember, we're reading a 4 byte value here). | ||
90 | |||
91 | Fortunately, the compiler understands the alignment constraints, so in the | ||
92 | above case it would insert 2 bytes of padding in between field1 and field2. | ||
93 | Therefore, for standard structure types you can always rely on the compiler | ||
94 | to pad structures so that accesses to fields are suitably aligned (assuming | ||
95 | you do not cast the field to a type of different length). | ||
96 | |||
97 | Similarly, you can also rely on the compiler to align variables and function | ||
98 | parameters to a naturally aligned scheme, based on the size of the type of | ||
99 | the variable. | ||
100 | |||
101 | At this point, it should be clear that accessing a single byte (u8 or char) | ||
102 | will never cause an unaligned access, because all memory addresses are evenly | ||
103 | divisible by one. | ||
104 | |||
105 | On a related topic, with the above considerations in mind you may observe | ||
106 | that you could reorder the fields in the structure in order to place fields | ||
107 | where padding would otherwise be inserted, and hence reduce the overall | ||
108 | resident memory size of structure instances. The optimal layout of the | ||
109 | above example is: | ||
110 | |||
111 | struct foo { | ||
112 | u32 field2; | ||
113 | u16 field1; | ||
114 | u8 field3; | ||
115 | }; | ||
116 | |||
117 | For a natural alignment scheme, the compiler would only have to add a single | ||
118 | byte of padding at the end of the structure. This padding is added in order | ||
119 | to satisfy alignment constraints for arrays of these structures. | ||
120 | |||
121 | Another point worth mentioning is the use of __attribute__((packed)) on a | ||
122 | structure type. This GCC-specific attribute tells the compiler never to | ||
123 | insert any padding within structures, useful when you want to use a C struct | ||
124 | to represent some data that comes in a fixed arrangement 'off the wire'. | ||
125 | |||
126 | You might be inclined to believe that usage of this attribute can easily | ||
127 | lead to unaligned accesses when accessing fields that do not satisfy | ||
128 | architectural alignment requirements. However, again, the compiler is aware | ||
129 | of the alignment constraints and will generate extra instructions to perform | ||
130 | the memory access in a way that does not cause unaligned access. Of course, | ||
131 | the extra instructions obviously cause a loss in performance compared to the | ||
132 | non-packed case, so the packed attribute should only be used when avoiding | ||
133 | structure padding is of importance. | ||
134 | |||
135 | |||
136 | Code that causes unaligned access | ||
137 | ================================= | ||
138 | |||
139 | With the above in mind, let's move onto a real life example of a function | ||
140 | that can cause an unaligned memory access. The following function adapted | ||
141 | from include/linux/etherdevice.h is an optimized routine to compare two | ||
142 | ethernet MAC addresses for equality. | ||
143 | |||
144 | unsigned 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 | |||
151 | In the above function, the reference to a[0] causes 2 bytes (16 bits) to | ||
152 | be read from memory starting at address addr1. Think about what would happen | ||
153 | if addr1 was an odd address such as 0x10003. (Hint: it'd be an unaligned | ||
154 | access.) | ||
155 | |||
156 | Despite the potential unaligned access problems with the above function, it | ||
157 | is included in the kernel anyway but is understood to only work on | ||
158 | 16-bit-aligned addresses. It is up to the caller to ensure this alignment or | ||
159 | not use this function at all. This alignment-unsafe function is still useful | ||
160 | as it is a decent optimization for the cases when you can ensure alignment, | ||
161 | which is true almost all of the time in ethernet networking context. | ||
162 | |||
163 | |||
164 | Here 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 | |||
172 | This code will cause unaligned accesses every time the data parameter points | ||
173 | to an address that is not evenly divisible by 4. | ||
174 | |||
175 | In summary, the 2 main scenarios where you may run into unaligned access | ||
176 | problems 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 | |||
181 | Avoiding unaligned accesses | ||
182 | =========================== | ||
183 | |||
184 | The easiest way to avoid unaligned access is to use the get_unaligned() and | ||
185 | put_unaligned() macros provided by the <asm/unaligned.h> header file. | ||
186 | |||
187 | Going back to an earlier example of code that potentially causes unaligned | ||
188 | access: | ||
189 | |||
190 | void myfunc(u8 *data, u32 value) | ||
191 | { | ||
192 | [...] | ||
193 | *((u32 *) data) = cpu_to_le32(value); | ||
194 | [...] | ||
195 | } | ||
196 | |||
197 | To 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 | |||
207 | The get_unaligned() macro works similarly. Assuming 'data' is a pointer to | ||
208 | memory and you wish to avoid unaligned access, its usage is as follows: | ||
209 | |||
210 | u32 value = get_unaligned((u32 *) data); | ||
211 | |||
212 | These macros work work for memory accesses of any length (not just 32 bits as | ||
213 | in the examples above). Be aware that when compared to standard access of | ||
214 | aligned memory, using these macros to access unaligned memory can be costly in | ||
215 | terms of performance. | ||
216 | |||
217 | If use of such macros is not convenient, another option is to use memcpy(), | ||
218 | where the source or destination (or both) are of type u8* or unsigned char*. | ||
219 | Due to the byte-wise nature of this operation, unaligned accesses are avoided. | ||
220 | |||
221 | -- | ||
222 | Author: Daniel Drake <dsd@gentoo.org> | ||
223 | With help from: Alan Cox, Avuton Olrich, Heikki Orsila, Jan Engelhardt, | ||
224 | Johannes Berg, Kyle McMartin, Kyle Moffett, Randy Dunlap, Robert Hancock, | ||
225 | Uli 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 | |||
9 | GENERAL | ||
10 | ======= | ||
11 | |||
12 | This driver may be used if you are writing printer firmware using Linux as | ||
13 | the embedded OS. This driver has nothing to do with using a printer with | ||
14 | your Linux host system. | ||
15 | |||
16 | You will need a USB device controller and a Linux driver for it that accepts | ||
17 | a gadget / "device class" driver using the Linux USB Gadget API. After the | ||
18 | USB device controller driver is loaded then load the printer gadget driver. | ||
19 | This will present a printer interface to the USB Host that your USB Device | ||
20 | port is connected to. | ||
21 | |||
22 | This driver is structured for printer firmware that runs in user mode. The | ||
23 | user mode printer firmware will read and write data from the kernel mode | ||
24 | printer gadget driver using a device file. The printer returns a printer status | ||
25 | byte when the USB HOST sends a device request to get the printer status. The | ||
26 | user 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 | |||
32 | HOWTO USE THIS DRIVER | ||
33 | ===================== | ||
34 | |||
35 | To load the USB device controller driver and the printer gadget driver. The | ||
36 | following example uses the Netchip 2280 USB device controller driver: | ||
37 | |||
38 | modprobe net2280 | ||
39 | modprobe g_printer | ||
40 | |||
41 | |||
42 | The follow command line parameter can be used when loading the printer gadget | ||
43 | (ex: modprobe g_printer idVendor=0x0525 idProduct=0xa4a8 ): | ||
44 | |||
45 | idVendor - 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 | |||
51 | idProduct - 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 | |||
56 | bcdDevice - This is the version number of your product. It would be a good idea | ||
57 | to put your firmware version here. | ||
58 | |||
59 | iManufacturer - A string containing the name of the Vendor. | ||
60 | |||
61 | iProduct - A string containing the Product Name. | ||
62 | |||
63 | iSerialNum - A string containing the Serial Number. This should be changed for | ||
64 | each unit of your product. | ||
65 | |||
66 | iPNPstring - 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 | |||
70 | qlen - 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 | |||
77 | USING THE EXAMPLE CODE | ||
78 | ====================== | ||
79 | |||
80 | This example code talks to stdout, instead of a print engine. | ||
81 | |||
82 | To compile the test code below: | ||
83 | |||
84 | 1) save it to a file called prn_example.c | ||
85 | 2) compile the code with the follow command: | ||
86 | gcc prn_example.c -o prn_example | ||
87 | |||
88 | |||
89 | |||
90 | To read printer data from the host to stdout: | ||
91 | |||
92 | # prn_example -read_data | ||
93 | |||
94 | |||
95 | To write printer data from a file (data_file) to the host: | ||
96 | |||
97 | # cat data_file | prn_example -write_data | ||
98 | |||
99 | |||
100 | To 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 | |||
110 | To set printer to Selected/On-line: | ||
111 | |||
112 | # prn_example -selected | ||
113 | |||
114 | |||
115 | To set printer to Not Selected/Off-line: | ||
116 | |||
117 | # prn_example -not_selected | ||
118 | |||
119 | |||
120 | To set paper status to paper out: | ||
121 | |||
122 | # prn_example -paper_out | ||
123 | |||
124 | |||
125 | To set paper status to paper loaded: | ||
126 | |||
127 | # prn_example -paper_loaded | ||
128 | |||
129 | |||
130 | To set error status to printer OK: | ||
131 | |||
132 | # prn_example -no_error | ||
133 | |||
134 | |||
135 | To set error status to ERROR: | ||
136 | |||
137 | # prn_example -error | ||
138 | |||
139 | |||
140 | |||
141 | |||
142 | EXAMPLE 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 | |||
161 | static void | ||
162 | usage(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 | |||
192 | static int | ||
193 | read_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 | |||
242 | static int | ||
243 | write_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 | |||
301 | static int | ||
302 | read_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 | |||
335 | static int | ||
336 | get_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 | |||
363 | static int | ||
364 | set_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 | |||
403 | static int | ||
404 | display_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 | |||
435 | int | ||
436 | main(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 @@ | |||
1 | Infinity Usb Unlimited Readme | ||
2 | ----------------------------- | ||
3 | |||
4 | Hi all, | ||
5 | |||
6 | |||
7 | This module provide a serial interface to use your | ||
8 | IUU unit in phoenix mode. Loading this module will | ||
9 | bring a ttyUSB[0-x] interface. This driver must be | ||
10 | used by your favorite application to pilot the IUU | ||
11 | |||
12 | This driver is still in beta stage, so bugs can | ||
13 | occur and your system may freeze. As far I now, | ||
14 | I never had any problem with it, but I'm not a real | ||
15 | guru, so don't blame me if your system is unstable | ||
16 | |||
17 | You can plug more than one IUU. Every unit will | ||
18 | have his own device file(/dev/ttyUSB0,/dev/ttyUSB1,...) | ||
19 | |||
20 | |||
21 | |||
22 | How 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/usb/power-management.txt b/Documentation/usb/power-management.txt index 97842deec471..b2fc4d4a9917 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/usb/power-management.txt | |||
@@ -278,6 +278,14 @@ optional. The methods' jobs are quite simple: | |||
278 | (although the interfaces will be in the same altsettings as | 278 | (although the interfaces will be in the same altsettings as |
279 | before the suspend). | 279 | before the suspend). |
280 | 280 | ||
281 | If the device is disconnected or powered down while it is suspended, | ||
282 | the disconnect method will be called instead of the resume or | ||
283 | reset_resume method. This is also quite likely to happen when | ||
284 | waking up from hibernation, as many systems do not maintain suspend | ||
285 | current to the USB host controllers during hibernation. (It's | ||
286 | possible to work around the hibernation-forces-disconnect problem by | ||
287 | using the USB Persist facility.) | ||
288 | |||
281 | The reset_resume method is used by the USB Persist facility (see | 289 | The reset_resume method is used by the USB Persist facility (see |
282 | Documentation/usb/persist.txt) and it can also be used under certain | 290 | Documentation/usb/persist.txt) and it can also be used under certain |
283 | circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a | 291 | circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a |
diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index 00cb646a4bde..0924e6e142c4 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 | |||
@@ -1,5 +1,7 @@ | |||
1 | 0 -> UNKNOWN/GENERIC [0070:3400] | 1 | 0 -> UNKNOWN/GENERIC [0070:3400] |
2 | 1 -> Hauppauge WinTV-HVR1800lp [0070:7600] | 2 | 1 -> Hauppauge WinTV-HVR1800lp [0070:7600] |
3 | 2 -> Hauppauge WinTV-HVR1800 [0070:7800,0070:7801] | 3 | 2 -> Hauppauge WinTV-HVR1800 [0070:7800,0070:7801,0070:7809] |
4 | 3 -> Hauppauge WinTV-HVR1250 [0070:7911] | 4 | 3 -> Hauppauge WinTV-HVR1250 [0070:7911] |
5 | 4 -> DViCO FusionHDTV5 Express [18ac:d500] | 5 | 4 -> DViCO FusionHDTV5 Express [18ac:d500] |
6 | 5 -> Hauppauge WinTV-HVR1500Q [0070:7790,0070:7797] | ||
7 | 6 -> Hauppauge WinTV-HVR1500 [0070:7710,0070:7717] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 82ac8250e978..bc5593bd9704 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -56,3 +56,4 @@ | |||
56 | 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] | 56 | 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] |
57 | 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder [0070:9600,0070:9601,0070:9602] | 57 | 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder [0070:9600,0070:9601,0070:9602] |
58 | 57 -> ADS Tech Instant Video PCI [1421:0390] | 58 | 57 -> ADS Tech Instant Video PCI [1421:0390] |
59 | 58 -> Pinnacle PCTV HD 800i [11bd:0051] | ||
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 37f0e3cedf43..6a8469f2bcae 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -1,14 +1,17 @@ | |||
1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] | 1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] |
2 | 1 -> Unknown EM2820/2840 video grabber (em2820/em2840) | 2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2750,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] |
3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] | 3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] |
4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] | 4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] |
5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200] | 5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] |
6 | 5 -> MSI VOX USB 2.0 (em2820/em2840) [eb1a:2820] | 6 | 5 -> MSI VOX USB 2.0 (em2820/em2840) |
7 | 6 -> Terratec Cinergy 200 USB (em2800) | 7 | 6 -> Terratec Cinergy 200 USB (em2800) |
8 | 7 -> Leadtek Winfast USB II (em2800) | 8 | 7 -> Leadtek Winfast USB II (em2800) |
9 | 8 -> Kworld USB2800 (em2800) | 9 | 8 -> Kworld USB2800 (em2800) |
10 | 9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207] | 10 | 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] |
11 | 10 -> Hauppauge WinTV HVR 900 (em2880) | 11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] |
12 | 11 -> Terratec Hybrid XS (em2880) | 12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] |
13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) | 13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) |
14 | 13 -> Terratec Prodigy XS (em2880) | 14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] |
15 | 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) | ||
16 | 15 -> V-Gear PocketTV (em2800) | ||
17 | 16 -> Hauppauge WinTV HVR 950 (em2880) [2040:6513] | ||
diff --git a/Documentation/video4linux/CARDLIST.ivtv b/Documentation/video4linux/CARDLIST.ivtv index ddd76a0eb100..a019e27e42b3 100644 --- a/Documentation/video4linux/CARDLIST.ivtv +++ b/Documentation/video4linux/CARDLIST.ivtv | |||
@@ -16,3 +16,9 @@ | |||
16 | 16 -> GOTVIEW PCI DVD2 Deluxe [ffac:0600] | 16 | 16 -> GOTVIEW PCI DVD2 Deluxe [ffac:0600] |
17 | 17 -> Yuan MPC622 [ff01:d998] | 17 | 17 -> Yuan MPC622 [ff01:d998] |
18 | 18 -> Digital Cowboy DCT-MTVP1 [1461:bfff] | 18 | 18 -> Digital Cowboy DCT-MTVP1 [1461:bfff] |
19 | 19 -> Yuan PG600V2/GotView PCI DVD Lite [ffab:0600,ffad:0600] | ||
20 | 20 -> Club3D ZAP-TV1x01 [ffab:0600] | ||
21 | 21 -> AverTV MCE 116 Plus [1461:c439] | ||
22 | 22 -> ASUS Falcon2 [1043:4b66,1043:462e,1043:4b2e] | ||
23 | 23 -> AverMedia PVR-150 Plus [1461:c035] | ||
24 | 24 -> AverMedia EZMaker PCI Deluxe [1461:c03f] | ||
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index a14545300e4c..5d3b6b4d2515 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -80,7 +80,7 @@ | |||
80 | 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) | 80 | 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) |
81 | 80 -> ASUS Digimatrix TV [1043:0210] | 81 | 80 -> ASUS Digimatrix TV [1043:0210] |
82 | 81 -> Philips Tiger reference design [1131:2018] | 82 | 81 -> Philips Tiger reference design [1131:2018] |
83 | 82 -> MSI TV@Anywhere plus [1462:6231] | 83 | 82 -> MSI TV@Anywhere plus [1462:6231,1462:8624] |
84 | 83 -> Terratec Cinergy 250 PCI TV [153b:1160] | 84 | 83 -> Terratec Cinergy 250 PCI TV [153b:1160] |
85 | 84 -> LifeView FlyDVB Trio [5168:0319] | 85 | 84 -> LifeView FlyDVB Trio [5168:0319] |
86 | 85 -> AverTV DVB-T 777 [1461:2c05,1461:2c05] | 86 | 85 -> AverTV DVB-T 777 [1461:2c05,1461:2c05] |
@@ -102,7 +102,7 @@ | |||
102 | 101 -> Pinnacle PCTV 310i [11bd:002f] | 102 | 101 -> Pinnacle PCTV 310i [11bd:002f] |
103 | 102 -> Avermedia AVerTV Studio 507 [1461:9715] | 103 | 102 -> Avermedia AVerTV Studio 507 [1461:9715] |
104 | 103 -> Compro Videomate DVB-T200A | 104 | 103 -> Compro Videomate DVB-T200A |
105 | 104 -> Hauppauge WinTV-HVR1110 DVB-T/Hybrid [0070:6701] | 105 | 104 -> Hauppauge WinTV-HVR1110 DVB-T/Hybrid [0070:6700,0070:6701,0070:6702,0070:6703,0070:6704,0070:6705] |
106 | 105 -> Terratec Cinergy HT PCMCIA [153b:1172] | 106 | 105 -> Terratec Cinergy HT PCMCIA [153b:1172] |
107 | 106 -> Encore ENLTV [1131:2342,1131:2341,3016:2344] | 107 | 106 -> Encore ENLTV [1131:2342,1131:2341,3016:2344] |
108 | 107 -> Encore ENLTV-FM [1131:230f] | 108 | 107 -> Encore ENLTV-FM [1131:230f] |
@@ -116,3 +116,16 @@ | |||
116 | 115 -> Sabrent PCMCIA TV-PCB05 [0919:2003] | 116 | 115 -> Sabrent PCMCIA TV-PCB05 [0919:2003] |
117 | 116 -> 10MOONS TM300 TV Card [1131:2304] | 117 | 116 -> 10MOONS TM300 TV Card [1131:2304] |
118 | 117 -> Avermedia Super 007 [1461:f01d] | 118 | 117 -> Avermedia Super 007 [1461:f01d] |
119 | 118 -> Beholder BeholdTV 401 [0000:4016] | ||
120 | 119 -> Beholder BeholdTV 403 [0000:4036] | ||
121 | 120 -> Beholder BeholdTV 403 FM [0000:4037] | ||
122 | 121 -> Beholder BeholdTV 405 [0000:4050] | ||
123 | 122 -> Beholder BeholdTV 405 FM [0000:4051] | ||
124 | 123 -> Beholder BeholdTV 407 [0000:4070] | ||
125 | 124 -> Beholder BeholdTV 407 FM [0000:4071] | ||
126 | 125 -> Beholder BeholdTV 409 [0000:4090] | ||
127 | 126 -> Beholder BeholdTV 505 FM/RDS [0000:5051,0000:505B,5ace:5050] | ||
128 | 127 -> Beholder BeholdTV 507 FM/RDS / BeholdTV 509 FM [0000:5071,0000:507B,5ace:5070,5ace:5090] | ||
129 | 128 -> Beholder BeholdTV Columbus TVFM [0000:5201] | ||
130 | 129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093] | ||
131 | 130 -> Beholder BeholdTV M6 / BeholdTV M6 Extra [5ace:6190,5ace:6193] | ||
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index a88c02d23805..0e2394695bb8 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner | |||
@@ -52,7 +52,7 @@ tuner=50 - TCL 2002N | |||
52 | tuner=51 - Philips PAL/SECAM_D (FM 1256 I-H3) | 52 | tuner=51 - Philips PAL/SECAM_D (FM 1256 I-H3) |
53 | tuner=52 - Thomson DTT 7610 (ATSC/NTSC) | 53 | tuner=52 - Thomson DTT 7610 (ATSC/NTSC) |
54 | tuner=53 - Philips FQ1286 | 54 | tuner=53 - Philips FQ1286 |
55 | tuner=54 - tda8290+75 | 55 | tuner=54 - Philips/NXP TDA 8290/8295 + 8275/8275A/18271 |
56 | tuner=55 - TCL 2002MB | 56 | tuner=55 - TCL 2002MB |
57 | tuner=56 - Philips PAL/SECAM multi (FQ1216AME MK4) | 57 | tuner=56 - Philips PAL/SECAM multi (FQ1216AME MK4) |
58 | tuner=57 - Philips FQ1236A MK4 | 58 | tuner=57 - Philips FQ1236A MK4 |
@@ -69,7 +69,8 @@ tuner=67 - Philips TD1316 Hybrid Tuner | |||
69 | tuner=68 - Philips TUV1236D ATSC/NTSC dual in | 69 | tuner=68 - Philips TUV1236D ATSC/NTSC dual in |
70 | tuner=69 - Tena TNF 5335 and similar models | 70 | tuner=69 - Tena TNF 5335 and similar models |
71 | tuner=70 - Samsung TCPN 2121P30A | 71 | tuner=70 - Samsung TCPN 2121P30A |
72 | tuner=71 - Xceive xc3028 | 72 | tuner=71 - Xceive xc2028/xc3028 tuner |
73 | tuner=72 - Thomson FE6600 | 73 | tuner=72 - Thomson FE6600 |
74 | tuner=73 - Samsung TCPG 6121P30A | 74 | tuner=73 - Samsung TCPG 6121P30A |
75 | tuner=75 - Philips TEA5761 FM Radio | 75 | tuner=75 - Philips TEA5761 FM Radio |
76 | tuner=76 - Xceive 5000 tuner | ||
diff --git a/Documentation/video4linux/CARDLIST.usbvision b/Documentation/video4linux/CARDLIST.usbvision index 3d6850ef0245..0b72d3fee17e 100644 --- a/Documentation/video4linux/CARDLIST.usbvision +++ b/Documentation/video4linux/CARDLIST.usbvision | |||
@@ -62,3 +62,4 @@ | |||
62 | 61 -> Pinnacle Studio Linx Video input cable (PAL) [2304:0301] | 62 | 61 -> Pinnacle Studio Linx Video input cable (PAL) [2304:0301] |
63 | 62 -> Pinnacle PCTV Bungee USB (PAL) FM [2304:0419] | 63 | 62 -> Pinnacle PCTV Bungee USB (PAL) FM [2304:0419] |
64 | 63 -> Hauppauge WinTv-USB [2400:4200] | 64 | 63 -> Hauppauge WinTv-USB [2400:4200] |
65 | 64 -> Pinnacle Studio PCTV USB (NTSC) FM V3 [2304:0113] | ||
diff --git a/Documentation/video4linux/extract_xc3028.pl b/Documentation/video4linux/extract_xc3028.pl new file mode 100644 index 000000000000..cced8ac5c543 --- /dev/null +++ b/Documentation/video4linux/extract_xc3028.pl | |||
@@ -0,0 +1,926 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # Copyright (c) Mauro Carvalho Chehab <mchehab@infradead.org> | ||
4 | # Released under GPLv2 | ||
5 | # | ||
6 | # In order to use, you need to: | ||
7 | # 1) Download the windows driver with something like: | ||
8 | # wget http://www.steventoth.net/linux/xc5000/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip | ||
9 | # 2) Extract the file hcw85bda.sys from the zip into the current dir: | ||
10 | # unzip -j HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys | ||
11 | # 3) run the script: | ||
12 | # ./extract_xc3028.pl | ||
13 | # 4) copy the generated file: | ||
14 | # cp xc3028-v27.fw /lib/firmware | ||
15 | |||
16 | #use strict; | ||
17 | use IO::Handle; | ||
18 | |||
19 | my $debug=0; | ||
20 | |||
21 | sub verify ($$) | ||
22 | { | ||
23 | my ($filename, $hash) = @_; | ||
24 | my ($testhash); | ||
25 | |||
26 | if (system("which md5sum > /dev/null 2>&1")) { | ||
27 | die "This firmware requires the md5sum command - see http://www.gnu.org/software/coreutils/\n"; | ||
28 | } | ||
29 | |||
30 | open(CMD, "md5sum ".$filename."|"); | ||
31 | $testhash = <CMD>; | ||
32 | $testhash =~ /([a-zA-Z0-9]*)/; | ||
33 | $testhash = $1; | ||
34 | close CMD; | ||
35 | die "Hash of extracted file does not match (found $testhash, expected $hash!\n" if ($testhash ne $hash); | ||
36 | } | ||
37 | |||
38 | sub get_hunk ($$) | ||
39 | { | ||
40 | my ($offset, $length) = @_; | ||
41 | my ($chunklength, $buf, $rcount, $out); | ||
42 | |||
43 | sysseek(INFILE, $offset, SEEK_SET); | ||
44 | while ($length > 0) { | ||
45 | # Calc chunk size | ||
46 | $chunklength = 2048; | ||
47 | $chunklength = $length if ($chunklength > $length); | ||
48 | |||
49 | $rcount = sysread(INFILE, $buf, $chunklength); | ||
50 | die "Ran out of data\n" if ($rcount != $chunklength); | ||
51 | $out .= $buf; | ||
52 | $length -= $rcount; | ||
53 | } | ||
54 | return $out; | ||
55 | } | ||
56 | |||
57 | sub write_le16($) | ||
58 | { | ||
59 | my $val = shift; | ||
60 | my $msb = ($val >> 8) &0xff; | ||
61 | my $lsb = $val & 0xff; | ||
62 | |||
63 | syswrite(OUTFILE, chr($lsb).chr($msb)); | ||
64 | } | ||
65 | |||
66 | sub write_le32($) | ||
67 | { | ||
68 | my $val = shift; | ||
69 | my $l3 = ($val >> 24) & 0xff; | ||
70 | my $l2 = ($val >> 16) & 0xff; | ||
71 | my $l1 = ($val >> 8) & 0xff; | ||
72 | my $l0 = $val & 0xff; | ||
73 | |||
74 | syswrite(OUTFILE, chr($l0).chr($l1).chr($l2).chr($l3)); | ||
75 | } | ||
76 | |||
77 | sub write_le64($$) | ||
78 | { | ||
79 | my $msb_val = shift; | ||
80 | my $lsb_val = shift; | ||
81 | my $l7 = ($msb_val >> 24) & 0xff; | ||
82 | my $l6 = ($msb_val >> 16) & 0xff; | ||
83 | my $l5 = ($msb_val >> 8) & 0xff; | ||
84 | my $l4 = $msb_val & 0xff; | ||
85 | |||
86 | my $l3 = ($lsb_val >> 24) & 0xff; | ||
87 | my $l2 = ($lsb_val >> 16) & 0xff; | ||
88 | my $l1 = ($lsb_val >> 8) & 0xff; | ||
89 | my $l0 = $lsb_val & 0xff; | ||
90 | |||
91 | syswrite(OUTFILE, | ||
92 | chr($l0).chr($l1).chr($l2).chr($l3). | ||
93 | chr($l4).chr($l5).chr($l6).chr($l7)); | ||
94 | } | ||
95 | |||
96 | sub write_hunk($$) | ||
97 | { | ||
98 | my ($offset, $length) = @_; | ||
99 | my $out = get_hunk($offset, $length); | ||
100 | |||
101 | printf "(len %d) ",$length if ($debug); | ||
102 | |||
103 | for (my $i=0;$i<$length;$i++) { | ||
104 | printf "%02x ",ord(substr($out,$i,1)) if ($debug); | ||
105 | } | ||
106 | printf "\n" if ($debug); | ||
107 | |||
108 | syswrite(OUTFILE, $out); | ||
109 | } | ||
110 | |||
111 | sub write_hunk_fix_endian($$) | ||
112 | { | ||
113 | my ($offset, $length) = @_; | ||
114 | my $out = get_hunk($offset, $length); | ||
115 | |||
116 | printf "(len_fix %d) ",$length if ($debug); | ||
117 | |||
118 | for (my $i=0;$i<$length;$i++) { | ||
119 | printf "%02x ",ord(substr($out,$i,1)) if ($debug); | ||
120 | } | ||
121 | printf "\n" if ($debug); | ||
122 | |||
123 | my $i=0; | ||
124 | while ($i<$length) { | ||
125 | my $size = ord(substr($out,$i,1))*256+ord(substr($out,$i+1,1)); | ||
126 | syswrite(OUTFILE, substr($out,$i+1,1)); | ||
127 | syswrite(OUTFILE, substr($out,$i,1)); | ||
128 | $i+=2; | ||
129 | if ($size>0 && $size <0x8000) { | ||
130 | for (my $j=0;$j<$size;$j++) { | ||
131 | syswrite(OUTFILE, substr($out,$j+$i,1)); | ||
132 | } | ||
133 | $i+=$size; | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | |||
138 | sub main_firmware($$$$) | ||
139 | { | ||
140 | my $out; | ||
141 | my $j=0; | ||
142 | my $outfile = shift; | ||
143 | my $name = shift; | ||
144 | my $version = shift; | ||
145 | my $nr_desc = shift; | ||
146 | |||
147 | for ($j = length($name); $j <32; $j++) { | ||
148 | $name = $name.chr(0); | ||
149 | } | ||
150 | |||
151 | open OUTFILE, ">$outfile"; | ||
152 | syswrite(OUTFILE, $name); | ||
153 | write_le16($version); | ||
154 | write_le16($nr_desc); | ||
155 | |||
156 | # | ||
157 | # Firmware 0, type: BASE FW F8MHZ (0x00000003), id: (0000000000000000), size: 8718 | ||
158 | # | ||
159 | |||
160 | write_le32(0x00000003); # Type | ||
161 | write_le64(0x00000000, 0x00000000); # ID | ||
162 | write_le32(8718); # Size | ||
163 | write_hunk_fix_endian(813432, 8718); | ||
164 | |||
165 | # | ||
166 | # Firmware 1, type: BASE FW F8MHZ MTS (0x00000007), id: (0000000000000000), size: 8712 | ||
167 | # | ||
168 | |||
169 | write_le32(0x00000007); # Type | ||
170 | write_le64(0x00000000, 0x00000000); # ID | ||
171 | write_le32(8712); # Size | ||
172 | write_hunk_fix_endian(822152, 8712); | ||
173 | |||
174 | # | ||
175 | # Firmware 2, type: BASE FW FM (0x00000401), id: (0000000000000000), size: 8562 | ||
176 | # | ||
177 | |||
178 | write_le32(0x00000401); # Type | ||
179 | write_le64(0x00000000, 0x00000000); # ID | ||
180 | write_le32(8562); # Size | ||
181 | write_hunk_fix_endian(830872, 8562); | ||
182 | |||
183 | # | ||
184 | # Firmware 3, type: BASE FW FM INPUT1 (0x00000c01), id: (0000000000000000), size: 8576 | ||
185 | # | ||
186 | |||
187 | write_le32(0x00000c01); # Type | ||
188 | write_le64(0x00000000, 0x00000000); # ID | ||
189 | write_le32(8576); # Size | ||
190 | write_hunk_fix_endian(839440, 8576); | ||
191 | |||
192 | # | ||
193 | # Firmware 4, type: BASE FW (0x00000001), id: (0000000000000000), size: 8706 | ||
194 | # | ||
195 | |||
196 | write_le32(0x00000001); # Type | ||
197 | write_le64(0x00000000, 0x00000000); # ID | ||
198 | write_le32(8706); # Size | ||
199 | write_hunk_fix_endian(848024, 8706); | ||
200 | |||
201 | # | ||
202 | # Firmware 5, type: BASE FW MTS (0x00000005), id: (0000000000000000), size: 8682 | ||
203 | # | ||
204 | |||
205 | write_le32(0x00000005); # Type | ||
206 | write_le64(0x00000000, 0x00000000); # ID | ||
207 | write_le32(8682); # Size | ||
208 | write_hunk_fix_endian(856736, 8682); | ||
209 | |||
210 | # | ||
211 | # Firmware 6, type: STD FW (0x00000000), id: PAL/BG A2/A (0000000100000007), size: 161 | ||
212 | # | ||
213 | |||
214 | write_le32(0x00000000); # Type | ||
215 | write_le64(0x00000001, 0x00000007); # ID | ||
216 | write_le32(161); # Size | ||
217 | write_hunk_fix_endian(865424, 161); | ||
218 | |||
219 | # | ||
220 | # Firmware 7, type: STD FW MTS (0x00000004), id: PAL/BG A2/A (0000000100000007), size: 169 | ||
221 | # | ||
222 | |||
223 | write_le32(0x00000004); # Type | ||
224 | write_le64(0x00000001, 0x00000007); # ID | ||
225 | write_le32(169); # Size | ||
226 | write_hunk_fix_endian(865592, 169); | ||
227 | |||
228 | # | ||
229 | # Firmware 8, type: STD FW (0x00000000), id: PAL/BG A2/B (0000000200000007), size: 161 | ||
230 | # | ||
231 | |||
232 | write_le32(0x00000000); # Type | ||
233 | write_le64(0x00000002, 0x00000007); # ID | ||
234 | write_le32(161); # Size | ||
235 | write_hunk_fix_endian(865424, 161); | ||
236 | |||
237 | # | ||
238 | # Firmware 9, type: STD FW MTS (0x00000004), id: PAL/BG A2/B (0000000200000007), size: 169 | ||
239 | # | ||
240 | |||
241 | write_le32(0x00000004); # Type | ||
242 | write_le64(0x00000002, 0x00000007); # ID | ||
243 | write_le32(169); # Size | ||
244 | write_hunk_fix_endian(865592, 169); | ||
245 | |||
246 | # | ||
247 | # Firmware 10, type: STD FW (0x00000000), id: PAL/BG NICAM/A (0000000400000007), size: 161 | ||
248 | # | ||
249 | |||
250 | write_le32(0x00000000); # Type | ||
251 | write_le64(0x00000004, 0x00000007); # ID | ||
252 | write_le32(161); # Size | ||
253 | write_hunk_fix_endian(866112, 161); | ||
254 | |||
255 | # | ||
256 | # Firmware 11, type: STD FW MTS (0x00000004), id: PAL/BG NICAM/A (0000000400000007), size: 169 | ||
257 | # | ||
258 | |||
259 | write_le32(0x00000004); # Type | ||
260 | write_le64(0x00000004, 0x00000007); # ID | ||
261 | write_le32(169); # Size | ||
262 | write_hunk_fix_endian(866280, 169); | ||
263 | |||
264 | # | ||
265 | # Firmware 12, type: STD FW (0x00000000), id: PAL/BG NICAM/B (0000000800000007), size: 161 | ||
266 | # | ||
267 | |||
268 | write_le32(0x00000000); # Type | ||
269 | write_le64(0x00000008, 0x00000007); # ID | ||
270 | write_le32(161); # Size | ||
271 | write_hunk_fix_endian(866112, 161); | ||
272 | |||
273 | # | ||
274 | # Firmware 13, type: STD FW MTS (0x00000004), id: PAL/BG NICAM/B (0000000800000007), size: 169 | ||
275 | # | ||
276 | |||
277 | write_le32(0x00000004); # Type | ||
278 | write_le64(0x00000008, 0x00000007); # ID | ||
279 | write_le32(169); # Size | ||
280 | write_hunk_fix_endian(866280, 169); | ||
281 | |||
282 | # | ||
283 | # Firmware 14, type: STD FW (0x00000000), id: PAL/DK A2 (00000003000000e0), size: 161 | ||
284 | # | ||
285 | |||
286 | write_le32(0x00000000); # Type | ||
287 | write_le64(0x00000003, 0x000000e0); # ID | ||
288 | write_le32(161); # Size | ||
289 | write_hunk_fix_endian(866800, 161); | ||
290 | |||
291 | # | ||
292 | # Firmware 15, type: STD FW MTS (0x00000004), id: PAL/DK A2 (00000003000000e0), size: 169 | ||
293 | # | ||
294 | |||
295 | write_le32(0x00000004); # Type | ||
296 | write_le64(0x00000003, 0x000000e0); # ID | ||
297 | write_le32(169); # Size | ||
298 | write_hunk_fix_endian(866968, 169); | ||
299 | |||
300 | # | ||
301 | # Firmware 16, type: STD FW (0x00000000), id: PAL/DK NICAM (0000000c000000e0), size: 161 | ||
302 | # | ||
303 | |||
304 | write_le32(0x00000000); # Type | ||
305 | write_le64(0x0000000c, 0x000000e0); # ID | ||
306 | write_le32(161); # Size | ||
307 | write_hunk_fix_endian(867144, 161); | ||
308 | |||
309 | # | ||
310 | # Firmware 17, type: STD FW MTS (0x00000004), id: PAL/DK NICAM (0000000c000000e0), size: 169 | ||
311 | # | ||
312 | |||
313 | write_le32(0x00000004); # Type | ||
314 | write_le64(0x0000000c, 0x000000e0); # ID | ||
315 | write_le32(169); # Size | ||
316 | write_hunk_fix_endian(867312, 169); | ||
317 | |||
318 | # | ||
319 | # Firmware 18, type: STD FW (0x00000000), id: SECAM/K1 (0000000000200000), size: 161 | ||
320 | # | ||
321 | |||
322 | write_le32(0x00000000); # Type | ||
323 | write_le64(0x00000000, 0x00200000); # ID | ||
324 | write_le32(161); # Size | ||
325 | write_hunk_fix_endian(867488, 161); | ||
326 | |||
327 | # | ||
328 | # Firmware 19, type: STD FW MTS (0x00000004), id: SECAM/K1 (0000000000200000), size: 169 | ||
329 | # | ||
330 | |||
331 | write_le32(0x00000004); # Type | ||
332 | write_le64(0x00000000, 0x00200000); # ID | ||
333 | write_le32(169); # Size | ||
334 | write_hunk_fix_endian(867656, 169); | ||
335 | |||
336 | # | ||
337 | # Firmware 20, type: STD FW (0x00000000), id: SECAM/K3 (0000000004000000), size: 161 | ||
338 | # | ||
339 | |||
340 | write_le32(0x00000000); # Type | ||
341 | write_le64(0x00000000, 0x04000000); # ID | ||
342 | write_le32(161); # Size | ||
343 | write_hunk_fix_endian(867832, 161); | ||
344 | |||
345 | # | ||
346 | # Firmware 21, type: STD FW MTS (0x00000004), id: SECAM/K3 (0000000004000000), size: 169 | ||
347 | # | ||
348 | |||
349 | write_le32(0x00000004); # Type | ||
350 | write_le64(0x00000000, 0x04000000); # ID | ||
351 | write_le32(169); # Size | ||
352 | write_hunk_fix_endian(868000, 169); | ||
353 | |||
354 | # | ||
355 | # Firmware 22, type: STD FW D2633 DTV6 ATSC (0x00010030), id: (0000000000000000), size: 149 | ||
356 | # | ||
357 | |||
358 | write_le32(0x00010030); # Type | ||
359 | write_le64(0x00000000, 0x00000000); # ID | ||
360 | write_le32(149); # Size | ||
361 | write_hunk_fix_endian(868176, 149); | ||
362 | |||
363 | # | ||
364 | # Firmware 23, type: STD FW D2620 DTV6 QAM (0x00000068), id: (0000000000000000), size: 149 | ||
365 | # | ||
366 | |||
367 | write_le32(0x00000068); # Type | ||
368 | write_le64(0x00000000, 0x00000000); # ID | ||
369 | write_le32(149); # Size | ||
370 | write_hunk_fix_endian(868336, 149); | ||
371 | |||
372 | # | ||
373 | # Firmware 24, type: STD FW D2633 DTV6 QAM (0x00000070), id: (0000000000000000), size: 149 | ||
374 | # | ||
375 | |||
376 | write_le32(0x00000070); # Type | ||
377 | write_le64(0x00000000, 0x00000000); # ID | ||
378 | write_le32(149); # Size | ||
379 | write_hunk_fix_endian(868488, 149); | ||
380 | |||
381 | # | ||
382 | # Firmware 25, type: STD FW D2620 DTV7 (0x00000088), id: (0000000000000000), size: 149 | ||
383 | # | ||
384 | |||
385 | write_le32(0x00000088); # Type | ||
386 | write_le64(0x00000000, 0x00000000); # ID | ||
387 | write_le32(149); # Size | ||
388 | write_hunk_fix_endian(868648, 149); | ||
389 | |||
390 | # | ||
391 | # Firmware 26, type: STD FW D2633 DTV7 (0x00000090), id: (0000000000000000), size: 149 | ||
392 | # | ||
393 | |||
394 | write_le32(0x00000090); # Type | ||
395 | write_le64(0x00000000, 0x00000000); # ID | ||
396 | write_le32(149); # Size | ||
397 | write_hunk_fix_endian(868800, 149); | ||
398 | |||
399 | # | ||
400 | # Firmware 27, type: STD FW D2620 DTV78 (0x00000108), id: (0000000000000000), size: 149 | ||
401 | # | ||
402 | |||
403 | write_le32(0x00000108); # Type | ||
404 | write_le64(0x00000000, 0x00000000); # ID | ||
405 | write_le32(149); # Size | ||
406 | write_hunk_fix_endian(868960, 149); | ||
407 | |||
408 | # | ||
409 | # Firmware 28, type: STD FW D2633 DTV78 (0x00000110), id: (0000000000000000), size: 149 | ||
410 | # | ||
411 | |||
412 | write_le32(0x00000110); # Type | ||
413 | write_le64(0x00000000, 0x00000000); # ID | ||
414 | write_le32(149); # Size | ||
415 | write_hunk_fix_endian(869112, 149); | ||
416 | |||
417 | # | ||
418 | # Firmware 29, type: STD FW D2620 DTV8 (0x00000208), id: (0000000000000000), size: 149 | ||
419 | # | ||
420 | |||
421 | write_le32(0x00000208); # Type | ||
422 | write_le64(0x00000000, 0x00000000); # ID | ||
423 | write_le32(149); # Size | ||
424 | write_hunk_fix_endian(868648, 149); | ||
425 | |||
426 | # | ||
427 | # Firmware 30, type: STD FW D2633 DTV8 (0x00000210), id: (0000000000000000), size: 149 | ||
428 | # | ||
429 | |||
430 | write_le32(0x00000210); # Type | ||
431 | write_le64(0x00000000, 0x00000000); # ID | ||
432 | write_le32(149); # Size | ||
433 | write_hunk_fix_endian(868800, 149); | ||
434 | |||
435 | # | ||
436 | # Firmware 31, type: STD FW FM (0x00000400), id: (0000000000000000), size: 135 | ||
437 | # | ||
438 | |||
439 | write_le32(0x00000400); # Type | ||
440 | write_le64(0x00000000, 0x00000000); # ID | ||
441 | write_le32(135); # Size | ||
442 | write_hunk_fix_endian(869584, 135); | ||
443 | |||
444 | # | ||
445 | # Firmware 32, type: STD FW (0x00000000), id: PAL/I (0000000000000010), size: 161 | ||
446 | # | ||
447 | |||
448 | write_le32(0x00000000); # Type | ||
449 | write_le64(0x00000000, 0x00000010); # ID | ||
450 | write_le32(161); # Size | ||
451 | write_hunk_fix_endian(869728, 161); | ||
452 | |||
453 | # | ||
454 | # Firmware 33, type: STD FW MTS (0x00000004), id: PAL/I (0000000000000010), size: 169 | ||
455 | # | ||
456 | |||
457 | write_le32(0x00000004); # Type | ||
458 | write_le64(0x00000000, 0x00000010); # ID | ||
459 | write_le32(169); # Size | ||
460 | write_hunk_fix_endian(869896, 169); | ||
461 | |||
462 | # | ||
463 | # Firmware 34, type: STD FW (0x00000000), id: SECAM/L AM (0000001000400000), size: 169 | ||
464 | # | ||
465 | |||
466 | write_le32(0x00000000); # Type | ||
467 | write_le64(0x00000010, 0x00400000); # ID | ||
468 | write_le32(169); # Size | ||
469 | write_hunk_fix_endian(870072, 169); | ||
470 | |||
471 | # | ||
472 | # Firmware 35, type: STD FW (0x00000000), id: SECAM/L NICAM (0000000c00400000), size: 161 | ||
473 | # | ||
474 | |||
475 | write_le32(0x00000000); # Type | ||
476 | write_le64(0x0000000c, 0x00400000); # ID | ||
477 | write_le32(161); # Size | ||
478 | write_hunk_fix_endian(870248, 161); | ||
479 | |||
480 | # | ||
481 | # Firmware 36, type: STD FW (0x00000000), id: SECAM/Lc (0000000000800000), size: 161 | ||
482 | # | ||
483 | |||
484 | write_le32(0x00000000); # Type | ||
485 | write_le64(0x00000000, 0x00800000); # ID | ||
486 | write_le32(161); # Size | ||
487 | write_hunk_fix_endian(870416, 161); | ||
488 | |||
489 | # | ||
490 | # Firmware 37, type: STD FW (0x00000000), id: NTSC/M Kr (0000000000008000), size: 161 | ||
491 | # | ||
492 | |||
493 | write_le32(0x00000000); # Type | ||
494 | write_le64(0x00000000, 0x00008000); # ID | ||
495 | write_le32(161); # Size | ||
496 | write_hunk_fix_endian(870584, 161); | ||
497 | |||
498 | # | ||
499 | # Firmware 38, type: STD FW LCD (0x00001000), id: NTSC/M Kr (0000000000008000), size: 161 | ||
500 | # | ||
501 | |||
502 | write_le32(0x00001000); # Type | ||
503 | write_le64(0x00000000, 0x00008000); # ID | ||
504 | write_le32(161); # Size | ||
505 | write_hunk_fix_endian(870752, 161); | ||
506 | |||
507 | # | ||
508 | # Firmware 39, type: STD FW LCD NOGD (0x00003000), id: NTSC/M Kr (0000000000008000), size: 161 | ||
509 | # | ||
510 | |||
511 | write_le32(0x00003000); # Type | ||
512 | write_le64(0x00000000, 0x00008000); # ID | ||
513 | write_le32(161); # Size | ||
514 | write_hunk_fix_endian(870920, 161); | ||
515 | |||
516 | # | ||
517 | # Firmware 40, type: STD FW MTS (0x00000004), id: NTSC/M Kr (0000000000008000), size: 169 | ||
518 | # | ||
519 | |||
520 | write_le32(0x00000004); # Type | ||
521 | write_le64(0x00000000, 0x00008000); # ID | ||
522 | write_le32(169); # Size | ||
523 | write_hunk_fix_endian(871088, 169); | ||
524 | |||
525 | # | ||
526 | # Firmware 41, type: STD FW (0x00000000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161 | ||
527 | # | ||
528 | |||
529 | write_le32(0x00000000); # Type | ||
530 | write_le64(0x00000000, 0x0000b700); # ID | ||
531 | write_le32(161); # Size | ||
532 | write_hunk_fix_endian(871264, 161); | ||
533 | |||
534 | # | ||
535 | # Firmware 42, type: STD FW LCD (0x00001000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161 | ||
536 | # | ||
537 | |||
538 | write_le32(0x00001000); # Type | ||
539 | write_le64(0x00000000, 0x0000b700); # ID | ||
540 | write_le32(161); # Size | ||
541 | write_hunk_fix_endian(871432, 161); | ||
542 | |||
543 | # | ||
544 | # Firmware 43, type: STD FW LCD NOGD (0x00003000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161 | ||
545 | # | ||
546 | |||
547 | write_le32(0x00003000); # Type | ||
548 | write_le64(0x00000000, 0x0000b700); # ID | ||
549 | write_le32(161); # Size | ||
550 | write_hunk_fix_endian(871600, 161); | ||
551 | |||
552 | # | ||
553 | # Firmware 44, type: STD FW (0x00000000), id: NTSC/M Jp (0000000000002000), size: 161 | ||
554 | # | ||
555 | |||
556 | write_le32(0x00000000); # Type | ||
557 | write_le64(0x00000000, 0x00002000); # ID | ||
558 | write_le32(161); # Size | ||
559 | write_hunk_fix_endian(871264, 161); | ||
560 | |||
561 | # | ||
562 | # Firmware 45, type: STD FW MTS (0x00000004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169 | ||
563 | # | ||
564 | |||
565 | write_le32(0x00000004); # Type | ||
566 | write_le64(0x00000000, 0x0000b700); # ID | ||
567 | write_le32(169); # Size | ||
568 | write_hunk_fix_endian(871936, 169); | ||
569 | |||
570 | # | ||
571 | # Firmware 46, type: STD FW MTS LCD (0x00001004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169 | ||
572 | # | ||
573 | |||
574 | write_le32(0x00001004); # Type | ||
575 | write_le64(0x00000000, 0x0000b700); # ID | ||
576 | write_le32(169); # Size | ||
577 | write_hunk_fix_endian(872112, 169); | ||
578 | |||
579 | # | ||
580 | # Firmware 47, type: STD FW MTS LCD NOGD (0x00003004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169 | ||
581 | # | ||
582 | |||
583 | write_le32(0x00003004); # Type | ||
584 | write_le64(0x00000000, 0x0000b700); # ID | ||
585 | write_le32(169); # Size | ||
586 | write_hunk_fix_endian(872288, 169); | ||
587 | |||
588 | # | ||
589 | # Firmware 48, type: SCODE FW HAS IF (0x60000000), IF = 3.28 MHz id: (0000000000000000), size: 192 | ||
590 | # | ||
591 | |||
592 | write_le32(0x60000000); # Type | ||
593 | write_le64(0x00000000, 0x00000000); # ID | ||
594 | write_le16(3280); # IF | ||
595 | write_le32(192); # Size | ||
596 | write_hunk(811896, 192); | ||
597 | |||
598 | # | ||
599 | # Firmware 49, type: SCODE FW HAS IF (0x60000000), IF = 3.30 MHz id: (0000000000000000), size: 192 | ||
600 | # | ||
601 | |||
602 | write_le32(0x60000000); # Type | ||
603 | write_le64(0x00000000, 0x00000000); # ID | ||
604 | write_le16(3300); # IF | ||
605 | write_le32(192); # Size | ||
606 | write_hunk(813048, 192); | ||
607 | |||
608 | # | ||
609 | # Firmware 50, type: SCODE FW HAS IF (0x60000000), IF = 3.44 MHz id: (0000000000000000), size: 192 | ||
610 | # | ||
611 | |||
612 | write_le32(0x60000000); # Type | ||
613 | write_le64(0x00000000, 0x00000000); # ID | ||
614 | write_le16(3440); # IF | ||
615 | write_le32(192); # Size | ||
616 | write_hunk(812280, 192); | ||
617 | |||
618 | # | ||
619 | # Firmware 51, type: SCODE FW HAS IF (0x60000000), IF = 3.46 MHz id: (0000000000000000), size: 192 | ||
620 | # | ||
621 | |||
622 | write_le32(0x60000000); # Type | ||
623 | write_le64(0x00000000, 0x00000000); # ID | ||
624 | write_le16(3460); # IF | ||
625 | write_le32(192); # Size | ||
626 | write_hunk(812472, 192); | ||
627 | |||
628 | # | ||
629 | # Firmware 52, type: SCODE FW DTV6 ATSC OREN36 HAS IF (0x60210020), IF = 3.80 MHz id: (0000000000000000), size: 192 | ||
630 | # | ||
631 | |||
632 | write_le32(0x60210020); # Type | ||
633 | write_le64(0x00000000, 0x00000000); # ID | ||
634 | write_le16(3800); # IF | ||
635 | write_le32(192); # Size | ||
636 | write_hunk(809784, 192); | ||
637 | |||
638 | # | ||
639 | # Firmware 53, type: SCODE FW HAS IF (0x60000000), IF = 4.00 MHz id: (0000000000000000), size: 192 | ||
640 | # | ||
641 | |||
642 | write_le32(0x60000000); # Type | ||
643 | write_le64(0x00000000, 0x00000000); # ID | ||
644 | write_le16(4000); # IF | ||
645 | write_le32(192); # Size | ||
646 | write_hunk(812088, 192); | ||
647 | |||
648 | # | ||
649 | # Firmware 54, type: SCODE FW DTV6 ATSC TOYOTA388 HAS IF (0x60410020), IF = 4.08 MHz id: (0000000000000000), size: 192 | ||
650 | # | ||
651 | |||
652 | write_le32(0x60410020); # Type | ||
653 | write_le64(0x00000000, 0x00000000); # ID | ||
654 | write_le16(4080); # IF | ||
655 | write_le32(192); # Size | ||
656 | write_hunk(809976, 192); | ||
657 | |||
658 | # | ||
659 | # Firmware 55, type: SCODE FW HAS IF (0x60000000), IF = 4.20 MHz id: (0000000000000000), size: 192 | ||
660 | # | ||
661 | |||
662 | write_le32(0x60000000); # Type | ||
663 | write_le64(0x00000000, 0x00000000); # ID | ||
664 | write_le16(4200); # IF | ||
665 | write_le32(192); # Size | ||
666 | write_hunk(811704, 192); | ||
667 | |||
668 | # | ||
669 | # Firmware 56, type: SCODE FW MONO HAS IF (0x60008000), IF = 4.32 MHz id: NTSC/M Kr (0000000000008000), size: 192 | ||
670 | # | ||
671 | |||
672 | write_le32(0x60008000); # Type | ||
673 | write_le64(0x00000000, 0x00008000); # ID | ||
674 | write_le16(4320); # IF | ||
675 | write_le32(192); # Size | ||
676 | write_hunk(808056, 192); | ||
677 | |||
678 | # | ||
679 | # Firmware 57, type: SCODE FW HAS IF (0x60000000), IF = 4.45 MHz id: (0000000000000000), size: 192 | ||
680 | # | ||
681 | |||
682 | write_le32(0x60000000); # Type | ||
683 | write_le64(0x00000000, 0x00000000); # ID | ||
684 | write_le16(4450); # IF | ||
685 | write_le32(192); # Size | ||
686 | write_hunk(812664, 192); | ||
687 | |||
688 | # | ||
689 | # Firmware 58, type: SCODE FW HAS IF (0x60000000), IF = 4.50 MHz id: NTSC/M Jp (0000000000002000), size: 192 | ||
690 | # | ||
691 | |||
692 | write_le32(0x60000000); # Type | ||
693 | write_le64(0x00000000, 0x00002000); # ID | ||
694 | write_le16(4500); # IF | ||
695 | write_le32(192); # Size | ||
696 | write_hunk(807672, 192); | ||
697 | |||
698 | # | ||
699 | # Firmware 59, type: SCODE FW LCD NOGD IF HAS IF (0x60023000), IF = 4.60 MHz id: NTSC/M Kr (0000000000008000), size: 192 | ||
700 | # | ||
701 | |||
702 | write_le32(0x60023000); # Type | ||
703 | write_le64(0x00000000, 0x00008000); # ID | ||
704 | write_le16(4600); # IF | ||
705 | write_le32(192); # Size | ||
706 | write_hunk(807864, 192); | ||
707 | |||
708 | # | ||
709 | # Firmware 60, type: SCODE FW DTV78 ZARLINK456 HAS IF (0x62000100), IF = 4.76 MHz id: (0000000000000000), size: 192 | ||
710 | # | ||
711 | |||
712 | write_le32(0x62000100); # Type | ||
713 | write_le64(0x00000000, 0x00000000); # ID | ||
714 | write_le16(4760); # IF | ||
715 | write_le32(192); # Size | ||
716 | write_hunk(807288, 192); | ||
717 | |||
718 | # | ||
719 | # Firmware 61, type: SCODE FW HAS IF (0x60000000), IF = 4.94 MHz id: (0000000000000000), size: 192 | ||
720 | # | ||
721 | |||
722 | write_le32(0x60000000); # Type | ||
723 | write_le64(0x00000000, 0x00000000); # ID | ||
724 | write_le16(4940); # IF | ||
725 | write_le32(192); # Size | ||
726 | write_hunk(811512, 192); | ||
727 | |||
728 | # | ||
729 | # Firmware 62, type: SCODE FW DTV7 ZARLINK456 HAS IF (0x62000080), IF = 5.26 MHz id: (0000000000000000), size: 192 | ||
730 | # | ||
731 | |||
732 | write_le32(0x62000080); # Type | ||
733 | write_le64(0x00000000, 0x00000000); # ID | ||
734 | write_le16(5260); # IF | ||
735 | write_le32(192); # Size | ||
736 | write_hunk(810552, 192); | ||
737 | |||
738 | # | ||
739 | # Firmware 63, type: SCODE FW MONO HAS IF (0x60008000), IF = 5.32 MHz id: PAL/BG NICAM/B (0000000800000007), size: 192 | ||
740 | # | ||
741 | |||
742 | write_le32(0x60008000); # Type | ||
743 | write_le64(0x00000008, 0x00000007); # ID | ||
744 | write_le16(5320); # IF | ||
745 | write_le32(192); # Size | ||
746 | write_hunk(810744, 192); | ||
747 | |||
748 | # | ||
749 | # Firmware 64, type: SCODE FW DTV8 CHINA HAS IF (0x64000200), IF = 5.40 MHz id: (0000000000000000), size: 192 | ||
750 | # | ||
751 | |||
752 | write_le32(0x64000200); # Type | ||
753 | write_le64(0x00000000, 0x00000000); # ID | ||
754 | write_le16(5400); # IF | ||
755 | write_le32(192); # Size | ||
756 | write_hunk(807096, 192); | ||
757 | |||
758 | # | ||
759 | # Firmware 65, type: SCODE FW DTV6 ATSC OREN538 HAS IF (0x60110020), IF = 5.58 MHz id: (0000000000000000), size: 192 | ||
760 | # | ||
761 | |||
762 | write_le32(0x60110020); # Type | ||
763 | write_le64(0x00000000, 0x00000000); # ID | ||
764 | write_le16(5580); # IF | ||
765 | write_le32(192); # Size | ||
766 | write_hunk(809592, 192); | ||
767 | |||
768 | # | ||
769 | # Firmware 66, type: SCODE FW HAS IF (0x60000000), IF = 5.64 MHz id: PAL/BG A2/B (0000000200000007), size: 192 | ||
770 | # | ||
771 | |||
772 | write_le32(0x60000000); # Type | ||
773 | write_le64(0x00000002, 0x00000007); # ID | ||
774 | write_le16(5640); # IF | ||
775 | write_le32(192); # Size | ||
776 | write_hunk(808440, 192); | ||
777 | |||
778 | # | ||
779 | # Firmware 67, type: SCODE FW HAS IF (0x60000000), IF = 5.74 MHz id: PAL/BG NICAM/B (0000000800000007), size: 192 | ||
780 | # | ||
781 | |||
782 | write_le32(0x60000000); # Type | ||
783 | write_le64(0x00000008, 0x00000007); # ID | ||
784 | write_le16(5740); # IF | ||
785 | write_le32(192); # Size | ||
786 | write_hunk(808632, 192); | ||
787 | |||
788 | # | ||
789 | # Firmware 68, type: SCODE FW DTV7 DIBCOM52 HAS IF (0x61000080), IF = 5.90 MHz id: (0000000000000000), size: 192 | ||
790 | # | ||
791 | |||
792 | write_le32(0x61000080); # Type | ||
793 | write_le64(0x00000000, 0x00000000); # ID | ||
794 | write_le16(5900); # IF | ||
795 | write_le32(192); # Size | ||
796 | write_hunk(810360, 192); | ||
797 | |||
798 | # | ||
799 | # Firmware 69, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.00 MHz id: PAL/I (0000000000000010), size: 192 | ||
800 | # | ||
801 | |||
802 | write_le32(0x60008000); # Type | ||
803 | write_le64(0x00000000, 0x00000010); # ID | ||
804 | write_le16(6000); # IF | ||
805 | write_le32(192); # Size | ||
806 | write_hunk(808824, 192); | ||
807 | |||
808 | # | ||
809 | # Firmware 70, type: SCODE FW DTV6 QAM F6MHZ HAS IF (0x68000060), IF = 6.20 MHz id: (0000000000000000), size: 192 | ||
810 | # | ||
811 | |||
812 | write_le32(0x68000060); # Type | ||
813 | write_le64(0x00000000, 0x00000000); # ID | ||
814 | write_le16(6200); # IF | ||
815 | write_le32(192); # Size | ||
816 | write_hunk(809400, 192); | ||
817 | |||
818 | # | ||
819 | # Firmware 71, type: SCODE FW HAS IF (0x60000000), IF = 6.24 MHz id: PAL/I (0000000000000010), size: 192 | ||
820 | # | ||
821 | |||
822 | write_le32(0x60000000); # Type | ||
823 | write_le64(0x00000000, 0x00000010); # ID | ||
824 | write_le16(6240); # IF | ||
825 | write_le32(192); # Size | ||
826 | write_hunk(808248, 192); | ||
827 | |||
828 | # | ||
829 | # Firmware 72, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.32 MHz id: SECAM/K1 (0000000000200000), size: 192 | ||
830 | # | ||
831 | |||
832 | write_le32(0x60008000); # Type | ||
833 | write_le64(0x00000000, 0x00200000); # ID | ||
834 | write_le16(6320); # IF | ||
835 | write_le32(192); # Size | ||
836 | write_hunk(811320, 192); | ||
837 | |||
838 | # | ||
839 | # Firmware 73, type: SCODE FW HAS IF (0x60000000), IF = 6.34 MHz id: SECAM/K1 (0000000000200000), size: 192 | ||
840 | # | ||
841 | |||
842 | write_le32(0x60000000); # Type | ||
843 | write_le64(0x00000000, 0x00200000); # ID | ||
844 | write_le16(6340); # IF | ||
845 | write_le32(192); # Size | ||
846 | write_hunk(809208, 192); | ||
847 | |||
848 | # | ||
849 | # Firmware 74, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.50 MHz id: SECAM/K3 (0000000004000000), size: 192 | ||
850 | # | ||
851 | |||
852 | write_le32(0x60008000); # Type | ||
853 | write_le64(0x00000000, 0x04000000); # ID | ||
854 | write_le16(6500); # IF | ||
855 | write_le32(192); # Size | ||
856 | write_hunk(811128, 192); | ||
857 | |||
858 | # | ||
859 | # Firmware 75, type: SCODE FW DTV6 ATSC ATI638 HAS IF (0x60090020), IF = 6.58 MHz id: (0000000000000000), size: 192 | ||
860 | # | ||
861 | |||
862 | write_le32(0x60090020); # Type | ||
863 | write_le64(0x00000000, 0x00000000); # ID | ||
864 | write_le16(6580); # IF | ||
865 | write_le32(192); # Size | ||
866 | write_hunk(807480, 192); | ||
867 | |||
868 | # | ||
869 | # Firmware 76, type: SCODE FW HAS IF (0x60000000), IF = 6.60 MHz id: PAL/DK A2 (00000003000000e0), size: 192 | ||
870 | # | ||
871 | |||
872 | write_le32(0x60000000); # Type | ||
873 | write_le64(0x00000003, 0x000000e0); # ID | ||
874 | write_le16(6600); # IF | ||
875 | write_le32(192); # Size | ||
876 | write_hunk(809016, 192); | ||
877 | |||
878 | # | ||
879 | # Firmware 77, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.68 MHz id: PAL/DK A2 (00000003000000e0), size: 192 | ||
880 | # | ||
881 | |||
882 | write_le32(0x60008000); # Type | ||
883 | write_le64(0x00000003, 0x000000e0); # ID | ||
884 | write_le16(6680); # IF | ||
885 | write_le32(192); # Size | ||
886 | write_hunk(810936, 192); | ||
887 | |||
888 | # | ||
889 | # Firmware 78, type: SCODE FW DTV6 ATSC TOYOTA794 HAS IF (0x60810020), IF = 8.14 MHz id: (0000000000000000), size: 192 | ||
890 | # | ||
891 | |||
892 | write_le32(0x60810020); # Type | ||
893 | write_le64(0x00000000, 0x00000000); # ID | ||
894 | write_le16(8140); # IF | ||
895 | write_le32(192); # Size | ||
896 | write_hunk(810168, 192); | ||
897 | |||
898 | # | ||
899 | # Firmware 79, type: SCODE FW HAS IF (0x60000000), IF = 8.20 MHz id: (0000000000000000), size: 192 | ||
900 | # | ||
901 | |||
902 | write_le32(0x60000000); # Type | ||
903 | write_le64(0x00000000, 0x00000000); # ID | ||
904 | write_le16(8200); # IF | ||
905 | write_le32(192); # Size | ||
906 | write_hunk(812856, 192); | ||
907 | } | ||
908 | |||
909 | sub extract_firmware { | ||
910 | my $sourcefile = "hcw85bda.sys"; | ||
911 | my $hash = "0e44dbf63bb0169d57446aec21881ff2"; | ||
912 | my $outfile = "xc3028-v27.fw"; | ||
913 | my $name = "xc2028 firmware"; | ||
914 | my $version = 519; | ||
915 | my $nr_desc = 80; | ||
916 | my $out; | ||
917 | |||
918 | verify($sourcefile, $hash); | ||
919 | |||
920 | open INFILE, "<$sourcefile"; | ||
921 | main_firmware($outfile, $name, $version, $nr_desc); | ||
922 | close INFILE; | ||
923 | } | ||
924 | |||
925 | extract_firmware; | ||
926 | printf "Firmwares generated.\n"; | ||
diff --git a/Documentation/video4linux/sn9c102.txt b/Documentation/video4linux/sn9c102.txt index 1ffad19ce891..b26f5195af51 100644 --- a/Documentation/video4linux/sn9c102.txt +++ b/Documentation/video4linux/sn9c102.txt | |||
@@ -568,6 +568,7 @@ the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'. | |||
568 | Many thanks to following persons for their contribute (listed in alphabetical | 568 | Many thanks to following persons for their contribute (listed in alphabetical |
569 | order): | 569 | order): |
570 | 570 | ||
571 | - David Anderson for the donation of a webcam; | ||
571 | - Luca Capello for the donation of a webcam; | 572 | - Luca Capello for the donation of a webcam; |
572 | - Philippe Coval for having helped testing the PAS202BCA image sensor; | 573 | - Philippe Coval for having helped testing the PAS202BCA image sensor; |
573 | - Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the | 574 | - Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the |
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index 51ccc48aa763..f962d01bea2a 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
@@ -30,9 +30,10 @@ alignment and size of the arguments to the above system calls. | |||
30 | The output of "cat /proc/meminfo" will have lines like: | 30 | The output of "cat /proc/meminfo" will have lines like: |
31 | 31 | ||
32 | ..... | 32 | ..... |
33 | HugePages_Total: xxx | 33 | HugePages_Total: vvv |
34 | HugePages_Free: yyy | 34 | HugePages_Free: www |
35 | HugePages_Rsvd: www | 35 | HugePages_Rsvd: xxx |
36 | HugePages_Surp: yyy | ||
36 | Hugepagesize: zzz kB | 37 | Hugepagesize: zzz kB |
37 | 38 | ||
38 | where: | 39 | where: |
@@ -42,6 +43,10 @@ allocated. | |||
42 | HugePages_Rsvd is short for "reserved," and is the number of hugepages | 43 | HugePages_Rsvd is short for "reserved," and is the number of hugepages |
43 | for which a commitment to allocate from the pool has been made, but no | 44 | for which a commitment to allocate from the pool has been made, but no |
44 | allocation has yet been made. It's vaguely analogous to overcommit. | 45 | allocation has yet been made. It's vaguely analogous to overcommit. |
46 | HugePages_Surp is short for "surplus," and is the number of hugepages in | ||
47 | the pool above the value in /proc/sys/vm/nr_hugepages. The maximum | ||
48 | number of surplus hugepages is controlled by | ||
49 | /proc/sys/vm/nr_overcommit_hugepages. | ||
45 | 50 | ||
46 | /proc/filesystems should also show a filesystem of type "hugetlbfs" configured | 51 | /proc/filesystems should also show a filesystem of type "hugetlbfs" configured |
47 | in the kernel. | 52 | in the kernel. |
@@ -71,7 +76,25 @@ or failure of allocation depends on the amount of physically contiguous | |||
71 | memory that is preset in system at this time. System administrators may want | 76 | memory that is preset in system at this time. System administrators may want |
72 | to put this command in one of the local rc init files. This will enable the | 77 | to put this command in one of the local rc init files. This will enable the |
73 | kernel to request huge pages early in the boot process (when the possibility | 78 | kernel to request huge pages early in the boot process (when the possibility |
74 | of getting physical contiguous pages is still very high). | 79 | of getting physical contiguous pages is still very high). In either |
80 | case, adminstrators will want to verify the number of hugepages actually | ||
81 | allocated by checking the sysctl or meminfo. | ||
82 | |||
83 | /proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of | ||
84 | hugepages can grow, if more hugepages than /proc/sys/vm/nr_hugepages are | ||
85 | requested by applications. echo'ing any non-zero value into this file | ||
86 | indicates that the hugetlb subsystem is allowed to try to obtain | ||
87 | hugepages from the buddy allocator, if the normal pool is exhausted. As | ||
88 | these surplus hugepages go out of use, they are freed back to the buddy | ||
89 | allocator. | ||
90 | |||
91 | Caveat: Shrinking the pool via nr_hugepages while a surplus is in effect | ||
92 | will allow the number of surplus huge pages to exceed the overcommit | ||
93 | value, as the pool hugepages (which must have been in use for a surplus | ||
94 | hugepages to be allocated) will become surplus hugepages. As long as | ||
95 | this condition holds, however, no more surplus huge pages will be | ||
96 | allowed on the system until one of the two sysctls are increased | ||
97 | sufficiently, or the surplus huge pages go out of use and are freed. | ||
75 | 98 | ||
76 | If the user applications are going to request hugepages using mmap system | 99 | If the user applications are going to request hugepages using mmap system |
77 | call, then it is required that system administrator mount a file system of | 100 | call, then it is required that system administrator mount a file system of |
@@ -94,8 +117,8 @@ provided on command line then no limits are set. For size and nr_inodes | |||
94 | options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For | 117 | options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For |
95 | example, size=2K has the same meaning as size=2048. | 118 | example, size=2K has the same meaning as size=2048. |
96 | 119 | ||
97 | read and write system calls are not supported on files that reside on hugetlb | 120 | While read system calls are supported on files that reside on hugetlb |
98 | file systems. | 121 | file systems, write system calls are not. |
99 | 122 | ||
100 | Regular chown, chgrp, and chmod commands (with right permissions) could be | 123 | Regular chown, chgrp, and chmod commands (with right permissions) could be |
101 | used to change the file attributes on hugetlbfs. | 124 | used to change the file attributes on hugetlbfs. |
diff --git a/Documentation/vm/slabinfo.c b/Documentation/vm/slabinfo.c index 7047696c47a1..488c1f31b992 100644 --- a/Documentation/vm/slabinfo.c +++ b/Documentation/vm/slabinfo.c | |||
@@ -1021,7 +1021,7 @@ void read_slab_dir(void) | |||
1021 | char *t; | 1021 | char *t; |
1022 | int count; | 1022 | int count; |
1023 | 1023 | ||
1024 | if (chdir("/sys/slab")) | 1024 | if (chdir("/sys/kernel/slab")) |
1025 | fatal("SYSFS support for SLUB not active\n"); | 1025 | fatal("SYSFS support for SLUB not active\n"); |
1026 | 1026 | ||
1027 | dir = opendir("."); | 1027 | dir = opendir("."); |
diff --git a/Documentation/vm/slub.txt b/Documentation/vm/slub.txt index d17f324db9f5..dcf8bcf846d6 100644 --- a/Documentation/vm/slub.txt +++ b/Documentation/vm/slub.txt | |||
@@ -63,7 +63,7 @@ In case you forgot to enable debugging on the kernel command line: It is | |||
63 | possible to enable debugging manually when the kernel is up. Look at the | 63 | possible to enable debugging manually when the kernel is up. Look at the |
64 | contents of: | 64 | contents of: |
65 | 65 | ||
66 | /sys/slab/<slab name>/ | 66 | /sys/kernel/slab/<slab name>/ |
67 | 67 | ||
68 | Look at the writable files. Writing 1 to them will enable the | 68 | Look at the writable files. Writing 1 to them will enable the |
69 | corresponding debug option. All options can be set on a slab that does | 69 | corresponding debug option. All options can be set on a slab that does |
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. |
5 | ds2490 | 5 | ds2490 |
6 | - The Maxim/Dallas Semiconductor DS2490 builds USB <-> W1 bridges. | 6 | - The Maxim/Dallas Semiconductor DS2490 builds USB <-> W1 bridges. |
7 | w1-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 @@ | |||
1 | Kernel driver w1-gpio | ||
2 | ===================== | ||
3 | |||
4 | Author: Ville Syrjala <syrjala@sci.fi> | ||
5 | |||
6 | |||
7 | Description | ||
8 | ----------- | ||
9 | |||
10 | GPIO 1-wire bus master driver. The driver uses the GPIO API to control the | ||
11 | wire and the GPIO pin can be specified using platform data. | ||
12 | |||
13 | |||
14 | Example (mach-at91) | ||
15 | ------------------- | ||
16 | |||
17 | #include <linux/w1-gpio.h> | ||
18 | |||
19 | static struct w1_gpio_platform_data foo_w1_gpio_pdata = { | ||
20 | .pin = AT91_PIN_PB20, | ||
21 | .is_open_drain = 1, | ||
22 | }; | ||
23 | |||
24 | static 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/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt index bb7cb1d31ec7..4cc4ba9d7150 100644 --- a/Documentation/watchdog/watchdog-api.txt +++ b/Documentation/watchdog/watchdog-api.txt | |||
@@ -42,23 +42,27 @@ like this source file: see Documentation/watchdog/src/watchdog-simple.c | |||
42 | A more advanced driver could for example check that a HTTP server is | 42 | A more advanced driver could for example check that a HTTP server is |
43 | still responding before doing the write call to ping the watchdog. | 43 | still responding before doing the write call to ping the watchdog. |
44 | 44 | ||
45 | When the device is closed, the watchdog is disabled. This is not | 45 | When the device is closed, the watchdog is disabled, unless the "Magic |
46 | always such a good idea, since if there is a bug in the watchdog | 46 | Close" feature is supported (see below). This is not always such a |
47 | daemon and it crashes the system will not reboot. Because of this, | 47 | good idea, since if there is a bug in the watchdog daemon and it |
48 | some of the drivers support the configuration option "Disable watchdog | 48 | crashes the system will not reboot. Because of this, some of the |
49 | shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when | 49 | drivers support the configuration option "Disable watchdog shutdown on |
50 | compiling the kernel, there is no way of disabling the watchdog once | 50 | close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when compiling |
51 | it has been started. So, if the watchdog daemon crashes, the system | 51 | the kernel, there is no way of disabling the watchdog once it has been |
52 | will reboot after the timeout has passed. Watchdog devices also usually | 52 | started. So, if the watchdog daemon crashes, the system will reboot |
53 | support the nowayout module parameter so that this option can be controlled | 53 | after the timeout has passed. Watchdog devices also usually support |
54 | at runtime. | 54 | the nowayout module parameter so that this option can be controlled at |
55 | 55 | runtime. | |
56 | Drivers will not disable the watchdog, unless a specific magic character 'V' | 56 | |
57 | has been sent /dev/watchdog just before closing the file. If the userspace | 57 | Magic Close feature: |
58 | daemon closes the file without sending this special character, the driver | 58 | |
59 | will assume that the daemon (and userspace in general) died, and will stop | 59 | If a driver supports "Magic Close", the driver will not disable the |
60 | pinging the watchdog without disabling it first. This will then cause a | 60 | watchdog unless a specific magic character 'V' has been sent to |
61 | reboot if the watchdog is not re-opened in sufficient time. | 61 | /dev/watchdog just before closing the file. If the userspace daemon |
62 | closes the file without sending this special character, the driver | ||
63 | will assume that the daemon (and userspace in general) died, and will | ||
64 | stop pinging the watchdog without disabling it first. This will then | ||
65 | cause a reboot if the watchdog is not re-opened in sufficient time. | ||
62 | 66 | ||
63 | The ioctl API: | 67 | The ioctl API: |
64 | 68 | ||
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 @@ | |||
1 | 00-INDEX | ||
2 | - This file | ||
3 | boot-options.txt | ||
4 | - AMD64-specific boot options. | ||
5 | cpu-hotplug-spec | ||
6 | - Firmware support for CPU hotplug under Linux/x86-64 | ||
7 | fake-numa-for-cpusets | ||
8 | - Using numa=fake and CPUSets for Resource Management | ||
9 | kernel-stacks | ||
10 | - Context-specific per-processor interrupt stacks. | ||
11 | machinecheck | ||
12 | - Configurable sysfs parameters for the x86-64 machine check code. | ||
13 | mm.txt | ||
14 | - Memory layout of x86-64 (4 level page tables, 46 bits physical). | ||
15 | uefi.txt | ||
16 | - Booting Linux via Unified Extensible Firmware Interface. | ||
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index 945311840a10..34abae4e9442 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -110,12 +110,18 @@ Idle loop | |||
110 | 110 | ||
111 | Rebooting | 111 | Rebooting |
112 | 112 | ||
113 | reboot=b[ios] | t[riple] | k[bd] [, [w]arm | [c]old] | 113 | reboot=b[ios] | t[riple] | k[bd] | a[cpi] | e[fi] [, [w]arm | [c]old] |
114 | bios Use the CPU reboot vector for warm reset | 114 | bios Use the CPU reboot vector for warm reset |
115 | warm Don't set the cold reboot flag | 115 | warm Don't set the cold reboot flag |
116 | cold Set the cold reboot flag | 116 | cold Set the cold reboot flag |
117 | triple Force a triple fault (init) | 117 | triple Force a triple fault (init) |
118 | kbd Use the keyboard controller. cold reset (default) | 118 | kbd Use the keyboard controller. cold reset (default) |
119 | acpi Use the ACPI RESET_REG in the FADT. If ACPI is not configured or the | ||
120 | ACPI reset does not work, the reboot path attempts the reset using | ||
121 | the keyboard controller. | ||
122 | efi Use efi reset_system runtime service. If EFI is not configured or the | ||
123 | EFI reset does not work, the reboot path attempts the reset using | ||
124 | the keyboard controller. | ||
119 | 125 | ||
120 | Using warm reset will be much faster especially on big memory | 126 | Using warm reset will be much faster especially on big memory |
121 | systems because the BIOS will not go through the memory check. | 127 | systems because the BIOS will not go through the memory check. |
diff --git a/Documentation/x86_64/uefi.txt b/Documentation/x86_64/uefi.txt new file mode 100644 index 000000000000..7d77120a5184 --- /dev/null +++ b/Documentation/x86_64/uefi.txt | |||
@@ -0,0 +1,38 @@ | |||
1 | General note on [U]EFI x86_64 support | ||
2 | ------------------------------------- | ||
3 | |||
4 | The nomenclature EFI and UEFI are used interchangeably in this document. | ||
5 | |||
6 | Although the tools below are _not_ needed for building the kernel, | ||
7 | the needed bootloader support and associated tools for x86_64 platforms | ||
8 | with EFI firmware and specifications are listed below. | ||
9 | |||
10 | 1. UEFI specification: http://www.uefi.org | ||
11 | |||
12 | 2. Booting Linux kernel on UEFI x86_64 platform requires bootloader | ||
13 | support. Elilo with x86_64 support can be used. | ||
14 | |||
15 | 3. x86_64 platform with EFI/UEFI firmware. | ||
16 | |||
17 | Mechanics: | ||
18 | --------- | ||
19 | - Build the kernel with the following configuration. | ||
20 | CONFIG_FB_EFI=y | ||
21 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
22 | If EFI runtime services are expected, the following configuration should | ||
23 | be selected. | ||
24 | CONFIG_EFI=y | ||
25 | CONFIG_EFI_VARS=y or m # optional | ||
26 | - Create a VFAT partition on the disk | ||
27 | - Copy the following to the VFAT partition: | ||
28 | elilo bootloader with x86_64 support, elilo configuration file, | ||
29 | kernel image built in first step and corresponding | ||
30 | initrd. Instructions on building elilo and its dependencies | ||
31 | can be found in the elilo sourceforge project. | ||
32 | - Boot to EFI shell and invoke elilo choosing the kernel image built | ||
33 | in first step. | ||
34 | - If some or all EFI runtime services don't work, you can try following | ||
35 | kernel command line parameters to turn off some or all EFI runtime | ||
36 | services. | ||
37 | noefi turn off all EFI runtime services | ||
38 | reboot_type=k turn off EFI reboot runtime service | ||
diff --git a/Documentation/zh_CN/CodingStyle b/Documentation/zh_CN/CodingStyle new file mode 100644 index 000000000000..ecd9307a641f --- /dev/null +++ b/Documentation/zh_CN/CodingStyle | |||
@@ -0,0 +1,701 @@ | |||
1 | Chinese translated version of Documentation/CodingStyle | ||
2 | |||
3 | If you have any comment or update to the content, please post to LKML directly. | ||
4 | However, if you have problem communicating in English you can also ask the | ||
5 | Chinese maintainer for help. Contact the Chinese maintainer, if this | ||
6 | translation is outdated or there is problem with translation. | ||
7 | |||
8 | Chinese maintainer: Zhang Le <r0bertz@gentoo.org> | ||
9 | --------------------------------------------------------------------- | ||
10 | Documentation/CodingStyle的中文翻译 | ||
11 | |||
12 | 如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可 | ||
13 | 以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。 | ||
14 | |||
15 | 中文版维护者: 张乐 Zhang Le <r0bertz@gentoo.org> | ||
16 | 中文版翻译者: 张乐 Zhang Le <r0bertz@gentoo.org> | ||
17 | 中文版校译者: 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
18 | wheelz <kernel.zeng@gmail.com> | ||
19 | 管旭东 Xudong Guan <xudong.guan@gmail.com> | ||
20 | Li Zefan <lizf@cn.fujitsu.com> | ||
21 | Wang Chen <wangchen@cn.fujitsu.com> | ||
22 | 以下为正文 | ||
23 | --------------------------------------------------------------------- | ||
24 | |||
25 | Linux内核代码风格 | ||
26 | |||
27 | 这是一个简短的文档,描述了linux内核的首选代码风格。代码风格是因人而异的,而且我 | ||
28 | 不愿意把我的观点强加给任何人,不过这里所讲述的是我必须要维护的代码所遵守的风格, | ||
29 | 并且我也希望绝大多数其他代码也能遵守这个风格。请在写代码时至少考虑一下本文所述的 | ||
30 | 风格。 | ||
31 | |||
32 | 首先,我建议你打印一份GNU代码规范,然后不要读它。烧了它,这是一个具有重大象征性 | ||
33 | 意义的动作。 | ||
34 | |||
35 | 不管怎样,现在我们开始: | ||
36 | |||
37 | |||
38 | 第一章:缩进 | ||
39 | |||
40 | 制表符是8个字符,所以缩进也是8个字符。有些异端运动试图将缩进变为4(乃至2)个字符 | ||
41 | 深,这几乎相当于尝试将圆周率的值定义为3。 | ||
42 | |||
43 | 理由:缩进的全部意义就在于清楚的定义一个控制块起止于何处。尤其是当你盯着你的屏幕 | ||
44 | 连续看了20小时之后,你将会发现大一点的缩进会使你更容易分辨缩进。 | ||
45 | |||
46 | 现在,有些人会抱怨8个字符的缩进会使代码向右边移动的太远,在80个字符的终端屏幕上 | ||
47 | 就很难读这样的代码。这个问题的答案是,如果你需要3级以上的缩进,不管用何种方式你 | ||
48 | 的代码已经有问题了,应该修正你的程序。 | ||
49 | |||
50 | 简而言之,8个字符的缩进可以让代码更容易阅读,还有一个好处是当你的函数嵌套太深的 | ||
51 | 时候可以给你警告。留心这个警告。 | ||
52 | |||
53 | 在switch语句中消除多级缩进的首选的方式是让“switch”和从属于它的“case”标签对齐于同 | ||
54 | 一列,而不要“两次缩进”“case”标签。比如: | ||
55 | |||
56 | switch (suffix) { | ||
57 | case 'G': | ||
58 | case 'g': | ||
59 | mem <<= 30; | ||
60 | break; | ||
61 | case 'M': | ||
62 | case 'm': | ||
63 | mem <<= 20; | ||
64 | break; | ||
65 | case 'K': | ||
66 | case 'k': | ||
67 | mem <<= 10; | ||
68 | /* fall through */ | ||
69 | default: | ||
70 | break; | ||
71 | } | ||
72 | |||
73 | |||
74 | 不要把多个语句放在一行里,除非你有什么东西要隐藏: | ||
75 | |||
76 | if (condition) do_this; | ||
77 | do_something_everytime; | ||
78 | |||
79 | 也不要在一行里放多个赋值语句。内核代码风格超级简单。就是避免可能导致别人误读的表 | ||
80 | 达式。 | ||
81 | |||
82 | 除了注释、文档和Kconfig之外,不要使用空格来缩进,前面的例子是例外,是有意为之。 | ||
83 | |||
84 | 选用一个好的编辑器,不要在行尾留空格。 | ||
85 | |||
86 | |||
87 | 第二章:把长的行和字符串打散 | ||
88 | |||
89 | 代码风格的意义就在于使用平常使用的工具来维持代码的可读性和可维护性。 | ||
90 | |||
91 | 每一行的长度的限制是80列,我们强烈建议您遵守这个惯例。 | ||
92 | |||
93 | 长于80列的语句要打散成有意义的片段。每个片段要明显短于原来的语句,而且放置的位置 | ||
94 | 也明显的靠右。同样的规则也适用于有很长参数列表的函数头。长字符串也要打散成较短的 | ||
95 | 字符串。唯一的例外是超过80列可以大幅度提高可读性并且不会隐藏信息的情况。 | ||
96 | |||
97 | void fun(int a, int b, int c) | ||
98 | { | ||
99 | if (condition) | ||
100 | printk(KERN_WARNING "Warning this is a long printk with " | ||
101 | "3 parameters a: %u b: %u " | ||
102 | "c: %u \n", a, b, c); | ||
103 | else | ||
104 | next_statement; | ||
105 | } | ||
106 | |||
107 | 第三章:大括号和空格的放置 | ||
108 | |||
109 | C语言风格中另外一个常见问题是大括号的放置。和缩进大小不同,选择或弃用某种放置策 | ||
110 | 略并没有多少技术上的原因,不过首选的方式,就像Kernighan和Ritchie展示给我们的,是 | ||
111 | 把起始大括号放在行尾,而把结束大括号放在行首,所以: | ||
112 | |||
113 | if (x is true) { | ||
114 | we do y | ||
115 | } | ||
116 | |||
117 | 这适用于所有的非函数语句块(if、switch、for、while、do)。比如: | ||
118 | |||
119 | switch (action) { | ||
120 | case KOBJ_ADD: | ||
121 | return "add"; | ||
122 | case KOBJ_REMOVE: | ||
123 | return "remove"; | ||
124 | case KOBJ_CHANGE: | ||
125 | return "change"; | ||
126 | default: | ||
127 | return NULL; | ||
128 | } | ||
129 | |||
130 | 不过,有一个例外,那就是函数:函数的起始大括号放置于下一行的开头,所以: | ||
131 | |||
132 | int function(int x) | ||
133 | { | ||
134 | body of function | ||
135 | } | ||
136 | |||
137 | 全世界的异端可能会抱怨这个不一致性是……呃……不一致的,不过所有思维健全的人都知道( | ||
138 | a)K&R是_正确的_,并且(b)K&R是正确的。此外,不管怎样函数都是特殊的(在C语言中 | ||
139 | ,函数是不能嵌套的)。 | ||
140 | |||
141 | 注意结束大括号独自占据一行,除非它后面跟着同一个语句的剩余部分,也就是do语句中的 | ||
142 | “while”或者if语句中的“else”,像这样: | ||
143 | |||
144 | do { | ||
145 | body of do-loop | ||
146 | } while (condition); | ||
147 | |||
148 | 和 | ||
149 | |||
150 | if (x == y) { | ||
151 | .. | ||
152 | } else if (x > y) { | ||
153 | ... | ||
154 | } else { | ||
155 | .... | ||
156 | } | ||
157 | |||
158 | 理由:K&R。 | ||
159 | |||
160 | 也请注意这种大括号的放置方式也能使空(或者差不多空的)行的数量最小化,同时不失可 | ||
161 | 读性。因此,由于你的屏幕上的新行是不可再生资源(想想25行的终端屏幕),你将会有更 | ||
162 | 多的空行来放置注释。 | ||
163 | |||
164 | 当只有一个单独的语句的时候,不用加不必要的大括号。 | ||
165 | |||
166 | if (condition) | ||
167 | action(); | ||
168 | |||
169 | 这点不适用于本身为某个条件语句的一个分支的单独语句。这时需要在两个分支里都使用大 | ||
170 | 括号。 | ||
171 | |||
172 | if (condition) { | ||
173 | do_this(); | ||
174 | do_that(); | ||
175 | } else { | ||
176 | otherwise(); | ||
177 | } | ||
178 | |||
179 | 3.1:空格 | ||
180 | |||
181 | Linux内核的空格使用方式(主要)取决于它是用于函数还是关键字。(大多数)关键字后 | ||
182 | 要加一个空格。值得注意的例外是sizeof、typeof、alignof和__attribute__,这些关键字 | ||
183 | 某些程度上看起来更像函数(它们在Linux里也常常伴随小括号而使用,尽管在C语言里这样 | ||
184 | 的小括号不是必需的,就像“struct fileinfo info”声明过后的“sizeof info”)。 | ||
185 | |||
186 | 所以在这些关键字之后放一个空格: | ||
187 | if, switch, case, for, do, while | ||
188 | 但是不要在sizeof、typeof、alignof或者__attribute__这些关键字之后放空格。例如, | ||
189 | s = sizeof(struct file); | ||
190 | |||
191 | 不要在小括号里的表达式两侧加空格。这是一个反例: | ||
192 | |||
193 | s = sizeof( struct file ); | ||
194 | |||
195 | 当声明指针类型或者返回指针类型的函数时,“*”的首选使用方式是使之靠近变量名或者函 | ||
196 | 数名,而不是靠近类型名。例子: | ||
197 | |||
198 | char *linux_banner; | ||
199 | unsigned long long memparse(char *ptr, char **retptr); | ||
200 | char *match_strdup(substring_t *s); | ||
201 | |||
202 | 在大多数二元和三元操作符两侧使用一个空格,例如下面所有这些操作符: | ||
203 | |||
204 | = + - < > * / % | & ^ <= >= == != ? : | ||
205 | |||
206 | 但是一元操作符后不要加空格: | ||
207 | & * + - ~ ! sizeof typeof alignof __attribute__ defined | ||
208 | |||
209 | 后缀自加和自减一元操作符前不加空格: | ||
210 | ++ -- | ||
211 | |||
212 | 前缀自加和自减一元操作符后不加空格: | ||
213 | ++ -- | ||
214 | |||
215 | “.”和“->”结构体成员操作符前后不加空格。 | ||
216 | |||
217 | 不要在行尾留空白。有些可以自动缩进的编辑器会在新行的行首加入适量的空白,然后你 | ||
218 | 就可以直接在那一行输入代码。不过假如你最后没有在那一行输入代码,有些编辑器就不 | ||
219 | 会移除已经加入的空白,就像你故意留下一个只有空白的行。包含行尾空白的行就这样产 | ||
220 | 生了。 | ||
221 | |||
222 | 当git发现补丁包含了行尾空白的时候会警告你,并且可以应你的要求去掉行尾空白;不过 | ||
223 | 如果你是正在打一系列补丁,这样做会导致后面的补丁失败,因为你改变了补丁的上下文。 | ||
224 | |||
225 | |||
226 | 第四章:命名 | ||
227 | |||
228 | C是一个简朴的语言,你的命名也应该这样。和Modula-2和Pascal程序员不同,C程序员不使 | ||
229 | 用类似ThisVariableIsATemporaryCounter这样华丽的名字。C程序员会称那个变量为“tmp” | ||
230 | ,这样写起来会更容易,而且至少不会令其难于理解。 | ||
231 | |||
232 | 不过,虽然混用大小写的名字是不提倡使用的,但是全局变量还是需要一个具描述性的名字 | ||
233 | 。称一个全局函数为“foo”是一个难以饶恕的错误。 | ||
234 | |||
235 | 全局变量(只有当你真正需要它们的时候再用它)需要有一个具描述性的名字,就像全局函 | ||
236 | 数。如果你有一个可以计算活动用户数量的函数,你应该叫它“count_active_users()”或者 | ||
237 | 类似的名字,你不应该叫它“cntuser()”。 | ||
238 | |||
239 | 在函数名中包含函数类型(所谓的匈牙利命名法)是脑子出了问题——编译器知道那些类型而 | ||
240 | 且能够检查那些类型,这样做只能把程序员弄糊涂了。难怪微软总是制造出有问题的程序。 | ||
241 | |||
242 | 本地变量名应该简短,而且能够表达相关的含义。如果你有一些随机的整数型的循环计数器 | ||
243 | ,它应该被称为“i”。叫它“loop_counter”并无益处,如果它没有被误解的可能的话。类似 | ||
244 | 的,“tmp”可以用来称呼任意类型的临时变量。 | ||
245 | |||
246 | 如果你怕混淆了你的本地变量名,你就遇到另一个问题了,叫做函数增长荷尔蒙失衡综合症 | ||
247 | 。请看第六章(函数)。 | ||
248 | |||
249 | |||
250 | 第五章:Typedef | ||
251 | |||
252 | 不要使用类似“vps_t”之类的东西。 | ||
253 | |||
254 | 对结构体和指针使用typedef是一个错误。当你在代码里看到: | ||
255 | |||
256 | vps_t a; | ||
257 | |||
258 | 这代表什么意思呢? | ||
259 | |||
260 | 相反,如果是这样 | ||
261 | |||
262 | struct virtual_container *a; | ||
263 | |||
264 | 你就知道“a”是什么了。 | ||
265 | |||
266 | 很多人认为typedef“能提高可读性”。实际不是这样的。它们只在下列情况下有用: | ||
267 | |||
268 | (a) 完全不透明的对象(这种情况下要主动使用typedef来隐藏这个对象实际上是什么)。 | ||
269 | |||
270 | 例如:“pte_t”等不透明对象,你只能用合适的访问函数来访问它们。 | ||
271 | |||
272 | 注意!不透明性和“访问函数”本身是不好的。我们使用pte_t等类型的原因在于真的是 | ||
273 | 完全没有任何共用的可访问信息。 | ||
274 | |||
275 | (b) 清楚的整数类型,如此,这层抽象就可以帮助消除到底是“int”还是“long”的混淆。 | ||
276 | |||
277 | u8/u16/u32是完全没有问题的typedef,不过它们更符合类别(d)而不是这里。 | ||
278 | |||
279 | 再次注意!要这样做,必须事出有因。如果某个变量是“unsigned long“,那么没有必要 | ||
280 | |||
281 | typedef unsigned long myflags_t; | ||
282 | |||
283 | 不过如果有一个明确的原因,比如它在某种情况下可能会是一个“unsigned int”而在 | ||
284 | 其他情况下可能为“unsigned long”,那么就不要犹豫,请务必使用typedef。 | ||
285 | |||
286 | (c) 当你使用sparse按字面的创建一个新类型来做类型检查的时候。 | ||
287 | |||
288 | (d) 和标准C99类型相同的类型,在某些例外的情况下。 | ||
289 | |||
290 | 虽然让眼睛和脑筋来适应新的标准类型比如“uint32_t”不需要花很多时间,可是有些 | ||
291 | 人仍然拒绝使用它们。 | ||
292 | |||
293 | 因此,Linux特有的等同于标准类型的“u8/u16/u32/u64”类型和它们的有符号类型是被 | ||
294 | 允许的——尽管在你自己的新代码中,它们不是强制要求要使用的。 | ||
295 | |||
296 | 当编辑已经使用了某个类型集的已有代码时,你应该遵循那些代码中已经做出的选择。 | ||
297 | |||
298 | (e) 可以在用户空间安全使用的类型。 | ||
299 | |||
300 | 在某些用户空间可见的结构体里,我们不能要求C99类型而且不能用上面提到的“u32” | ||
301 | 类型。因此,我们在与用户空间共享的所有结构体中使用__u32和类似的类型。 | ||
302 | |||
303 | 可能还有其他的情况,不过基本的规则是永远不要使用typedef,除非你可以明确的应用上 | ||
304 | 述某个规则中的一个。 | ||
305 | |||
306 | 总的来说,如果一个指针或者一个结构体里的元素可以合理的被直接访问到,那么它们就不 | ||
307 | 应该是一个typedef。 | ||
308 | |||
309 | |||
310 | 第六章:函数 | ||
311 | |||
312 | 函数应该简短而漂亮,并且只完成一件事情。函数应该可以一屏或者两屏显示完(我们都知 | ||
313 | 道ISO/ANSI屏幕大小是80x24),只做一件事情,而且把它做好。 | ||
314 | |||
315 | 一个函数的最大长度是和该函数的复杂度和缩进级数成反比的。所以,如果你有一个理论上 | ||
316 | 很简单的只有一个很长(但是简单)的case语句的函数,而且你需要在每个case里做很多很 | ||
317 | 小的事情,这样的函数尽管很长,但也是可以的。 | ||
318 | |||
319 | 不过,如果你有一个复杂的函数,而且你怀疑一个天分不是很高的高中一年级学生可能甚至 | ||
320 | 搞不清楚这个函数的目的,你应该严格的遵守前面提到的长度限制。使用辅助函数,并为之 | ||
321 | 取个具描述性的名字(如果你觉得它们的性能很重要的话,可以让编译器内联它们,这样的 | ||
322 | 效果往往会比你写一个复杂函数的效果要好。) | ||
323 | |||
324 | 函数的另外一个衡量标准是本地变量的数量。此数量不应超过5-10个,否则你的函数就有 | ||
325 | 问题了。重新考虑一下你的函数,把它分拆成更小的函数。人的大脑一般可以轻松的同时跟 | ||
326 | 踪7个不同的事物,如果再增多的话,就会糊涂了。即便你聪颖过人,你也可能会记不清你2 | ||
327 | 个星期前做过的事情。 | ||
328 | |||
329 | 在源文件里,使用空行隔开不同的函数。如果该函数需要被导出,它的EXPORT*宏应该紧贴 | ||
330 | 在它的结束大括号之下。比如: | ||
331 | |||
332 | int system_is_up(void) | ||
333 | { | ||
334 | return system_state == SYSTEM_RUNNING; | ||
335 | } | ||
336 | EXPORT_SYMBOL(system_is_up); | ||
337 | |||
338 | 在函数原型中,包含函数名和它们的数据类型。虽然C语言里没有这样的要求,在Linux里这 | ||
339 | 是提倡的做法,因为这样可以很简单的给读者提供更多的有价值的信息。 | ||
340 | |||
341 | |||
342 | 第七章:集中的函数退出途径 | ||
343 | |||
344 | 虽然被某些人声称已经过时,但是goto语句的等价物还是经常被编译器所使用,具体形式是 | ||
345 | 无条件跳转指令。 | ||
346 | |||
347 | 当一个函数从多个位置退出并且需要做一些通用的清理工作的时候,goto的好处就显现出来 | ||
348 | 了。 | ||
349 | |||
350 | 理由是: | ||
351 | |||
352 | - 无条件语句容易理解和跟踪 | ||
353 | - 嵌套程度减小 | ||
354 | - 可以避免由于修改时忘记更新某个单独的退出点而导致的错误 | ||
355 | - 减轻了编译器的工作,无需删除冗余代码;) | ||
356 | |||
357 | int fun(int a) | ||
358 | { | ||
359 | int result = 0; | ||
360 | char *buffer = kmalloc(SIZE); | ||
361 | |||
362 | if (buffer == NULL) | ||
363 | return -ENOMEM; | ||
364 | |||
365 | if (condition1) { | ||
366 | while (loop1) { | ||
367 | ... | ||
368 | } | ||
369 | result = 1; | ||
370 | goto out; | ||
371 | } | ||
372 | ... | ||
373 | out: | ||
374 | kfree(buffer); | ||
375 | return result; | ||
376 | } | ||
377 | |||
378 | 第八章:注释 | ||
379 | |||
380 | 注释是好的,不过有过度注释的危险。永远不要在注释里解释你的代码是如何运作的:更好 | ||
381 | 的做法是让别人一看你的代码就可以明白,解释写的很差的代码是浪费时间。 | ||
382 | |||
383 | 一般的,你想要你的注释告诉别人你的代码做了什么,而不是怎么做的。也请你不要把注释 | ||
384 | 放在一个函数体内部:如果函数复杂到你需要独立的注释其中的一部分,你很可能需要回到 | ||
385 | 第六章看一看。你可以做一些小注释来注明或警告某些很聪明(或者槽糕)的做法,但不要 | ||
386 | 加太多。你应该做的,是把注释放在函数的头部,告诉人们它做了什么,也可以加上它做这 | ||
387 | 些事情的原因。 | ||
388 | |||
389 | 当注释内核API函数时,请使用kernel-doc格式。请看 | ||
390 | Documentation/kernel-doc-nano-HOWTO.txt和scripts/kernel-doc以获得详细信息。 | ||
391 | |||
392 | Linux的注释风格是C89“/* ... */”风格。不要使用C99风格“// ...”注释。 | ||
393 | |||
394 | 长(多行)的首选注释风格是: | ||
395 | |||
396 | /* | ||
397 | * This is the preferred style for multi-line | ||
398 | * comments in the Linux kernel source code. | ||
399 | * Please use it consistently. | ||
400 | * | ||
401 | * Description: A column of asterisks on the left side, | ||
402 | * with beginning and ending almost-blank lines. | ||
403 | */ | ||
404 | |||
405 | 注释数据也是很重要的,不管是基本类型还是衍生类型。为了方便实现这一点,每一行应只 | ||
406 | 声明一个数据(不要使用逗号来一次声明多个数据)。这样你就有空间来为每个数据写一段 | ||
407 | 小注释来解释它们的用途了。 | ||
408 | |||
409 | |||
410 | 第九章:你已经把事情弄糟了 | ||
411 | |||
412 | 这没什么,我们都是这样。可能你的使用了很长时间Unix的朋友已经告诉你“GNU emacs”能 | ||
413 | 自动帮你格式化C源代码,而且你也注意到了,确实是这样,不过它所使用的默认值和我们 | ||
414 | 想要的相去甚远(实际上,甚至比随机打的还要差——无数个猴子在GNU emacs里打字永远不 | ||
415 | 会创造出一个好程序)(译注:请参考Infinite Monkey Theorem) | ||
416 | |||
417 | 所以你要么放弃GNU emacs,要么改变它让它使用更合理的设定。要采用后一个方案,你可 | ||
418 | 以把下面这段粘贴到你的.emacs文件里。 | ||
419 | |||
420 | (defun linux-c-mode () | ||
421 | "C mode with adjusted defaults for use with the Linux kernel." | ||
422 | (interactive) | ||
423 | (c-mode) | ||
424 | (c-set-style "K&R") | ||
425 | (setq tab-width 8) | ||
426 | (setq indent-tabs-mode t) | ||
427 | (setq c-basic-offset 8)) | ||
428 | |||
429 | 这样就定义了M-x linux-c-mode命令。当你hack一个模块的时候,如果你把字符串 | ||
430 | -*- linux-c -*-放在头两行的某个位置,这个模式将会被自动调用。如果你希望在你修改 | ||
431 | /usr/src/linux里的文件时魔术般自动打开linux-c-mode的话,你也可能需要添加 | ||
432 | |||
433 | (setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode) | ||
434 | auto-mode-alist)) | ||
435 | |||
436 | 到你的.emacs文件里。 | ||
437 | |||
438 | 不过就算你尝试让emacs正确的格式化代码失败了,也并不意味着你失去了一切:还可以用“ | ||
439 | indent”。 | ||
440 | |||
441 | 不过,GNU indent也有和GNU emacs一样有问题的设定,所以你需要给它一些命令选项。不 | ||
442 | 过,这还不算太糟糕,因为就算是GNU indent的作者也认同K&R的权威性(GNU的人并不是坏 | ||
443 | 人,他们只是在这个问题上被严重的误导了),所以你只要给indent指定选项“-kr -i8” | ||
444 | (代表“K&R,8个字符缩进”),或者使用“scripts/Lindent”,这样就可以以最时髦的方式 | ||
445 | 缩进源代码。 | ||
446 | |||
447 | “indent”有很多选项,特别是重新格式化注释的时候,你可能需要看一下它的手册页。不过 | ||
448 | 记住:“indent”不能修正坏的编程习惯。 | ||
449 | |||
450 | |||
451 | 第十章:Kconfig配置文件 | ||
452 | |||
453 | 对于遍布源码树的所有Kconfig*配置文件来说,它们缩进方式与C代码相比有所不同。紧挨 | ||
454 | 在“config”定义下面的行缩进一个制表符,帮助信息则再多缩进2个空格。比如: | ||
455 | |||
456 | config AUDIT | ||
457 | bool "Auditing support" | ||
458 | depends on NET | ||
459 | help | ||
460 | Enable auditing infrastructure that can be used with another | ||
461 | kernel subsystem, such as SELinux (which requires this for | ||
462 | logging of avc messages output). Does not do system-call | ||
463 | auditing without CONFIG_AUDITSYSCALL. | ||
464 | |||
465 | 仍然被认为不够稳定的功能应该被定义为依赖于“EXPERIMENTAL”: | ||
466 | |||
467 | config SLUB | ||
468 | depends on EXPERIMENTAL && !ARCH_USES_SLAB_PAGE_STRUCT | ||
469 | bool "SLUB (Unqueued Allocator)" | ||
470 | ... | ||
471 | |||
472 | 而那些危险的功能(比如某些文件系统的写支持)应该在它们的提示字符串里显著的声明这 | ||
473 | 一点: | ||
474 | |||
475 | config ADFS_FS_RW | ||
476 | bool "ADFS write support (DANGEROUS)" | ||
477 | depends on ADFS_FS | ||
478 | ... | ||
479 | |||
480 | 要查看配置文件的完整文档,请看Documentation/kbuild/kconfig-language.txt。 | ||
481 | |||
482 | |||
483 | 第十一章:数据结构 | ||
484 | |||
485 | 如果一个数据结构,在创建和销毁它的单线执行环境之外可见,那么它必须要有一个引用计 | ||
486 | 数器。内核里没有垃圾收集(并且内核之外的垃圾收集慢且效率低下),这意味着你绝对需 | ||
487 | 要记录你对这种数据结构的使用情况。 | ||
488 | |||
489 | 引用计数意味着你能够避免上锁,并且允许多个用户并行访问这个数据结构——而不需要担心 | ||
490 | 这个数据结构仅仅因为暂时不被使用就消失了,那些用户可能不过是沉睡了一阵或者做了一 | ||
491 | 些其他事情而已。 | ||
492 | |||
493 | 注意上锁不能取代引用计数。上锁是为了保持数据结构的一致性,而引用计数是一个内存管 | ||
494 | 理技巧。通常二者都需要,不要把两个搞混了。 | ||
495 | |||
496 | 很多数据结构实际上有2级引用计数,它们通常有不同“类”的用户。子类计数器统计子类用 | ||
497 | 户的数量,每当子类计数器减至零时,全局计数器减一。 | ||
498 | |||
499 | 这种“多级引用计数”的例子可以在内存管理(“struct mm_struct”:mm_users和mm_count) | ||
500 | 和文件系统(“struct super_block”:s_count和s_active)中找到。 | ||
501 | |||
502 | 记住:如果另一个执行线索可以找到你的数据结构,但是这个数据结构没有引用计数器,这 | ||
503 | 里几乎肯定是一个bug。 | ||
504 | |||
505 | |||
506 | 第十二章:宏,枚举和RTL | ||
507 | |||
508 | 用于定义常量的宏的名字及枚举里的标签需要大写。 | ||
509 | |||
510 | #define CONSTANT 0x12345 | ||
511 | |||
512 | 在定义几个相关的常量时,最好用枚举。 | ||
513 | |||
514 | 宏的名字请用大写字母,不过形如函数的宏的名字可以用小写字母。 | ||
515 | |||
516 | 一般的,如果能写成内联函数就不要写成像函数的宏。 | ||
517 | |||
518 | 含有多个语句的宏应该被包含在一个do-while代码块里: | ||
519 | |||
520 | #define macrofun(a, b, c) \ | ||
521 | do { \ | ||
522 | if (a == 5) \ | ||
523 | do_this(b, c); \ | ||
524 | } while (0) | ||
525 | |||
526 | 使用宏的时候应避免的事情: | ||
527 | |||
528 | 1) 影响控制流程的宏: | ||
529 | |||
530 | #define FOO(x) \ | ||
531 | do { \ | ||
532 | if (blah(x) < 0) \ | ||
533 | return -EBUGGERED; \ | ||
534 | } while(0) | ||
535 | |||
536 | 非常不好。它看起来像一个函数,不过却能导致“调用”它的函数退出;不要打乱读者大脑里 | ||
537 | 的语法分析器。 | ||
538 | |||
539 | 2) 依赖于一个固定名字的本地变量的宏: | ||
540 | |||
541 | #define FOO(val) bar(index, val) | ||
542 | |||
543 | 可能看起来像是个不错的东西,不过它非常容易把读代码的人搞糊涂,而且容易导致看起来 | ||
544 | 不相关的改动带来错误。 | ||
545 | |||
546 | 3) 作为左值的带参数的宏: FOO(x) = y;如果有人把FOO变成一个内联函数的话,这种用 | ||
547 | 法就会出错了。 | ||
548 | |||
549 | 4) 忘记了优先级:使用表达式定义常量的宏必须将表达式置于一对小括号之内。带参数的 | ||
550 | 宏也要注意此类问题。 | ||
551 | |||
552 | #define CONSTANT 0x4000 | ||
553 | #define CONSTEXP (CONSTANT | 3) | ||
554 | |||
555 | cpp手册对宏的讲解很详细。Gcc internals手册也详细讲解了RTL(译注:register | ||
556 | transfer language),内核里的汇编语言经常用到它。 | ||
557 | |||
558 | |||
559 | 第十三章:打印内核消息 | ||
560 | |||
561 | 内核开发者应该是受过良好教育的。请一定注意内核信息的拼写,以给人以好的印象。不要 | ||
562 | 用不规范的单词比如“dont”,而要用“do not”或者“don't”。保证这些信息简单、明了、无 | ||
563 | 歧义。 | ||
564 | |||
565 | 内核信息不必以句号(译注:英文句号,即点)结束。 | ||
566 | |||
567 | 在小括号里打印数字(%d)没有任何价值,应该避免这样做。 | ||
568 | |||
569 | <linux/device.h>里有一些驱动模型诊断宏,你应该使用它们,以确保信息对应于正确的 | ||
570 | 设备和驱动,并且被标记了正确的消息级别。这些宏有:dev_err(), dev_warn(), | ||
571 | dev_info()等等。对于那些不和某个特定设备相关连的信息,<linux/kernel.h>定义了 | ||
572 | pr_debug()和pr_info()。 | ||
573 | |||
574 | 写出好的调试信息可以是一个很大的挑战;当你写出来之后,这些信息在远程除错的时候 | ||
575 | 就会成为极大的帮助。当DEBUG符号没有被定义的时候,这些信息不应该被编译进内核里 | ||
576 | (也就是说,默认地,它们不应该被包含在内)。如果你使用dev_dbg()或者pr_debug(), | ||
577 | 就能自动达到这个效果。很多子系统拥有Kconfig选项来启用-DDEBUG。还有一个相关的惯例 | ||
578 | 是使用VERBOSE_DEBUG来添加dev_vdbg()消息到那些已经由DEBUG启用的消息之上。 | ||
579 | |||
580 | |||
581 | 第十四章:分配内存 | ||
582 | |||
583 | 内核提供了下面的一般用途的内存分配函数:kmalloc(),kzalloc(),kcalloc()和 | ||
584 | vmalloc()。请参考API文档以获取有关它们的详细信息。 | ||
585 | |||
586 | 传递结构体大小的首选形式是这样的: | ||
587 | |||
588 | p = kmalloc(sizeof(*p), ...); | ||
589 | |||
590 | 另外一种传递方式中,sizeof的操作数是结构体的名字,这样会降低可读性,并且可能会引 | ||
591 | 入bug。有可能指针变量类型被改变时,而对应的传递给内存分配函数的sizeof的结果不变。 | ||
592 | |||
593 | 强制转换一个void指针返回值是多余的。C语言本身保证了从void指针到其他任何指针类型 | ||
594 | 的转换是没有问题的。 | ||
595 | |||
596 | |||
597 | 第十五章:内联弊病 | ||
598 | |||
599 | 有一个常见的误解是内联函数是gcc提供的可以让代码运行更快的一个选项。虽然使用内联 | ||
600 | 函数有时候是恰当的(比如作为一种替代宏的方式,请看第十二章),不过很多情况下不是 | ||
601 | 这样。inline关键字的过度使用会使内核变大,从而使整个系统运行速度变慢。因为大内核 | ||
602 | 会占用更多的指令高速缓存(译注:一级缓存通常是指令缓存和数据缓存分开的)而且会导 | ||
603 | 致pagecache的可用内存减少。想象一下,一次pagecache未命中就会导致一次磁盘寻址,将 | ||
604 | 耗时5毫秒。5毫秒的时间内CPU能执行很多很多指令。 | ||
605 | |||
606 | 一个基本的原则是如果一个函数有3行以上,就不要把它变成内联函数。这个原则的一个例 | ||
607 | 外是,如果你知道某个参数是一个编译时常量,而且因为这个常量你确定编译器在编译时能 | ||
608 | 优化掉你的函数的大部分代码,那仍然可以给它加上inline关键字。kmalloc()内联函数就 | ||
609 | 是一个很好的例子。 | ||
610 | |||
611 | 人们经常主张给static的而且只用了一次的函数加上inline,如此不会有任何损失,因为没 | ||
612 | 有什么好权衡的。虽然从技术上说这是正确的,但是实际上这种情况下即使不加inline gcc | ||
613 | 也可以自动使其内联。而且其他用户可能会要求移除inline,由此而来的争论会抵消inline | ||
614 | 自身的潜在价值,得不偿失。 | ||
615 | |||
616 | |||
617 | 第十六章:函数返回值及命名 | ||
618 | |||
619 | 函数可以返回很多种不同类型的值,最常见的一种是表明函数执行成功或者失败的值。这样 | ||
620 | 的一个值可以表示为一个错误代码整数(-Exxx=失败,0=成功)或者一个“成功”布尔值( | ||
621 | 0=失败,非0=成功)。 | ||
622 | |||
623 | 混合使用这两种表达方式是难于发现的bug的来源。如果C语言本身严格区分整形和布尔型变 | ||
624 | 量,那么编译器就能够帮我们发现这些错误……不过C语言不区分。为了避免产生这种bug,请 | ||
625 | 遵循下面的惯例: | ||
626 | |||
627 | 如果函数的名字是一个动作或者强制性的命令,那么这个函数应该返回错误代码整 | ||
628 | 数。如果是一个判断,那么函数应该返回一个“成功”布尔值。 | ||
629 | |||
630 | 比如,“add work”是一个命令,所以add_work()函数在成功时返回0,在失败时返回-EBUSY。 | ||
631 | 类似的,因为“PCI device present”是一个判断,所以pci_dev_present()函数在成功找到 | ||
632 | 一个匹配的设备时应该返回1,如果找不到时应该返回0。 | ||
633 | |||
634 | 所有导出(译注:EXPORT)的函数都必须遵守这个惯例,所有的公共函数也都应该如此。私 | ||
635 | 有(static)函数不需要如此,但是我们也推荐这样做。 | ||
636 | |||
637 | 返回值是实际计算结果而不是计算是否成功的标志的函数不受此惯例的限制。一般的,他们 | ||
638 | 通过返回一些正常值范围之外的结果来表示出错。典型的例子是返回指针的函数,他们使用 | ||
639 | NULL或者ERR_PTR机制来报告错误。 | ||
640 | |||
641 | |||
642 | 第十七章:不要重新发明内核宏 | ||
643 | |||
644 | 头文件include/linux/kernel.h包含了一些宏,你应该使用它们,而不要自己写一些它们的 | ||
645 | 变种。比如,如果你需要计算一个数组的长度,使用这个宏 | ||
646 | |||
647 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
648 | |||
649 | 类似的,如果你要计算某结构体成员的大小,使用 | ||
650 | |||
651 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | ||
652 | |||
653 | 还有可以做严格的类型检查的min()和max()宏,如果你需要可以使用它们。你可以自己看看 | ||
654 | 那个头文件里还定义了什么你可以拿来用的东西,如果有定义的话,你就不应在你的代码里 | ||
655 | 自己重新定义。 | ||
656 | |||
657 | |||
658 | 第十八章:编辑器模式行和其他需要罗嗦的事情 | ||
659 | |||
660 | 有一些编辑器可以解释嵌入在源文件里的由一些特殊标记标明的配置信息。比如,emacs | ||
661 | 能够解释被标记成这样的行: | ||
662 | |||
663 | -*- mode: c -*- | ||
664 | |||
665 | 或者这样的: | ||
666 | |||
667 | /* | ||
668 | Local Variables: | ||
669 | compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c" | ||
670 | End: | ||
671 | */ | ||
672 | |||
673 | Vim能够解释这样的标记: | ||
674 | |||
675 | /* vim:set sw=8 noet */ | ||
676 | |||
677 | 不要在源代码中包含任何这样的内容。每个人都有他自己的编辑器配置,你的源文件不应 | ||
678 | 该覆盖别人的配置。这包括有关缩进和模式配置的标记。人们可以使用他们自己定制的模 | ||
679 | 式,或者使用其他可以产生正确的缩进的巧妙方法。 | ||
680 | |||
681 | |||
682 | |||
683 | 附录 I:参考 | ||
684 | |||
685 | The C Programming Language, 第二版, 作者Brian W. Kernighan和Denni | ||
686 | M. Ritchie. Prentice Hall, Inc., 1988. ISBN 0-13-110362-8 (软皮), | ||
687 | 0-13-110370-9 (硬皮). URL: http://cm.bell-labs.com/cm/cs/cbook/ | ||
688 | |||
689 | The Practice of Programming 作者Brian W. Kernighan和Rob Pike. Addison-Wesley, | ||
690 | Inc., 1999. ISBN 0-201-61586-X. URL: http://cm.bell-labs.com/cm/cs/tpop/ | ||
691 | |||
692 | cpp,gcc,gcc internals和indent的GNU手册——和K&R及本文相符合的部分,全部可以在 | ||
693 | http://www.gnu.org/manual/找到 | ||
694 | |||
695 | WG14是C语言的国际标准化工作组,URL: http://www.open-std.org/JTC1/SC22/WG14/ | ||
696 | |||
697 | Kernel CodingStyle,作者greg@kroah.com发表于OLS 2002: | ||
698 | http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/ | ||
699 | |||
700 | -- | ||
701 | 最后更新于2007年7月13日。 | ||
diff --git a/Documentation/zh_CN/HOWTO b/Documentation/zh_CN/HOWTO index 48fc67bfbe3d..3d80e8af36ec 100644 --- a/Documentation/zh_CN/HOWTO +++ b/Documentation/zh_CN/HOWTO | |||
@@ -1,10 +1,10 @@ | |||
1 | Chinese translated version of Documentation/HOWTO | 1 | Chinese translated version of Documentation/HOWTO |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | If you have any comment or update to the content, please contact the |
4 | original document maintainer directly. However, if you have problem | 4 | original document maintainer directly. However, if you have a problem |
5 | communicating in English you can also ask the Chinese maintainer for | 5 | communicating in English you can also ask the Chinese maintainer for |
6 | help. Contact the Chinese maintainer, if this translation is outdated | 6 | help. Contact the Chinese maintainer if this translation is outdated |
7 | or there is problem with translation. | 7 | or if there is a problem with the translation. |
8 | 8 | ||
9 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | 9 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> |
10 | Chinese maintainer: Li Yang <leoli@freescale.com> | 10 | Chinese maintainer: Li Yang <leoli@freescale.com> |
@@ -85,7 +85,7 @@ Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的 | |||
85 | Linux内核代码中包含有大量的文档。这些文档对于学习如何与内核社区互动有着 | 85 | Linux内核代码中包含有大量的文档。这些文档对于学习如何与内核社区互动有着 |
86 | 不可估量的价值。当一个新的功能被加入内核,最好把解释如何使用这个功能的文 | 86 | 不可估量的价值。当一个新的功能被加入内核,最好把解释如何使用这个功能的文 |
87 | 档也放进内核。当内核的改动导致面向用户空间的接口发生变化时,最好将相关信 | 87 | 档也放进内核。当内核的改动导致面向用户空间的接口发生变化时,最好将相关信 |
88 | 息或手册页(manpages)的补丁发到mtk-manpages@gmx.net,以向手册页(manpages) | 88 | 息或手册页(manpages)的补丁发到mtk.manpages@gmail.com,以向手册页(manpages) |
89 | 的维护者解释这些变化。 | 89 | 的维护者解释这些变化。 |
90 | 90 | ||
91 | 以下是内核代码中需要阅读的文档: | 91 | 以下是内核代码中需要阅读的文档: |
@@ -218,6 +218,8 @@ kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循 | |||
218 | 时,一个新的-rc版本就会被发布。计划是每周都发布新的-rc版本。 | 218 | 时,一个新的-rc版本就会被发布。计划是每周都发布新的-rc版本。 |
219 | - 这个过程一直持续下去直到内核被认为达到足够稳定的状态,持续时间大概是 | 219 | - 这个过程一直持续下去直到内核被认为达到足够稳定的状态,持续时间大概是 |
220 | 6个星期。 | 220 | 6个星期。 |
221 | - 以下地址跟踪了在每个-rc发布中发现的退步列表: | ||
222 | http://kernelnewbies.org/known_regressions | ||
221 | 223 | ||
222 | 关于内核发布,值得一提的是Andrew Morton在linux-kernel邮件列表中如是说: | 224 | 关于内核发布,值得一提的是Andrew Morton在linux-kernel邮件列表中如是说: |
223 | “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定 | 225 | “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定 |
diff --git a/Documentation/zh_CN/SubmittingDrivers b/Documentation/zh_CN/SubmittingDrivers new file mode 100644 index 000000000000..5f4815c63ec7 --- /dev/null +++ b/Documentation/zh_CN/SubmittingDrivers | |||
@@ -0,0 +1,168 @@ | |||
1 | Chinese translated version of Documentation/SubmittingDrivers | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: Li Yang <leo@zh-kernel.org> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/SubmittingDrivers 的中文翻译 | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | |||
17 | 中文版维护者: 李阳 Li Yang <leo@zh-kernel.org> | ||
18 | 中文版翻译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
19 | 中文版校译者: 陈琦 Maggie Chen <chenqi@beyondsoft.com> | ||
20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
21 | 张巍 Zhang Wei <Wei.Zhang@freescale.com> | ||
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | |||
26 | 如何向 Linux 内核提交驱动程序 | ||
27 | ----------------------------- | ||
28 | |||
29 | 这篇文档将会解释如何向不同的内核源码树提交设备驱动程序。请注意,如果你感 | ||
30 | 兴趣的是显卡驱动程序,你也许应该访问 XFree86 项目(http://www.xfree86.org/) | ||
31 | 和/或 X.org 项目 (http://x.org)。 | ||
32 | |||
33 | 另请参阅 Documentation/SubmittingPatches 文档。 | ||
34 | |||
35 | |||
36 | 分配设备号 | ||
37 | ---------- | ||
38 | |||
39 | 块设备和字符设备的主设备号与从设备号是由 Linux 命名编号分配权威 LANANA( | ||
40 | 现在是 Torben Mathiasen)负责分配。申请的网址是 http://www.lanana.org/。 | ||
41 | 即使不准备提交到主流内核的设备驱动也需要在这里分配设备号。有关详细信息, | ||
42 | 请参阅 Documentation/devices.txt。 | ||
43 | |||
44 | 如果你使用的不是已经分配的设备号,那么当你提交设备驱动的时候,它将会被强 | ||
45 | 制分配一个新的设备号,即便这个设备号和你之前发给客户的截然不同。 | ||
46 | |||
47 | 设备驱动的提交对象 | ||
48 | ------------------ | ||
49 | |||
50 | Linux 2.0: | ||
51 | 此内核源码树不接受新的驱动程序。 | ||
52 | |||
53 | Linux 2.2: | ||
54 | 此内核源码树不接受新的驱动程序。 | ||
55 | |||
56 | Linux 2.4: | ||
57 | 如果所属的代码领域在内核的 MAINTAINERS 文件中列有一个总维护者, | ||
58 | 那么请将驱动程序提交给他。如果此维护者没有回应或者你找不到恰当的 | ||
59 | 维护者,那么请联系 Willy Tarreau <w@1wt.eu>。 | ||
60 | |||
61 | Linux 2.6: | ||
62 | 除了遵循和 2.4 版内核同样的规则外,你还需要在 linux-kernel 邮件 | ||
63 | 列表上跟踪最新的 API 变化。向 Linux 2.6 内核提交驱动的顶级联系人 | ||
64 | 是 Andrew Morton <akpm@osdl.org>。 | ||
65 | |||
66 | 决定设备驱动能否被接受的条件 | ||
67 | ---------------------------- | ||
68 | |||
69 | 许可: 代码必须使用 GNU 通用公开许可证 (GPL) 提交给 Linux,但是 | ||
70 | 我们并不要求 GPL 是唯一的许可。你或许会希望同时使用多种 | ||
71 | 许可证发布,如果希望驱动程序可以被其他开源社区(比如BSD) | ||
72 | 使用。请参考 include/linux/module.h 文件中所列出的可被 | ||
73 | 接受共存的许可。 | ||
74 | |||
75 | 版权: 版权所有者必须同意使用 GPL 许可。最好提交者和版权所有者 | ||
76 | 是相同个人或实体。否则,必需列出授权使用 GPL 的版权所有 | ||
77 | 人或实体,以备验证之需。 | ||
78 | |||
79 | 接口: 如果你的驱动程序使用现成的接口并且和其他同类的驱动程序行 | ||
80 | 为相似,而不是去发明无谓的新接口,那么它将会更容易被接受。 | ||
81 | 如果你需要一个 Linux 和 NT 的通用驱动接口,那么请在用 | ||
82 | 户空间实现它。 | ||
83 | |||
84 | 代码: 请使用 Documentation/CodingStyle 中所描述的 Linux 代码风 | ||
85 | 格。如果你的某些代码段(例如那些与 Windows 驱动程序包共 | ||
86 | 享的代码段)需要使用其他格式,而你却只希望维护一份代码, | ||
87 | 那么请将它们很好地区分出来,并且注明原因。 | ||
88 | |||
89 | 可移植性: 请注意,指针并不永远是 32 位的,不是所有的计算机都使用小 | ||
90 | 尾模式 (little endian) 存储数据,不是所有的人都拥有浮点 | ||
91 | 单元,不要随便在你的驱动程序里嵌入 x86 汇编指令。只能在 | ||
92 | x86 上运行的驱动程序一般是不受欢迎的。虽然你可能只有 x86 | ||
93 | 硬件,很难测试驱动程序在其他平台上是否可用,但是确保代码 | ||
94 | 可以被轻松地移植却是很简单的。 | ||
95 | |||
96 | 清晰度: 做到所有人都能修补这个驱动程序将会很有好处,因为这样你将 | ||
97 | 会直接收到修复的补丁而不是 bug 报告。如果你提交一个试图 | ||
98 | 隐藏硬件工作机理的驱动程序,那么它将会被扔进废纸篓。 | ||
99 | |||
100 | 电源管理: 因为 Linux 正在被很多移动设备和桌面系统使用,所以你的驱 | ||
101 | 动程序也很有可能被使用在这些设备上。它应该支持最基本的电 | ||
102 | 源管理,即在需要的情况下实现系统级休眠和唤醒要用到的 | ||
103 | .suspend 和 .resume 函数。你应该检查你的驱动程序是否能正 | ||
104 | 确地处理休眠与唤醒,如果实在无法确认,请至少把 .suspend | ||
105 | 函数定义成返回 -ENOSYS(功能未实现)错误。你还应该尝试确 | ||
106 | 保你的驱动在什么都不干的情况下将耗电降到最低。要获得驱动 | ||
107 | 程序测试的指导,请参阅 | ||
108 | Documentation/power/drivers-testing.txt。有关驱动程序电 | ||
109 | 源管理问题相对全面的概述,请参阅 | ||
110 | Documentation/power/devices.txt。 | ||
111 | |||
112 | 管理: 如果一个驱动程序的作者还在进行有效的维护,那么通常除了那 | ||
113 | 些明显正确且不需要任何检查的补丁以外,其他所有的补丁都会 | ||
114 | 被转发给作者。如果你希望成为驱动程序的联系人和更新者,最 | ||
115 | 好在代码注释中写明并且在 MAINTAINERS 文件中加入这个驱动 | ||
116 | 程序的条目。 | ||
117 | |||
118 | 不影响设备驱动能否被接受的条件 | ||
119 | ------------------------------ | ||
120 | |||
121 | 供应商: 由硬件供应商来维护驱动程序通常是一件好事。不过,如果源码 | ||
122 | 树里已经有其他人提供了可稳定工作的驱动程序,那么请不要期 | ||
123 | 望“我是供应商”会成为内核改用你的驱动程序的理由。理想的情 | ||
124 | 况是:供应商与现有驱动程序的作者合作,构建一个统一完美的 | ||
125 | 驱动程序。 | ||
126 | |||
127 | 作者: 驱动程序是由大的 Linux 公司研发还是由你个人编写,并不影 | ||
128 | 响其是否能被内核接受。没有人对内核源码树享有特权。只要你 | ||
129 | 充分了解内核社区,你就会发现这一点。 | ||
130 | |||
131 | |||
132 | 资源列表 | ||
133 | -------- | ||
134 | |||
135 | Linux 内核主源码树: | ||
136 | ftp.??.kernel.org:/pub/linux/kernel/... | ||
137 | ?? == 你的国家代码,例如 "cn"、"us"、"uk"、"fr" 等等 | ||
138 | |||
139 | Linux 内核邮件列表: | ||
140 | linux-kernel@vger.kernel.org | ||
141 | [可通过向majordomo@vger.kernel.org发邮件来订阅] | ||
142 | |||
143 | Linux 设备驱动程序,第三版(探讨 2.6.10 版内核): | ||
144 | http://lwn.net/Kernel/LDD3/ (免费版) | ||
145 | |||
146 | LWN.net: | ||
147 | 每周内核开发活动摘要 - http://lwn.net/ | ||
148 | 2.6 版中 API 的变更: | ||
149 | http://lwn.net/Articles/2.6-kernel-api/ | ||
150 | 将旧版内核的驱动程序移植到 2.6 版: | ||
151 | http://lwn.net/Articles/driver-porting/ | ||
152 | |||
153 | KernelTrap: | ||
154 | Linux 内核的最新动态以及开发者访谈 | ||
155 | http://kerneltrap.org/ | ||
156 | |||
157 | 内核新手(KernelNewbies): | ||
158 | 为新的内核开发者提供文档和帮助 | ||
159 | http://kernelnewbies.org/ | ||
160 | |||
161 | Linux USB项目: | ||
162 | http://www.linux-usb.org/ | ||
163 | |||
164 | 写内核驱动的“不要”(Arjan van de Ven著): | ||
165 | http://www.fenrus.org/how-to-not-write-a-device-driver-paper.pdf | ||
166 | |||
167 | 内核清洁工 (Kernel Janitor): | ||
168 | http://janitor.kernelnewbies.org/ | ||
diff --git a/Documentation/zh_CN/SubmittingPatches b/Documentation/zh_CN/SubmittingPatches new file mode 100644 index 000000000000..985c92e20b73 --- /dev/null +++ b/Documentation/zh_CN/SubmittingPatches | |||
@@ -0,0 +1,416 @@ | |||
1 | Chinese translated version of Documentation/SubmittingPatches | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: TripleX Chung <triplex@zh-kernel.org> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/SubmittingPatches 的中文翻译 | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | |||
17 | 中文版维护者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | ||
18 | 中文版翻译者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | ||
19 | 中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
21 | |||
22 | 以下为正文 | ||
23 | --------------------------------------------------------------------- | ||
24 | |||
25 | 如何让你的改动进入内核 | ||
26 | 或者 | ||
27 | 获得亲爱的 Linus Torvalds 的关注和处理 | ||
28 | ---------------------------------- | ||
29 | |||
30 | 对于想要将改动提交到 Linux 内核的个人或者公司来说,如果不熟悉“规矩”, | ||
31 | 提交的流程会让人畏惧。本文档收集了一系列建议,这些建议可以大大的提高你 | ||
32 | 的改动被接受的机会。 | ||
33 | 阅读 Documentation/SubmitChecklist 来获得在提交代码前需要检查的项目的列 | ||
34 | 表。如果你在提交一个驱动程序,那么同时阅读一下 | ||
35 | Documentation/SubmittingDrivers 。 | ||
36 | |||
37 | |||
38 | -------------------------- | ||
39 | 第一节 - 创建并发送你的改动 | ||
40 | -------------------------- | ||
41 | |||
42 | 1) "diff -up" | ||
43 | ----------- | ||
44 | |||
45 | 使用 "diff -up" 或者 "diff -uprN" 来创建补丁。 | ||
46 | |||
47 | 所有内核的改动,都是以补丁的形式呈现的,补丁由 diff(1) 生成。创建补丁的 | ||
48 | 时候,要确认它是以 "unified diff" 格式创建的,这种格式由 diff(1) 的 '-u' | ||
49 | 参数生成。而且,请使用 '-p' 参数,那样会显示每个改动所在的C函数,使得 | ||
50 | 产生的补丁容易读得多。补丁应该基于内核源代码树的根目录,而不是里边的任 | ||
51 | 何子目录。 | ||
52 | 为一个单独的文件创建补丁,一般来说这样做就够了: | ||
53 | |||
54 | SRCTREE= linux-2.6 | ||
55 | MYFILE= drivers/net/mydriver.c | ||
56 | |||
57 | cd $SRCTREE | ||
58 | cp $MYFILE $MYFILE.orig | ||
59 | vi $MYFILE # make your change | ||
60 | cd .. | ||
61 | diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch | ||
62 | |||
63 | 为多个文件创建补丁,你可以解开一个没有修改过的内核源代码树,然后和你自 | ||
64 | 己的代码树之间做 diff 。例如: | ||
65 | |||
66 | MYSRC= /devel/linux-2.6 | ||
67 | |||
68 | tar xvfz linux-2.6.12.tar.gz | ||
69 | mv linux-2.6.12 linux-2.6.12-vanilla | ||
70 | diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \ | ||
71 | linux-2.6.12-vanilla $MYSRC > /tmp/patch | ||
72 | |||
73 | "dontdiff" 是内核在编译的时候产生的文件的列表,列表中的文件在 diff(1) | ||
74 | 产生的补丁里会被跳过。"dontdiff" 文件被包含在2.6.12和之后版本的内核源代 | ||
75 | 码树中。对于更早的内核版本,你可以从 | ||
76 | <http://www.xenotime.net/linux/doc/dontdiff> 获取它。 | ||
77 | 确定你的补丁里没有包含任何不属于这次补丁提交的额外文件。记得在用diff(1) | ||
78 | 生成补丁之后,审阅一次补丁,以确保准确。 | ||
79 | 如果你的改动很散乱,你应该研究一下如何将补丁分割成独立的部分,将改动分 | ||
80 | 割成一系列合乎逻辑的步骤。这样更容易让其他内核开发者审核,如果你想你的 | ||
81 | 补丁被接受,这是很重要的。下面这些脚本能够帮助你做这件事情: | ||
82 | Quilt: | ||
83 | http://savannah.nongnu.org/projects/quilt | ||
84 | |||
85 | Andrew Morton 的补丁脚本: | ||
86 | http://www.zip.com.au/~akpm/linux/patches/ | ||
87 | 作为这些脚本的替代,quilt 是值得推荐的补丁管理工具(看上面的链接)。 | ||
88 | |||
89 | 2)描述你的改动。 | ||
90 | 描述你的改动包含的技术细节。 | ||
91 | |||
92 | 要多具体就写多具体。最糟糕的描述可能是像下面这些语句:“更新了某驱动程 | ||
93 | 序”,“修正了某驱动程序的bug”,或者“这个补丁包含了某子系统的修改,请 | ||
94 | 使用。” | ||
95 | |||
96 | 如果你的描述开始变长,这表示你也许需要拆分你的补丁了,请看第3小节, | ||
97 | 继续。 | ||
98 | |||
99 | 3)拆分你的改动 | ||
100 | |||
101 | 将改动拆分,逻辑类似的放到同一个补丁文件里。 | ||
102 | |||
103 | 例如,如果你的改动里同时有bug修正和性能优化,那么把这些改动才分到两个或 | ||
104 | 者更多的补丁文件中。如果你的改动包含对API的修改,并且修改了驱动程序来适 | ||
105 | 应这些新的API,那么把这些修改分成两个补丁。 | ||
106 | |||
107 | 另一方面,如果你将一个单独的改动做成多个补丁文件,那么将它们合并成一个 | ||
108 | 单独的补丁文件。这样一个逻辑上单独的改动只被包含在一个补丁文件里。 | ||
109 | |||
110 | 如果有一个补丁依赖另外一个补丁来完成它的改动,那没问题。简单的在你的补 | ||
111 | 丁描述里指出“这个补丁依赖某补丁”就好了。 | ||
112 | |||
113 | 如果你不能将补丁浓缩成更少的文件,那么每次大约发送出15个,然后等待审查 | ||
114 | 和整合。 | ||
115 | |||
116 | 4)选择 e-mail 的收件人 | ||
117 | |||
118 | 看一遍 MAINTAINERS 文件和源代码,看看你所的改动所在的内核子系统有没有指 | ||
119 | 定的维护者。如果有,给他们发e-mail。 | ||
120 | |||
121 | 如果没有找到维护者,或者维护者没有反馈,将你的补丁发送到内核开发者主邮 | ||
122 | 件列表 linux-kernel@vger.kernel.org。大部分的内核开发者都跟踪这个邮件列 | ||
123 | 表,可以评价你的改动。 | ||
124 | |||
125 | 每次不要发送超过15个补丁到 vger 邮件列表!!! | ||
126 | |||
127 | Linus Torvalds 是决定改动能否进入 Linux 内核的最终裁决者。他的 e-mail | ||
128 | 地址是 <torvalds@linux-foundation.org> 。他收到的 e-mail 很多,所以一般 | ||
129 | 的说,最好别给他发 e-mail。 | ||
130 | |||
131 | 那些修正bug,“显而易见”的修改或者是类似的只需要很少讨论的补丁可以直接 | ||
132 | 发送或者CC给Linus。那些需要讨论或者没有很清楚的好处的补丁,一般先发送到 | ||
133 | linux-kernel邮件列表。只有当补丁被讨论得差不多了,才提交给Linus。 | ||
134 | |||
135 | 5)选择CC( e-mail 抄送)列表 | ||
136 | |||
137 | 除非你有理由不这样做,否则CC linux-kernel@vger.kernel.org。 | ||
138 | |||
139 | 除了 Linus 之外,其他内核开发者也需要注意到你的改动,这样他们才能评论你 | ||
140 | 的改动并提供代码审查和建议。linux-kernel 是 Linux 内核开发者主邮件列表 | ||
141 | 。其它的邮件列表为特定的子系统提供服务,比如 USB,framebuffer 设备,虚 | ||
142 | 拟文件系统,SCSI 子系统,等等。查看 MAINTAINERS 文件来获得和你的改动有 | ||
143 | 关的邮件列表。 | ||
144 | |||
145 | Majordomo lists of VGER.KERNEL.ORG at: | ||
146 | <http://vger.kernel.org/vger-lists.html> | ||
147 | |||
148 | 如果改动影响了用户空间和内核之间的接口,请给 MAN-PAGES 的维护者(列在 | ||
149 | MAITAINERS 文件里的)发送一个手册页(man-pages)补丁,或者至少通知一下改 | ||
150 | 变,让一些信息有途径进入手册页。 | ||
151 | |||
152 | 即使在第四步的时候,维护者没有作出回应,也要确认在修改他们的代码的时候 | ||
153 | ,一直将维护者拷贝到CC列表中。 | ||
154 | |||
155 | 对于小的补丁,你也许会CC到 Adrian Bunk 管理的搜集琐碎补丁的邮件列表 | ||
156 | (Trivial Patch Monkey)trivial@kernel.org,那里专门收集琐碎的补丁。下面这样 | ||
157 | 的补丁会被看作“琐碎的”补丁: | ||
158 | 文档的拼写修正。 | ||
159 | 修正会影响到 grep(1) 的拼写。 | ||
160 | 警告信息修正(频繁的打印无用的警告是不好的。) | ||
161 | 编译错误修正(代码逻辑的确是对的,只是编译有问题。) | ||
162 | 运行时修正(只要真的修正了错误。) | ||
163 | 移除使用了被废弃的函数/宏的代码(例如 check_region。) | ||
164 | 联系方式和文档修正。 | ||
165 | 用可移植的代码替换不可移植的代码(即使在体系结构相关的代码中,既然有 | ||
166 | 人拷贝,只要它是琐碎的) | ||
167 | 任何文件的作者/维护者对该文件的改动(例如 patch monkey 在重传模式下) | ||
168 | |||
169 | URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/> | ||
170 | |||
171 | (译注,关于“琐碎补丁”的一些说明:因为原文的这一部分写得比较简单,所以不得不 | ||
172 | 违例写一下译注。"trivial"这个英文单词的本意是“琐碎的,不重要的。”但是在这里 | ||
173 | 有稍微有一些变化,例如对一些明显的NULL指针的修正,属于运行时修正,会被归类 | ||
174 | 到琐碎补丁里。虽然NULL指针的修正很重要,但是这样的修正往往很小而且很容易得到 | ||
175 | 检验,所以也被归入琐碎补丁。琐碎补丁更精确的归类应该是 | ||
176 | “simple, localized & easy to verify”,也就是说简单的,局部的和易于检验的。 | ||
177 | trivial@kernel.org邮件列表的目的是针对这样的补丁,为提交者提供一个中心,来 | ||
178 | 降低提交的门槛。) | ||
179 | |||
180 | 6)没有 MIME 编码,没有链接,没有压缩,没有附件,只有纯文本。 | ||
181 | |||
182 | Linus 和其他的内核开发者需要阅读和评论你提交的改动。对于内核开发者来说 | ||
183 | ,可以“引用”你的改动很重要,使用一般的 e-mail 工具,他们就可以在你的 | ||
184 | 代码的任何位置添加评论。 | ||
185 | |||
186 | 因为这个原因,所有的提交的补丁都是 e-mail 中“内嵌”的。 | ||
187 | 警告:如果你使用剪切-粘贴你的补丁,小心你的编辑器的自动换行功能破坏你的 | ||
188 | 补丁。 | ||
189 | |||
190 | 不要将补丁作为 MIME 编码的附件,不管是否压缩。很多流行的 e-mail 软件不 | ||
191 | 是任何时候都将 MIME 编码的附件当作纯文本发送的,这会使得别人无法在你的 | ||
192 | 代码中加评论。另外,MIME 编码的附件会让 Linus 多花一点时间来处理,这就 | ||
193 | 降低了你的改动被接受的可能性。 | ||
194 | |||
195 | 警告:一些邮件软件,比如 Mozilla 会将你的信息以如下格式发送: | ||
196 | ---- 邮件头 ---- | ||
197 | Content-Type: text/plain; charset=us-ascii; format=flowed | ||
198 | ---- 邮件头 ---- | ||
199 | 问题在于 “format=flowed” 会让接收端的某些邮件软件将邮件中的制表符替换 | ||
200 | 成空格以及做一些类似的替换。这样,你发送的时候看起来没问题的补丁就被破 | ||
201 | 坏了。 | ||
202 | |||
203 | 要修正这个问题,只需要将你的 mozilla 的 defaults/pref/mailnews.js 文件 | ||
204 | 里的 | ||
205 | pref("mailnews.send_plaintext_flowed", false); // RFC 2646======= | ||
206 | 修改成 | ||
207 | pref("mailnews.display.disable_format_flowed_support", true); | ||
208 | 就可以了。 | ||
209 | |||
210 | 7) e-mail 的大小 | ||
211 | |||
212 | 给 Linus 发送补丁的时候,永远按照第6小节说的做。 | ||
213 | |||
214 | 大的改动对邮件列表不合适,对某些维护者也不合适。如果你的补丁,在不压缩 | ||
215 | 的情况下,超过了40kB,那么你最好将补丁放在一个能通过 internet 访问的服 | ||
216 | 务器上,然后用指向你的补丁的 URL 替代。 | ||
217 | |||
218 | 8) 指出你的内核版本 | ||
219 | |||
220 | 在标题和在补丁的描述中,指出补丁对应的内核的版本,是很重要的。 | ||
221 | |||
222 | 如果补丁不能干净的在最新版本的内核上打上,Linus 是不会接受它的。 | ||
223 | |||
224 | 9) 不要气馁,继续提交。 | ||
225 | |||
226 | 当你提交了改动以后,耐心地等待。如果 Linus 喜欢你的改动并且同意它,那么 | ||
227 | 它将在下一个内核发布版本中出现。 | ||
228 | |||
229 | 然而,如果你的改动没有出现在下一个版本的内核中,可能有若干原因。减少那 | ||
230 | 些原因,修正错误,重新提交更新后的改动,是你自己的工作。 | ||
231 | |||
232 | Linus不给出任何评论就“丢弃”你的补丁是常见的事情。在系统中这样的事情很 | ||
233 | 平常。如果他没有接受你的补丁,也许是由于以下原本: | ||
234 | * 你的补丁不能在最新版本的内核上干净的打上。 | ||
235 | * 你的补丁在 linux-kernel 邮件列表中没有得到充分的讨论。 | ||
236 | * 风格问题(参照第2小节) | ||
237 | * 邮件格式问题(重读本节) | ||
238 | * 你的改动有技术问题。 | ||
239 | * 他收到了成吨的 e-mail,而你的在混乱中丢失了。 | ||
240 | * 你让人为难。 | ||
241 | |||
242 | 有疑问的时候,在 linux-kernel 邮件列表上请求评论。 | ||
243 | |||
244 | 10) 在标题上加上 PATCH 的字样 | ||
245 | |||
246 | Linus 和 linux-kernel 邮件列表的 e-mail 流量都很高,一个通常的约定是标 | ||
247 | 题行以 [PATCH] 开头。这样可以让 Linus 和其他内核开发人员可以从 e-mail | ||
248 | 的讨论中很轻易的将补丁分辨出来。 | ||
249 | |||
250 | 11)为你的工作签名 | ||
251 | |||
252 | 为了加强对谁做了何事的追踪,尤其是对那些透过好几层的维护者的补丁,我们 | ||
253 | 建议在发送出去的补丁上加一个 “sign-off” 的过程。 | ||
254 | |||
255 | "sign-off" 是在补丁的注释的最后的简单的一行文字,认证你编写了它或者其他 | ||
256 | 人有权力将它作为开放源代码的补丁传递。规则很简单:如果你能认证如下信息 | ||
257 | : | ||
258 | 开发者来源证书 1.1 | ||
259 | 对于本项目的贡献,我认证如下信息: | ||
260 | (a)这些贡献是完全或者部分的由我创建,我有权利以文件中指出 | ||
261 | 的开放源代码许可证提交它;或者 | ||
262 | (b)这些贡献基于以前的工作,据我所知,这些以前的工作受恰当的开放 | ||
263 | 源代码许可证保护,而且,根据许可证,我有权提交修改后的贡献, | ||
264 | 无论是完全还是部分由我创造,这些贡献都使用同一个开放源代码许可证 | ||
265 | (除非我被允许用其它的许可证),正如文件中指出的;或者 | ||
266 | (c)这些贡献由认证(a),(b)或者(c)的人直接提供给我,而 | ||
267 | 且我没有修改它。 | ||
268 | (d)我理解并同意这个项目和贡献是公开的,贡献的记录(包括我 | ||
269 | 一起提交的个人记录,包括 sign-off )被永久维护并且可以和这个项目 | ||
270 | 或者开放源代码的许可证同步地再发行。 | ||
271 | 那么加入这样一行: | ||
272 | Signed-off-by: Random J Developer <random@developer.example.org> | ||
273 | |||
274 | 使用你的真名(抱歉,不能使用假名或者匿名。) | ||
275 | |||
276 | 有人在最后加上标签。现在这些东西会被忽略,但是你可以这样做,来标记公司 | ||
277 | 内部的过程,或者只是指出关于 sign-off 的一些特殊细节。 | ||
278 | |||
279 | 12)标准补丁格式 | ||
280 | |||
281 | 标准的补丁,标题行是: | ||
282 | Subject: [PATCH 001/123] 子系统:一句话概述 | ||
283 | |||
284 | 标准补丁的信体存在如下部分: | ||
285 | |||
286 | - 一个 "from" 行指出补丁作者。 | ||
287 | |||
288 | - 一个空行 | ||
289 | |||
290 | - 说明的主体,这些说明文字会被拷贝到描述该补丁的永久改动记录里。 | ||
291 | |||
292 | - 一个由"---"构成的标记行 | ||
293 | |||
294 | - 不合适放到改动记录里的额外的注解。 | ||
295 | |||
296 | - 补丁本身(diff 输出) | ||
297 | |||
298 | 标题行的格式,使得对标题行按字母序排序非常的容易 - 很多 e-mail 客户端都 | ||
299 | 可以支持 - 因为序列号是用零填充的,所以按数字排序和按字母排序是一样的。 | ||
300 | |||
301 | e-mail 标题中的“子系统”标识哪个内核子系统将被打补丁。 | ||
302 | |||
303 | e-mail 标题中的“一句话概述”扼要的描述 e-mail 中的补丁。“一句话概述” | ||
304 | 不应该是一个文件名。对于一个补丁系列(“补丁系列”指一系列的多个相关补 | ||
305 | 丁),不要对每个补丁都使用同样的“一句话概述”。 | ||
306 | |||
307 | 记住 e-mail 的“一句话概述”会成为该补丁的全局唯一标识。它会蔓延到 git | ||
308 | 的改动记录里。然后“一句话概述”会被用在开发者的讨论里,用来指代这个补 | ||
309 | 丁。用户将希望通过 google 来搜索"一句话概述"来找到那些讨论这个补丁的文 | ||
310 | 章。 | ||
311 | |||
312 | 一些标题的例子: | ||
313 | |||
314 | Subject: [patch 2/5] ext2: improve scalability of bitmap searching | ||
315 | Subject: [PATCHv2 001/207] x86: fix eflags tracking | ||
316 | |||
317 | "from" 行是信体里的最上面一行,具有如下格式: | ||
318 | From: Original Author <author@example.com> | ||
319 | |||
320 | "from" 行指明在永久改动日志里,谁会被确认为作者。如果没有 "from" 行,那 | ||
321 | 么邮件头里的 "From: " 行会被用来决定改动日志中的作者。 | ||
322 | |||
323 | 说明的主题将会被提交到永久的源代码改动日志里,因此对那些早已经不记得和 | ||
324 | 这个补丁相关的讨论细节的有能力的读者来说,是有意义的。 | ||
325 | |||
326 | "---" 标记行对于补丁处理工具要找到哪里是改动日志信息的结束,是不可缺少 | ||
327 | 的。 | ||
328 | |||
329 | 对于 "---" 标记之后的额外注解,一个好的用途就是用来写 diffstat,用来显 | ||
330 | 示修改了什么文件和每个文件都增加和删除了多少行。diffstat 对于比较大的补 | ||
331 | 丁特别有用。其余那些只是和时刻或者开发者相关的注解,不合适放到永久的改 | ||
332 | 动日志里的,也应该放这里。 | ||
333 | 使用 diffstat的选项 "-p 1 -w 70" 这样文件名就会从内核源代码树的目录开始 | ||
334 | ,不会占用太宽的空间(很容易适合80列的宽度,也许会有一些缩进。) | ||
335 | |||
336 | 在后面的参考资料中能看到适当的补丁格式的更多细节。 | ||
337 | |||
338 | ------------------------------- | ||
339 | 第二节 提示,建议和诀窍 | ||
340 | ------------------------------- | ||
341 | |||
342 | 本节包含很多和提交到内核的代码有关的通常的"规则"。事情永远有例外...但是 | ||
343 | 你必须真的有好的理由这样做。你可以把本节叫做Linus的计算机科学入门课。 | ||
344 | |||
345 | 1) 读 Document/CodingStyle | ||
346 | |||
347 | Nuff 说过,如果你的代码和这个偏离太多,那么它有可能会被拒绝,没有更多的 | ||
348 | 审查,没有更多的评价。 | ||
349 | |||
350 | 2) #ifdef 是丑陋的 | ||
351 | 混杂了 ifdef 的代码难以阅读和维护。别这样做。作为替代,将你的 ifdef 放 | ||
352 | 在头文件里,有条件地定义 "static inline" 函数,或者宏,在代码里用这些东 | ||
353 | 西。让编译器把那些"空操作"优化掉。 | ||
354 | |||
355 | 一个简单的例子,不好的代码: | ||
356 | |||
357 | dev = alloc_etherdev (sizeof(struct funky_private)); | ||
358 | if (!dev) | ||
359 | return -ENODEV; | ||
360 | #ifdef CONFIG_NET_FUNKINESS | ||
361 | init_funky_net(dev); | ||
362 | #endif | ||
363 | |||
364 | 清理后的例子: | ||
365 | |||
366 | (头文件里) | ||
367 | #ifndef CONFIG_NET_FUNKINESS | ||
368 | static inline void init_funky_net (struct net_device *d) {} | ||
369 | #endif | ||
370 | |||
371 | (代码文件里) | ||
372 | dev = alloc_etherdev (sizeof(struct funky_private)); | ||
373 | if (!dev) | ||
374 | return -ENODEV; | ||
375 | init_funky_net(dev); | ||
376 | |||
377 | 3) 'static inline' 比宏好 | ||
378 | |||
379 | Static inline 函数相比宏来说,是好得多的选择。Static inline 函数提供了 | ||
380 | 类型安全,没有长度限制,没有格式限制,在 gcc 下开销和宏一样小。 | ||
381 | |||
382 | 宏只在 static inline 函数不是最优的时候[在 fast paths 里有很少的独立的 | ||
383 | 案例],或者不可能用 static inline 函数的时候[例如字符串分配]。 | ||
384 | 应该用 'static inline' 而不是 'static __inline__', 'extern inline' 和 | ||
385 | 'extern __inline__' 。 | ||
386 | |||
387 | 4) 不要过度设计 | ||
388 | |||
389 | 不要试图预计模糊的未来事情,这些事情也许有用也许没有用:"让事情尽可能的 | ||
390 | 简单,而不是更简单"。 | ||
391 | |||
392 | ---------------- | ||
393 | 第三节 参考文献 | ||
394 | ---------------- | ||
395 | |||
396 | Andrew Morton, "The perfect patch" (tpp). | ||
397 | <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> | ||
398 | |||
399 | Jeff Garzik, "Linux kernel patch submission format". | ||
400 | <http://linux.yyz.us/patch-format.html> | ||
401 | |||
402 | Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". | ||
403 | <http://www.kroah.com/log/2005/03/31/> | ||
404 | <http://www.kroah.com/log/2005/07/08/> | ||
405 | <http://www.kroah.com/log/2005/10/19/> | ||
406 | <http://www.kroah.com/log/2006/01/11/> | ||
407 | |||
408 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! | ||
409 | <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2> | ||
410 | |||
411 | Kernel Documentation/CodingStyle: | ||
412 | <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle> | ||
413 | |||
414 | Linus Torvalds's mail on the canonical patch format: | ||
415 | <http://lkml.org/lkml/2005/4/7/183> | ||
416 | -- | ||
diff --git a/Documentation/zh_CN/oops-tracing.txt b/Documentation/zh_CN/oops-tracing.txt new file mode 100644 index 000000000000..9312608ffb8d --- /dev/null +++ b/Documentation/zh_CN/oops-tracing.txt | |||
@@ -0,0 +1,212 @@ | |||
1 | Chinese translated version of Documentation/oops-tracing.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: Dave Young <hidave.darkstar@gmail.com> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/oops-tracing.txt 的中文翻译 | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | |||
17 | 中文版维护者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> | ||
18 | 中文版翻译者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> | ||
19 | 中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
20 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
21 | |||
22 | 以下为正文 | ||
23 | --------------------------------------------------------------------- | ||
24 | |||
25 | 注意: ksymoops 在2.6中是没有用的。 请以原有格式使用Oops(来自dmesg,等等)。 | ||
26 | 忽略任何这样那样关于“解码Oops”或者“通过ksymoops运行”的文档。 如果你贴出运行过 | ||
27 | ksymoops的来自2.6的Oops,人们只会让你重贴一次。 | ||
28 | |||
29 | 快速总结 | ||
30 | ------------- | ||
31 | |||
32 | 发现Oops并发送给看似相关的内核领域的维护者。别太担心对不上号。如果你不确定就发给 | ||
33 | 和你所做的事情相关的代码的负责人。 如果可重现试着描述怎样重构。 那甚至比oops更有 | ||
34 | 价值。 | ||
35 | |||
36 | 如果你对于发送给谁一无所知, 发给linux-kernel@vger.kernel.org。感谢你帮助Linux | ||
37 | 尽可能地稳定。 | ||
38 | |||
39 | Oops在哪里? | ||
40 | ---------------------- | ||
41 | |||
42 | 通常Oops文本由klogd从内核缓冲区里读取并传给syslogd,由syslogd写到syslog文件中, | ||
43 | 典型地是/var/log/messages(依赖于/etc/syslog.conf)。有时klogd崩溃了,这种情况下你 | ||
44 | 能够运行dmesg > file来从内核缓冲区中读取数据并保存下来。 否则你可以 | ||
45 | cat /proc/kmsg > file, 然而你必须介入中止传输, kmsg是一个“永不结束的文件”。如 | ||
46 | 果机器崩溃坏到你不能输入命令或者磁盘不可用那么你有三种选择:- | ||
47 | |||
48 | (1) 手抄屏幕上的文本待机器重启后再输入计算机。 麻烦但如果没有针对崩溃的准备, | ||
49 | 这是仅有的选择。 另外,你可以用数码相机把屏幕拍下来-不太好,但比没有强。 如果信 | ||
50 | 息滚动到了终端的上面,你会发现以高分辩率启动(比如,vga=791)会让你读到更多的文 | ||
51 | 本。(注意:这需要vesafb,所以对‘早期’的oops没有帮助) | ||
52 | |||
53 | (2)用串口终端启动(请参看Documentation/serial-console.txt),运行一个null | ||
54 | modem到另一台机器并用你喜欢的通讯工具获取输出。Minicom工作地很好。 | ||
55 | |||
56 | (3)使用Kdump(请参看Documentation/kdump/kdump.txt), | ||
57 | 使用在Documentation/kdump/gdbmacros.txt中定义的dmesg gdb宏,从旧的内存中提取内核 | ||
58 | 环形缓冲区。 | ||
59 | |||
60 | 完整信息 | ||
61 | ---------------- | ||
62 | |||
63 | 注意:以下来自于Linus的邮件适用于2.4内核。 我因为历史原因保留了它,并且因为其中 | ||
64 | 一些信息仍然适用。 特别注意的是,请忽略任何ksymoops的引用。 | ||
65 | |||
66 | From: Linus Torvalds <torvalds@osdl.org> | ||
67 | |||
68 | 怎样跟踪Oops.. [原发到linux-kernel的一封邮件] | ||
69 | |||
70 | 主要的窍门是有五年和这些烦人的oops消息打交道的经验;-) | ||
71 | |||
72 | 实际上,你有办法使它更简单。我有两个不同的方法: | ||
73 | |||
74 | gdb /usr/src/linux/vmlinux | ||
75 | gdb> disassemble <offending_function> | ||
76 | |||
77 | 那是发现问题的简单办法,至少如果bug报告做的好的情况下(象这个一样-运行ksymoops | ||
78 | 得到oops发生的函数及函数内的偏移)。 | ||
79 | |||
80 | 哦,如果报告发生的内核以相同的编译器和相似的配置编译它会有帮助的。 | ||
81 | |||
82 | 另一件要做的事是反汇编bug报告的“Code”部分:ksymoops也会用正确的工具来做这件事, | ||
83 | 但如果没有那些工具你可以写一个傻程序: | ||
84 | |||
85 | char str[] = "\xXX\xXX\xXX..."; | ||
86 | main(){} | ||
87 | |||
88 | 并用gcc -g编译它然后执行“disassemble str”(XX部分是由Oops报告的值-你可以仅剪切 | ||
89 | 粘贴并用“\x”替换空格-我就是这么做的,因为我懒得写程序自动做这一切)。 | ||
90 | |||
91 | 另外,你可以用scripts/decodecode这个shell脚本。它的使用方法是: | ||
92 | decodecode < oops.txt | ||
93 | |||
94 | “Code”之后的十六进制字节可能(在某些架构上)有一些当前指令之前的指令字节以及 | ||
95 | 当前和之后的指令字节 | ||
96 | |||
97 | Code: f9 0f 8d f9 00 00 00 8d 42 0c e8 dd 26 11 c7 a1 60 ea 2b f9 8b 50 08 a1 | ||
98 | 64 ea 2b f9 8d 34 82 8b 1e 85 db 74 6d 8b 15 60 ea 2b f9 <8b> 43 04 39 42 54 | ||
99 | 7e 04 40 89 42 54 8b 43 04 3b 05 00 f6 52 c0 | ||
100 | |||
101 | 最后,如果你想知道代码来自哪里,你可以: | ||
102 | |||
103 | cd /usr/src/linux | ||
104 | make fs/buffer.s # 或任何产生BUG的文件 | ||
105 | |||
106 | 然后你会比gdb反汇编更清楚的知道发生了什么。 | ||
107 | |||
108 | 现在,问题是把你所拥有的所有数据结合起来:C源码(关于它应该怎样的一般知识), | ||
109 | 汇编代码及其反汇编得到的代码(另外还有从“oops”消息得到的寄存器状态-对了解毁坏的 | ||
110 | 指针有用,而且当你有了汇编代码你也能拿其它的寄存器和任何它们对应的C表达式做匹配 | ||
111 | )。 | ||
112 | |||
113 | 实际上,你仅需看看哪里不匹配(这个例子是“Code”反汇编和编译器生成的代码不匹配)。 | ||
114 | 然后你须要找出为什么不匹配。通常很简单-你看到代码使用了空指针然后你看代码想知道 | ||
115 | 空指针是怎么出现的,还有检查它是否合法.. | ||
116 | |||
117 | 现在,如果明白这是一项耗时的工作而且需要一丁点儿的专心,没错。这就是我为什么大多 | ||
118 | 只是忽略那些没有符号表信息的崩溃报告的原因:简单的说太难查找了(我有一些 | ||
119 | 程序用于在内核代码段中搜索特定的模式,而且有时我也已经能找出那些崩溃的地方,但是 | ||
120 | 仅仅是找出正确的序列也确实需要相当扎实的内核知识) | ||
121 | |||
122 | _有时_会发生这种情况,我仅看到崩溃中的反汇编代码序列, 然后我马上就明白问题出在 | ||
123 | 哪里。这时我才意识到自己干这个工作已经太长时间了;-) | ||
124 | |||
125 | Linus | ||
126 | |||
127 | |||
128 | --------------------------------------------------------------------------- | ||
129 | 关于Oops跟踪的注解: | ||
130 | |||
131 | 为了帮助Linus和其它内核开发者,klogd纳入了大量的支持来处理保护错误。为了拥有对 | ||
132 | 地址解析的完整支持至少应该使用1.3-pl3的sysklogd包。 | ||
133 | |||
134 | 当保护错误发生时,klogd守护进程自动把内核日志信息中的重要地址翻译成它们相应的符 | ||
135 | 号。 | ||
136 | |||
137 | klogd执行两种类型的地址解析。首先是静态翻译其次是动态翻译。静态翻译和ksymoops | ||
138 | 一样使用System.map文件。为了做静态翻译klogd守护进程必须在初始化时能找到system | ||
139 | map文件。关于klogd怎样搜索map文件请参看klogd手册页。 | ||
140 | |||
141 | 动态地址翻译在使用内核可装载模块时很重要。 因为内核模块的内存是从内核动态内存池 | ||
142 | 里分配的,所以不管是模块开始位置还是模块中函数和符号的位置都不是固定的。 | ||
143 | |||
144 | 内核支持允许程序决定装载哪些模块和它们在内存中位置的系统调用。使用这些系统调用 | ||
145 | klogd守护进程生成一张符号表用于调试发生在可装载模块中的保护错误。 | ||
146 | |||
147 | 至少klogd会提供产生保护错误的模块名。还可有额外的符号信息供可装载模块开发者选择 | ||
148 | 以从模块中输出符号信息。 | ||
149 | |||
150 | 因为内核模块环境可能是动态的,所以必须有一种机制当模块环境发生改变时来通知klogd | ||
151 | 守护进程。 有一些可用的命令行选项允许klogd向当前执行中的守护进程发送信号,告知符 | ||
152 | 号信息应该被刷新了。 更多信息请参看klogd手册页。 | ||
153 | |||
154 | sysklogd发布时包含一个补丁修改了modules-2.0.0包,无论何时一个模块装载或者卸载都 | ||
155 | 会自动向klogd发送信号。打上这个补丁提供了必要的对调试发生于内核可装载模块的保护 | ||
156 | 错误的无缝支持。 | ||
157 | |||
158 | 以下是被klogd处理过的发生在可装载模块中的一个保护错误例子: | ||
159 | --------------------------------------------------------------------------- | ||
160 | Aug 29 09:51:01 blizard kernel: Unable to handle kernel paging request at virtual address f15e97cc | ||
161 | Aug 29 09:51:01 blizard kernel: current->tss.cr3 = 0062d000, %cr3 = 0062d000 | ||
162 | Aug 29 09:51:01 blizard kernel: *pde = 00000000 | ||
163 | Aug 29 09:51:01 blizard kernel: Oops: 0002 | ||
164 | Aug 29 09:51:01 blizard kernel: CPU: 0 | ||
165 | Aug 29 09:51:01 blizard kernel: EIP: 0010:[oops:_oops+16/3868] | ||
166 | Aug 29 09:51:01 blizard kernel: EFLAGS: 00010212 | ||
167 | Aug 29 09:51:01 blizard kernel: eax: 315e97cc ebx: 003a6f80 ecx: 001be77b edx: 00237c0c | ||
168 | Aug 29 09:51:01 blizard kernel: esi: 00000000 edi: bffffdb3 ebp: 00589f90 esp: 00589f8c | ||
169 | Aug 29 09:51:01 blizard kernel: ds: 0018 es: 0018 fs: 002b gs: 002b ss: 0018 | ||
170 | Aug 29 09:51:01 blizard kernel: Process oops_test (pid: 3374, process nr: 21, stackpage=00589000) | ||
171 | Aug 29 09:51:01 blizard kernel: Stack: 315e97cc 00589f98 0100b0b4 bffffed4 0012e38e 00240c64 003a6f80 00000001 | ||
172 | Aug 29 09:51:01 blizard kernel: 00000000 00237810 bfffff00 0010a7fa 00000003 00000001 00000000 bfffff00 | ||
173 | Aug 29 09:51:01 blizard kernel: bffffdb3 bffffed4 ffffffda 0000002b 0007002b 0000002b 0000002b 00000036 | ||
174 | Aug 29 09:51:01 blizard kernel: Call Trace: [oops:_oops_ioctl+48/80] [_sys_ioctl+254/272] [_system_call+82/128] | ||
175 | Aug 29 09:51:01 blizard kernel: Code: c7 00 05 00 00 00 eb 08 90 90 90 90 90 90 90 90 89 ec 5d c3 | ||
176 | --------------------------------------------------------------------------- | ||
177 | |||
178 | Dr. G.W. Wettstein Oncology Research Div. Computing Facility | ||
179 | Roger Maris Cancer Center INTERNET: greg@wind.rmcc.com | ||
180 | 820 4th St. N. | ||
181 | Fargo, ND 58122 | ||
182 | Phone: 701-234-7556 | ||
183 | |||
184 | |||
185 | --------------------------------------------------------------------------- | ||
186 | 受污染的内核 | ||
187 | |||
188 | 一些oops报告在程序记数器之后包含字符串'Tainted: '。这表明内核已经被一些东西给污 | ||
189 | 染了。 该字符串之后紧跟着一系列的位置敏感的字符,每个代表一个特定的污染值。 | ||
190 | |||
191 | 1:'G'如果所有装载的模块都有GPL或相容的许可证,'P'如果装载了任何的专有模块。 | ||
192 | 没有模块MODULE_LICENSE或者带有insmod认为是与GPL不相容的的MODULE_LICENSE的模块被 | ||
193 | 认定是专有的。 | ||
194 | |||
195 | 2:'F'如果有任何通过“insmod -f”被强制装载的模块,' '如果所有模块都被正常装载。 | ||
196 | |||
197 | 3:'S'如果oops发生在SMP内核中,运行于没有证明安全运行多处理器的硬件。 当前这种 | ||
198 | 情况仅限于几种不支持SMP的速龙处理器。 | ||
199 | |||
200 | 4:'R'如果模块通过“insmod -f”被强制装载,' '如果所有模块都被正常装载。 | ||
201 | |||
202 | 5:'M'如果任何处理器报告了机器检查异常,' '如果没有发生机器检查异常。 | ||
203 | |||
204 | 6:'B'如果页释放函数发现了一个错误的页引用或者一些非预期的页标志。 | ||
205 | |||
206 | 7:'U'如果用户或者用户应用程序特别请求设置污染标志,否则' '。 | ||
207 | |||
208 | 8:'D'如果内核刚刚死掉,比如有OOPS或者BUG。 | ||
209 | |||
210 | 使用'Tainted: '字符串的主要原因是要告诉内核调试者,这是否是一个干净的内核亦或发 | ||
211 | 生了任何的不正常的事。污染是永久的:即使出错的模块已经被卸载了,污染值仍然存在, | ||
212 | 以表明内核不再值得信任。 | ||
diff --git a/Documentation/zh_CN/sparse.txt b/Documentation/zh_CN/sparse.txt new file mode 100644 index 000000000000..75992a603ae3 --- /dev/null +++ b/Documentation/zh_CN/sparse.txt | |||
@@ -0,0 +1,100 @@ | |||
1 | Chinese translated version of Documentation/sparse.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: Li Yang <leo@zh-kernel.org> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/sparse.txt 的中文翻译 | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | |||
17 | 中文版维护者: 李阳 Li Yang <leo@zh-kernel.org> | ||
18 | 中文版翻译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
19 | |||
20 | |||
21 | 以下为正文 | ||
22 | --------------------------------------------------------------------- | ||
23 | |||
24 | Copyright 2004 Linus Torvalds | ||
25 | Copyright 2004 Pavel Machek <pavel@suse.cz> | ||
26 | Copyright 2006 Bob Copeland <me@bobcopeland.com> | ||
27 | |||
28 | 使用 sparse 工具做类型检查 | ||
29 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
30 | |||
31 | "__bitwise" 是一种类型属性,所以你应该这样使用它: | ||
32 | |||
33 | typedef int __bitwise pm_request_t; | ||
34 | |||
35 | enum pm_request { | ||
36 | PM_SUSPEND = (__force pm_request_t) 1, | ||
37 | PM_RESUME = (__force pm_request_t) 2 | ||
38 | }; | ||
39 | |||
40 | 这样会使 PM_SUSPEND 和 PM_RESUME 成为位方式(bitwise)整数(使用"__force" | ||
41 | 是因为 sparse 会抱怨改变位方式的类型转换,但是这里我们确实需要强制进行转 | ||
42 | 换)。而且因为所有枚举值都使用了相同的类型,这里的"enum pm_request"也将 | ||
43 | 会使用那个类型做为底层实现。 | ||
44 | |||
45 | 而且使用 gcc 编译的时候,所有的 __bitwise/__force 都会消失,最后在 gcc | ||
46 | 看来它们只不过是普通的整数。 | ||
47 | |||
48 | 坦白来说,你并不需要使用枚举类型。上面那些实际都可以浓缩成一个特殊的"int | ||
49 | __bitwise"类型。 | ||
50 | |||
51 | 所以更简单的办法只要这样做: | ||
52 | |||
53 | typedef int __bitwise pm_request_t; | ||
54 | |||
55 | #define PM_SUSPEND ((__force pm_request_t) 1) | ||
56 | #define PM_RESUME ((__force pm_request_t) 2) | ||
57 | |||
58 | 现在你就有了严格的类型检查所需要的所有基础架构。 | ||
59 | |||
60 | 一个小提醒:常数整数"0"是特殊的。你可以直接把常数零当作位方式整数使用而 | ||
61 | 不用担心 sparse 会抱怨。这是因为"bitwise"(恰如其名)是用来确保不同位方 | ||
62 | 式类型不会被弄混(小尾模式,大尾模式,cpu尾模式,或者其他),对他们来说 | ||
63 | 常数"0"确实是特殊的。 | ||
64 | |||
65 | 获取 sparse 工具 | ||
66 | ~~~~~~~~~~~~~~~~ | ||
67 | |||
68 | 你可以从 Sparse 的主页获取最新的发布版本: | ||
69 | |||
70 | http://www.kernel.org/pub/linux/kernel/people/josh/sparse/ | ||
71 | |||
72 | 或者,你也可以使用 git 克隆最新的 sparse 开发版本: | ||
73 | |||
74 | git://git.kernel.org/pub/scm/linux/kernel/git/josh/sparse.git | ||
75 | |||
76 | DaveJ 把每小时自动生成的 git 源码树 tar 包放在以下地址: | ||
77 | |||
78 | http://www.codemonkey.org.uk/projects/git-snapshots/sparse/ | ||
79 | |||
80 | 一旦你下载了源码,只要以普通用户身份运行: | ||
81 | |||
82 | make | ||
83 | make install | ||
84 | |||
85 | 它将会被自动安装到你的 ~/bin 目录下。 | ||
86 | |||
87 | 使用 sparse 工具 | ||
88 | ~~~~~~~~~~~~~~~~ | ||
89 | |||
90 | 用"make C=1"命令来编译内核,会对所有重新编译的 C 文件使用 sparse 工具。 | ||
91 | 或者使用"make C=2"命令,无论文件是否被重新编译都会对其使用 sparse 工具。 | ||
92 | 如果你已经编译了内核,用后一种方式可以很快地检查整个源码树。 | ||
93 | |||
94 | make 的可选变量 CHECKFLAGS 可以用来向 sparse 工具传递参数。编译系统会自 | ||
95 | 动向 sparse 工具传递 -Wbitwise 参数。你可以定义 __CHECK_ENDIAN__ 来进行 | ||
96 | 大小尾检查。 | ||
97 | |||
98 | make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__" | ||
99 | |||
100 | 这些检查默认都是被关闭的,因为他们通常会产生大量的警告。 | ||
diff --git a/Documentation/zh_CN/stable_kernel_rules.txt b/Documentation/zh_CN/stable_kernel_rules.txt new file mode 100644 index 000000000000..b5b9b0ab02fd --- /dev/null +++ b/Documentation/zh_CN/stable_kernel_rules.txt | |||
@@ -0,0 +1,66 @@ | |||
1 | Chinese translated version of Documentation/stable_kernel_rules.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: TripleX Chung <triplex@zh-kernel.org> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/stable_kernel_rules.txt 的中文翻译 | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
14 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
15 | 译存在问题,请联系中文版维护者。 | ||
16 | |||
17 | |||
18 | 中文版维护者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | ||
19 | 中文版翻译者: 钟宇 TripleX Chung <triplex@zh-kernel.org> | ||
20 | 中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> | ||
21 | Kangkai Yin <e12051@motorola.com> | ||
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | |||
26 | 关于Linux 2.6稳定版发布,所有你想知道的事情。 | ||
27 | |||
28 | 关于哪些类型的补丁可以被接收进入稳定版代码树,哪些不可以的规则: | ||
29 | |||
30 | - 必须是显而易见的正确,并且经过测试的。 | ||
31 | - 连同上下文,不能大于100行。 | ||
32 | - 必须只修正一件事情。 | ||
33 | - 必须修正了一个给大家带来麻烦的真正的bug(不是“这也许是一个问题...” | ||
34 | 那样的东西)。 | ||
35 | - 必须修正带来如下后果的问题:编译错误(对被标记为CONFIG_BROKEN的例外), | ||
36 | 内核崩溃,挂起,数据损坏,真正的安全问题,或者一些类似“哦,这不 | ||
37 | 好”的问题。简短的说,就是一些致命的问题。 | ||
38 | - 没有“理论上的竞争条件”,除非能给出竞争条件如何被利用的解释。 | ||
39 | - 不能存在任何的“琐碎的”修正(拼写修正,去掉多余空格之类的)。 | ||
40 | - 必须被相关子系统的维护者接受。 | ||
41 | - 必须遵循Documentation/SubmittingPatches里的规则。 | ||
42 | |||
43 | 向稳定版代码树提交补丁的过程: | ||
44 | |||
45 | - 在确认了补丁符合以上的规则后,将补丁发送到stable@kernel.org。 | ||
46 | - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收 | ||
47 | 到的是NAK回复。回复需要几天的时间,这取决于开发者的时间安排。 | ||
48 | - 被接受的补丁会被加到稳定版本队列里,等待其他开发者的审查。 | ||
49 | - 安全方面的补丁不要发到这个列表,应该发送到security@kernel.org。 | ||
50 | |||
51 | 审查周期: | ||
52 | |||
53 | - 当稳定版的维护者决定开始一个审查周期,补丁将被发送到审查委员会,以 | ||
54 | 及被补丁影响的领域的维护者(除非提交者就是该领域的维护者)并且抄送 | ||
55 | 到linux-kernel邮件列表。 | ||
56 | - 审查委员会有48小时的时间,用来决定给该补丁回复ACK还是NAK。 | ||
57 | - 如果委员会中有成员拒绝这个补丁,或者linux-kernel列表上有人反对这个 | ||
58 | 补丁,并提出维护者和审查委员会之前没有意识到的问题,补丁会从队列中 | ||
59 | 丢弃。 | ||
60 | - 在审查周期结束的时候,那些得到ACK回应的补丁将会被加入到最新的稳定版 | ||
61 | 发布中,一个新的稳定版发布就此产生。 | ||
62 | - 安全性补丁将从内核安全小组那里直接接收到稳定版代码树中,而不是通过 | ||
63 | 通常的审查周期。请联系内核安全小组以获得关于这个过程的更多细节。 | ||
64 | |||
65 | 审查委员会: | ||
66 | - 由一些自愿承担这项任务的内核开发者,和几个非志愿的组成。 | ||
diff --git a/Documentation/zh_CN/volatile-considered-harmful.txt b/Documentation/zh_CN/volatile-considered-harmful.txt new file mode 100644 index 000000000000..ba8149d2233a --- /dev/null +++ b/Documentation/zh_CN/volatile-considered-harmful.txt | |||
@@ -0,0 +1,113 @@ | |||
1 | Chinese translated version of Documentation/volatile-considered-harmful.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Maintainer: Jonathan Corbet <corbet@lwn.net> | ||
10 | Chinese maintainer: Bryan Wu <bryan.wu@analog.com> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/volatile-considered-harmful.txt 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | |||
18 | 英文版维护者: Jonathan Corbet <corbet@lwn.net> | ||
19 | 中文版维护者: 伍鹏 Bryan Wu <bryan.wu@analog.com> | ||
20 | 中文版翻译者: 伍鹏 Bryan Wu <bryan.wu@analog.com> | ||
21 | 中文版校译者: 张汉辉 Eugene Teo <eugeneteo@kernel.sg> | ||
22 | 杨瑞 Dave Young <hidave.darkstar@gmail.com> | ||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | |||
26 | 为什么不应该使用“volatile”类型 | ||
27 | ------------------------------ | ||
28 | |||
29 | C程序员通常认为volatile表示某个变量可以在当前执行的线程之外被改变;因此,在内核 | ||
30 | 中用到共享数据结构时,常常会有C程序员喜欢使用volatile这类变量。换句话说,他们经 | ||
31 | 常会把volatile类型看成某种简易的原子变量,当然它们不是。在内核中使用volatile几 | ||
32 | 乎总是错误的;本文档将解释为什么这样。 | ||
33 | |||
34 | 理解volatile的关键是知道它的目的是用来消除优化,实际上很少有人真正需要这样的应 | ||
35 | 用。在内核中,程序员必须防止意外的并发访问破坏共享的数据结构,这其实是一个完全 | ||
36 | 不同的任务。用来防止意外并发访问的保护措施,可以更加高效的避免大多数优化相关的 | ||
37 | 问题。 | ||
38 | |||
39 | 像volatile一样,内核提供了很多原语来保证并发访问时的数据安全(自旋锁, 互斥量,内 | ||
40 | 存屏障等等),同样可以防止意外的优化。如果可以正确使用这些内核原语,那么就没有 | ||
41 | 必要再使用volatile。如果仍然必须使用volatile,那么几乎可以肯定在代码的某处有一 | ||
42 | 个bug。在正确设计的内核代码中,volatile能带来的仅仅是使事情变慢。 | ||
43 | |||
44 | 思考一下这段典型的内核代码: | ||
45 | |||
46 | spin_lock(&the_lock); | ||
47 | do_something_on(&shared_data); | ||
48 | do_something_else_with(&shared_data); | ||
49 | spin_unlock(&the_lock); | ||
50 | |||
51 | 如果所有的代码都遵循加锁规则,当持有the_lock的时候,不可能意外的改变shared_data的 | ||
52 | 值。任何可能访问该数据的其他代码都会在这个锁上等待。自旋锁原语跟内存屏障一样—— 它 | ||
53 | 们显式的用来书写成这样 —— 意味着数据访问不会跨越它们而被优化。所以本来编译器认为 | ||
54 | 它知道在shared_data里面将有什么,但是因为spin_lock()调用跟内存屏障一样,会强制编 | ||
55 | 译器忘记它所知道的一切。那么在访问这些数据时不会有优化的问题。 | ||
56 | |||
57 | 如果shared_data被声名为volatile,锁操作将仍然是必须的。就算我们知道没有其他人正在 | ||
58 | 使用它,编译器也将被阻止优化对临界区内shared_data的访问。在锁有效的同时, | ||
59 | shared_data不是volatile的。在处理共享数据的时候,适当的锁操作可以不再需要 | ||
60 | volatile —— 并且是有潜在危害的。 | ||
61 | |||
62 | volatile的存储类型最初是为那些内存映射的I/O寄存器而定义。在内核里,寄存器访问也应 | ||
63 | 该被锁保护,但是人们也不希望编译器“优化”临界区内的寄存器访问。内核里I/O的内存访问 | ||
64 | 是通过访问函数完成的;不赞成通过指针对I/O内存的直接访问,并且不是在所有体系架构上 | ||
65 | 都能工作。那些访问函数正是为了防止意外优化而写的,因此,再说一次,volatile类型不 | ||
66 | 是必需的。 | ||
67 | |||
68 | 另一种引起用户可能使用volatile的情况是当处理器正忙着等待一个变量的值。正确执行一 | ||
69 | 个忙等待的方法是: | ||
70 | |||
71 | while (my_variable != what_i_want) | ||
72 | cpu_relax(); | ||
73 | |||
74 | cpu_relax()调用会降低CPU的能量消耗或者让位于超线程双处理器;它也作为内存屏障一样出 | ||
75 | 现,所以,再一次,volatile不是必需的。当然,忙等待一开始就是一种反常规的做法。 | ||
76 | |||
77 | 在内核中,一些稀少的情况下volatile仍然是有意义的: | ||
78 | |||
79 | - 在一些体系架构的系统上,允许直接的I/0内存访问,那么前面提到的访问函数可以使用 | ||
80 | volatile。基本上,每一个访问函数调用它自己都是一个小的临界区域并且保证了按照 | ||
81 | 程序员期望的那样发生访问操作。 | ||
82 | |||
83 | - 某些会改变内存的内联汇编代码虽然没有什么其他明显的附作用,但是有被GCC删除的可 | ||
84 | 能性。在汇编声明中加上volatile关键字可以防止这种删除操作。 | ||
85 | |||
86 | - Jiffies变量是一种特殊情况,虽然每次引用它的时候都可以有不同的值,但读jiffies | ||
87 | 变量时不需要任何特殊的加锁保护。所以jiffies变量可以使用volatile,但是不赞成 | ||
88 | 其他跟jiffies相同类型变量使用volatile。Jiffies被认为是一种“愚蠢的遗留物" | ||
89 | (Linus的话)因为解决这个问题比保持现状要麻烦的多。 | ||
90 | |||
91 | - 由于某些I/0设备可能会修改连续一致的内存,所以有时,指向连续一致内存的数据结构 | ||
92 | 的指针需要正确的使用volatile。网络适配器使用的环状缓存区正是这类情形的一个例 | ||
93 | 子,其中适配器用改变指针来表示哪些描述符已经处理过了。 | ||
94 | |||
95 | 对于大多代码,上述几种可以使用volatile的情况都不适用。所以,使用volatile是一种 | ||
96 | bug并且需要对这样的代码额外仔细检查。那些试图使用volatile的开发人员需要退一步想想 | ||
97 | 他们真正想实现的是什么。 | ||
98 | |||
99 | 非常欢迎删除volatile变量的补丁 - 只要证明这些补丁完整的考虑了并发问题。 | ||
100 | |||
101 | 注释 | ||
102 | ---- | ||
103 | |||
104 | [1] http://lwn.net/Articles/233481/ | ||
105 | [2] http://lwn.net/Articles/233482/ | ||
106 | |||
107 | 致谢 | ||
108 | ---- | ||
109 | |||
110 | 最初由Randy Dunlap推动并作初步研究 | ||
111 | 由Jonathan Corbet撰写 | ||
112 | 参考Satyam Sharma,Johannes Stezenbach,Jesper Juhl,Heikki Orsila, | ||
113 | H. Peter Anvin,Philipp Hahn和Stefan Richter的意见改善了本档。 | ||