public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
@ 2023-06-28  1:15 Tuan Phan
  2023-06-28 14:43 ` Sunil V L
  0 siblings, 1 reply; 3+ messages in thread
From: Tuan Phan @ 2023-06-28  1:15 UTC (permalink / raw)
  To: devel; +Cc: sunilvl, andrei.warkentin, Tuan Phan

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>
---
 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 358057e7c6a4..30e48061cd06 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) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
  2023-06-28  1:15 [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly Tuan Phan
@ 2023-06-28 14:43 ` Sunil V L
  2023-06-28 21:06   ` Tuan Phan
  0 siblings, 1 reply; 3+ messages in thread
From: Sunil V L @ 2023-06-28 14:43 UTC (permalink / raw)
  To: Tuan Phan; +Cc: devel, andrei.warkentin

On Tue, Jun 27, 2023 at 06:15:57PM -0700, Tuan Phan wrote:
> 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>
> ---

LGTM.

Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks!
Sunil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
  2023-06-28 14:43 ` Sunil V L
@ 2023-06-28 21:06   ` Tuan Phan
  0 siblings, 0 replies; 3+ messages in thread
From: Tuan Phan @ 2023-06-28 21:06 UTC (permalink / raw)
  To: Sunil V L; +Cc: devel@edk2.groups.io, andrei.warkentin@intel.com

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

Thanks Sunil,
Updated pull request: https://github.com/tianocore/edk2/pull/4585
Please help merge it if no objection.

Thanks,

From: Sunil V L <sunilvl@ventanamicro.com>
Date: Wednesday, June 28, 2023 at 7:43 AM
To: Tuan Phan <tphan@ventanamicro.com>
Cc: devel@edk2.groups.io <devel@edk2.groups.io>, andrei.warkentin@intel.com <andrei.warkentin@intel.com>
Subject: Re: [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
On Tue, Jun 27, 2023 at 06:15:57PM -0700, Tuan Phan wrote:
> 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>
> ---

LGTM.

Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks!
Sunil

[-- Attachment #2: Type: text/html, Size: 3112 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-28 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28  1:15 [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly Tuan Phan
2023-06-28 14:43 ` Sunil V L
2023-06-28 21:06   ` Tuan Phan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox