]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/SmiHandlerProfile: Add Context support in Unregister
authorJiewen Yao <jiewen.yao@intel.com>
Fri, 10 Mar 2017 03:44:38 +0000 (11:44 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Mon, 13 Mar 2017 08:04:12 +0000 (16:04 +0800)
The reason is that we observe that a platform may use same Handler
for different context.

In order to support Unregister such handler, we have to input
context information as well.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
MdeModulePkg/Include/Guid/SmiHandlerProfile.h
MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.c

index b81631dcf4a504003625253e222911c2d9d69174..c5d29e889234295c2837cfafbb016af238494698 100644 (file)
@@ -150,6 +150,26 @@ extern EFI_GUID gSmiHandlerProfileGuid;
 \r
 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL  SMI_HANDLER_PROFILE_PROTOCOL;\r
 \r
 \r
 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL  SMI_HANDLER_PROFILE_PROTOCOL;\r
 \r
+/**\r
+  This function is called by SmmChildDispatcher module to report\r
+  a new SMI handler is registered, to SmmCore.\r
+\r
+  @param This            The protocol instance\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_OUT_OF_RESOURCES  There is no enough resource to record the information.\r
+**/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI  *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI  *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r
@@ -161,12 +181,31 @@ EFI_STATUS
   IN UINTN                          ContextSize OPTIONAL\r
   );\r
 \r
   IN UINTN                          ContextSize OPTIONAL\r
   );\r
 \r
+/**\r
+  This function is called by SmmChildDispatcher module to report\r
+  an existing SMI handler is unregistered, to SmmCore.\r
+\r
+  @param This            The protocol instance\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 Context         The context of the SMI handler.\r
+                         If it is NOT NULL, it will be used to check what is registered.\r
+  @param ContextSize     The size of the context in bytes.\r
+                         If Context is NOT NULL, it will be used to check what is registered.\r
+\r
+  @retval EFI_SUCCESS           The original record is removed.\r
+  @retval EFI_NOT_FOUND         There is no record for the HandlerGuid and handler.\r
+**/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI  *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (\r
   IN SMI_HANDLER_PROFILE_PROTOCOL   *This,\r
   IN EFI_GUID                       *HandlerGuid,\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI  *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (\r
   IN SMI_HANDLER_PROFILE_PROTOCOL   *This,\r
   IN EFI_GUID                       *HandlerGuid,\r
-  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler\r
+  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler,\r
+  IN VOID                           *Context, OPTIONAL\r
+  IN UINTN                          ContextSize OPTIONAL\r
   );\r
 \r
 struct _SMI_HANDLER_PROFILE_PROTOCOL {\r
   );\r
 \r
 struct _SMI_HANDLER_PROFILE_PROTOCOL {\r
index 2edc71be3efbb50ccc77548225a62956c16baa82..29116199718c0ba4da672cc0a167bbabb9ed9bc9 100644 (file)
@@ -63,6 +63,10 @@ SmiHandlerProfileRegisterHandler (
                          For the SmmChildDispatch protocol, the HandlerGuid\r
                          must be the GUID of SmmChildDispatch protocol.\r
   @param Handler         The SMI handler.\r
                          For the SmmChildDispatch protocol, the HandlerGuid\r
                          must be the GUID of SmmChildDispatch protocol.\r
   @param Handler         The SMI handler.\r
+  @param Context         The context of the SMI handler.\r
+                         If it is NOT NULL, it will be used to check what is registered.\r
+  @param ContextSize     The size of the context in bytes.\r
+                         If Context is NOT NULL, it will be used to check what is registered.\r
 \r
   @retval EFI_SUCCESS           The original record is removed.\r
   @retval EFI_UNSUPPORTED       The feature is unsupported.\r
 \r
   @retval EFI_SUCCESS           The original record is removed.\r
   @retval EFI_UNSUPPORTED       The feature is unsupported.\r
@@ -72,11 +76,13 @@ EFI_STATUS
 EFIAPI\r
 SmiHandlerProfileUnregisterHandler (\r
   IN EFI_GUID                       *HandlerGuid,\r
 EFIAPI\r
 SmiHandlerProfileUnregisterHandler (\r
   IN EFI_GUID                       *HandlerGuid,\r
-  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler\r
+  IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler,\r
+  IN VOID                           *Context, OPTIONAL\r
+  IN UINTN                          ContextSize OPTIONAL\r
   )\r
 {\r
   if (mSmiHandlerProfile != NULL) {\r
   )\r
 {\r
   if (mSmiHandlerProfile != NULL) {\r
-    return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler);\r
+    return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, Context, ContextSize);\r
   }\r
   return EFI_UNSUPPORTED;\r
 }\r
   }\r
   return EFI_UNSUPPORTED;\r
 }\r