]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/HiiConfigRouting.h
Clarify some definitions in HII Configure Routine Protocol
[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 Hex UNICODE 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
122 This function allows the caller to request the current
123 configuration for all of the current HII database. The results
124 include both the current and alternate configurations as
125 described in ExtractConfig() above.
126
127 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
128
129 @param Results A null-terminated Unicode string in
130 <MultiConfigAltResp> format which has all
131 values filled in for the names in the Request
132 string. String to be allocated by this
133 function. De-allocation is up to the caller.
134
135 @retval EFI_SUCCESS The Results string is filled with the
136 values corresponding to all requested
137 names.
138
139 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
140 parts of the results that must be
141 stored awaiting possible future
142 protocols.
143
144 @retval EFI_INVALID_PARAMETERS For example, passing in a NULL
145 for the Results parameter
146 would result in this type of
147 error.
148
149 **/
150 typedef
151 EFI_STATUS
152 (EFIAPI * EFI_HII_EXPORT_CONFIG)(
153 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
154 OUT EFI_STRING *Results
155 );
156
157 /**
158
159 This function routes the results of processing forms to the
160 appropriate targets. It scans for <ConfigHdr> within the string
161 and passes the header and subsequent body to the driver whose
162 location is described in the <ConfigHdr>. Many <ConfigHdr>s may
163 appear as a single request. The expected implementation is to
164 hand off the various <ConfigResp> substrings to the
165 Configuration Access Protocol RouteConfig routine corresponding
166 to the driver whose routing information is defined by the
167 <ConfigHdr> in turn.
168
169 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
170
171 @param Configuration A null-terminated Unicode string in
172 <MulltiConfigResp> format.
173
174 @param Progress A pointer to a string filled in with the
175 offset of the most recent '&' before the
176 first failing name / value pair (or the
177 beginning of the string if the failure is in
178 the first name / value pair) or the
179 terminating NULL if all was successful.
180
181 @retval EFI_SUCCESS The results have been distributed or are
182 awaiting distribution.
183
184 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
185 parts of the results that must be
186 stored awaiting possible future
187 protocols.
188
189 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
190 Results parameter would result
191 in this type of error.
192
193 @retval EFI_NOT_FOUND Target for the specified routing data
194 was not found
195
196 **/
197 typedef
198 EFI_STATUS
199 (EFIAPI * EFI_HII_ROUTE_CONFIG)(
200 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
201 IN CONST EFI_STRING Configuration,
202 OUT EFI_STRING *Progress
203 );
204
205
206 /**
207
208 This function extracts the current configuration from a block of
209 bytes. To do so, it requires that the ConfigRequest string
210 consists of a list of <BlockName> formatted names. It uses the
211 offset in the name to determine the index into the Block to
212 start the extraction and the width of each name to determine the
213 number of bytes to extract. These are mapped to a UNICODE value
214 using the equivalent of the C "%x" format (with optional leading
215 spaces). The call fails if, for any (offset, width) pair in
216 ConfigRequest, offset+value >= BlockSize.
217
218 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
219
220 @param ConfigRequest A null-terminated Unicode string in
221 <ConfigRequest> format.
222
223 @param Block Array of bytes defining the block's
224 configuration.
225
226 @param BlockSize Length in bytes of Block.
227
228 @param Config Filled-in configuration string. String
229 allocated by the function. Returned only if
230 call is successful.
231
232 @param Progress A pointer to a string filled in with the
233 offset of the most recent '&' before the
234 first failing name / value pair (or the
235 beginning of the string if the failure is in
236 the first name / value pair) or the
237 terminating NULL if all was successful.
238
239 @retval EFI_SUCCESS The request succeeded. Progress points
240 to the null terminator at the end of the
241 ConfigRequest string.
242
243 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate
244 Config. Progress points to the
245 first character of ConfigRequest.
246
247 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
248 ConfigRequest or Block
249 parameter would result in this
250 type of error. Progress points
251 to the first character of
252 ConfigRequest.
253
254 @retval EFI_NOT_FOUND Target for the specified routing data
255 was not found. Progress points to the
256 'G' in "GUID" of the errant routing
257 data.
258 @retval EFI_DEVICE_ERROR Block not large enough. Progress undefined.
259
260 @retval EFI_INVALID_PARAMETER Encountered non <BlockName>
261 formatted string. Block is
262 left updated and Progress
263 points at the '&' preceding
264 the first non-<BlockName>.
265
266 **/
267 typedef
268 EFI_STATUS
269 (EFIAPI * EFI_HII_BLOCK_TO_CONFIG)(
270 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
271 IN CONST EFI_STRING ConfigRequest,
272 IN CONST UINT8 *Block,
273 IN CONST UINTN BlockSize,
274 OUT EFI_STRING *Config,
275 OUT EFI_STRING *Progress
276 );
277
278
279
280 /**
281 This function maps a configuration containing a series of
282 <BlockConfig> formatted name value pairs in ConfigResp into a
283 Block so it may be stored in a linear mapped storage such as a
284 UEFI Variable. If present, the function skips GUID, NAME, and
285 PATH in <ConfigResp>. It stops when it finds a non-<BlockConfig>
286 name / value pair (after skipping the routing header) or when it
287 reaches the end of the string.
288 Example Assume an existing block containing: 00 01 02 03 04 05
289 And the ConfigResp string is:
290 OFFSET=4&WIDTH=1&VALUE=7&OFFSET=0&WIDTH=2&VALUE=AA55
291 The results are
292 55 AA 02 07 04 05
293
294 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
295
296 @param ConfigResp A null-terminated Unicode string in
297 <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 Unicode 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