]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/DriverBinding.h
MdePkg FirmwareManagement.h: Fix typo EFI_SECURITY_VIOLATIO
[mirror_edk2.git] / MdePkg / Include / Protocol / DriverBinding.h
... / ...
CommitLineData
1/** @file\r
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
6\r
7Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
8This program and the accompanying materials are licensed and made available under \r
9the terms and conditions of the BSD License that accompanies this distribution. \r
10The full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php. \r
12 \r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16**/\r
17\r
18#ifndef __EFI_DRIVER_BINDING_H__\r
19#define __EFI_DRIVER_BINDING_H__\r
20\r
21///\r
22/// The global ID for the ControllerHandle Driver Protocol.\r
23///\r
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
29typedef struct _EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL;\r
30\r
31/**\r
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
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
45 Because ControllerHandle may have been previously started by the same driver, if a protocol is \r
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
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
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
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
68 driver or an application that requires exclusive access.\r
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
72**/\r
73typedef\r
74EFI_STATUS\r
75(EFIAPI *EFI_DRIVER_BINDING_SUPPORTED)(\r
76 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
77 IN EFI_HANDLE ControllerHandle,\r
78 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
79 );\r
80\r
81/**\r
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
86 common boot service. It is legal to call Start() from other locations, \r
87 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
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
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
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
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
114\r
115**/\r
116typedef\r
117EFI_STATUS\r
118(EFIAPI *EFI_DRIVER_BINDING_START)(\r
119 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
120 IN EFI_HANDLE ControllerHandle,\r
121 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
122 );\r
123\r
124/**\r
125 Stops a device controller or a bus controller.\r
126 \r
127 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r
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
130 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
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
134 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
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
137 \r
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
142 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
143 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL \r
144 if NumberOfChildren is 0.\r
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
148\r
149**/\r
150typedef\r
151EFI_STATUS\r
152(EFIAPI *EFI_DRIVER_BINDING_STOP)(\r
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
157 );\r
158\r
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
163struct _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
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
180 UINT32 Version;\r
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
186 EFI_HANDLE ImageHandle;\r
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
196 EFI_HANDLE DriverBindingHandle;\r
197};\r
198\r
199extern EFI_GUID gEfiDriverBindingProtocolGuid;\r
200\r
201#endif\r