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