Support functions for UEFI protocol notification infrastructure.\r
\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
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
LIST_ENTRY *Link;\r
\r
ProtEntry = Prot->Protocol;\r
- for (Link=ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {\r
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
+ for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {\r
+ ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
ProtNotify->Function (&ProtEntry->ProtocolID, Prot->Interface, Prot->Handle);\r
}\r
}\r
\r
Prot = SmmFindProtocolInterface (Handle, Protocol, Interface);\r
if (Prot != NULL) {\r
-\r
ProtEntry = Prot->Protocol;\r
\r
//\r
// If there's a protocol notify location pointing to this entry, back it up one\r
//\r
- for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {\r
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
+ for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {\r
+ ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
\r
if (ProtNotify->Position == &Prot->ByProtocol) {\r
ProtNotify->Position = Prot->ByProtocol.BackLink;\r
LIST_ENTRY *Link;\r
EFI_STATUS Status;\r
\r
- if (Protocol == NULL || Registration == NULL) {\r
+ if ((Protocol == NULL) || (Registration == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
// Get the protocol entry per Protocol\r
//\r
- ProtEntry = SmmFindProtocolEntry ((EFI_GUID *) Protocol, FALSE);\r
+ ProtEntry = SmmFindProtocolEntry ((EFI_GUID *)Protocol, FALSE);\r
if (ProtEntry != NULL) {\r
- ProtNotify = (PROTOCOL_NOTIFY * )*Registration;\r
+ ProtNotify = (PROTOCOL_NOTIFY *)*Registration;\r
for (Link = ProtEntry->Notify.ForwardLink;\r
Link != &ProtEntry->Notify;\r
- Link = Link->ForwardLink) {\r
+ Link = Link->ForwardLink)\r
+ {\r
//\r
// Compare the notification record\r
//\r
- if (ProtNotify == (CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE))){\r
+ if (ProtNotify == (CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE))) {\r
//\r
// If Registration is an existing registration, then unhook it\r
//\r
}\r
}\r
}\r
+\r
//\r
// If the registration is not found\r
//\r
//\r
// Get the protocol entry to add the notification too\r
//\r
- ProtEntry = SmmFindProtocolEntry ((EFI_GUID *) Protocol, TRUE);\r
+ ProtEntry = SmmFindProtocolEntry ((EFI_GUID *)Protocol, TRUE);\r
if (ProtEntry != NULL) {\r
//\r
// Find whether notification already exist\r
//\r
for (Link = ProtEntry->Notify.ForwardLink;\r
Link != &ProtEntry->Notify;\r
- Link = Link->ForwardLink) {\r
-\r
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
+ Link = Link->ForwardLink)\r
+ {\r
+ ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
if (CompareGuid (&ProtNotify->Protocol->ProtocolID, Protocol) &&\r
- (ProtNotify->Function == Function)) {\r
-\r
+ (ProtNotify->Function == Function))\r
+ {\r
//\r
// Notification already exist\r
//\r
//\r
// Allocate a new notification record\r
//\r
- ProtNotify = AllocatePool (sizeof(PROTOCOL_NOTIFY));\r
+ ProtNotify = AllocatePool (sizeof (PROTOCOL_NOTIFY));\r
if (ProtNotify != NULL) {\r
ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;\r
- ProtNotify->Protocol = ProtEntry;\r
- ProtNotify->Function = Function;\r
+ ProtNotify->Protocol = ProtEntry;\r
+ ProtNotify->Function = Function;\r
//\r
// Start at the ending\r
//\r
Status = EFI_OUT_OF_RESOURCES;\r
if (ProtNotify != NULL) {\r
*Registration = ProtNotify;\r
- Status = EFI_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
}\r
+\r
return Status;\r
}\r