]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.h
SecurityPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / SecurityPkg / Tcg / Opal / OpalPassword / OpalHii.h
1 /** @file
2 Public Header file of HII library used by Opal UEFI Driver.
3 Defines required callbacks of Opal HII library.
4
5 Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _OPAL_HII_H_
11 #define _OPAL_HII_H_
12
13 #include <Protocol/HiiConfigAccess.h>
14
15 #include "OpalDriver.h"
16 #include "OpalHiiFormValues.h"
17
18 #define OPAL_PASSWORD_CONFIG_GUID \
19 { \
20 0x0d510a4f, 0xa81b, 0x473f, { 0x87, 0x07, 0xb7, 0xfd, 0xfb, 0xc0, 0x45, 0xba } \
21 }
22
23 #define OPAL_REQUEST_VARIABLE_NAME L"OpalRequest"
24
25 #pragma pack(1)
26
27 typedef struct {
28 UINT32 Length;
29 OPAL_REQUEST OpalRequest;
30 //EFI_DEVICE_PATH_PROTOCOL OpalDevicePath;
31 } OPAL_REQUEST_VARIABLE;
32
33 typedef struct {
34 UINT16 Id: HII_KEY_ID_BITS;
35 UINT16 Index: HII_KEY_INDEX_BITS;
36 UINT16 Flag: HII_KEY_FLAG_BITS;
37 } KEY_BITS;
38
39 typedef union {
40 UINT16 Raw;
41 KEY_BITS KeyBits;
42 } HII_KEY;
43
44 typedef struct {
45 VENDOR_DEVICE_PATH VendorDevicePath;
46 EFI_DEVICE_PATH_PROTOCOL End;
47 } HII_VENDOR_DEVICE_PATH;
48
49 #pragma pack()
50
51 extern const EFI_GUID gHiiSetupVariableGuid;
52
53 /**
54 This function processes the results of changes in configuration.
55
56 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
57 @param Configuration A null-terminated Unicode string in <ConfigResp>
58 format.
59 @param Progress A pointer to a string filled in with the offset of
60 the most recent '&' before the first failing
61 name/value pair (or the beginning of the string if
62 the failure is in the first name/value pair) or
63 the terminating NULL if all was successful.
64
65 @retval EFI_SUCCESS The Results is processed successfully.
66 @retval EFI_INVALID_PARAMETER Configuration is NULL.
67 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
68 driver.
69
70 **/
71 EFI_STATUS
72 EFIAPI
73 RouteConfig(
74 CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
75 CONST EFI_STRING Configuration,
76 EFI_STRING *Progress
77 );
78
79 /**
80 This function allows a caller to extract the current configuration for one
81 or more named elements from the target driver.
82
83 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
84 @param Request A null-terminated Unicode string in
85 <ConfigRequest> format.
86 @param Progress On return, points to a character in the Request
87 string. Points to the string's null terminator if
88 request was successful. Points to the most recent
89 '&' before the first failing name/value pair (or
90 the beginning of the string if the failure is in
91 the first name/value pair) if the request was not
92 successful.
93 @param Results A null-terminated Unicode string in
94 <ConfigAltResp> format which has all values filled
95 in for the names in the Request string. String to
96 be allocated by the called function.
97
98 @retval EFI_SUCCESS The Results is filled with the requested values.
99 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
100 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
101 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
102 driver.
103
104 **/
105 EFI_STATUS
106 EFIAPI
107 ExtractConfig(
108 CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
109 CONST EFI_STRING Request,
110 EFI_STRING *Progress,
111 EFI_STRING *Results
112 );
113
114 /**
115 This function processes the results of changes in configuration.
116
117 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
118 @param Action Specifies the type of action taken by the browser.
119 @param QuestionId A unique value which is sent to the original
120 exporting driver so that it can identify the type
121 of data to expect.
122 @param Type The type of value for the question.
123 @param Value A pointer to the data being sent to the original
124 exporting driver.
125 @param ActionRequest On return, points to the action requested by the
126 callback function.
127
128 @retval EFI_SUCCESS The callback successfully handled the action.
129 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
130 variable and its data.
131 @retval EFI_DEVICE_ERROR The variable could not be saved.
132 @retval EFI_UNSUPPORTED The specified Action is not supported by the
133 callback.
134
135 **/
136 EFI_STATUS
137 EFIAPI
138 DriverCallback(
139 CONST EFI_HII_CONFIG_ACCESS_PROTOCOL* This,
140 EFI_BROWSER_ACTION Action,
141 EFI_QUESTION_ID QuestionId,
142 UINT8 Type,
143 EFI_IFR_TYPE_VALUE* Value,
144 EFI_BROWSER_ACTION_REQUEST* ActionRequest
145 );
146
147 /**
148
149 Pass the current system state to the bios via the hii_G_Configuration.
150
151 **/
152 VOID
153 OpalHiiSetBrowserData (
154 VOID
155 );
156
157 /**
158
159 Populate the hii_g_Configuraton with the browser Data.
160
161 **/
162 VOID
163 OpalHiiGetBrowserData (
164 VOID
165 );
166
167 /**
168 Draws the disk info form.
169
170 @retval EFI_SUCCESS Draw the disk info success.
171
172 **/
173 EFI_STATUS
174 HiiPopulateDiskInfoForm(
175 VOID
176 );
177
178 /**
179 Update the global Disk index info.
180
181 @param Index The input disk index info.
182
183 @retval EFI_SUCCESS Update the disk index info success.
184
185 **/
186 EFI_STATUS
187 HiiSelectDisk(
188 UINT8 Index
189 );
190
191 /**
192 Use the input password to do the specified action.
193
194 @param Str The input password saved in.
195
196 @retval EFI_SUCCESS Do the required action success.
197 @retval Others Other error occur.
198
199 **/
200 EFI_STATUS
201 HiiPasswordEntered(
202 EFI_STRING_ID Str
203 );
204
205 /**
206 Update block sid info.
207
208 @param PpRequest Input the Pp Request.
209
210 @retval EFI_SUCCESS Do the required action success.
211 @retval Others Other error occur.
212
213 **/
214 EFI_STATUS
215 HiiSetBlockSidAction (
216 UINT32 PpRequest
217 );
218
219 /**
220 Reverts the Opal disk to factory default.
221
222 @param PsidStringId The string id for the PSID info.
223
224 @retval EFI_SUCCESS Do the required action success.
225
226 **/
227 EFI_STATUS
228 HiiPsidRevert(
229 EFI_STRING_ID PsidStringId
230 );
231
232 /**
233 Get disk name string id.
234
235 @param DiskIndex The input disk index info.
236
237 @retval The disk name string id.
238
239 **/
240 EFI_STRING_ID
241 GetDiskNameStringId(
242 UINT8 DiskIndex
243 );
244
245 /**
246 Update the device info.
247
248 @param OpalDisk The Opal device.
249
250 @retval EFI_SUCESS Initialize the device success.
251 @retval EFI_DEVICE_ERROR Get info from device failed.
252 @retval EFI_INVALID_PARAMETER Not get Msid info before get ownership info.
253
254 **/
255 EFI_STATUS
256 OpalDiskUpdateStatus (
257 OPAL_DISK *OpalDisk
258 );
259
260 /**
261 Get the driver image handle.
262
263 @retval the driver image handle.
264
265 **/
266 EFI_HANDLE
267 HiiGetDriverImageHandleCB(
268 VOID
269 );
270
271 /**
272 Install the HII form and string packages.
273
274 @retval EFI_SUCCESS Install all the resources success.
275 @retval EFI_OUT_OF_RESOURCES Out of resource error.
276 **/
277 EFI_STATUS
278 OpalHiiAddPackages(
279 VOID
280 );
281
282 /**
283 Returns the opaque pointer to a physical disk context.
284
285 @param DiskIndex Input the disk index.
286
287 @retval The device pointer.
288
289 **/
290 OPAL_DISK*
291 HiiGetOpalDiskCB(
292 UINT8 DiskIndex
293 );
294
295 /**
296 Returns the disk name.
297
298 @param DiskIndex Input the disk index.
299
300 @retval Returns the disk name.
301
302 **/
303 CHAR8*
304 HiiDiskGetNameCB(
305 UINT8 DiskIndex
306 );
307
308 /**
309 Set a string Value in a form.
310
311 @param DestStringId The stringid which need to update.
312 @param SrcAsciiStr The string nned to update.
313
314 @retval EFI_SUCCESS Do the required action success.
315 @retval Others Other error occur.
316
317 **/
318 EFI_STATUS
319 HiiSetFormString(
320 EFI_STRING_ID DestStringId,
321 CHAR8 *SrcAsciiStr
322 );
323
324 /**
325 Install the HII related resources.
326
327 @retval EFI_SUCCESS Install all the resources success.
328 @retval other Error occur when install the resources.
329 **/
330 EFI_STATUS
331 HiiInstall(
332 VOID
333 );
334
335 /**
336 Uninstall the HII capability.
337
338 @retval EFI_SUCCESS Uninstall all the resources success.
339 @retval others Other errors occur when unistall the hii resource.
340 **/
341 EFI_STATUS
342 HiiUninstall(
343 VOID
344 );
345
346 /**
347 Initialize the Opal disk base on the hardware info get from device.
348
349 @param Dev The Opal device.
350
351 @retval EFI_SUCESS Initialize the device success.
352 @retval EFI_DEVICE_ERROR Get info from device failed.
353
354 **/
355 EFI_STATUS
356 OpalDiskInitialize (
357 IN OPAL_DRIVER_DEVICE *Dev
358 );
359
360 #endif // _HII_H_