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