]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugMp.c
This revision can only work with Intel(c) UDK Debugger Tool version 1.2 or greater...
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DebugAgentCommon / DebugMp.c
index 577c6f54c66552576e1c54dfd85e1adecea13ee0..5275b096bb190c4a5ce8c5414d195a731e5fef71 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Multi-Processor support functions implementation.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2012, 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
@@ -101,7 +101,7 @@ HaltOtherProcessors (
   IN UINT32             CurrentProcessorIndex\r
   )\r
 {\r
-\r
+  DebugAgentMsgPrint (DEBUG_AGENT_INFO, "processor[%x]:Try to halt other processors.\n", CurrentProcessorIndex);\r
   if (!IsBsp (CurrentProcessorIndex)) {\r
     SetIpiSentByApFlag (TRUE);;\r
   }\r
@@ -305,7 +305,7 @@ SetDebugViewPoint (
 }\r
 \r
 /**\r
-  Initialize debug timer.\r
+  Set the IPI send by BPS/AP flag.\r
 \r
   @param[in] IpiSentByApFlag   TRUE means this IPI is sent by AP.\r
                                FALSE means this IPI is sent by BSP.\r
@@ -324,7 +324,7 @@ SetIpiSentByApFlag (
 }\r
 \r
 /**\r
-  Check if any processor breaks.\r
+  Check the next pending breaking CPU.\r
 \r
   @retval others      There is at least one processor broken, the minimum\r
                       index number of Processor returned.\r
@@ -332,7 +332,7 @@ SetIpiSentByApFlag (
 \r
 **/\r
 UINT32\r
-FindCpuNotRunning (\r
+FindNextPendingBreakCpu (\r
   VOID\r
   )\r
 {\r
@@ -368,3 +368,37 @@ IsAllCpuRunning (
   return TRUE;\r
 }\r
 \r
+/**\r
+  Check if the current processor is the first breaking processor.\r
+\r
+  If yes, halt other processors.  \r
+  \r
+  @param[in] ProcessorIndex   Processor index value.\r
+  \r
+  @return TRUE       This processor is the first breaking processor.\r
+  @return FALSE      This processor is not the first breaking processor.\r
+                            \r
+**/\r
+BOOLEAN\r
+IsFirstBreakProcessor (\r
+  IN UINT32              ProcessorIndex\r
+  )\r
+{\r
+  if (MultiProcessorDebugSupport) {\r
+    if (mDebugMpContext.BreakAtCpuIndex != (UINT32) -1) {\r
+      //\r
+      // The current processor is not the first breaking one.\r
+      //\r
+      SetCpuBreakFlagByIndex (ProcessorIndex, TRUE);\r
+      return FALSE;\r
+    } else {\r
+      //\r
+      // If no any processor breaks, try to halt other processors\r
+      //\r
+      HaltOtherProcessors (ProcessorIndex);\r
+      return TRUE;\r
+    }\r
+  }\r
+  return TRUE;\r
+} \r
+\r