]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / WatchdogTimerDxe / WatchdogTimer.h
1 /** @file
2 The internal include file for WatchDogTimer module.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _WATCHDOG_TIMER_H_
10 #define _WATCHDOG_TIMER_H_
11
12
13
14 #include <Uefi.h>
15 #include <Library/DebugLib.h>
16 #include <Library/UefiDriverEntryPoint.h>
17 #include <Library/ReportStatusCodeLib.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 #include <Library/UefiRuntimeServicesTableLib.h>
20 #include <Protocol/WatchdogTimer.h>
21
22
23 /**
24 Registers a handler that is to be invoked when the watchdog timer fires.
25
26 This function registers a handler that is to be invoked when the watchdog
27 timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the
28 Runtime Service ResetSystem() when the watchdog timer fires. If a
29 NotifyFunction is registered, then the NotifyFunction will be called before
30 the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then
31 the watchdog handler is unregistered. If a watchdog handler is registered,
32 then EFI_SUCCESS is returned. If an attempt is made to register a handler
33 when a handler is already registered, then EFI_ALREADY_STARTED is returned.
34 If an attempt is made to uninstall a handler when a handler is not installed,
35 then return EFI_INVALID_PARAMETER.
36
37 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
38 @param NotifyFunction The function to call when the watchdog timer fires. If this
39 is NULL, then the handler will be unregistered.
40
41 @retval EFI_SUCCESS The watchdog timer handler was registered or unregistered.
42 @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
43 @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
44
45 **/
46 EFI_STATUS
47 EFIAPI
48 WatchdogTimerDriverRegisterHandler (
49 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
50 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
51 );
52
53 /**
54 Sets the amount of time in the future to fire the watchdog timer.
55
56 This function sets the amount of time to wait before firing the watchdog
57 timer to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog
58 timer is disabled.
59
60 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
61 @param TimerPeriod The amount of time in 100 ns units to wait before the watchdog
62 timer is fired. If TimerPeriod is zero, then the watchdog
63 timer is disabled.
64
65 @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
66 100 ns units.
67 @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
68 error.
69
70 **/
71 EFI_STATUS
72 EFIAPI
73 WatchdogTimerDriverSetTimerPeriod (
74 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
75 IN UINT64 TimerPeriod
76 );
77
78 /**
79 Retrieves the amount of time in 100 ns units that the system will wait before firing the watchdog timer.
80
81 This function retrieves the amount of time the system will wait before firing
82 the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
83 is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
84
85 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
86 @param TimerPeriod A pointer to the amount of time in 100 ns units that the system
87 will wait before the watchdog timer is fired. If TimerPeriod of
88 zero is returned, then the watchdog timer is disabled.
89
90 @retval EFI_SUCCESS The amount of time that the system will wait before
91 firing the watchdog timer was returned in TimerPeriod.
92 @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
93
94 **/
95 EFI_STATUS
96 EFIAPI
97 WatchdogTimerDriverGetTimerPeriod (
98 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
99 IN UINT64 *TimerPeriod
100 );
101
102 #endif