TianoCore EDK2 master
Loading...
Searching...
No Matches
WatchdogTimer.c File Reference
#include "WatchdogTimer.h"

Go to the source code of this file.

Functions

VOID EFIAPI WatchdogTimerDriverExpires (IN EFI_EVENT Timer, IN VOID *Context)
 
EFI_STATUS EFIAPI WatchdogTimerDriverRegisterHandler (IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction)
 
EFI_STATUS EFIAPI WatchdogTimerDriverSetTimerPeriod (IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod)
 
EFI_STATUS EFIAPI WatchdogTimerDriverGetTimerPeriod (IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 *TimerPeriod)
 
EFI_STATUS EFIAPI WatchdogTimerDriverInitialize (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_HANDLE mWatchdogTimerHandle = NULL
 
EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer
 
UINT64 mWatchdogTimerPeriod = 0
 
EFI_WATCHDOG_TIMER_NOTIFY mWatchdogTimerNotifyFunction = NULL
 
EFI_EVENT mWatchdogTimerEvent
 

Detailed Description

Implementation of Watchdog Timer Architectural Protocol using UEFI APIs.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file WatchdogTimer.c.

Function Documentation

◆ WatchdogTimerDriverExpires()

VOID EFIAPI WatchdogTimerDriverExpires ( IN EFI_EVENT  Timer,
IN VOID *  Context 
)

Notification function that is called if the watchdog timer is fired.

Notification function for the one-shot timer event that was signaled when the watchdog timer expired. If a handler has been registered with the Watchdog Timer Architectural Protocol, then that handler is called passing in the time period that has passed that cause the watchdog timer to fire. Then, a call to the Runtime Service ResetSystem() is made to reset the platform.

Parameters
TimerThe one-shot timer event that was signaled when the watchdog timer expired.
ContextThe context that was registered when the event Timer was created.

Definition at line 57 of file WatchdogTimer.c.

◆ WatchdogTimerDriverGetTimerPeriod()

EFI_STATUS EFIAPI WatchdogTimerDriverGetTimerPeriod ( IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL This,
IN UINT64 *  TimerPeriod 
)

Retrieves the amount of time in 100 ns units that the system will wait before firing the watchdog timer.

This function retrieves the amount of time the system will wait before firing the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.

Parameters
ThisThe EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
TimerPeriodA pointer to the amount of time in 100 ns units that the system will wait before the watchdog timer is fired. If TimerPeriod of zero is returned, then the watchdog timer is disabled.
Return values
EFI_SUCCESSThe amount of time that the system will wait before firing the watchdog timer was returned in TimerPeriod.
EFI_INVALID_PARAMETERTimerPeriod is NULL.

Definition at line 183 of file WatchdogTimer.c.

◆ WatchdogTimerDriverInitialize()

EFI_STATUS EFIAPI WatchdogTimerDriverInitialize ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Entry point of the Watchdog Timer Architectural Protocol driver.

Parameters
ImageHandleThe image handle of this driver.
SystemTableThe pointer of EFI_SYSTEM_TABLE.
Return values
EFI_SUCCESSWatchdog Timer Architectural Protocol successfully installed.

Definition at line 208 of file WatchdogTimer.c.

◆ WatchdogTimerDriverRegisterHandler()

EFI_STATUS EFIAPI WatchdogTimerDriverRegisterHandler ( IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL This,
IN EFI_WATCHDOG_TIMER_NOTIFY  NotifyFunction 
)

Registers a handler that is to be invoked when the watchdog timer fires.

This function registers a handler that is to be invoked when the watchdog timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the Runtime Service ResetSystem() when the watchdog timer fires. If a NotifyFunction is registered, then the NotifyFunction will be called before the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then the watchdog handler is unregistered. If a watchdog handler is registered, then EFI_SUCCESS is returned. If an attempt is made to register a handler when a handler is already registered, then EFI_ALREADY_STARTED is returned. If an attempt is made to uninstall a handler when a handler is not installed, then return EFI_INVALID_PARAMETER.

Parameters
ThisThe EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
NotifyFunctionThe function to call when the watchdog timer fires. If this is NULL, then the handler will be unregistered.
Return values
EFI_SUCCESSThe watchdog timer handler was registered or unregistered.
EFI_ALREADY_STARTEDNotifyFunction is not NULL, and a handler is already registered.
EFI_INVALID_PARAMETERNotifyFunction is NULL, and a handler was not previously registered.

Definition at line 104 of file WatchdogTimer.c.

◆ WatchdogTimerDriverSetTimerPeriod()

EFI_STATUS EFIAPI WatchdogTimerDriverSetTimerPeriod ( IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL This,
IN UINT64  TimerPeriod 
)

Sets the amount of time in the future to fire the watchdog timer.

This function sets the amount of time to wait before firing the watchdog timer to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog timer is disabled.

Parameters
ThisThe EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
TimerPeriodThe amount of time in 100 ns units to wait before the watchdog timer is fired. If TimerPeriod is zero, then the watchdog timer is disabled.
Return values
EFI_SUCCESSThe watchdog timer has been programmed to fire in Time 100 ns units.
EFI_DEVICE_ERRORA watchdog timer could not be programmed due to a device error.

Definition at line 150 of file WatchdogTimer.c.

Variable Documentation

◆ mWatchdogTimer

Initial value:
= {
}
EFI_STATUS EFIAPI WatchdogTimerDriverSetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod)
EFI_STATUS EFIAPI WatchdogTimerDriverRegisterHandler(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction)
EFI_STATUS EFIAPI WatchdogTimerDriverGetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 *TimerPeriod)

Definition at line 19 of file WatchdogTimer.c.

◆ mWatchdogTimerEvent

EFI_EVENT mWatchdogTimerEvent

Definition at line 38 of file WatchdogTimer.c.

◆ mWatchdogTimerHandle

EFI_HANDLE mWatchdogTimerHandle = NULL

Definition at line 14 of file WatchdogTimer.c.

◆ mWatchdogTimerNotifyFunction

EFI_WATCHDOG_TIMER_NOTIFY mWatchdogTimerNotifyFunction = NULL

Definition at line 33 of file WatchdogTimer.c.

◆ mWatchdogTimerPeriod

UINT64 mWatchdogTimerPeriod = 0

Definition at line 28 of file WatchdogTimer.c.