]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DebugSupportDxe/DebugSupport.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / DebugSupport.c
index 33f2ad12692decbb37b1c59d74d9defe59137ed6..349a932b0652d9014f2b6920b07b159acf236aad 100644 (file)
@@ -1,26 +1,14 @@
 /** @file\r
   Top level C file for debug support driver.  Contains initialization function.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\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
-http://opensource.org/licenses/bsd-license.php\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
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
-//\r
-// private header files\r
-//\r
-#include "plDebugSupport.h"\r
+#include "PlDebugSupport.h"\r
 \r
-//\r
-// This is a global that is the actual interface\r
-//\r
-EFI_DEBUG_SUPPORT_PROTOCOL  gDebugSupportProtocolInterface = {\r
+EFI_DEBUG_SUPPORT_PROTOCOL  mDebugSupportProtocolInterface = {\r
   EFI_ISA,\r
   GetMaximumProcessorIndex,\r
   RegisterPeriodicCallback,\r
@@ -28,31 +16,26 @@ EFI_DEBUG_SUPPORT_PROTOCOL  gDebugSupportProtocolInterface = {
   InvalidateInstructionCache\r
 };\r
 \r
-//\r
-// Driver Entry Point\r
-//\r
-EFI_STATUS\r
-InitializeDebugSupportDriver (\r
-  IN EFI_HANDLE               ImageHandle,\r
-  IN EFI_SYSTEM_TABLE         *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Driver entry point.  Checks to see there's not already a DebugSupport protocol\r
-  installed for the selected processor before installing protocol.\r
+/**\r
+  Debug Support Driver entry point.\r
 \r
-Arguments:\r
-  IN EFI_HANDLE               ImageHandle,\r
-  IN EFI_SYSTEM_TABLE         *SystemTable\r
+  Checks to see if there's not already a Debug Support protocol installed for\r
+  the selected processor before installing it.\r
 \r
-Returns:\r
+  @param[in] ImageHandle       The firmware allocated handle for the EFI image.\r
+  @param[in] SystemTable       A pointer to the EFI System Table.\r
 \r
-  EFI_STATUS\r
+  @retval EFI_SUCCESS          The entry point is executed successfully.\r
+  @retval EFI_ALREADY_STARTED  Debug Support protocol is installed already.\r
+  @retval other                Some error occurs when executing this entry point.\r
 \r
---*/\r
-// TODO:    ImageHandle - add argument and description to function comment\r
-// TODO:    SystemTable - add argument and description to function comment\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeDebugSupportDriver (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
 {\r
   EFI_LOADED_IMAGE_PROTOCOL   *LoadedImageProtocolPtr;\r
   EFI_STATUS                  Status;\r
@@ -61,8 +44,6 @@ Returns:
   UINTN                       NumHandles;\r
   EFI_DEBUG_SUPPORT_PROTOCOL  *DebugSupportProtocolPtr;\r
 \r
-  //\r
-  //  Install Protocol Interface...\r
   //\r
   // First check to see that the debug support protocol for this processor\r
   // type is not already installed\r
@@ -81,17 +62,21 @@ Returns:
       Status = gBS->OpenProtocol (\r
                       HandlePtr[NumHandles],\r
                       &gEfiDebugSupportProtocolGuid,\r
-                      (VOID **) &DebugSupportProtocolPtr,\r
+                      (VOID **)&DebugSupportProtocolPtr,\r
                       ImageHandle,\r
                       NULL,\r
                       EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
                       );\r
-      if (Status == EFI_SUCCESS && DebugSupportProtocolPtr->Isa == EFI_ISA) {\r
+      if ((Status == EFI_SUCCESS) && (DebugSupportProtocolPtr->Isa == EFI_ISA)) {\r
+        //\r
+        // a Debug Support protocol has been installed for this processor\r
+        //\r
         FreePool (HandlePtr);\r
         Status = EFI_ALREADY_STARTED;\r
         goto ErrExit;\r
       }\r
     } while (NumHandles > 0);\r
+\r
     FreePool (HandlePtr);\r
   }\r
 \r
@@ -101,7 +86,7 @@ Returns:
   Status = gBS->OpenProtocol (\r
                   ImageHandle,\r
                   &gEfiLoadedImageProtocolGuid,\r
-                  (VOID **) &LoadedImageProtocolPtr,\r
+                  (VOID **)&LoadedImageProtocolPtr,\r
                   ImageHandle,\r
                   NULL,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -111,26 +96,26 @@ Returns:
     goto ErrExit;\r
   }\r
 \r
-  LoadedImageProtocolPtr->Unload = plUnloadDebugSupportDriver;\r
+  LoadedImageProtocolPtr->Unload = PlUnloadDebugSupportDriver;\r
 \r
   //\r
-  // Call hook for platform specific initialization\r
+  // Call hook for processor specific initialization\r
   //\r
-  Status = plInitializeDebugSupportDriver ();\r
+  Status = PlInitializeDebugSupportDriver ();\r
   ASSERT (!EFI_ERROR (Status));\r
   if (Status != EFI_SUCCESS) {\r
     goto ErrExit;\r
   }\r
 \r
   //\r
-  // Install DebugSupport protocol to new handle\r
+  // Install Debug Support protocol to new handle\r
   //\r
   Handle = NULL;\r
   Status = gBS->InstallProtocolInterface (\r
                   &Handle,\r
                   &gEfiDebugSupportProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
-                  &gDebugSupportProtocolInterface\r
+                  &mDebugSupportProtocolInterface\r
                   );\r
   ASSERT (!EFI_ERROR (Status));\r
   if (Status != EFI_SUCCESS) {\r