diff options
author | Jeff Fan <jeff.fan@intel.com> | 2016-12-26 19:13:44 +0800 |
---|---|---|
committer | Jeff Fan <jeff.fan@intel.com> | 2016-12-28 15:38:18 +0800 |
commit | b6e45716c3ebccba9c576b1c39502dfa8e62c9df (patch) | |
tree | e2a3ebe8410478988426a92afb60a563d0f14738 /UefiCpuPkg | |
parent | 26b43433c1367f893ce3ae962761141a93b1d25a (diff) | |
download | edk2-platforms-b6e45716c3ebccba9c576b1c39502dfa8e62c9df.tar.xz |
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>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r-- | UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 3 | ||||
-rw-r--r-- | UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 31 |
2 files changed, 33 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf index cc4f2e93be..9751ba1f0d 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -57,6 +57,9 @@ UefiBootServicesTableLib
DebugAgentLib
+[Protocols]
+ gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES
+
[Guids]
gEfiEventExitBootServicesGuid ## CONSUMES ## Event
gEfiEventLegacyBootGuid ## CONSUMES ## Event
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c index 733a9fb7be..5e50b4c391 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -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;
}
|