summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTuan Phan <tphan@ventanamicro.com>2023-06-27 18:15:57 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-07-02 10:33:11 +0000
commitad7d3ace1ad4d7350d1e1304fab86dffd0f3fd11 (patch)
treed1c259a6be89674a7da5298a6ce2fbe52721ce69
parent5a13f5c2fa5ada2eb2fcb961aa3745fd236620bd (diff)
downloadedk2-ad7d3ace1ad4d7350d1e1304fab86dffd0f3fd11.tar.gz
edk2-ad7d3ace1ad4d7350d1e1304fab86dffd0f3fd11.tar.bz2
edk2-ad7d3ace1ad4d7350d1e1304fab86dffd0f3fd11.zip
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 <tphan@ventanamicro.com>
-rw-r--r--UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c8
1 files changed, 7 insertions, 1 deletions
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 <Library/BaseLib.h>
#include <Library/BaseRiscVSbiLib.h>
+#include <Library/UefiLib.h>
#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) {