]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c
Add X64 support for DebugSupport driver.
[mirror_edk2.git] / EdkModulePkg / Universal / DebugSupport / Dxe / ipf / plDebugSupport.c
index b79390a95f858421580c011cc1b8507568b166ad..513d71f62fb8455758e793887c59999e301f1306 100644 (file)
@@ -1,4 +1,5 @@
-/*++\r
+/**@file\r
+  IPF specific debug support functions\r
 \r
 Copyright (c) 2006, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 \r
 Copyright (c) 2006, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
@@ -9,32 +10,7 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
-\r
-    PlDebugSupport.c\r
-\r
-Abstract:\r
-\r
-    IPF specific debug support functions\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-//\r
-// Master EFI header file\r
-//\r
-#include "Tiano.h"\r
-\r
-//\r
-// Common library header files\r
-//\r
-#include "EfiDriverLib.h"\r
-\r
-//\r
-// Produced protocols\r
-//\r
-#include EFI_PROTOCOL_DEFINITION (DebugSupport)\r
+**/\r
 \r
 //\r
 // private header files\r
 \r
 //\r
 // private header files\r
@@ -148,14 +124,13 @@ Routine Description:
   used by the driver.  Must be public because it's referenced from DebugSuport.c\r
 \r
 Arguments:\r
   used by the driver.  Must be public because it's referenced from DebugSuport.c\r
 \r
 Arguments:\r
-  IN EFI_HANDLE       ImageHandle\r
+  ImageHandle - Image handle\r
 \r
 Returns:\r
 \r
   EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
 \r
 --*/\r
 \r
 Returns:\r
 \r
   EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
 \r
 --*/\r
