2 IPF specific debugsupport types, macros, and definitions.
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
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.
15 #ifndef _PLDEBUG_SUPPORT_H_
16 #define _PLDEBUG_SUPPORT_H_
20 #include <Protocol/DebugSupport.h>
21 #include <Protocol/LoadedImage.h>
23 #include <Library/DebugLib.h>
24 #include <Library/UefiDriverEntryPoint.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
29 #define DISABLE_INTERRUPTS 0UL
31 #define EFI_ISA IsaIpf
39 IPF specific DebugSupport driver initialization.
41 Must be public because it's referenced from DebugSupport.c
43 @retval EFI_SUCCESS Always.
47 PlInitializeDebugSupportDriver (
52 Unload handler that is called during UnloadImage() - deallocates pool memory
53 used by the driver. Must be public because it's referenced from DebugSuport.c
55 @param ImageHandle The firmware allocated handle for the EFI image.
57 @retval EFI_SUCCESS Always.
62 PlUnloadDebugSupportDriver (
63 IN EFI_HANDLE ImageHandle
67 C callable function to obtain the current value of IVA.
69 @return Current value of IVA.
78 HookStub will be copied from it's loaded location into the IVT when
79 an IVT entry is hooked.
88 Chains an interrupt handler.
97 Unchains an interrupt handler.
106 C callable function to enable/disable interrupts.
108 @param NewInterruptState New Interrupt State.
110 @return Previous state of psr.ic.
114 ProgramInterruptFlags (
115 IN UINT64 NewInterruptState
119 Flushes instruction cache for specified number of bytes.
121 @param StartAddress Cache Start Address.
122 @param SizeInBytes Cache Size.
126 InstructionCacheFlush (
127 IN VOID
*StartAddress
,
132 This is a DebugSupport protocol member function, hard
133 coded to support only 1 processor for now.
135 @param This The DebugSupport instance
136 @param MaxProcessorIndex The maximuim supported processor index
138 @retval EFI_SUCCESS Always returned with **MaxProcessorIndex set to 0.
143 GetMaximumProcessorIndex (
144 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
145 OUT UINTN
*MaxProcessorIndex
149 DebugSupport protocol member function.
151 @param This The DebugSupport instance
152 @param ProcessorIndex Which processor the callback applies to.
153 @param PeriodicCallback Callback function
155 @retval EFI_SUCCESS Indicates the callback was registered.
156 @retval others Callback was not registered.
161 RegisterPeriodicCallback (
162 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
163 IN UINTN ProcessorIndex
,
164 IN EFI_PERIODIC_CALLBACK PeriodicCallback
168 DebugSupport protocol member function.
170 @param This The DebugSupport instance
171 @param ProcessorIndex Which processor the callback applies to.
172 @param NewCallback Callback function
173 @param ExceptionType Which exception to hook
175 @retval EFI_SUCCESS Indicates the callback was registered.
176 @retval others Callback was not registered.
181 RegisterExceptionCallback (
182 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
183 IN UINTN ProcessorIndex
,
184 IN EFI_EXCEPTION_CALLBACK NewCallback
,
185 IN EFI_EXCEPTION_TYPE ExceptionType
189 DebugSupport protocol member function. Calls assembly routine to flush cache.
191 @param This The DebugSupport instance
192 @param ProcessorIndex Which processor the callback applies to.
193 @param Start Physical base of the memory range to be invalidated
194 @param Length mininum number of bytes in instruction cache to invalidate
196 @retval EFI_SUCCESS Always returned.
201 InvalidateInstructionCache (
202 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
203 IN UINTN ProcessorIndex
,
209 C routine that is called for all registered exceptions. This is the main
210 exception dispatcher. Must be public because it's referenced from AsmFuncs.s.
212 @param ExceptionType Exception Type
213 @param Context System Context
217 IN EFI_EXCEPTION_TYPE ExceptionType
,
218 IN EFI_SYSTEM_CONTEXT Context
222 This is the worker function that uninstalls and removes all handlers.
224 @param ExceptionType Exception Type
225 @param NewBundles New Boundles
226 @param NewCallback New Callback
228 @retval EFI_ALEADY_STARTED Ivt already hooked.
229 @retval others Indicates the request was not satisfied.
230 @retval EFI_SUCCESS Successfully uninstalled.
234 ManageIvtEntryTable (
235 IN EFI_EXCEPTION_TYPE ExceptionType
,
236 IN BUNDLE NewBundles
[4],
237 IN
VOID (*NewCallback
) ()
241 Saves original IVT contents and inserts a few new bundles which are fixed up
242 to store the ExceptionType and then call the common handler.
244 @param ExceptionType Exception Type
245 @param NewBundles New Boundles
246 @param NewCallback New Callback
251 IN EFI_EXCEPTION_TYPE ExceptionType
,
252 IN BUNDLE NewBundles
[4],
253 IN
VOID (*NewCallback
) ()
257 Restores original IVT contents when unregistering a callback function.
259 @param ExceptionType Exception Type
264 IN EFI_EXCEPTION_TYPE ExceptionType
268 Sets up cache flush and calls assembly function to chain external interrupt.
270 Records new callback in IvtEntryTable.
272 @param NewCallback New Callback.
276 ChainExternalInterrupt (
277 IN
VOID (*NewCallback
) ()
281 Sets up cache flush and calls assembly function to restore external interrupt.
282 Removes registered callback from IvtEntryTable.
286 UnchainExternalInterrupt (
291 Given an integer number, return the physical address of the entry point in the IFT.
293 @param HandlerIndex Index of the Handler
294 @param EntryPoint IFT Entrypoint
298 GetHandlerEntryPoint (