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