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 - 2010, Intel Corporation. All rights reserved.<BR>
|
---|
8 | This program and the accompanying materials are licensed and made available under
|
---|
9 | the terms and conditions of the BSD License that accompanies this distribution.
|
---|
10 | The full text of the license may be found at
|
---|
11 | http://opensource.org/licenses/bsd-license.php.
|
---|
12 |
|
---|
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
15 |
|
---|
16 | **/
|
---|
17 |
|
---|
18 | #ifndef __EFI_DRIVER_BINDING_H__
|
---|
19 | #define __EFI_DRIVER_BINDING_H__
|
---|
20 |
|
---|
21 | ///
|
---|
22 | /// The global ID for the ControllerHandle Driver Protocol.
|
---|
23 | ///
|
---|
24 | #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
|
---|
25 | { \
|
---|
26 | 0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71 } \
|
---|
27 | }
|
---|
28 |
|
---|
29 | typedef struct _EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | Tests to see if this driver supports a given controller. If a child device is provided,
|
---|
33 | it further tests to see if this driver supports creating a handle for the specified child device.
|
---|
34 |
|
---|
35 | This function checks to see if the driver specified by This supports the device specified by
|
---|
36 | ControllerHandle. Drivers will typically use the device path attached to
|
---|
37 | ControllerHandle and/or the services from the bus I/O abstraction attached to
|
---|
38 | ControllerHandle to determine if the driver supports ControllerHandle. This function
|
---|
39 | may be called many times during platform initialization. In order to reduce boot times, the tests
|
---|
40 | performed by this function must be very small, and take as little time as possible to execute. This
|
---|
41 | function must not change the state of any hardware devices, and this function must be aware that the
|
---|
42 | device specified by ControllerHandle may already be managed by the same driver or a
|
---|
43 | different driver. This function must match its calls to AllocatePages() with FreePages(),
|
---|
44 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
---|
45 | Because ControllerHandle may have been previously started by the same driver, if a protocol is
|
---|
46 | already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
---|
47 | to guarantee the state of ControllerHandle is not modified by this function.
|
---|
48 |
|
---|
49 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
---|
50 | @param[in] ControllerHandle The handle of the controller to test. This handle
|
---|
51 | must support a protocol interface that supplies
|
---|
52 | an I/O abstraction to the driver.
|
---|
53 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
---|
54 | parameter is ignored by device drivers, and is optional for bus
|
---|
55 | drivers. For bus drivers, if this parameter is not NULL, then
|
---|
56 | the bus driver must determine if the bus controller specified
|
---|
57 | by ControllerHandle and the child controller specified
|
---|
58 | by RemainingDevicePath are both supported by this
|
---|
59 | bus driver.
|
---|
60 |
|
---|
61 | @retval EFI_SUCCESS The device specified by ControllerHandle and
|
---|
62 | RemainingDevicePath is supported by the driver specified by This.
|
---|
63 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
|
---|
64 | RemainingDevicePath is already being managed by the driver
|
---|
65 | specified by This.
|
---|
66 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
|
---|
67 | RemainingDevicePath is already being managed by a different
|
---|
68 | driver or an application that requires exclusive access.
|
---|
69 | Currently not implemented.
|
---|
70 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
|
---|
71 | RemainingDevicePath is not supported by the driver specified by This.
|
---|
72 | **/
|
---|
73 | typedef
|
---|
74 | EFI_STATUS
|
---|
75 | (EFIAPI *EFI_DRIVER_BINDING_SUPPORTED)(
|
---|
76 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
77 | IN EFI_HANDLE ControllerHandle,
|
---|
78 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
---|
79 | );
|
---|
80 |
|
---|
81 | /**
|
---|
82 | Starts a device controller or a bus controller.
|
---|
83 |
|
---|
84 | The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
---|
85 | As a result, much of the error checking on the parameters to Start() has been moved into this
|
---|
86 | common boot service. It is legal to call Start() from other locations,
|
---|
87 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
---|
88 | 1. ControllerHandle must be a valid EFI_HANDLE.
|
---|
89 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
---|
90 | EFI_DEVICE_PATH_PROTOCOL.
|
---|
91 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
---|
92 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
---|
93 |
|
---|
94 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
---|
95 | @param[in] ControllerHandle The handle of the controller to start. This handle
|
---|
96 | must support a protocol interface that supplies
|
---|
97 | an I/O abstraction to the driver.
|
---|
98 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
---|
99 | parameter is ignored by device drivers, and is optional for bus
|
---|
100 | drivers. For a bus driver, if this parameter is NULL, then handles
|
---|
101 | for all the children of Controller are created by this driver.
|
---|
102 | If this parameter is not NULL and the first Device Path Node is
|
---|
103 | not the End of Device Path Node, then only the handle for the
|
---|
104 | child device specified by the first Device Path Node of
|
---|
105 | RemainingDevicePath is created by this driver.
|
---|
106 | If the first Device Path Node of RemainingDevicePath is
|
---|
107 | the End of Device Path Node, no child handle is created by this
|
---|
108 | driver.
|
---|
109 |
|
---|
110 | @retval EFI_SUCCESS The device was started.
|
---|
111 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
|
---|
112 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
---|
113 | @retval Others The driver failded to start the device.
|
---|
114 |
|
---|
115 | **/
|
---|
116 | typedef
|
---|
117 | EFI_STATUS
|
---|
118 | (EFIAPI *EFI_DRIVER_BINDING_START)(
|
---|
119 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
120 | IN EFI_HANDLE ControllerHandle,
|
---|
121 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
---|
122 | );
|
---|
123 |
|
---|
124 | /**
|
---|
125 | Stops a device controller or a bus controller.
|
---|
126 |
|
---|
127 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
---|
128 | As a result, much of the error checking on the parameters to Stop() has been moved
|
---|
129 | into this common boot service. It is legal to call Stop() from other locations,
|
---|
130 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
---|
131 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
---|
132 | same driver's Start() function.
|
---|
133 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
|
---|
134 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
---|
135 | Start() function, and the Start() function must have called OpenProtocol() on
|
---|
136 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
---|
137 |
|
---|
138 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
---|
139 | @param[in] ControllerHandle A handle to the device being stopped. The handle must
|
---|
140 | support a bus specific I/O protocol for the driver
|
---|
141 | to use to stop the device.
|
---|
142 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
---|
143 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
---|
144 | if NumberOfChildren is 0.
|
---|
145 |
|
---|
146 | @retval EFI_SUCCESS The device was stopped.
|
---|
147 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
---|
148 |
|
---|
149 | **/
|
---|
150 | typedef
|
---|
151 | EFI_STATUS
|
---|
152 | (EFIAPI *EFI_DRIVER_BINDING_STOP)(
|
---|
153 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
154 | IN EFI_HANDLE ControllerHandle,
|
---|
155 | IN UINTN NumberOfChildren,
|
---|
156 | IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
|
---|
157 | );
|
---|
158 |
|
---|
159 | ///
|
---|
160 | /// This protocol provides the services required to determine if a driver supports a given controller.
|
---|
161 | /// If a controller is supported, then it also provides routines to start and stop the controller.
|
---|
162 | ///
|
---|
163 | struct _EFI_DRIVER_BINDING_PROTOCOL {
|
---|
164 | EFI_DRIVER_BINDING_SUPPORTED Supported;
|
---|
165 | EFI_DRIVER_BINDING_START Start;
|
---|
166 | EFI_DRIVER_BINDING_STOP Stop;
|
---|
167 |
|
---|
168 | ///
|
---|
169 | /// The version number of the UEFI driver that produced the
|
---|
170 | /// EFI_DRIVER_BINDING_PROTOCOL. This field is used by
|
---|
171 | /// the EFI boot service ConnectController() to determine
|
---|
172 | /// the order that driver's Supported() service will be used when
|
---|
173 | /// a controller needs to be started. EFI Driver Binding Protocol
|
---|
174 | /// instances with higher Version values will be used before ones
|
---|
175 | /// with lower Version values. The Version values of 0x0-
|
---|
176 | /// 0x0f and 0xfffffff0-0xffffffff are reserved for
|
---|
177 | /// platform/OEM specific drivers. The Version values of 0x10-
|
---|
178 | /// 0xffffffef are reserved for IHV-developed drivers.
|
---|
179 | ///
|
---|
180 | UINT32 Version;
|
---|
181 |
|
---|
182 | ///
|
---|
183 | /// The image handle of the UEFI driver that produced this instance
|
---|
184 | /// of the EFI_DRIVER_BINDING_PROTOCOL.
|
---|
185 | ///
|
---|
186 | EFI_HANDLE ImageHandle;
|
---|
187 |
|
---|
188 | ///
|
---|
189 | /// The handle on which this instance of the
|
---|
190 | /// EFI_DRIVER_BINDING_PROTOCOL is installed. In most
|
---|
191 | /// cases, this is the same handle as ImageHandle. However, for
|
---|
192 | /// UEFI drivers that produce more than one instance of the
|
---|
193 | /// EFI_DRIVER_BINDING_PROTOCOL, this value may not be
|
---|
194 | /// the same as ImageHandle.
|
---|
195 | ///
|
---|
196 | EFI_HANDLE DriverBindingHandle;
|
---|
197 | };
|
---|
198 |
|
---|
199 | extern EFI_GUID gEfiDriverBindingProtocolGuid;
|
---|
200 |
|
---|
201 | #endif
|
---|