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