summaryrefslogtreecommitdiffstats
path: root/SourceLevelDebugPkg
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2015-05-25 02:46:11 +0000
committervanjeff <vanjeff@Edk2>2015-05-25 02:46:11 +0000
commitedbb27132d4737be1fa54ea9f6e7657daa2bb72a (patch)
tree96636d62c383d711ccdb64aa3adf3646559b081e /SourceLevelDebugPkg
parente9d6470bd846aa4a7194227b5d61f652fb01dcc0 (diff)
downloadedk2-edbb27132d4737be1fa54ea9f6e7657daa2bb72a.tar.gz
edk2-edbb27132d4737be1fa54ea9f6e7657daa2bb72a.tar.bz2
edk2-edbb27132d4737be1fa54ea9f6e7657daa2bb72a.zip
SourceLevelDebugPkg/SmmDebugAgent: Initialize Local APIC Timer
Now Debug Agent library uses Local APIC Timer to implement time-out mechanism. In SMM, SMM BSP maybe not be the one in DXE phase, its local APIC timer may not work. This fix is to initialize Local APIC timer if it doesn't work as expected at SMM entry. 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@17500 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
index ac96a00240..544067b4d6 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
@@ -190,6 +190,8 @@ InitializeDebugAgent (
DEBUG_AGENT_MAILBOX *Mailbox;
UINT64 *MailboxLocation;
UINT32 DebugTimerFrequency;
+ BOOLEAN PeriodicMode;
+ UINTN TimerCycle;
switch (InitFlag) {
case DEBUG_AGENT_INIT_SMM:
@@ -275,7 +277,15 @@ InitializeDebugAgent (
case DEBUG_AGENT_INIT_ENTER_SMI:
SaveDebugRegister ();
InitializeDebugIdt ();
-
+ //
+ // Check if CPU APIC Timer is working, otherwise initialize it.
+ //
+ GetApicTimerState (NULL, &PeriodicMode, NULL);
+ TimerCycle = GetApicTimerInitCount ();
+ if (PeriodicMode != TRUE || TimerCycle == 0) {
+ InitializeDebugTimer (NULL);
+ DisableApicTimerInterrupt ();
+ }
Mailbox = GetMailboxPointer ();
if (GetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS) == 1) {
//