]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
MdePkg: Add UEFI2.5 USB Function I/O protocol definitions
[mirror_edk2.git] / MdePkg / Include / Protocol / PlatformToDriverConfiguration.h
... / ...
CommitLineData
1/** @file\r
2 UEFI Platform to Driver Configuration Protocol is defined in UEFI specification.\r
3 \r
4 This is a protocol that is optionally produced by the platform and optionally consumed \r
5 by a UEFI Driver in its Start() function. This protocol allows the driver to receive \r
6 configuration information as part of being started.\r
7\r
8 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
9 This program and the accompanying materials \r
10 are licensed and made available under the terms and conditions of the BSD License \r
11 which accompanies this distribution. The full text of the license may be found at \r
12 http://opensource.org/licenses/bsd-license.php \r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
16\r
17**/\r
18\r
19#ifndef __PLATFORM_TO_DRIVER_CONFIGUARTION_H__\r
20#define __PLATFORM_TO_DRIVER_CONFIGUARTION_H__\r
21\r
22#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL_GUID \\r
23 { 0x642cd590, 0x8059, 0x4c0a, { 0xa9, 0x58, 0xc5, 0xec, 0x7, 0xd2, 0x3c, 0x4b } }\r
24\r
25\r
26typedef struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL;\r
27\r
28\r
29/**\r
30 The UEFI driver must call Query early in the Start() function\r
31 before any time consuming operations are performed. If\r
32 ChildHandle is NULL the driver is requesting information from\r
33 the platform about the ControllerHandle that is being started.\r
34 Information returned from Query may lead to the drivers Start()\r
35 function failing.\r
36 If the UEFI driver is a bus driver and producing a ChildHandle,\r
37 the driver must call Query after the child handle has been created\r
38 and an EFI_DEVICE_PATH_PROTOCOL has been placed on that handle,\r
39 but before any time consuming operation is performed. If information\r
40 return by Query may lead the driver to decide to not create the\r
41 ChildHandle. The driver must then cleanup and remove the ChildHandle\r
42 from the system.\r
43 The UEFI driver repeatedly calls Query, processes the information\r
44 returned by the platform, and calls Response passing in the\r
45 arguments returned from Query. The Instance value passed into\r
46 Response must be the same value passed into the corresponding\r
47 call to Query.\r
48 An Instance value of zero means return the first ParameterBlock\r
49 in the set of unprocessed parameter blocks. The driver should\r
50 increment the Instance value by one for each successive call to Query.\r
51\r
52 @param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.\r
53 \r
54 @param ControllerHandle The handle the platform will return\r
55 configuration information about.\r
56 \r
57 @param ChildHandle The handle of the child controller to\r
58 return information on. This is an optional\r
59 parameter that may be NULL. It will be\r
60 NULL for device drivers and for bus\r
61 drivers that attempt to get options for\r
62 the bus controller. It will not be NULL\r
63 for a bus driver that attempts to get\r
64 options for one of its child controllers.\r
65 \r
66 \r
67 @param Instance Pointer to the Instance value. Zero means\r
68 return the first query data. The caller should\r
69 increment this value by one each time to retrieve\r
70 successive data.\r
71\r
72 @param ParameterTypeGuid An EFI_GUID that defines the contents\r
73 of ParameterBlock. UEFI drivers must\r
74 use the ParameterTypeGuid to determine\r
75 how to parse the ParameterBlock. The caller\r
76 should not attempt to free ParameterTypeGuid.\r
77\r
78 @param ParameterBlock The platform returns a pointer to the\r
79 ParameterBlock structure which\r
80 contains details about the\r
81 configuration parameters specific to\r
82 the ParameterTypeGuid. This structure\r
83 is defined based on the protocol and\r
84 may be different for different\r
85 protocols. UEFI driver decodes this\r
86 structure and its contents based on\r
87 ParameterTypeGuid. ParameterBlock is\r
88 allocated by the platform and the\r
89 platform is responsible for freeing\r
90 the ParameterBlock after Result is\r
91 called.\r
92\r
93 @param ParameterBlockSize The platform returns the size of\r
94 the ParameterBlock in bytes.\r
95\r
96\r
97 @retval EFI_SUCCESS The platform return parameter\r
98 information for ControllerHandle.\r
99\r
100 @retval EFI_NOT_FOUND No more unread Instance exists.\r
101\r
102 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
103\r
104 @retval EFI_INVALID_PARAMETER Instance is NULL.\r
105\r
106 @retval EFI_DEVICE_ERROR A device error occurred while\r
107 attempting to return parameter block\r
108 information for the controller\r
109 specified by ControllerHandle and\r
110 ChildHandle.\r
111\r
112 @retval EFI_OUT_RESOURCES There are not enough resources\r
113 available to set the configuration\r
114 options for the controller specified\r
115 by ControllerHandle and ChildHandle.\r
116\r
117\r
118**/\r
119typedef\r
120EFI_STATUS\r
121(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY)(\r
122 IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,\r
123 IN CONST EFI_HANDLE ControllerHandle,\r
124 IN CONST EFI_HANDLE ChildHandle OPTIONAL,\r
125 IN CONST UINTN *Instance,\r
126 OUT EFI_GUID **ParameterTypeGuid,\r
127 OUT VOID **ParameterBlock,\r
128 OUT UINTN *ParameterBlockSize\r
129);\r
130\r
131typedef enum {\r
132 ///\r
133 /// The controller specified by ControllerHandle is still\r
134 /// in a usable state, and its configuration has been updated\r
135 /// via parsing the ParameterBlock. If required by the\r
136 /// parameter block, and the module supports an NVRAM store,\r
137 /// the configuration information from PB was successfully\r
138 /// saved to the NVRAM. No actions are required before\r
139 /// this controller can be used again with the updated\r
140 /// configuration settings.\r
141 ///\r
142 EfiPlatformConfigurationActionNone = 0,\r
143 \r
144 ///\r
145 /// The driver has detected that the controller specified\r
146 /// by ControllerHandle is not in a usable state and \r
147 /// needs to be stopped. The calling agent can use the\r
148 /// DisconnectControservice to perform this operation, and\r
149 /// it should be performed as soon as possible. \r
150 ///\r
151 EfiPlatformConfigurationActionStopController = 1,\r
152 \r
153 ///\r
154 /// This controller specified by ControllerHandle needs to\r
155 /// be stopped and restarted before it can be used again.\r
156 /// The calling agent can use the DisconnectController()\r
157 /// and ConnectController() services to perform this\r
158 /// operation. The restart operation can be delayed until\r
159 /// all of the configuration options have been set. \r
160 ///\r
161 EfiPlatformConfigurationActionRestartController = 2,\r
162 \r
163 ///\r
164 /// A configuration change has been made that requires the\r
165 /// platform to be restarted before the controller\r
166 /// specified by ControllerHandle can be used again. The\r
167 /// calling agent can use the ResetSystem() services to\r
168 /// perform this operation. The restart operation can be\r
169 /// delayed until all of the configuration options have\r
170 /// been set. \r
171 ///\r
172 EfiPlatformConfigurationActionRestartPlatform = 3,\r
173\r
174 ///\r
175 /// The controller specified by ControllerHandle is still\r
176 /// in a usable state; its configuration has been updated\r
177 /// via parsing the ParameterBlock. The driver tried to\r
178 /// update the driver's private NVRAM store with\r
179 /// information from ParameterBlock and failed. No actions\r
180 /// are required before this controller can be used again\r
181 /// with the updated configuration settings, but these\r
182 /// configuration settings are not guaranteed to persist\r
183 /// after ControllerHandle is stopped. \r
184 /// \r
185 EfiPlatformConfigurationActionNvramFailed = 4,\r
186 EfiPlatformConfigurationActionMaximum\r
187} EFI_PLATFORM_CONFIGURATION_ACTION;\r
188\r
189\r
190/**\r
191 The UEFI driver repeatedly calls Query, processes the\r
192 information returned by the platform, and calls Response passing\r
193 in the arguments returned from Query. The UEFI driver must\r
194 continuously call Query until EFI_NOT_FOUND is returned. For\r
195 every call to Query that returns EFI_SUCCESS a corrisponding\r
196 call to Response is required passing in the same\r
197 ContollerHandle, ChildHandle, Instance, ParameterTypeGuid,\r
198 ParameterBlock, and ParameterBlockSize. The UEFI driver may\r
199 update values in ParameterBlock based on rules defined by\r
200 ParameterTypeGuid. The platform is responsible for freeing\r
201 ParameterBlock and the UEFI driver must not try to free it.\r
202\r
203 @param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.\r
204\r
205 @param ControllerHandle The handle the driver is returning\r
206 configuration information about.\r
207\r
208 @param ChildHandle The handle of the child controller to\r
209 return information on. This is an optional\r
210 parameter that may be NULL. It will be\r
211 NULL for device drivers, and for bus\r
212 drivers that attempt to get options for\r
213 the bus controller. It will not be NULL\r
214 for a bus driver that attempts to get\r
215 options for one of its child controllers.\r
216 Instance Instance data returned from\r
217 Query().\r
218\r
219 @param Instance Instance data passed to Query().\r
220\r
221 @param ParameterTypeGuid ParameterTypeGuid returned from Query.\r
222\r
223 @param ParameterBlock ParameterBlock returned from Query.\r
224\r
225 @param ParameterBlockSize The ParameterBlock size returned from Query.\r
226\r
227 @param ConfigurationAction The driver tells the platform what\r
228 action is required for ParameterBlock to\r
229 take effect.\r
230 \r
231 \r
232 @retval EFI_SUCCESS The platform return parameter information\r
233 for ControllerHandle.\r
234 \r
235 @retval EFI_NOT_FOUND Instance was not found.\r
236 \r
237 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
238 \r
239 @retval EFI_INVALID_PARAMETER Instance is zero.\r
240 \r
241**/\r
242typedef\r
243EFI_STATUS\r
244(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE)(\r
245 IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,\r
246 IN CONST EFI_HANDLE ControllerHandle,\r
247 IN CONST EFI_HANDLE ChildHandle OPTIONAL,\r
248 IN CONST UINTN *Instance,\r
249 IN CONST EFI_GUID *ParameterTypeGuid,\r
250 IN CONST VOID *ParameterBlock,\r
251 IN CONST UINTN ParameterBlockSize ,\r
252 IN CONST EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction\r
253);\r
254\r
255\r
256///\r
257/// The EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is used by the\r
258/// UEFI driver to query the platform for configuration information.\r
259/// The UEFI driver calls Query() multiple times to get\r
260/// configuration information from the platform. For every call to\r
261/// Query() there must be a matching call to Response() so the\r
262/// UEFI driver can inform the platform how it used the\r
263/// information passed in from Query(). It's legal for a UEFI\r
264/// driver to use Response() to inform the platform it does not\r
265/// understand the data returned via Query() and thus no action was\r
266/// taken.\r
267///\r
268struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL {\r
269 EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY Query;\r
270 EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE Response;\r
271};\r
272\r
273\r
274\r
275#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_CLP_GUID \\r
276 {0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e } }\r
277\r
278/**\r
279 \r
280 ParameterTypeGuid provides the support for parameters\r
281 communicated through the DMTF SM CLP Specification 1.0 Final\r
282 Standard to be used to configure the UEFI driver. In this\r
283 section the producer of the\r
284 EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is platform\r
285 firmware and the consumer is the UEFI driver. Note: if future\r
286 versions of the DMTF SM CLP Specification require changes to the\r
287 parameter block definition, a newer ParameterTypeGuid will be\r
288 used.\r
289**/\r
290typedef struct {\r
291 CHAR8 *CLPCommand; ///< A pointer to the null-terminated UTF-8 string that specifies the DMTF SM CLP command\r
292 ///< line that the driver is required to parse and process when this function is called. \r
293 ///< See the DMTF SM CLP Specification 1.0 Final Standard for details on the \r
294 ///< format and syntax of the CLP command line string. CLPCommand buffer\r
295 ///< is allocated by the producer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOOL.\r
296 UINT32 CLPCommandLength; ///< The length of the CLP Command in bytes.\r
297 CHAR8 *CLPReturnString; ///< A pointer to the null-terminated UTF-8 string that indicates the CLP return status\r
298 ///< that the driver is required to provide to the calling agent.\r
299 ///< The calling agent may parse and/ or pass\r
300 ///< this for processing and user feedback. The SM CLP Command Response string\r
301 ///< buffer is filled in by the UEFI driver in the "keyword=value" format\r
302 ///< described in the SM CLP Specification, unless otherwise requested via the SM\r
303 ///< CLP Coutput option in the Command Line string buffer. UEFI driver's support\r
304 ///< for this default "keyword=value" output format is required if the UEFI\r
305 ///< driver supports this protocol, while support for other SM CLP output\r
306 ///< formats is optional (the UEFI Driver should return an EFI_UNSUPPORTED if\r
307 ///< the SM CLP Coutput option requested by the caller is not supported by the\r
308 ///< UEFI Driver). CLPReturnString buffer is allocated by the consumer of the\r
309 ///< EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to\r
310 ///< Response(). \r
311 UINT32 CLPReturnStringLength; ///< The length of the CLP return status string in bytes.\r
312 UINT8 CLPCmdStatus; ///< SM CLP Command Status (see DMTF SM CLP Specification 1.0 Final Standard -\r
313 ///< Table 4) CLPErrorValue SM CLP Processing Error Value (see DMTF SM\r
314 ///< CLP Specification 1.0 Final Standard - Table 6). This field is filled in by\r
315 ///< the consumer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC \r
316 ///< OL and undefined prior to the call to Response(). \r
317 UINT8 CLPErrorValue; ///< SM CLP Processing Error Value (see DMTF SM CLP Specification 1.0 Final Standard - Table 6).\r
318 ///< This field is filled in by the consumer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL and undefined prior to the call to Response(). \r
319 UINT16 CLPMsgCode; ///< Bit 15: OEM Message Code Flag 0 = Message Code is an SM CLP Probable\r
320 ///< Cause Value. (see SM CLP Specification Table 11) 1 = Message Code is OEM\r
321 ///< Specific Bits 14-0: Message Code This field is filled in by the consumer of\r
322 ///< the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to\r
323 ///< Response(). \r
324\r
325} EFI_CONFIGURE_CLP_PARAMETER_BLK;\r
326\r
327\r
328\r
329extern EFI_GUID gEfiPlatformToDriverConfigurationClpGuid;\r
330\r
331extern EFI_GUID gEfiPlatformToDriverConfigurationProtocolGuid;\r
332\r
333#endif\r