]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add init flag DEBUG_AGENT_INIT_DXE_AP.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 19 Jul 2010 02:26:09 +0000 (02:26 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 19 Jul 2010 02:26:09 +0000 (02:26 +0000)
2. Add definition DEBUG_AGENT_CONTINUE.
3. Update the definition of InitializeDebugAgent() more comments.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10660 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
MdeModulePkg/Include/Library/DebugAgentLib.h
MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c

index 04ec17708b2c9376b4c9640f604088b322009370..b18f92d4081066f534be279cab8c3091d253a75c 100644 (file)
@@ -244,7 +244,7 @@ DxeMain (
   //\r
   // Initialize Debug Agent to support source level debug in DXE phase\r
   //\r
-  InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart);\r
+  InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart, NULL);\r
 \r
   //\r
   // Initialize Memory Services\r
index 8424209091aacb19ec5b2407d7ce7edf30f96fd6..f945b0c007d5caec8040d797866e0fcbd0b04212 100644 (file)
@@ -2,12 +2,12 @@
   Debug Agent Library provide source-level debug capability.\r
 \r
 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution.  \r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.                                            \r
+http://opensource.org/licenses/bsd-license.php.\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
@@ -22,21 +22,60 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define DEBUG_AGENT_INIT_ENTER_SMI       5\r
 #define DEBUG_AGENT_INIT_EXIT_SMI        6\r
 #define DEBUG_AGENT_INIT_S3              7\r
+#define DEBUG_AGENT_INIT_DXE_AP          8\r
+\r
+\r
+//\r
+// Context for DEBUG_AGENT_INIT_POSTMEM_SEC\r
+//\r
+typedef struct {\r
+  UINTN          HeapMigrateOffset;\r
+  UINTN          StackMigrateOffset;\r
+} DEBUG_AGENT_CONTEXT_POSTMEM_SEC;\r
+\r
+/**\r
+  Caller provided function to be invoked at the end of InitializeDebugAgent().\r
+\r
+  Refer to the descrption for InitializeDebugAgent() for more details.\r
+\r
+  @param[in] Context    The first input parameter of InitializeDebugAgent().\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI * DEBUG_AGENT_CONTINUE)(\r
+  IN VOID        *Context\r
+  );\r
+\r
 \r
 /**\r
   Initialize debug agent.\r
 \r
-  This function is used to set up debug enviroment.\r
+  This function is used to set up debug environment to support source level debugging.\r
+  If certain Debug Agent Library instance has to save some private data in the stack,\r
+  this function must work on the mode that doesn't return to the caller, then\r
+  the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one\r
+  function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is\r
+  responsible to invoke the passing-in function at the end of InitializeDebugAgent().\r
+\r
+  If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by\r
+  passing in the Context to be its parameter.\r
+\r
+  If Function() is NULL, Debug Agent Library instance will return after setup debug\r
+  environment.\r
 \r
-  @param[in] InitFlag   Init flag is used to decide the initialize process.\r
-  @param[in] Context    Context needed according to InitFlag; it was optional.\r
+  @param[in] InitFlag     Init flag is used to decide the initialize process.\r
+  @param[in] Context      Context needed according to InitFlag; it was optional.\r
+  @param[in] Function     Continue function called by debug agent library; it was\r
+                          optional.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 InitializeDebugAgent (\r
   IN UINT32                InitFlag,\r
-  IN VOID                  *Context  OPTIONAL\r
+  IN VOID                  *Context, OPTIONAL\r
+  IN DEBUG_AGENT_CONTINUE  Function  OPTIONAL\r
   );\r
 \r
 /**\r
index 0db1e866b6519d861bfe9df4070bf14118d068ed..09e1366189303d38066ff3860da6fb4006726228 100644 (file)
 \r
 **/\r
 \r
+#include <Library/DebugAgentLib.h>\r
+\r
 /**\r
   Initialize debug agent.\r
 \r
-  This function is used to set up debug enviroment. It may enable interrupts.\r
+  This function is used to set up debug environment to support source level debugging.\r
+  If certain Debug Agent Library instance has to save some private data in the stack,\r
+  this function must work on the mode that doesn't return to the caller, then\r
+  the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one\r
+  function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is\r
+  responsible to invoke the passing-in function at the end of InitializeDebugAgent().\r
+\r
+  If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by\r
+  passing in the Context to be its parameter.\r
 \r
-  @param[in] InitFlag   Init flag is used to decide initialize process.\r
-  @param[in] Context    Context needed according to InitFlag, it was optional.\r
+  If Function() is NULL, Debug Agent Library instance will return after setup debug\r
+  environment.\r
+\r
+  @param[in] InitFlag     Init flag is used to decide the initialize process.\r
+  @param[in] Context      Context needed according to InitFlag; it was optional.\r
+  @param[in] Function     Continue function called by debug agent library; it was\r
+                          optional.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 InitializeDebugAgent (\r
   IN UINT32                InitFlag,\r
-  IN VOID                  *Context  OPTIONAL\r
+  IN VOID                  *Context, OPTIONAL\r
+  IN DEBUG_AGENT_CONTINUE  Function  OPTIONAL\r
   )\r
 {\r
-\r
+  if (Function != NULL) {\r
+    Function (Context);\r
+  }\r
 }\r
 \r
 /**\r