diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c index cc1be0125b..8fb183a35d 100644 --- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c +++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c @@ -17,13 +17,6 @@ #define TICKS_PER_MICRO_SEC (ArmGenericTimerGetTimerFreq ()/1000000U) -// Select appropriate multiply function for platform architecture. -#ifdef MDE_CPU_ARM -#define MULT_U64_X_N MultU64x32 -#else -#define MULT_U64_X_N MultU64x64 -#endif - /** A local utility function that returns the PCD value, if specified. Otherwise it defaults to ArmGenericTimerGetTimerFreq. @@ -69,7 +62,7 @@ MicroSecondDelay ( // = MicroSeconds x TICKS_PER_MICRO_SEC // = MicroSeconds x Frequency.10^-6 TimerTicks64 = DivU64x32 ( - MULT_U64_X_N ( + MultU64x64 ( MicroSeconds, GetPlatformTimerFreq () ), @@ -205,8 +198,8 @@ GetTimeInNanoSecond ( ) { UINT64 NanoSeconds; - UINT32 Remainder; - UINT32 TimerFreq; + UINT64 Remainder; + UINT64 TimerFreq; TimerFreq = GetPlatformTimerFreq (); // @@ -214,8 +207,8 @@ GetTimeInNanoSecond ( // Time = --------- x 1,000,000,000 // Frequency // - NanoSeconds = MULT_U64_X_N ( - DivU64x32Remainder ( + NanoSeconds = MultU64x64 ( + DivU64x64Remainder ( Ticks, TimerFreq, &Remainder @@ -227,12 +220,13 @@ GetTimeInNanoSecond ( // Frequency < 0x100000000, so Remainder < 0x100000000, then (Remainder * 1,000,000,000) // will not overflow 64-bit. // - NanoSeconds += DivU64x32 ( - MULT_U64_X_N ( - (UINT64)Remainder, + NanoSeconds += DivU64x64Remainder ( + MultU64x64 ( + Remainder, 1000000000U ), - TimerFreq + TimerFreq, + NULL ); return NanoSeconds;