lgao4 | 504214c | 2008-04-09 07:07:50 +0000 | [diff] [blame] | 1 | /** @file
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 2 | The internal include file for WatchDogTimer module.
|
lgao4 | 504214c | 2008-04-09 07:07:50 +0000 | [diff] [blame] | 3 |
|
hhtian | e5eed7d | 2010-04-24 09:33:45 +0000 | [diff] [blame] | 4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
| 5 | This program and the accompanying materials
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 6 | are licensed and made available under the terms and conditions of the BSD License
|
| 7 | which accompanies this distribution. The full text of the license may be found at
|
| 8 | http://opensource.org/licenses/bsd-license.php
|
| 9 |
|
| 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 12 |
|
lgao4 | 504214c | 2008-04-09 07:07:50 +0000 | [diff] [blame] | 13 | **/
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 14 |
|
| 15 | #ifndef _WATCHDOG_TIMER_H_
|
| 16 | #define _WATCHDOG_TIMER_H_
|
| 17 |
|
AJFISH | ba23773 | 2007-07-03 18:34:24 +0000 | [diff] [blame] | 18 |
|
vanjeff | ed7748f | 2007-07-20 06:10:09 +0000 | [diff] [blame] | 19 |
|
lgao4 | 60c9367 | 2008-08-30 14:09:38 +0000 | [diff] [blame] | 20 | #include <Uefi.h>
|
AJFISH | ba23773 | 2007-07-03 18:34:24 +0000 | [diff] [blame] | 21 | #include <Library/DebugLib.h>
|
| 22 | #include <Library/UefiDriverEntryPoint.h>
|
| 23 | #include <Library/ReportStatusCodeLib.h>
|
| 24 | #include <Library/UefiBootServicesTableLib.h>
|
| 25 | #include <Library/UefiRuntimeServicesTableLib.h>
|
jljusten | c0d17d2 | 2008-02-20 01:26:35 +0000 | [diff] [blame] | 26 | #include <Protocol/WatchdogTimer.h>
|
AJFISH | ba23773 | 2007-07-03 18:34:24 +0000 | [diff] [blame] | 27 |
|
| 28 |
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 29 | /**
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 30 | Registers a handler that is to be invoked when the watchdog timer fires.
|
| 31 |
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 32 | This function registers a handler that is to be invoked when the watchdog
|
| 33 | timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the
|
| 34 | Runtime Service ResetSystem() when the watchdog timer fires. If a
|
| 35 | NotifyFunction is registered, then the NotifyFunction will be called before
|
| 36 | the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then
|
| 37 | the watchdog handler is unregistered. If a watchdog handler is registered,
|
| 38 | then EFI_SUCCESS is returned. If an attempt is made to register a handler
|
| 39 | when a handler is already registered, then EFI_ALREADY_STARTED is returned.
|
| 40 | If an attempt is made to uninstall a handler when a handler is not installed,
|
| 41 | then return EFI_INVALID_PARAMETER.
|
| 42 |
|
| 43 | @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
| 44 | @param NotifyFunction The function to call when the watchdog timer fires. If this
|
| 45 | is NULL, then the handler will be unregistered.
|
| 46 |
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 47 | @retval EFI_SUCCESS The watchdog timer handler was registered or unregistered.
|
| 48 | @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
|
| 49 | @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 50 |
|
| 51 | **/
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 52 | EFI_STATUS
|
| 53 | EFIAPI
|
| 54 | WatchdogTimerDriverRegisterHandler (
|
| 55 | IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
|
| 56 | IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
|
AJFISH | ba23773 | 2007-07-03 18:34:24 +0000 | [diff] [blame] | 57 | );
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 58 |
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 59 | /**
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 60 | Sets the amount of time in the future to fire the watchdog timer.
|
| 61 |
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 62 | This function sets the amount of time to wait before firing the watchdog
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 63 | timer to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 64 | timer is disabled.
|
| 65 |
|
| 66 | @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 67 | @param TimerPeriod The amount of time in 100 ns units to wait before the watchdog
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 68 | timer is fired. If TimerPeriod is zero, then the watchdog
|
| 69 | timer is disabled.
|
| 70 |
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 71 | @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
|
| 72 | 100 ns units.
|
| 73 | @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 74 | error.
|
| 75 |
|
| 76 | **/
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 77 | EFI_STATUS
|
| 78 | EFIAPI
|
| 79 | WatchdogTimerDriverSetTimerPeriod (
|
| 80 | IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
|
| 81 | IN UINT64 TimerPeriod
|
AJFISH | ba23773 | 2007-07-03 18:34:24 +0000 | [diff] [blame] | 82 | );
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 83 |
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 84 | /**
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 85 | Retrieves the amount of time in 100 ns units that the system will wait before firing the watchdog timer.
|
| 86 |
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 87 | This function retrieves the amount of time the system will wait before firing
|
| 88 | the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
|
| 89 | is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
|
| 90 |
|
| 91 | @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 92 | @param TimerPeriod A pointer to the amount of time in 100 ns units that the system
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 93 | will wait before the watchdog timer is fired. If TimerPeriod of
|
| 94 | zero is returned, then the watchdog timer is disabled.
|
| 95 |
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 96 | @retval EFI_SUCCESS The amount of time that the system will wait before
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 97 | firing the watchdog timer was returned in TimerPeriod.
|
xli24 | 96437c9 | 2008-11-17 04:33:19 +0000 | [diff] [blame] | 98 | @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
|
eric_tian | 36093af | 2008-07-11 06:49:09 +0000 | [diff] [blame] | 99 |
|
| 100 | **/
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 101 | EFI_STATUS
|
| 102 | EFIAPI
|
| 103 | WatchdogTimerDriverGetTimerPeriod (
|
| 104 | IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
|
| 105 | IN UINT64 *TimerPeriod
|
AJFISH | ba23773 | 2007-07-03 18:34:24 +0000 | [diff] [blame] | 106 | );
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 107 |
|
klu2 | de4c8a3 | 2007-06-28 08:36:46 +0000 | [diff] [blame] | 108 | #endif
|