iPXE
DriverBinding.h
Go to the documentation of this file.
1 /** @file
2  UEFI DriverBinding Protocol is defined in UEFI specification.
3 
4  This protocol is produced by every driver that follows the UEFI Driver Model,
5  and it is the central component that allows drivers and controllers to be managed.
6 
7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9 
10 **/
11 
12 #ifndef __EFI_DRIVER_BINDING_H__
13 #define __EFI_DRIVER_BINDING_H__
14 
15 FILE_LICENCE ( BSD2_PATENT );
16 
17 ///
18 /// The global ID for the ControllerHandle Driver Protocol.
19 ///
20 #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
21  { \
22  0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71 } \
23  }
24 
26 
27 /**
28  Tests to see if this driver supports a given controller. If a child device is provided,
29  it further tests to see if this driver supports creating a handle for the specified child device.
30 
31  This function checks to see if the driver specified by This supports the device specified by
32  ControllerHandle. Drivers will typically use the device path attached to
33  ControllerHandle and/or the services from the bus I/O abstraction attached to
34  ControllerHandle to determine if the driver supports ControllerHandle. This function
35  may be called many times during platform initialization. In order to reduce boot times, the tests
36  performed by this function must be very small, and take as little time as possible to execute. This
37  function must not change the state of any hardware devices, and this function must be aware that the
38  device specified by ControllerHandle may already be managed by the same driver or a
39  different driver. This function must match its calls to AllocatePages() with FreePages(),
40  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
41  Because ControllerHandle may have been previously started by the same driver, if a protocol is
42  already in the opened state, then it must not be closed with CloseProtocol(). This is required
43  to guarantee the state of ControllerHandle is not modified by this function.
44 
45  @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
46  @param[in] ControllerHandle The handle of the controller to test. This handle
47  must support a protocol interface that supplies
48  an I/O abstraction to the driver.
49  @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
50  parameter is ignored by device drivers, and is optional for bus
51  drivers. For bus drivers, if this parameter is not NULL, then
52  the bus driver must determine if the bus controller specified
53  by ControllerHandle and the child controller specified
54  by RemainingDevicePath are both supported by this
55  bus driver.
56 
57  @retval EFI_SUCCESS The device specified by ControllerHandle and
58  RemainingDevicePath is supported by the driver specified by This.
59  @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
60  RemainingDevicePath is already being managed by the driver
61  specified by This.
62  @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
63  RemainingDevicePath is already being managed by a different
64  driver or an application that requires exclusive access.
65  Currently not implemented.
66  @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
67  RemainingDevicePath is not supported by the driver specified by This.
68 **/
69 typedef
74  IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
75  );
76 
77 /**
78  Starts a device controller or a bus controller.
79 
80  The Start() function is designed to be invoked from the EFI boot service ConnectController().
81  As a result, much of the error checking on the parameters to Start() has been moved into this
82  common boot service. It is legal to call Start() from other locations,
83  but the following calling restrictions must be followed, or the system behavior will not be deterministic.
84  1. ControllerHandle must be a valid EFI_HANDLE.
85  2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
86  EFI_DEVICE_PATH_PROTOCOL.
87  3. Prior to calling Start(), the Supported() function for the driver specified by This must
88  have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
89 
90  @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
91  @param[in] ControllerHandle The handle of the controller to start. This handle
92  must support a protocol interface that supplies
93  an I/O abstraction to the driver.
94  @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
95  parameter is ignored by device drivers, and is optional for bus
96  drivers. For a bus driver, if this parameter is NULL, then handles
97  for all the children of Controller are created by this driver.
98  If this parameter is not NULL and the first Device Path Node is
99  not the End of Device Path Node, then only the handle for the
100  child device specified by the first Device Path Node of
101  RemainingDevicePath is created by this driver.
102  If the first Device Path Node of RemainingDevicePath is
103  the End of Device Path Node, no child handle is created by this
104  driver.
105 
106  @retval EFI_SUCCESS The device was started.
107  @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
108  @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
109  @retval Others The driver failded to start the device.
110 
111 **/
112 typedef
117  IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
118  );
119 
120 /**
121  Stops a device controller or a bus controller.
122 
123  The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
124  As a result, much of the error checking on the parameters to Stop() has been moved
125  into this common boot service. It is legal to call Stop() from other locations,
126  but the following calling restrictions must be followed, or the system behavior will not be deterministic.
127  1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
128  same driver's Start() function.
129  2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
130  EFI_HANDLE. In addition, all of these handles must have been created in this driver's
131  Start() function, and the Start() function must have called OpenProtocol() on
132  ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
133 
134  @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
135  @param[in] ControllerHandle A handle to the device being stopped. The handle must
136  support a bus specific I/O protocol for the driver
137  to use to stop the device.
138  @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
139  @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
140  if NumberOfChildren is 0.
141 
142  @retval EFI_SUCCESS The device was stopped.
143  @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
144 
145 **/
146 typedef
151  IN UINTN NumberOfChildren,
152  IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
153  );
154 
155 ///
156 /// This protocol provides the services required to determine if a driver supports a given controller.
157 /// If a controller is supported, then it also provides routines to start and stop the controller.
158 ///
163 
164  ///
165  /// The version number of the UEFI driver that produced the
166  /// EFI_DRIVER_BINDING_PROTOCOL. This field is used by
167  /// the EFI boot service ConnectController() to determine
168  /// the order that driver's Supported() service will be used when
169  /// a controller needs to be started. EFI Driver Binding Protocol
170  /// instances with higher Version values will be used before ones
171  /// with lower Version values. The Version values of 0x0-
172  /// 0x0f and 0xfffffff0-0xffffffff are reserved for
173  /// platform/OEM specific drivers. The Version values of 0x10-
174  /// 0xffffffef are reserved for IHV-developed drivers.
175  ///
177 
178  ///
179  /// The image handle of the UEFI driver that produced this instance
180  /// of the EFI_DRIVER_BINDING_PROTOCOL.
181  ///
183 
184  ///
185  /// The handle on which this instance of the
186  /// EFI_DRIVER_BINDING_PROTOCOL is installed. In most
187  /// cases, this is the same handle as ImageHandle. However, for
188  /// UEFI drivers that produce more than one instance of the
189  /// EFI_DRIVER_BINDING_PROTOCOL, this value may not be
190  /// the same as ImageHandle.
191  ///
193 };
194 
196 
197 #endif
#define OPTIONAL
Passing the datum to the function is optional, and a NULL is passed if the value is not supplied.
Definition: Base.h:292
EFI_DRIVER_BINDING_STOP Stop
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
EFI_DRIVER_BINDING_SUPPORTED Supported
unsigned int UINT32
Definition: ProcessorBind.h:98
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:45
EFI_STATUS(EFIAPI * EFI_DRIVER_BINDING_START)(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Starts a device controller or a bus controller.
EFI_DRIVER_BINDING_START Start
EFI_GUID gEfiDriverBindingProtocolGuid
EFI_STATUS(EFIAPI * EFI_DRIVER_BINDING_STOP)(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
Stops a device controller or a bus controller.
FILE_LICENCE(BSD2_PATENT)
#define EFIAPI
EFI_HANDLE DriverBindingHandle
The handle on which this instance of the EFI_DRIVER_BINDING_PROTOCOL is installed.
UINT64 UINTN
Unsigned value of native width.
This protocol provides the services required to determine if a driver supports a given controller.
EFI_HANDLE ImageHandle
The image handle of the UEFI driver that produced this instance of the EFI_DRIVER_BINDING_PROTOCOL.
EFI_HANDLE ControllerHandle
Definition: efi_bofm.c:109
#define IN
Definition: mlx_utils.h:28
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_STATUS(EFIAPI * EFI_DRIVER_BINDING_SUPPORTED)(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Tests to see if this driver supports a given controller.
Definition: DriverBinding.h:71
Definition: efi.h:59
UINT32 Version
The version number of the UEFI driver that produced the EFI_DRIVER_BINDING_PROTOCOL.