Status codes returned, Examples – Intel Extensible Firmware Interface User Manual
Page 165

Services — Boot Services
Version 1.10
12/01/02
5-67
then
EFI_INVALID_PARAMETER
is returned. If
DriverImageHandle
is not
NULL
, and
DriverImageHandle
is not currently managing
ControllerHandle
, then
EFI_SUCCESS
is returned. If
ChildHandle
is not
NULL
, and
ChildHandle
is not a valid
EFI_HANDLE
,
then
EFI_INVALID_PARAMETER
is returned. If there are not enough resources available to
disconnect drivers from
ControllerHandle
, then
EFI_OUT_OF_RESOURCES
is returned.
Status Codes Returned
EFI_SUCCESS
One or more drivers were disconnected from the controller.
EFI_SUCCESS
On entry, no drivers are managing
ControllerHandle
.
EFI_SUCCESS
DriverImageHandle
is not
NULL
, and on entry
DriverImageHandle
is not managing
ControllerHandle
.
EFI_INVALID_PARAMETER
ControllerHandle
is not a valid
EFI_HANDLE
.
EFI_INVALID_PARAMETER
DriverImageHandle
is not
NULL
, and it is not a valid
EFI_HANDLE
.
EFI_INVALID_PARAMETER
ChildHandle
is not
NULL
, and it is not a valid
EFI_HANDLE
.
EFI_OUT_OF_RESOURCES
There are not enough resources available to disconnect any drivers from
ControllerHandle
.
EFI_DEVICE_ERROR
The controller could not be disconnected because of a device error.
Examples
//
// Disconnect All Handles Example
//
The following example recusively disconnects all drivers from all
//
controllers in a platform.
//
EFI_STATUS
Status;
EFI_BOOT_SERVICES_TABLE
*gBS;
UINTN
HandleCount;
EFI_HANDLE
*HandleBuffer;
UINTN
HandleIndex;
//
// Retrieve the list of all handles from the handle database
//
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Status = gBS->DisconnectController (
HandleBuffer[HandleIndex],
NULL,
NULL
);
}
gBS->FreePool(HandleBuffer);