]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Library / SmmSmiHandlerProfileLib / SmmSmiHandlerProfileLib.c
index 2edc71be3efbb50ccc77548225a62956c16baa82..da8cee7f15049c82c934facbca0ad3769d6318f8 100644 (file)
@@ -2,87 +2,17 @@
   SMM driver instance of SmiHandlerProfile Library.\r
 \r
   Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
-  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) Microsoft Corporation.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
-#include <PiSmm.h>\r
-#include <Library/SmiHandlerProfileLib.h>\r
-#include <Library/SmmServicesTableLib.h>\r
-#include <Guid/SmiHandlerProfile.h>\r
-\r
-SMI_HANDLER_PROFILE_PROTOCOL  *mSmiHandlerProfile;\r
-\r
-/**\r
-  This function is called by SmmChildDispatcher module to report\r
-  a new SMI handler is registered, to SmmCore.\r
-\r
-  @param HandlerGuid     The GUID to identify the type of the handler.\r
-                         For the SmmChildDispatch protocol, the HandlerGuid\r
-                         must be the GUID of SmmChildDispatch protocol.\r
-  @param Handler         The SMI handler.\r
-  @param CallerAddress   The address of the module who registers the SMI handler.\r
-  @param Context         The context of the SMI handler.\r
-                         For the SmmChildDispatch protocol, the Context\r
-                         must match the one defined for SmmChildDispatch protocol.\r
-  @param ContextSize     The size of the context in bytes.\r
-                         For the SmmChildDispatch protocol, the Context\r
-                         must match the one defined for SmmChildDispatch protocol.\r
-\r
-  @retval EFI_SUCCESS           The information is recorded.\r
-  @retval EFI_UNSUPPORTED       The feature is unsupported.\r
-  @retval EFI_OUT_OF_RESOURCES  There is no enough resource to record the information.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmiHandlerProfileRegisterHandler (\r
-  IN EFI_GUID                       *HandlerGuid,\r
-  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler,\r
-  IN PHYSICAL_ADDRESS               CallerAddress,\r
-  IN VOID                           *Context, OPTIONAL\r
-  IN UINTN                          ContextSize OPTIONAL\r
-  )\r
-{\r
-  if (mSmiHandlerProfile != NULL) {\r
-    return mSmiHandlerProfile->RegisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, CallerAddress, Context, ContextSize);\r
-  }\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
-  This function is called by SmmChildDispatcher module to report\r
-  an existing SMI handler is unregistered, to SmmCore.\r
+#include <PiMm.h>\r
 \r
-  @param HandlerGuid     The GUID to identify the type of the handler.\r
-                         For the SmmChildDispatch protocol, the HandlerGuid\r
-                         must be the GUID of SmmChildDispatch protocol.\r
-  @param Handler         The SMI handler.\r
-\r
-  @retval EFI_SUCCESS           The original record is removed.\r
-  @retval EFI_UNSUPPORTED       The feature is unsupported.\r
-  @retval EFI_NOT_FOUND         There is no record for the HandlerGuid and handler.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmiHandlerProfileUnregisterHandler (\r
-  IN EFI_GUID                       *HandlerGuid,\r
-  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler\r
-  )\r
-{\r
-  if (mSmiHandlerProfile != NULL) {\r
-    return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler);\r
-  }\r
-  return EFI_UNSUPPORTED;\r
-}\r
+#include "MmSmiHandlerProfileLib.h"\r
 \r
 /**\r
-  The constructor function for SMI handler profile.\r
+  The constructor function for traditional MM SMI handler profile.\r
 \r
   @param  ImageHandle   The firmware allocated handle for the EFI image.\r
   @param  SystemTable   A pointer to the EFI System Table.\r
@@ -96,11 +26,5 @@ SmmSmiHandlerProfileLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  gSmst->SmmLocateProtocol (\r
-           &gSmiHandlerProfileGuid,\r
-           NULL,\r
-           (VOID **) &mSmiHandlerProfile\r
-           );\r
-  return EFI_SUCCESS;\r
+  return MmSmiHandlerProfileLibInitialization ();\r
 }\r
-\r