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