Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | Debug Agent Library provide source-level debug capability.
|
| 3 |
|
| 4 | Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
|
| 5 | This program and the accompanying materials are licensed and made available under
|
| 6 | the terms and conditions of the BSD License that accompanies this distribution.
|
| 7 | The full text of the license may be found at
|
| 8 | http://opensource.org/licenses/bsd-license.php.
|
| 9 |
|
| 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 12 |
|
| 13 | **/
|
| 14 |
|
| 15 | #ifndef __DEBUG_AGENT_LIB_H__
|
| 16 | #define __DEBUG_AGENT_LIB_H__
|
| 17 |
|
| 18 | #define DEBUG_AGENT_INIT_PREMEM_SEC 1
|
| 19 | #define DEBUG_AGENT_INIT_POSTMEM_SEC 2
|
| 20 | #define DEBUG_AGENT_INIT_DXE_CORE 3
|
| 21 | #define DEBUG_AGENT_INIT_SMM 4
|
| 22 | #define DEBUG_AGENT_INIT_ENTER_SMI 5
|
| 23 | #define DEBUG_AGENT_INIT_EXIT_SMI 6
|
| 24 | #define DEBUG_AGENT_INIT_S3 7
|
| 25 | #define DEBUG_AGENT_INIT_DXE_AP 8
|
| 26 | #define DEBUG_AGENT_INIT_PEI 9
|
| 27 | #define DEBUG_AGENT_INIT_DXE_LOAD 10
|
| 28 | #define DEBUG_AGENT_INIT_DXE_UNLOAD 11
|
| 29 | #define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
|
| 30 |
|
| 31 | //
|
| 32 | // Context for DEBUG_AGENT_INIT_POSTMEM_SEC
|
| 33 | //
|
| 34 | typedef struct {
|
| 35 | UINTN HeapMigrateOffset;
|
| 36 | UINTN StackMigrateOffset;
|
| 37 | } DEBUG_AGENT_CONTEXT_POSTMEM_SEC;
|
| 38 |
|
| 39 | /**
|
| 40 | Caller provided function to be invoked at the end of InitializeDebugAgent().
|
| 41 |
|
| 42 | Refer to the descrption for InitializeDebugAgent() for more details.
|
| 43 |
|
| 44 | @param[in] Context The first input parameter of InitializeDebugAgent().
|
| 45 |
|
| 46 | **/
|
| 47 | typedef
|
| 48 | VOID
|
| 49 | (EFIAPI * DEBUG_AGENT_CONTINUE)(
|
| 50 | IN VOID *Context
|
| 51 | );
|
| 52 |
|
| 53 |
|
| 54 | /**
|
| 55 | Initialize debug agent.
|
| 56 |
|
| 57 | This function is used to set up debug environment to support source level debugging.
|
| 58 | If certain Debug Agent Library instance has to save some private data in the stack,
|
| 59 | this function must work on the mode that doesn't return to the caller, then
|
| 60 | the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one
|
| 61 | function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is
|
| 62 | responsible to invoke the passing-in function at the end of InitializeDebugAgent().
|
| 63 |
|
| 64 | If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by
|
| 65 | passing in the Context to be its parameter.
|
| 66 |
|
| 67 | If Function() is NULL, Debug Agent Library instance will return after setup debug
|
| 68 | environment.
|
| 69 |
|
| 70 | @param[in] InitFlag Init flag is used to decide the initialize process.
|
| 71 | @param[in] Context Context needed according to InitFlag; it was optional.
|
| 72 | @param[in] Function Continue function called by debug agent library; it was
|
| 73 | optional.
|
| 74 |
|
| 75 | **/
|
| 76 | VOID
|
| 77 | EFIAPI
|
| 78 | InitializeDebugAgent (
|
| 79 | IN UINT32 InitFlag,
|
| 80 | IN VOID *Context, OPTIONAL
|
| 81 | IN DEBUG_AGENT_CONTINUE Function OPTIONAL
|
| 82 | );
|
| 83 |
|
| 84 | /**
|
| 85 | Enable/Disable the interrupt of debug timer and return the interrupt state
|
| 86 | prior to the operation.
|
| 87 |
|
| 88 | If EnableStatus is TRUE, enable the interrupt of debug timer.
|
| 89 | If EnableStatus is FALSE, disable the interrupt of debug timer.
|
| 90 |
|
| 91 | @param[in] EnableStatus Enable/Disable.
|
| 92 |
|
| 93 | @retval TRUE Debug timer interrupt were enabled on entry to this call.
|
| 94 | @retval FALSE Debug timer interrupt were disabled on entry to this call.
|
| 95 |
|
| 96 | **/
|
| 97 | BOOLEAN
|
| 98 | EFIAPI
|
| 99 | SaveAndSetDebugTimerInterrupt (
|
| 100 | IN BOOLEAN EnableStatus
|
| 101 | );
|
| 102 |
|
| 103 | #endif
|