UefiBootServicesTableLib\r
DebugAgentLib\r
\r
+[Protocols]\r
+ gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES\r
+\r
[Guids]\r
gEfiEventExitBootServicesGuid ## CONSUMES ## Event\r
gEfiEventLegacyBootGuid ## CONSUMES ## Event\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/DebugAgentLib.h>\r
\r
+#include <Protocol/Timer.h>\r
+\r
#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100))\r
#define AP_SAFE_STACK_SIZE 128\r
\r
IN BOOLEAN EnableOldBSP\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
+ EFI_TIMER_ARCH_PROTOCOL *Timer;\r
+ UINT64 TimerPeriod;\r
\r
+ //\r
+ // Locate Timer Arch Protocol\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (VOID **) &Timer);\r
+ if (EFI_ERROR (Status)) {\r
+ Timer = NULL;\r
+ }\r
+\r
+ if (Timer != NULL) {\r
+ //\r
+ // Save current rate of DXE Timer\r
+ //\r
+ Timer->GetTimerPeriod (Timer, &TimerPeriod);\r
+ //\r
+ // Disable DXE Timer and drain pending interrupts\r
+ //\r
+ Timer->SetTimerPeriod (Timer, 0);\r
+ }\r
\r
Status = SwitchBSPWorker (ProcessorNumber, EnableOldBSP);\r
\r
+ if (Timer != NULL) {\r
+ //\r
+ // Enable and restore rate of DXE Timer\r
+ //\r
+ Timer->SetTimerPeriod (Timer, TimerPeriod);\r
+ }\r
+\r
return Status;\r
}\r
\r