]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/WatchdogTimer.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / WatchdogTimer.h
CommitLineData
d1f95000 1/** @file\r
0f82bd55 2 Watchdog Timer Architectural Protocol as defined in PI Specification VOLUME 2 DXE\r
d1f95000 3\r
4 Used to provide system watchdog timer services\r
5\r
9095d37b 6 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 8**/\r
9\r
10#ifndef __ARCH_PROTOCOL_WATCHDOG_TIMER_H__\r
11#define __ARCH_PROTOCOL_WATCHDOG_TIMER_H__\r
12\r
99e8ed21 13///\r
14/// Global ID for the Watchdog Timer Architectural Protocol\r
15///\r
d1f95000 16#define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \\r
17 { 0x665E3FF5, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }\r
18\r
99e8ed21 19///\r
20/// Declare forward reference for the Timer Architectural Protocol\r
21///\r
d1f95000 22typedef struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL EFI_WATCHDOG_TIMER_ARCH_PROTOCOL;\r
23\r
24/**\r
9095d37b 25 A function of this type is called when the watchdog timer fires if a\r
d1f95000 26 handler has been registered.\r
27\r
28 @param Time The time in 100 ns units that has passed since the watchdog\r
29 timer was armed. For the notify function to be called, this\r
30 must be greater than TimerPeriod.\r
31\r
32 @return None.\r
33\r
34**/\r
35typedef\r
36VOID\r
8b13229b 37(EFIAPI *EFI_WATCHDOG_TIMER_NOTIFY)(\r
d1f95000 38 IN UINT64 Time\r
39 );\r
40\r
41/**\r
9095d37b
LG
42 This function registers a handler that is to be invoked when the watchdog\r
43 timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the\r
44 Runtime Service ResetSystem() when the watchdog timer fires. If a\r
45 NotifyFunction is registered, then the NotifyFunction will be called before\r
46 the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then\r
47 the watchdog handler is unregistered. If a watchdog handler is registered,\r
48 then EFI_SUCCESS is returned. If an attempt is made to register a handler\r
49 when a handler is already registered, then EFI_ALREADY_STARTED is returned.\r
50 If an attempt is made to uninstall a handler when a handler is not installed,\r
d1f95000 51 then return EFI_INVALID_PARAMETER.\r
52\r
53 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
54 @param NotifyFunction The function to call when the watchdog timer fires. If this\r
55 is NULL, then the handler will be unregistered.\r
56\r
57 @retval EFI_SUCCESS The watchdog timer handler was registered or\r
58 unregistered.\r
59 @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already\r
60 registered.\r
61 @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not\r
62 previously registered.\r
63\r
64**/\r
9095d37b 65typedef\r
d1f95000 66EFI_STATUS\r
8b13229b 67(EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER)(\r
d1f95000 68 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,\r
69 IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction\r
70 );\r
71\r
72/**\r
9095d37b
LG
73 This function sets the amount of time to wait before firing the watchdog\r
74 timer to TimerPeriod 100 nS units. If TimerPeriod is 0, then the watchdog\r
d1f95000 75 timer is disabled.\r
76\r
77 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
78 @param TimerPeriod The amount of time in 100 nS units to wait before the watchdog\r
79 timer is fired. If TimerPeriod is zero, then the watchdog\r
80 timer is disabled.\r
81\r
82 @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time\r
83 100 nS units.\r
84 @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device\r
85 error.\r
86\r
87**/\r
9095d37b 88typedef\r
d1f95000 89EFI_STATUS\r
8b13229b 90(EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD)(\r
d1f95000 91 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,\r
92 IN UINT64 TimerPeriod\r
93 );\r
94\r
95/**\r
9095d37b
LG
96 This function retrieves the amount of time the system will wait before firing\r
97 the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS\r
d1f95000 98 is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.\r
99\r
100 @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
101 @param TimerPeriod A pointer to the amount of time in 100 nS units that the system\r
102 will wait before the watchdog timer is fired. If TimerPeriod of\r
103 zero is returned, then the watchdog timer is disabled.\r
104\r
f754f721 105 @retval EFI_SUCCESS The amount of time that the system will wait before\r
106 firing the watchdog timer was returned in TimerPeriod.\r
d1f95000 107 @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.\r
108\r
109**/\r
9095d37b 110typedef\r
d1f95000 111EFI_STATUS\r
8b13229b 112(EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD)(\r
d1f95000 113 IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,\r
114 OUT UINT64 *TimerPeriod\r
115 );\r
116\r
117\r
44717a39 118///\r
9095d37b
LG
119/// This protocol provides the services required to implement the Boot Service\r
120/// SetWatchdogTimer(). It provides a service to set the amount of time to wait\r
121/// before firing the watchdog timer, and it also provides a service to register\r
122/// a handler that is invoked when the watchdog timer fires. This protocol can\r
123/// implement the watchdog timer by using the event and timer Boot Services, or\r
124/// it can make use of custom hardware. When the watchdog timer fires, control\r
125/// will be passed to a handler if one has been registered. If no handler has\r
126/// been registered, or the registered handler returns, then the system will be\r
44717a39 127/// reset by calling the Runtime Service ResetSystem().\r
128///\r
d1f95000 129struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL {\r
130 EFI_WATCHDOG_TIMER_REGISTER_HANDLER RegisterHandler;\r
131 EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD SetTimerPeriod;\r
132 EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD GetTimerPeriod;\r
133};\r
134\r
135extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid;\r
136\r
137#endif\r
138\r