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