]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c
Add comments and DoxyGen format for these files.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Misc / SetWatchdogTimer.c
1 /** @file
2
3 UEFI Miscellaneous boot Services SetWatchdogTimer service implementation
4
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
10
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.
13
14 **/
15
16 #include <DxeMain.h>
17
18 #define WATCHDOG_TIMER_CALIBRATE_PER_SECOND 10000000
19
20
21 EFI_STATUS
22 EFIAPI
23 CoreSetWatchdogTimer (
24 IN UINTN Timeout,
25 IN UINT64 WatchdogCode,
26 IN UINTN DataSize,
27 IN CHAR16 *WatchdogData OPTIONAL
28 )
29 /*++
30
31 Routine Description:
32
33 Sets the system's watchdog timer.
34
35 Arguments:
36
37 Timeout The number of seconds. Zero disables the timer.
38
39 ///////following three parameters are left for platform specific using
40
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
44 data.
45
46 Returns:
47
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
52
53 --*/
54 {
55 EFI_STATUS Status;
56
57 //
58 // Check our architectural protocol
59 //
60 if (gWatchdogTimer == NULL) {
61 return EFI_NOT_AVAILABLE_YET;
62 }
63
64 //
65 // Attempt to set the timeout
66 //
67 Status = gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, MultU64x32 (Timeout, WATCHDOG_TIMER_CALIBRATE_PER_SECOND));
68
69 //
70 // Check for errors
71 //
72 if (EFI_ERROR (Status)) {
73 return EFI_DEVICE_ERROR;
74 }
75
76 return EFI_SUCCESS;
77 }