]>
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 | |
4ca9b6c4 | 8 | Copyright (c) 2006 - 2008, Intel Corporation\r |
d1f95000 | 9 | All rights reserved. This program and the accompanying materials \r |
10 | are licensed and made available under the terms and conditions of the BSD License \r | |
11 | which accompanies this distribution. 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 | |
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 | |
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, 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 | Hex UNICODE 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 | |
4ca9b6c4 LG |
56 | @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r |
57 | instance.\r | |
d1f95000 | 58 | \r |
4ca9b6c4 LG |
59 | @param Request A null-terminated Unicode string in\r |
60 | <MultiConfigRequest> format.\r | |
d1f95000 | 61 | \r |
62 | @param Progress On return, points to a character in the\r | |
63 | Request string. Points to the string's null\r | |
64 | terminator if request was successful. Points\r | |
65 | to the most recent '&' before the first\r | |
66 | failing name / value pair (or the beginning\r | |
67 | of the string if the failure is in the first\r | |
68 | name / value pair) if the request was not\r | |
69 | successful\r | |
70 | \r | |
71 | @param Results Null-terminated Unicode string in\r | |
72 | <MultiConfigAltResp> format which has all\r | |
73 | values filled in for the names in the\r | |
74 | Request string. String to be allocated by\r | |
75 | the called function.\r | |
76 | \r | |
4ca9b6c4 LG |
77 | @retval EFI_SUCCESS The Results string is filled with the\r |
78 | values corresponding to all requested\r | |
79 | names.\r | |
d1f95000 | 80 | \r |
4ca9b6c4 LG |
81 | @retval EFI_OUT_OF_MEMORY Not enough memory to store the\r |
82 | parts of the results that must be\r | |
83 | stored awaiting possible future\r | |
84 | protocols.\r | |
d1f95000 | 85 | \r |
86 | @retval EFI_INVALID_PARAMETER For example, passing in a NULL\r | |
87 | for the Request parameter\r | |
88 | would result in this type of\r | |
89 | error. The Progress parameter\r | |
90 | is set to NULL. EFI_NOT_FOUND\r | |
91 | Routing data doesn't match any\r | |
92 | known driver. Progress set to\r | |
93 | the "G" in "GUID" of the\r | |
94 | routing header that doesn't\r | |
95 | match. Note: There is no\r | |
96 | requirement that all routing\r | |
97 | data be validated before any\r | |
98 | configuration extraction.\r | |
99 | \r | |
100 | @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set\r | |
101 | to most recent & before the\r | |
102 | error or the beginning of the\r | |
103 | string.\r | |
104 | @retval EFI_INVALID_PARAMETER Unknown name.\r | |
105 | \r | |
106 | \r | |
107 | **/\r | |
108 | typedef\r | |
109 | EFI_STATUS\r | |
8b13229b | 110 | (EFIAPI * EFI_HII_ROUTING_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 | |
115 | );\r | |
116 | \r | |
117 | /**\r | |
118 | \r | |
119 | This function allows the caller to request the current\r | |
120 | configuration for all of the current HII database. The results\r | |
121 | include both the current and alternate configurations as\r | |
122 | described in ExtractConfig() above. Implementation note: This\r | |
123 | call has deceptively few inputs but the implementation is likely\r | |
124 | to be somewhat complex. The requirement is to scan all IFR in\r | |
125 | the HII database to determine the list of names and then request\r | |
126 | the configuration using the corresponding drivers??\r | |
127 | EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig() interfaces below.\r | |
128 | \r | |
4ca9b6c4 | 129 | @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r |
d1f95000 | 130 | \r |
131 | @param Results A null-terminated Unicode string in\r | |
132 | <MultiConfigAltResp> format which has all\r | |
133 | values filled in for the names in the Request\r | |
134 | string. String to be allocated by this\r | |
135 | function. De-allocation is up to the caller.\r | |
136 | \r | |
4ca9b6c4 LG |
137 | @retval EFI_SUCCESS The Results string is filled with the\r |
138 | values corresponding to all requested\r | |
139 | names.\r | |
d1f95000 | 140 | \r |
4ca9b6c4 LG |
141 | @retval EFI_OUT_OF_MEMORY Not enough memory to store the\r |
142 | parts of the results that must be\r | |
143 | stored awaiting possible future\r | |
144 | protocols.\r | |
d1f95000 | 145 | \r |
146 | @retval EFI_INVALID_PARAMETERS For example, passing in a NULL\r | |
147 | for the Results parameter\r | |
148 | would result in this type of\r | |
149 | error.\r | |
150 | \r | |
151 | **/\r | |
152 | typedef\r | |
153 | EFI_STATUS\r | |
8b13229b | 154 | (EFIAPI * EFI_HII_ROUTING_EXPORT_CONFIG)(\r |
d1f95000 | 155 | IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r |
156 | OUT EFI_STRING *Results\r | |
157 | );\r | |
158 | \r | |
159 | /**\r | |
160 | \r | |
161 | This function routes the results of processing forms to the\r | |
162 | appropriate targets. It scans for <ConfigHdr> within the string\r | |
163 | and passes the header and subsequent body to the driver whose\r | |
164 | location is described in the <ConfigHdr>. Many <ConfigHdr>s may\r | |
165 | appear as a single request. The expected implementation is to\r | |
166 | hand off the various <ConfigResp> substrings to the\r | |
167 | Configuration Access Protocol RouteConfig routine corresponding\r | |
168 | to the driver whose routing information is defined by the\r | |
169 | <ConfigHdr> in turn.\r | |
170 | \r | |
4ca9b6c4 | 171 | @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r |
d1f95000 | 172 | \r |
173 | @param Configuration A null-terminated Unicode string in\r | |
174 | <MulltiConfigResp> format.\r | |
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 | |
180 | the first name / value pair) or the\r | |
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 |
4ca9b6c4 LG |
186 | @retval EFI_OUT_OF_MEMORY Not enough memory to store the\r |
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 | |
4ca9b6c4 LG |
195 | @retval EFI_NOT_FOUND Target for the specified routing data\r |
196 | was not found\r | |
d1f95000 | 197 | \r |
198 | **/\r | |
199 | typedef\r | |
200 | EFI_STATUS\r | |
8b13229b | 201 | (EFIAPI * EFI_HII_ROUTING_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 | |
215 | number of bytes to extract. These are mapped to a UNICODE value\r | |
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 |
222 | @param ConfigRequest A null-terminated Unicode string in\r | |
223 | <ConfigRequest> format.\r | |
224 | \r | |
4ca9b6c4 LG |
225 | @param Block Array of bytes defining the block's\r |
226 | configuration.\r | |
d1f95000 | 227 | \r |
228 | @param BlockSize Length in bytes of Block.\r | |
229 | \r | |
4ca9b6c4 LG |
230 | @param Config Filled-in configuration string. String\r |
231 | allocated by the function. Returned only if\r | |
232 | call is successful.\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 | |
238 | the first name / value pair) or the\r | |
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 | |
245 | @retval EFI_OUT_OF_MEMORY Not enough memory to allocate\r | |
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 | |
4ca9b6c4 LG |
256 | @retval EFI_NOT_FOUND Target for the specified routing data\r |
257 | was not found. Progress points to the\r | |
258 | 'G' in "GUID" of the errant routing\r | |
259 | data. EFI_DEVICE_ERROR Block not large\r | |
260 | 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 | |
8b13229b | 271 | (EFIAPI * EFI_HII_ROUTING_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 |
4ca9b6c4 LG |
298 | @param ConfigResp A null-terminated Unicode string in\r |
299 | <ConfigResp> format.\r | |
d1f95000 | 300 | \r |
4ca9b6c4 | 301 | @param Block A possibly null array of bytes\r |
d1f95000 | 302 | representing the current block. Only\r |
303 | bytes referenced in the ConfigResp\r | |
304 | string in the block are modified. If\r | |
305 | this parameter is null or if the\r | |
306 | BlockLength parameter is (on input)\r | |
307 | shorter than required by the\r | |
308 | Configuration string, only the BlockSize\r | |
309 | parameter is updated and an appropriate\r | |
310 | status (see below) is returned.\r | |
311 | \r | |
4ca9b6c4 LG |
312 | @param BlockSize The length of the Block in units of UINT8.\r |
313 | On input, this is the size of the Block. On\r | |
314 | output, if successful, contains the index of\r | |
315 | the last modified byte in the Block.\r | |
316 | \r | |
317 | @param Progress On return, points to an element of the\r | |
318 | ConfigResp string filled in with the offset\r | |
319 | of the most recent "&" before the first\r | |
320 | failing name / value pair (or the beginning\r | |
321 | of the string if the failure is in the first\r | |
322 | name / value pair) or the terminating NULL\r | |
323 | if all was successful.\r | |
324 | \r | |
325 | @retval EFI_SUCCESS The request succeeded. Progress points to the null\r | |
326 | terminator at the end of the ConfigResp string.\r | |
327 | @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate Config. Progress\r | |
328 | points to the first character of ConfigResp.\r | |
329 | @retval EFI_INVALID_PARAMETER Passing in a NULL for the ConfigResp or\r | |
330 | Block parameter would result in this type of\r | |
331 | error. Progress points to the first character of\r | |
332 | ConfigResp.\r | |
333 | @retval EFI_INVALID_PARAMETER Encountered non <BlockName> formatted name /\r | |
334 | value pair. Block is left updated and\r | |
335 | Progress points at the '&' preceding the first\r | |
336 | non-<BlockName>.\r | |
d1f95000 | 337 | \r |
338 | **/\r | |
339 | typedef\r | |
340 | EFI_STATUS\r | |
8b13229b | 341 | (EFIAPI * EFI_HII_ROUTING_CONFIG_TO_BLOCK)(\r |
d1f95000 | 342 | IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r |
7d582d6b | 343 | IN CONST EFI_STRING ConfigResp,\r |
344 | IN OUT UINT8 *Block,\r | |
d1f95000 | 345 | IN OUT UINTN *BlockSize,\r |
346 | OUT EFI_STRING *Progress\r | |
347 | );\r | |
348 | \r | |
4ca9b6c4 LG |
349 | /**\r |
350 | This helper function is to be called by drivers to extract portions of \r | |
351 | a larger configuration string.\r | |
352 | \r | |
353 | @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance. \r | |
354 | @param Configuration A null-terminated Unicode string in <MultiConfigAltResp> format.\r | |
355 | @param Guid A pointer to the GUID value to search for in the \r | |
356 | routing portion of the ConfigResp string when retrieving \r | |
357 | the requested data. If Guid is NULL, then all GUID \r | |
358 | values will be searched for.\r | |
359 | @param Name A pointer to the NAME value to search for in the \r | |
360 | routing portion of the ConfigResp string when retrieving \r | |
361 | the requested data. If Name is NULL, then all Name \r | |
362 | values will be searched for. \r | |
363 | @param DevicePath A pointer to the PATH value to search for in the \r | |
364 | routing portion of the ConfigResp string when retrieving \r | |
365 | the requested data. If DevicePath is NULL, then all \r | |
366 | DevicePath values will be searched for. \r | |
367 | @param AltCfgId A pointer to the ALTCFG value to search for in the \r | |
368 | routing portion of the ConfigResp string when retrieving \r | |
369 | the requested data. If this parameter is NULL, \r | |
370 | then the current setting will be retrieved.\r | |
371 | @param AltCfgResp A pointer to a buffer which will be allocated by the \r | |
372 | function which contains the retrieved string as requested. \r | |
373 | This buffer is only allocated if the call was successful. \r | |
374 | \r | |
375 | @retval EFI_SUCCESS The request succeeded. The requested data was extracted \r | |
376 | and placed in the newly allocated AltCfgResp buffer.\r | |
377 | @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate AltCfgResp. \r | |
378 | @retval EFI_INVALID_PARAMETER Any parameter is invalid.\r | |
379 | @retval EFI_NOT_FOUND Target for the specified routing data was not found.\r | |
380 | **/\r | |
7d582d6b | 381 | typedef\r |
382 | EFI_STATUS \r | |
8b13229b | 383 | (EFIAPI * EFI_HII_GET_ALT_CFG)(\r |
7d582d6b | 384 | IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This, \r |
385 | IN CONST EFI_STRING Configuration, \r | |
386 | IN CONST EFI_GUID *Guid, \r | |
387 | IN CONST EFI_STRING Name, \r | |
388 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, \r | |
389 | IN CONST UINT16 *AltCfgId,\r | |
390 | OUT EFI_STRING *AltCfgResp \r | |
ed66e1bc | 391 | );\r |
7d582d6b | 392 | \r |
44717a39 | 393 | ///\r |
394 | /// This protocol defines the configuration routing interfaces\r | |
395 | /// between external applications and the HII. There may only be one\r | |
396 | /// instance of this protocol in the system.\r | |
397 | ///\r | |
d1f95000 | 398 | struct _EFI_HII_CONFIG_ROUTING_PROTOCOL {\r |
399 | EFI_HII_ROUTING_EXTRACT_CONFIG ExtractConfig;\r | |
400 | EFI_HII_ROUTING_EXPORT_CONFIG ExportConfig;\r | |
401 | EFI_HII_ROUTING_ROUTE_CONFIG RouteConfig;\r | |
402 | EFI_HII_ROUTING_BLOCK_TO_CONFIG BlockToConfig;\r | |
403 | EFI_HII_ROUTING_CONFIG_TO_BLOCK ConfigToBlock;\r | |
7d582d6b | 404 | EFI_HII_GET_ALT_CFG GetAltConfig;\r |
d1f95000 | 405 | };\r |
406 | \r | |
407 | extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid;\r | |
408 | \r | |
409 | \r | |
410 | #endif\r | |
411 | \r |