]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h
SecurityPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
[mirror_edk2.git] / SecurityPkg / Tcg / Opal / OpalPasswordDxe / OpalHiiPrivate.h
CommitLineData
a06875e1
ED
1/** @file\r
2 Private functions and sturctures used by the Opal UEFI Driver.\r
3\r
4Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _OPAL_HII_PRIVATE_H_\r
16#define _OPAL_HII_PRIVATE_H_\r
17\r
18\r
19\r
20#include <Library/OpalPasswordSupportLib.h>\r
21#include <Protocol/HiiConfigAccess.h>\r
22\r
23#include "OpalHii.h"\r
24#include "OpalHiiFormValues.h"\r
25\r
26\r
27#define OPAL_PASSWORD_CONFIG_GUID \\r
28 { \\r
29 0x0d510a4f, 0xa81b, 0x473f, { 0x87, 0x07, 0xb7, 0xfd, 0xfb, 0xc0, 0x45, 0xba } \\r
30 }\r
31\r
32#pragma pack(1)\r
33\r
34typedef struct {\r
35 UINT16 Id: HII_KEY_ID_BITS;\r
36 UINT16 Index: HII_KEY_INDEX_BITS;\r
37 UINT16 Flag: HII_KEY_FLAG_BITS;\r
38} KEY_BITS;\r
39\r
40typedef union {\r
41 UINT16 Raw;\r
42 KEY_BITS KeyBits;\r
43} HII_KEY;\r
44\r
45typedef struct {\r
46 VENDOR_DEVICE_PATH VendorDevicePath;\r
47 EFI_DEVICE_PATH_PROTOCOL End;\r
48} HII_VENDOR_DEVICE_PATH;\r
49\r
50/**\r
51* Opal PSID Authority utilized for PSID revert\r
52*\r
53* The type indicates the structure of the PSID authority\r
54*/\r
55typedef struct {\r
b7c71793 56 UINT8 Psid[PSID_CHARACTER_LENGTH];\r
a06875e1
ED
57} TCG_PSID;\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 Enable Enable/disable BlockSid.\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
221HiiSetBlockSid (\r
222 BOOLEAN Enable\r
223 );\r
224\r
225/**\r
226 Reverts the Opal disk to factory default.\r
227\r
228 @retval EFI_SUCCESS Do the required action success.\r
229\r
230**/\r
231EFI_STATUS\r
232HiiPsidRevert(\r
233 VOID\r
234 );\r
235\r
236/**\r
237 Get disk name string id.\r
238\r
239 @param DiskIndex The input disk index info.\r
240\r
241 @retval The disk name string id.\r
242\r
243**/\r
244EFI_STRING_ID\r
245GetDiskNameStringId(\r
246 UINT8 DiskIndex\r
247 );\r
248\r
249/**\r
250 Update the device info.\r
251\r
252 @param OpalDisk The Opal device.\r
253\r
254 @retval EFI_SUCESS Initialize the device success.\r
255 @retval EFI_DEVICE_ERROR Get info from device failed.\r
256 @retval EFI_INVALID_PARAMETER Not get Msid info before get ownership info.\r
257\r
258**/\r
259EFI_STATUS\r
260OpalDiskUpdateStatus (\r
261 OPAL_DISK *OpalDisk\r
262 );\r
263\r
264#pragma pack()\r
265\r
266#endif // _HII_P_H_\r