summaryrefslogtreecommitdiffstats
path: root/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2015-06-08 06:36:41 +0000
committervanjeff <vanjeff@Edk2>2015-06-08 06:36:41 +0000
commit2befbc82ccd6ebbba35bafe21f6ab929ef2cff31 (patch)
tree3dd3dd0ebba8899a0aef0b3aea6e141de13882e4 /SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon
parent9ade4339658e962c067d01f12ff83f1c2dab13ab (diff)
downloadedk2-2befbc82ccd6ebbba35bafe21f6ab929ef2cff31.tar.gz
edk2-2befbc82ccd6ebbba35bafe21f6ab929ef2cff31.tar.bz2
edk2-2befbc82ccd6ebbba35bafe21f6ab929ef2cff31.zip
SourceLevelDebugPkg/DebugAgent: Disable Debug Timer as early
InitializeApicTimer() will enable Local APIC timer interrupt. Even though we disable CPU interrupt at the beginning and enable CPU Interrupt after debug agent initialized completely, some Boot Service may invoke RestoreTpl () which may enable CPU interrupt. We should disable Local APIC timer in InitializeDebugTimer () to avoid Debug Timer interrupt happens during debug port and debug agent initialization phase. And enable Debug Timer interrupt after debug agent is initialized. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17572 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c1
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index 3eca30497f..6c32586303 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -2535,6 +2535,7 @@ InterruptProcess (
CurrentDebugTimerInitCount = GetApicTimerInitCount ();
if (mDebugMpContext.DebugTimerInitCount != CurrentDebugTimerInitCount) {
InitializeDebugTimer (NULL, FALSE);
+ SaveAndSetDebugTimerInterrupt (TRUE);
}
}
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
index 25d6468588..4a6ccdb7da 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
@@ -46,6 +46,11 @@ InitializeDebugTimer (
);
InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);
+ //
+ // Disable Debug Timer interrupt to avoid it is delivered before Debug Port
+ // is initialized
+ //
+ DisableApicTimerInterrupt ();
if (DumpFlag) {
DEBUG ((EFI_D_INFO, "Debug Timer: FSB Clock = %d\n", PcdGet32(PcdFSBClock)));