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