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