]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Library/DebugAgentLib.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Include / Library / DebugAgentLib.h
1 /** @file
2 Debug Agent Library provide source-level debug capability.
3
4 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __DEBUG_AGENT_LIB_H__
10 #define __DEBUG_AGENT_LIB_H__
11
12 #define DEBUG_AGENT_INIT_PREMEM_SEC 1
13 #define DEBUG_AGENT_INIT_POSTMEM_SEC 2
14 #define DEBUG_AGENT_INIT_DXE_CORE 3
15 #define DEBUG_AGENT_INIT_SMM 4
16 #define DEBUG_AGENT_INIT_ENTER_SMI 5
17 #define DEBUG_AGENT_INIT_EXIT_SMI 6
18 #define DEBUG_AGENT_INIT_S3 7
19 #define DEBUG_AGENT_INIT_DXE_AP 8
20 #define DEBUG_AGENT_INIT_PEI 9
21 #define DEBUG_AGENT_INIT_DXE_LOAD 10
22 #define DEBUG_AGENT_INIT_DXE_UNLOAD 11
23 #define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
24
25 //
26 // Context for DEBUG_AGENT_INIT_POSTMEM_SEC
27 //
28 typedef struct {
29 UINTN HeapMigrateOffset;
30 UINTN StackMigrateOffset;
31 } DEBUG_AGENT_CONTEXT_POSTMEM_SEC;
32
33 /**
34 Caller provided function to be invoked at the end of InitializeDebugAgent().
35
36 Refer to the description for InitializeDebugAgent() for more details.
37
38 @param[in] Context The first input parameter of InitializeDebugAgent().
39
40 **/
41 typedef
42 VOID
43 (EFIAPI * DEBUG_AGENT_CONTINUE)(
44 IN VOID *Context
45 );
46
47
48 /**
49 Initialize debug agent.
50
51 This function is used to set up debug environment to support source level debugging.
52 If certain Debug Agent Library instance has to save some private data in the stack,
53 this function must work on the mode that doesn't return to the caller, then
54 the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one
55 function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is
56 responsible to invoke the passing-in function at the end of InitializeDebugAgent().
57
58 If the parameter Function is not NULL, Debug Agent Library instance will invoke it by
59 passing in the Context to be its parameter.
60
61 If Function() is NULL, Debug Agent Library instance will return after setup debug
62 environment.
63
64 @param[in] InitFlag Init flag is used to decide the initialize process.
65 @param[in] Context Context needed according to InitFlag; it was optional.
66 @param[in] Function Continue function called by debug agent library; it was
67 optional.
68
69 **/
70 VOID
71 EFIAPI
72 InitializeDebugAgent (
73 IN UINT32 InitFlag,
74 IN VOID *Context, OPTIONAL
75 IN DEBUG_AGENT_CONTINUE Function OPTIONAL
76 );
77
78 /**
79 Enable/Disable the interrupt of debug timer and return the interrupt state
80 prior to the operation.
81
82 If EnableStatus is TRUE, enable the interrupt of debug timer.
83 If EnableStatus is FALSE, disable the interrupt of debug timer.
84
85 @param[in] EnableStatus Enable/Disable.
86
87 @retval TRUE Debug timer interrupt were enabled on entry to this call.
88 @retval FALSE Debug timer interrupt were disabled on entry to this call.
89
90 **/
91 BOOLEAN
92 EFIAPI
93 SaveAndSetDebugTimerInterrupt (
94 IN BOOLEAN EnableStatus
95 );
96
97 #endif