diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/Makefile | 3 | ||||
-rw-r--r-- | Documentation/DocBook/genericirq.tmpl | 474 | ||||
-rw-r--r-- | Documentation/IRQ.txt | 22 | ||||
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 10 | ||||
-rw-r--r-- | Documentation/kernel-parameters.txt | 9 | ||||
-rw-r--r-- | Documentation/keys-request-key.txt | 54 | ||||
-rw-r--r-- | Documentation/keys.txt | 29 | ||||
-rw-r--r-- | Documentation/watchdog/pcwd-watchdog.txt | 75 | ||||
-rw-r--r-- | Documentation/watchdog/src/watchdog-simple.c | 15 | ||||
-rw-r--r-- | Documentation/watchdog/src/watchdog-test.c | 68 | ||||
-rw-r--r-- | Documentation/watchdog/watchdog-api.txt | 56 | ||||
-rw-r--r-- | Documentation/watchdog/watchdog.txt | 23 |
12 files changed, 706 insertions, 132 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 5a2882d275ba..66e1cf733571 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -10,7 +10,8 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ | |||
10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ | 10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ |
11 | procfs-guide.xml writing_usb_driver.xml \ | 11 | procfs-guide.xml writing_usb_driver.xml \ |
12 | kernel-api.xml journal-api.xml lsm.xml usb.xml \ | 12 | kernel-api.xml journal-api.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 | ||
14 | 15 | ||
15 | ### | 16 | ### |
16 | # The build process is as follows (targets): | 17 | # The build process is as follows (targets): |
diff --git a/Documentation/DocBook/genericirq.tmpl b/Documentation/DocBook/genericirq.tmpl new file mode 100644 index 000000000000..0f4a4b6321e4 --- /dev/null +++ b/Documentation/DocBook/genericirq.tmpl | |||
@@ -0,0 +1,474 @@ | |||
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="Generic-IRQ-Guide"> | ||
6 | <bookinfo> | ||
7 | <title>Linux generic IRQ handling</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Thomas</firstname> | ||
12 | <surname>Gleixner</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>tglx@linutronix.de</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | <author> | ||
20 | <firstname>Ingo</firstname> | ||
21 | <surname>Molnar</surname> | ||
22 | <affiliation> | ||
23 | <address> | ||
24 | <email>mingo@elte.hu</email> | ||
25 | </address> | ||
26 | </affiliation> | ||
27 | </author> | ||
28 | </authorgroup> | ||
29 | |||
30 | <copyright> | ||
31 | <year>2005-2006</year> | ||
32 | <holder>Thomas Gleixner</holder> | ||
33 | </copyright> | ||
34 | <copyright> | ||
35 | <year>2005-2006</year> | ||
36 | <holder>Ingo Molnar</holder> | ||
37 | </copyright> | ||
38 | |||
39 | <legalnotice> | ||
40 | <para> | ||
41 | This documentation is free software; you can redistribute | ||
42 | it and/or modify it under the terms of the GNU General Public | ||
43 | License version 2 as published by the Free Software Foundation. | ||
44 | </para> | ||
45 | |||
46 | <para> | ||
47 | This program is distributed in the hope that it will be | ||
48 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
49 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
50 | See the GNU General Public License for more details. | ||
51 | </para> | ||
52 | |||
53 | <para> | ||
54 | You should have received a copy of the GNU General Public | ||
55 | License along with this program; if not, write to the Free | ||
56 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
57 | MA 02111-1307 USA | ||
58 | </para> | ||
59 | |||
60 | <para> | ||
61 | For more details see the file COPYING in the source | ||
62 | distribution of Linux. | ||
63 | </para> | ||
64 | </legalnotice> | ||
65 | </bookinfo> | ||
66 | |||
67 | <toc></toc> | ||
68 | |||
69 | <chapter id="intro"> | ||
70 | <title>Introduction</title> | ||
71 | <para> | ||
72 | The generic interrupt handling layer is designed to provide a | ||
73 | complete abstraction of interrupt handling for device drivers. | ||
74 | It is able to handle all the different types of interrupt controller | ||
75 | hardware. Device drivers use generic API functions to request, enable, | ||
76 | disable and free interrupts. The drivers do not have to know anything | ||
77 | about interrupt hardware details, so they can be used on different | ||
78 | platforms without code changes. | ||
79 | </para> | ||
80 | <para> | ||
81 | This documentation is provided to developers who want to implement | ||
82 | an interrupt subsystem based for their architecture, with the help | ||
83 | of the generic IRQ handling layer. | ||
84 | </para> | ||
85 | </chapter> | ||
86 | |||
87 | <chapter id="rationale"> | ||
88 | <title>Rationale</title> | ||
89 | <para> | ||
90 | The original implementation of interrupt handling in Linux is using | ||
91 | the __do_IRQ() super-handler, which is able to deal with every | ||
92 | type of interrupt logic. | ||
93 | </para> | ||
94 | <para> | ||
95 | Originally, Russell King identified different types of handlers to | ||
96 | build a quite universal set for the ARM interrupt handler | ||
97 | implementation in Linux 2.5/2.6. He distinguished between: | ||
98 | <itemizedlist> | ||
99 | <listitem><para>Level type</para></listitem> | ||
100 | <listitem><para>Edge type</para></listitem> | ||
101 | <listitem><para>Simple type</para></listitem> | ||
102 | </itemizedlist> | ||
103 | In the SMP world of the __do_IRQ() super-handler another type | ||
104 | was identified: | ||
105 | <itemizedlist> | ||
106 | <listitem><para>Per CPU type</para></listitem> | ||
107 | </itemizedlist> | ||
108 | </para> | ||
109 | <para> | ||
110 | This split implementation of highlevel IRQ handlers allows us to | ||
111 | optimize the flow of the interrupt handling for each specific | ||
112 | interrupt type. This reduces complexity in that particular codepath | ||
113 | and allows the optimized handling of a given type. | ||
114 | </para> | ||
115 | <para> | ||
116 | The original general IRQ implementation used hw_interrupt_type | ||
117 | structures and their ->ack(), ->end() [etc.] callbacks to | ||
118 | differentiate the flow control in the super-handler. This leads to | ||
119 | a mix of flow logic and lowlevel hardware logic, and it also leads | ||
120 | to unnecessary code duplication: for example in i386, there is a | ||
121 | ioapic_level_irq and a ioapic_edge_irq irq-type which share many | ||
122 | of the lowlevel details but have different flow handling. | ||
123 | </para> | ||
124 | <para> | ||
125 | A more natural abstraction is the clean separation of the | ||
126 | 'irq flow' and the 'chip details'. | ||
127 | </para> | ||
128 | <para> | ||
129 | Analysing a couple of architecture's IRQ subsystem implementations | ||
130 | reveals that most of them can use a generic set of 'irq flow' | ||
131 | methods and only need to add the chip level specific code. | ||
132 | The separation is also valuable for (sub)architectures | ||
133 | which need specific quirks in the irq flow itself but not in the | ||
134 | chip-details - and thus provides a more transparent IRQ subsystem | ||
135 | design. | ||
136 | </para> | ||
137 | <para> | ||
138 | Each interrupt descriptor is assigned its own highlevel flow | ||
139 | handler, which is normally one of the generic | ||
140 | implementations. (This highlevel flow handler implementation also | ||
141 | makes it simple to provide demultiplexing handlers which can be | ||
142 | found in embedded platforms on various architectures.) | ||
143 | </para> | ||
144 | <para> | ||
145 | The separation makes the generic interrupt handling layer more | ||
146 | flexible and extensible. For example, an (sub)architecture can | ||
147 | use a generic irq-flow implementation for 'level type' interrupts | ||
148 | and add a (sub)architecture specific 'edge type' implementation. | ||
149 | </para> | ||
150 | <para> | ||
151 | To make the transition to the new model easier and prevent the | ||
152 | breakage of existing implementations, the __do_IRQ() super-handler | ||
153 | is still available. This leads to a kind of duality for the time | ||
154 | being. Over time the new model should be used in more and more | ||
155 | architectures, as it enables smaller and cleaner IRQ subsystems. | ||
156 | </para> | ||
157 | </chapter> | ||
158 | <chapter id="bugs"> | ||
159 | <title>Known Bugs And Assumptions</title> | ||
160 | <para> | ||
161 | None (knock on wood). | ||
162 | </para> | ||
163 | </chapter> | ||
164 | |||
165 | <chapter id="Abstraction"> | ||
166 | <title>Abstraction layers</title> | ||
167 | <para> | ||
168 | There are three main levels of abstraction in the interrupt code: | ||
169 | <orderedlist> | ||
170 | <listitem><para>Highlevel driver API</para></listitem> | ||
171 | <listitem><para>Highlevel IRQ flow handlers</para></listitem> | ||
172 | <listitem><para>Chiplevel hardware encapsulation</para></listitem> | ||
173 | </orderedlist> | ||
174 | </para> | ||
175 | <sect1> | ||
176 | <title>Interrupt control flow</title> | ||
177 | <para> | ||
178 | Each interrupt is described by an interrupt descriptor structure | ||
179 | irq_desc. The interrupt is referenced by an 'unsigned int' numeric | ||
180 | value which selects the corresponding interrupt decription structure | ||
181 | in the descriptor structures array. | ||
182 | The descriptor structure contains status information and pointers | ||
183 | to the interrupt flow method and the interrupt chip structure | ||
184 | which are assigned to this interrupt. | ||
185 | </para> | ||
186 | <para> | ||
187 | Whenever an interrupt triggers, the lowlevel arch code calls into | ||
188 | the generic interrupt code by calling desc->handle_irq(). | ||
189 | This highlevel IRQ handling function only uses desc->chip primitives | ||
190 | referenced by the assigned chip descriptor structure. | ||
191 | </para> | ||
192 | </sect1> | ||
193 | <sect1> | ||
194 | <title>Highlevel Driver API</title> | ||
195 | <para> | ||
196 | The highlevel Driver API consists of following functions: | ||
197 | <itemizedlist> | ||
198 | <listitem><para>request_irq()</para></listitem> | ||
199 | <listitem><para>free_irq()</para></listitem> | ||
200 | <listitem><para>disable_irq()</para></listitem> | ||
201 | <listitem><para>enable_irq()</para></listitem> | ||
202 | <listitem><para>disable_irq_nosync() (SMP only)</para></listitem> | ||
203 | <listitem><para>synchronize_irq() (SMP only)</para></listitem> | ||
204 | <listitem><para>set_irq_type()</para></listitem> | ||
205 | <listitem><para>set_irq_wake()</para></listitem> | ||
206 | <listitem><para>set_irq_data()</para></listitem> | ||
207 | <listitem><para>set_irq_chip()</para></listitem> | ||
208 | <listitem><para>set_irq_chip_data()</para></listitem> | ||
209 | </itemizedlist> | ||
210 | See the autogenerated function documentation for details. | ||
211 | </para> | ||
212 | </sect1> | ||
213 | <sect1> | ||
214 | <title>Highlevel IRQ flow handlers</title> | ||
215 | <para> | ||
216 | The generic layer provides a set of pre-defined irq-flow methods: | ||
217 | <itemizedlist> | ||
218 | <listitem><para>handle_level_irq</para></listitem> | ||
219 | <listitem><para>handle_edge_irq</para></listitem> | ||
220 | <listitem><para>handle_simple_irq</para></listitem> | ||
221 | <listitem><para>handle_percpu_irq</para></listitem> | ||
222 | </itemizedlist> | ||
223 | The interrupt flow handlers (either predefined or architecture | ||
224 | specific) are assigned to specific interrupts by the architecture | ||
225 | either during bootup or during device initialization. | ||
226 | </para> | ||
227 | <sect2> | ||
228 | <title>Default flow implementations</title> | ||
229 | <sect3> | ||
230 | <title>Helper functions</title> | ||
231 | <para> | ||
232 | The helper functions call the chip primitives and | ||
233 | are used by the default flow implementations. | ||
234 | The following helper functions are implemented (simplified excerpt): | ||
235 | <programlisting> | ||
236 | default_enable(irq) | ||
237 | { | ||
238 | desc->chip->unmask(irq); | ||
239 | } | ||
240 | |||
241 | default_disable(irq) | ||
242 | { | ||
243 | if (!delay_disable(irq)) | ||
244 | desc->chip->mask(irq); | ||
245 | } | ||
246 | |||
247 | default_ack(irq) | ||
248 | { | ||
249 | chip->ack(irq); | ||
250 | } | ||
251 | |||
252 | default_mask_ack(irq) | ||
253 | { | ||
254 | if (chip->mask_ack) { | ||
255 | chip->mask_ack(irq); | ||
256 | } else { | ||
257 | chip->mask(irq); | ||
258 | chip->ack(irq); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | noop(irq) | ||
263 | { | ||
264 | } | ||
265 | |||
266 | </programlisting> | ||
267 | </para> | ||
268 | </sect3> | ||
269 | </sect2> | ||
270 | <sect2> | ||
271 | <title>Default flow handler implementations</title> | ||
272 | <sect3> | ||
273 | <title>Default Level IRQ flow handler</title> | ||
274 | <para> | ||
275 | handle_level_irq provides a generic implementation | ||
276 | for level-triggered interrupts. | ||
277 | </para> | ||
278 | <para> | ||
279 | The following control flow is implemented (simplified excerpt): | ||
280 | <programlisting> | ||
281 | desc->chip->start(); | ||
282 | handle_IRQ_event(desc->action); | ||
283 | desc->chip->end(); | ||
284 | </programlisting> | ||
285 | </para> | ||
286 | </sect3> | ||
287 | <sect3> | ||
288 | <title>Default Edge IRQ flow handler</title> | ||
289 | <para> | ||
290 | handle_edge_irq provides a generic implementation | ||
291 | for edge-triggered interrupts. | ||
292 | </para> | ||
293 | <para> | ||
294 | The following control flow is implemented (simplified excerpt): | ||
295 | <programlisting> | ||
296 | if (desc->status & running) { | ||
297 | desc->chip->hold(); | ||
298 | desc->status |= pending | masked; | ||
299 | return; | ||
300 | } | ||
301 | desc->chip->start(); | ||
302 | desc->status |= running; | ||
303 | do { | ||
304 | if (desc->status & masked) | ||
305 | desc->chip->enable(); | ||
306 | desc-status &= ~pending; | ||
307 | handle_IRQ_event(desc->action); | ||
308 | } while (status & pending); | ||
309 | desc-status &= ~running; | ||
310 | desc->chip->end(); | ||
311 | </programlisting> | ||
312 | </para> | ||
313 | </sect3> | ||
314 | <sect3> | ||
315 | <title>Default simple IRQ flow handler</title> | ||
316 | <para> | ||
317 | handle_simple_irq provides a generic implementation | ||
318 | for simple interrupts. | ||
319 | </para> | ||
320 | <para> | ||
321 | Note: The simple flow handler does not call any | ||
322 | handler/chip primitives. | ||
323 | </para> | ||
324 | <para> | ||
325 | The following control flow is implemented (simplified excerpt): | ||
326 | <programlisting> | ||
327 | handle_IRQ_event(desc->action); | ||
328 | </programlisting> | ||
329 | </para> | ||
330 | </sect3> | ||
331 | <sect3> | ||
332 | <title>Default per CPU flow handler</title> | ||
333 | <para> | ||
334 | handle_percpu_irq provides a generic implementation | ||
335 | for per CPU interrupts. | ||
336 | </para> | ||
337 | <para> | ||
338 | Per CPU interrupts are only available on SMP and | ||
339 | the handler provides a simplified version without | ||
340 | locking. | ||
341 | </para> | ||
342 | <para> | ||
343 | The following control flow is implemented (simplified excerpt): | ||
344 | <programlisting> | ||
345 | desc->chip->start(); | ||
346 | handle_IRQ_event(desc->action); | ||
347 | desc->chip->end(); | ||
348 | </programlisting> | ||
349 | </para> | ||
350 | </sect3> | ||
351 | </sect2> | ||
352 | <sect2> | ||
353 | <title>Quirks and optimizations</title> | ||
354 | <para> | ||
355 | The generic functions are intended for 'clean' architectures and chips, | ||
356 | which have no platform-specific IRQ handling quirks. If an architecture | ||
357 | needs to implement quirks on the 'flow' level then it can do so by | ||
358 | overriding the highlevel irq-flow handler. | ||
359 | </para> | ||
360 | </sect2> | ||
361 | <sect2> | ||
362 | <title>Delayed interrupt disable</title> | ||
363 | <para> | ||
364 | This per interrupt selectable feature, which was introduced by Russell | ||
365 | King in the ARM interrupt implementation, does not mask an interrupt | ||
366 | at the hardware level when disable_irq() is called. The interrupt is | ||
367 | kept enabled and is masked in the flow handler when an interrupt event | ||
368 | happens. This prevents losing edge interrupts on hardware which does | ||
369 | not store an edge interrupt event while the interrupt is disabled at | ||
370 | the hardware level. When an interrupt arrives while the IRQ_DISABLED | ||
371 | flag is set, then the interrupt is masked at the hardware level and | ||
372 | the IRQ_PENDING bit is set. When the interrupt is re-enabled by | ||
373 | enable_irq() the pending bit is checked and if it is set, the | ||
374 | interrupt is resent either via hardware or by a software resend | ||
375 | mechanism. (It's necessary to enable CONFIG_HARDIRQS_SW_RESEND when | ||
376 | you want to use the delayed interrupt disable feature and your | ||
377 | hardware is not capable of retriggering an interrupt.) | ||
378 | The delayed interrupt disable can be runtime enabled, per interrupt, | ||
379 | by setting the IRQ_DELAYED_DISABLE flag in the irq_desc status field. | ||
380 | </para> | ||
381 | </sect2> | ||
382 | </sect1> | ||
383 | <sect1> | ||
384 | <title>Chiplevel hardware encapsulation</title> | ||
385 | <para> | ||
386 | The chip level hardware descriptor structure irq_chip | ||
387 | contains all the direct chip relevant functions, which | ||
388 | can be utilized by the irq flow implementations. | ||
389 | <itemizedlist> | ||
390 | <listitem><para>ack()</para></listitem> | ||
391 | <listitem><para>mask_ack() - Optional, recommended for performance</para></listitem> | ||
392 | <listitem><para>mask()</para></listitem> | ||
393 | <listitem><para>unmask()</para></listitem> | ||
394 | <listitem><para>retrigger() - Optional</para></listitem> | ||
395 | <listitem><para>set_type() - Optional</para></listitem> | ||
396 | <listitem><para>set_wake() - Optional</para></listitem> | ||
397 | </itemizedlist> | ||
398 | These primitives are strictly intended to mean what they say: ack means | ||
399 | ACK, masking means masking of an IRQ line, etc. It is up to the flow | ||
400 | handler(s) to use these basic units of lowlevel functionality. | ||
401 | </para> | ||
402 | </sect1> | ||
403 | </chapter> | ||
404 | |||
405 | <chapter id="doirq"> | ||
406 | <title>__do_IRQ entry point</title> | ||
407 | <para> | ||
408 | The original implementation __do_IRQ() is an alternative entry | ||
409 | point for all types of interrupts. | ||
410 | </para> | ||
411 | <para> | ||
412 | This handler turned out to be not suitable for all | ||
413 | interrupt hardware and was therefore reimplemented with split | ||
414 | functionality for egde/level/simple/percpu interrupts. This is not | ||
415 | only a functional optimization. It also shortens code paths for | ||
416 | interrupts. | ||
417 | </para> | ||
418 | <para> | ||
419 | To make use of the split implementation, replace the call to | ||
420 | __do_IRQ by a call to desc->chip->handle_irq() and associate | ||
421 | the appropriate handler function to desc->chip->handle_irq(). | ||
422 | In most cases the generic handler implementations should | ||
423 | be sufficient. | ||
424 | </para> | ||
425 | </chapter> | ||
426 | |||
427 | <chapter id="locking"> | ||
428 | <title>Locking on SMP</title> | ||
429 | <para> | ||
430 | The locking of chip registers is up to the architecture that | ||
431 | defines the chip primitives. There is a chip->lock field that can be used | ||
432 | for serialization, but the generic layer does not touch it. The per-irq | ||
433 | structure is protected via desc->lock, by the generic layer. | ||
434 | </para> | ||
435 | </chapter> | ||
436 | <chapter id="structs"> | ||
437 | <title>Structures</title> | ||
438 | <para> | ||
439 | This chapter contains the autogenerated documentation of the structures which are | ||
440 | used in the generic IRQ layer. | ||
441 | </para> | ||
442 | !Iinclude/linux/irq.h | ||
443 | </chapter> | ||
444 | |||
445 | <chapter id="pubfunctions"> | ||
446 | <title>Public Functions Provided</title> | ||
447 | <para> | ||
448 | This chapter contains the autogenerated documentation of the kernel API functions | ||
449 | which are exported. | ||
450 | </para> | ||
451 | !Ekernel/irq/manage.c | ||
452 | !Ekernel/irq/chip.c | ||
453 | </chapter> | ||
454 | |||
455 | <chapter id="intfunctions"> | ||
456 | <title>Internal Functions Provided</title> | ||
457 | <para> | ||
458 | This chapter contains the autogenerated documentation of the internal functions. | ||
459 | </para> | ||
460 | !Ikernel/irq/handle.c | ||
461 | !Ikernel/irq/chip.c | ||
462 | </chapter> | ||
463 | |||
464 | <chapter id="credits"> | ||
465 | <title>Credits</title> | ||
466 | <para> | ||
467 | The following people have contributed to this document: | ||
468 | <orderedlist> | ||
469 | <listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem> | ||
470 | <listitem><para>Ingo Molnar<email>mingo@elte.hu</email></para></listitem> | ||
471 | </orderedlist> | ||
472 | </para> | ||
473 | </chapter> | ||
474 | </book> | ||
diff --git a/Documentation/IRQ.txt b/Documentation/IRQ.txt new file mode 100644 index 000000000000..1011e7175021 --- /dev/null +++ b/Documentation/IRQ.txt | |||
@@ -0,0 +1,22 @@ | |||
1 | What is an IRQ? | ||
2 | |||
3 | An IRQ is an interrupt request from a device. | ||
4 | Currently they can come in over a pin, or over a packet. | ||
5 | Several devices may be connected to the same pin thus | ||
6 | sharing an IRQ. | ||
7 | |||
8 | An IRQ number is a kernel identifier used to talk about a hardware | ||
9 | interrupt source. Typically this is an index into the global irq_desc | ||
10 | array, but except for what linux/interrupt.h implements the details | ||
11 | are architecture specific. | ||
12 | |||
13 | An IRQ number is an enumeration of the possible interrupt sources on a | ||
14 | machine. Typically what is enumerated is the number of input pins on | ||
15 | all of the interrupt controller in the system. In the case of ISA | ||
16 | what is enumerated are the 16 input pins on the two i8259 interrupt | ||
17 | controllers. | ||
18 | |||
19 | Architectures can assign additional meaning to the IRQ numbers, and | ||
20 | are encouraged to in the case where there is any manual configuration | ||
21 | of the hardware involved. The ISA IRQs are a classic example of | ||
22 | assigning this kind of additional meaning. | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 027285d0c26c..033ac91da07a 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -177,6 +177,16 @@ Who: Jean Delvare <khali@linux-fr.org> | |||
177 | 177 | ||
178 | --------------------------- | 178 | --------------------------- |
179 | 179 | ||
180 | What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports | ||
181 | (temporary transition config option provided until then) | ||
182 | The transition config option will also be removed at the same time. | ||
183 | When: before 2.6.19 | ||
184 | Why: Unused symbols are both increasing the size of the kernel binary | ||
185 | and are often a sign of "wrong API" | ||
186 | Who: Arjan van de Ven <arjan@linux.intel.com> | ||
187 | |||
188 | --------------------------- | ||
189 | |||
180 | What: remove EXPORT_SYMBOL(tasklist_lock) | 190 | What: remove EXPORT_SYMBOL(tasklist_lock) |
181 | When: August 2006 | 191 | When: August 2006 |
182 | Files: kernel/fork.c | 192 | Files: kernel/fork.c |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 0d189c93eeaf..25f8d20dac53 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1689,9 +1689,14 @@ running once the system is up. | |||
1689 | decrease the size and leave more room for directly | 1689 | decrease the size and leave more room for directly |
1690 | mapped kernel RAM. | 1690 | mapped kernel RAM. |
1691 | 1691 | ||
1692 | vmhalt= [KNL,S390] | 1692 | vmhalt= [KNL,S390] Perform z/VM CP command after system halt. |
1693 | Format: <command> | ||
1693 | 1694 | ||
1694 | vmpoff= [KNL,S390] | 1695 | vmpanic= [KNL,S390] Perform z/VM CP command after kernel panic. |
1696 | Format: <command> | ||
1697 | |||
1698 | vmpoff= [KNL,S390] Perform z/VM CP command after power off. | ||
1699 | Format: <command> | ||
1695 | 1700 | ||
1696 | waveartist= [HW,OSS] | 1701 | waveartist= [HW,OSS] |
1697 | Format: <io>,<irq>,<dma>,<dma2> | 1702 | Format: <io>,<irq>,<dma>,<dma2> |
diff --git a/Documentation/keys-request-key.txt b/Documentation/keys-request-key.txt index 22488d791168..c1f64fdf84cb 100644 --- a/Documentation/keys-request-key.txt +++ b/Documentation/keys-request-key.txt | |||
@@ -3,16 +3,23 @@ | |||
3 | =================== | 3 | =================== |
4 | 4 | ||
5 | The key request service is part of the key retention service (refer to | 5 | The key request service is part of the key retention service (refer to |
6 | Documentation/keys.txt). This document explains more fully how that the | 6 | Documentation/keys.txt). This document explains more fully how the requesting |
7 | requesting algorithm works. | 7 | algorithm works. |
8 | 8 | ||
9 | The process starts by either the kernel requesting a service by calling | 9 | The process starts by either the kernel requesting a service by calling |
10 | request_key(): | 10 | request_key*(): |
11 | 11 | ||
12 | struct key *request_key(const struct key_type *type, | 12 | struct key *request_key(const struct key_type *type, |
13 | const char *description, | 13 | const char *description, |
14 | const char *callout_string); | 14 | const char *callout_string); |
15 | 15 | ||
16 | or: | ||
17 | |||
18 | struct key *request_key_with_auxdata(const struct key_type *type, | ||
19 | const char *description, | ||
20 | const char *callout_string, | ||
21 | void *aux); | ||
22 | |||
16 | Or by userspace invoking the request_key system call: | 23 | Or by userspace invoking the request_key system call: |
17 | 24 | ||
18 | key_serial_t request_key(const char *type, | 25 | key_serial_t request_key(const char *type, |
@@ -20,16 +27,26 @@ Or by userspace invoking the request_key system call: | |||
20 | const char *callout_info, | 27 | const char *callout_info, |
21 | key_serial_t dest_keyring); | 28 | key_serial_t dest_keyring); |
22 | 29 | ||
23 | The main difference between the two access points is that the in-kernel | 30 | The main difference between the access points is that the in-kernel interface |
24 | interface does not need to link the key to a keyring to prevent it from being | 31 | does not need to link the key to a keyring to prevent it from being immediately |
25 | immediately destroyed. The kernel interface returns a pointer directly to the | 32 | destroyed. The kernel interface returns a pointer directly to the key, and |
26 | key, and it's up to the caller to destroy the key. | 33 | it's up to the caller to destroy the key. |
34 | |||
35 | The request_key_with_auxdata() call is like the in-kernel request_key() call, | ||
36 | except that it permits auxiliary data to be passed to the upcaller (the default | ||
37 | is NULL). This is only useful for those key types that define their own upcall | ||
38 | mechanism rather than using /sbin/request-key. | ||
27 | 39 | ||
28 | The userspace interface links the key to a keyring associated with the process | 40 | The userspace interface links the key to a keyring associated with the process |
29 | to prevent the key from going away, and returns the serial number of the key to | 41 | to prevent the key from going away, and returns the serial number of the key to |
30 | the caller. | 42 | the caller. |
31 | 43 | ||
32 | 44 | ||
45 | The following example assumes that the key types involved don't define their | ||
46 | own upcall mechanisms. If they do, then those should be substituted for the | ||
47 | forking and execution of /sbin/request-key. | ||
48 | |||
49 | |||
33 | =========== | 50 | =========== |
34 | THE PROCESS | 51 | THE PROCESS |
35 | =========== | 52 | =========== |
@@ -40,8 +57,8 @@ A request proceeds in the following manner: | |||
40 | interface]. | 57 | interface]. |
41 | 58 | ||
42 | (2) request_key() searches the process's subscribed keyrings to see if there's | 59 | (2) request_key() searches the process's subscribed keyrings to see if there's |
43 | a suitable key there. If there is, it returns the key. If there isn't, and | 60 | a suitable key there. If there is, it returns the key. If there isn't, |
44 | callout_info is not set, an error is returned. Otherwise the process | 61 | and callout_info is not set, an error is returned. Otherwise the process |
45 | proceeds to the next step. | 62 | proceeds to the next step. |
46 | 63 | ||
47 | (3) request_key() sees that A doesn't have the desired key yet, so it creates | 64 | (3) request_key() sees that A doesn't have the desired key yet, so it creates |
@@ -62,7 +79,7 @@ A request proceeds in the following manner: | |||
62 | instantiation. | 79 | instantiation. |
63 | 80 | ||
64 | (7) The program may want to access another key from A's context (say a | 81 | (7) The program may want to access another key from A's context (say a |
65 | Kerberos TGT key). It just requests the appropriate key, and the keyring | 82 | Kerberos TGT key). It just requests the appropriate key, and the keyring |
66 | search notes that the session keyring has auth key V in its bottom level. | 83 | search notes that the session keyring has auth key V in its bottom level. |
67 | 84 | ||
68 | This will permit it to then search the keyrings of process A with the | 85 | This will permit it to then search the keyrings of process A with the |
@@ -79,10 +96,11 @@ A request proceeds in the following manner: | |||
79 | (10) The program then exits 0 and request_key() deletes key V and returns key | 96 | (10) The program then exits 0 and request_key() deletes key V and returns key |
80 | U to the caller. | 97 | U to the caller. |
81 | 98 | ||
82 | This also extends further. If key W (step 7 above) didn't exist, key W would be | 99 | This also extends further. If key W (step 7 above) didn't exist, key W would |
83 | created uninstantiated, another auth key (X) would be created (as per step 3) | 100 | be created uninstantiated, another auth key (X) would be created (as per step |
84 | and another copy of /sbin/request-key spawned (as per step 4); but the context | 101 | 3) and another copy of /sbin/request-key spawned (as per step 4); but the |
85 | specified by auth key X will still be process A, as it was in auth key V. | 102 | context specified by auth key X will still be process A, as it was in auth key |
103 | V. | ||
86 | 104 | ||
87 | This is because process A's keyrings can't simply be attached to | 105 | This is because process A's keyrings can't simply be attached to |
88 | /sbin/request-key at the appropriate places because (a) execve will discard two | 106 | /sbin/request-key at the appropriate places because (a) execve will discard two |
@@ -118,17 +136,17 @@ A search of any particular keyring proceeds in the following fashion: | |||
118 | 136 | ||
119 | (2) It considers all the non-keyring keys within that keyring and, if any key | 137 | (2) It considers all the non-keyring keys within that keyring and, if any key |
120 | matches the criteria specified, calls key_permission(SEARCH) on it to see | 138 | matches the criteria specified, calls key_permission(SEARCH) on it to see |
121 | if the key is allowed to be found. If it is, that key is returned; if | 139 | if the key is allowed to be found. If it is, that key is returned; if |
122 | not, the search continues, and the error code is retained if of higher | 140 | not, the search continues, and the error code is retained if of higher |
123 | priority than the one currently set. | 141 | priority than the one currently set. |
124 | 142 | ||
125 | (3) It then considers all the keyring-type keys in the keyring it's currently | 143 | (3) It then considers all the keyring-type keys in the keyring it's currently |
126 | searching. It calls key_permission(SEARCH) on each keyring, and if this | 144 | searching. It calls key_permission(SEARCH) on each keyring, and if this |
127 | grants permission, it recurses, executing steps (2) and (3) on that | 145 | grants permission, it recurses, executing steps (2) and (3) on that |
128 | keyring. | 146 | keyring. |
129 | 147 | ||
130 | The process stops immediately a valid key is found with permission granted to | 148 | The process stops immediately a valid key is found with permission granted to |
131 | use it. Any error from a previous match attempt is discarded and the key is | 149 | use it. Any error from a previous match attempt is discarded and the key is |
132 | returned. | 150 | returned. |
133 | 151 | ||
134 | When search_process_keyrings() is invoked, it performs the following searches | 152 | When search_process_keyrings() is invoked, it performs the following searches |
@@ -153,7 +171,7 @@ The moment one succeeds, all pending errors are discarded and the found key is | |||
153 | returned. | 171 | returned. |
154 | 172 | ||
155 | Only if all these fail does the whole thing fail with the highest priority | 173 | Only if all these fail does the whole thing fail with the highest priority |
156 | error. Note that several errors may have come from LSM. | 174 | error. Note that several errors may have come from LSM. |
157 | 175 | ||
158 | The error priority is: | 176 | The error priority is: |
159 | 177 | ||
diff --git a/Documentation/keys.txt b/Documentation/keys.txt index 61c0fad2fe2f..e373f0212843 100644 --- a/Documentation/keys.txt +++ b/Documentation/keys.txt | |||
@@ -780,6 +780,17 @@ payload contents" for more information. | |||
780 | See also Documentation/keys-request-key.txt. | 780 | See also Documentation/keys-request-key.txt. |
781 | 781 | ||
782 | 782 | ||
783 | (*) To search for a key, passing auxiliary data to the upcaller, call: | ||
784 | |||
785 | struct key *request_key_with_auxdata(const struct key_type *type, | ||
786 | const char *description, | ||
787 | const char *callout_string, | ||
788 | void *aux); | ||
789 | |||
790 | This is identical to request_key(), except that the auxiliary data is | ||
791 | passed to the key_type->request_key() op if it exists. | ||
792 | |||
793 | |||
783 | (*) When it is no longer required, the key should be released using: | 794 | (*) When it is no longer required, the key should be released using: |
784 | 795 | ||
785 | void key_put(struct key *key); | 796 | void key_put(struct key *key); |
@@ -1031,6 +1042,24 @@ The structure has a number of fields, some of which are mandatory: | |||
1031 | as might happen when the userspace buffer is accessed. | 1042 | as might happen when the userspace buffer is accessed. |
1032 | 1043 | ||
1033 | 1044 | ||
1045 | (*) int (*request_key)(struct key *key, struct key *authkey, const char *op, | ||
1046 | void *aux); | ||
1047 | |||
1048 | This method is optional. If provided, request_key() and | ||
1049 | request_key_with_auxdata() will invoke this function rather than | ||
1050 | upcalling to /sbin/request-key to operate upon a key of this type. | ||
1051 | |||
1052 | The aux parameter is as passed to request_key_with_auxdata() or is NULL | ||
1053 | otherwise. Also passed are the key to be operated upon, the | ||
1054 | authorisation key for this operation and the operation type (currently | ||
1055 | only "create"). | ||
1056 | |||
1057 | This function should return only when the upcall is complete. Upon return | ||
1058 | the authorisation key will be revoked, and the target key will be | ||
1059 | negatively instantiated if it is still uninstantiated. The error will be | ||
1060 | returned to the caller of request_key*(). | ||
1061 | |||
1062 | |||
1034 | ============================ | 1063 | ============================ |
1035 | REQUEST-KEY CALLBACK SERVICE | 1064 | REQUEST-KEY CALLBACK SERVICE |
1036 | ============================ | 1065 | ============================ |
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.txt index 12187a33e310..d9ee6336c1d4 100644 --- a/Documentation/watchdog/pcwd-watchdog.txt +++ b/Documentation/watchdog/pcwd-watchdog.txt | |||
@@ -22,78 +22,9 @@ | |||
22 | to run the program with an "&" to run it in the background!) | 22 | to run the program with an "&" to run it in the background!) |
23 | 23 | ||
24 | If you want to write a program to be compatible with the PC Watchdog | 24 | If you want to write a program to be compatible with the PC Watchdog |
25 | driver, simply do the following: | 25 | driver, simply use of modify the watchdog test program: |
26 | 26 | Documentation/watchdog/src/watchdog-test.c | |
27 | -- Snippet of code -- | 27 | |
28 | /* | ||
29 | * Watchdog Driver Test Program | ||
30 | */ | ||
31 | |||
32 | #include <stdio.h> | ||
33 | #include <stdlib.h> | ||
34 | #include <string.h> | ||
35 | #include <unistd.h> | ||
36 | #include <fcntl.h> | ||
37 | #include <sys/ioctl.h> | ||
38 | #include <linux/types.h> | ||
39 | #include <linux/watchdog.h> | ||
40 | |||
41 | int fd; | ||
42 | |||
43 | /* | ||
44 | * This function simply sends an IOCTL to the driver, which in turn ticks | ||
45 | * the PC Watchdog card to reset its internal timer so it doesn't trigger | ||
46 | * a computer reset. | ||
47 | */ | ||
48 | void keep_alive(void) | ||
49 | { | ||
50 | int dummy; | ||
51 | |||
52 | ioctl(fd, WDIOC_KEEPALIVE, &dummy); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * The main program. Run the program with "-d" to disable the card, | ||
57 | * or "-e" to enable the card. | ||
58 | */ | ||
59 | int main(int argc, char *argv[]) | ||
60 | { | ||
61 | fd = open("/dev/watchdog", O_WRONLY); | ||
62 | |||
63 | if (fd == -1) { | ||
64 | fprintf(stderr, "Watchdog device not enabled.\n"); | ||
65 | fflush(stderr); | ||
66 | exit(-1); | ||
67 | } | ||
68 | |||
69 | if (argc > 1) { | ||
70 | if (!strncasecmp(argv[1], "-d", 2)) { | ||
71 | ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD); | ||
72 | fprintf(stderr, "Watchdog card disabled.\n"); | ||
73 | fflush(stderr); | ||
74 | exit(0); | ||
75 | } else if (!strncasecmp(argv[1], "-e", 2)) { | ||
76 | ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD); | ||
77 | fprintf(stderr, "Watchdog card enabled.\n"); | ||
78 | fflush(stderr); | ||
79 | exit(0); | ||
80 | } else { | ||
81 | fprintf(stderr, "-d to disable, -e to enable.\n"); | ||
82 | fprintf(stderr, "run by itself to tick the card.\n"); | ||
83 | fflush(stderr); | ||
84 | exit(0); | ||
85 | } | ||
86 | } else { | ||
87 | fprintf(stderr, "Watchdog Ticking Away!\n"); | ||
88 | fflush(stderr); | ||
89 | } | ||
90 | |||
91 | while(1) { | ||
92 | keep_alive(); | ||
93 | sleep(1); | ||
94 | } | ||
95 | } | ||
96 | -- End snippet -- | ||
97 | 28 | ||
98 | Other IOCTL functions include: | 29 | Other IOCTL functions include: |
99 | 30 | ||
diff --git a/Documentation/watchdog/src/watchdog-simple.c b/Documentation/watchdog/src/watchdog-simple.c new file mode 100644 index 000000000000..85cf17c48669 --- /dev/null +++ b/Documentation/watchdog/src/watchdog-simple.c | |||
@@ -0,0 +1,15 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <fcntl.h> | ||
3 | |||
4 | int main(int argc, const char *argv[]) { | ||
5 | int fd = open("/dev/watchdog", O_WRONLY); | ||
6 | if (fd == -1) { | ||
7 | perror("watchdog"); | ||
8 | exit(1); | ||
9 | } | ||
10 | while (1) { | ||
11 | write(fd, "\0", 1); | ||
12 | fsync(fd); | ||
13 | sleep(10); | ||
14 | } | ||
15 | } | ||
diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c new file mode 100644 index 000000000000..65f6c19cb865 --- /dev/null +++ b/Documentation/watchdog/src/watchdog-test.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Watchdog Driver Test Program | ||
3 | */ | ||
4 | |||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include <string.h> | ||
8 | #include <unistd.h> | ||
9 | #include <fcntl.h> | ||
10 | #include <sys/ioctl.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/watchdog.h> | ||
13 | |||
14 | int fd; | ||
15 | |||
16 | /* | ||
17 | * This function simply sends an IOCTL to the driver, which in turn ticks | ||
18 | * the PC Watchdog card to reset its internal timer so it doesn't trigger | ||
19 | * a computer reset. | ||
20 | */ | ||
21 | void keep_alive(void) | ||
22 | { | ||
23 | int dummy; | ||
24 | |||
25 | ioctl(fd, WDIOC_KEEPALIVE, &dummy); | ||
26 | } | ||
27 | |||
28 | /* | ||
29 | * The main program. Run the program with "-d" to disable the card, | ||
30 | * or "-e" to enable the card. | ||
31 | */ | ||
32 | int main(int argc, char *argv[]) | ||
33 | { | ||
34 | fd = open("/dev/watchdog", O_WRONLY); | ||
35 | |||
36 | if (fd == -1) { | ||
37 | fprintf(stderr, "Watchdog device not enabled.\n"); | ||
38 | fflush(stderr); | ||
39 | exit(-1); | ||
40 | } | ||
41 | |||
42 | if (argc > 1) { | ||
43 | if (!strncasecmp(argv[1], "-d", 2)) { | ||
44 | ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD); | ||
45 | fprintf(stderr, "Watchdog card disabled.\n"); | ||
46 | fflush(stderr); | ||
47 | exit(0); | ||
48 | } else if (!strncasecmp(argv[1], "-e", 2)) { | ||
49 | ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD); | ||
50 | fprintf(stderr, "Watchdog card enabled.\n"); | ||
51 | fflush(stderr); | ||
52 | exit(0); | ||
53 | } else { | ||
54 | fprintf(stderr, "-d to disable, -e to enable.\n"); | ||
55 | fprintf(stderr, "run by itself to tick the card.\n"); | ||
56 | fflush(stderr); | ||
57 | exit(0); | ||
58 | } | ||
59 | } else { | ||
60 | fprintf(stderr, "Watchdog Ticking Away!\n"); | ||
61 | fflush(stderr); | ||
62 | } | ||
63 | |||
64 | while(1) { | ||
65 | keep_alive(); | ||
66 | sleep(1); | ||
67 | } | ||
68 | } | ||
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt index 21ed51173662..958ff3d48be3 100644 --- a/Documentation/watchdog/watchdog-api.txt +++ b/Documentation/watchdog/watchdog-api.txt | |||
@@ -34,22 +34,7 @@ activates as soon as /dev/watchdog is opened and will reboot unless | |||
34 | the watchdog is pinged within a certain time, this time is called the | 34 | the watchdog is pinged within a certain time, this time is called the |
35 | timeout or margin. The simplest way to ping the watchdog is to write | 35 | timeout or margin. The simplest way to ping the watchdog is to write |
36 | some data to the device. So a very simple watchdog daemon would look | 36 | some data to the device. So a very simple watchdog daemon would look |
37 | like this: | 37 | like this source file: see Documentation/watchdog/src/watchdog-simple.c |
38 | |||
39 | #include <stdlib.h> | ||
40 | #include <fcntl.h> | ||
41 | |||
42 | int main(int argc, const char *argv[]) { | ||
43 | int fd=open("/dev/watchdog",O_WRONLY); | ||
44 | if (fd==-1) { | ||
45 | perror("watchdog"); | ||
46 | exit(1); | ||
47 | } | ||
48 | while(1) { | ||
49 | write(fd, "\0", 1); | ||
50 | sleep(10); | ||
51 | } | ||
52 | } | ||
53 | 38 | ||
54 | A more advanced driver could for example check that a HTTP server is | 39 | A more advanced driver could for example check that a HTTP server is |
55 | still responding before doing the write call to ping the watchdog. | 40 | still responding before doing the write call to ping the watchdog. |
@@ -110,7 +95,40 @@ current timeout using the GETTIMEOUT ioctl. | |||
110 | ioctl(fd, WDIOC_GETTIMEOUT, &timeout); | 95 | ioctl(fd, WDIOC_GETTIMEOUT, &timeout); |
111 | printf("The timeout was is %d seconds\n", timeout); | 96 | printf("The timeout was is %d seconds\n", timeout); |
112 | 97 | ||
113 | Envinronmental monitoring: | 98 | Pretimeouts: |
99 | |||
100 | Some watchdog timers can be set to have a trigger go off before the | ||
101 | actual time they will reset the system. This can be done with an NMI, | ||
102 | interrupt, or other mechanism. This allows Linux to record useful | ||
103 | information (like panic information and kernel coredumps) before it | ||
104 | resets. | ||
105 | |||
106 | pretimeout = 10; | ||
107 | ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout); | ||
108 | |||
109 | Note that the pretimeout is the number of seconds before the time | ||
110 | when the timeout will go off. It is not the number of seconds until | ||
111 | the pretimeout. So, for instance, if you set the timeout to 60 seconds | ||
112 | and the pretimeout to 10 seconds, the pretimout will go of in 50 | ||
113 | seconds. Setting a pretimeout to zero disables it. | ||
114 | |||
115 | There is also a get function for getting the pretimeout: | ||
116 | |||
117 | ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout); | ||
118 | printf("The pretimeout was is %d seconds\n", timeout); | ||
119 | |||
120 | Not all watchdog drivers will support a pretimeout. | ||
121 | |||
122 | Get the number of seconds before reboot: | ||
123 | |||
124 | Some watchdog drivers have the ability to report the remaining time | ||
125 | before the system will reboot. The WDIOC_GETTIMELEFT is the ioctl | ||
126 | that returns the number of seconds before reboot. | ||
127 | |||
128 | ioctl(fd, WDIOC_GETTIMELEFT, &timeleft); | ||
129 | printf("The timeout was is %d seconds\n", timeleft); | ||
130 | |||
131 | Environmental monitoring: | ||
114 | 132 | ||
115 | All watchdog drivers are required return more information about the system, | 133 | All watchdog drivers are required return more information about the system, |
116 | some do temperature, fan and power level monitoring, some can tell you | 134 | some do temperature, fan and power level monitoring, some can tell you |
@@ -169,6 +187,10 @@ The watchdog saw a keepalive ping since it was last queried. | |||
169 | 187 | ||
170 | WDIOF_SETTIMEOUT Can set/get the timeout | 188 | WDIOF_SETTIMEOUT Can set/get the timeout |
171 | 189 | ||
190 | The watchdog can do pretimeouts. | ||
191 | |||
192 | WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set | ||
193 | |||
172 | 194 | ||
173 | For those drivers that return any bits set in the option field, the | 195 | For those drivers that return any bits set in the option field, the |
174 | GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current | 196 | GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current |
diff --git a/Documentation/watchdog/watchdog.txt b/Documentation/watchdog/watchdog.txt index dffda29c8799..4b1ff69cc19a 100644 --- a/Documentation/watchdog/watchdog.txt +++ b/Documentation/watchdog/watchdog.txt | |||
@@ -65,28 +65,7 @@ The external event interfaces on the WDT boards are not currently supported. | |||
65 | Minor numbers are however allocated for it. | 65 | Minor numbers are however allocated for it. |
66 | 66 | ||
67 | 67 | ||
68 | Example Watchdog Driver | 68 | Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c |
69 | ----------------------- | ||
70 | |||
71 | #include <stdio.h> | ||
72 | #include <unistd.h> | ||
73 | #include <fcntl.h> | ||
74 | |||
75 | int main(int argc, const char *argv[]) | ||
76 | { | ||
77 | int fd=open("/dev/watchdog",O_WRONLY); | ||
78 | if(fd==-1) | ||
79 | { | ||
80 | perror("watchdog"); | ||
81 | exit(1); | ||
82 | } | ||
83 | while(1) | ||
84 | { | ||
85 | write(fd,"\0",1); | ||
86 | fsync(fd); | ||
87 | sleep(10); | ||
88 | } | ||
89 | } | ||
90 | 69 | ||
91 | 70 | ||
92 | Contact Information | 71 | Contact Information |