summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/PiSmmCore/Notify.c
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2013-11-05 13:32:32 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-11-05 13:32:32 +0000
commit50903aa5a81ae691a470d5d71fd900404730ec18 (patch)
tree99a6cfb959b2ab23b9b790d02818cd57c3f5bab9 /MdeModulePkg/Core/PiSmmCore/Notify.c
parent7baf3c69c5c24cc03de51561cfc4ba94da3e5359 (diff)
downloadedk2-50903aa5a81ae691a470d5d71fd900404730ec18.tar.gz
edk2-50903aa5a81ae691a470d5d71fd900404730ec18.tar.bz2
edk2-50903aa5a81ae691a470d5d71fd900404730ec18.zip
Support unhook notification function for Smst->SmmRegisterProtocolNotify() per PI specification.
Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14823 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/PiSmmCore/Notify.c')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/Notify.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/Notify.c b/MdeModulePkg/Core/PiSmmCore/Notify.c
index eb5059dd70..5ec0aa71a8 100644
--- a/MdeModulePkg/Core/PiSmmCore/Notify.c
+++ b/MdeModulePkg/Core/PiSmmCore/Notify.c
@@ -1,7 +1,7 @@
/** @file
Support functions for UEFI protocol notification infrastructure.
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -94,6 +94,8 @@ SmmRemoveInterfaceFromProtocol (
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully returned the registration record
that has been added
+ @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request
+ @retval EFI_NOT_FOUND If the registration is not found when Function == NULL
**/
EFI_STATUS
@@ -109,10 +111,40 @@ SmmRegisterProtocolNotify (
LIST_ENTRY *Link;
EFI_STATUS Status;
- if ((Protocol == NULL) || (Function == NULL) || (Registration == NULL)) {
+ if (Protocol == NULL || Registration == NULL) {
return EFI_INVALID_PARAMETER;
}
+ if (Function == NULL) {
+ //
+ // Get the protocol entry per Protocol
+ //
+ ProtEntry = SmmFindProtocolEntry ((EFI_GUID *) Protocol, FALSE);
+ if (ProtEntry != NULL) {
+ ProtNotify = (PROTOCOL_NOTIFY * )*Registration;
+ for (Link = ProtEntry->Notify.ForwardLink;
+ Link != &ProtEntry->Notify;
+ Link = Link->ForwardLink) {
+ //
+ // Compare the notification record
+ //
+ if (ProtNotify == (CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE))){
+ //
+ // If Registration is an existing registration, then unhook it
+ //
+ ProtNotify->Signature = 0;
+ RemoveEntryList (&ProtNotify->Link);
+ FreePool (ProtNotify);
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ //
+ // If the registration is not found
+ //
+ return EFI_NOT_FOUND;
+ }
+
ProtNotify = NULL;
//