//\r
// ProtocolRequest - Last LocateHandle request ID\r
//\r
-UINTN mEfiLocateHandleRequest = 0;\r
+UINTN mEfiLocateHandleRequest = 0;\r
\r
//\r
// Internal prototypes\r
//\r
\r
typedef struct {\r
- EFI_GUID *Protocol;\r
- VOID *SearchKey;\r
- LIST_ENTRY *Position;\r
- PROTOCOL_ENTRY *ProtEntry;\r
+ EFI_GUID *Protocol;\r
+ VOID *SearchKey;\r
+ LIST_ENTRY *Position;\r
+ PROTOCOL_ENTRY *ProtEntry;\r
} LOCATE_POSITION;\r
\r
typedef\r
IHANDLE *\r
-(* CORE_GET_NEXT) (\r
- IN OUT LOCATE_POSITION *Position,\r
- OUT VOID **Interface\r
+(*CORE_GET_NEXT) (\r
+ IN OUT LOCATE_POSITION *Position,\r
+ OUT VOID **Interface\r
);\r
\r
/**\r
OUT VOID **Interface\r
)\r
{\r
- IHANDLE *Handle;\r
+ IHANDLE *Handle;\r
\r
//\r
// Next handle\r
//\r
// If not at the end of the list, get the handle\r
//\r
- Handle = NULL;\r
- *Interface = NULL;\r
+ Handle = NULL;\r
+ *Interface = NULL;\r
if (Position->Position != &gHandleList) {\r
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);\r
}\r
+\r
return Handle;\r
}\r
\r
PROTOCOL_INTERFACE *Prot;\r
LIST_ENTRY *Link;\r
\r
- Handle = NULL;\r
- *Interface = NULL;\r
+ Handle = NULL;\r
+ *Interface = NULL;\r
ProtNotify = Position->SearchKey;\r
\r
//\r
//\r
Link = ProtNotify->Position->ForwardLink;\r
if (Link != &ProtNotify->Protocol->Protocols) {\r
- Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);\r
- Handle = Prot->Handle;\r
+ Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);\r
+ Handle = Prot->Handle;\r
*Interface = Prot->Interface;\r
}\r
}\r
+\r
return Handle;\r
}\r
\r
LIST_ENTRY *Link;\r
PROTOCOL_INTERFACE *Prot;\r
\r
- Handle = NULL;\r
- *Interface = NULL;\r
- for (; ;) {\r
+ Handle = NULL;\r
+ *Interface = NULL;\r
+ for ( ; ;) {\r
//\r
// Next entry\r
//\r
- Link = Position->Position->ForwardLink;\r
+ Link = Position->Position->ForwardLink;\r
Position->Position = Link;\r
\r
//\r
//\r
// Get the handle\r
//\r
- Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);\r
- Handle = Prot->Handle;\r
+ Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);\r
+ Handle = Prot->Handle;\r
*Interface = Prot->Interface;\r
\r
//\r
break;\r
}\r
}\r
+\r
return Handle;\r
}\r
\r
OUT VOID **Interface\r
)\r
{\r
- EFI_STATUS Status;\r
- LOCATE_POSITION Position;\r
- PROTOCOL_NOTIFY *ProtNotify;\r
- IHANDLE *Handle;\r
+ EFI_STATUS Status;\r
+ LOCATE_POSITION Position;\r
+ PROTOCOL_NOTIFY *ProtNotify;\r
+ IHANDLE *Handle;\r
\r
if ((Interface == NULL) || (Protocol == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
*Interface = NULL;\r
- Status = EFI_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
\r
//\r
// Set initial position\r
if (Position.ProtEntry == NULL) {\r
return EFI_NOT_FOUND;\r
}\r
+\r
Position.Position = &Position.ProtEntry->Protocols;\r
\r
Handle = MmGetNextLocateByProtocol (&Position, Interface);\r
// If this is a search by register notify and a handle was\r
// returned, update the register notification position\r
//\r
- ProtNotify = Registration;\r
+ ProtNotify = Registration;\r
ProtNotify->Position = ProtNotify->Position->ForwardLink;\r
}\r
\r
Position.SearchKey = SearchKey;\r
Position.Position = &gHandleList;\r
\r
- ResultSize = 0;\r
- ResultBuffer = (IHANDLE **) Buffer;\r
- Status = EFI_SUCCESS;\r
+ ResultSize = 0;\r
+ ResultBuffer = (IHANDLE **)Buffer;\r
+ Status = EFI_SUCCESS;\r
\r
//\r
// Get the search function based on type\r
//\r
switch (SearchType) {\r
- case AllHandles:\r
- GetNext = MmGetNextLocateAllHandles;\r
- break;\r
+ case AllHandles:\r
+ GetNext = MmGetNextLocateAllHandles;\r
+ break;\r
\r
- case ByRegisterNotify:\r
- GetNext = MmGetNextLocateByRegisterNotify;\r
- //\r
- // Must have SearchKey for locate ByRegisterNotify\r
- //\r
- if (SearchKey == NULL) {\r
- Status = EFI_INVALID_PARAMETER;\r
- }\r
- break;\r
+ case ByRegisterNotify:\r
+ GetNext = MmGetNextLocateByRegisterNotify;\r
+ //\r
+ // Must have SearchKey for locate ByRegisterNotify\r
+ //\r
+ if (SearchKey == NULL) {\r
+ Status = EFI_INVALID_PARAMETER;\r
+ }\r
\r
- case ByProtocol:\r
- GetNext = MmGetNextLocateByProtocol;\r
- if (Protocol == NULL) {\r
- Status = EFI_INVALID_PARAMETER;\r
break;\r
- }\r
- //\r
- // Look up the protocol entry and set the head pointer\r
- //\r
- Position.ProtEntry = MmFindProtocolEntry (Protocol, FALSE);\r
- if (Position.ProtEntry == NULL) {\r
- Status = EFI_NOT_FOUND;\r
+\r
+ case ByProtocol:\r
+ GetNext = MmGetNextLocateByProtocol;\r
+ if (Protocol == NULL) {\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Look up the protocol entry and set the head pointer\r
+ //\r
+ Position.ProtEntry = MmFindProtocolEntry (Protocol, FALSE);\r
+ if (Position.ProtEntry == NULL) {\r
+ Status = EFI_NOT_FOUND;\r
+ break;\r
+ }\r
+\r
+ Position.Position = &Position.ProtEntry->Protocols;\r
break;\r
- }\r
- Position.Position = &Position.ProtEntry->Protocols;\r
- break;\r
\r
- default:\r
- Status = EFI_INVALID_PARAMETER;\r
- break;\r
+ default:\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
}\r
\r
if (EFI_ERROR (Status)) {\r
// Enumerate out the matching handles\r
//\r
mEfiLocateHandleRequest += 1;\r
- for (; ;) {\r
+ for ( ; ;) {\r
//\r
// Get the next handle. If no more handles, stop\r
//\r
//\r
ResultSize += sizeof (Handle);\r
if (ResultSize <= *BufferSize) {\r
- *ResultBuffer = Handle;\r
- ResultBuffer += 1;\r
+ *ResultBuffer = Handle;\r
+ ResultBuffer += 1;\r
}\r
}\r
\r
\r
*BufferSize = ResultSize;\r
\r
- if (SearchType == ByRegisterNotify && !EFI_ERROR (Status)) {\r
+ if ((SearchType == ByRegisterNotify) && !EFI_ERROR (Status)) {\r
ASSERT (SearchKey != NULL);\r
//\r
// If this is a search by register notify and a handle was\r
// returned, update the register notification position\r
//\r
- ProtNotify = SearchKey;\r
+ ProtNotify = SearchKey;\r
ProtNotify->Position = ProtNotify->Position->ForwardLink;\r
}\r
}\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- BufferSize = 0;\r
+ BufferSize = 0;\r
*NumberHandles = 0;\r
- *Buffer = NULL;\r
- Status = MmLocateHandle (\r
- SearchType,\r
- Protocol,\r
- SearchKey,\r
- &BufferSize,\r
- *Buffer\r
- );\r
+ *Buffer = NULL;\r
+ Status = MmLocateHandle (\r
+ SearchType,\r
+ Protocol,\r
+ SearchKey,\r
+ &BufferSize,\r
+ *Buffer\r
+ );\r
//\r
// LocateHandleBuffer() returns incorrect status code if SearchType is\r
// invalid.\r
//\r
// Add code to correctly handle expected errors from MmLocateHandle().\r
//\r
- if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {\r
+ if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {\r
if (Status != EFI_INVALID_PARAMETER) {\r
Status = EFI_NOT_FOUND;\r
}\r
+\r
return Status;\r
}\r
\r
*Buffer\r
);\r
\r
- *NumberHandles = BufferSize / sizeof(EFI_HANDLE);\r
+ *NumberHandles = BufferSize / sizeof (EFI_HANDLE);\r
if (EFI_ERROR (Status)) {\r
*NumberHandles = 0;\r
}\r