MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@ -9,10 +9,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "DxeMain.h"
|
||||
#include "Handle.h"
|
||||
|
||||
|
||||
//
|
||||
// Driver Support Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Connects one or more drivers to a controller.
|
||||
|
||||
@ -48,22 +48,22 @@ CoreConnectController (
|
||||
IN BOOLEAN Recursive
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS ReturnStatus;
|
||||
IHANDLE *Handle;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *ProtLink;
|
||||
OPEN_PROTOCOL_DATA *OpenData;
|
||||
EFI_DEVICE_PATH_PROTOCOL *AlignedRemainingDevicePath;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
UINTN ChildHandleCount;
|
||||
UINTN Index;
|
||||
UINTN HandleFilePathSize;
|
||||
UINTN RemainingDevicePathSize;
|
||||
EFI_DEVICE_PATH_PROTOCOL *HandleFilePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FilePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempFilePath;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS ReturnStatus;
|
||||
IHANDLE *Handle;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *ProtLink;
|
||||
OPEN_PROTOCOL_DATA *OpenData;
|
||||
EFI_DEVICE_PATH_PROTOCOL *AlignedRemainingDevicePath;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
UINTN ChildHandleCount;
|
||||
UINTN Index;
|
||||
UINTN HandleFilePathSize;
|
||||
UINTN RemainingDevicePathSize;
|
||||
EFI_DEVICE_PATH_PROTOCOL *HandleFilePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FilePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempFilePath;
|
||||
|
||||
//
|
||||
// Make sure ControllerHandle is valid
|
||||
@ -87,25 +87,27 @@ CoreConnectController (
|
||||
ASSERT (HandleFilePath != NULL);
|
||||
FilePath = HandleFilePath;
|
||||
TempFilePath = NULL;
|
||||
if (RemainingDevicePath != NULL && !Recursive) {
|
||||
if ((RemainingDevicePath != NULL) && !Recursive) {
|
||||
HandleFilePathSize = GetDevicePathSize (HandleFilePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
RemainingDevicePathSize = GetDevicePathSize (RemainingDevicePath);
|
||||
TempFilePath = AllocateZeroPool (HandleFilePathSize + RemainingDevicePathSize);
|
||||
TempFilePath = AllocateZeroPool (HandleFilePathSize + RemainingDevicePathSize);
|
||||
ASSERT (TempFilePath != NULL);
|
||||
CopyMem (TempFilePath, HandleFilePath, HandleFilePathSize);
|
||||
CopyMem ((UINT8 *) TempFilePath + HandleFilePathSize, RemainingDevicePath, RemainingDevicePathSize);
|
||||
CopyMem ((UINT8 *)TempFilePath + HandleFilePathSize, RemainingDevicePath, RemainingDevicePathSize);
|
||||
FilePath = TempFilePath;
|
||||
}
|
||||
|
||||
Status = gSecurity2->FileAuthentication (
|
||||
gSecurity2,
|
||||
FilePath,
|
||||
NULL,
|
||||
0,
|
||||
FALSE
|
||||
);
|
||||
gSecurity2,
|
||||
FilePath,
|
||||
NULL,
|
||||
0,
|
||||
FALSE
|
||||
);
|
||||
if (TempFilePath != NULL) {
|
||||
FreePool (TempFilePath);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -169,15 +171,15 @@ CoreConnectController (
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Count ControllerHandle's children
|
||||
//
|
||||
for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink)
|
||||
{
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
ChildHandleCount++;
|
||||
@ -188,7 +190,7 @@ CoreConnectController (
|
||||
//
|
||||
// Allocate a handle buffer for ControllerHandle's children
|
||||
//
|
||||
ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof(EFI_HANDLE));
|
||||
ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof (EFI_HANDLE));
|
||||
if (ChildHandleBuffer == NULL) {
|
||||
CoreReleaseProtocolLock ();
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@ -198,10 +200,11 @@ CoreConnectController (
|
||||
// Fill in a handle buffer with ControllerHandle's children
|
||||
//
|
||||
for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink)
|
||||
{
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
ChildHandleBuffer[ChildHandleCount] = OpenData->ControllerHandle;
|
||||
@ -236,7 +239,6 @@ CoreConnectController (
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Add Driver Binding Protocols from Context Driver Image Handles to sorted
|
||||
Driver Binding Protocol list.
|
||||
@ -296,11 +298,11 @@ AddSortedDriverBindingProtocol (
|
||||
// Retrieve the Driver Binding Protocol associated with each Driver Binding Handle
|
||||
//
|
||||
Status = CoreHandleProtocol (
|
||||
DriverBindingHandleBuffer[Index],
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **) &DriverBinding
|
||||
);
|
||||
if (EFI_ERROR (Status) || DriverBinding == NULL) {
|
||||
DriverBindingHandleBuffer[Index],
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **)&DriverBinding
|
||||
);
|
||||
if (EFI_ERROR (Status) || (DriverBinding == NULL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -319,21 +321,22 @@ AddSortedDriverBindingProtocol (
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve the Driver Binding Protocol from DriverBindingHandle
|
||||
//
|
||||
Status = CoreHandleProtocol(
|
||||
Status = CoreHandleProtocol (
|
||||
DriverBindingHandle,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **) &DriverBinding
|
||||
(VOID **)&DriverBinding
|
||||
);
|
||||
//
|
||||
// If DriverBindingHandle does not support the Driver Binding Protocol then return
|
||||
//
|
||||
if (EFI_ERROR (Status) || DriverBinding == NULL) {
|
||||
if (EFI_ERROR (Status) || (DriverBinding == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -352,6 +355,7 @@ AddSortedDriverBindingProtocol (
|
||||
if (*NumberOfSortedDriverBindingProtocols < DriverBindingHandleCount) {
|
||||
SortedDriverBindingProtocols[*NumberOfSortedDriverBindingProtocols] = DriverBinding;
|
||||
}
|
||||
|
||||
*NumberOfSortedDriverBindingProtocols = *NumberOfSortedDriverBindingProtocols + 1;
|
||||
|
||||
//
|
||||
@ -364,7 +368,6 @@ AddSortedDriverBindingProtocol (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Connects a controller to a driver.
|
||||
|
||||
@ -416,12 +419,12 @@ CoreConnectSingleController (
|
||||
//
|
||||
// Initialize local variables
|
||||
//
|
||||
DriverBindingHandleCount = 0;
|
||||
DriverBindingHandleBuffer = NULL;
|
||||
NumberOfSortedDriverBindingProtocols = 0;
|
||||
SortedDriverBindingProtocols = NULL;
|
||||
PlatformDriverOverride = NULL;
|
||||
NewDriverBindingHandleBuffer = NULL;
|
||||
DriverBindingHandleCount = 0;
|
||||
DriverBindingHandleBuffer = NULL;
|
||||
NumberOfSortedDriverBindingProtocols = 0;
|
||||
SortedDriverBindingProtocols = NULL;
|
||||
PlatformDriverOverride = NULL;
|
||||
NewDriverBindingHandleBuffer = NULL;
|
||||
|
||||
//
|
||||
// Get list of all Driver Binding Protocol Instances
|
||||
@ -468,7 +471,7 @@ CoreConnectSingleController (
|
||||
Status = CoreLocateProtocol (
|
||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &PlatformDriverOverride
|
||||
(VOID **)&PlatformDriverOverride
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {
|
||||
DriverImageHandle = NULL;
|
||||
@ -501,7 +504,7 @@ CoreConnectSingleController (
|
||||
Status = CoreHandleProtocol (
|
||||
DriverBindingHandleBuffer[Index],
|
||||
&gEfiDriverFamilyOverrideProtocolGuid,
|
||||
(VOID **) &DriverFamilyOverride
|
||||
(VOID **)&DriverFamilyOverride
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (DriverFamilyOverride != NULL)) {
|
||||
DriverFamilyOverrideVersion = DriverFamilyOverride->GetVersion (DriverFamilyOverride);
|
||||
@ -532,7 +535,7 @@ CoreConnectSingleController (
|
||||
Status = CoreHandleProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiBusSpecificDriverOverrideProtocolGuid,
|
||||
(VOID **) &BusSpecificDriverOverride
|
||||
(VOID **)&BusSpecificDriverOverride
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {
|
||||
DriverImageHandle = NULL;
|
||||
@ -608,9 +611,10 @@ CoreConnectSingleController (
|
||||
HighestIndex = Index;
|
||||
}
|
||||
}
|
||||
|
||||
if (SortIndex != HighestIndex) {
|
||||
DriverBinding = SortedDriverBindingProtocols[SortIndex];
|
||||
SortedDriverBindingProtocols[SortIndex] = SortedDriverBindingProtocols[HighestIndex];
|
||||
DriverBinding = SortedDriverBindingProtocols[SortIndex];
|
||||
SortedDriverBindingProtocols[SortIndex] = SortedDriverBindingProtocols[HighestIndex];
|
||||
SortedDriverBindingProtocols[HighestIndex] = DriverBinding;
|
||||
}
|
||||
}
|
||||
@ -620,19 +624,18 @@ CoreConnectSingleController (
|
||||
//
|
||||
OneStarted = FALSE;
|
||||
do {
|
||||
|
||||
//
|
||||
// Loop through the sorted Driver Binding Protocol Instances in order, and see if
|
||||
// any of the Driver Binding Protocols support the controller specified by
|
||||
// ControllerHandle.
|
||||
//
|
||||
DriverBinding = NULL;
|
||||
DriverFound = FALSE;
|
||||
DriverFound = FALSE;
|
||||
for (Index = 0; (Index < NumberOfSortedDriverBindingProtocols) && !DriverFound; Index++) {
|
||||
if (SortedDriverBindingProtocols[Index] != NULL) {
|
||||
DriverBinding = SortedDriverBindingProtocols[Index];
|
||||
PERF_DRIVER_BINDING_SUPPORT_BEGIN (DriverBinding->DriverBindingHandle, ControllerHandle);
|
||||
Status = DriverBinding->Supported(
|
||||
Status = DriverBinding->Supported (
|
||||
DriverBinding,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath
|
||||
@ -640,7 +643,7 @@ CoreConnectSingleController (
|
||||
PERF_DRIVER_BINDING_SUPPORT_END (DriverBinding->DriverBindingHandle, ControllerHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SortedDriverBindingProtocols[Index] = NULL;
|
||||
DriverFound = TRUE;
|
||||
DriverFound = TRUE;
|
||||
|
||||
//
|
||||
// A driver was found that supports ControllerHandle, so attempt to start the driver
|
||||
@ -692,8 +695,6 @@ CoreConnectSingleController (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Disonnects a controller from a driver
|
||||
|
||||
@ -734,24 +735,24 @@ CoreDisconnectController (
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
IHANDLE *Handle;
|
||||
EFI_HANDLE *DriverImageHandleBuffer;
|
||||
EFI_HANDLE *ChildBuffer;
|
||||
UINTN Index;
|
||||
UINTN HandleIndex;
|
||||
UINTN DriverImageHandleCount;
|
||||
UINTN ChildrenToStop;
|
||||
UINTN ChildBufferCount;
|
||||
UINTN StopCount;
|
||||
BOOLEAN Duplicate;
|
||||
BOOLEAN ChildHandleValid;
|
||||
BOOLEAN DriverImageHandleValid;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *ProtLink;
|
||||
OPEN_PROTOCOL_DATA *OpenData;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
|
||||
EFI_STATUS Status;
|
||||
IHANDLE *Handle;
|
||||
EFI_HANDLE *DriverImageHandleBuffer;
|
||||
EFI_HANDLE *ChildBuffer;
|
||||
UINTN Index;
|
||||
UINTN HandleIndex;
|
||||
UINTN DriverImageHandleCount;
|
||||
UINTN ChildrenToStop;
|
||||
UINTN ChildBufferCount;
|
||||
UINTN StopCount;
|
||||
BOOLEAN Duplicate;
|
||||
BOOLEAN ChildHandleValid;
|
||||
BOOLEAN DriverImageHandleValid;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *ProtLink;
|
||||
OPEN_PROTOCOL_DATA *OpenData;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
|
||||
|
||||
//
|
||||
// Make sure ControllerHandle is valid
|
||||
@ -793,16 +794,18 @@ CoreDisconnectController (
|
||||
|
||||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
ProtLink = ProtLink->ForwardLink)
|
||||
{
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
|
||||
DriverImageHandleCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreReleaseProtocolLock ();
|
||||
|
||||
//
|
||||
@ -823,19 +826,21 @@ CoreDisconnectController (
|
||||
|
||||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
ProtLink = ProtLink->ForwardLink)
|
||||
{
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
|
||||
Duplicate = FALSE;
|
||||
for (Index = 0; Index< DriverImageHandleCount; Index++) {
|
||||
for (Index = 0; Index < DriverImageHandleCount; Index++) {
|
||||
if (DriverImageHandleBuffer[Index] == OpenData->AgentHandle) {
|
||||
Duplicate = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Duplicate) {
|
||||
DriverImageHandleBuffer[DriverImageHandleCount] = OpenData->AgentHandle;
|
||||
DriverImageHandleCount++;
|
||||
@ -843,12 +848,12 @@ CoreDisconnectController (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreReleaseProtocolLock ();
|
||||
}
|
||||
|
||||
StopCount = 0;
|
||||
for (HandleIndex = 0; HandleIndex < DriverImageHandleCount; HandleIndex++) {
|
||||
|
||||
if (DriverImageHandleBuffer != NULL) {
|
||||
DriverImageHandle = DriverImageHandleBuffer[HandleIndex];
|
||||
}
|
||||
@ -861,7 +866,7 @@ CoreDisconnectController (
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **)&DriverBinding
|
||||
);
|
||||
if (EFI_ERROR (Status) || DriverBinding == NULL) {
|
||||
if (EFI_ERROR (Status) || (DriverBinding == NULL)) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
@ -870,30 +875,33 @@ CoreDisconnectController (
|
||||
// Look at each protocol interface for a match
|
||||
//
|
||||
DriverImageHandleValid = FALSE;
|
||||
ChildBufferCount = 0;
|
||||
ChildBufferCount = 0;
|
||||
|
||||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
ProtLink = ProtLink->ForwardLink)
|
||||
{
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if (OpenData->AgentHandle == DriverImageHandle) {
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
ChildBufferCount++;
|
||||
}
|
||||
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
|
||||
DriverImageHandleValid = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreReleaseProtocolLock ();
|
||||
|
||||
if (DriverImageHandleValid) {
|
||||
ChildHandleValid = FALSE;
|
||||
ChildBuffer = NULL;
|
||||
ChildBuffer = NULL;
|
||||
if (ChildBufferCount != 0) {
|
||||
ChildBuffer = AllocatePool (sizeof (EFI_HANDLE) * ChildBufferCount);
|
||||
if (ChildBuffer == NULL) {
|
||||
@ -905,13 +913,15 @@ CoreDisconnectController (
|
||||
|
||||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
ProtLink = ProtLink->ForwardLink)
|
||||
{
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->AgentHandle == DriverImageHandle) &&
|
||||
((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0)) {
|
||||
((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0))
|
||||
{
|
||||
Duplicate = FALSE;
|
||||
for (Index = 0; Index < ChildBufferCount; Index++) {
|
||||
if (ChildBuffer[Index] == OpenData->ControllerHandle) {
|
||||
@ -919,34 +929,39 @@ CoreDisconnectController (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Duplicate) {
|
||||
ChildBuffer[ChildBufferCount] = OpenData->ControllerHandle;
|
||||
if (ChildHandle == ChildBuffer[ChildBufferCount]) {
|
||||
ChildHandleValid = TRUE;
|
||||
}
|
||||
|
||||
ChildBufferCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreReleaseProtocolLock ();
|
||||
}
|
||||
|
||||
if (ChildHandle == NULL || ChildHandleValid) {
|
||||
if ((ChildHandle == NULL) || ChildHandleValid) {
|
||||
ChildrenToStop = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
if (ChildBufferCount > 0) {
|
||||
if (ChildHandle != NULL) {
|
||||
ChildrenToStop = 1;
|
||||
Status = DriverBinding->Stop (DriverBinding, ControllerHandle, ChildrenToStop, &ChildHandle);
|
||||
Status = DriverBinding->Stop (DriverBinding, ControllerHandle, ChildrenToStop, &ChildHandle);
|
||||
} else {
|
||||
ChildrenToStop = ChildBufferCount;
|
||||
Status = DriverBinding->Stop (DriverBinding, ControllerHandle, ChildrenToStop, ChildBuffer);
|
||||
Status = DriverBinding->Stop (DriverBinding, ControllerHandle, ChildrenToStop, ChildBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status) && ((ChildHandle == NULL) || (ChildBufferCount == ChildrenToStop))) {
|
||||
Status = DriverBinding->Stop (DriverBinding, ControllerHandle, 0, NULL);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
StopCount++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user