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