]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/DriverBinding.h
Remove redundant #include statements
[mirror_edk2.git] / MdePkg / Include / Protocol / DriverBinding.h
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 - 2008, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. 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 /// 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 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
36 @param[in] ControllerHandle The handle of the controller to test. This handle
37 must support a protocol interface that supplies
38 an I/O abstraction to the driver.
39 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
40 This parameter is ignored by device drivers, and is optional for bus drivers.
41
42
43 @retval EFI_SUCCESS The device specified by ControllerHandle and
44 RemainingDevicePath is supported by the driver specified by This.
45 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
46 RemainingDevicePath is already being managed by the driver
47 specified by This.
48 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
49 RemainingDevicePath is already being managed by a different
50 driver or an application that requires exclusive acces.
51 Currently not implemented.
52 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
53 RemainingDevicePath is not supported by the driver specified by This.
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_DRIVER_BINDING_SUPPORTED)(
58 IN EFI_DRIVER_BINDING_PROTOCOL *This,
59 IN EFI_HANDLE ControllerHandle,
60 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
61 );
62
63 /**
64 Start this driver on ControllerHandle. The Start() function is designed to be
65 invoked from the EFI boot service ConnectController(). As a result, much of
66 the error checking on the parameters to Start() has been moved into this
67 common boot service. It is legal to call Start() from other locations,
68 but the following calling restrictions must be followed or the system behavior will not be deterministic.
69 1. ControllerHandle must be a valid EFI_HANDLE.
70 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
71 EFI_DEVICE_PATH_PROTOCOL.
72 3. Prior to calling Start(), the Supported() function for the driver specified by This must
73 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
74
75 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
76 @param[in] ControllerHandle The handle of the controller to start. This handle
77 must support a protocol interface that supplies
78 an I/O abstraction to the driver.
79 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
80 This parameter is ignored by device drivers, and is optional for bus drivers.
81
82 @retval EFI_SUCCESS The device was started.
83 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
84 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
85 @retval Others The driver failded to start the device.
86 **/
87 typedef
88 EFI_STATUS
89 (EFIAPI *EFI_DRIVER_BINDING_START)(
90 IN EFI_DRIVER_BINDING_PROTOCOL *This,
91 IN EFI_HANDLE ControllerHandle,
92 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
93 );
94
95 /**
96 Stop this driver on ControllerHandle.
97
98 Release the control of this controller and remove the IScsi functions. The Stop()
99 function is designed to be invoked from the EFI boot service DisconnectController().
100 As a result, much of the error checking on the parameters to Stop() has been moved
101 into this common boot service. It is legal to call Stop() from other locations,
102 but the following calling restrictions must be followed or the system behavior will not be deterministic.
103 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
104 same driver's Start() function.
105 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
106 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
107 Start() function, and the Start() function must have called OpenProtocol() on
108 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
109
110 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
111 @param[in] ControllerHandle A handle to the device being stopped. The handle must
112 support a bus specific I/O protocol for the driver
113 to use to stop the device.
114 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.Not used.
115 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
116 if NumberOfChildren is 0.Not used.
117
118 @retval EFI_SUCCESS The device was stopped.
119 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
120 **/
121 typedef
122 EFI_STATUS
123 (EFIAPI *EFI_DRIVER_BINDING_STOP)(
124 IN EFI_DRIVER_BINDING_PROTOCOL *This,
125 IN EFI_HANDLE ControllerHandle,
126 IN UINTN NumberOfChildren,
127 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
128 );
129
130 ///
131 /// This protocol provides the services required to determine if a driver supports a given controller.
132 /// If a controller is supported, then it also provides routines to start and stop the controller.
133 ///
134 struct _EFI_DRIVER_BINDING_PROTOCOL {
135 EFI_DRIVER_BINDING_SUPPORTED Supported;
136 EFI_DRIVER_BINDING_START Start;
137 EFI_DRIVER_BINDING_STOP Stop;
138
139 ///
140 /// The version number of the UEFI driver that produced the
141 /// EFI_DRIVER_BINDING_PROTOCOL. This field is used by
142 /// the EFI boot service ConnectController() to determine
143 /// the order that driver's Supported() service will be used when
144 /// a controller needs to be started. EFI Driver Binding Protocol
145 /// instances with higher Version values will be used before ones
146 /// with lower Version values. The Version values of 0x0-
147 /// 0x0f and 0xfffffff0-0xffffffff are reserved for
148 /// platform/OEM specific drivers. The Version values of 0x10-
149 /// 0xffffffef are reserved for IHV-developed drivers.
150 ///
151 UINT32 Version;
152
153 ///
154 /// The image handle of the UEFI driver that produced this instance
155 /// of the EFI_DRIVER_BINDING_PROTOCOL.
156 ///
157 EFI_HANDLE ImageHandle;
158
159 ///
160 /// The handle on which this instance of the
161 /// EFI_DRIVER_BINDING_PROTOCOL is installed. In most
162 /// cases, this is the same handle as ImageHandle. However, for
163 /// UEFI drivers that produce more than one instance of the
164 /// EFI_DRIVER_BINDING_PROTOCOL, this value may not be
165 /// the same as ImageHandle.
166 ///
167 EFI_HANDLE DriverBindingHandle;
168 };
169
170 extern EFI_GUID gEfiDriverBindingProtocolGuid;
171
172 #endif