mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
Fix a bug that prevents Fat driver being unloaded successfully.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> (based on FatPkg commit 8e0e11897d92c75a6cd1d0fa8af8cb50a60bfe2d) [jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Acked-by: Mark Doran <mark.doran@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
bd10d0712f
commit
b6efb80ad0
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
@ -140,6 +140,8 @@ Returns:
|
|||||||
EFI_HANDLE *DeviceHandleBuffer;
|
EFI_HANDLE *DeviceHandleBuffer;
|
||||||
UINTN DeviceHandleCount;
|
UINTN DeviceHandleCount;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
VOID *ComponentName;
|
||||||
|
VOID *ComponentName2;
|
||||||
|
|
||||||
Status = gBS->LocateHandleBuffer (
|
Status = gBS->LocateHandleBuffer (
|
||||||
AllHandles,
|
AllHandles,
|
||||||
@ -148,19 +150,76 @@ Returns:
|
|||||||
&DeviceHandleCount,
|
&DeviceHandleCount,
|
||||||
&DeviceHandleBuffer
|
&DeviceHandleBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < DeviceHandleCount; Index++) {
|
for (Index = 0; Index < DeviceHandleCount; Index++) {
|
||||||
|
Status = EfiTestManagedDevice (DeviceHandleBuffer[Index], ImageHandle, &gEfiDiskIoProtocolGuid);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = gBS->DisconnectController (
|
Status = gBS->DisconnectController (
|
||||||
DeviceHandleBuffer[Index],
|
DeviceHandleBuffer[Index],
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Index == DeviceHandleCount) {
|
||||||
|
//
|
||||||
|
// Driver is stopped successfully.
|
||||||
|
//
|
||||||
|
Status = gBS->HandleProtocol (ImageHandle, &gEfiComponentNameProtocolGuid, &ComponentName);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ComponentName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (ImageHandle, &gEfiComponentName2ProtocolGuid, &ComponentName2);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ComponentName2 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ComponentName == NULL) {
|
||||||
|
if (ComponentName2 == NULL) {
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
ImageHandle,
|
||||||
|
&gEfiDriverBindingProtocolGuid, &gFatDriverBinding,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
ImageHandle,
|
||||||
|
&gEfiDriverBindingProtocolGuid, &gFatDriverBinding,
|
||||||
|
&gEfiComponentName2ProtocolGuid, ComponentName2,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ComponentName2 == NULL) {
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
ImageHandle,
|
||||||
|
&gEfiDriverBindingProtocolGuid, &gFatDriverBinding,
|
||||||
|
&gEfiComponentNameProtocolGuid, ComponentName,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
ImageHandle,
|
||||||
|
&gEfiDriverBindingProtocolGuid, &gFatDriverBinding,
|
||||||
|
&gEfiComponentNameProtocolGuid, ComponentName,
|
||||||
|
&gEfiComponentName2ProtocolGuid, ComponentName2,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DeviceHandleBuffer != NULL) {
|
if (DeviceHandleBuffer != NULL) {
|
||||||
FreePool (DeviceHandleBuffer);
|
FreePool (DeviceHandleBuffer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user