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