Revision: 17604
          http://sourceforge.net/p/edk2/code/17604
Author:   vanjeff
Date:     2015-06-10 01:45:18 +0000 (Wed, 10 Jun 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c

Modified: 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
===================================================================
--- 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
  2015-06-10 00:26:48 UTC (rev 17603)
+++ 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
  2015-06-10 01:45:18 UTC (rev 17604)
@@ -365,9 +365,19 @@
   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 ();


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to