//\r
// Make sure ControllerHandle is valid\r
//\r
+ CoreAcquireProtocolLock ();\r
+\r
Status = CoreValidateHandle (ControllerHandle);\r
+\r
+ CoreReleaseProtocolLock ();\r
+\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
//\r
// Make sure the DriverBindingHandle is valid\r
//\r
+ CoreAcquireProtocolLock ();\r
+\r
Status = CoreValidateHandle (DriverBindingHandle);\r
+\r
+ CoreReleaseProtocolLock ();\r
+\r
if (EFI_ERROR (Status)) {\r
return;\r
}\r
//\r
// Make sure ControllerHandle is valid\r
//\r
+ CoreAcquireProtocolLock ();\r
+\r
Status = CoreValidateHandle (ControllerHandle);\r
if (EFI_ERROR (Status)) {\r
+ CoreReleaseProtocolLock ();\r
return Status;\r
}\r
\r
if (ChildHandle != NULL) {\r
Status = CoreValidateHandle (ChildHandle);\r
if (EFI_ERROR (Status)) {\r
+ CoreReleaseProtocolLock ();\r
return Status;\r
}\r
}\r
\r
+ CoreReleaseProtocolLock ();\r
+\r
Handle = ControllerHandle;\r
\r
//\r
\r
/**\r
Check whether a handle is a valid EFI_HANDLE\r
+ The gProtocolDatabaseLock must be owned\r
\r
@param UserHandle The handle to check\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ ASSERT_LOCKED(&gProtocolDatabaseLock);\r
+\r
for (Link = gHandleList.BackLink; Link != &gHandleList; Link = Link->BackLink) {\r
Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);\r
if (Handle == (IHANDLE *) UserHandle) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ //\r
+ // Lock the protocol database\r
+ //\r
+ CoreAcquireProtocolLock ();\r
+\r
//\r
// Check that UserHandle is a valid handle\r
//\r
Status = CoreValidateHandle (UserHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
\r
- //\r
- // Lock the protocol database\r
- //\r
- CoreAcquireProtocolLock ();\r
-\r
//\r
// Check that Protocol exists on UserHandle, and Interface matches the interface in the database\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ //\r
+ // Lock the protocol database\r
+ //\r
+ CoreAcquireProtocolLock ();\r
+\r
//\r
// Check for invalid UserHandle\r
//\r
Status = CoreValidateHandle (UserHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
\r
//\r
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :\r
Status = CoreValidateHandle (ImageHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
Status = CoreValidateHandle (ControllerHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
if (UserHandle == ControllerHandle) {\r
- return EFI_INVALID_PARAMETER;\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Done;\r
}\r
break;\r
case EFI_OPEN_PROTOCOL_BY_DRIVER :\r
case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :\r
Status = CoreValidateHandle (ImageHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
Status = CoreValidateHandle (ControllerHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
break;\r
case EFI_OPEN_PROTOCOL_EXCLUSIVE :\r
Status = CoreValidateHandle (ImageHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
break;\r
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :\r
case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :\r
break;\r
default:\r
- return EFI_INVALID_PARAMETER;\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Done;\r
}\r
\r
- //\r
- // Lock the protocol database\r
- //\r
- CoreAcquireProtocolLock ();\r
\r
//\r
// Look at each protocol interface for a match\r
LIST_ENTRY *Link;\r
OPEN_PROTOCOL_DATA *OpenData;\r
\r
+ //\r
+ // Lock the protocol database\r
+ //\r
+ CoreAcquireProtocolLock ();\r
+\r
//\r
// Check for invalid parameters\r
//\r
Status = CoreValidateHandle (UserHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
Status = CoreValidateHandle (AgentHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
if (ControllerHandle != NULL) {\r
Status = CoreValidateHandle (ControllerHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Done;\r
}\r
}\r
if (Protocol == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Done;\r
}\r
\r
- //\r
- // Lock the protocol database\r
- //\r
- CoreAcquireProtocolLock ();\r
-\r
//\r
// Look at each protocol interface for a match\r
//\r
UINTN ProtocolCount;\r
EFI_GUID **Buffer;\r
\r
- Status = CoreValidateHandle (UserHandle);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- Handle = (IHANDLE *)UserHandle;\r
-\r
if (ProtocolBuffer == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
CoreAcquireProtocolLock ();\r
\r
+ Status = CoreValidateHandle (UserHandle);\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ Handle = (IHANDLE *)UserHandle;\r
+\r
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {\r
ProtocolCount++;\r
}\r