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