]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
MdeModulePkg: Apply uncrustify changes
[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 - 2018, Intel Corporation. All rights reserved.<BR>\r
9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
10\r
11**/\r
12\r
13#ifndef __PLATFORM_TO_DRIVER_CONFIGUARTION_H__\r
14#define __PLATFORM_TO_DRIVER_CONFIGUARTION_H__\r
15\r
16#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL_GUID \\r
17 { 0x642cd590, 0x8059, 0x4c0a, { 0xa9, 0x58, 0xc5, 0xec, 0x7, 0xd2, 0x3c, 0x4b } }\r
18\r
19\r
20typedef struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL;\r
21\r
22\r
23/**\r
24 The UEFI driver must call Query early in the Start() function\r
25 before any time consuming operations are performed. If\r
26 ChildHandle is NULL the driver is requesting information from\r
27 the platform about the ControllerHandle that is being started.\r
28 Information returned from Query may lead to the drivers Start()\r
29 function failing.\r
30 If the UEFI driver is a bus driver and producing a ChildHandle,\r
31 the driver must call Query after the child handle has been created\r
32 and an EFI_DEVICE_PATH_PROTOCOL has been placed on that handle,\r
33 but before any time consuming operation is performed. If information\r
34 return by Query may lead the driver to decide to not create the\r
35 ChildHandle. The driver must then cleanup and remove the ChildHandle\r
36 from the system.\r
37 The UEFI driver repeatedly calls Query, processes the information\r
38 returned by the platform, and calls Response passing in the\r
39 arguments returned from Query. The Instance value passed into\r
40 Response must be the same value passed into the corresponding\r
41 call to Query. The UEFI driver must continuously call Query and\r
42 Response until EFI_NOT_FOUND is returned by Query.\r
43 If the UEFI driver does not recognize the ParameterTypeGuid, it\r
44 calls Response with a ConfigurationAction of\r
45 EfiPlatformConfigurationActionUnsupportedGuid. The UEFI driver\r
46 must then continue calling Query and Response until EFI_NOT_FOUND\r
47 is returned by Query. This gives the platform an opportunity to\r
48 pass additional configuration settings using a different\r
49 ParameterTypeGuid that may be supported by the driver.\r
50 An Instance value of zero means return the first ParameterBlock\r
51 in the set of unprocessed parameter blocks. The driver should\r
52 increment the Instance value by one for each successive call to Query.\r
53\r
54 @param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.\r
55\r
56 @param ControllerHandle The handle the platform will return\r
57 configuration information about.\r
58\r
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
67\r
68\r
69 @param Instance Pointer to the Instance value. Zero means\r
70 return the first query data. The caller should\r
71 increment this value by one each time to retrieve\r
72 successive data.\r
73\r
74 @param ParameterTypeGuid An EFI_GUID that defines the contents\r
75 of ParameterBlock. UEFI drivers must\r
76 use the ParameterTypeGuid to determine\r
77 how to parse the ParameterBlock. The caller\r
78 should not attempt to free ParameterTypeGuid.\r
79\r
80 @param ParameterBlock The platform returns a pointer to the\r
81 ParameterBlock structure which\r
82 contains details about the\r
83 configuration parameters specific to\r
84 the ParameterTypeGuid. This structure\r
85 is defined based on the protocol and\r
86 may be different for different\r
87 protocols. UEFI driver decodes this\r
88 structure and its contents based on\r
89 ParameterTypeGuid. ParameterBlock is\r
90 allocated by the platform and the\r
91 platform is responsible for freeing\r
92 the ParameterBlock after Result is\r
93 called.\r
94\r
95 @param ParameterBlockSize The platform returns the size of\r
96 the ParameterBlock in bytes.\r
97\r
98\r
99 @retval EFI_SUCCESS The platform return parameter\r
100 information for ControllerHandle.\r
101\r
102 @retval EFI_NOT_FOUND No more unread Instance exists.\r
103\r
104 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
105\r
106 @retval EFI_INVALID_PARAMETER Instance is NULL.\r
107\r
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
113\r
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
118\r
119\r
120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY)(\r
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 CONST UINTN *Instance,\r
128 OUT EFI_GUID **ParameterTypeGuid,\r
129 OUT VOID **ParameterBlock,\r
130 OUT UINTN *ParameterBlockSize\r
131);\r
132\r
133typedef enum {\r
134 ///\r
135 /// The controller specified by ControllerHandle is still\r
136 /// in a usable state, and its 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
144 EfiPlatformConfigurationActionNone = 0,\r
145\r
146 ///\r
147 /// The driver has detected that the controller specified\r
148 /// by ControllerHandle is not in a usable state and\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
153 EfiPlatformConfigurationActionStopController = 1,\r
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 configuration options have been set.\r
162 ///\r
163 EfiPlatformConfigurationActionRestartController = 2,\r
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
174 EfiPlatformConfigurationActionRestartPlatform = 3,\r
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
187 EfiPlatformConfigurationActionNvramFailed = 4,\r
188\r
189 ///\r
190 /// The controller specified by ControllerHandle is still\r
191 /// in a usable state; its configuration has not been updated\r
192 /// via parsing the ParameterBlock. The driver did not support\r
193 /// the ParameterBlock format identified by ParameterTypeGuid.\r
194 /// No actions are required before this controller can be used\r
195 /// again. On additional Query calls from this ControllerHandle,\r
196 /// the platform should stop returning a ParameterBlock\r
197 /// qualified by this same ParameterTypeGuid. If no other\r
198 /// ParameterTypeGuid is supported by the platform, Query\r
199 /// should return EFI_NOT_FOUND.\r
200 ///\r
201 EfiPlatformConfigurationActionUnsupportedGuid = 5,\r
202 EfiPlatformConfigurationActionMaximum\r
203} EFI_PLATFORM_CONFIGURATION_ACTION;\r
204\r
205\r
206/**\r
207 The UEFI driver repeatedly calls Query, processes the\r
208 information returned by the platform, and calls Response passing\r
209 in the arguments returned from Query. The UEFI driver must\r
210 continuously call Query until EFI_NOT_FOUND is returned. For\r
211 every call to Query that returns EFI_SUCCESS a corrisponding\r
212 call to Response is required passing in the same\r
213 ContollerHandle, ChildHandle, Instance, ParameterTypeGuid,\r
214 ParameterBlock, and ParameterBlockSize. The UEFI driver may\r
215 update values in ParameterBlock based on rules defined by\r
216 ParameterTypeGuid. The platform is responsible for freeing\r
217 ParameterBlock and the UEFI driver must not try to free it.\r
218\r
219 @param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.\r
220\r
221 @param ControllerHandle The handle the driver is returning\r
222 configuration information about.\r
223\r
224 @param ChildHandle The handle of the child controller to\r
225 return information on. This is an optional\r
226 parameter that may be NULL. It will be\r
227 NULL for device drivers, and for bus\r
228 drivers that attempt to get options for\r
229 the bus controller. It will not be NULL\r
230 for a bus driver that attempts to get\r
231 options for one of its child controllers.\r
232 Instance Instance data returned from\r
233 Query().\r
234\r
235 @param Instance Instance data passed to Query().\r
236\r
237 @param ParameterTypeGuid ParameterTypeGuid returned from Query.\r
238\r
239 @param ParameterBlock ParameterBlock returned from Query.\r
240\r
241 @param ParameterBlockSize The ParameterBlock size returned from Query.\r
242\r
243 @param ConfigurationAction The driver tells the platform what\r
244 action is required for ParameterBlock to\r
245 take effect.\r
246\r
247\r
248 @retval EFI_SUCCESS The platform return parameter information\r
249 for ControllerHandle.\r
250\r
251 @retval EFI_NOT_FOUND Instance was not found.\r
252\r
253 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
254\r
255 @retval EFI_INVALID_PARAMETER Instance is zero.\r
256\r
257**/\r
258typedef\r
259EFI_STATUS\r
260(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE)(\r
261 IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,\r
262 IN CONST EFI_HANDLE ControllerHandle,\r
263 IN CONST EFI_HANDLE ChildHandle OPTIONAL,\r
264 IN CONST UINTN *Instance,\r
265 IN CONST EFI_GUID *ParameterTypeGuid,\r
266 IN CONST VOID *ParameterBlock,\r
267 IN CONST UINTN ParameterBlockSize ,\r
268 IN CONST EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction\r
269);\r
270\r
271\r
272///\r
273/// The EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is used by the\r
274/// UEFI driver to query the platform for configuration information.\r
275/// The UEFI driver calls Query() multiple times to get\r
276/// configuration information from the platform. For every call to\r
277/// Query() there must be a matching call to Response() so the\r
278/// UEFI driver can inform the platform how it used the\r
279/// information passed in from Query(). It's legal for a UEFI\r
280/// driver to use Response() to inform the platform it does not\r
281/// understand the data returned via Query() and thus no action was\r
282/// taken.\r
283///\r
284struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL {\r
285 EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY Query;\r
286 EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE Response;\r
287};\r
288\r
289\r
290\r
291#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_CLP_GUID \\r
292 {0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e } }\r
293\r
294/**\r
295\r
296 ParameterTypeGuid provides the support for parameters\r
297 communicated through the DMTF SM CLP Specification 1.0 Final\r
298 Standard to be used to configure the UEFI driver. In this\r
299 section the producer of the\r
300 EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is platform\r
301 firmware and the consumer is the UEFI driver. Note: if future\r
302 versions of the DMTF SM CLP Specification require changes to the\r
303 parameter block definition, a newer ParameterTypeGuid will be\r
304 used.\r
305**/\r
306typedef struct {\r
307 CHAR8 *CLPCommand; ///< A pointer to the null-terminated UTF-8 string that specifies the DMTF SM CLP command\r
308 ///< line that the driver is required to parse and process when this function is called.\r
309 ///< See the DMTF SM CLP Specification 1.0 Final Standard for details on the\r
310 ///< format and syntax of the CLP command line string. CLPCommand buffer\r
311 ///< is allocated by the producer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOOL.\r
312 UINT32 CLPCommandLength; ///< The length of the CLP Command in bytes.\r
313 CHAR8 *CLPReturnString; ///< A pointer to the null-terminated UTF-8 string that indicates the CLP return status\r
314 ///< that the driver is required to provide to the calling agent.\r
315 ///< The calling agent may parse and/ or pass\r
316 ///< this for processing and user feedback. The SM CLP Command Response string\r
317 ///< buffer is filled in by the UEFI driver in the "keyword=value" format\r
318 ///< described in the SM CLP Specification, unless otherwise requested via the SM\r
319 ///< CLP Coutput option in the Command Line string buffer. UEFI driver's support\r
320 ///< for this default "keyword=value" output format is required if the UEFI\r
321 ///< driver supports this protocol, while support for other SM CLP output\r
322 ///< formats is optional (the UEFI Driver should return an EFI_UNSUPPORTED if\r
323 ///< the SM CLP Coutput option requested by the caller is not supported by the\r
324 ///< UEFI Driver). CLPReturnString buffer is allocated by the consumer of the\r
325 ///< EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to\r
326 ///< Response().\r
327 UINT32 CLPReturnStringLength; ///< The length of the CLP return status string in bytes.\r
328 UINT8 CLPCmdStatus; ///< SM CLP Command Status (see DMTF SM CLP Specification 1.0 Final Standard -\r
329 ///< Table 4) CLPErrorValue SM CLP Processing Error Value (see DMTF SM\r
330 ///< CLP Specification 1.0 Final Standard - Table 6). This field is filled in by\r
331 ///< the consumer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC\r
332 ///< OL and undefined prior to the call to Response().\r
333 UINT8 CLPErrorValue; ///< SM CLP Processing Error Value (see DMTF SM CLP Specification 1.0 Final Standard - Table 6).\r
334 ///< 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
335 UINT16 CLPMsgCode; ///< Bit 15: OEM Message Code Flag 0 = Message Code is an SM CLP Probable\r
336 ///< Cause Value. (see SM CLP Specification Table 11) 1 = Message Code is OEM\r
337 ///< Specific Bits 14-0: Message Code This field is filled in by the consumer of\r
338 ///< the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to\r
339 ///< Response().\r
340\r
341} EFI_CONFIGURE_CLP_PARAMETER_BLK;\r
342\r
343\r
344\r
345extern EFI_GUID gEfiPlatformToDriverConfigurationClpGuid;\r
346\r
347extern EFI_GUID gEfiPlatformToDriverConfigurationProtocolGuid;\r
348\r
349#endif\r