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