summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c b/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
index aff51932f6..65957e2a61 100644
--- a/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
+++ b/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
@@ -105,6 +105,7 @@ InternalX86Delay (
)
{
INT32 Ticks;
+ UINT32 PowerOfTwoCounter;
//
// The target timer count is calculated here
@@ -116,7 +117,8 @@ InternalX86Delay (
// Delay > 2^31 could not be handled by this function
// Timer wrap-arounds are handled correctly by this function
//
- while (((UINT32)(InternalX86GetTimerTick (ApicBase) - Ticks) & GetPowerOfTwo32 ((MmioRead32 (ApicBase + APIC_TMICT)))) == 0) {
+ PowerOfTwoCounter = GetPowerOfTwo32 (MmioRead32 (ApicBase + APIC_TMICT));
+ while (((UINT32)(InternalX86GetTimerTick (ApicBase) - Ticks) & PowerOfTwoCounter) == 0) {
CpuPause ();
}
}