]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/HiiConfigRouting.h
sync comments on data structure to follow latest UEFI spec.
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiConfigRouting.h
1 /** @file
2 The file provides services to manage the movement of
3 configuration data from drivers to configuration applications.
4 It then serves as the single point to receive configuration
5 information from configuration applications, routing the
6 results to the appropriate drivers.
7
8 Copyright (c) 2006 - 2009, Intel Corporation
9 All rights reserved. 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 __HII_CONFIG_ROUTING_H__
20 #define __HII_CONFIG_ROUTING_H__
21
22 #define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \
23 { 0x587e72d7, 0xcc50, 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } }
24
25
26 typedef struct _EFI_HII_CONFIG_ROUTING_PROTOCOL EFI_HII_CONFIG_ROUTING_PROTOCOL;
27
28 /**
29
30 This function allows the caller to request the current
31 configuration for one or more named elements from one or more
32 drivers. The resulting string is in the standard HII
33 configuration string format. If Successful Results contains an
34 equivalent string with "=" and the values associated with all
35 names added in. The expected implementation is for each
36 <ConfigRequest> substring in the Request, call the HII
37 Configuration Routing Protocol ExtractProtocol function for the
38 driver corresponding to the <ConfigHdr> at the start of the
39 <ConfigRequest> substring. The request fails if no driver
40 matches the <ConfigRequest> substring. Note: Alternative
41 configuration strings may also be appended to the end of the
42 current configuration string. If they are, they must appear
43 after the current configuration. They must contain the same
44 routing (GUID, NAME, PATH) as the current configuration string.
45 They must have an additional description indicating the type of
46 alternative configuration the string represents,
47 "ALTCFG=<StringToken>". That <StringToken> (when converted from
48 hexadecimal (encoded as text) to binary) is a reference to a string in the
49 associated string pack. As an example, assume that the Request
50 string is:
51 GUID=...&NAME=00480050&PATH=...&Fred&George&Ron&Neville A result
52 might be:
53 GUID=...&NAME=00480050&PATH=...&Fred=16&George=16&Ron=12&Neville=11&
54 GUID=...&NAME=00480050&PATH=...&ALTCFG=0037&Fred=12&Neville=7
55
56 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL
57 instance.
58
59 @param Request A null-terminated string in <MultiConfigRequest>
60 format. If a NULL is passed in for the Request field,
61 all of the settings being abstracted by this function
62 will be returned in the Results field.
63
64 @param Progress On return, points to a character in the
65 Request string. Points to the string's null
66 terminator if request was successful. Points
67 to the most recent '&' before the first
68 failing name / value pair (or the beginning
69 of the string if the failure is in the first
70 name / value pair) if the request was not
71 successful
72
73 @param Results A null-terminated string in <ConfigAltResp> format
74 which has all values filled in for the names in the
75 Request string. If the Request string was NULL, the data
76 returned is in <MultiConfigAltResp> format. String to be
77 allocated by the called function.
78
79 @retval EFI_SUCCESS The Results string is filled with the
80 values corresponding to all requested
81 names.
82
83 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
84 parts of the results that must be
85 stored awaiting possible future
86 protocols.
87
88 @retval EFI_INVALID_PARAMETER For example, passing in a NULL
89 for the Request parameter
90 would result in this type of
91 error. The Progress parameter
92 is set to NULL.
93
94 @retval EFI_NOT_FOUND Routing data doesn't match any
95 known driver. Progress set to
96 the "G" in "GUID" of the
97 routing header that doesn't
98 match. Note: There is no
99 requirement that all routing
100 data be validated before any
101 configuration extraction.
102
103 @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set
104 to most recent & before the
105 error or the beginning of the
106 string.
107 @retval EFI_INVALID_PARAMETER Unknown name.
108
109
110 **/
111 typedef
112 EFI_STATUS
113 (EFIAPI * EFI_HII_EXTRACT_CONFIG)(
114 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
115 IN CONST EFI_STRING Request,
116 OUT EFI_STRING *Progress,
117 OUT EFI_STRING *Results
118 );
119
120 /**
121 This function allows the caller to request the current configuration
122 for the entirety of the current HII database and returns the data in
123 a null-terminated string.
124
125 This function allows the caller to request the current
126 configuration for all of the current HII database. The results
127 include both the current and alternate configurations as
128 described in ExtractConfig() above.
129
130 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
131
132 @param Results A null-terminated string in <MultiConfigAltResp>
133 format which has all values filled in for the
134 names in the Request string.
135 String to be allocated by this function.
136 De-allocation is up to the caller.
137
138 @retval EFI_SUCCESS The Results string is filled with the
139 values corresponding to all requested
140 names.
141
142 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
143 parts of the results that must be
144 stored awaiting possible future
145 protocols.
146
147 @retval EFI_INVALID_PARAMETERS For example, passing in a NULL
148 for the Results parameter
149 would result in this type of
150 error.
151
152 **/
153 typedef
154 EFI_STATUS
155 (EFIAPI * EFI_HII_EXPORT_CONFIG)(
156 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
157 OUT EFI_STRING *Results
158 );
159
160 /**
161
162 This function routes the results of processing forms to the
163 appropriate targets. It scans for <ConfigHdr> within the string
164 and passes the header and subsequent body to the driver whose
165 location is described in the <ConfigHdr>. Many <ConfigHdr>s may
166 appear as a single request. The expected implementation is to
167 hand off the various <ConfigResp> substrings to the
168 Configuration Access Protocol RouteConfig routine corresponding
169 to the driver whose routing information is defined by the
170 <ConfigHdr> in turn.
171
172 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
173
174 @param Configuration A null-terminated string in <MulltiConfigResp> format.
175
176 @param Progress A pointer to a string filled in with the
177 offset of the most recent '&' before the
178 first failing name / value pair (or the
179 beginning of the string if the failure is in
180 the first name / value pair) or the
181 terminating NULL if all was successful.
182
183 @retval EFI_SUCCESS The results have been distributed or are
184 awaiting distribution.
185
186 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
187 parts of the results that must be
188 stored awaiting possible future
189 protocols.
190
191 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
192 Results parameter would result
193 in this type of error.
194
195 @retval EFI_NOT_FOUND Target for the specified routing data
196 was not found
197
198 **/
199 typedef
200 EFI_STATUS
201 (EFIAPI * EFI_HII_ROUTE_CONFIG)(
202 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
203 IN CONST EFI_STRING Configuration,
204 OUT EFI_STRING *Progress
205 );
206
207
208 /**
209
210 This function extracts the current configuration from a block of
211 bytes. To do so, it requires that the ConfigRequest string
212 consists of a list of <BlockName> formatted names. It uses the
213 offset in the name to determine the index into the Block to
214 start the extraction and the width of each name to determine the
215 number of bytes to extract. These are mapped to a string
216 using the equivalent of the C "%x" format (with optional leading
217 spaces). The call fails if, for any (offset, width) pair in
218 ConfigRequest, offset+value >= BlockSize.
219
220 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
221
222 @param ConfigRequest A null-terminated string in <ConfigRequest> format.
223
224 @param Block Array of bytes defining the block's
225 configuration.
226
227 @param BlockSize Length in bytes of Block.
228
229 @param Config Filled-in configuration string. String
230 allocated by the function. Returned only if
231 call is successful.
232
233 @param Progress A pointer to a string filled in with the
234 offset of the most recent '&' before the
235 first failing name / value pair (or the
236 beginning of the string if the failure is in
237 the first name / value pair) or the
238 terminating NULL if all was successful.
239
240 @retval EFI_SUCCESS The request succeeded. Progress points
241 to the null terminator at the end of the
242 ConfigRequest string.
243
244 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate
245 Config. Progress points to the
246 first character of ConfigRequest.
247
248 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
249 ConfigRequest or Block
250 parameter would result in this
251 type of error. Progress points
252 to the first character of
253 ConfigRequest.
254
255 @retval EFI_NOT_FOUND Target for the specified routing data
256 was not found. Progress points to the
257 'G' in "GUID" of the errant routing
258 data.
259 @retval EFI_DEVICE_ERROR Block not large enough. Progress undefined.
260
261 @retval EFI_INVALID_PARAMETER Encountered non <BlockName>
262 formatted string. Block is
263 left updated and Progress
264 points at the '&' preceding
265 the first non-<BlockName>.
266
267 **/
268 typedef
269 EFI_STATUS
270 (EFIAPI * EFI_HII_BLOCK_TO_CONFIG)(
271 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
272 IN CONST EFI_STRING ConfigRequest,
273 IN CONST UINT8 *Block,
274 IN CONST UINTN BlockSize,
275 OUT EFI_STRING *Config,
276 OUT EFI_STRING *Progress
277 );
278
279
280
281 /**
282 This function maps a configuration containing a series of
283 <BlockConfig> formatted name value pairs in ConfigResp into a
284 Block so it may be stored in a linear mapped storage such as a
285 UEFI Variable. If present, the function skips GUID, NAME, and
286 PATH in <ConfigResp>. It stops when it finds a non-<BlockConfig>
287 name / value pair (after skipping the routing header) or when it
288 reaches the end of the string.
289 Example Assume an existing block containing: 00 01 02 03 04 05
290 And the ConfigResp string is:
291 OFFSET=4&WIDTH=1&VALUE=7&OFFSET=0&WIDTH=2&VALUE=AA55
292 The results are
293 55 AA 02 07 04 05
294
295 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
296
297 @param ConfigResp A null-terminated string in <ConfigResp> format.
298
299 @param Block A possibly null array of bytes
300 representing the current block. Only
301 bytes referenced in the ConfigResp
302 string in the block are modified. If
303 this parameter is null or if the
304 BlockLength parameter is (on input)
305 shorter than required by the
306 Configuration string, only the BlockSize
307 parameter is updated and an appropriate
308 status (see below) is returned.
309
310 @param BlockSize The length of the Block in units of UINT8.
311 On input, this is the size of the Block. On
312 output, if successful, contains the index of
313 the last modified byte in the Block.
314
315 @param Progress On return, points to an element of the
316 ConfigResp string filled in with the offset
317 of the most recent "&" before the first
318 failing name / value pair (or the beginning
319 of the string if the failure is in the first
320 name / value pair) or the terminating NULL
321 if all was successful.
322
323 @retval EFI_SUCCESS The request succeeded. Progress points to the null
324 terminator at the end of the ConfigResp string.
325 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate Config. Progress
326 points to the first character of ConfigResp.
327 @retval EFI_INVALID_PARAMETER Passing in a NULL for the ConfigResp or
328 Block parameter would result in this type of
329 error. Progress points to the first character of
330 ConfigResp.
331 @retval EFI_INVALID_PARAMETER Encountered non <BlockName> formatted name /
332 value pair. Block is left updated and
333 Progress points at the '&' preceding the first
334 non-<BlockName>.
335
336 **/
337 typedef
338 EFI_STATUS
339 (EFIAPI * EFI_HII_CONFIG_TO_BLOCK)(
340 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
341 IN CONST EFI_STRING ConfigResp,
342 IN OUT UINT8 *Block,
343 IN OUT UINTN *BlockSize,
344 OUT EFI_STRING *Progress
345 );
346
347 /**
348 This helper function is to be called by drivers to extract portions of
349 a larger configuration string.
350
351 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
352 @param Configuration A null-terminated string in <MultiConfigAltResp> format.
353 @param Guid A pointer to the GUID value to search for in the
354 routing portion of the ConfigResp string when retrieving
355 the requested data. If Guid is NULL, then all GUID
356 values will be searched for.
357 @param Name A pointer to the NAME value to search for in the
358 routing portion of the ConfigResp string when retrieving
359 the requested data. If Name is NULL, then all Name
360 values will be searched for.
361 @param DevicePath A pointer to the PATH value to search for in the
362 routing portion of the ConfigResp string when retrieving
363 the requested data. If DevicePath is NULL, then all
364 DevicePath values will be searched for.
365 @param AltCfgId A pointer to the ALTCFG value to search for in the
366 routing portion of the ConfigResp string when retrieving
367 the requested data. If this parameter is NULL,
368 then the current setting will be retrieved.
369 @param AltCfgResp A pointer to a buffer which will be allocated by the
370 function which contains the retrieved string as requested.
371 This buffer is only allocated if the call was successful.
372
373 @retval EFI_SUCCESS The request succeeded. The requested data was extracted
374 and placed in the newly allocated AltCfgResp buffer.
375 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate AltCfgResp.
376 @retval EFI_INVALID_PARAMETER Any parameter is invalid.
377 @retval EFI_NOT_FOUND Target for the specified routing data was not found.
378 **/
379 typedef
380 EFI_STATUS
381 (EFIAPI * EFI_HII_GET_ALT_CFG)(
382 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
383 IN CONST EFI_STRING Configuration,
384 IN CONST EFI_GUID *Guid,
385 IN CONST EFI_STRING Name,
386 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
387 IN CONST UINT16 *AltCfgId,
388 OUT EFI_STRING *AltCfgResp
389 );
390
391 ///
392 /// This protocol defines the configuration routing interfaces
393 /// between external applications and the HII. There may only be one
394 /// instance of this protocol in the system.
395 ///
396 struct _EFI_HII_CONFIG_ROUTING_PROTOCOL {
397 EFI_HII_EXTRACT_CONFIG ExtractConfig;
398 EFI_HII_EXPORT_CONFIG ExportConfig;
399 EFI_HII_ROUTE_CONFIG RouteConfig;
400 EFI_HII_BLOCK_TO_CONFIG BlockToConfig;
401 EFI_HII_CONFIG_TO_BLOCK ConfigToBlock;
402 EFI_HII_GET_ALT_CFG GetAltConfig;
403 };
404
405 extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid;
406
407
408 #endif
409