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