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