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