]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SourceLevelDebugPkg/DxeDebugAgent: Initialize Local APIC Timer
authorJeff Fan <jeff.fan@intel.com>
Wed, 10 Jun 2015 01:45:18 +0000 (01:45 +0000)
committervanjeff <vanjeff@Edk2>
Wed, 10 Jun 2015 01:45:18 +0000 (01:45 +0000)
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

SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c

index 56a5e1a170700ebd395872a62d2e93d1ec301616..f7fbb3ccfaf49a64cb7da37ef2edea02e7bf3492 100644 (file)
@@ -365,8 +365,18 @@ InitializeDebugAgent (
   IA32_DESCRIPTOR              IdtDescriptor;\r
   IA32_DESCRIPTOR              *Ia32Idtr;\r
   IA32_IDT_ENTRY               *Ia32IdtEntry;\r
+  BOOLEAN                      PeriodicMode;\r
+  UINTN                        TimerCycle;\r
 \r
   if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {\r
+    //\r
+    // Check if CPU APIC Timer is working, otherwise initialize it.\r
+    //\r
+    GetApicTimerState (NULL, &PeriodicMode, NULL);\r
+    TimerCycle = GetApicTimerInitCount ();\r
+    if (!PeriodicMode || TimerCycle == 0) {\r
+      InitializeDebugTimer (NULL, FALSE);\r
+    }\r
     //\r
     // Invoked by AP, enable interrupt to let AP could receive IPI from other processors\r
     //\r