]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/WatchdogTimer.h
Code Scrub for Protocol and Ppi Definition
[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 - 2008, 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 @par Revision Reference:
16 Version 0.91B.
17
18 **/
19
20 #ifndef __ARCH_PROTOCOL_WATCHDOG_TIMER_H__
21 #define __ARCH_PROTOCOL_WATCHDOG_TIMER_H__
22
23 //
24 // Global ID for the Watchdog Timer Architectural Protocol
25 //
26 #define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \
27 { 0x665E3FF5, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }
28
29 //
30 // Declare forward reference for the Timer Architectural Protocol
31 //
32 typedef struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL EFI_WATCHDOG_TIMER_ARCH_PROTOCOL;
33
34 /**
35 A function of this type is called when the watchdog timer fires if a
36 handler has been registered.
37
38 @param Time The time in 100 ns units that has passed since the watchdog
39 timer was armed. For the notify function to be called, this
40 must be greater than TimerPeriod.
41
42 @return None.
43
44 **/
45 typedef
46 VOID
47 (EFIAPI *EFI_WATCHDOG_TIMER_NOTIFY)(
48 IN UINT64 Time
49 );
50
51 /**
52 This function registers a handler that is to be invoked when the watchdog
53 timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the
54 Runtime Service ResetSystem() when the watchdog timer fires. If a
55 NotifyFunction is registered, then the NotifyFunction will be called before
56 the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then
57 the watchdog handler is unregistered. If a watchdog handler is registered,
58 then EFI_SUCCESS is returned. If an attempt is made to register a handler
59 when a handler is already registered, then EFI_ALREADY_STARTED is returned.
60 If an attempt is made to uninstall a handler when a handler is not installed,
61 then return EFI_INVALID_PARAMETER.
62
63 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
64 @param NotifyFunction The function to call when the watchdog timer fires. If this
65 is NULL, then the handler will be unregistered.
66
67 @retval EFI_SUCCESS The watchdog timer handler was registered or
68 unregistered.
69 @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
70 registered.
71 @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
72 previously registered.
73
74 **/
75 typedef
76 EFI_STATUS
77 (EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER)(
78 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
79 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
80 );
81
82 /**
83 This function sets the amount of time to wait before firing the watchdog
84 timer to TimerPeriod 100 nS units. If TimerPeriod is 0, then the watchdog
85 timer is disabled.
86
87 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
88 @param TimerPeriod The amount of time in 100 nS units to wait before the watchdog
89 timer is fired. If TimerPeriod is zero, then the watchdog
90 timer is disabled.
91
92 @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
93 100 nS units.
94 @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
95 error.
96
97 **/
98 typedef
99 EFI_STATUS
100 (EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD)(
101 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
102 IN UINT64 TimerPeriod
103 );
104
105 /**
106 This function retrieves the amount of time the system will wait before firing
107 the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
108 is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
109
110 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
111 @param TimerPeriod A pointer to the amount of time in 100 nS units that the system
112 will wait before the watchdog timer is fired. If TimerPeriod of
113 zero is returned, then the watchdog timer is disabled.
114
115 @retval EFI_SUCCESS The amount of time that the system will wait before
116 firing the watchdog timer was returned in TimerPeriod.
117 @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
118
119 **/
120 typedef
121 EFI_STATUS
122 (EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD)(
123 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
124 OUT UINT64 *TimerPeriod
125 );
126
127
128 /**
129 Interface stucture for the Watchdog Timer Architectural Protocol.
130
131 @par Protocol Description:
132 This protocol provides the services required to implement the Boot Service
133 SetWatchdogTimer(). It provides a service to set the amount of time to wait
134 before firing the watchdog timer, and it also provides a service to register
135 a handler that is invoked when the watchdog timer fires. This protocol can
136 implement the watchdog timer by using the event and timer Boot Services, or
137 it can make use of custom hardware. When the watchdog timer fires, control
138 will be passed to a handler if one has been registered. If no handler has
139 been registered, or the registered handler returns, then the system will be
140 reset by calling the Runtime Service ResetSystem().
141
142 @param RegisterHandler Registers a handler that is invoked when the watchdog
143 timer fires.
144
145 @param SetTimerPeriod Sets the amount of time in 100 ns units to wait before the
146 watchdog timer is fired. If this function is supported,
147 then the watchdog timer period will be rounded up to the
148 nearest supported watchdog timer period.
149
150 @param GetTimerPeriod Retrieves the amount of time in 100 ns units that the
151 system will wait before the watchdog timer is fired.
152
153 **/
154 struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL {
155 EFI_WATCHDOG_TIMER_REGISTER_HANDLER RegisterHandler;
156 EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD SetTimerPeriod;
157 EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD GetTimerPeriod;
158 };
159
160 extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid;
161
162 #endif
163