]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/HiiConfigRouting.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiConfigRouting.h
... / ...
CommitLineData
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
8Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9SPDX-License-Identifier: BSD-2-Clause-Patent\r
10\r
11 @par Revision Reference:\r
12 This Protocol was introduced in UEFI Specification 2.1.\r
13\r
14\r
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
23typedef struct _EFI_HII_CONFIG_ROUTING_PROTOCOL EFI_HII_CONFIG_ROUTING_PROTOCOL;\r
24\r
25/**\r
26\r
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
30 configuration string format. If Successful, Results contains an\r
31 equivalent string with "=" and the values associated with all\r
32 names added in. The expected implementation is for each\r
33 <ConfigRequest> substring in the Request to call the HII\r
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
45 hexadecimal (encoded as text) to binary) is a reference to a string in the\r
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
53 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
54 instance.\r
55\r
56 @param Request A null-terminated string in <MultiConfigRequest> format.\r
57\r
58 @param Progress On return, points to a character in the\r
59 Request string. Points to the string's null\r
60 terminator if the request was successful. Points\r
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
67 @param Results A null-terminated string in <MultiConfigAltResp> format\r
68 which has all values filled in for the names in the\r
69 Request string.\r
70\r
71 @retval EFI_SUCCESS The Results string is filled with the\r
72 values corresponding to all requested\r
73 names.\r
74\r
75 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the\r
76 parts of the results that must be\r
77 stored awaiting possible future\r
78 protocols.\r
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
84 is set to NULL.\r
85\r
86 @retval EFI_NOT_FOUND Routing data doesn't match any\r
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
96 to the most recent & before the\r
97 error, or the beginning of the\r
98 string.\r
99 @retval EFI_INVALID_PARAMETER The ExtractConfig function of the\r
100 underlying HII Configuration\r
101 Access Protocol returned\r
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
106\r
107**/\r
108typedef\r
109EFI_STATUS\r
110(EFIAPI *EFI_HII_EXTRACT_CONFIG)(\r
111 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
112 IN CONST EFI_STRING Request,\r
113 OUT EFI_STRING *Progress,\r
114 OUT EFI_STRING *Results\r
115 );\r
116\r
117/**\r
118 This function allows the caller to request the current configuration\r
119 for the entirety of the current HII database and returns the data in\r
120 a null-terminated string.\r
121\r
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
125 described in ExtractConfig() above.\r
126\r
127 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r
128\r
129 @param Results Null-terminated Unicode string in\r
130 <MultiConfigAltResp> format which has all values\r
131 filled in for the entirety of the current HII\r
132 database. String to be allocated by the called\r
133 function. De-allocation is up to the caller.\r
134\r
135 @retval EFI_SUCCESS The Results string is filled with the\r
136 values corresponding to all requested\r
137 names.\r
138\r
139 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the\r
140 parts of the results that must be\r
141 stored awaiting possible future\r
142 protocols.\r
143\r
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
150typedef\r
151EFI_STATUS\r
152(EFIAPI *EFI_HII_EXPORT_CONFIG)(\r
153 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
154 OUT EFI_STRING *Results\r
155 );\r
156\r
157/**\r
158\r
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
169 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r
170\r
171 @param Configuration A null-terminated string in <MulltiConfigResp> format.\r
172\r
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
177 the first name / value pair), or the\r
178 terminating NULL if all was successful.\r
179\r
180 @retval EFI_SUCCESS The results have been distributed or are\r
181 awaiting distribution.\r
182\r
183 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the\r
184 parts of the results that must be\r
185 stored awaiting possible future\r
186 protocols.\r
187\r
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
191\r
192 @retval EFI_NOT_FOUND The target for the specified routing data\r
193 was not found.\r
194\r
195**/\r
196typedef\r
197EFI_STATUS\r
198(EFIAPI *EFI_HII_ROUTE_CONFIG)(\r
199 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
200 IN CONST EFI_STRING Configuration,\r
201 OUT EFI_STRING *Progress\r
202 );\r
203\r
204/**\r
205\r
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
211 number of bytes to extract. These are mapped to a string\r
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
216 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r
217\r
218 @param ConfigRequest A null-terminated string in <ConfigRequest> format.\r
219\r
220 @param Block An array of bytes defining the block's\r
221 configuration.\r
222\r
223 @param BlockSize The length in bytes of Block.\r
224\r
225 @param Config The filled-in configuration string. String\r
226 allocated by the function. Returned only if\r
227 call is successful. The null-terminated string\r
228 will be <ConfigResp> format.\r
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
234 the first name / value pair), or the\r
235 terminating NULL if all was successful.\r
236\r
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
241 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate\r
242 Config. Progress points to the\r
243 first character of ConfigRequest.\r
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
252 @retval EFI_NOT_FOUND The target for the specified routing data\r
253 was not found. Progress points to the\r
254 'G' in "GUID" of the errant routing\r
255 data.\r
256 @retval EFI_DEVICE_ERROR The block is not large enough. Progress undefined.\r
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
265typedef\r
266EFI_STATUS\r
267(EFIAPI *EFI_HII_BLOCK_TO_CONFIG)(\r
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
272 OUT EFI_STRING *Config,\r
273 OUT EFI_STRING *Progress\r
274 );\r
275\r
276/**\r
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
290 @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r
291\r
292 @param ConfigResp A null-terminated string in <ConfigResp> format.\r
293\r
294 @param Block A possibly null array of bytes\r
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
302 parameter is updated, and an appropriate\r
303 status (see below) is returned.\r
304\r
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
307 output, if successful, contains the largest\r
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
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
317 name / value pair), or the terminating NULL\r
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
322 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate Config. Progress\r
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
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
336 @retval EFI_BUFFER_TOO_SMALL Block not large enough. Progress undefined.\r
337 BlockSize is updated with the required buffer size.\r
338\r
339**/\r
340typedef\r
341EFI_STATUS\r
342(EFIAPI *EFI_HII_CONFIG_TO_BLOCK)(\r
343 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
344 IN CONST EFI_STRING ConfigResp,\r
345 IN OUT UINT8 *Block,\r
346 IN OUT UINTN *BlockSize,\r
347 OUT EFI_STRING *Progress\r
348 );\r
349\r
350/**\r
351 This helper function is to be called by drivers to extract portions of\r
352 a larger configuration string.\r
353\r
354 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.\r
355 @param ConfigResp A null-terminated string in <ConfigAltResp> format.\r
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
363 values will be searched for.\r
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
371 then the current setting will be retrieved.\r
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
375 The null-terminated string will be <ConfigResp> format.\r
376\r
377 @retval EFI_SUCCESS The request succeeded. The requested data was extracted\r
378 and placed in the newly allocated AltCfgResp buffer.\r
379 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate AltCfgResp.\r
380 @retval EFI_INVALID_PARAMETER Any parameter is invalid.\r
381 @retval EFI_NOT_FOUND The target for the specified routing data was not found.\r
382**/\r
383typedef\r
384EFI_STATUS\r
385(EFIAPI *EFI_HII_GET_ALT_CFG)(\r
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
391 IN CONST UINT16 *AltCfgId,\r
392 OUT EFI_STRING *AltCfgResp\r
393 );\r
394\r
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
400struct _EFI_HII_CONFIG_ROUTING_PROTOCOL {\r
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
407};\r
408\r
409extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid;\r
410\r
411#endif\r