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