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