]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c
Perfect the msa of the following modules, DiskIo, Partition, English and Ebc.
[mirror_edk2.git] / EdkModulePkg / Universal / DebugSupport / Dxe / Ia32 / plDebugSupport.c
index 2198192a0402cd0de8086b78b0312ca83bb8efcd..270a158b7972e221e63723ecc67128a6e16c38ed 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
+/**@file\r
+  IA32 specific debug support functions\r
+  \r
+Copyright (c) 2006 Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -9,17 +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
-Module Name:\r
-\r
-    plDebugSupport.c\r
-\r
-Abstract:\r
-\r
-    IA32 specific debug support functions\r
-\r
-Revision History\r
-\r
---*/\r
+**/\r
 \r
 //\r
 // private header files\r
@@ -54,16 +45,15 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_STATUS  Status;\r
   UINT8       *StubCopy;\r
 \r
   //\r
   // First, allocate a new buffer and copy the stub code into it\r
   //\r
-  Status = gBS->AllocatePool (EfiBootServicesData, StubSize, Stub);\r
-  if (Status == EFI_SUCCESS) {\r
+  *Stub = AllocatePool (StubSize);\r
+  if (*Stub != NULL) {\r
     StubCopy = *Stub;\r
-    gBS->CopyMem (StubCopy, InterruptEntryStub, StubSize);\r
+    CopyMem (StubCopy, InterruptEntryStub, StubSize);\r
 \r
     //\r
     // Next fixup the stub code for this vector\r
@@ -87,9 +77,11 @@ Returns:
     // fixup the jump target to point to the common entry\r
     //\r
     *(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize];\r
+    \r
+    return EFI_SUCCESS;\r
   }\r
 \r
-  return Status;\r
+  return EFI_OUT_OF_RESOURCES;\r
 }\r
 \r
 STATIC\r
@@ -117,7 +109,6 @@ Returns:
   Other possibilities are passed through by CreateEntryStub\r
 \r
 --*/\r
-// TODO:    ) - add argument and description to function comment\r
 {\r
   BOOLEAN     OldIntFlagState;\r
   EFI_STATUS  Status;\r
@@ -154,20 +145,18 @@ Arguments:
 \r
 Returns:\r
   EFI_SUCCESS\r
-  Other values are passed through from FreePool\r
 \r
 --*/\r
 {\r
   BOOLEAN     OldIntFlagState;\r
-  EFI_STATUS  Status;\r
 \r
   OldIntFlagState = WriteInterruptFlag (0);\r
   WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc));\r
-  Status = gBS->FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry);\r
+  FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry);\r
   ZeroMem (&IdtEntryTable[ExceptionType], sizeof (IDT_ENTRY));\r
   WriteInterruptFlag (OldIntFlagState);\r
 \r
-  return (Status);\r
+  return EFI_SUCCESS;\r
 }\r
 #endif\r
 \r
@@ -199,7 +188,6 @@ Returns:
   Other possible return values are passed through from UnHookEntry and HookEntry.\r
 \r
 --*/\r
-// TODO:    ) - add argument and description to function comment\r
 {\r
   EFI_STATUS  Status;\r
 \r
@@ -246,12 +234,13 @@ GetMaximumProcessorIndex (
 Routine Description: This is a DebugSupport protocol member function.\r
 \r
 Arguments:\r
+  This              - The DebugSupport instance\r
+  MaxProcessorIndex - The maximuim supported processor index\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
-// 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
@@ -269,13 +258,20 @@ RegisterPeriodicCallback (
 Routine Description: This is a 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
 \r
 Returns:\r
 \r
+  EFI_SUCCESS\r
+  EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has\r
+                          no handler registered for it\r
+  EFI_ALREADY_STARTED   - requested install to a vector that already has a handler registered.\r
+\r
+  Other possible return values are passed through from UnHookEntry and HookEntry.\r
+\r
 --*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    ProcessorIndex - add argument and description to function comment\r
-// TODO:    PeriodicCallback - add argument and description to function comment\r
 {\r
   return ManageIdtEntryTable (PeriodicCallback, SYSTEM_TIMER_VECTOR);\r
 }\r
@@ -296,16 +292,21 @@ Routine Description:
   This code executes in boot services context.\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
-  None\r
+  EFI_SUCCESS\r
+  EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has\r
+                          no handler registered for it\r
+  EFI_ALREADY_STARTED   - requested install to a vector that already has a handler registered.\r
+\r
+  Other possible return values are passed through from UnHookEntry and HookEntry.\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 ManageIdtEntryTable (NewCallback, ExceptionType);\r
 }\r
@@ -322,21 +323,21 @@ InvalidateInstructionCache (
 \r
 Routine Description:\r
   This is a DebugSupport protocol member function.\r
-  For IA32, this is a no-op since the instruction and data caches are coherent.\r
+  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
 \r
-  None\r
+  EFI_SUCCESS - always return 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
-// TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
+  AsmWbinvd ();\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -358,9 +359,9 @@ Returns:
   EFI_SUCCESS\r
   EFI_UNSUPPORTED - if IA32 processor does not support FXSTOR/FXRSTOR instructions,\r
                     the context save will fail, so these processor's are not supported.\r
+  EFI_OUT_OF_RESOURCES - not resource to finish initialization\r
 \r
 --*/\r
-// TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment\r
 {\r
   if (!FxStorSupport ()) {\r
     return EFI_UNSUPPORTED;\r
@@ -393,10 +394,9 @@ Arguments:
 \r
 Returns:\r
 \r
-  None\r
+  EFI_SUCCESS - always return success\r
 \r
 --*/\r
-// TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
   EFI_EXCEPTION_TYPE  ExceptionType;\r
 \r
@@ -404,7 +404,7 @@ Returns:
     ManageIdtEntryTable (NULL, ExceptionType);\r
   }\r
 \r
-  gBS->FreePool (IdtEntryTable);\r
+  FreePool (IdtEntryTable);\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -420,14 +420,14 @@ Routine Description: Common piece of code that invokes the registered handlers.
   This code executes in exception context so no efi calls are allowed.\r
 \r
 Arguments:\r
+  ExceptionType - exception type\r
+  ContextRecord - system context\r
 \r
 Returns:\r
 \r
   None\r
 \r
 --*/\r
-// TODO:    ExceptionType - add argument and description to function comment\r
-// TODO:    ContextRecord - add argument and description to function comment\r
 {\r
   if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {\r
     if (ExceptionType != SYSTEM_TIMER_VECTOR) {\r