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