From 4cf7e0380ebf7e07c2ddee3d2c20daaeb66203a3 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Mon, 19 Jul 2010 02:26:09 +0000 Subject: [PATCH] 1. Add init flag DEBUG_AGENT_INIT_DXE_AP. 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 | 2 +- MdeModulePkg/Include/Library/DebugAgentLib.h | 55 ++++++++++++++++--- .../DebugAgentLibNull/DebugAgentLibNull.c | 28 ++++++++-- 3 files changed, 71 insertions(+), 14 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 04ec17708b..b18f92d408 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -244,7 +244,7 @@ DxeMain ( // // Initialize Debug Agent to support source level debug in DXE phase // - InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart); + InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart, NULL); // // Initialize Memory Services diff --git a/MdeModulePkg/Include/Library/DebugAgentLib.h b/MdeModulePkg/Include/Library/DebugAgentLib.h index 8424209091..f945b0c007 100644 --- a/MdeModulePkg/Include/Library/DebugAgentLib.h +++ b/MdeModulePkg/Include/Library/DebugAgentLib.h @@ -2,12 +2,12 @@ Debug Agent Library provide source-level debug capability. Copyright (c) 2010, Intel Corporation. All rights reserved.
-This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. +http://opensource.org/licenses/bsd-license.php. -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ @@ -22,21 +22,60 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define DEBUG_AGENT_INIT_ENTER_SMI 5 #define DEBUG_AGENT_INIT_EXIT_SMI 6 #define DEBUG_AGENT_INIT_S3 7 +#define DEBUG_AGENT_INIT_DXE_AP 8 + + +// +// Context for DEBUG_AGENT_INIT_POSTMEM_SEC +// +typedef struct { + UINTN HeapMigrateOffset; + UINTN StackMigrateOffset; +} DEBUG_AGENT_CONTEXT_POSTMEM_SEC; + +/** + Caller provided function to be invoked at the end of InitializeDebugAgent(). + + Refer to the descrption for InitializeDebugAgent() for more details. + + @param[in] Context The first input parameter of InitializeDebugAgent(). + +**/ +typedef +VOID +(EFIAPI * DEBUG_AGENT_CONTINUE)( + IN VOID *Context + ); + /** Initialize debug agent. - This function is used to set up debug enviroment. + This function is used to set up debug environment to support source level debugging. + If certain Debug Agent Library instance has to save some private data in the stack, + this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one + function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is + responsible to invoke the passing-in function at the end of InitializeDebugAgent(). - @param[in] InitFlag Init flag is used to decide the initialize process. - @param[in] Context Context needed according to InitFlag; it was optional. + If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by + passing in the Context to be its parameter. + + If Function() is NULL, Debug Agent Library instance will return after setup debug + environment. + + @param[in] InitFlag Init flag is used to decide the initialize process. + @param[in] Context Context needed according to InitFlag; it was optional. + @param[in] Function Continue function called by debug agent library; it was + optional. **/ VOID EFIAPI InitializeDebugAgent ( IN UINT32 InitFlag, - IN VOID *Context OPTIONAL + IN VOID *Context, OPTIONAL + IN DEBUG_AGENT_CONTINUE Function OPTIONAL ); /** diff --git a/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c b/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c index 0db1e866b6..09e1366189 100644 --- a/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c +++ b/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c @@ -12,23 +12,41 @@ **/ +#include + /** Initialize debug agent. - This function is used to set up debug enviroment. It may enable interrupts. + This function is used to set up debug environment to support source level debugging. + If certain Debug Agent Library instance has to save some private data in the stack, + this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one + function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is + responsible to invoke the passing-in function at the end of InitializeDebugAgent(). - @param[in] InitFlag Init flag is used to decide initialize process. - @param[in] Context Context needed according to InitFlag, it was optional. + If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by + passing in the Context to be its parameter. + + If Function() is NULL, Debug Agent Library instance will return after setup debug + environment. + + @param[in] InitFlag Init flag is used to decide the initialize process. + @param[in] Context Context needed according to InitFlag; it was optional. + @param[in] Function Continue function called by debug agent library; it was + optional. **/ VOID EFIAPI InitializeDebugAgent ( IN UINT32 InitFlag, - IN VOID *Context OPTIONAL + IN VOID *Context, OPTIONAL + IN DEBUG_AGENT_CONTINUE Function OPTIONAL ) { - + if (Function != NULL) { + Function (Context); + } } /**