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