Jeff,
SetupDebugAgentEnvironment() behavior was changed but the function header 
wasn't updated.
If the Local APIC Timer initialization is moved to 
SetupDebugAgentEnvironment(), does it impact S3 debugging? Because 
SetupDebugAgentEnvironment() is also called when DEBUG_AGENT_INIT_S3.

Thanks,
Ray

-----Original Message-----
From: Fan, Jeff 
Sent: Thursday, May 14, 2015 4:42 PM
To: edk2-devel@lists.sourceforge.net
Cc: Ni, Ruiyu
Subject: [Patch 1/2] SourceLevelDebugPkg/DxeDebugAgent: Initialize Local APIC 
Timer early

Now Debug Agent library uses Local APIC Timer to implement time-out mechanism.
But it does not initialize Local APIC Timer before transfer data with HOST.
This fix is to move Local APIC Timer initialization to
SetupDebugAgentEnviroment().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff....@intel.com>
Cc: Ruiyu Ni <ruiyu...@intel.com>
---
 .../Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c 
b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
index 601c5e8..6af934a 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
@@ -248,6 +248,7 @@ SetupDebugAgentEnviroment (
   IA32_DESCRIPTOR              Idtr;
   UINT16                       IdtEntryCount;
   UINT64                       DebugPortHandle;
+  UINT32                       DebugTimerFrequency;
 
   if (mMultiProcessorDebugSupport) {
     InitializeSpinLock (&mDebugMpContext.MpContextSpinLock);
@@ -299,6 +300,11 @@ SetupDebugAgentEnviroment (
   }
 
   //
+  // Initialize Debug Timer hardware and save its initial count and frequency
+  //
+  mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer 
(&DebugTimerFrequency);
+  UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, 
DebugTimerFrequency);
+  //
   // Initialize debug communication port
   //
   DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((VOID 
*)(UINTN)mMailboxPointer->DebugPortHandle, NULL);
@@ -355,7 +361,6 @@ InitializeDebugAgent (
   IA32_DESCRIPTOR              IdtDescriptor;
   IA32_DESCRIPTOR              *Ia32Idtr;
   IA32_IDT_ENTRY               *Ia32IdtEntry;
-  UINT32                       DebugTimerFrequency;
 
   if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {
     //
@@ -414,11 +419,6 @@ InitializeDebugAgent (
     //
     SetupDebugAgentEnviroment (Mailbox);
     //
-    // Initialize Debug Timer hardware and save its initial count and frequency
-    //
-    mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer 
(&DebugTimerFrequency);
-    UpdateMailboxContent (mMailboxPointer, 
DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);
-    //
     // For DEBUG_AGENT_INIT_S3, needn't to install configuration table and EFI 
Serial IO protocol
     // For DEBUG_AGENT_INIT_DXE_CORE, InternalConstructorWorker() will invoked 
in Constructor()
     //
@@ -507,11 +507,6 @@ InitializeDebugAgent (
     //
     SetupDebugAgentEnviroment (Mailbox);
     //
-    // Initialize Debug Timer hardware and save its initial count and frequency
-    //
-    mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer 
(&DebugTimerFrequency);
-    UpdateMailboxContent (mMailboxPointer, 
DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);
-    //
     // Enable interrupt to receive Debug Timer interrupt
     //
     EnableInterrupts ();
-- 
1.9.5.msysgit.0


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to