#include <Library/PcdLib.h>\r
#include <Library/IoLib.h>\r
#include <Library/ArmGenericTimerCounterLib.h>\r
-#include <Library/ArmArchTimer.h>\r
\r
#include <Protocol/Timer.h>\r
#include <Protocol/HardwareInterrupt.h>\r
//\r
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
\r
+ // Signal end of interrupt early to help avoid losing subsequent ticks\r
+ // from long duration handlers\r
+ gInterrupt->EndOfInterrupt (gInterrupt, Source);\r
+\r
// Check if the timer interrupt is active\r
if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {\r
\r
- // Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers\r
- gInterrupt->EndOfInterrupt (gInterrupt, Source);\r
-\r
if (mTimerNotifyFunction) {\r
mTimerNotifyFunction (mTimerPeriod * mElapsedPeriod);\r
}\r
\r
// Set next compare value\r
ArmGenericTimerSetCompareVal (CompareValue);\r
+ ArmGenericTimerReenableTimer ();\r
+ ArmInstructionSynchronizationBarrier ();\r
}\r
\r
- // Enable timer interrupts\r
- gInterrupt->EnableInterruptSource (gInterrupt, Source);\r
-\r
gBS->RestoreTPL (OriginalTPL);\r
}\r
\r
{\r
EFI_HANDLE Handle = NULL;\r
EFI_STATUS Status;\r
- UINTN TimerCtrlReg;\r
+ UINTN TimerCtrlReg;\r
+ UINT32 TimerHypIntrNum;\r
\r
if (ArmIsArchTimerImplemented () == 0) {\r
DEBUG ((EFI_D_ERROR, "ARM Architectural Timer is not available in the CPU, hence cann't use this Driver \n"));\r
Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 (PcdArmArchTimerVirtIntrNum), TimerInterruptHandler);\r
ASSERT_EFI_ERROR (Status);\r
\r
- Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 (PcdArmArchTimerHypIntrNum), TimerInterruptHandler);\r
- ASSERT_EFI_ERROR (Status);\r
+ //\r
+ // The hypervisor timer interrupt may be omitted by implementations that\r
+ // execute under virtualization.\r
+ //\r
+ TimerHypIntrNum = PcdGet32 (PcdArmArchTimerHypIntrNum);\r
+ if (TimerHypIntrNum != 0) {\r
+ Status = gInterrupt->RegisterInterruptSource (gInterrupt, TimerHypIntrNum, TimerInterruptHandler);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
\r
Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 (PcdArmArchTimerSecIntrNum), TimerInterruptHandler);\r
ASSERT_EFI_ERROR (Status);\r