ArmPkg/GenericWatchdogDxe: Set up the watchdog timeout relatively to the system counter

Use the system counter to compute the watchdog compare
value as the watchdog compare value is compared to the
system counter to check if the watchdog timeout expired or not.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16513 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ronald Cron 2014-12-12 19:10:58 +00:00 committed by oliviermartin
parent 0b4d97a0ea
commit 2366640023
1 changed files with 3 additions and 3 deletions

View File

@ -181,7 +181,7 @@ WatchdogSetTimerPeriod (
IN UINT64 TimerPeriod // In 100ns units
)
{
UINTN TimerVal;
UINTN SystemCount;
EFI_STATUS Status;
// if TimerPerdiod is 0, this is a request to stop the watchdog.
@ -210,8 +210,8 @@ WatchdogSetTimerPeriod (
return Status;
}
WatchdogEnable ();
TimerVal = ArmGenericTimerGetTimerVal ();
Status = WatchdogWriteCompareRegister (TimerVal + mNumTimerTicks);
SystemCount = ArmGenericTimerGetSystemCount ();
Status = WatchdogWriteCompareRegister (SystemCount + mNumTimerTicks);
} else {
Status = WatchdogWriteOffsetRegister ((UINT32)mNumTimerTicks);
WatchdogEnable ();