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