]>
Commit | Line | Data |
---|---|---|
504214c4 LG |
1 | /** @file \r |
2 | \r | |
3 | UEFI Miscellaneous boot Services SetWatchdogTimer service implementation\r | |
28a00297 | 4 | \r |
504214c4 | 5 | Copyright (c) 2006 - 2008, Intel Corporation \r |
28a00297 | 6 | All rights reserved. This program and the accompanying materials \r |
7 | are licensed and made available under the terms and conditions of the BSD License \r | |
8 | which accompanies this distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php \r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
13 | \r | |
504214c4 | 14 | **/\r |
28a00297 | 15 | \r |
16 | #include <DxeMain.h>\r | |
17 | \r | |
18 | #define WATCHDOG_TIMER_CALIBRATE_PER_SECOND 10000000\r | |
19 | \r | |
162ed594 | 20 | /**\r |
21 | Sets the system's watchdog timer.\r | |
22 | \r | |
23 | @param Timeout The number of seconds to set the watchdog timer to.\r | |
24 | A value of zero disables the timer.\r | |
25 | @param WatchdogCode The numeric code to log on a watchdog timer timeout\r | |
26 | event. The firmware reserves codes 0x0000 to 0xFFFF.\r | |
27 | Loaders and operating systems may use other timeout\r | |
28 | codes.\r | |
29 | @param DataSize The size, in bytes, of WatchdogData.\r | |
30 | @param WatchdogData A data buffer that includes a Null-terminated Unicode\r | |
31 | string, optionally followed by additional binary data.\r | |
32 | The string is a description that the call may use to\r | |
33 | further indicate the reason to be logged with a\r | |
34 | watchdog event.\r | |
35 | \r | |
36 | @return EFI_SUCCESS Timeout has been set\r | |
37 | @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet\r | |
38 | @return EFI_UNSUPPORTED System does not have a timer (currently not used)\r | |
39 | @return EFI_DEVICE_ERROR Could not complete due to hardware error\r | |
28a00297 | 40 | \r |
162ed594 | 41 | **/\r |
28a00297 | 42 | EFI_STATUS\r |
43 | EFIAPI\r | |
44 | CoreSetWatchdogTimer (\r | |
45 | IN UINTN Timeout,\r | |
46 | IN UINT64 WatchdogCode,\r | |
47 | IN UINTN DataSize,\r | |
48 | IN CHAR16 *WatchdogData OPTIONAL\r | |
49 | )\r | |
28a00297 | 50 | {\r |
51 | EFI_STATUS Status;\r | |
52 | \r | |
53 | //\r | |
54 | // Check our architectural protocol\r | |
55 | //\r | |
56 | if (gWatchdogTimer == NULL) {\r | |
57 | return EFI_NOT_AVAILABLE_YET;\r | |
58 | }\r | |
59 | \r | |
60 | //\r | |
61 | // Attempt to set the timeout\r | |
62 | //\r | |
63 | Status = gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, MultU64x32 (Timeout, WATCHDOG_TIMER_CALIBRATE_PER_SECOND));\r | |
64 | \r | |
65 | //\r | |
66 | // Check for errors\r | |
67 | //\r | |
68 | if (EFI_ERROR (Status)) {\r | |
69 | return EFI_DEVICE_ERROR;\r | |
70 | }\r | |
71 | \r | |
72 | return EFI_SUCCESS;\r | |
73 | }\r |