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>
This commit is contained in:
Kun Qin 2024-10-10 15:21:36 -07:00 committed by mergify[bot]
parent 957fcbe7a3
commit 77d32b1796

View File

@ -143,8 +143,7 @@ TimerDriverSetTimerPeriod (
// mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3 // mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3
// = TimerPeriod.10^-4 x Frequency.10^-3 // = TimerPeriod.10^-4 x Frequency.10^-3
// = (TimerPeriod x Frequency) x 10^-7 // = (TimerPeriod x Frequency) x 10^-7
TimerTicks = MultU64x32 (TimerPeriod, ArmGenericTimerGetTimerFreq ()); TimerTicks = TimerPeriod * ArmGenericTimerGetTimerFreq () / 10000000U;
TimerTicks = DivU64x32 (TimerTicks, 10000000U);
// Raise TPL to update the mTimerTicks and mTimerPeriod to ensure these values // Raise TPL to update the mTimerTicks and mTimerPeriod to ensure these values
// are coherent in the interrupt handler // are coherent in the interrupt handler