mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/MpInitLib: Disable and restore system timer interrupt
We need to disable system timer interrup to avoid generating the pending interrupt on the old BSP. Cc: Feng Tian <feng.tian@intel.com> Cc: Kinney Michael D <michael.d.kinney@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
parent
26b43433c1
commit
b6e45716c3
|
@ -57,6 +57,9 @@
|
|||
UefiBootServicesTableLib
|
||||
DebugAgentLib
|
||||
|
||||
[Protocols]
|
||||
gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
[Guids]
|
||||
gEfiEventExitBootServicesGuid ## CONSUMES ## Event
|
||||
gEfiEventLegacyBootGuid ## CONSUMES ## Event
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DebugAgentLib.h>
|
||||
|
||||
#include <Protocol/Timer.h>
|
||||
|
||||
#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100))
|
||||
#define AP_SAFE_STACK_SIZE 128
|
||||
|
||||
|
@ -645,11 +647,38 @@ MpInitLibSwitchBSP (
|
|||
IN BOOLEAN EnableOldBSP
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
EFI_TIMER_ARCH_PROTOCOL *Timer;
|
||||
UINT64 TimerPeriod;
|
||||
|
||||
//
|
||||
// Locate Timer Arch Protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (VOID **) &Timer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Timer = NULL;
|
||||
}
|
||||
|
||||
if (Timer != NULL) {
|
||||
//
|
||||
// Save current rate of DXE Timer
|
||||
//
|
||||
Timer->GetTimerPeriod (Timer, &TimerPeriod);
|
||||
//
|
||||
// Disable DXE Timer and drain pending interrupts
|
||||
//
|
||||
Timer->SetTimerPeriod (Timer, 0);
|
||||
}
|
||||
|
||||
Status = SwitchBSPWorker (ProcessorNumber, EnableOldBSP);
|
||||
|
||||
if (Timer != NULL) {
|
||||
//
|
||||
// Enable and restore rate of DXE Timer
|
||||
//
|
||||
Timer->SetTimerPeriod (Timer, TimerPeriod);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue