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