Update DebugAgent to make sure the Local APIC SoftwareEnable bit is set
before using the Local APIC Timer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <[email protected]>
---
 SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c    | 1 +
 SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c | 1 +
 SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c | 1 +
 3 files changed, 3 insertions(+)

diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c 
b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
index e287c4c..d01d1ae 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
@@ -30,10 +30,11 @@ InitializeDebugTimer (
 {
   UINTN       ApicTimerDivisor;
   UINT32      InitialCount;
   UINT32      ApicTimerFrequency;
 
+  InitializeLocalApicSoftwareEnable (TRUE);
   GetApicTimerState (&ApicTimerDivisor, NULL, NULL);
   ApicTimerFrequency = PcdGet32(PcdFSBClock) / (UINT32)ApicTimerDivisor;
   //
   // Cpu Local Apic timer interrupt frequency, it is set to 0.1s
   //
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c 
b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
index 35fb5e6..a63932c 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
@@ -370,10 +370,11 @@ InitializeDebugAgent (
 
   if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {
     //
     // Check if CPU APIC Timer is working, otherwise initialize it.
     //
+    InitializeLocalApicSoftwareEnable (TRUE);
     GetApicTimerState (NULL, &PeriodicMode, NULL);
     TimerCycle = GetApicTimerInitCount ();
     if (!PeriodicMode || TimerCycle == 0) {
       InitializeDebugTimer (NULL, FALSE);
     }
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c 
b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
index 3a759f9..32b1ae6 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
@@ -278,10 +278,11 @@ InitializeDebugAgent (
     SaveDebugRegister ();
     InitializeDebugIdt ();
     //
     // Check if CPU APIC Timer is working, otherwise initialize it.
     //
+    InitializeLocalApicSoftwareEnable (TRUE);
     GetApicTimerState (NULL, &PeriodicMode, NULL);
     TimerCycle = GetApicTimerInitCount ();
     if (!PeriodicMode || TimerCycle == 0) {
       InitializeDebugTimer (NULL, FALSE);
     }
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to