-/**@file\r
+/** @file\r
IPF specific debugsupport types, macros, and definitions.\r
\r
Copyright (c) 2004 - 2006 Intel Corporation \r
\r
**/\r
\r
-#ifndef _PLDEBUG_SUPPORT_H\r
-#define _PLDEBUG_SUPPORT_H\r
-\r
+#ifndef _PLDEBUG_SUPPORT_H_\r
+#define _PLDEBUG_SUPPORT_H_\r
\r
#include <Uefi.h>\r
\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/PcdLib.h>\r
\r
#define DISABLE_INTERRUPTS 0UL\r
\r
-//\r
-// The remaining definitions comprise the protocol members.\r
-//\r
#define EFI_ISA IsaIpf\r
\r
-//\r
-// processor specific functions that must be public\r
-//\r
-EFI_STATUS\r
-plInitializeDebugSupportDriver (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- IPF specific DebugSupport driver initialization. Must be public because it's\r
- referenced from DebugSupport.c\r
+typedef struct {\r
+ UINT64 low;\r
+ UINT64 high;\r
+} BUNDLE;\r
\r
-Arguments:\r
+/**\r
+ IPF specific DebugSupport driver initialization. \r
\r
-Returns:\r
+ Must be public because it's referenced from DebugSupport.c\r
\r
- EFI_SUCCESS\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Always.\r
\r
+**/\r
EFI_STATUS\r
-EFIAPI\r
-plUnloadDebugSupportDriver (\r
- IN EFI_HANDLE ImageHandle\r
- )\r
-/*++\r
+PlInitializeDebugSupportDriver (\r
+ VOID\r
+ );\r
\r
-Routine Description:\r
+/**\r
Unload handler that is called during UnloadImage() - deallocates pool memory\r
used by the driver. Must be public because it's referenced from DebugSuport.c\r
\r
-Arguments:\r
- ImageHandle - Image handle\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
\r
-Returns:\r
+ @retval EFI_SUCCESS Always.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlUnloadDebugSupportDriver (\r
+ IN EFI_HANDLE ImageHandle\r
+ );\r
\r
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
+/**\r
+ C callable function to obtain the current value of IVA.\r
\r
---*/\r
-;\r
+ @return Current value of IVA.\r
\r
-//\r
-// Assembly worker functions and data referenced from plDebugSupport.c\r
-//\r
+**/\r
VOID *\r
GetIva (\r
VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- C callable function to obtain the current value of IVA\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- Current value if IVA\r
+ );\r
\r
---*/\r
-;\r
+/**\r
+ HookStub will be copied from it's loaded location into the IVT when\r
+ an IVT entry is hooked.\r
\r
+**/\r
VOID\r
HookStub (\r
VOID\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
-\r
- HookStub will be copied from it's loaded location into the IVT when\r
- an IVT entry is hooked.\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
+/**\r
+ Chains an interrupt handler.\r
\r
+**/\r
VOID\r
ChainHandler (\r
VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+ );\r
\r
- Chains an interrupt handler\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
+/**\r
+ Unchains an interrupt handler.\r
\r
+**/\r
VOID\r
UnchainHandler (\r
VOID\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
+/**\r
+ C callable function to enable/disable interrupts.\r
\r
- Unchains an interrupt handler\r
+ @param NewInterruptState New Interrupt State.\r
\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-;\r
+ @return Previous state of psr.ic.\r
\r
+**/\r
UINT64\r
ProgramInterruptFlags (\r
IN UINT64 NewInterruptState\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- C callable function to enable/disable interrupts\r
+ );\r
\r
-Arguments:\r
+/**\r
+ Flushes instruction cache for specified number of bytes.\r
\r
- NewInterruptState - New Interrupt State\r
-\r
-Returns:\r
-\r
- Previous state of psr.ic\r
-\r
---*/\r
-;\r
+ @param StartAddress Cache Start Address.\r
+ @param SizeInBytes Cache Size.\r
\r
+**/\r
VOID\r
InstructionCacheFlush (\r
IN VOID *StartAddress,\r
IN UINTN SizeInBytes\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Flushes instruction cache for specified number of bytes\r
+ );\r
\r
-Arguments:\r
-\r
- StartAddress - Cache Start Address\r
- SizeInBytes - Cache Size\r
-\r
-Returns:\r
+/**\r
+ This is a DebugSupport protocol member function, hard\r
+ coded to support only 1 processor for now.\r
\r
- None\r
+ @param This The DebugSupport instance\r
+ @param MaxProcessorIndex The maximuim supported processor index\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Always returned with **MaxProcessorIndex set to 0.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
GetMaximumProcessorIndex (\r
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
OUT UINTN *MaxProcessorIndex\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description: This is a DebugSupport protocol member function. Hard\r
- coded to support only 1 processor for now.\r
-\r
-Arguments:\r
- This - The DebugSupport instance\r
- MaxProcessorIndex - The maximuim supported processor index\r
+/**\r
+ DebugSupport protocol member function.\r
\r
-Returns:\r
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0\r
+ @param This The DebugSupport instance\r
+ @param ProcessorIndex Which processor the callback applies to.\r
+ @param PeriodicCallback Callback function\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Indicates the callback was registered.\r
+ @retval others Callback was not registered.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
RegisterPeriodicCallback (\r
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
IN UINTN ProcessorIndex,\r
IN EFI_PERIODIC_CALLBACK PeriodicCallback\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- DebugSupport protocol member function\r
+/**\r
+ DebugSupport protocol member function.\r
\r
-Arguments:\r
- This - The DebugSupport instance\r
- ProcessorIndex - Which processor the callback applies to.\r
- PeriodicCallback - Callback function\r
+ @param This The DebugSupport instance\r
+ @param ProcessorIndex Which processor the callback applies to.\r
+ @param NewCallback Callback function\r
+ @param ExceptionType Which exception to hook\r
\r
-Returns:\r
-\r
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Indicates the callback was registered.\r
+ @retval others Callback was not registered.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
RegisterExceptionCallback (\r
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
IN UINTN ProcessorIndex,\r
- IN EFI_EXCEPTION_CALLBACK NewHandler,\r
+ IN EFI_EXCEPTION_CALLBACK NewCallback,\r
IN EFI_EXCEPTION_TYPE ExceptionType\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- DebugSupport protocol member function\r
-\r
-Arguments:\r
- This - The DebugSupport instance\r
- ProcessorIndex - Which processor the callback applies to.\r
- NewCallback - Callback function\r
- ExceptionType - Which exception to hook\r
-\r
-Returns:\r
+/**\r
+ DebugSupport protocol member function. Calls assembly routine to flush cache.\r
\r
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
+ @param This The DebugSupport instance\r
+ @param ProcessorIndex Which processor the callback applies to.\r
+ @param Start Physical base of the memory range to be invalidated\r
+ @param Length mininum number of bytes in instruction cache to invalidate\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Always returned.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
InvalidateInstructionCache (\r
IN UINTN ProcessorIndex,\r
IN VOID *Start,\r
IN UINTN Length\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- DebugSupport protocol member function. Calls assembly routine to flush cache.\r
-\r
-Arguments:\r
- This - The DebugSupport instance\r
- ProcessorIndex - Which processor the callback applies to.\r
- Start - Physical base of the memory range to be invalidated\r
- Length - mininum number of bytes in instruction cache to invalidate\r
+ );\r
\r
-Returns:\r
- EFI_SUCCESS\r
-\r
---*/\r
-;\r
+/**\r
+ C routine that is called for all registered exceptions. This is the main\r
+ exception dispatcher. Must be public because it's referenced from AsmFuncs.s.\r
\r
+ @param ExceptionType Exception Type\r
+ @param Context System Context\r
+**/\r
VOID\r
CommonHandler (\r
IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT Context\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- C routine that is called for all registered exceptions. This is the main\r
- exception dispatcher. Must be public because it's referenced from AsmFuncs.s.\r
+/**\r
+ This is the worker function that uninstalls and removes all handlers.\r
\r
-Arguments:\r
- ExceptionType - Exception Type\r
- Context - System Context\r
+ @param ExceptionType Exception Type\r
+ @param NewBundles New Boundles\r
+ @param NewCallback New Callback\r
\r
-Returns:\r
+ @retval EFI_ALEADY_STARTED Ivt already hooked.\r
+ @retval others Indicates the request was not satisfied.\r
+ @retval EFI_SUCCESS Successfully uninstalled.\r
\r
- Nothing\r
- \r
---*/\r
-;\r
+**/\r
+EFI_STATUS\r
+ManageIvtEntryTable (\r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
+ IN BUNDLE NewBundles[4],\r
+ IN VOID (*NewCallback) ()\r
+ );\r
+\r
+/**\r
+ Saves original IVT contents and inserts a few new bundles which are fixed up\r
+ to store the ExceptionType and then call the common handler.\r
+\r
+ @param ExceptionType Exception Type\r
+ @param NewBundles New Boundles\r
+ @param NewCallback New Callback\r
+\r
+**/\r
+VOID\r
+HookEntry (\r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
+ IN BUNDLE NewBundles[4],\r
+ IN VOID (*NewCallback) ()\r
+ );\r
+\r
+/**\r
+ Restores original IVT contents when unregistering a callback function.\r
+\r
+ @param ExceptionType Exception Type\r
+\r
+**/\r
+VOID\r
+UnhookEntry (\r
+ IN EFI_EXCEPTION_TYPE ExceptionType\r
+ );\r
+\r
+/**\r
+ Sets up cache flush and calls assembly function to chain external interrupt.\r
+\r
+ Records new callback in IvtEntryTable.\r
+\r
+ @param NewCallback New Callback.\r
+\r
+**/\r
+VOID\r
+ChainExternalInterrupt (\r
+ IN VOID (*NewCallback) ()\r
+ );\r
+\r
+/**\r
+ Sets up cache flush and calls assembly function to restore external interrupt.\r
+ Removes registered callback from IvtEntryTable.\r
+\r
+**/\r
+VOID\r
+UnchainExternalInterrupt (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Given an integer number, return the physical address of the entry point in the IFT.\r
+\r
+ @param HandlerIndex Index of the Handler \r
+ @param EntryPoint IFT Entrypoint\r
+\r
+**/\r
+VOID\r
+GetHandlerEntryPoint (\r
+ UINTN HandlerIndex,\r
+ VOID **EntryPoint\r
+ );\r
\r
#endif\r