Add DebugPort & DebugSupport drivers
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / ipf / plDebugSupport.h
1 /**@file
2 IPF specific debugsupport types, macros, and definitions.
3
4 Copyright (c) 2004 - 2006 Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. 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 _PLDEBUG_SUPPORT_H
16 #define _PLDEBUG_SUPPORT_H
17
18 //
19 // The package level header files this module uses
20 //
21 #include <PiDxe.h>
22 //
23 // The protocols, PPI and GUID defintions for this module
24 //
25 #include <Protocol/DebugSupport.h>
26 #include <Protocol/LoadedImage.h>
27 //
28 // The Library classes this module consumes
29 //
30 #include <Library/DebugLib.h>
31 #include <Library/UefiDriverEntryPoint.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/BaseLib.h>
36 #include <Library/PcdLib.h>
37
38 #define DISABLE_INTERRUPTS 0UL
39
40 //
41 // The remaining definitions comprise the protocol members.
42 //
43 #define EFI_ISA IsaIpf
44
45 //
46 // processor specific functions that must be public
47 //
48 EFI_STATUS
49 plInitializeDebugSupportDriver (
50 VOID
51 )
52 /*++
53
54 Routine Description:
55 IPF specific DebugSupport driver initialization. Must be public because it's
56 referenced from DebugSupport.c
57
58 Arguments:
59
60 Returns:
61
62 EFI_SUCCESS
63
64 --*/
65 ;
66
67 EFI_STATUS
68 EFIAPI
69 plUnloadDebugSupportDriver (
70 IN EFI_HANDLE ImageHandle
71 )
72 /*++
73
74 Routine Description:
75 Unload handler that is called during UnloadImage() - deallocates pool memory
76 used by the driver. Must be public because it's referenced from DebugSuport.c
77
78 Arguments:
79 ImageHandle - Image handle
80
81 Returns:
82
83 EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
84
85 --*/
86 ;
87
88 //
89 // Assembly worker functions and data referenced from plDebugSupport.c
90 //
91 VOID *
92 GetIva (
93 VOID
94 )
95 /*++
96
97 Routine Description:
98
99 C callable function to obtain the current value of IVA
100
101 Arguments:
102
103 None
104
105 Returns:
106
107 Current value if IVA
108
109 --*/
110 ;
111
112 VOID
113 HookStub (
114 VOID
115 )
116 /*++
117
118 Routine Description:
119
120 HookStub will be copied from it's loaded location into the IVT when
121 an IVT entry is hooked.
122
123 Arguments:
124
125 None
126
127 Returns:
128
129 None
130
131 --*/
132 ;
133
134 VOID
135 ChainHandler (
136 VOID
137 )
138 /*++
139
140 Routine Description:
141
142 Chains an interrupt handler
143
144 Arguments:
145
146 None
147
148 Returns:
149
150 None
151
152 --*/
153 ;
154
155 VOID
156 UnchainHandler (
157 VOID
158 )
159 /*++
160
161 Routine Description:
162
163 Unchains an interrupt handler
164
165 Arguments:
166
167 None
168
169 Returns:
170
171 None
172
173 --*/
174 ;
175
176 UINT64
177 ProgramInterruptFlags (
178 IN UINT64 NewInterruptState
179 )
180 /*++
181
182 Routine Description:
183
184 C callable function to enable/disable interrupts
185
186 Arguments:
187
188 NewInterruptState - New Interrupt State
189
190 Returns:
191
192 Previous state of psr.ic
193
194 --*/
195 ;
196
197 VOID
198 InstructionCacheFlush (
199 IN VOID *StartAddress,
200 IN UINTN SizeInBytes
201 )
202 /*++
203
204 Routine Description:
205
206 Flushes instruction cache for specified number of bytes
207
208 Arguments:
209
210 StartAddress - Cache Start Address
211 SizeInBytes - Cache Size
212
213 Returns:
214
215 None
216
217 --*/
218 ;
219
220 EFI_STATUS
221 EFIAPI
222 GetMaximumProcessorIndex (
223 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
224 OUT UINTN *MaxProcessorIndex
225 )
226 /*++
227
228 Routine Description: This is a DebugSupport protocol member function. Hard
229 coded to support only 1 processor for now.
230
231 Arguments:
232 This - The DebugSupport instance
233 MaxProcessorIndex - The maximuim supported processor index
234
235 Returns:
236 Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
237
238 --*/
239 ;
240
241 EFI_STATUS
242 EFIAPI
243 RegisterPeriodicCallback (
244 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
245 IN UINTN ProcessorIndex,
246 IN EFI_PERIODIC_CALLBACK PeriodicCallback
247 )
248 /*++
249
250 Routine Description:
251 DebugSupport protocol member function
252
253 Arguments:
254 This - The DebugSupport instance
255 ProcessorIndex - Which processor the callback applies to.
256 PeriodicCallback - Callback function
257
258 Returns:
259
260 EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
261
262 --*/
263 ;
264
265 EFI_STATUS
266 EFIAPI
267 RegisterExceptionCallback (
268 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
269 IN UINTN ProcessorIndex,
270 IN EFI_EXCEPTION_CALLBACK NewHandler,
271 IN EFI_EXCEPTION_TYPE ExceptionType
272 )
273 /*++
274
275 Routine Description:
276 DebugSupport protocol member function
277
278 Arguments:
279 This - The DebugSupport instance
280 ProcessorIndex - Which processor the callback applies to.
281 NewCallback - Callback function
282 ExceptionType - Which exception to hook
283
284 Returns:
285
286 EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
287
288 --*/
289 ;
290
291 EFI_STATUS
292 EFIAPI
293 InvalidateInstructionCache (
294 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
295 IN UINTN ProcessorIndex,
296 IN VOID *Start,
297 IN UINTN Length
298 )
299 /*++
300
301 Routine Description:
302 DebugSupport protocol member function. Calls assembly routine to flush cache.
303
304 Arguments:
305 This - The DebugSupport instance
306 ProcessorIndex - Which processor the callback applies to.
307 Start - Physical base of the memory range to be invalidated
308 Length - mininum number of bytes in instruction cache to invalidate
309
310 Returns:
311 EFI_SUCCESS
312
313 --*/
314 ;
315
316 VOID
317 CommonHandler (
318 IN EFI_EXCEPTION_TYPE ExceptionType,
319 IN EFI_SYSTEM_CONTEXT Context
320 )
321 /*++
322
323 Routine Description:
324 C routine that is called for all registered exceptions. This is the main
325 exception dispatcher. Must be public because it's referenced from AsmFuncs.s.
326
327 Arguments:
328 ExceptionType - Exception Type
329 Context - System Context
330
331 Returns:
332
333 Nothing
334
335 --*/
336 ;
337
338 #endif