3 UEFI Miscellaneous boot Services SetWatchdogTimer service implementation
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #define WATCHDOG_TIMER_CALIBRATE_PER_SECOND 10000000
23 CoreSetWatchdogTimer (
25 IN UINT64 WatchdogCode
,
27 IN CHAR16
*WatchdogData OPTIONAL
33 Sets the system's watchdog timer.
37 Timeout The number of seconds. Zero disables the timer.
39 ///////following three parameters are left for platform specific using
41 WatchdogCode The numberic code to log. 0x0 to 0xffff are firmware
42 DataSize Size of the optional data
43 WatchdogData Optional Null terminated unicode string followed by binary
48 EFI_SUCCESS Timeout has been set
49 EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
50 EFI_UNSUPPORTED System does not have a timer (currently not used)
51 EFI_DEVICE_ERROR Could not complete due to hardware error
58 // Check our architectural protocol
60 if (gWatchdogTimer
== NULL
) {
61 return EFI_NOT_AVAILABLE_YET
;
65 // Attempt to set the timeout
67 Status
= gWatchdogTimer
->SetTimerPeriod (gWatchdogTimer
, MultU64x32 (Timeout
, WATCHDOG_TIMER_CALIBRATE_PER_SECOND
));
72 if (EFI_ERROR (Status
)) {
73 return EFI_DEVICE_ERROR
;