diff options
Diffstat (limited to 'Documentation/watchdog')
-rw-r--r-- | Documentation/watchdog/pcwd-watchdog.txt | 135 | ||||
-rw-r--r-- | Documentation/watchdog/watchdog-api.txt | 399 | ||||
-rw-r--r-- | Documentation/watchdog/watchdog.txt | 115 |
3 files changed, 649 insertions, 0 deletions
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.txt new file mode 100644 index 000000000000..12187a33e310 --- /dev/null +++ b/Documentation/watchdog/pcwd-watchdog.txt | |||
@@ -0,0 +1,135 @@ | |||
1 | Berkshire Products PC Watchdog Card | ||
2 | Support for ISA Cards Revision A and C | ||
3 | Documentation and Driver by Ken Hollis <kenji@bitgate.com> | ||
4 | |||
5 | The PC Watchdog is a card that offers the same type of functionality that | ||
6 | the WDT card does, only it doesn't require an IRQ to run. Furthermore, | ||
7 | the Revision C card allows you to monitor any IO Port to automatically | ||
8 | trigger the card into being reset. This way you can make the card | ||
9 | monitor hard drive status, or anything else you need. | ||
10 | |||
11 | The Watchdog Driver has one basic role: to talk to the card and send | ||
12 | signals to it so it doesn't reset your computer ... at least during | ||
13 | normal operation. | ||
14 | |||
15 | The Watchdog Driver will automatically find your watchdog card, and will | ||
16 | attach a running driver for use with that card. After the watchdog | ||
17 | drivers have initialized, you can then talk to the card using the PC | ||
18 | Watchdog program, available from http://ftp.bitgate.com/pcwd/. | ||
19 | |||
20 | I suggest putting a "watchdog -d" before the beginning of an fsck, and | ||
21 | a "watchdog -e -t 1" immediately after the end of an fsck. (Remember | ||
22 | to run the program with an "&" to run it in the background!) | ||
23 | |||
24 | If you want to write a program to be compatible with the PC Watchdog | ||
25 | driver, simply do the following: | ||
26 | |||
27 | -- Snippet of code -- | ||
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 | |||
98 | Other IOCTL functions include: | ||
99 | |||
100 | WDIOC_GETSUPPORT | ||
101 | This returns the support of the card itself. This | ||
102 | returns in structure "PCWDS" which returns: | ||
103 | options = WDIOS_TEMPPANIC | ||
104 | (This card supports temperature) | ||
105 | firmware_version = xxxx | ||
106 | (Firmware version of the card) | ||
107 | |||
108 | WDIOC_GETSTATUS | ||
109 | This returns the status of the card, with the bits of | ||
110 | WDIOF_* bitwise-anded into the value. (The comments | ||
111 | are in linux/pcwd.h) | ||
112 | |||
113 | WDIOC_GETBOOTSTATUS | ||
114 | This returns the status of the card that was reported | ||
115 | at bootup. | ||
116 | |||
117 | WDIOC_GETTEMP | ||
118 | This returns the temperature of the card. (You can also | ||
119 | read /dev/watchdog, which gives a temperature update | ||
120 | every second.) | ||
121 | |||
122 | WDIOC_SETOPTIONS | ||
123 | This lets you set the options of the card. You can either | ||
124 | enable or disable the card this way. | ||
125 | |||
126 | WDIOC_KEEPALIVE | ||
127 | This pings the card to tell it not to reset your computer. | ||
128 | |||
129 | And that's all she wrote! | ||
130 | |||
131 | -- Ken Hollis | ||
132 | (kenji@bitgate.com) | ||
133 | |||
134 | (This documentation may be out of date. Check | ||
135 | http://ftp.bitgate.com/pcwd/ for the absolute latest additions.) | ||
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt new file mode 100644 index 000000000000..28388aa700c6 --- /dev/null +++ b/Documentation/watchdog/watchdog-api.txt | |||
@@ -0,0 +1,399 @@ | |||
1 | The Linux Watchdog driver API. | ||
2 | |||
3 | Copyright 2002 Christer Weingel <wingel@nano-system.com> | ||
4 | |||
5 | Some parts of this document are copied verbatim from the sbc60xxwdt | ||
6 | driver which is (c) Copyright 2000 Jakob Oestergaard <jakob@ostenfeld.dk> | ||
7 | |||
8 | This document describes the state of the Linux 2.4.18 kernel. | ||
9 | |||
10 | Introduction: | ||
11 | |||
12 | A Watchdog Timer (WDT) is a hardware circuit that can reset the | ||
13 | computer system in case of a software fault. You probably knew that | ||
14 | already. | ||
15 | |||
16 | Usually a userspace daemon will notify the kernel watchdog driver via the | ||
17 | /dev/watchdog special device file that userspace is still alive, at | ||
18 | regular intervals. When such a notification occurs, the driver will | ||
19 | usually tell the hardware watchdog that everything is in order, and | ||
20 | that the watchdog should wait for yet another little while to reset | ||
21 | the system. If userspace fails (RAM error, kernel bug, whatever), the | ||
22 | notifications cease to occur, and the hardware watchdog will reset the | ||
23 | system (causing a reboot) after the timeout occurs. | ||
24 | |||
25 | The Linux watchdog API is a rather AD hoc construction and different | ||
26 | drivers implement different, and sometimes incompatible, parts of it. | ||
27 | This file is an attempt to document the existing usage and allow | ||
28 | future driver writers to use it as a reference. | ||
29 | |||
30 | The simplest API: | ||
31 | |||
32 | All drivers support the basic mode of operation, where the watchdog | ||
33 | 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 | ||
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 | ||
37 | like this: | ||
38 | |||
39 | int main(int argc, const char *argv[]) { | ||
40 | int fd=open("/dev/watchdog",O_WRONLY); | ||
41 | if (fd==-1) { | ||
42 | perror("watchdog"); | ||
43 | exit(1); | ||
44 | } | ||
45 | while(1) { | ||
46 | write(fd, "\0", 1); | ||
47 | sleep(10); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | A more advanced driver could for example check that a HTTP server is | ||
52 | still responding before doing the write call to ping the watchdog. | ||
53 | |||
54 | When the device is closed, the watchdog is disabled. This is not | ||
55 | always such a good idea, since if there is a bug in the watchdog | ||
56 | daemon and it crashes the system will not reboot. Because of this, | ||
57 | some of the drivers support the configuration option "Disable watchdog | ||
58 | shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when | ||
59 | compiling the kernel, there is no way of disabling the watchdog once | ||
60 | it has been started. So, if the watchdog dameon crashes, the system | ||
61 | will reboot after the timeout has passed. | ||
62 | |||
63 | Some other drivers will not disable the watchdog, unless a specific | ||
64 | magic character 'V' has been sent /dev/watchdog just before closing | ||
65 | the file. If the userspace daemon closes the file without sending | ||
66 | this special character, the driver will assume that the daemon (and | ||
67 | userspace in general) died, and will stop pinging the watchdog without | ||
68 | disabling it first. This will then cause a reboot. | ||
69 | |||
70 | The ioctl API: | ||
71 | |||
72 | All conforming drivers also support an ioctl API. | ||
73 | |||
74 | Pinging the watchdog using an ioctl: | ||
75 | |||
76 | All drivers that have an ioctl interface support at least one ioctl, | ||
77 | KEEPALIVE. This ioctl does exactly the same thing as a write to the | ||
78 | watchdog device, so the main loop in the above program could be | ||
79 | replaced with: | ||
80 | |||
81 | while (1) { | ||
82 | ioctl(fd, WDIOC_KEEPALIVE, 0); | ||
83 | sleep(10); | ||
84 | } | ||
85 | |||
86 | the argument to the ioctl is ignored. | ||
87 | |||
88 | Setting and getting the timeout: | ||
89 | |||
90 | For some drivers it is possible to modify the watchdog timeout on the | ||
91 | fly with the SETTIMEOUT ioctl, those drivers have the WDIOF_SETTIMEOUT | ||
92 | flag set in their option field. The argument is an integer | ||
93 | representing the timeout in seconds. The driver returns the real | ||
94 | timeout used in the same variable, and this timeout might differ from | ||
95 | the requested one due to limitation of the hardware. | ||
96 | |||
97 | int timeout = 45; | ||
98 | ioctl(fd, WDIOC_SETTIMEOUT, &timeout); | ||
99 | printf("The timeout was set to %d seconds\n", timeout); | ||
100 | |||
101 | This example might actually print "The timeout was set to 60 seconds" | ||
102 | if the device has a granularity of minutes for its timeout. | ||
103 | |||
104 | Starting with the Linux 2.4.18 kernel, it is possible to query the | ||
105 | current timeout using the GETTIMEOUT ioctl. | ||
106 | |||
107 | ioctl(fd, WDIOC_GETTIMEOUT, &timeout); | ||
108 | printf("The timeout was is %d seconds\n", timeout); | ||
109 | |||
110 | Envinronmental monitoring: | ||
111 | |||
112 | All watchdog drivers are required return more information about the system, | ||
113 | some do temperature, fan and power level monitoring, some can tell you | ||
114 | the reason for the last reboot of the system. The GETSUPPORT ioctl is | ||
115 | available to ask what the device can do: | ||
116 | |||
117 | struct watchdog_info ident; | ||
118 | ioctl(fd, WDIOC_GETSUPPORT, &ident); | ||
119 | |||
120 | the fields returned in the ident struct are: | ||
121 | |||
122 | identity a string identifying the watchdog driver | ||
123 | firmware_version the firmware version of the card if available | ||
124 | options a flags describing what the device supports | ||
125 | |||
126 | the options field can have the following bits set, and describes what | ||
127 | kind of information that the GET_STATUS and GET_BOOT_STATUS ioctls can | ||
128 | return. [FIXME -- Is this correct?] | ||
129 | |||
130 | WDIOF_OVERHEAT Reset due to CPU overheat | ||
131 | |||
132 | The machine was last rebooted by the watchdog because the thermal limit was | ||
133 | exceeded | ||
134 | |||
135 | WDIOF_FANFAULT Fan failed | ||
136 | |||
137 | A system fan monitored by the watchdog card has failed | ||
138 | |||
139 | WDIOF_EXTERN1 External relay 1 | ||
140 | |||
141 | External monitoring relay/source 1 was triggered. Controllers intended for | ||
142 | real world applications include external monitoring pins that will trigger | ||
143 | a reset. | ||
144 | |||
145 | WDIOF_EXTERN2 External relay 2 | ||
146 | |||
147 | External monitoring relay/source 2 was triggered | ||
148 | |||
149 | WDIOF_POWERUNDER Power bad/power fault | ||
150 | |||
151 | The machine is showing an undervoltage status | ||
152 | |||
153 | WDIOF_CARDRESET Card previously reset the CPU | ||
154 | |||
155 | The last reboot was caused by the watchdog card | ||
156 | |||
157 | WDIOF_POWEROVER Power over voltage | ||
158 | |||
159 | The machine is showing an overvoltage status. Note that if one level is | ||
160 | under and one over both bits will be set - this may seem odd but makes | ||
161 | sense. | ||
162 | |||
163 | WDIOF_KEEPALIVEPING Keep alive ping reply | ||
164 | |||
165 | The watchdog saw a keepalive ping since it was last queried. | ||
166 | |||
167 | WDIOF_SETTIMEOUT Can set/get the timeout | ||
168 | |||
169 | |||
170 | For those drivers that return any bits set in the option field, the | ||
171 | GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current | ||
172 | status, and the status at the last reboot, respectively. | ||
173 | |||
174 | int flags; | ||
175 | ioctl(fd, WDIOC_GETSTATUS, &flags); | ||
176 | |||
177 | or | ||
178 | |||
179 | ioctl(fd, WDIOC_GETBOOTSTATUS, &flags); | ||
180 | |||
181 | Note that not all devices support these two calls, and some only | ||
182 | support the GETBOOTSTATUS call. | ||
183 | |||
184 | Some drivers can measure the temperature using the GETTEMP ioctl. The | ||
185 | returned value is the temperature in degrees farenheit. | ||
186 | |||
187 | int temperature; | ||
188 | ioctl(fd, WDIOC_GETTEMP, &temperature); | ||
189 | |||
190 | Finally the SETOPTIONS ioctl can be used to control some aspects of | ||
191 | the cards operation; right now the pcwd driver is the only one | ||
192 | supporting thiss ioctl. | ||
193 | |||
194 | int options = 0; | ||
195 | ioctl(fd, WDIOC_SETOPTIONS, options); | ||
196 | |||
197 | The following options are available: | ||
198 | |||
199 | WDIOS_DISABLECARD Turn off the watchdog timer | ||
200 | WDIOS_ENABLECARD Turn on the watchdog timer | ||
201 | WDIOS_TEMPPANIC Kernel panic on temperature trip | ||
202 | |||
203 | [FIXME -- better explanations] | ||
204 | |||
205 | Implementations in the current drivers in the kernel tree: | ||
206 | |||
207 | Here I have tried to summarize what the different drivers support and | ||
208 | where they do strange things compared to the other drivers. | ||
209 | |||
210 | acquirewdt.c -- Acquire Single Board Computer | ||
211 | |||
212 | This driver has a hardcoded timeout of 1 minute | ||
213 | |||
214 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
215 | |||
216 | GETSUPPORT returns KEEPALIVEPING. GETSTATUS will return 1 if | ||
217 | the device is open, 0 if not. [FIXME -- isn't this rather | ||
218 | silly? To be able to use the ioctl, the device must be open | ||
219 | and so GETSTATUS will always return 1]. | ||
220 | |||
221 | advantechwdt.c -- Advantech Single Board Computer | ||
222 | |||
223 | Timeout that defaults to 60 seconds, supports SETTIMEOUT. | ||
224 | |||
225 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
226 | |||
227 | GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT. | ||
228 | The GETSTATUS call returns if the device is open or not. | ||
229 | [FIXME -- silliness again?] | ||
230 | |||
231 | eurotechwdt.c -- Eurotech CPU-1220/1410 | ||
232 | |||
233 | The timeout can be set using the SETTIMEOUT ioctl and defaults | ||
234 | to 60 seconds. | ||
235 | |||
236 | Also has a module parameter "ev", event type which controls | ||
237 | what should happen on a timeout, the string "int" or anything | ||
238 | else that causes a reboot. [FIXME -- better description] | ||
239 | |||
240 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
241 | |||
242 | GETSUPPORT returns CARDRESET and WDIOF_SETTIMEOUT but | ||
243 | GETSTATUS is not supported and GETBOOTSTATUS just returns 0. | ||
244 | |||
245 | i810-tco.c -- Intel 810 chipset | ||
246 | |||
247 | Also has support for a lot of other i8x0 stuff, but the | ||
248 | watchdog is one of the things. | ||
249 | |||
250 | The timeout is set using the module parameter "i810_margin", | ||
251 | which is in steps of 0.6 seconds where 2<i810_margin<64. The | ||
252 | driver supports the SETTIMEOUT ioctl. | ||
253 | |||
254 | Supports CONFIG_WATCHDOG_NOWAYOUT. | ||
255 | |||
256 | GETSUPPORT returns WDIOF_SETTIMEOUT. The GETSTATUS call | ||
257 | returns some kind of timer value which ist not compatible with | ||
258 | the other drivers. GETBOOT status returns some kind of | ||
259 | hardware specific boot status. [FIXME -- describe this] | ||
260 | |||
261 | ib700wdt.c -- IB700 Single Board Computer | ||
262 | |||
263 | Default timeout of 30 seconds and the timeout is settable | ||
264 | using the SETTIMEOUT ioctl. Note that only a few timeout | ||
265 | values are supported. | ||
266 | |||
267 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
268 | |||
269 | GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT. | ||
270 | The GETSTATUS call returns if the device is open or not. | ||
271 | [FIXME -- silliness again?] | ||
272 | |||
273 | machzwd.c -- MachZ ZF-Logic | ||
274 | |||
275 | Hardcoded timeout of 10 seconds | ||
276 | |||
277 | Has a module parameter "action" that controls what happens | ||
278 | when the timeout runs out which can be 0 = RESET (default), | ||
279 | 1 = SMI, 2 = NMI, 3 = SCI. | ||
280 | |||
281 | Supports CONFIG_WATCHDOG_NOWAYOUT and the magic character | ||
282 | 'V' close handling. | ||
283 | |||
284 | GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call | ||
285 | returns if the device is open or not. [FIXME -- silliness | ||
286 | again?] | ||
287 | |||
288 | mixcomwd.c -- MixCom Watchdog | ||
289 | |||
290 | [FIXME -- I'm unable to tell what the timeout is] | ||
291 | |||
292 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
293 | |||
294 | GETSUPPORT returns WDIOF_KEEPALIVEPING, GETSTATUS returns if | ||
295 | the device is opened or not [FIXME -- I'm not really sure how | ||
296 | this works, there seems to be some magic connected to | ||
297 | CONFIG_WATCHDOG_NOWAYOUT] | ||
298 | |||
299 | pcwd.c -- Berkshire PC Watchdog | ||
300 | |||
301 | Hardcoded timeout of 1.5 seconds | ||
302 | |||
303 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
304 | |||
305 | GETSUPPORT returns WDIOF_OVERHEAT|WDIOF_CARDRESET and both | ||
306 | GETSTATUS and GETBOOTSTATUS return something useful. | ||
307 | |||
308 | The SETOPTIONS call can be used to enable and disable the card | ||
309 | and to ask the driver to call panic if the system overheats. | ||
310 | |||
311 | sbc60xxwdt.c -- 60xx Single Board Computer | ||
312 | |||
313 | Hardcoded timeout of 10 seconds | ||
314 | |||
315 | Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic | ||
316 | character 'V' close handling. | ||
317 | |||
318 | No bits set in GETSUPPORT | ||
319 | |||
320 | scx200.c -- National SCx200 CPUs | ||
321 | |||
322 | Not in the kernel yet. | ||
323 | |||
324 | The timeout is set using a module parameter "margin" which | ||
325 | defaults to 60 seconds. The timeout can also be set using | ||
326 | SETTIMEOUT and read using GETTIMEOUT. | ||
327 | |||
328 | Supports a module parameter "nowayout" that is initialized | ||
329 | with the value of CONFIG_WATCHDOG_NOWAYOUT. Also supports the | ||
330 | magic character 'V' handling. | ||
331 | |||
332 | shwdt.c -- SuperH 3/4 processors | ||
333 | |||
334 | [FIXME -- I'm unable to tell what the timeout is] | ||
335 | |||
336 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
337 | |||
338 | GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call | ||
339 | returns if the device is open or not. [FIXME -- silliness | ||
340 | again?] | ||
341 | |||
342 | softdog.c -- Software watchdog | ||
343 | |||
344 | The timeout is set with the module parameter "soft_margin" | ||
345 | which defaults to 60 seconds, the timeout is also settable | ||
346 | using the SETTIMEOUT ioctl. | ||
347 | |||
348 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
349 | |||
350 | WDIOF_SETTIMEOUT bit set in GETSUPPORT | ||
351 | |||
352 | w83877f_wdt.c -- W83877F Computer | ||
353 | |||
354 | Hardcoded timeout of 30 seconds | ||
355 | |||
356 | Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic | ||
357 | character 'V' close handling. | ||
358 | |||
359 | No bits set in GETSUPPORT | ||
360 | |||
361 | w83627hf_wdt.c -- w83627hf watchdog | ||
362 | |||
363 | Timeout that defaults to 60 seconds, supports SETTIMEOUT. | ||
364 | |||
365 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
366 | |||
367 | GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT. | ||
368 | The GETSTATUS call returns if the device is open or not. | ||
369 | |||
370 | wdt.c -- ICS WDT500/501 ISA and | ||
371 | wdt_pci.c -- ICS WDT500/501 PCI | ||
372 | |||
373 | Default timeout of 60 seconds. The timeout is also settable | ||
374 | using the SETTIMEOUT ioctl. | ||
375 | |||
376 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
377 | |||
378 | GETSUPPORT returns with bits set depending on the actual | ||
379 | card. The WDT501 supports a lot of external monitoring, the | ||
380 | WDT500 much less. | ||
381 | |||
382 | wdt285.c -- Footbridge watchdog | ||
383 | |||
384 | The timeout is set with the module parameter "soft_margin" | ||
385 | which defaults to 60 seconds. The timeout is also settable | ||
386 | using the SETTIMEOUT ioctl. | ||
387 | |||
388 | Does not support CONFIG_WATCHDOG_NOWAYOUT | ||
389 | |||
390 | WDIOF_SETTIMEOUT bit set in GETSUPPORT | ||
391 | |||
392 | wdt977.c -- Netwinder W83977AF chip | ||
393 | |||
394 | Hardcoded timeout of 3 minutes | ||
395 | |||
396 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
397 | |||
398 | Does not support any ioctls at all. | ||
399 | |||
diff --git a/Documentation/watchdog/watchdog.txt b/Documentation/watchdog/watchdog.txt new file mode 100644 index 000000000000..dffda29c8799 --- /dev/null +++ b/Documentation/watchdog/watchdog.txt | |||
@@ -0,0 +1,115 @@ | |||
1 | Watchdog Timer Interfaces For The Linux Operating System | ||
2 | |||
3 | Alan Cox <alan@lxorguk.ukuu.org.uk> | ||
4 | |||
5 | Custom Linux Driver And Program Development | ||
6 | |||
7 | |||
8 | The following watchdog drivers are currently implemented: | ||
9 | |||
10 | ICS WDT501-P | ||
11 | ICS WDT501-P (no fan tachometer) | ||
12 | ICS WDT500-P | ||
13 | Software Only | ||
14 | SA1100 Internal Watchdog | ||
15 | Berkshire Products PC Watchdog Revision A & C (by Ken Hollis) | ||
16 | |||
17 | |||
18 | All six interfaces provide /dev/watchdog, which when open must be written | ||
19 | to within a timeout or the machine will reboot. Each write delays the reboot | ||
20 | time another timeout. In the case of the software watchdog the ability to | ||
21 | reboot will depend on the state of the machines and interrupts. The hardware | ||
22 | boards physically pull the machine down off their own onboard timers and | ||
23 | will reboot from almost anything. | ||
24 | |||
25 | A second temperature monitoring interface is available on the WDT501P cards | ||
26 | and some Berkshire cards. This provides /dev/temperature. This is the machine | ||
27 | internal temperature in degrees Fahrenheit. Each read returns a single byte | ||
28 | giving the temperature. | ||
29 | |||
30 | The third interface logs kernel messages on additional alert events. | ||
31 | |||
32 | Both software and hardware watchdog drivers are available in the standard | ||
33 | kernel. If you are using the software watchdog, you probably also want | ||
34 | to use "panic=60" as a boot argument as well. | ||
35 | |||
36 | The wdt card cannot be safely probed for. Instead you need to pass | ||
37 | wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11". | ||
38 | |||
39 | The SA1100 watchdog module can be configured with the "sa1100_margin" | ||
40 | commandline argument which specifies timeout value in seconds. | ||
41 | |||
42 | The i810 TCO watchdog modules can be configured with the "i810_margin" | ||
43 | commandline argument which specifies the counter initial value. The counter | ||
44 | is decremented every 0.6 seconds and default to 50 (30 seconds). Values can | ||
45 | range between 3 and 63. | ||
46 | |||
47 | The i810 TCO watchdog driver also implements the WDIOC_GETSTATUS and | ||
48 | WDIOC_GETBOOTSTATUS ioctl()s. WDIOC_GETSTATUS returns the actual counter value | ||
49 | and WDIOC_GETBOOTSTATUS returns the value of TCO2 Status Register (see Intel's | ||
50 | documentation for the 82801AA and 82801AB datasheet). | ||
51 | |||
52 | Features | ||
53 | -------- | ||
54 | WDT501P WDT500P Software Berkshire i810 TCO SA1100WD | ||
55 | Reboot Timer X X X X X X | ||
56 | External Reboot X X o o o X | ||
57 | I/O Port Monitor o o o X o o | ||
58 | Temperature X o o X o o | ||
59 | Fan Speed X o o o o o | ||
60 | Power Under X o o o o o | ||
61 | Power Over X o o o o o | ||
62 | Overheat X o o o o o | ||
63 | |||
64 | The external event interfaces on the WDT boards are not currently supported. | ||
65 | Minor numbers are however allocated for it. | ||
66 | |||
67 | |||
68 | Example Watchdog Driver | ||
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 | |||
91 | |||
92 | Contact Information | ||
93 | |||
94 | People keep asking about the WDT watchdog timer hardware: The phone contacts | ||
95 | for Industrial Computer Source are: | ||
96 | |||
97 | Industrial Computer Source | ||
98 | http://www.indcompsrc.com | ||
99 | ICS Advent, San Diego | ||
100 | 6260 Sequence Dr. | ||
101 | San Diego, CA 92121-4371 | ||
102 | Phone (858) 677-0877 | ||
103 | FAX: (858) 677-0895 | ||
104 | > | ||
105 | ICS Advent Europe, UK | ||
106 | Oving Road | ||
107 | Chichester, | ||
108 | West Sussex, | ||
109 | PO19 4ET, UK | ||
110 | Phone: 00.44.1243.533900 | ||
111 | |||
112 | |||
113 | and please mention Linux when enquiring. | ||
114 | |||
115 | For full information about the PCWD cards see the pcwd-watchdog.txt document. | ||