2c8b87be23fec73cd3679eeae4f54ba74b9226fe
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiConfigAccess.h
1 /** @file
2
3 The file provides services to forward results to PCOL-based
4 handler if EFI HII results processing protocol invokes this
5 protocol.
6
7 Copyright (c) 2006 - 2007, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18
19 #ifndef __EFI_HII_CONFIG_ACCESS_H__
20 #define __EFI_HII_CONFIG_ACCESS_H__
21
22 #define EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \
23 { 0x330d4706, 0xf2a0, 0x4e4f, { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } }
24
25 typedef struct _EFI_HII_CONFIG_ACCESS_PROTOCOL EFI_HII_CONFIG_ACCESS_PROTOCOL;
26
27 /**
28
29 This function allows the caller to request the current
30 configuration for one or more named elements. The resulting
31 string is in <ConfigAltResp> format. Any and all alternative
32 configuration strings shall also be appended to the end of the
33 current configuration string. If they are, they must appear
34 after the current configuration. They must contain the same
35 routing (GUID, NAME, PATH) as the current configuration string.
36 They must have an additional description indicating the type of
37 alternative configuration the string represents,
38 "ALTCFG=<StringToken>". That <StringToken> (when
39 converted from Hex UNICODE to binary) is a reference to a
40 string in the associated string pack.
41
42 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
43
44 @param Request A null-terminated Unicode string in
45 <ConfigRequest> format. Note that this
46 includes the routing information as well as
47 the configurable name / value pairs. It is
48 invalid for this string to be in
49 <MultiConfigRequest> format.
50
51 @param Progress On return, points to a character in the
52 Request string. Points to the string's null
53 terminator if request was successful. Points
54 to the most recent "&" before the first
55 failing name / value pair (or the beginning
56 of the string if the failure is in the first
57 name / value pair) if the request was not
58 successful
59
60 @param Results A null-terminated Unicode string in
61 <ConfigAltResp> format which has all values
62 filled in for the names in the Request string.
63 String to be allocated by the called function.
64
65 @retval EFI_SUCCESS The Results string is filled with the
66 values corresponding to all requested
67 names.
68
69 @retval EFI_OUT_OF_MEMORY Not enough memory to store the
70 parts of the results that must be
71 stored awaiting possible future
72 protocols.
73
74 @retval EFI_INVALID_PARAMETER For example, passing in a NULL
75 for the Request parameter
76 would result in this type of
77 error. In this case, the
78 Progress parameter would be
79 set to NULL.
80
81 @retval EFI_NOT_FOUND Routing data doesn't match any
82 known driver. Progress set to the
83 first character in the routing header.
84 Note: There is no requirement that the
85 driver validate the routing data. It
86 must skip the <ConfigHdr> in order to
87 process the names.
88
89 @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set
90 to most recent & before the
91 error or the beginning of the
92 string.
93
94 @retval EFI_INVALID_PARAMETER Unknown name. Progress points
95 to the & before the name in
96 question.
97
98 **/
99 typedef
100 EFI_STATUS
101 (EFIAPI * EFI_HII_ACCESS_EXTRACT_CONFIG ) (
102 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
103 IN CONST EFI_STRING Request,
104 OUT EFI_STRING *Progress,
105 OUT EFI_STRING *Results
106 );
107
108
109 /**
110
111 This function applies changes in a driver's configuration.
112 Input is a Configuration, which has the routing data for this
113 driver followed by name / value configuration pairs. The driver
114 must apply those pairs to its configurable storage. If the
115 driver's configuration is stored in a linear block of data
116 and the driver????s name / value pairs are in <BlockConfig>
117 format, it may use the ConfigToBlock helper function (above) to
118 simplify the job.
119
120 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
121
122 @param Configuration A null-terminated Unicode string in
123 <ConfigString> format. Progress a
124 pointer to a string filled in with the
125 offset of the most recent '&' before the
126 first failing name / value pair (or the
127 beginn ing of the string if the failure
128 is in the first name / value pair) or
129 the terminating NULL if all was
130 successful.
131
132 @retval EFI_SUCCESS The results have been distributed or are
133 awaiting distribution.
134
135 @retval EFI_OUT_OF_MEMORY Not enough memory to store the
136 parts of the results that must be
137 stored awaiting possible future
138 protocols.
139
140 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
141 Results parameter would result
142 in this type of error.
143
144 @retval EFI_NOT_FOUND Target for the specified routing data
145 was not found
146
147 **/
148 typedef
149 EFI_STATUS
150 (EFIAPI * EFI_HII_ACCESS_ROUTE_CONFIG ) (
151 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
152 IN CONST EFI_STRING Configuration,
153 OUT EFI_STRING *Progress
154 );
155
156 /**
157
158 This function is called to provide results data to the driver.
159 This data consists of a unique key that is used to identify
160 which data is either being passed back or being asked for.
161
162 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
163
164 @param KeyValue A unique value which is sent to the original
165 exporting driver so that it can identify the
166 type of data to expect. The format of the
167 data tends to vary based on the opcode that
168 generated the callback.
169
170 @param Data A pointer to the data being sent to the original
171 exporting driver. The format of the data should
172 be the same as that of the question invoking the
173 callback and will be known to the recipient.
174
175 @retval EFI_SUCCESS The firmware has successfully stored the
176 variable and its data as defined by the
177 Attributes.
178
179 @retval EFI_INVALID_PARAMETER An invalid combination of
180 Attributes bits was supplied,
181 or the DataSize exceeds the
182 maximum allowed.
183
184 @retval EFI_OUT_OF_RESOURCES Not enough storage is available
185 to hold the variable and its
186 data.
187
188 @retval EFI_DEVICE_ERROR The variable could not be saved due
189 to a hardware failure.
190
191
192 **/
193 typedef
194 EFI_STATUS
195 (EFIAPI *EFI_FORM_CALLBACK) (
196 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
197 IN CONST UINT16 KeyValue,
198 IN CONST VOID *Data
199 );
200 /**
201
202 This protocol provides a callable interface between the HII and
203 drivers. Only drivers which provide IFR data to HII are required
204 to publish this protocol.
205
206 @param ExtractConfig This function breaks apart the UNICODE
207 request strings routing them to the
208 appropriate drivers. This function is
209 analogous to the similarly named
210 function in the HII Routing Protocol.
211
212 @param RouteConfig This function breaks apart the UNICODE
213 results strings and returns configuration
214 information as specified by the request.
215
216 @param Callback This function is called from the
217 configuration browser to communicate certain
218 activities that were initiated by a user.
219
220
221 **/
222 struct _EFI_HII_CONFIG_ACCESS_PROTOCOL {
223 EFI_HII_ACCESS_ROUTE_CONFIG ExtractConfig;
224 EFI_HII_ACCESS_EXTRACT_CONFIG RouteConfig;
225 EFI_FORM_CALLBACK Callback;
226 } ;
227
228 extern EFI_GUID gEfiHiiConfigAccessProtocolGuid;
229
230 #endif
231