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 - 2013, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials are licensed and made available under
10 the terms and conditions of the BSD License that accompanies this distribution.
11 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 #define EFI_BROWSER_ACTION_RETRIEVE   2
35 #define EFI_BROWSER_ACTION_FORM_OPEN  3
36 #define EFI_BROWSER_ACTION_FORM_CLOSE 4
37 #define EFI_BROWSER_ACTION_DEFAULT_STANDARD      0x1000
38 #define EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING 0x1001
39 #define EFI_BROWSER_ACTION_DEFAULT_SAFE          0x1002
40 #define EFI_BROWSER_ACTION_DEFAULT_PLATFORM      0x2000
41 #define EFI_BROWSER_ACTION_DEFAULT_HARDWARE      0x3000
42 #define EFI_BROWSER_ACTION_DEFAULT_FIRMWARE      0x4000
43 
44 /**
45 
46   This function allows the caller to request the current
47   configuration for one or more named elements. The resulting
48   string is in <ConfigAltResp> format. Any and all alternative
49   configuration strings shall also be appended to the end of the
50   current configuration string. If they are, they must appear
51   after the current configuration. They must contain the same
52   routing (GUID, NAME, PATH) as the current configuration string.
53   They must have an additional description indicating the type of
54   alternative configuration the string represents,
55   "ALTCFG=<StringToken>". That <StringToken> (when
56   converted from Hex UNICODE to binary) is a reference to a
57   string in the associated string pack.
58 
59   @param This       Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
60 
61   @param Request    A null-terminated Unicode string in
62                     <ConfigRequest> format. Note that this
63                     includes the routing information as well as
64                     the configurable name / value pairs. It is
65                     invalid for this string to be in
66                     <MultiConfigRequest> format.
67                     If a NULL is passed in for the Request field,
68                     all of the settings being abstracted by this function
69                     will be returned in the Results field.  In addition,
70                     if a ConfigHdr is passed in with no request elements,
71                     all of the settings being abstracted for that particular
72                     ConfigHdr reference will be returned in the Results Field.
73 
74   @param Progress   On return, points to a character in the
75                     Request string. Points to the string's null
76                     terminator if request was successful. Points
77                     to the most recent "&" before the first
78                     failing name / value pair (or the beginning
79                     of the string if the failure is in the first
80                     name / value pair) if the request was not
81                     successful.
82 
83   @param Results    A null-terminated Unicode string in
84                     <MultiConfigAltResp> format which has all values
85                     filled in for the names in the Request string.
86                     String to be allocated by the called function.
87 
88   @retval EFI_SUCCESS             The Results string is filled with the
89                                   values corresponding to all requested
90                                   names.
91 
92   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the
93                                   parts of the results that must be
94                                   stored awaiting possible future
95                                   protocols.
96 
97   @retval EFI_NOT_FOUND           A configuration element matching
98                                   the routing data is not found.
99                                   Progress set to the first character
100                                   in the routing header.
101 
102   @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set
103                                   to most recent "&" before the
104                                   error or the beginning of the
105                                   string.
106 
107   @retval EFI_INVALID_PARAMETER   Unknown name. Progress points
108                                   to the & before the name in
109                                   question.
110 
111 **/
112 typedef
113 EFI_STATUS
114 (EFIAPI * EFI_HII_ACCESS_EXTRACT_CONFIG)(
115   IN CONST  EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,
116   IN CONST  EFI_STRING                      Request,
117   OUT       EFI_STRING                      *Progress,
118   OUT       EFI_STRING                      *Results
119 );
120 
121 
122 /**
123 
124   This function applies changes in a driver's configuration.
125   Input is a Configuration, which has the routing data for this
126   driver followed by name / value configuration pairs. The driver
127   must apply those pairs to its configurable storage. If the
128   driver's configuration is stored in a linear block of data
129   and the driver's name / value pairs are in <BlockConfig>
130   format, it may use the ConfigToBlock helper function (above) to
131   simplify the job.
132 
133   @param This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
134 
135   @param Configuration  A null-terminated Unicode string in
136                         <ConfigString> format.
137 
138   @param Progress       A pointer to a string filled in with the
139                         offset of the most recent '&' before the
140                         first failing name / value pair (or the
141                         beginn ing of the string if the failure
142                         is in the first name / value pair) or
143                         the terminating NULL if all was
144                         successful.
145 
146   @retval EFI_SUCCESS             The results have been distributed or are
147                                   awaiting distribution.
148 
149   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the
150                                   parts of the results that must be
151                                   stored awaiting possible future
152                                   protocols.
153 
154   @retval EFI_INVALID_PARAMETERS  Passing in a NULL for the
155                                   Results parameter would result
156                                   in this type of error.
157 
158   @retval EFI_NOT_FOUND           Target for the specified routing data
159                                   was not found
160 
161 **/
162 typedef
163 EFI_STATUS
164 (EFIAPI * EFI_HII_ACCESS_ROUTE_CONFIG)(
165   IN CONST  EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,
166   IN CONST  EFI_STRING                      Configuration,
167   OUT       EFI_STRING                      *Progress
168 );
169 
170 /**
171 
172   This function is called to provide results data to the driver.
173   This data consists of a unique key that is used to identify
174   which data is either being passed back or being asked for.
175 
176   @param  This                   Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
177   @param  Action                 Specifies the type of action taken by the browser.
178   @param  QuestionId             A unique value which is sent to the original
179                                  exporting driver so that it can identify the type
180                                  of data to expect. The format of the data tends to
181                                  vary based on the opcode that generated the callback.
182   @param  Type                   The type of value for the question.
183   @param  Value                  A pointer to the data being sent to the original
184                                  exporting driver.
185   @param  ActionRequest          On return, points to the action requested by the
186                                  callback function.
187 
188   @retval EFI_SUCCESS            The callback successfully handled the action.
189   @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the
190                                  variable and its data.
191   @retval EFI_DEVICE_ERROR       The variable could not be saved.
192   @retval EFI_UNSUPPORTED        The specified Action is not supported by the
193                                  callback.
194 **/
195 typedef
196 EFI_STATUS
197 (EFIAPI *EFI_HII_ACCESS_FORM_CALLBACK)(
198   IN     CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
199   IN     EFI_BROWSER_ACTION                     Action,
200   IN     EFI_QUESTION_ID                        QuestionId,
201   IN     UINT8                                  Type,
202   IN OUT EFI_IFR_TYPE_VALUE                     *Value,
203   OUT    EFI_BROWSER_ACTION_REQUEST             *ActionRequest
204   )
205   ;
206 
207 ///
208 /// This protocol provides a callable interface between the HII and
209 /// drivers. Only drivers which provide IFR data to HII are required
210 /// to publish this protocol.
211 ///
212 struct _EFI_HII_CONFIG_ACCESS_PROTOCOL {
213   EFI_HII_ACCESS_EXTRACT_CONFIG     ExtractConfig;
214   EFI_HII_ACCESS_ROUTE_CONFIG       RouteConfig;
215   EFI_HII_ACCESS_FORM_CALLBACK      Callback;
216 } ;
217 
218 extern EFI_GUID gEfiHiiConfigAccessProtocolGuid;
219 
220 #endif
221 
222 
223