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