]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/TianoTools/Include/Dxe/ArchProtocol/WatchdogTimer.h
Remove the dependence to MdePkg
[mirror_edk2.git] / Tools / Source / TianoTools / Include / Dxe / ArchProtocol / 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
67 @param NotifyFunction The function to call when the watchdog timer fires. If this
68 is NULL, then the handler will be unregistered.
69
70 @retval EFI_SUCCESS The watchdog timer handler was registered or
71 unregistered.
72
73 @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
74 registered.
75
76 @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
77 previously registered.
78
79 **/
80 typedef
81 EFI_STATUS
82 (EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER) (
83 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
84 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
85 );
86
87 /**
88 This function sets the amount of time to wait before firing the watchdog
89 timer to TimerPeriod 100 nS units. If TimerPeriod is 0, then the watchdog
90 timer is disabled.
91
92 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
93
94 @param TimerPeriod The amount of time in 100 nS units to wait before the watchdog
95 timer is fired. If TimerPeriod is zero, then the watchdog
96 timer is disabled.
97
98 @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
99 100 nS units.
100
101 @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
102 error.
103
104 **/
105 typedef
106 EFI_STATUS
107 (EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) (
108 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
109 IN UINT64 TimerPeriod
110 );
111
112 /**
113 This function retrieves the amount of time the system will wait before firing
114 the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
115 is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
116
117 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
118
119 @param TimerPeriod A pointer to the amount of time in 100 nS units that the system
120 will wait before the watchdog timer is fired. If TimerPeriod of
121 zero is returned, then the watchdog timer is disabled.
122
123 @retval EFI_SUCCESS The amount of time that the system will wait before
124 firing the watchdog timer was returned in TimerPeriod.
125
126 @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
127
128 **/
129 typedef
130 EFI_STATUS
131 (EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) (
132 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
133 OUT UINT64 *TimerPeriod
134 );
135
136
137 /**
138 Interface stucture for the Watchdog Timer Architectural Protocol.
139
140 @par Protocol Description:
141 This protocol provides the services required to implement the Boot Service
142 SetWatchdogTimer(). It provides a service to set the amount of time to wait
143 before firing the watchdog timer, and it also provides a service to register
144 a handler that is invoked when the watchdog timer fires. This protocol can
145 implement the watchdog timer by using the event and timer Boot Services, or
146 it can make use of custom hardware. When the watchdog timer fires, control
147 will be passed to a handler if one has been registered. If no handler has
148 been registered, or the registered handler returns, then the system will be
149 reset by calling the Runtime Service ResetSystem().
150
151 @param RegisterHandler - Registers a handler that is invoked when the watchdog
152 timer fires.
153
154 @param SetTimerPeriod - Sets the amount of time in 100 ns units to wait before the
155 watchdog timer is fired. If this function is supported,
156 then the watchdog timer period will be rounded up to the
157 nearest supported watchdog timer period.
158
159 @param GetTimerPeriod - Retrieves the amount of time in 100 ns units that the
160 system will wait before the watchdog timer is fired.
161
162 **/
163 struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL {
164 EFI_WATCHDOG_TIMER_REGISTER_HANDLER RegisterHandler;
165 EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD SetTimerPeriod;
166 EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD GetTimerPeriod;
167 };
168
169 extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid;
170
171 #endif
172