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