]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
SourceLevelDebugPkg: Use CPU Local APIC timer to handle timeout.
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / SmmDebugAgent / SmmDebugAgentLib.c
index 651737e5e7b2195b745851b247402f930898dc44..ac96a00240319e6245182a64174bbad3df34f92a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Debug Agent library implementition.\r
 \r
-  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -189,6 +189,7 @@ InitializeDebugAgent (
   UINT16                        IdtEntryCount;\r
   DEBUG_AGENT_MAILBOX           *Mailbox;\r
   UINT64                        *MailboxLocation;\r
+  UINT32                        DebugTimerFrequency;\r
 \r
   switch (InitFlag) {\r
   case DEBUG_AGENT_INIT_SMM:\r
@@ -236,6 +237,12 @@ InitializeDebugAgent (
     // Initialized Debug Agent\r
     //\r
     InitializeDebugIdt ();\r
+    //\r
+    // Initialize Debug Timer hardware and save its frequency\r
+    //\r
+    InitializeDebugTimer (&DebugTimerFrequency);\r
+    UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);\r
+\r
     DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((DEBUG_PORT_HANDLE) (UINTN)Mailbox->DebugPortHandle, NULL);\r
     UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX, DebugPortHandle);\r
     mMailboxPointer = Mailbox;\r
@@ -329,9 +336,10 @@ InitializeDebugAgent (
 \r
       InitializeDebugIdt ();\r
       //\r
-      // Initialize Debug Timer hardware and enable interrupt.\r
+      // Initialize Debug Timer hardware and save its frequency\r
       //\r
-      InitializeDebugTimer ();\r
+      InitializeDebugTimer (&DebugTimerFrequency);\r
+      UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);\r
       EnableInterrupts ();\r
 \r
       FindAndReportModuleImageInfo (SIZE_4KB);\r