TianoCore EDK2 master
|
#include <PiDxe.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/ArmGenericTimerCounterLib.h>
#include <Protocol/HardwareInterrupt2.h>
#include <Protocol/WatchdogTimer.h>
#include "GenericWatchdog.h"
Go to the source code of this file.
Macros | |
#define | TIME_UNITS_PER_SECOND 10000000 |
#define | MAX_UINT48 0xFFFFFFFFFFFFULL |
Functions | |
STATIC UINT64 | GetMaxWatchdogOffsetRegisterValue (VOID) |
STATIC VOID | WatchdogWriteOffsetRegister (UINT64 Value) |
STATIC VOID | WatchdogWriteCompareRegister (UINT64 Value) |
STATIC VOID | WatchdogEnable (VOID) |
STATIC VOID | WatchdogDisable (VOID) |
STATIC VOID EFIAPI | WatchdogExitBootServicesEvent (IN EFI_EVENT Event, IN VOID *Context) |
STATIC VOID EFIAPI | WatchdogInterruptHandler (IN HARDWARE_INTERRUPT_SOURCE Source, IN EFI_SYSTEM_CONTEXT SystemContext) |
STATIC EFI_STATUS EFIAPI | WatchdogRegisterHandler (IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction) |
STATIC EFI_STATUS EFIAPI | WatchdogSetTimerPeriod (IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod) |
STATIC EFI_STATUS EFIAPI | WatchdogGetTimerPeriod (IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod) |
EFI_STATUS EFIAPI | GenericWatchdogEntry (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
Copyright (c) 2013-2018, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file GenericWatchdogDxe.c.
#define MAX_UINT48 0xFFFFFFFFFFFFULL |
Definition at line 39 of file GenericWatchdogDxe.c.
#define TIME_UNITS_PER_SECOND 10000000 |
Definition at line 29 of file GenericWatchdogDxe.c.
EFI_STATUS EFIAPI GenericWatchdogEntry | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Definition at line 355 of file GenericWatchdogDxe.c.
STATIC UINT64 GetMaxWatchdogOffsetRegisterValue | ( | VOID | ) |
This function returns the maximum watchdog offset register value.
MAX_UINT32 | The watchdog offset register holds a 32-bit value. |
MAX_UINT48 | The watchdog offset register holds a 48-bit value. |
Definition at line 53 of file GenericWatchdogDxe.c.
STATIC VOID WatchdogDisable | ( | VOID | ) |
Definition at line 106 of file GenericWatchdogDxe.c.
STATIC VOID WatchdogEnable | ( | VOID | ) |
Definition at line 97 of file GenericWatchdogDxe.c.
On exiting boot services we must make sure the Watchdog Timer is stopped.
Definition at line 119 of file GenericWatchdogDxe.c.
STATIC EFI_STATUS EFIAPI WatchdogGetTimerPeriod | ( | IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL * | This, |
OUT UINT64 * | TimerPeriod | ||
) |
This function retrieves the period of timer interrupts in 100ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled.
This | The EFI_TIMER_ARCH_PROTOCOL instance. |
TimerPeriod | A pointer to the timer period to retrieve in 100ns units. If 0 is returned, then the timer is currently disabled. |
EFI_SUCCESS | The timer period was returned in TimerPeriod. |
EFI_INVALID_PARAMETER | TimerPeriod is NULL. |
Definition at line 301 of file GenericWatchdogDxe.c.
STATIC VOID EFIAPI WatchdogInterruptHandler | ( | IN HARDWARE_INTERRUPT_SOURCE | Source, |
IN EFI_SYSTEM_CONTEXT | SystemContext | ||
) |
Definition at line 135 of file GenericWatchdogDxe.c.
STATIC EFI_STATUS EFIAPI WatchdogRegisterHandler | ( | IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL * | This, |
IN EFI_WATCHDOG_TIMER_NOTIFY | NotifyFunction | ||
) |
This function registers the handler NotifyFunction so it is called every time the watchdog timer expires. It also passes the amount of time since the last handler call to the NotifyFunction. If NotifyFunction is not NULL and a handler is not already registered, then the new handler is registered and EFI_SUCCESS is returned. If NotifyFunction is NULL, and a handler is already registered, then that handler is unregistered. 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 unregister a handler when a handler is not registered, then EFI_INVALID_PARAMETER is returned.
This | The EFI_TIMER_ARCH_PROTOCOL instance. |
NotifyFunction | The function to call when a timer interrupt fires. This function executes at TPL_HIGH_LEVEL. The DXE Core will register a handler for the timer interrupt, so it can know how much time has passed. This information is used to signal timer based events. NULL will unregister the handler. |
EFI_UNSUPPORTED | The code does not support NotifyFunction. |
Definition at line 194 of file GenericWatchdogDxe.c.
STATIC EFI_STATUS EFIAPI WatchdogSetTimerPeriod | ( | IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL * | This, |
IN UINT64 | TimerPeriod | ||
) |
This function sets the amount of time to wait before firing the watchdog timer to TimerPeriod 100ns units. If TimerPeriod is 0, then the watchdog timer is disabled.
This | The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance. |
TimerPeriod | The amount of time in 100ns units to wait before the watchdog timer is fired. If TimerPeriod is zero, then the watchdog timer is disabled. |
EFI_SUCCESS | The watchdog timer has been programmed to fire in TimerPeriod 100ns units. |
EFI_DEVICE_ERROR | Boot Services has been exited but TimerPeriod is not zero. |
Definition at line 230 of file GenericWatchdogDxe.c.
STATIC VOID WatchdogWriteCompareRegister | ( | UINT64 | Value | ) |
Definition at line 87 of file GenericWatchdogDxe.c.
STATIC VOID WatchdogWriteOffsetRegister | ( | UINT64 | Value | ) |
Definition at line 75 of file GenericWatchdogDxe.c.
Definition at line 43 of file GenericWatchdogDxe.c.
Definition at line 37 of file GenericWatchdogDxe.c.
STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL* mInterruptProtocol |
Definition at line 41 of file GenericWatchdogDxe.c.
STATIC UINT64 mTimerPeriod = 0 |
Definition at line 34 of file GenericWatchdogDxe.c.
STATIC EFI_WATCHDOG_TIMER_NOTIFY mWatchdogNotify |
Definition at line 42 of file GenericWatchdogDxe.c.
STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer |
Interface structure for the Watchdog Architectural Protocol.
RegisterHandler | Registers a handler that will be called each time the watchdogtimer interrupt fires. TimerPeriod defines the minimum time between timer interrupts, so TimerPeriod will also be the minimum time between calls to the registered handler. NOTE: If the watchdog resets the system in hardware, then this function will not have any chance of executing. |
SetTimerPeriod | Sets the period of the timer interrupt in 100ns units. This function is optional, and may return EFI_UNSUPPORTED. If this function is supported, then the timer period will be rounded up to the nearest supported timer period. |
GetTimerPeriod | Retrieves the period of the timer interrupt in 100ns units. |
Definition at line 347 of file GenericWatchdogDxe.c.