]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
ee6c452c | 2 | UEFI Platform to Driver Configuration Protocol is defined in UEFI specification.\r |
9095d37b LG |
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 | |
ee6c452c | 6 | configuration information as part of being started.\r |
d1f95000 | 7 | \r |
9095d37b | 8 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 9 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d1f95000 | 10 | \r |
d1f95000 | 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 | |
d1f95000 | 19 | typedef struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL;\r |
20 | \r | |
d1f95000 | 21 | /**\r |
22 | The UEFI driver must call Query early in the Start() function\r | |
23 | before any time consuming operations are performed. If\r | |
24 | ChildHandle is NULL the driver is requesting information from\r | |
25 | the platform about the ControllerHandle that is being started.\r | |
26 | Information returned from Query may lead to the drivers Start()\r | |
764f4d53 | 27 | function failing.\r |
630b4187 | 28 | If the UEFI driver is a bus driver and producing a ChildHandle,\r |
764f4d53 | 29 | the driver must call Query after the child handle has been created\r |
30 | and an EFI_DEVICE_PATH_PROTOCOL has been placed on that handle,\r | |
31 | but before any time consuming operation is performed. If information\r | |
32 | return by Query may lead the driver to decide to not create the\r | |
33 | ChildHandle. The driver must then cleanup and remove the ChildHandle\r | |
34 | from the system.\r | |
35 | The UEFI driver repeatedly calls Query, processes the information\r | |
36 | returned by the platform, and calls Response passing in the\r | |
37 | arguments returned from Query. The Instance value passed into\r | |
38 | Response must be the same value passed into the corresponding\r | |
a65c44c9 RN |
39 | call to Query. The UEFI driver must continuously call Query and\r |
40 | Response until EFI_NOT_FOUND is returned by Query.\r | |
41 | If the UEFI driver does not recognize the ParameterTypeGuid, it\r | |
42 | calls Response with a ConfigurationAction of\r | |
43 | EfiPlatformConfigurationActionUnsupportedGuid. The UEFI driver\r | |
44 | must then continue calling Query and Response until EFI_NOT_FOUND\r | |
45 | is returned by Query. This gives the platform an opportunity to\r | |
46 | pass additional configuration settings using a different\r | |
47 | ParameterTypeGuid that may be supported by the driver.\r | |
764f4d53 | 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 | |
d1f95000 | 51 | \r |
4ca9b6c4 | 52 | @param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.\r |
9095d37b | 53 | \r |
4ca9b6c4 LG |
54 | @param ControllerHandle The handle the platform will return\r |
55 | configuration information about.\r | |
9095d37b | 56 | \r |
4ca9b6c4 LG |
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 | |
630b4187 | 60 | NULL for device drivers and for bus\r |
4ca9b6c4 LG |
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 | |
9095d37b LG |
65 | \r |
66 | \r | |
764f4d53 | 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 | |
4ca9b6c4 LG |
77 | \r |
78 | @param ParameterBlock The platform returns a pointer to the\r | |
f754f721 | 79 | ParameterBlock structure which\r |
4ca9b6c4 LG |
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 | |
bbeea0de | 87 | ParameterTypeGuid. ParameterBlock is\r |
f754f721 | 88 | allocated by the platform and the\r |
4ca9b6c4 LG |
89 | platform is responsible for freeing\r |
90 | the ParameterBlock after Result is\r | |
91 | called.\r | |
d1f95000 | 92 | \r |
93 | @param ParameterBlockSize The platform returns the size of\r | |
94 | the ParameterBlock in bytes.\r | |
95 | \r | |
96 | \r | |
4ca9b6c4 LG |
97 | @retval EFI_SUCCESS The platform return parameter\r |
98 | information for ControllerHandle.\r | |
d1f95000 | 99 | \r |
4ca9b6c4 | 100 | @retval EFI_NOT_FOUND No more unread Instance exists.\r |
d1f95000 | 101 | \r |
18bd7e85 | 102 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
d1f95000 | 103 | \r |
104 | @retval EFI_INVALID_PARAMETER Instance is NULL.\r | |
105 | \r | |
4ca9b6c4 LG |
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 | |
d1f95000 | 111 | \r |
4ca9b6c4 LG |
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 | |
d1f95000 | 116 | \r |
117 | \r | |
118 | **/\r | |
119 | typedef\r | |
120 | EFI_STATUS\r | |
8b13229b | 121 | (EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY)(\r |
d1f95000 | 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 | |
764f4d53 | 125 | IN CONST UINTN *Instance,\r |
126 | OUT EFI_GUID **ParameterTypeGuid,\r | |
127 | OUT VOID **ParameterBlock,\r | |
128 | OUT UINTN *ParameterBlockSize\r | |
2f88bd3a | 129 | );\r |
d1f95000 | 130 | \r |
d1f95000 | 131 | typedef enum {\r |
cce6f7aa | 132 | ///\r |
133 | /// The controller specified by ControllerHandle is still\r | |
630b4187 | 134 | /// in a usable state, and its configuration has been updated\r |
cce6f7aa | 135 | /// via parsing the ParameterBlock. If required by the\r |
630b4187 | 136 | /// parameter block, and the module supports an NVRAM store,\r |
cce6f7aa | 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 | |
2f88bd3a | 142 | EfiPlatformConfigurationActionNone = 0,\r |
9095d37b | 143 | \r |
cce6f7aa | 144 | ///\r |
145 | /// The driver has detected that the controller specified\r | |
9095d37b | 146 | /// by ControllerHandle is not in a usable state and\r |
cce6f7aa | 147 | /// needs to be stopped. The calling agent can use the\r |
148 | /// DisconnectControservice to perform this operation, and\r | |
9095d37b | 149 | /// it should be performed as soon as possible.\r |
cce6f7aa | 150 | ///\r |
2f88bd3a | 151 | EfiPlatformConfigurationActionStopController = 1,\r |
9095d37b | 152 | \r |
cce6f7aa | 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 | |
630b4187 | 158 | /// operation. The restart operation can be delayed until\r |
9095d37b | 159 | /// all of the configuration options have been set.\r |
cce6f7aa | 160 | ///\r |
d1f95000 | 161 | EfiPlatformConfigurationActionRestartController = 2,\r |
9095d37b | 162 | \r |
cce6f7aa | 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 | |
9095d37b | 170 | /// been set.\r |
cce6f7aa | 171 | ///\r |
2f88bd3a | 172 | EfiPlatformConfigurationActionRestartPlatform = 3,\r |
cce6f7aa | 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 | |
9095d37b LG |
183 | /// after ControllerHandle is stopped.\r |
184 | ///\r | |
2f88bd3a | 185 | EfiPlatformConfigurationActionNvramFailed = 4,\r |
a65c44c9 RN |
186 | \r |
187 | ///\r | |
188 | /// The controller specified by ControllerHandle is still\r | |
189 | /// in a usable state; its configuration has not been updated\r | |
190 | /// via parsing the ParameterBlock. The driver did not support\r | |
191 | /// the ParameterBlock format identified by ParameterTypeGuid.\r | |
192 | /// No actions are required before this controller can be used\r | |
193 | /// again. On additional Query calls from this ControllerHandle,\r | |
194 | /// the platform should stop returning a ParameterBlock\r | |
195 | /// qualified by this same ParameterTypeGuid. If no other\r | |
196 | /// ParameterTypeGuid is supported by the platform, Query\r | |
197 | /// should return EFI_NOT_FOUND.\r | |
198 | ///\r | |
2f88bd3a | 199 | EfiPlatformConfigurationActionUnsupportedGuid = 5,\r |
d1f95000 | 200 | EfiPlatformConfigurationActionMaximum\r |
201 | } EFI_PLATFORM_CONFIGURATION_ACTION;\r | |
202 | \r | |
d1f95000 | 203 | /**\r |
204 | The UEFI driver repeatedly calls Query, processes the\r | |
205 | information returned by the platform, and calls Response passing\r | |
206 | in the arguments returned from Query. The UEFI driver must\r | |
207 | continuously call Query until EFI_NOT_FOUND is returned. For\r | |
208 | every call to Query that returns EFI_SUCCESS a corrisponding\r | |
209 | call to Response is required passing in the same\r | |
210 | ContollerHandle, ChildHandle, Instance, ParameterTypeGuid,\r | |
211 | ParameterBlock, and ParameterBlockSize. The UEFI driver may\r | |
212 | update values in ParameterBlock based on rules defined by\r | |
213 | ParameterTypeGuid. The platform is responsible for freeing\r | |
630b4187 | 214 | ParameterBlock and the UEFI driver must not try to free it.\r |
d1f95000 | 215 | \r |
f754f721 | 216 | @param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.\r |
d1f95000 | 217 | \r |
f754f721 | 218 | @param ControllerHandle The handle the driver is returning\r |
219 | configuration information about.\r | |
d1f95000 | 220 | \r |
f754f721 | 221 | @param ChildHandle The handle of the child controller to\r |
222 | return information on. This is an optional\r | |
223 | parameter that may be NULL. It will be\r | |
224 | NULL for device drivers, and for bus\r | |
225 | drivers that attempt to get options for\r | |
226 | the bus controller. It will not be NULL\r | |
227 | for a bus driver that attempts to get\r | |
228 | options for one of its child controllers.\r | |
229 | Instance Instance data returned from\r | |
230 | Query().\r | |
d1f95000 | 231 | \r |
f754f721 | 232 | @param Instance Instance data passed to Query().\r |
764f4d53 | 233 | \r |
f754f721 | 234 | @param ParameterTypeGuid ParameterTypeGuid returned from Query.\r |
d1f95000 | 235 | \r |
f754f721 | 236 | @param ParameterBlock ParameterBlock returned from Query.\r |
d1f95000 | 237 | \r |
f754f721 | 238 | @param ParameterBlockSize The ParameterBlock size returned from Query.\r |
d1f95000 | 239 | \r |
f754f721 | 240 | @param ConfigurationAction The driver tells the platform what\r |
241 | action is required for ParameterBlock to\r | |
242 | take effect.\r | |
9095d37b LG |
243 | \r |
244 | \r | |
4ca9b6c4 LG |
245 | @retval EFI_SUCCESS The platform return parameter information\r |
246 | for ControllerHandle.\r | |
9095d37b | 247 | \r |
4ca9b6c4 | 248 | @retval EFI_NOT_FOUND Instance was not found.\r |
9095d37b | 249 | \r |
18bd7e85 | 250 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
9095d37b | 251 | \r |
d1f95000 | 252 | @retval EFI_INVALID_PARAMETER Instance is zero.\r |
9095d37b | 253 | \r |
d1f95000 | 254 | **/\r |
255 | typedef\r | |
256 | EFI_STATUS\r | |
8b13229b | 257 | (EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE)(\r |
d1f95000 | 258 | IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,\r |
259 | IN CONST EFI_HANDLE ControllerHandle,\r | |
260 | IN CONST EFI_HANDLE ChildHandle OPTIONAL,\r | |
261 | IN CONST UINTN *Instance,\r | |
262 | IN CONST EFI_GUID *ParameterTypeGuid,\r | |
263 | IN CONST VOID *ParameterBlock,\r | |
2f88bd3a | 264 | IN CONST UINTN ParameterBlockSize,\r |
d1f95000 | 265 | IN CONST EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction\r |
2f88bd3a | 266 | );\r |
d1f95000 | 267 | \r |
44717a39 | 268 | ///\r |
269 | /// The EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is used by the\r | |
270 | /// UEFI driver to query the platform for configuration information.\r | |
271 | /// The UEFI driver calls Query() multiple times to get\r | |
272 | /// configuration information from the platform. For every call to\r | |
273 | /// Query() there must be a matching call to Response() so the\r | |
274 | /// UEFI driver can inform the platform how it used the\r | |
275 | /// information passed in from Query(). It's legal for a UEFI\r | |
276 | /// driver to use Response() to inform the platform it does not\r | |
277 | /// understand the data returned via Query() and thus no action was\r | |
278 | /// taken.\r | |
279 | ///\r | |
d1f95000 | 280 | struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL {\r |
2f88bd3a MK |
281 | EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY Query;\r |
282 | EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE Response;\r | |
d1f95000 | 283 | };\r |
284 | \r | |
d1f95000 | 285 | #define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_CLP_GUID \\r |
286 | {0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e } }\r | |
287 | \r | |
288 | /**\r | |
9095d37b | 289 | \r |
d1f95000 | 290 | ParameterTypeGuid provides the support for parameters\r |
291 | communicated through the DMTF SM CLP Specification 1.0 Final\r | |
292 | Standard to be used to configure the UEFI driver. In this\r | |
293 | section the producer of the\r | |
294 | EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is platform\r | |
295 | firmware and the consumer is the UEFI driver. Note: if future\r | |
296 | versions of the DMTF SM CLP Specification require changes to the\r | |
630b4187 | 297 | parameter block definition, a newer ParameterTypeGuid will be\r |
d1f95000 | 298 | used.\r |
d1f95000 | 299 | **/\r |
300 | typedef struct {\r | |
2f88bd3a MK |
301 | CHAR8 *CLPCommand; ///< A pointer to the null-terminated UTF-8 string that specifies the DMTF SM CLP command\r |
302 | ///< line that the driver is required to parse and process when this function is called.\r | |
303 | ///< See the DMTF SM CLP Specification 1.0 Final Standard for details on the\r | |
304 | ///< format and syntax of the CLP command line string. CLPCommand buffer\r | |
305 | ///< is allocated by the producer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOOL.\r | |
306 | UINT32 CLPCommandLength; ///< The length of the CLP Command in bytes.\r | |
307 | CHAR8 *CLPReturnString; ///< A pointer to the null-terminated UTF-8 string that indicates the CLP return status\r | |
308 | ///< that the driver is required to provide to the calling agent.\r | |
309 | ///< The calling agent may parse and/ or pass\r | |
310 | ///< this for processing and user feedback. The SM CLP Command Response string\r | |
311 | ///< buffer is filled in by the UEFI driver in the "keyword=value" format\r | |
312 | ///< described in the SM CLP Specification, unless otherwise requested via the SM\r | |
313 | ///< CLP Coutput option in the Command Line string buffer. UEFI driver's support\r | |
314 | ///< for this default "keyword=value" output format is required if the UEFI\r | |
315 | ///< driver supports this protocol, while support for other SM CLP output\r | |
316 | ///< formats is optional (the UEFI Driver should return an EFI_UNSUPPORTED if\r | |
317 | ///< the SM CLP Coutput option requested by the caller is not supported by the\r | |
318 | ///< UEFI Driver). CLPReturnString buffer is allocated by the consumer of the\r | |
319 | ///< EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to\r | |
320 | ///< Response().\r | |
321 | UINT32 CLPReturnStringLength; ///< The length of the CLP return status string in bytes.\r | |
322 | UINT8 CLPCmdStatus; ///< SM CLP Command Status (see DMTF SM CLP Specification 1.0 Final Standard -\r | |
323 | ///< Table 4) CLPErrorValue SM CLP Processing Error Value (see DMTF SM\r | |
324 | ///< CLP Specification 1.0 Final Standard - Table 6). This field is filled in by\r | |
325 | ///< the consumer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC\r | |
326 | ///< OL and undefined prior to the call to Response().\r | |
327 | UINT8 CLPErrorValue; ///< SM CLP Processing Error Value (see DMTF SM CLP Specification 1.0 Final Standard - Table 6).\r | |
328 | ///< 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 | |
329 | UINT16 CLPMsgCode; ///< Bit 15: OEM Message Code Flag 0 = Message Code is an SM CLP Probable\r | |
330 | ///< Cause Value. (see SM CLP Specification Table 11) 1 = Message Code is OEM\r | |
331 | ///< Specific Bits 14-0: Message Code This field is filled in by the consumer of\r | |
332 | ///< the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to\r | |
333 | ///< Response().\r | |
d1f95000 | 334 | } EFI_CONFIGURE_CLP_PARAMETER_BLK;\r |
335 | \r | |
2f88bd3a | 336 | extern EFI_GUID gEfiPlatformToDriverConfigurationClpGuid;\r |
d1f95000 | 337 | \r |
2f88bd3a | 338 | extern EFI_GUID gEfiPlatformToDriverConfigurationProtocolGuid;\r |
d1f95000 | 339 | \r |
340 | #endif\r |