From ad7d3ace1ad4d7350d1e1304fab86dffd0f3fd11 Mon Sep 17 00:00:00 2001 From: Tuan Phan Date: Tue, 27 Jun 2023 18:15:57 -0700 Subject: [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly The timer notify function should be called with timer period, not the value read from timer register. Signed-off-by: Tuan Phan --- UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c b/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c index 358057e7c6..30e48061cd 100644 --- a/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c +++ b/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c @@ -9,6 +9,7 @@ #include #include +#include #include "Timer.h" // @@ -71,7 +72,12 @@ TimerInterruptHandler ( // time to increment slower. So when we take an interrupt, // account for the actual time passed. // - mTimerNotifyFunction (PeriodStart - mLastPeriodStart); + mTimerNotifyFunction ( + DivU64x32 ( + EFI_TIMER_PERIOD_SECONDS (PeriodStart - mLastPeriodStart), + PcdGet64 (PcdCpuCoreCrystalClockFrequency) + ) + ); } if (mTimerPeriod == 0) {