summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKun Qin <kuqin@microsoft.com>2024-10-10 15:21:36 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-11 18:21:29 +0000
commit77d32b179661739ce9a7e59141338c460da54e47 (patch)
treedde80bf32f35f64454aaf7d83e684370fafbe434
parent957fcbe7a3396dbd568f685d6c967514bdfb59f1 (diff)
downloadedk2-77d32b179661739ce9a7e59141338c460da54e47.tar.gz
ArmPkg: TimerDxe: Use 64bit operation for timer ticks
The current implementation operates on 64bit value with implicit value truncation. This change updates the involved frequencies to use 64 bit based operations. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
-rw-r--r--ArmPkg/Drivers/TimerDxe/TimerDxe.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 1559b323eb..37859e178e 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -143,8 +143,7 @@ TimerDriverSetTimerPeriod (
// mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3
// = TimerPeriod.10^-4 x Frequency.10^-3
// = (TimerPeriod x Frequency) x 10^-7
- TimerTicks = MultU64x32 (TimerPeriod, ArmGenericTimerGetTimerFreq ());
- TimerTicks = DivU64x32 (TimerTicks, 10000000U);
+ TimerTicks = TimerPeriod * ArmGenericTimerGetTimerFreq () / 10000000U;
// Raise TPL to update the mTimerTicks and mTimerPeriod to ensure these values
// are coherent in the interrupt handler