diff options
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r-- | Documentation/DocBook/gadget.tmpl | 38 | ||||
-rw-r--r-- | Documentation/DocBook/kernel-locking.tmpl | 82 | ||||
-rw-r--r-- | Documentation/DocBook/kgdb.tmpl | 28 | ||||
-rw-r--r-- | Documentation/DocBook/procfs-guide.tmpl | 4 | ||||
-rw-r--r-- | Documentation/DocBook/uio-howto.tmpl | 63 |
5 files changed, 151 insertions, 64 deletions
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl index 5a8ffa761e09..ea3bc9565e6a 100644 --- a/Documentation/DocBook/gadget.tmpl +++ b/Documentation/DocBook/gadget.tmpl | |||
@@ -524,6 +524,44 @@ These utilities include endpoint autoconfiguration. | |||
524 | <!-- !Edrivers/usb/gadget/epautoconf.c --> | 524 | <!-- !Edrivers/usb/gadget/epautoconf.c --> |
525 | </sect1> | 525 | </sect1> |
526 | 526 | ||
527 | <sect1 id="composite"><title>Composite Device Framework</title> | ||
528 | |||
529 | <para>The core API is sufficient for writing drivers for composite | ||
530 | USB devices (with more than one function in a given configuration), | ||
531 | and also multi-configuration devices (also more than one function, | ||
532 | but not necessarily sharing a given configuration). | ||
533 | There is however an optional framework which makes it easier to | ||
534 | reuse and combine functions. | ||
535 | </para> | ||
536 | |||
537 | <para>Devices using this framework provide a <emphasis>struct | ||
538 | usb_composite_driver</emphasis>, which in turn provides one or | ||
539 | more <emphasis>struct usb_configuration</emphasis> instances. | ||
540 | Each such configuration includes at least one | ||
541 | <emphasis>struct usb_function</emphasis>, which packages a user | ||
542 | visible role such as "network link" or "mass storage device". | ||
543 | Management functions may also exist, such as "Device Firmware | ||
544 | Upgrade". | ||
545 | </para> | ||
546 | |||
547 | !Iinclude/linux/usb/composite.h | ||
548 | !Edrivers/usb/gadget/composite.c | ||
549 | |||
550 | </sect1> | ||
551 | |||
552 | <sect1 id="functions"><title>Composite Device Functions</title> | ||
553 | |||
554 | <para>At this writing, a few of the current gadget drivers have | ||
555 | been converted to this framework. | ||
556 | Near-term plans include converting all of them, except for "gadgetfs". | ||
557 | </para> | ||
558 | |||
559 | !Edrivers/usb/gadget/f_acm.c | ||
560 | !Edrivers/usb/gadget/f_serial.c | ||
561 | |||
562 | </sect1> | ||
563 | |||
564 | |||
527 | </chapter> | 565 | </chapter> |
528 | 566 | ||
529 | <chapter id="controllers"><title>Peripheral Controller Drivers</title> | 567 | <chapter id="controllers"><title>Peripheral Controller Drivers</title> |
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl index 77c42f40be5d..084f6ad7b7a0 100644 --- a/Documentation/DocBook/kernel-locking.tmpl +++ b/Documentation/DocBook/kernel-locking.tmpl | |||
@@ -219,10 +219,10 @@ | |||
219 | </para> | 219 | </para> |
220 | 220 | ||
221 | <sect1 id="lock-intro"> | 221 | <sect1 id="lock-intro"> |
222 | <title>Three Main Types of Kernel Locks: Spinlocks, Mutexes and Semaphores</title> | 222 | <title>Two Main Types of Kernel Locks: Spinlocks and Mutexes</title> |
223 | 223 | ||
224 | <para> | 224 | <para> |
225 | There are three main types of kernel locks. The fundamental type | 225 | There are two main types of kernel locks. The fundamental type |
226 | is the spinlock | 226 | is the spinlock |
227 | (<filename class="headerfile">include/asm/spinlock.h</filename>), | 227 | (<filename class="headerfile">include/asm/spinlock.h</filename>), |
228 | which is a very simple single-holder lock: if you can't get the | 228 | which is a very simple single-holder lock: if you can't get the |
@@ -240,14 +240,6 @@ | |||
240 | use a spinlock instead. | 240 | use a spinlock instead. |
241 | </para> | 241 | </para> |
242 | <para> | 242 | <para> |
243 | The third type is a semaphore | ||
244 | (<filename class="headerfile">include/linux/semaphore.h</filename>): it | ||
245 | can have more than one holder at any time (the number decided at | ||
246 | initialization time), although it is most commonly used as a | ||
247 | single-holder lock (a mutex). If you can't get a semaphore, your | ||
248 | task will be suspended and later on woken up - just like for mutexes. | ||
249 | </para> | ||
250 | <para> | ||
251 | Neither type of lock is recursive: see | 243 | Neither type of lock is recursive: see |
252 | <xref linkend="deadlock"/>. | 244 | <xref linkend="deadlock"/>. |
253 | </para> | 245 | </para> |
@@ -278,7 +270,7 @@ | |||
278 | </para> | 270 | </para> |
279 | 271 | ||
280 | <para> | 272 | <para> |
281 | Semaphores still exist, because they are required for | 273 | Mutexes still exist, because they are required for |
282 | synchronization between <firstterm linkend="gloss-usercontext">user | 274 | synchronization between <firstterm linkend="gloss-usercontext">user |
283 | contexts</firstterm>, as we will see below. | 275 | contexts</firstterm>, as we will see below. |
284 | </para> | 276 | </para> |
@@ -289,18 +281,17 @@ | |||
289 | 281 | ||
290 | <para> | 282 | <para> |
291 | If you have a data structure which is only ever accessed from | 283 | If you have a data structure which is only ever accessed from |
292 | user context, then you can use a simple semaphore | 284 | user context, then you can use a simple mutex |
293 | (<filename>linux/linux/semaphore.h</filename>) to protect it. This | 285 | (<filename>include/linux/mutex.h</filename>) to protect it. This |
294 | is the most trivial case: you initialize the semaphore to the number | 286 | is the most trivial case: you initialize the mutex. Then you can |
295 | of resources available (usually 1), and call | 287 | call <function>mutex_lock_interruptible()</function> to grab the mutex, |
296 | <function>down_interruptible()</function> to grab the semaphore, and | 288 | and <function>mutex_unlock()</function> to release it. There is also a |
297 | <function>up()</function> to release it. There is also a | 289 | <function>mutex_lock()</function>, which should be avoided, because it |
298 | <function>down()</function>, which should be avoided, because it | ||
299 | will not return if a signal is received. | 290 | will not return if a signal is received. |
300 | </para> | 291 | </para> |
301 | 292 | ||
302 | <para> | 293 | <para> |
303 | Example: <filename>linux/net/core/netfilter.c</filename> allows | 294 | Example: <filename>net/netfilter/nf_sockopt.c</filename> allows |
304 | registration of new <function>setsockopt()</function> and | 295 | registration of new <function>setsockopt()</function> and |
305 | <function>getsockopt()</function> calls, with | 296 | <function>getsockopt()</function> calls, with |
306 | <function>nf_register_sockopt()</function>. Registration and | 297 | <function>nf_register_sockopt()</function>. Registration and |
@@ -515,7 +506,7 @@ | |||
515 | <listitem> | 506 | <listitem> |
516 | <para> | 507 | <para> |
517 | If you are in a process context (any syscall) and want to | 508 | If you are in a process context (any syscall) and want to |
518 | lock other process out, use a semaphore. You can take a semaphore | 509 | lock other process out, use a mutex. You can take a mutex |
519 | and sleep (<function>copy_from_user*(</function> or | 510 | and sleep (<function>copy_from_user*(</function> or |
520 | <function>kmalloc(x,GFP_KERNEL)</function>). | 511 | <function>kmalloc(x,GFP_KERNEL)</function>). |
521 | </para> | 512 | </para> |
@@ -662,7 +653,7 @@ | |||
662 | <entry>SLBH</entry> | 653 | <entry>SLBH</entry> |
663 | <entry>SLBH</entry> | 654 | <entry>SLBH</entry> |
664 | <entry>SLBH</entry> | 655 | <entry>SLBH</entry> |
665 | <entry>DI</entry> | 656 | <entry>MLI</entry> |
666 | <entry>None</entry> | 657 | <entry>None</entry> |
667 | </row> | 658 | </row> |
668 | 659 | ||
@@ -692,8 +683,8 @@ | |||
692 | <entry>spin_lock_bh</entry> | 683 | <entry>spin_lock_bh</entry> |
693 | </row> | 684 | </row> |
694 | <row> | 685 | <row> |
695 | <entry>DI</entry> | 686 | <entry>MLI</entry> |
696 | <entry>down_interruptible</entry> | 687 | <entry>mutex_lock_interruptible</entry> |
697 | </row> | 688 | </row> |
698 | 689 | ||
699 | </tbody> | 690 | </tbody> |
@@ -703,6 +694,31 @@ | |||
703 | </sect1> | 694 | </sect1> |
704 | </chapter> | 695 | </chapter> |
705 | 696 | ||
697 | <chapter id="trylock-functions"> | ||
698 | <title>The trylock Functions</title> | ||
699 | <para> | ||
700 | There are functions that try to acquire a lock only once and immediately | ||
701 | return a value telling about success or failure to acquire the lock. | ||
702 | They can be used if you need no access to the data protected with the lock | ||
703 | when some other thread is holding the lock. You should acquire the lock | ||
704 | later if you then need access to the data protected with the lock. | ||
705 | </para> | ||
706 | |||
707 | <para> | ||
708 | <function>spin_trylock()</function> does not spin but returns non-zero if | ||
709 | it acquires the spinlock on the first try or 0 if not. This function can | ||
710 | be used in all contexts like <function>spin_lock</function>: you must have | ||
711 | disabled the contexts that might interrupt you and acquire the spin lock. | ||
712 | </para> | ||
713 | |||
714 | <para> | ||
715 | <function>mutex_trylock()</function> does not suspend your task | ||
716 | but returns non-zero if it could lock the mutex on the first try | ||
717 | or 0 if not. This function cannot be safely used in hardware or software | ||
718 | interrupt contexts despite not sleeping. | ||
719 | </para> | ||
720 | </chapter> | ||
721 | |||
706 | <chapter id="Examples"> | 722 | <chapter id="Examples"> |
707 | <title>Common Examples</title> | 723 | <title>Common Examples</title> |
708 | <para> | 724 | <para> |
@@ -1285,7 +1301,7 @@ as Alan Cox says, <quote>Lock data, not code</quote>. | |||
1285 | <para> | 1301 | <para> |
1286 | There is a coding bug where a piece of code tries to grab a | 1302 | There is a coding bug where a piece of code tries to grab a |
1287 | spinlock twice: it will spin forever, waiting for the lock to | 1303 | spinlock twice: it will spin forever, waiting for the lock to |
1288 | be released (spinlocks, rwlocks and semaphores are not | 1304 | be released (spinlocks, rwlocks and mutexes are not |
1289 | recursive in Linux). This is trivial to diagnose: not a | 1305 | recursive in Linux). This is trivial to diagnose: not a |
1290 | stay-up-five-nights-talk-to-fluffy-code-bunnies kind of | 1306 | stay-up-five-nights-talk-to-fluffy-code-bunnies kind of |
1291 | problem. | 1307 | problem. |
@@ -1310,7 +1326,7 @@ as Alan Cox says, <quote>Lock data, not code</quote>. | |||
1310 | 1326 | ||
1311 | <para> | 1327 | <para> |
1312 | This complete lockup is easy to diagnose: on SMP boxes the | 1328 | This complete lockup is easy to diagnose: on SMP boxes the |
1313 | watchdog timer or compiling with <symbol>DEBUG_SPINLOCKS</symbol> set | 1329 | watchdog timer or compiling with <symbol>DEBUG_SPINLOCK</symbol> set |
1314 | (<filename>include/linux/spinlock.h</filename>) will show this up | 1330 | (<filename>include/linux/spinlock.h</filename>) will show this up |
1315 | immediately when it happens. | 1331 | immediately when it happens. |
1316 | </para> | 1332 | </para> |
@@ -1533,7 +1549,7 @@ the amount of locking which needs to be done. | |||
1533 | <title>Read/Write Lock Variants</title> | 1549 | <title>Read/Write Lock Variants</title> |
1534 | 1550 | ||
1535 | <para> | 1551 | <para> |
1536 | Both spinlocks and semaphores have read/write variants: | 1552 | Both spinlocks and mutexes have read/write variants: |
1537 | <type>rwlock_t</type> and <structname>struct rw_semaphore</structname>. | 1553 | <type>rwlock_t</type> and <structname>struct rw_semaphore</structname>. |
1538 | These divide users into two classes: the readers and the writers. If | 1554 | These divide users into two classes: the readers and the writers. If |
1539 | you are only reading the data, you can get a read lock, but to write to | 1555 | you are only reading the data, you can get a read lock, but to write to |
@@ -1656,7 +1672,7 @@ the amount of locking which needs to be done. | |||
1656 | #include <linux/slab.h> | 1672 | #include <linux/slab.h> |
1657 | #include <linux/string.h> | 1673 | #include <linux/string.h> |
1658 | +#include <linux/rcupdate.h> | 1674 | +#include <linux/rcupdate.h> |
1659 | #include <linux/semaphore.h> | 1675 | #include <linux/mutex.h> |
1660 | #include <asm/errno.h> | 1676 | #include <asm/errno.h> |
1661 | 1677 | ||
1662 | struct object | 1678 | struct object |
@@ -1888,7 +1904,7 @@ machines due to caching. | |||
1888 | </listitem> | 1904 | </listitem> |
1889 | <listitem> | 1905 | <listitem> |
1890 | <para> | 1906 | <para> |
1891 | <function> put_user()</function> | 1907 | <function>put_user()</function> |
1892 | </para> | 1908 | </para> |
1893 | </listitem> | 1909 | </listitem> |
1894 | </itemizedlist> | 1910 | </itemizedlist> |
@@ -1902,13 +1918,13 @@ machines due to caching. | |||
1902 | 1918 | ||
1903 | <listitem> | 1919 | <listitem> |
1904 | <para> | 1920 | <para> |
1905 | <function>down_interruptible()</function> and | 1921 | <function>mutex_lock_interruptible()</function> and |
1906 | <function>down()</function> | 1922 | <function>mutex_lock()</function> |
1907 | </para> | 1923 | </para> |
1908 | <para> | 1924 | <para> |
1909 | There is a <function>down_trylock()</function> which can be | 1925 | There is a <function>mutex_trylock()</function> which can be |
1910 | used inside interrupt context, as it will not sleep. | 1926 | used inside interrupt context, as it will not sleep. |
1911 | <function>up()</function> will also never sleep. | 1927 | <function>mutex_unlock()</function> will also never sleep. |
1912 | </para> | 1928 | </para> |
1913 | </listitem> | 1929 | </listitem> |
1914 | </itemizedlist> | 1930 | </itemizedlist> |
@@ -1998,7 +2014,7 @@ machines due to caching. | |||
1998 | <para> | 2014 | <para> |
1999 | Prior to 2.5, or when <symbol>CONFIG_PREEMPT</symbol> is | 2015 | Prior to 2.5, or when <symbol>CONFIG_PREEMPT</symbol> is |
2000 | unset, processes in user context inside the kernel would not | 2016 | unset, processes in user context inside the kernel would not |
2001 | preempt each other (ie. you had that CPU until you have it up, | 2017 | preempt each other (ie. you had that CPU until you gave it up, |
2002 | except for interrupts). With the addition of | 2018 | except for interrupts). With the addition of |
2003 | <symbol>CONFIG_PREEMPT</symbol> in 2.5.4, this changed: when | 2019 | <symbol>CONFIG_PREEMPT</symbol> in 2.5.4, this changed: when |
2004 | in user context, higher priority tasks can "cut in": spinlocks | 2020 | in user context, higher priority tasks can "cut in": spinlocks |
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index 97618bed4d65..e8acd1f03456 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
@@ -72,7 +72,7 @@ | |||
72 | kgdb is a source level debugger for linux kernel. It is used along | 72 | kgdb is a source level debugger for linux kernel. It is used along |
73 | with gdb to debug a linux kernel. The expectation is that gdb can | 73 | with gdb to debug a linux kernel. The expectation is that gdb can |
74 | be used to "break in" to the kernel to inspect memory, variables | 74 | be used to "break in" to the kernel to inspect memory, variables |
75 | and look through a cal stack information similar to what an | 75 | and look through call stack information similar to what an |
76 | application developer would use gdb for. It is possible to place | 76 | application developer would use gdb for. It is possible to place |
77 | breakpoints in kernel code and perform some limited execution | 77 | breakpoints in kernel code and perform some limited execution |
78 | stepping. | 78 | stepping. |
@@ -84,17 +84,18 @@ | |||
84 | runs an instance of gdb against the vmlinux file which contains | 84 | runs an instance of gdb against the vmlinux file which contains |
85 | the symbols (not boot image such as bzImage, zImage, uImage...). | 85 | the symbols (not boot image such as bzImage, zImage, uImage...). |
86 | In gdb the developer specifies the connection parameters and | 86 | In gdb the developer specifies the connection parameters and |
87 | connects to kgdb. Depending on which kgdb I/O modules exist in | 87 | connects to kgdb. The type of connection a developer makes with |
88 | the kernel for a given architecture, it may be possible to debug | 88 | gdb depends on the availability of kgdb I/O modules compiled as |
89 | the test machine's kernel with the development machine using a | 89 | builtin's or kernel modules in the test machine's kernel. |
90 | rs232 or ethernet connection. | ||
91 | </para> | 90 | </para> |
92 | </chapter> | 91 | </chapter> |
93 | <chapter id="CompilingAKernel"> | 92 | <chapter id="CompilingAKernel"> |
94 | <title>Compiling a kernel</title> | 93 | <title>Compiling a kernel</title> |
95 | <para> | 94 | <para> |
96 | To enable <symbol>CONFIG_KGDB</symbol>, look under the "Kernel debugging" | 95 | To enable <symbol>CONFIG_KGDB</symbol> you should first turn on |
97 | and then select "KGDB: kernel debugging with remote gdb". | 96 | "Prompt for development and/or incomplete code/drivers" |
97 | (CONFIG_EXPERIMENTAL) in "General setup", then under the | ||
98 | "Kernel debugging" select "KGDB: kernel debugging with remote gdb". | ||
98 | </para> | 99 | </para> |
99 | <para> | 100 | <para> |
100 | Next you should choose one of more I/O drivers to interconnect debugging | 101 | Next you should choose one of more I/O drivers to interconnect debugging |
@@ -221,7 +222,7 @@ | |||
221 | </para> | 222 | </para> |
222 | <para> | 223 | <para> |
223 | IMPORTANT NOTE: Using this option with kgdb over the console | 224 | IMPORTANT NOTE: Using this option with kgdb over the console |
224 | (kgdboc) or kgdb over ethernet (kgdboe) is not supported. | 225 | (kgdboc) is not supported. |
225 | </para> | 226 | </para> |
226 | </sect1> | 227 | </sect1> |
227 | </chapter> | 228 | </chapter> |
@@ -247,18 +248,11 @@ | |||
247 | (gdb) target remote /dev/ttyS0 | 248 | (gdb) target remote /dev/ttyS0 |
248 | </programlisting> | 249 | </programlisting> |
249 | <para> | 250 | <para> |
250 | Example (kgdb to a terminal server): | 251 | Example (kgdb to a terminal server on tcp port 2012): |
251 | </para> | 252 | </para> |
252 | <programlisting> | 253 | <programlisting> |
253 | % gdb ./vmlinux | 254 | % gdb ./vmlinux |
254 | (gdb) target remote udp:192.168.2.2:6443 | 255 | (gdb) target remote 192.168.2.2:2012 |
255 | </programlisting> | ||
256 | <para> | ||
257 | Example (kgdb over ethernet): | ||
258 | </para> | ||
259 | <programlisting> | ||
260 | % gdb ./vmlinux | ||
261 | (gdb) target remote udp:192.168.2.2:6443 | ||
262 | </programlisting> | 256 | </programlisting> |
263 | <para> | 257 | <para> |
264 | Once connected, you can debug a kernel the way you would debug an | 258 | Once connected, you can debug a kernel the way you would debug an |
diff --git a/Documentation/DocBook/procfs-guide.tmpl b/Documentation/DocBook/procfs-guide.tmpl index 1fd6a1ec7591..8a5dc6e021ff 100644 --- a/Documentation/DocBook/procfs-guide.tmpl +++ b/Documentation/DocBook/procfs-guide.tmpl | |||
@@ -29,12 +29,12 @@ | |||
29 | 29 | ||
30 | <revhistory> | 30 | <revhistory> |
31 | <revision> | 31 | <revision> |
32 | <revnumber>1.0 </revnumber> | 32 | <revnumber>1.0</revnumber> |
33 | <date>May 30, 2001</date> | 33 | <date>May 30, 2001</date> |
34 | <revremark>Initial revision posted to linux-kernel</revremark> | 34 | <revremark>Initial revision posted to linux-kernel</revremark> |
35 | </revision> | 35 | </revision> |
36 | <revision> | 36 | <revision> |
37 | <revnumber>1.1 </revnumber> | 37 | <revnumber>1.1</revnumber> |
38 | <date>June 3, 2001</date> | 38 | <date>June 3, 2001</date> |
39 | <revremark>Revised after comments from linux-kernel</revremark> | 39 | <revremark>Revised after comments from linux-kernel</revremark> |
40 | </revision> | 40 | </revision> |
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index fdd7f4f887b7..df87d1b93605 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -21,6 +21,18 @@ | |||
21 | </affiliation> | 21 | </affiliation> |
22 | </author> | 22 | </author> |
23 | 23 | ||
24 | <copyright> | ||
25 | <year>2006-2008</year> | ||
26 | <holder>Hans-Jürgen Koch.</holder> | ||
27 | </copyright> | ||
28 | |||
29 | <legalnotice> | ||
30 | <para> | ||
31 | This documentation is Free Software licensed under the terms of the | ||
32 | GPL version 2. | ||
33 | </para> | ||
34 | </legalnotice> | ||
35 | |||
24 | <pubdate>2006-12-11</pubdate> | 36 | <pubdate>2006-12-11</pubdate> |
25 | 37 | ||
26 | <abstract> | 38 | <abstract> |
@@ -30,6 +42,12 @@ | |||
30 | 42 | ||
31 | <revhistory> | 43 | <revhistory> |
32 | <revision> | 44 | <revision> |
45 | <revnumber>0.5</revnumber> | ||
46 | <date>2008-05-22</date> | ||
47 | <authorinitials>hjk</authorinitials> | ||
48 | <revremark>Added description of write() function.</revremark> | ||
49 | </revision> | ||
50 | <revision> | ||
33 | <revnumber>0.4</revnumber> | 51 | <revnumber>0.4</revnumber> |
34 | <date>2007-11-26</date> | 52 | <date>2007-11-26</date> |
35 | <authorinitials>hjk</authorinitials> | 53 | <authorinitials>hjk</authorinitials> |
@@ -57,20 +75,9 @@ | |||
57 | </bookinfo> | 75 | </bookinfo> |
58 | 76 | ||
59 | <chapter id="aboutthisdoc"> | 77 | <chapter id="aboutthisdoc"> |
60 | <?dbhtml filename="about.html"?> | 78 | <?dbhtml filename="aboutthis.html"?> |
61 | <title>About this document</title> | 79 | <title>About this document</title> |
62 | 80 | ||
63 | <sect1 id="copyright"> | ||
64 | <?dbhtml filename="copyright.html"?> | ||
65 | <title>Copyright and License</title> | ||
66 | <para> | ||
67 | Copyright (c) 2006 by Hans-Jürgen Koch.</para> | ||
68 | <para> | ||
69 | This documentation is Free Software licensed under the terms of the | ||
70 | GPL version 2. | ||
71 | </para> | ||
72 | </sect1> | ||
73 | |||
74 | <sect1 id="translations"> | 81 | <sect1 id="translations"> |
75 | <?dbhtml filename="translations.html"?> | 82 | <?dbhtml filename="translations.html"?> |
76 | <title>Translations</title> | 83 | <title>Translations</title> |
@@ -189,6 +196,30 @@ interested in translating it, please email me | |||
189 | represents the total interrupt count. You can use this number | 196 | represents the total interrupt count. You can use this number |
190 | to figure out if you missed some interrupts. | 197 | to figure out if you missed some interrupts. |
191 | </para> | 198 | </para> |
199 | <para> | ||
200 | For some hardware that has more than one interrupt source internally, | ||
201 | but not separate IRQ mask and status registers, there might be | ||
202 | situations where userspace cannot determine what the interrupt source | ||
203 | was if the kernel handler disables them by writing to the chip's IRQ | ||
204 | register. In such a case, the kernel has to disable the IRQ completely | ||
205 | to leave the chip's register untouched. Now the userspace part can | ||
206 | determine the cause of the interrupt, but it cannot re-enable | ||
207 | interrupts. Another cornercase is chips where re-enabling interrupts | ||
208 | is a read-modify-write operation to a combined IRQ status/acknowledge | ||
209 | register. This would be racy if a new interrupt occurred | ||
210 | simultaneously. | ||
211 | </para> | ||
212 | <para> | ||
213 | To address these problems, UIO also implements a write() function. It | ||
214 | is normally not used and can be ignored for hardware that has only a | ||
215 | single interrupt source or has separate IRQ mask and status registers. | ||
216 | If you need it, however, a write to <filename>/dev/uioX</filename> | ||
217 | will call the <function>irqcontrol()</function> function implemented | ||
218 | by the driver. You have to write a 32-bit value that is usually either | ||
219 | 0 or 1 to disable or enable interrupts. If a driver does not implement | ||
220 | <function>irqcontrol()</function>, <function>write()</function> will | ||
221 | return with <varname>-ENOSYS</varname>. | ||
222 | </para> | ||
192 | 223 | ||
193 | <para> | 224 | <para> |
194 | To handle interrupts properly, your custom kernel module can | 225 | To handle interrupts properly, your custom kernel module can |
@@ -362,6 +393,14 @@ device is actually used. | |||
362 | <function>open()</function>, you will probably also want a custom | 393 | <function>open()</function>, you will probably also want a custom |
363 | <function>release()</function> function. | 394 | <function>release()</function> function. |
364 | </para></listitem> | 395 | </para></listitem> |
396 | |||
397 | <listitem><para> | ||
398 | <varname>int (*irqcontrol)(struct uio_info *info, s32 irq_on) | ||
399 | </varname>: Optional. If you need to be able to enable or disable | ||
400 | interrupts from userspace by writing to <filename>/dev/uioX</filename>, | ||
401 | you can implement this function. The parameter <varname>irq_on</varname> | ||
402 | will be 0 to disable interrupts and 1 to enable them. | ||
403 | </para></listitem> | ||
365 | </itemizedlist> | 404 | </itemizedlist> |
366 | 405 | ||
367 | <para> | 406 | <para> |