]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/DriverBinding.h
Fix typo in function prototype.
[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 This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
37 @param 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 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 @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 This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
76 @param 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 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.
84 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
85
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 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
98 As a result, much of the error checking on the parameters to Stop() has been moved
99 into this common boot service. It is legal to call Stop() from other locations,
100 but the following calling restrictions must be followed or the system behavior will not be deterministic.
101 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
102 same driver's Start() function.
103 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
104 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
105 Start() function, and the Start() function must have called OpenProtocol() on
106 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
107
108 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
109 @param ControllerHandle A handle to the device being stopped. The handle must
110 support a bus specific I/O protocol for the driver
111 to use to stop the device.
112 @param NumberOfChildren The number of child device handles in ChildHandleBuffer.
113 @param ChildHandleBuffer An array of child handles to be freed. May be NULL if NumberOfChildren is 0.
114
115 @retval EFI_SUCCESS The device was stopped.
116 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
117
118 **/
119 typedef
120 EFI_STATUS
121 (EFIAPI *EFI_DRIVER_BINDING_STOP)(
122 IN EFI_DRIVER_BINDING_PROTOCOL *This,
123 IN EFI_HANDLE ControllerHandle,
124 IN UINTN NumberOfChildren,
125 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
126 );
127
128 ///
129 /// This protocol provides the services required to determine if a driver supports a given controller.
130 /// If a controller is supported, then it also provides routines to start and stop the controller.
131 ///
132 struct _EFI_DRIVER_BINDING_PROTOCOL {
133 EFI_DRIVER_BINDING_SUPPORTED Supported;
134 EFI_DRIVER_BINDING_START Start;
135 EFI_DRIVER_BINDING_STOP Stop;
136
137 ///
138 /// The version number of the UEFI driver that produced the
139 /// EFI_DRIVER_BINDING_PROTOCOL. This field is used by
140 /// the EFI boot service ConnectController() to determine
141 /// the order that driver's Supported() service will be used when
142 /// a controller needs to be started. EFI Driver Binding Protocol
143 /// instances with higher Version values will be used before ones
144 /// with lower Version values. The Version values of 0x0-
145 /// 0x0f and 0xfffffff0-0xffffffff are reserved for
146 /// platform/OEM specific drivers. The Version values of 0x10-
147 /// 0xffffffef are reserved for IHV-developed drivers.
148 ///
149 UINT32 Version;
150
151 ///
152 /// The image handle of the UEFI driver that produced this instance
153 /// of the EFI_DRIVER_BINDING_PROTOCOL.
154 ///
155 EFI_HANDLE ImageHandle;
156
157 ///
158 /// The handle on which this instance of the
159 /// EFI_DRIVER_BINDING_PROTOCOL is installed. In most
160 /// cases, this is the same handle as ImageHandle. However, for
161 /// UEFI drivers that produce more than one instance of the
162 /// EFI_DRIVER_BINDING_PROTOCOL, this value may not be
163 /// the same as ImageHandle.
164 ///
165 EFI_HANDLE DriverBindingHandle;
166 };
167
168 extern EFI_GUID gEfiDriverBindingProtocolGuid;
169
170 #endif