-// TODO:    ImageHandle - add argument and description to function comment\r
 {\r
   EFI_EXCEPTION_TYPE  ExceptionType;\r
 \r
 {\r
   EFI_EXCEPTION_TYPE  ExceptionType;\r
 \r
@@ -178,22 +153,20 @@ Routine Description:
   exception dispatcher.  Must be public because it's referenced from AsmFuncs.s.\r
 \r
 Arguments:\r
   exception dispatcher.  Must be public because it's referenced from AsmFuncs.s.\r
 \r
 Arguments:\r
-  IN EFI_EXCEPTION_TYPE ExceptionType,\r
-  IN EFI_SYSTEM_CONTEXT Context\r
+  ExceptionType - Exception Type\r
+  Context       - System Context\r
 \r
 Returns:\r
 \r
   Nothing\r
   \r
 --*/\r
 \r
 Returns:\r
 \r
   Nothing\r
   \r
 --*/\r
-// TODO:    ExceptionType - add argument and description to function comment\r
-// TODO:    Context - add argument and description to function comment\r
 {\r
   static BOOLEAN  InHandler = FALSE;\r
 \r
   DEBUG_CODE_BEGIN ();\r
     if (InHandler) {\r
 {\r
   static BOOLEAN  InHandler = FALSE;\r
 \r
   DEBUG_CODE_BEGIN ();\r
     if (InHandler) {\r
-      EfiDebugPrint (EFI_D_GENERIC, "ERROR: Re-entered debugger!\n"\r
+      DEBUG ((EFI_D_INFO, "ERROR: Re-entered debugger!\n"\r
                                     "       ExceptionType == %X\n"\r
                                     "       Context       == %X\n"\r
                                     "       Context.SystemContextIpf->CrIip  == %X\n"\r
                                     "       ExceptionType == %X\n"\r
                                     "       Context       == %X\n"\r
                                     "       Context.SystemContextIpf->CrIip  == %X\n"\r
@@ -203,7 +176,7 @@ Returns:
                                     Context, \r
                                     Context.SystemContextIpf->CrIip,\r
                                     Context.SystemContextIpf->CrIpsr,\r
                                     Context, \r
                                     Context.SystemContextIpf->CrIip,\r
                                     Context.SystemContextIpf->CrIpsr,\r
-                                    InHandler);\r
+                                    InHandler));\r
     }\r
   DEBUG_CODE_END ();\r
 \r
     }\r
   DEBUG_CODE_END ();\r
 \r
@@ -234,16 +207,14 @@ Routine Description:
   Given an integer number, return the physical address of the entry point in the IFT\r
   \r
 Arguments:\r
   Given an integer number, return the physical address of the entry point in the IFT\r
   \r
 Arguments:\r
-  UINTN   HandlerIndex, \r
-  VOID    ** EntryPoint\r
+  HandlerIndex - Index of the Handler \r
+  EntryPoint   - IFT Entrypoint\r
 \r
 Returns:\r
 \r
   Nothing\r
   \r
 --*/\r
 \r
 Returns:\r
 \r
   Nothing\r
   \r
 --*/\r
-// TODO:    HandlerIndex - add argument and description to function comment\r
-// TODO:    EntryPoint - add argument and description to function comment\r
 {\r
   UINT8 *TempPtr;\r
 \r
 {\r
   UINT8 *TempPtr;\r
 \r
@@ -280,20 +251,17 @@ Routine Description:
   This is the worker function that installs and removes all handlers\r
   \r
 Arguments:\r
   This is the worker function that installs and removes all handlers\r
   \r
 Arguments:\r
-  IN  EFI_EXCEPTION_TYPE           ExceptionType,\r
-  IN  BUNDLE                       NewBundles[NUM_BUNDLES_IN_STUB],\r
-  IN  VOID                         (*NewCallback) ()\r
+  ExceptionType  - Exception Type\r
+  NewBundles     - New Boundles\r
+  NewCallback    - New Callback\r
 \r
 Returns:\r
 \r
   EFI_STATUS - any return other than EFI_SUCCESS indicates the request was not\r
   satisfied.\r
 \r
 Returns:\r
 \r
   EFI_STATUS - any return other than EFI_SUCCESS indicates the request was not\r
   satisfied.\r
+  EFI_ALEADY_STARTED - Ivt already hooked.\r
   \r
 --*/\r
   \r
 --*/\r
-// TODO:    ExceptionType - add argument and description to function comment\r
-// TODO:    ] - add argument and description to function comment\r
-// TODO:    ) - add argument and description to function comment\r
-// TODO:    EFI_ALREADY_STARTED - add return value to function comment\r
 {\r
   BUNDLE  *B0Ptr;\r
   UINT64  InterruptFlags;\r
 {\r
   BUNDLE  *B0Ptr;\r
   UINT64  InterruptFlags;\r
@@ -367,18 +335,15 @@ Routine Description:
   to store the ExceptionType and then call the common handler.\r
   \r
 Arguments:\r
   to store the ExceptionType and then call the common handler.\r
   \r
 Arguments:\r
-  IN  EFI_EXCEPTION_TYPE  ExceptionType,\r
-  IN  BUNDLE              NewBundles[4],\r
-  IN  VOID                (*NewCallback) ()\r
+  ExceptionType  - Exception Type\r
+  NewBundles     - New Boundles\r
+  NewCallback    - New Callback\r
 \r
 Returns:\r
 \r
   Nothing\r
     \r
 --*/\r
 \r
 Returns:\r
 \r
   Nothing\r
     \r
 --*/\r
-// TODO:    ExceptionType - add argument and description to function comment\r
-// TODO:    ] - add argument and description to function comment\r
-// TODO:    ) - add argument and description to function comment\r
 {\r
   BUNDLE  *FixupBundle;\r
   BUNDLE  *B0Ptr;\r
 {\r
   BUNDLE  *FixupBundle;\r
   BUNDLE  *B0Ptr;\r
@@ -422,14 +387,15 @@ Routine Description:
   Restores original IVT contents when unregistering a callback function\r
   \r
 Arguments:\r
   Restores original IVT contents when unregistering a callback function\r
   \r
 Arguments:\r
-  IN  EFI_EXCEPTION_TYPE  ExceptionType,\r
+  ExceptionType  - Exception Type\r
+  NewBundles     - New Boundles\r
+  NewCallback    - New Callback\r
 \r
 Returns:\r
 \r
   Nothing\r
     \r
 --*/\r
 \r
 Returns:\r
 \r
   Nothing\r
     \r
 --*/\r
-// TODO:    ExceptionType - add argument and description to function comment\r
 {\r
   BUNDLE  *B0Ptr;\r
 \r
 {\r
   BUNDLE  *B0Ptr;\r
 \r
@@ -460,14 +426,13 @@ Routine Description:
   Records new callback in IvtEntryTable.\r
   \r
 Arguments:\r
   Records new callback in IvtEntryTable.\r
   \r
 Arguments:\r
-  IN  VOID  (*NewCallback) ()\r
+  NewCallback    - New Callback\r
 \r
 Returns:\r
 \r
   Nothing\r
     \r
 --*/\r
 \r
 Returns:\r
 \r
   Nothing\r
     \r
 --*/\r
-// TODO:    ) - add argument and description to function comment\r
 {\r
   VOID  *Start;\r
 \r
 {\r
   VOID  *Start;\r
 \r
@@ -522,12 +487,13 @@ Routine Description: This is a DebugSupport protocol member function.  Hard
   coded to support only 1 processor for now.\r
 \r
 Arguments:\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
 \r
-Returns: Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0\r
+Returns:\r
+  Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0\r
 \r
 --*/\r
 \r
 --*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    MaxProcessorIndex - add argument and description to function comment\r
 {\r
   *MaxProcessorIndex = 0;\r
   return (EFI_SUCCESS);\r
 {\r
   *MaxProcessorIndex = 0;\r
   return (EFI_SUCCESS);\r
@@ -546,18 +512,15 @@ Routine Description:
   DebugSupport protocol member function\r
 \r
 Arguments:\r
   DebugSupport protocol member function\r
 \r
 Arguments:\r
-  IN EFI_DEBUG_SUPPORT_PROTOCOL   *This,\r
-  IN UINTN                        ProcessorIndex,\r
-  IN EFI_PERIODIC_CALLBACK        NewPeriodicCallback\r
+  This             - The DebugSupport instance\r
+  ProcessorIndex   - Which processor the callback applies to.\r
+  PeriodicCallback - Callback function\r
 \r
 Returns:\r
 \r
   EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
 \r
 --*/\r
 \r
 Returns:\r
 \r
   EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
 \r
 --*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    ProcessorIndex - add argument and description to function comment\r
-// TODO:    NewPeriodicCallback - add argument and description to function comment\r
 {\r
   return ManageIvtEntryTable (EXCEPT_IPF_EXTERNAL_INTERRUPT, NULL, NewPeriodicCallback);\r
 }\r
 {\r
   return ManageIvtEntryTable (EXCEPT_IPF_EXTERNAL_INTERRUPT, NULL, NewPeriodicCallback);\r
 }\r
@@ -576,19 +539,16 @@ Routine Description:
   DebugSupport protocol member function\r
 \r
 Arguments:\r
   DebugSupport protocol member function\r
 \r
 Arguments:\r
-  IN EFI_DEBUG_SUPPORT_PROTOCOL   *This,\r
-  IN EFI_EXCEPTION_CALLBACK       NewCallback,\r
-  IN EFI_EXCEPTION_TYPE           ExceptionType\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
   EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
 \r
 --*/\r
 \r
 Returns:\r
 \r
   EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.\r
 \r
 --*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    ProcessorIndex - add argument and description to function comment\r
-// TODO:    NewCallback - add argument and description to function comment\r
-// TODO:    ExceptionType - add argument and description to function comment\r
 {\r
   return ManageIvtEntryTable (\r
           ExceptionType,\r
 {\r
   return ManageIvtEntryTable (\r
           ExceptionType,\r
@@ -611,15 +571,15 @@ Routine Description:
   DebugSupport protocol member function.  Calls assembly routine to flush cache.\r
 \r
 Arguments:\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
 Returns:\r
   EFI_SUCCESS\r
 \r
 --*/\r
 \r
 Returns:\r
   EFI_SUCCESS\r
 \r
 --*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    ProcessorIndex - add argument and description to function comment\r
-// TODO:    Start - add argument and description to function comment\r
-// TODO:    Length - add argument and description to function comment\r
 {\r
   InstructionCacheFlush (Start, Length);\r
   return (EFI_SUCCESS);\r
 {\r
   InstructionCacheFlush (Start, Length);\r
   return (EFI_SUCCESS);\r