Add one parameter DumpFlag to indicate if need to dump Local APIC time's
parameter.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff....@intel.com>
CC: Ruiyu Ni <ruiyu...@intel.com>
---
 .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c      |  2 +-
 .../Library/DebugAgent/DebugAgentCommon/DebugTimer.c      | 15 +++++++++------
 .../Library/DebugAgent/DebugAgentCommon/DebugTimer.h      |  4 +++-
 .../Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c   |  2 +-
 .../DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c     |  4 ++--
 .../Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c   |  6 +++---
 6 files changed, 19 insertions(+), 14 deletions(-)

diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c 
b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index 3daa633..d9f7204 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -2530,7 +2530,7 @@ InterruptProcess (
         //
         CurrentDebugTimerInitCount = GetApicTimerInitCount ();
         if (mDebugMpContext.DebugTimerInitCount != CurrentDebugTimerInitCount) 
{
-          InitializeDebugTimer (NULL);
+          InitializeDebugTimer (NULL, FALSE);
         }
       }
 
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c 
b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
index 0a60e7d..25d6468 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
@@ -18,12 +18,14 @@
   Initialize CPU local APIC timer.
 
   @param[out] TimerFrequency  Local APIC timer frequency returned.
+  @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.
  
   @return   32-bit Local APIC timer init count.
 **/
 UINT32
 InitializeDebugTimer (
-  OUT UINT32     *TimerFrequency
+  OUT UINT32     *TimerFrequency,
+  IN  BOOLEAN    DumpFlag
   )
 {
   UINTN       ApicTimerDivisor;
@@ -45,11 +47,12 @@ InitializeDebugTimer (
 
   InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, 
DEBUG_TIMER_VECTOR);
 
-  DEBUG ((EFI_D_INFO, "Debug Timer: FSB Clock    = %d\n", 
PcdGet32(PcdFSBClock))); 
-  DEBUG ((EFI_D_INFO, "Debug Timer: Divisor      = %d\n", ApicTimerDivisor)); 
-  DEBUG ((EFI_D_INFO, "Debug Timer: Frequency    = %d\n", 
ApicTimerFrequency)); 
-  DEBUG ((EFI_D_INFO, "Debug Timer: InitialCount = %d\n", InitialCount)); 
-
+  if (DumpFlag) {
+    DEBUG ((EFI_D_INFO, "Debug Timer: FSB Clock    = %d\n", 
PcdGet32(PcdFSBClock)));
+    DEBUG ((EFI_D_INFO, "Debug Timer: Divisor      = %d\n", ApicTimerDivisor));
+    DEBUG ((EFI_D_INFO, "Debug Timer: Frequency    = %d\n", 
ApicTimerFrequency));
+    DEBUG ((EFI_D_INFO, "Debug Timer: InitialCount = %d\n", InitialCount));
+  }
   if (TimerFrequency != NULL) {
     *TimerFrequency = ApicTimerFrequency;
   }
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h 
b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h
index 021d67e..60550d4 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h
@@ -19,12 +19,14 @@
   Initialize CPU local APIC timer.
 
   @param[out] TimerFrequency  Local APIC timer frequency returned.
+  @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.
  
   @return   32-bit Local APIC timer init count.
 **/
 UINT32
 InitializeDebugTimer (
-  OUT UINT32     *TimerFrequency
+  OUT UINT32     *TimerFrequency,
+  IN  BOOLEAN    DumpFlag
   );
 
 /**
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c 
b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
index 63fb928..7784ac4 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
@@ -306,7 +306,7 @@ SetupDebugAgentEnvironment (
   //
   // Initialize Debug Timer hardware and save its initial count and frequency
   //
-  mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer 
(&DebugTimerFrequency);
+  mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer 
(&DebugTimerFrequency, TRUE);
   UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, 
DebugTimerFrequency);
   //
   // Initialize debug communication port
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c 
b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
index f71ddad..fba41ee 100644
--- 
a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
+++ 
b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
@@ -403,7 +403,7 @@ InitializeDebugAgent (
     //
     // Initialize Debug Timer hardware and save its frequency
     //
-    InitializeDebugTimer (&DebugTimerFrequency);
+    InitializeDebugTimer (&DebugTimerFrequency, TRUE);
     UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, 
DebugTimerFrequency);
 
     Phase2Context.InitFlag = InitFlag;
@@ -535,7 +535,7 @@ InitializeDebugAgent (
       //
       // Initialize Debug Timer hardware and save its frequency
       //
-      InitializeDebugTimer (&DebugTimerFrequency);
+      InitializeDebugTimer (&DebugTimerFrequency, TRUE);
       UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, 
DebugTimerFrequency);
       //
       // Update IDT entry to save the location pointer saved mailbox pointer
diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c 
b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
index 544067b..72db534 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
@@ -242,7 +242,7 @@ InitializeDebugAgent (
     //
     // Initialize Debug Timer hardware and save its frequency
     //
-    InitializeDebugTimer (&DebugTimerFrequency);
+    InitializeDebugTimer (&DebugTimerFrequency, TRUE);
     UpdateMailboxContent (mMailboxPointer, 
DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);
 
     DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((DEBUG_PORT_HANDLE) 
(UINTN)Mailbox->DebugPortHandle, NULL);
@@ -283,7 +283,7 @@ InitializeDebugAgent (
     GetApicTimerState (NULL, &PeriodicMode, NULL);
     TimerCycle = GetApicTimerInitCount ();
     if (PeriodicMode != TRUE || TimerCycle == 0) {
-      InitializeDebugTimer (NULL);
+      InitializeDebugTimer (NULL, FALSE);
       DisableApicTimerInterrupt ();
     }
     Mailbox = GetMailboxPointer ();
@@ -348,7 +348,7 @@ InitializeDebugAgent (
       //
       // Initialize Debug Timer hardware and save its frequency
       //
-      InitializeDebugTimer (&DebugTimerFrequency);
+      InitializeDebugTimer (&DebugTimerFrequency, TRUE);
       UpdateMailboxContent (mMailboxPointer, 
DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);
       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