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