]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/WatchdogTimer.h
Import Pal.h and Sal.h.
[mirror_edk2.git] / MdePkg / Include / Protocol / WatchdogTimer.h
1 /** @file
2 Watchdog Timer Architectural Protocol as defined in the DXE CIS
3
4 Used to provide system watchdog timer services
5
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 Module Name: WatchdogTimer.h
16
17 @par Revision Reference:
18 Version 0.91B.
19
20 **/
21
22 #ifndef __ARCH_PROTOCOL_WATCHDOG_TIMER_H__
23 #define __ARCH_PROTOCOL_WATCHDOG_TIMER_H__
24
25 //
26 // Global ID for the Watchdog Timer Architectural Protocol
27 //
28 #define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \
29 { 0x665E3FF5, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }
30
31 //
32 // Declare forward reference for the Timer Architectural Protocol
33 //
34 typedef struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL EFI_WATCHDOG_TIMER_ARCH_PROTOCOL;
35
36 /**
37 A function of this type is called when the watchdog timer fires if a
38 handler has been registered.
39
40 @param Time The time in 100 ns units that has passed since the watchdog
41 timer was armed. For the notify function to be called, this
42 must be greater than TimerPeriod.
43
44 @return None.
45
46 **/
47 typedef
48 VOID
49 (EFIAPI *EFI_WATCHDOG_TIMER_NOTIFY) (
50 IN UINT64 Time
51 );
52
53 /**
54 This function registers a handler that is to be invoked when the watchdog
55 timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the
56 Runtime Service ResetSystem() when the watchdog timer fires. If a
57 NotifyFunction is registered, then the NotifyFunction will be called before
58 the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then
59 the watchdog handler is unregistered. If a watchdog handler is registered,
60 then EFI_SUCCESS is returned. If an attempt is made to register a handler
61 when a handler is already registered, then EFI_ALREADY_STARTED is returned.
62 If an attempt is made to uninstall a handler when a handler is not installed,
63 then return EFI_INVALID_PARAMETER.
64
65 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
66 @param NotifyFunction The function to call when the watchdog timer fires. If this
67 is NULL, then the handler will be unregistered.
68
69 @retval EFI_SUCCESS The watchdog timer handler was registered or
70 unregistered.
71 @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
72 registered.
73 @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
74 previously registered.
75
76 **/
77 typedef
78 EFI_STATUS
79 (EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER) (
80 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
81 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
82 );
83
84 /**
85 This function sets the amount of time to wait before firing the watchdog
86 timer to TimerPeriod 100 nS units. If TimerPeriod is 0, then the watchdog
87 timer is disabled.
88
89 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
90 @param TimerPeriod The amount of time in 100 nS units to wait before the watchdog
91 timer is fired. If TimerPeriod is zero, then the watchdog
92 timer is disabled.
93
94 @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
95 100 nS units.
96 @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
97 error.
98
99 **/
100 typedef
101 EFI_STATUS
102 (EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) (
103 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
104 IN UINT64 TimerPeriod
105 );
106
107 /**
108 This function retrieves the amount of time the system will wait before firing
109 the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
110 is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
111
112 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
113 @param TimerPeriod A pointer to the amount of time in 100 nS units that the system
114 will wait before the watchdog timer is fired. If TimerPeriod of
115 zero is returned, then the watchdog timer is disabled.
116
117 @retval EFI_SUCCESS The amount of time that the system will wait before
118 firing the watchdog timer was returned in TimerPeriod.
119 @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
120
121 **/
122 typedef
123 EFI_STATUS
124 (EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) (
125 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
126 OUT UINT64 *TimerPeriod
127 );
128
129
130 /**
131 Interface stucture for the Watchdog Timer Architectural Protocol.
132
133 @par Protocol Description:
134 This protocol provides the services required to implement the Boot Service
135 SetWatchdogTimer(). It provides a service to set the amount of time to wait
136 before firing the watchdog timer, and it also provides a service to register
137 a handler that is invoked when the watchdog timer fires. This protocol can
138 implement the watchdog timer by using the event and timer Boot Services, or
139 it can make use of custom hardware. When the watchdog timer fires, control
140 will be passed to a handler if one has been registered. If no handler has
141 been registered, or the registered handler returns, then the system will be
142 reset by calling the Runtime Service ResetSystem().
143
144 @param RegisterHandler Registers a handler that is invoked when the watchdog
145 timer fires.
146
147 @param SetTimerPeriod Sets the amount of time in 100 ns units to wait before the
148 watchdog timer is fired. If this function is supported,
149 then the watchdog timer period will be rounded up to the
150 nearest supported watchdog timer period.
151
152 @param GetTimerPeriod Retrieves the amount of time in 100 ns units that the
153 system will wait before the watchdog timer is fired.
154
155 **/
156 struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL {
157 EFI_WATCHDOG_TIMER_REGISTER_HANDLER RegisterHandler;
158 EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD SetTimerPeriod;
159 EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD GetTimerPeriod;
160 };
161
162 extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid;
163
164 #endif
165