Status codes returned, Examples – Intel Extensible Firmware Interface User Manual
Page 261
Protocols
— EFI Driver Model
Version 1.10
12/01/02
9-19
If
ControllerHandle
cannot be stopped, then
EFI_DEVICE_ERROR
is returned. If, for
some reason, there are not enough resources to stop
ControllerHandle
, then
EFI_OUT_OF_RESOURCES
is returned. If
ControllerHandle
was not started by the driver
specified by
This
, then
EFI_UNSUPPORTED
is returned.
The
Stop()
function is designed to be invoked from the EFI boot service
. As a result, much of the error checking on the parameters to
Stop()
has been moved into this common boot service. It is legal to call
Stop()
from other
locations, but the following calling restrictions must be followed or the system behavior will not be
deterministic.
1.
ControllerHandle
must be a valid
EFI_HANDLE
that was used on a previous call to this
same driver’s
function.
2. The
first
NumberOfChildren
handles of
ChildHandleBuffer
must all be a valid
EFI_HANDLE
. In addition, all of these handles must have been created in this driver’s
Start()
function, and the
Start()
function must have called
ControllerHandle
with an
Attribute
of
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
.
Status Codes Returned
EFI_SUCCESS
The device was stopped
.
EFI_DEVICE_ERROR
The device could not be stopped due to a device error.
Examples
extern EFI_GUID gEfiDriverBindingProtocolGuid;
EFI_HANDLE DriverImageHandle;
EFI_HANDLE ControllerHandle;
EFI_HANDLE ChildHandle;
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
//
// Use the DriverImageHandle to get the Driver Binding Protocol instance
//
Status = gBS->OpenProtocol (
DriverImageHandle,
&gEfiDriverBindingProtocolGuid,
&DriverBinding,
DriverImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Use the Driver Binding Protocol instance to free the child
// specified by ChildHandle. Then, use the Driver Binding
// Protocol to stop ControllerHandle.
//