/** @file\r
Support functions for UEFI protocol notification infrastructure.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available \r
- under the terms and conditions of the BSD License which accompanies this \r
- distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials are licensed and made available\r
+ under the terms and conditions of the BSD License which accompanies this\r
+ 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
+ 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
**/\r
\r
@param Function Points to the notification function\r
@param Registration Returns the registration record\r
\r
- @retval EFI_INVALID_PARAMETER Invalid parameter\r
@retval EFI_SUCCESS Successfully returned the registration record\r
- that has been added\r
+ that has been added or unhooked\r
+ @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request\r
+ @retval EFI_NOT_FOUND If the registration is not found when Function == NULL\r
\r
**/\r
EFI_STATUS\r
LIST_ENTRY *Link;\r
EFI_STATUS Status;\r
\r
- if ((Protocol == NULL) || (Function == NULL) || (Registration == NULL)) {\r
+ if (Protocol == NULL || Registration == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ if (Function == NULL) {\r
+ //\r
+ // Get the protocol entry per Protocol\r
+ //\r
+ ProtEntry = SmmFindProtocolEntry ((EFI_GUID *) Protocol, FALSE);\r
+ if (ProtEntry != NULL) {\r
+ ProtNotify = (PROTOCOL_NOTIFY * )*Registration;\r
+ for (Link = ProtEntry->Notify.ForwardLink;\r
+ Link != &ProtEntry->Notify;\r
+ Link = Link->ForwardLink) {\r
+ //\r
+ // Compare the notification record\r
+ //\r
+ if (ProtNotify == (CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE))){\r
+ //\r
+ // If Registration is an existing registration, then unhook it\r
+ //\r
+ ProtNotify->Signature = 0;\r
+ RemoveEntryList (&ProtNotify->Link);\r
+ FreePool (ProtNotify);\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+ }\r
+ //\r
+ // If the registration is not found\r
+ //\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
ProtNotify = NULL;\r
\r
//\r