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