summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2015-06-10 01:45:18 +0000
committervanjeff <vanjeff@Edk2>2015-06-10 01:45:18 +0000
commite2c8d3cff7538db66931e32fc76f91b116b00bee (patch)
tree85595455d25a1b71cbe0714d70ea86fe4dab7f80 /SourceLevelDebugPkg
parent81338070fed63c736e86d8e2e0e2a3b52733a794 (diff)
downloadedk2-platforms-e2c8d3cff7538db66931e32fc76f91b116b00bee.tar.xz
SourceLevelDebugPkg/DxeDebugAgent: Initialize Local APIC Timer
Now Debug Agent library uses Local APIC Timer to implement time-out mechanism. For AP, its local APIC timer may not work. This fix is to initialize Local APIC timer if it doesn't work as expected when debugging AP function. 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@17604 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
index 56a5e1a170..f7fbb3ccfa 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
@@ -365,9 +365,19 @@ InitializeDebugAgent (
IA32_DESCRIPTOR IdtDescriptor;
IA32_DESCRIPTOR *Ia32Idtr;
IA32_IDT_ENTRY *Ia32IdtEntry;
+ BOOLEAN PeriodicMode;
+ UINTN TimerCycle;
if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {
//
+ // Check if CPU APIC Timer is working, otherwise initialize it.
+ //
+ GetApicTimerState (NULL, &PeriodicMode, NULL);
+ TimerCycle = GetApicTimerInitCount ();
+ if (!PeriodicMode || TimerCycle == 0) {
+ InitializeDebugTimer (NULL, FALSE);
+ }
+ //
// Invoked by AP, enable interrupt to let AP could receive IPI from other processors
//
EnableInterrupts ();