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