]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DebugSupportDxe/Ia32/plDebugSupport.h
remove some comments introduced by tools.
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / Ia32 / plDebugSupport.h
1 /**@file
2 IA32 specific debug support macros, typedefs and prototypes.
3
4 Copyright (c) 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 NUM_IDT_ENTRIES 0x78
39 #define SYSTEM_TIMER_VECTOR 0x68
40 #define VECTOR_ENTRY_PAGES 1
41 #define CopyDescriptor(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))
42 #define ZeroDescriptor(Dest) CopyDescriptor ((Dest), &NullDesc)
43 #define ReadIdt(Vector, Dest) CopyDescriptor ((Dest), &((GetIdtr ())[(Vector)]))
44 #define WriteIdt(Vector, Src) CopyDescriptor (&((GetIdtr ())[(Vector)]), (Src))
45 #define CompareDescriptor(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))
46 #define EFI_ISA IsaIa32
47 #define FF_FXSR (1 << 24)
48
49 typedef UINT64 DESCRIPTOR;
50
51 typedef
52 VOID
53 (*DEBUG_PROC) (
54 VOID
55 )
56 ;
57
58 typedef struct {
59 DESCRIPTOR OrigDesc;
60 DEBUG_PROC OrigVector;
61 DESCRIPTOR NewDesc;
62 DEBUG_PROC StubEntry;
63 VOID (*RegisteredCallback) ();
64 } IDT_ENTRY;
65
66 extern EFI_SYSTEM_CONTEXT SystemContext;
67 extern UINT8 InterruptEntryStub[];
68 extern UINT32 StubSize;
69 extern VOID (*OrigVector) (VOID);
70
71 VOID
72 CommonIdtEntry (
73 VOID
74 )
75 /*++
76
77 Routine Description:
78
79 Generic IDT entry
80
81 Arguments:
82
83 None
84
85 Returns:
86
87 None
88
89 --*/
90 ;
91
92
93 BOOLEAN
94 FxStorSupport (
95 VOID
96 )
97 /*++
98
99 Routine Description:
100
101 Check whether FXSTOR is supported
102
103 Arguments:
104
105 None
106
107 Returns:
108
109 TRUE - supported
110 FALSE - not supported
111
112 --*/
113 ;
114
115 DESCRIPTOR *
116 GetIdtr (
117 VOID
118 )
119 /*++
120
121 Routine Description:
122
123 Return the physical address of IDTR
124
125 Arguments:
126
127 None
128
129 Returns:
130
131 The physical address of IDTR
132
133 --*/
134 ;
135
136 VOID
137 Vect2Desc (
138 DESCRIPTOR * DestDesc,
139 VOID (*Vector) (VOID)
140 )
141 /*++
142
143 Routine Description:
144
145 Encodes an IDT descriptor with the given physical address
146
147 Arguments:
148
149 DestDesc - The IDT descriptor address
150 Vector - The interrupt vector entry
151
152 Returns:
153
154 None
155
156 --*/
157 ;
158
159 BOOLEAN
160 WriteInterruptFlag (
161 BOOLEAN NewState
162 )
163 /*++
164
165 Routine Description:
166
167 Programs interrupt flag to the requested state and returns previous
168 state.
169
170 Arguments:
171
172 NewState - New interrupt status
173
174 Returns:
175
176 Old interrupt status
177
178 --*/
179 ;
180
181 EFI_STATUS
182 plInitializeDebugSupportDriver (
183 VOID
184 )
185 /*++
186
187 Routine Description:
188 Initializes driver's handler registration database.
189
190 This code executes in boot services context.
191
192 Arguments:
193 None
194
195 Returns:
196 EFI_SUCCESS
197 EFI_UNSUPPORTED - if IA32 processor does not support FXSTOR/FXRSTOR instructions,
198 the context save will fail, so these processor's are not supported.
199 EFI_OUT_OF_RESOURCES - not resource to finish initialization
200
201 --*/
202 ;
203
204 EFI_STATUS
205 EFIAPI
206 plUnloadDebugSupportDriver (
207 IN EFI_HANDLE ImageHandle
208 )
209 /*++
210
211 Routine Description:
212 This is the callback that is written to the LoadedImage protocol instance
213 on the image handle. It uninstalls all registered handlers and frees all entry
214 stub memory.
215
216 This code executes in boot services context.
217
218 Arguments:
219 ImageHandle - The image handle of the unload handler
220
221 Returns:
222
223 EFI_SUCCESS - always return success
224
225 --*/
226 ;
227
228 //
229 // DebugSupport protocol member functions
230 //
231 EFI_STATUS
232 EFIAPI
233 GetMaximumProcessorIndex (
234 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
235 OUT UINTN *MaxProcessorIndex
236 )
237 /*++
238
239 Routine Description: This is a DebugSupport protocol member function.
240
241 Arguments:
242 This - The DebugSupport instance
243 MaxProcessorIndex - The maximuim supported processor index
244
245 Returns:
246 Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
247
248 --*/
249 ;
250
251 EFI_STATUS
252 EFIAPI
253 RegisterPeriodicCallback (
254 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
255 IN UINTN ProcessorIndex,
256 IN EFI_PERIODIC_CALLBACK PeriodicCallback
257 )
258 /*++
259
260 Routine Description: This is a DebugSupport protocol member function.
261
262 Arguments:
263 This - The DebugSupport instance
264 ProcessorIndex - Which processor the callback applies to.
265 PeriodicCallback - Callback function
266
267 Returns:
268
269 EFI_SUCCESS
270 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
271 no handler registered for it
272 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
273
274 Other possible return values are passed through from UnHookEntry and HookEntry.
275
276 --*/
277 ;
278
279 EFI_STATUS
280 EFIAPI
281 RegisterExceptionCallback (
282 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
283 IN UINTN ProcessorIndex,
284 IN EFI_EXCEPTION_CALLBACK NewCallback,
285 IN EFI_EXCEPTION_TYPE ExceptionType
286 )
287 /*++
288
289 Routine Description:
290 This is a DebugSupport protocol member function.
291
292 This code executes in boot services context.
293
294 Arguments:
295 This - The DebugSupport instance
296 ProcessorIndex - Which processor the callback applies to.
297 NewCallback - Callback function
298 ExceptionType - Which exception to hook
299
300 Returns:
301
302 EFI_SUCCESS
303 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
304 no handler registered for it
305 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
306
307 Other possible return values are passed through from UnHookEntry and HookEntry.
308
309 --*/
310 ;
311
312 EFI_STATUS
313 EFIAPI
314 InvalidateInstructionCache (
315 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
316 IN UINTN ProcessorIndex,
317 IN VOID *Start,
318 IN UINT64 Length
319 )
320 /*++
321
322 Routine Description:
323 This is a DebugSupport protocol member function.
324 Calls assembly routine to flush cache.
325
326 Arguments:
327 This - The DebugSupport instance
328 ProcessorIndex - Which processor the callback applies to.
329 Start - Physical base of the memory range to be invalidated
330 Length - mininum number of bytes in instruction cache to invalidate
331
332 Returns:
333
334 EFI_SUCCESS - always return success
335
336 --*/
337 ;
338
339 #endif