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