summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2015-04-01 07:51:15 +0000
committervanjeff <vanjeff@Edk2>2015-04-01 07:51:15 +0000
commit08021523f8a581437b07986d2c1876a7b6f0d282 (patch)
tree5a6684e3bcb26373da7ef36a7a2a818e67de0e0c /SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
parent206f412113e8be0da9bd6fd16f89c045ce0d8366 (diff)
downloadedk2-platforms-08021523f8a581437b07986d2c1876a7b6f0d282.tar.xz
SourceLevelDebugPkg: Use CPU Local APIC timer to handle timeout.
Use CPU Local APIC timer to handle timeout when read data from debug port, instead of the TimerLib in Debug Communication lib instances. It could remove much duplicated code in Debug Communication Lib instances. 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@17089 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
index 651737e5e7..ac96a00240 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
@@ -1,7 +1,7 @@
/** @file
Debug Agent library implementition.
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -189,6 +189,7 @@ InitializeDebugAgent (
UINT16 IdtEntryCount;
DEBUG_AGENT_MAILBOX *Mailbox;
UINT64 *MailboxLocation;
+ UINT32 DebugTimerFrequency;
switch (InitFlag) {
case DEBUG_AGENT_INIT_SMM:
@@ -236,6 +237,12 @@ InitializeDebugAgent (
// Initialized Debug Agent
//
InitializeDebugIdt ();
+ //
+ // Initialize Debug Timer hardware and save its frequency
+ //
+ InitializeDebugTimer (&DebugTimerFrequency);
+ UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);
+
DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((DEBUG_PORT_HANDLE) (UINTN)Mailbox->DebugPortHandle, NULL);
UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX, DebugPortHandle);
mMailboxPointer = Mailbox;
@@ -329,9 +336,10 @@ InitializeDebugAgent (
InitializeDebugIdt ();
//
- // Initialize Debug Timer hardware and enable interrupt.
+ // Initialize Debug Timer hardware and save its frequency
//
- InitializeDebugTimer ();
+ InitializeDebugTimer (&DebugTimerFrequency);
+ UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);
EnableInterrupts ();
FindAndReportModuleImageInfo (SIZE_4KB);