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