mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 08:34:07 +02:00
Code scrub for WatchdogTimer driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6555 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
636578d333
commit
96437c903c
@ -1,7 +1,5 @@
|
||||
/** @file
|
||||
|
||||
Generic watchdog timer services implemenetation using UEFI APIs and
|
||||
install watchdog timer architecture protocol.
|
||||
Implementation of Watchdog Timer Architectural Protocol using UEFI APIs.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -19,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Handle for the Watchdog Timer Architectural Protocol instance produced by this driver
|
||||
//
|
||||
EFI_HANDLE mWatchdogTimerHandle = NULL;
|
||||
EFI_HANDLE mWatchdogTimerHandle = NULL;
|
||||
|
||||
//
|
||||
// The Watchdog Timer Architectural Protocol instance produced by this driver
|
||||
@ -31,35 +29,35 @@ EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer = {
|
||||
};
|
||||
|
||||
//
|
||||
// The watchdog timer period in 100 nS units
|
||||
// The watchdog timer period in 100 ns units
|
||||
//
|
||||
UINT64 mWatchdogTimerPeriod = 0;
|
||||
UINT64 mWatchdogTimerPeriod = 0;
|
||||
|
||||
//
|
||||
// The notification function to call if the watchdig timer fires
|
||||
//
|
||||
EFI_WATCHDOG_TIMER_NOTIFY mWatchdogTimerNotifyFunction = NULL;
|
||||
EFI_WATCHDOG_TIMER_NOTIFY mWatchdogTimerNotifyFunction = NULL;
|
||||
|
||||
//
|
||||
// The one-shot timer event that is armed when the watchdog timer is enabled
|
||||
//
|
||||
EFI_EVENT mWatchdogTimerEvent;
|
||||
EFI_EVENT mWatchdogTimerEvent;
|
||||
|
||||
|
||||
/**
|
||||
Notification function that is called if the watchdog timer is fired. 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.
|
||||
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.
|
||||
|
||||
@param Timer The one-shot timer event that was signaled when the watchdog timer
|
||||
expired.
|
||||
@param Timer The one-shot timer event that was signaled when the
|
||||
watchdog timer expired.
|
||||
@param Context The context that was registered when the event Timer was created.
|
||||
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@ -84,6 +82,8 @@ WatchdogTimerDriverExpires (
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
@ -99,9 +99,9 @@ WatchdogTimerDriverExpires (
|
||||
@param NotifyFunction The function to call when the watchdog timer fires. If this
|
||||
is NULL, then the handler will be unregistered.
|
||||
|
||||
@return EFI_SUCCESS The watchdog timer handler was registered or unregistered.
|
||||
@return EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
|
||||
@return EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
|
||||
@retval EFI_SUCCESS The watchdog timer handler was registered or unregistered.
|
||||
@retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
|
||||
@retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -111,10 +111,17 @@ WatchdogTimerDriverRegisterHandler (
|
||||
IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
|
||||
)
|
||||
{
|
||||
//
|
||||
// If NotifyFunction is NULL, and a handler was not previously registered,
|
||||
// return EFI_INVALID_PARAMETER.
|
||||
//
|
||||
if (NotifyFunction == NULL && mWatchdogTimerNotifyFunction == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// If NotifyFunction is not NULL, and a handler is already registered,
|
||||
// return EFI_ALREADY_STARTED.
|
||||
//
|
||||
if (NotifyFunction != NULL && mWatchdogTimerNotifyFunction != NULL) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
@ -125,18 +132,20 @@ WatchdogTimerDriverRegisterHandler (
|
||||
}
|
||||
|
||||
/**
|
||||
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 to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog
|
||||
timer is disabled.
|
||||
|
||||
@param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
||||
@param TimerPeriod The amount of time in 100 nS units to wait before the watchdog
|
||||
@param TimerPeriod The 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 EFI_SUCCESS The watchdog timer has been programmed to fire in Time
|
||||
100 nS units.
|
||||
@return EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
|
||||
@retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
|
||||
100 ns units.
|
||||
@retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
|
||||
error.
|
||||
|
||||
**/
|
||||
@ -157,18 +166,20 @@ WatchdogTimerDriverSetTimerPeriod (
|
||||
}
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
||||
@param TimerPeriod A pointer to the amount of time in 100 nS units that the system
|
||||
@param TimerPeriod A 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 EFI_SUCCESS The amount of time that the system will wait before
|
||||
@retval EFI_SUCCESS The amount of time that the system will wait before
|
||||
firing the watchdog timer was returned in TimerPeriod.
|
||||
@return EFI_INVALID_PARAMETER TimerPeriod is NULL.
|
||||
@retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -188,12 +199,12 @@ WatchdogTimerDriverGetTimerPeriod (
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the Watchdog Timer Architectural Protocol driver.
|
||||
Entry point of the Watchdog Timer Architectural Protocol driver.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the System Table.
|
||||
@param ImageHandle The image handle of this driver.
|
||||
@param SystemTable The pointer of EFI_SYSTEM_TABLE.
|
||||
|
||||
@return EFI_SUCCESS Timer Architectural Protocol created.
|
||||
@retval EFI_SUCCESS Watchdog Timer Architectural Protocol successfully installed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -206,12 +217,12 @@ WatchdogTimerDriverInitialize (
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Make sure the Watchdog Timer Architectural Protocol is not already installed in the system
|
||||
// Make sure the Watchdog Timer Architectural Protocol has not been installed in the system yet.
|
||||
//
|
||||
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid);
|
||||
|
||||
//
|
||||
// Create the timer event used to implement a simple watchdog timer
|
||||
// Create the timer event to implement a simple watchdog timer
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
@ -233,5 +244,5 @@ WatchdogTimerDriverInitialize (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
/** @file
|
||||
|
||||
The internal header file includes the common header files, defines
|
||||
internal functions used by WatchDogTimer module.
|
||||
The internal include file for WatchDogTimer module.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -30,6 +28,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
@ -45,9 +45,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
@param NotifyFunction The function to call when the watchdog timer fires. If this
|
||||
is NULL, then the handler will be unregistered.
|
||||
|
||||
@return EFI_SUCCESS The watchdog timer handler was registered or unregistered.
|
||||
@return EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
|
||||
@return EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
|
||||
@retval EFI_SUCCESS The watchdog timer handler was registered or unregistered.
|
||||
@retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
|
||||
@retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -58,18 +58,20 @@ WatchdogTimerDriverRegisterHandler (
|
||||
);
|
||||
|
||||
/**
|
||||
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 to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog
|
||||
timer is disabled.
|
||||
|
||||
@param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
||||
@param TimerPeriod The amount of time in 100 nS units to wait before the watchdog
|
||||
@param TimerPeriod The 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 EFI_SUCCESS The watchdog timer has been programmed to fire in Time
|
||||
100 nS units.
|
||||
@return EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
|
||||
@retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
|
||||
100 ns units.
|
||||
@retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
|
||||
error.
|
||||
|
||||
**/
|
||||
@ -81,18 +83,20 @@ WatchdogTimerDriverSetTimerPeriod (
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
|
||||
@param TimerPeriod A pointer to the amount of time in 100 nS units that the system
|
||||
@param TimerPeriod A 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 EFI_SUCCESS The amount of time that the system will wait before
|
||||
@retval EFI_SUCCESS The amount of time that the system will wait before
|
||||
firing the watchdog timer was returned in TimerPeriod.
|
||||
@return EFI_INVALID_PARAMETER TimerPeriod is NULL.
|
||||
@retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -102,20 +106,4 @@ WatchdogTimerDriverGetTimerPeriod (
|
||||
IN UINT64 *TimerPeriod
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the Watchdog Timer Architectural Protocol driver.
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@param SystemTable Pointer to the System Table.
|
||||
|
||||
@return EFI_SUCCESS Timer Architectural Protocol created.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WatchdogTimerDriverInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,7 @@
|
||||
#/** @file
|
||||
# Component description file for WatchdogTimer module.
|
||||
# Generic watchdog timer driver produceing Watchdog Timer Architectural Protocol using UEFI APIs.
|
||||
#
|
||||
# Generic watchdog timer implemenetation using EFI APIs.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
Loading…
x
Reference in New Issue
Block a user