TianoCore EDK2 master
Loading...
Searching...
No Matches
OpalHii.c
Go to the documentation of this file.
1
9#include "OpalHii.h"
10//
11// Character definitions
12//
13#define UPPER_LOWER_CASE_OFFSET 0x20
14
15//
16// This is the generated IFR binary Data for each formset defined in VFR.
17// This Data array is ready to be used as input of HiiAddPackages() to
18// create a packagelist (which contains Form packages, String packages, etc).
19//
20extern UINT8 OpalPasswordFormBin[];
21
22//
23// This is the generated String package Data for all .UNI files.
24// This Data array is ready to be used as input of HiiAddPackages() to
25// create a packagelist (which contains Form packages, String packages, etc).
26//
27extern UINT8 OpalPasswordDxeStrings[];
28
29CHAR16 OpalPasswordStorageName[] = L"OpalHiiConfig";
30
31EFI_HII_CONFIG_ACCESS_PROTOCOL gHiiConfigAccessProtocol;
32
33//
34// Handle to the list of HII packages (forms and strings) for this driver
35//
36EFI_HII_HANDLE gHiiPackageListHandle = NULL;
37
38//
39// Package List GUID containing all form and string packages
40//
41const EFI_GUID gHiiPackageListGuid = PACKAGE_LIST_GUID;
42const EFI_GUID gHiiSetupVariableGuid = SETUP_VARIABLE_GUID;
43const EFI_GUID gOpalSetupFormSetGuid = SETUP_FORMSET_GUID;
44
45//
46// Structure that contains state of the HII
47// This structure is updated by Hii.cpp and its contents
48// is rendered in the HII.
49//
50OPAL_HII_CONFIGURATION gHiiConfiguration;
51
52//
53// The device path containing the VENDOR_DEVICE_PATH and EFI_DEVICE_PATH_PROTOCOL
54//
55HII_VENDOR_DEVICE_PATH gHiiVendorDevicePath = {
56 {
57 {
60 {
61 (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
62 (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
63 }
64 },
65 OPAL_PASSWORD_CONFIG_GUID
66 },
67 {
68 END_DEVICE_PATH_TYPE,
69 END_ENTIRE_DEVICE_PATH_SUBTYPE,
70 {
71 (UINT8)(END_DEVICE_PATH_LENGTH),
72 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
73 }
74 }
75};
76
84VOID
86 IN OPAL_DISK *OpalDisk,
87 OUT OPAL_REQUEST *OpalRequest
88 )
89{
90 EFI_STATUS Status;
91 OPAL_REQUEST_VARIABLE *TempVariable;
92 OPAL_REQUEST_VARIABLE *Variable;
93 UINTN VariableSize;
94 EFI_DEVICE_PATH_PROTOCOL *DevicePathInVariable;
95 UINTN DevicePathSizeInVariable;
96 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
97 UINTN DevicePathSize;
98
99 DEBUG ((DEBUG_INFO, "%a() - enter\n", __func__));
100
101 Variable = NULL;
102 VariableSize = 0;
103
104 Status = GetVariable2 (
105 OPAL_REQUEST_VARIABLE_NAME,
106 &gHiiSetupVariableGuid,
107 (VOID **)&Variable,
108 &VariableSize
109 );
110 if (EFI_ERROR (Status) || (Variable == NULL)) {
111 return;
112 }
113
114 TempVariable = Variable;
115 while ((VariableSize > sizeof (OPAL_REQUEST_VARIABLE)) &&
116 (VariableSize >= TempVariable->Length) &&
117 (TempVariable->Length > sizeof (OPAL_REQUEST_VARIABLE)))
118 {
119 DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)TempVariable + sizeof (OPAL_REQUEST_VARIABLE));
120 DevicePathSizeInVariable = GetDevicePathSize (DevicePathInVariable);
121 DevicePath = OpalDisk->OpalDevicePath;
122 DevicePathSize = GetDevicePathSize (DevicePath);
123 if ((DevicePathSize == DevicePathSizeInVariable) &&
124 (CompareMem (DevicePath, DevicePathInVariable, DevicePathSize) == 0))
125 {
126 //
127 // Found the node for the OPAL device.
128 // Get the OPAL request.
129 //
130 CopyMem (OpalRequest, &TempVariable->OpalRequest, sizeof (OPAL_REQUEST));
131 DEBUG ((
132 DEBUG_INFO,
133 "OpalRequest got: 0x%x\n",
134 *OpalRequest
135 ));
136 break;
137 }
138
139 VariableSize -= TempVariable->Length;
140 TempVariable = (OPAL_REQUEST_VARIABLE *)((UINTN)TempVariable + TempVariable->Length);
141 }
142
143 FreePool (Variable);
144
145 DEBUG ((DEBUG_INFO, "%a() - exit\n", __func__));
146}
147
155VOID
157 IN OPAL_DISK *OpalDisk,
158 IN OPAL_REQUEST OpalRequest
159 )
160{
161 EFI_STATUS Status;
162 OPAL_REQUEST_VARIABLE *TempVariable;
163 UINTN TempVariableSize;
164 OPAL_REQUEST_VARIABLE *Variable;
165 UINTN VariableSize;
166 OPAL_REQUEST_VARIABLE *NewVariable;
167 UINTN NewVariableSize;
168 EFI_DEVICE_PATH_PROTOCOL *DevicePathInVariable;
169 UINTN DevicePathSizeInVariable;
170 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
171 UINTN DevicePathSize;
172
173 DEBUG ((DEBUG_INFO, "%a() - enter\n", __func__));
174
175 DEBUG ((
176 DEBUG_INFO,
177 "OpalRequest to save: 0x%x\n",
178 OpalRequest
179 ));
180
181 Variable = NULL;
182 VariableSize = 0;
183 NewVariable = NULL;
184 NewVariableSize = 0;
185
186 Status = GetVariable2 (
187 OPAL_REQUEST_VARIABLE_NAME,
188 &gHiiSetupVariableGuid,
189 (VOID **)&Variable,
190 &VariableSize
191 );
192 if (!EFI_ERROR (Status) && (Variable != NULL)) {
193 TempVariable = Variable;
194 TempVariableSize = VariableSize;
195 while ((TempVariableSize > sizeof (OPAL_REQUEST_VARIABLE)) &&
196 (TempVariableSize >= TempVariable->Length) &&
197 (TempVariable->Length > sizeof (OPAL_REQUEST_VARIABLE)))
198 {
199 DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)TempVariable + sizeof (OPAL_REQUEST_VARIABLE));
200 DevicePathSizeInVariable = GetDevicePathSize (DevicePathInVariable);
201 DevicePath = OpalDisk->OpalDevicePath;
202 DevicePathSize = GetDevicePathSize (DevicePath);
203 if ((DevicePathSize == DevicePathSizeInVariable) &&
204 (CompareMem (DevicePath, DevicePathInVariable, DevicePathSize) == 0))
205 {
206 //
207 // Found the node for the OPAL device.
208 // Update the OPAL request.
209 //
210 CopyMem (&TempVariable->OpalRequest, &OpalRequest, sizeof (OPAL_REQUEST));
211 NewVariable = Variable;
212 NewVariableSize = VariableSize;
213 break;
214 }
215
216 TempVariableSize -= TempVariable->Length;
217 TempVariable = (OPAL_REQUEST_VARIABLE *)((UINTN)TempVariable + TempVariable->Length);
218 }
219
220 if (NewVariable == NULL) {
221 //
222 // The node for the OPAL device is not found.
223 // Create node for the OPAL device.
224 //
225 DevicePath = OpalDisk->OpalDevicePath;
226 DevicePathSize = GetDevicePathSize (DevicePath);
227 NewVariableSize = VariableSize + sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize;
228 NewVariable = AllocatePool (NewVariableSize);
229 ASSERT (NewVariable != NULL);
230 CopyMem (NewVariable, Variable, VariableSize);
231 TempVariable = (OPAL_REQUEST_VARIABLE *)((UINTN)NewVariable + VariableSize);
232 TempVariable->Length = (UINT32)(sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize);
233 CopyMem (&TempVariable->OpalRequest, &OpalRequest, sizeof (OPAL_REQUEST));
234 DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)TempVariable + sizeof (OPAL_REQUEST_VARIABLE));
235 CopyMem (DevicePathInVariable, DevicePath, DevicePathSize);
236 }
237 } else {
238 DevicePath = OpalDisk->OpalDevicePath;
239 DevicePathSize = GetDevicePathSize (DevicePath);
240 NewVariableSize = sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize;
241 NewVariable = AllocatePool (NewVariableSize);
242 ASSERT (NewVariable != NULL);
243 NewVariable->Length = (UINT32)(sizeof (OPAL_REQUEST_VARIABLE) + DevicePathSize);
244 CopyMem (&NewVariable->OpalRequest, &OpalRequest, sizeof (OPAL_REQUEST));
245 DevicePathInVariable = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)NewVariable + sizeof (OPAL_REQUEST_VARIABLE));
246 CopyMem (DevicePathInVariable, DevicePath, DevicePathSize);
247 }
248
249 Status = gRT->SetVariable (
250 OPAL_REQUEST_VARIABLE_NAME,
251 (EFI_GUID *)&gHiiSetupVariableGuid,
252 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
253 NewVariableSize,
254 NewVariable
255 );
256 if (EFI_ERROR (Status)) {
257 DEBUG ((DEBUG_INFO, "OpalRequest variable set failed (%r)\n", Status));
258 }
259
260 if (NewVariable != Variable) {
261 FreePool (NewVariable);
262 }
263
264 if (Variable != NULL) {
265 FreePool (Variable);
266 }
267
268 DEBUG ((DEBUG_INFO, "%a() - exit\n", __func__));
269}
270
275VOID
277 VOID
278 )
279{
280 UINT32 PpStorageFlag;
281 EFI_STRING NewString;
282
283 gHiiConfiguration.NumDisks = GetDeviceCount ();
284
285 //
286 // Update the BlockSID status string.
287 //
289
290 if ((PpStorageFlag & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) != 0) {
291 NewString = HiiGetString (gHiiPackageListHandle, STRING_TOKEN (STR_ENABLED), NULL);
292 if (NewString == NULL) {
293 DEBUG ((DEBUG_INFO, "HiiSetCurrentConfiguration: HiiGetString( ) failed\n"));
294 return;
295 }
296 } else {
297 NewString = HiiGetString (gHiiPackageListHandle, STRING_TOKEN (STR_DISABLED), NULL);
298 if (NewString == NULL) {
299 DEBUG ((DEBUG_INFO, "HiiSetCurrentConfiguration: HiiGetString( ) failed\n"));
300 return;
301 }
302 }
303
304 HiiSetString (gHiiPackageListHandle, STRING_TOKEN (STR_BLOCKSID_STATUS1), NewString, NULL);
306
307 if ((PpStorageFlag & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID) != 0) {
308 NewString = HiiGetString (gHiiPackageListHandle, STRING_TOKEN (STR_DISK_INFO_ENABLE_BLOCKSID_TRUE), NULL);
309 if (NewString == NULL) {
310 DEBUG ((DEBUG_INFO, "HiiSetCurrentConfiguration: HiiGetString( ) failed\n"));
311 return;
312 }
313 } else {
314 NewString = HiiGetString (gHiiPackageListHandle, STRING_TOKEN (STR_DISK_INFO_ENABLE_BLOCKSID_FALSE), NULL);
315 if (NewString == NULL) {
316 DEBUG ((DEBUG_INFO, "HiiSetCurrentConfiguration: HiiGetString( ) failed\n"));
317 return;
318 }
319 }
320
321 HiiSetString (gHiiPackageListHandle, STRING_TOKEN (STR_BLOCKSID_STATUS2), NewString, NULL);
323
324 if ((PpStorageFlag & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID) != 0) {
325 NewString = HiiGetString (gHiiPackageListHandle, STRING_TOKEN (STR_DISK_INFO_DISABLE_BLOCKSID_TRUE), NULL);
326 if (NewString == NULL) {
327 DEBUG ((DEBUG_INFO, "HiiSetCurrentConfiguration: HiiGetString( ) failed\n"));
328 return;
329 }
330 } else {
331 NewString = HiiGetString (gHiiPackageListHandle, STRING_TOKEN (STR_DISK_INFO_DISABLE_BLOCKSID_FALSE), NULL);
332 if (NewString == NULL) {
333 DEBUG ((DEBUG_INFO, "HiiSetCurrentConfiguration: HiiGetString( ) failed\n"));
334 return;
335 }
336 }
337
338 HiiSetString (gHiiPackageListHandle, STRING_TOKEN (STR_BLOCKSID_STATUS3), NewString, NULL);
340}
341
350 VOID
351 )
352{
353 EFI_STATUS Status;
354 EFI_HANDLE DriverHandle;
355
356 //
357 // Clear the global configuration.
358 //
359 ZeroMem (&gHiiConfiguration, sizeof (gHiiConfiguration));
360
361 //
362 // Obtain the driver handle that the BIOS assigned us
363 //
364 DriverHandle = HiiGetDriverImageHandleCB ();
365
366 //
367 // Populate the config access protocol with the three functions we are publishing
368 //
369 gHiiConfigAccessProtocol.ExtractConfig = ExtractConfig;
370 gHiiConfigAccessProtocol.RouteConfig = RouteConfig;
371 gHiiConfigAccessProtocol.Callback = DriverCallback;
372
373 //
374 // Associate the required protocols with our driver handle
375 //
376 Status = gBS->InstallMultipleProtocolInterfaces (
377 &DriverHandle,
378 &gEfiHiiConfigAccessProtocolGuid,
379 &gHiiConfigAccessProtocol, // HII callback
380 &gEfiDevicePathProtocolGuid,
381 &gHiiVendorDevicePath, // required for HII callback allow all disks to be shown in same hii
382 NULL
383 );
384
385 if (EFI_ERROR (Status)) {
386 return Status;
387 }
388
389 return OpalHiiAddPackages ();
390}
391
400 VOID
401 )
402{
403 EFI_HANDLE DriverHandle;
404
405 DriverHandle = HiiGetDriverImageHandleCB ();
406
407 //
408 // Publish the HII form and HII string packages
409 //
410 gHiiPackageListHandle = HiiAddPackages (
411 &gHiiPackageListGuid,
412 DriverHandle,
413 OpalPasswordDxeStrings,
414 OpalPasswordFormBin,
415 (VOID *)NULL
416 );
417
418 //
419 // Make sure the packages installed successfully
420 //
421 if (gHiiPackageListHandle == NULL) {
422 DEBUG ((DEBUG_INFO, "OpalHiiAddPackages failed\n"));
423 return EFI_OUT_OF_RESOURCES;
424 }
425
426 return EFI_SUCCESS;
427}
428
437 VOID
438 )
439{
440 EFI_STATUS Status;
441
442 //
443 // Remove the packages we've provided to the BIOS
444 //
445 HiiRemovePackages (gHiiPackageListHandle);
446
447 //
448 // Remove the protocols from our driver handle
449 //
450 Status = gBS->UninstallMultipleProtocolInterfaces (
452 &gEfiHiiConfigAccessProtocolGuid,
453 &gHiiConfigAccessProtocol, // HII callback
454 &gEfiDevicePathProtocolGuid,
455 &gHiiVendorDevicePath, // required for HII callback
456 NULL
457 );
458 if (EFI_ERROR (Status)) {
459 DEBUG ((DEBUG_INFO, "Cannot uninstall Hii Protocols: %r\n", Status));
460 }
461
462 return Status;
463}
464
472 VOID
473 )
474{
475 UINT8 Index;
476 CHAR8 *DiskName;
477 EFI_STRING_ID DiskNameId;
478 OPAL_DISK *OpalDisk;
479
481
482 gHiiConfiguration.SupportedDisks = 0;
483
484 for (Index = 0; Index < gHiiConfiguration.NumDisks; Index++) {
485 OpalDisk = HiiGetOpalDiskCB (Index);
486 if ((OpalDisk != NULL) && OpalFeatureSupported (&OpalDisk->SupportedAttributes)) {
487 gHiiConfiguration.SupportedDisks |= (1 << Index);
488 DiskNameId = GetDiskNameStringId (Index);
489 DiskName = HiiDiskGetNameCB (Index);
490 if ((DiskName == NULL) || (DiskNameId == 0)) {
491 return EFI_UNSUPPORTED;
492 }
493
494 HiiSetFormString (DiskNameId, DiskName);
495 }
496 }
497
499 return EFI_SUCCESS;
500}
501
510EFI_STRING_ID
512 UINT8 DiskIndex
513 )
514{
515 switch (DiskIndex) {
516 case 0: return STRING_TOKEN (STR_MAIN_GOTO_DISK_INFO_0);
517 case 1: return STRING_TOKEN (STR_MAIN_GOTO_DISK_INFO_1);
518 case 2: return STRING_TOKEN (STR_MAIN_GOTO_DISK_INFO_2);
519 case 3: return STRING_TOKEN (STR_MAIN_GOTO_DISK_INFO_3);
520 case 4: return STRING_TOKEN (STR_MAIN_GOTO_DISK_INFO_4);
521 case 5: return STRING_TOKEN (STR_MAIN_GOTO_DISK_INFO_5);
522 }
523
524 return 0;
525}
526
537 IN OPAL_DISK *OpalDisk,
538 IN CHAR16 *ActionString
539
540 )
541{
542 CHAR16 Unicode[512];
543 EFI_INPUT_KEY Key;
544 CHAR16 ApproveResponse;
545 CHAR16 RejectResponse;
546
547 //
548 // When the estimate cost time bigger than MAX_ACCEPTABLE_REVERTING_TIME, pop up dialog to let user confirm
549 // the revert action.
550 //
551 if (OpalDisk->EstimateTimeCost < MAX_ACCEPTABLE_REVERTING_TIME) {
552 return EFI_SUCCESS;
553 }
554
555 ApproveResponse = L'Y';
556 RejectResponse = L'N';
557
558 UnicodeSPrint (Unicode, StrSize (L"WARNING: ############# action needs about ####### seconds"), L"WARNING: %s action needs about %d seconds", ActionString, OpalDisk->EstimateTimeCost);
559
560 do {
562 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
563 &Key,
564 Unicode,
565 L" System should not be powered off until action completion ",
566 L" ",
567 L" Press 'Y/y' to continue, press 'N/n' to cancel ",
568 NULL
569 );
570 } while (
571 ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (ApproveResponse | UPPER_LOWER_CASE_OFFSET)) &&
572 ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (RejectResponse | UPPER_LOWER_CASE_OFFSET))
573 );
574
575 if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (RejectResponse | UPPER_LOWER_CASE_OFFSET)) {
576 return EFI_ABORTED;
577 }
578
579 return EFI_SUCCESS;
580}
581
605EFIAPI
608 EFI_BROWSER_ACTION Action,
609 EFI_QUESTION_ID QuestionId,
610 UINT8 Type,
611 EFI_IFR_TYPE_VALUE *Value,
612 EFI_BROWSER_ACTION_REQUEST *ActionRequest
613 )
614{
615 HII_KEY HiiKey;
616 UINT8 HiiKeyId;
617 UINT32 PpRequest;
618 OPAL_DISK *OpalDisk;
619 EFI_STATUS Status;
620 VOID *StartOpCodeHandle;
621 VOID *EndOpCodeHandle;
622 EFI_IFR_GUID_LABEL *StartLabel;
623 EFI_IFR_GUID_LABEL *EndLabel;
624
625 if (ActionRequest != NULL) {
626 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
627 } else {
628 return EFI_INVALID_PARAMETER;
629 }
630
631 //
632 // If QuestionId is an auto-generated key (label, empty line, etc.), ignore it.
633 //
634 if ((QuestionId & HII_KEY_FLAG) == 0) {
635 return EFI_SUCCESS;
636 }
637
638 HiiKey.Raw = QuestionId;
639 HiiKeyId = (UINT8)HiiKey.KeyBits.Id;
640
641 if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
642 if ((HiiKeyId == HII_KEY_ID_VAR_SUPPORTED_DISKS) || (HiiKeyId == HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS)) {
643 //
644 // Allocate space for creation of UpdateData Buffer
645 //
646 StartOpCodeHandle = HiiAllocateOpCodeHandle ();
647 if (StartOpCodeHandle == NULL) {
648 return EFI_OUT_OF_RESOURCES;
649 }
650
651 EndOpCodeHandle = HiiAllocateOpCodeHandle ();
652 if (EndOpCodeHandle == NULL) {
653 return EFI_OUT_OF_RESOURCES;
654 }
655
656 //
657 // Create Hii Extend Label OpCode as the start opcode
658 //
659 StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
661
662 //
663 // Create Hii Extend Label OpCode as the end opcode
664 //
665 EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
667
668 switch (HiiKeyId) {
669 case HII_KEY_ID_VAR_SUPPORTED_DISKS:
670 DEBUG ((DEBUG_INFO, "HII_KEY_ID_VAR_SUPPORTED_DISKS\n"));
671 Status = HiiPopulateMainMenuForm ();
672
673 StartLabel->Number = OPAL_MAIN_MENU_LABEL_START;
674 EndLabel->Number = OPAL_MAIN_MENU_LABEL_END;
676 gHiiPackageListHandle,
677 (EFI_GUID *)&gOpalSetupFormSetGuid,
678 FORMID_VALUE_MAIN_MENU,
679 StartOpCodeHandle,
680 EndOpCodeHandle
681 );
682 break;
683
684 case HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS:
685 DEBUG ((DEBUG_INFO, "HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS\n"));
686 Status = HiiPopulateDiskInfoForm ();
687
688 StartLabel->Number = OPAL_DISK_INFO_LABEL_START;
689 EndLabel->Number = OPAL_DISK_INFO_LABEL_END;
691 gHiiPackageListHandle,
692 (EFI_GUID *)&gOpalSetupFormSetGuid,
693 FORMID_VALUE_DISK_INFO_FORM_MAIN,
694 StartOpCodeHandle,
695 EndOpCodeHandle
696 );
697 break;
698 }
699
700 HiiFreeOpCodeHandle (StartOpCodeHandle);
701 HiiFreeOpCodeHandle (EndOpCodeHandle);
702
703 return Status;
704 }
705 } else if (Action == EFI_BROWSER_ACTION_CHANGING) {
706 switch (HiiKeyId) {
707 case HII_KEY_ID_GOTO_DISK_INFO:
708 return HiiSelectDisk ((UINT8)HiiKey.KeyBits.Index);
709
710 case HII_KEY_ID_REVERT:
711 case HII_KEY_ID_PSID_REVERT:
712 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
713 if (OpalDisk != NULL) {
714 return HiiConfirmDataRemovalAction (OpalDisk, L"Revert");
715 } else {
716 ASSERT (FALSE);
717 return EFI_SUCCESS;
718 }
719
720 case HII_KEY_ID_SECURE_ERASE:
721 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
722 if (OpalDisk != NULL) {
723 return HiiConfirmDataRemovalAction (OpalDisk, L"Secure erase");
724 } else {
725 ASSERT (FALSE);
726 return EFI_SUCCESS;
727 }
728 }
729 } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
730 switch (HiiKeyId) {
731 case HII_KEY_ID_BLOCKSID:
732 switch (Value->u8) {
733 case 0:
734 PpRequest = TCG2_PHYSICAL_PRESENCE_NO_ACTION;
735 break;
736
737 case 1:
738 PpRequest = TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID;
739 break;
740
741 case 2:
742 PpRequest = TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID;
743 break;
744
745 case 3:
746 PpRequest = TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_TRUE;
747 break;
748
749 case 4:
750 PpRequest = TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_FALSE;
751 break;
752
753 case 5:
754 PpRequest = TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_TRUE;
755 break;
756
757 case 6:
758 PpRequest = TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_FALSE;
759 break;
760
761 default:
762 PpRequest = TCG2_PHYSICAL_PRESENCE_NO_ACTION;
763 DEBUG ((DEBUG_ERROR, "Invalid value input!\n"));
764 break;
765 }
766
767 HiiSetBlockSidAction (PpRequest);
768
769 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
770 return EFI_SUCCESS;
771
772 case HII_KEY_ID_SET_ADMIN_PWD:
773 DEBUG ((DEBUG_INFO, "HII_KEY_ID_SET_ADMIN_PWD\n"));
774 gHiiConfiguration.OpalRequest.SetAdminPwd = Value->b;
775 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
776 if (OpalDisk != NULL) {
777 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
778 }
779
780 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
781 return EFI_SUCCESS;
782
783 case HII_KEY_ID_SET_USER_PWD:
784 DEBUG ((DEBUG_INFO, "HII_KEY_ID_SET_USER_PWD\n"));
785 gHiiConfiguration.OpalRequest.SetUserPwd = Value->b;
786 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
787 if (OpalDisk != NULL) {
788 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
789 }
790
791 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
792 return EFI_SUCCESS;
793
794 case HII_KEY_ID_SECURE_ERASE:
795 DEBUG ((DEBUG_INFO, "HII_KEY_ID_SECURE_ERASE\n"));
796 gHiiConfiguration.OpalRequest.SecureErase = Value->b;
797 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
798 if (OpalDisk != NULL) {
799 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
800 }
801
802 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
803 return EFI_SUCCESS;
804
805 case HII_KEY_ID_REVERT:
806 DEBUG ((DEBUG_INFO, "HII_KEY_ID_REVERT\n"));
807 gHiiConfiguration.OpalRequest.Revert = Value->b;
808 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
809 if (OpalDisk != NULL) {
810 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
811 }
812
813 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
814 return EFI_SUCCESS;
815 case HII_KEY_ID_KEEP_USER_DATA:
816 DEBUG ((DEBUG_INFO, "HII_KEY_ID_KEEP_USER_DATA\n"));
817 gHiiConfiguration.OpalRequest.KeepUserData = Value->b;
818 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
819 if (OpalDisk != NULL) {
820 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
821 }
822
823 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
824 return EFI_SUCCESS;
825
826 case HII_KEY_ID_PSID_REVERT:
827 DEBUG ((DEBUG_INFO, "HII_KEY_ID_PSID_REVERT\n"));
828 gHiiConfiguration.OpalRequest.PsidRevert = Value->b;
829 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
830 if (OpalDisk != NULL) {
831 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
832 }
833
834 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
835 return EFI_SUCCESS;
836
837 case HII_KEY_ID_DISABLE_USER:
838 DEBUG ((DEBUG_INFO, "HII_KEY_ID_DISABLE_USER\n"));
839 gHiiConfiguration.OpalRequest.DisableUser = Value->b;
840 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
841 if (OpalDisk != NULL) {
842 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
843 }
844
845 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
846 return EFI_SUCCESS;
847
848 case HII_KEY_ID_ENABLE_FEATURE:
849 DEBUG ((DEBUG_INFO, "HII_KEY_ID_ENABLE_FEATURE\n"));
850 gHiiConfiguration.OpalRequest.EnableFeature = Value->b;
851 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
852 if (OpalDisk != NULL) {
853 SaveOpalRequest (OpalDisk, gHiiConfiguration.OpalRequest);
854 }
855
856 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
857 return EFI_SUCCESS;
858
859 default:
860 break;
861 }
862 }
863
864 return EFI_UNSUPPORTED;
865}
866
877 UINT8 Index
878 )
879{
881 gHiiConfiguration.SelectedDiskIndex = Index;
883
884 return EFI_SUCCESS;
885}
886
895 VOID
896 )
897{
898 OPAL_DISK *OpalDisk;
899 OPAL_DISK_ACTIONS AvailActions;
900 TCG_RESULT Ret;
901 CHAR8 *DiskName;
902
904
905 DiskName = HiiDiskGetNameCB (gHiiConfiguration.SelectedDiskIndex);
906 if (DiskName == NULL) {
907 return EFI_UNSUPPORTED;
908 }
909
910 HiiSetFormString (STRING_TOKEN (STR_DISK_INFO_SELECTED_DISK_NAME), DiskName);
911
912 gHiiConfiguration.SelectedDiskAvailableActions = HII_ACTION_NONE;
913 ZeroMem (&gHiiConfiguration.OpalRequest, sizeof (OPAL_REQUEST));
914 gHiiConfiguration.KeepUserDataForced = FALSE;
915
916 OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
917
918 if (OpalDisk != NULL) {
919 OpalDiskUpdateStatus (OpalDisk);
920 Ret = OpalSupportGetAvailableActions (&OpalDisk->SupportedAttributes, &OpalDisk->LockingFeature, OpalDisk->Owner, &AvailActions);
921 if (Ret == TcgResultSuccess) {
922 //
923 // Update actions, always allow PSID Revert
924 //
925 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.PsidRevert == 1) ? HII_ACTION_PSID_REVERT : HII_ACTION_NONE;
926
927 //
928 // Always allow unlock to handle device migration
929 //
930 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.Unlock == 1) ? HII_ACTION_UNLOCK : HII_ACTION_NONE;
931
932 if (!OpalFeatureEnabled (&OpalDisk->SupportedAttributes, &OpalDisk->LockingFeature)) {
933 if (OpalDisk->Owner == OpalOwnershipNobody) {
934 gHiiConfiguration.SelectedDiskAvailableActions |= HII_ACTION_ENABLE_FEATURE;
935
936 //
937 // Update strings
938 //
939 HiiSetFormString (STRING_TOKEN (STR_DISK_INFO_PSID_REVERT), "PSID Revert to factory default");
940 } else {
941 DEBUG ((DEBUG_INFO, "Feature disabled but ownership != nobody\n"));
942 }
943 } else {
944 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.Revert == 1) ? HII_ACTION_REVERT : HII_ACTION_NONE;
945 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.AdminPass == 1) ? HII_ACTION_SET_ADMIN_PWD : HII_ACTION_NONE;
946 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.UserPass == 1) ? HII_ACTION_SET_USER_PWD : HII_ACTION_NONE;
947 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.SecureErase == 1) ? HII_ACTION_SECURE_ERASE : HII_ACTION_NONE;
948 gHiiConfiguration.SelectedDiskAvailableActions |= (AvailActions.DisableUser == 1) ? HII_ACTION_DISABLE_USER : HII_ACTION_NONE;
949
950 HiiSetFormString (STRING_TOKEN (STR_DISK_INFO_PSID_REVERT), "PSID Revert to factory default and Disable");
951
952 //
953 // Determine revert options for disk
954 // Default initialize keep user Data to be true
955 //
956 gHiiConfiguration.OpalRequest.KeepUserData = 1;
957 if (AvailActions.RevertKeepDataForced) {
958 gHiiConfiguration.KeepUserDataForced = TRUE;
959 }
960 }
961 }
962
963 GetSavedOpalRequest (OpalDisk, &gHiiConfiguration.OpalRequest);
964 }
965
966 //
967 // Pass the current configuration to the BIOS
968 //
970
971 return EFI_SUCCESS;
972}
973
985 IN UINT32 PpRequest
986 )
987{
988 UINT32 ReturnCode;
989 EFI_STATUS Status;
990
991 ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (PpRequest, 0);
992 if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {
993 Status = EFI_SUCCESS;
994 } else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE) {
995 Status = EFI_OUT_OF_RESOURCES;
996 } else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED) {
997 Status = EFI_UNSUPPORTED;
998 } else {
999 Status = EFI_DEVICE_ERROR;
1000 }
1001
1002 return Status;
1003}
1004
1024EFIAPI
1027 CONST EFI_STRING Configuration,
1028 EFI_STRING *Progress
1029 )
1030{
1031 if ((Configuration == NULL) || (Progress == NULL)) {
1032 return (EFI_INVALID_PARAMETER);
1033 }
1034
1035 *Progress = Configuration;
1036 if (!HiiIsConfigHdrMatch (Configuration, &gHiiSetupVariableGuid, OpalPasswordStorageName)) {
1037 return EFI_NOT_FOUND;
1038 }
1039
1040 *Progress = Configuration + StrLen (Configuration);
1041
1042 return EFI_SUCCESS;
1043}
1044
1072EFIAPI
1075 CONST EFI_STRING Request,
1076 EFI_STRING *Progress,
1077 EFI_STRING *Results
1078 )
1079{
1080 EFI_STATUS Status;
1081 EFI_STRING ConfigRequest;
1082 EFI_STRING ConfigRequestHdr;
1083 UINTN BufferSize;
1084 UINTN Size;
1085 BOOLEAN AllocatedRequest;
1086 EFI_HANDLE DriverHandle;
1087
1088 //
1089 // Check for valid parameters
1090 //
1091 if ((Progress == NULL) || (Results == NULL)) {
1092 return (EFI_INVALID_PARAMETER);
1093 }
1094
1095 *Progress = Request;
1096 if ((Request != NULL) &&
1097 !HiiIsConfigHdrMatch (Request, &gHiiSetupVariableGuid, OpalPasswordStorageName))
1098 {
1099 return EFI_NOT_FOUND;
1100 }
1101
1102 AllocatedRequest = FALSE;
1103 BufferSize = sizeof (OPAL_HII_CONFIGURATION);
1104 ConfigRequest = Request;
1105 if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
1106 //
1107 // Request has no request element, construct full request string.
1108 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
1109 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
1110 //
1111 DriverHandle = HiiGetDriverImageHandleCB ();
1112 ConfigRequestHdr = HiiConstructConfigHdr (&gHiiSetupVariableGuid, OpalPasswordStorageName, DriverHandle);
1113 Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
1114 ConfigRequest = AllocateZeroPool (Size);
1115 if (ConfigRequest == NULL) {
1116 return EFI_OUT_OF_RESOURCES;
1117 }
1118
1119 AllocatedRequest = TRUE;
1120 UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
1121 FreePool (ConfigRequestHdr);
1122 }
1123
1124 //
1125 // Convert Buffer Data to <ConfigResp> by helper function BlockToConfig( )
1126 //
1127 Status = gHiiConfigRouting->BlockToConfig (
1129 ConfigRequest,
1130 (UINT8 *)&gHiiConfiguration,
1131 sizeof (OPAL_HII_CONFIGURATION),
1132 Results,
1133 Progress
1134 );
1135
1136 //
1137 // Free the allocated config request string.
1138 //
1139 if (AllocatedRequest) {
1140 FreePool (ConfigRequest);
1141 ConfigRequest = NULL;
1142 }
1143
1144 //
1145 // Set Progress string to the original request string.
1146 //
1147 if (Request == NULL) {
1148 *Progress = NULL;
1149 } else if (StrStr (Request, L"OFFSET") == NULL) {
1150 *Progress = Request + StrLen (Request);
1151 }
1152
1153 return (Status);
1154}
1155
1161VOID
1163 VOID
1164 )
1165{
1167 &gHiiSetupVariableGuid,
1168 (CHAR16 *)L"OpalHiiConfig",
1169 sizeof (gHiiConfiguration),
1170 (UINT8 *)&gHiiConfiguration,
1171 NULL
1172 );
1173}
1174
1180VOID
1182 VOID
1183 )
1184{
1186 &gHiiSetupVariableGuid,
1187 (CHAR16 *)L"OpalHiiConfig",
1188 sizeof (gHiiConfiguration),
1189 (UINT8 *)&gHiiConfiguration
1190 );
1191}
1192
1205 EFI_STRING_ID DestStringId,
1206 CHAR8 *SrcAsciiStr
1207 )
1208{
1209 UINT32 Len;
1210 UINT32 UniSize;
1211 CHAR16 *UniStr;
1212
1213 //
1214 // Determine the Length of the sting
1215 //
1216 Len = (UINT32)AsciiStrLen (SrcAsciiStr);
1217
1218 //
1219 // Allocate space for the unicode string, including terminator
1220 //
1221 UniSize = (Len + 1) * sizeof (CHAR16);
1222 UniStr = (CHAR16 *)AllocateZeroPool (UniSize);
1223
1224 //
1225 // Copy into unicode string, then copy into string id
1226 //
1227 AsciiStrToUnicodeStrS (SrcAsciiStr, UniStr, Len + 1);
1228
1229 //
1230 // Update the string in the form
1231 //
1232 if (HiiSetString (gHiiPackageListHandle, DestStringId, UniStr, NULL) == 0) {
1233 DEBUG ((DEBUG_INFO, "HiiSetFormString( ) failed\n"));
1234 FreePool (UniStr);
1235 return (EFI_OUT_OF_RESOURCES);
1236 }
1237
1238 //
1239 // Free the memory
1240 //
1241 FreePool (UniStr);
1242
1243 return (EFI_SUCCESS);
1244}
1245
1258 )
1259{
1260 TCG_RESULT TcgResult;
1261 OPAL_SESSION Session;
1262 UINT8 ActiveDataRemovalMechanism;
1263 UINT32 RemovalMechanishLists[ResearvedMechanism];
1264
1265 ZeroMem (&Dev->OpalDisk, sizeof (OPAL_DISK));
1266 Dev->OpalDisk.Sscp = Dev->Sscp;
1267 Dev->OpalDisk.MediaId = Dev->MediaId;
1268 Dev->OpalDisk.OpalDevicePath = Dev->OpalDevicePath;
1269
1270 ZeroMem (&Session, sizeof (Session));
1271 Session.Sscp = Dev->Sscp;
1272 Session.MediaId = Dev->MediaId;
1273
1274 TcgResult = OpalGetSupportedAttributesInfo (&Session, &Dev->OpalDisk.SupportedAttributes, &Dev->OpalDisk.OpalBaseComId);
1275 if (TcgResult != TcgResultSuccess) {
1276 return EFI_DEVICE_ERROR;
1277 }
1278
1279 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1280
1281 TcgResult = OpalUtilGetMsid (&Session, Dev->OpalDisk.Msid, OPAL_MSID_LENGTH, &Dev->OpalDisk.MsidLength);
1282 if (TcgResult != TcgResultSuccess) {
1283 return EFI_DEVICE_ERROR;
1284 }
1285
1286 if (Dev->OpalDisk.SupportedAttributes.DataRemoval) {
1287 TcgResult = OpalUtilGetDataRemovalMechanismLists (&Session, RemovalMechanishLists);
1288 if (TcgResult != TcgResultSuccess) {
1289 return EFI_DEVICE_ERROR;
1290 }
1291
1292 TcgResult = OpalUtilGetActiveDataRemovalMechanism (&Session, Dev->OpalDisk.Msid, Dev->OpalDisk.MsidLength, &ActiveDataRemovalMechanism);
1293 if (TcgResult != TcgResultSuccess) {
1294 return EFI_DEVICE_ERROR;
1295 }
1296
1297 Dev->OpalDisk.EstimateTimeCost = RemovalMechanishLists[ActiveDataRemovalMechanism];
1298 }
1299
1300 return OpalDiskUpdateStatus (&Dev->OpalDisk);
1301}
1302
1315 OPAL_DISK *OpalDisk
1316 )
1317{
1318 OPAL_SESSION Session;
1319
1320 if (OpalDisk->MsidLength == 0) {
1321 return EFI_INVALID_PARAMETER;
1322 }
1323
1324 if (OpalDisk->SentBlockSID) {
1325 return EFI_ACCESS_DENIED;
1326 }
1327
1328 ZeroMem (&Session, sizeof (Session));
1329 Session.Sscp = OpalDisk->Sscp;
1330 Session.MediaId = OpalDisk->MediaId;
1331 Session.OpalBaseComId = OpalDisk->OpalBaseComId;
1332
1333 OpalDisk->Owner = OpalUtilDetermineOwnership (&Session, OpalDisk->Msid, OpalDisk->MsidLength);
1334 return EFI_SUCCESS;
1335}
1336
1350 OPAL_DISK *OpalDisk
1351 )
1352{
1353 TCG_RESULT TcgResult;
1354 OPAL_SESSION Session;
1355
1356 ZeroMem (&Session, sizeof (Session));
1357 Session.Sscp = OpalDisk->Sscp;
1358 Session.MediaId = OpalDisk->MediaId;
1359 Session.OpalBaseComId = OpalDisk->OpalBaseComId;
1360
1361 TcgResult = OpalGetLockingInfo (&Session, &OpalDisk->LockingFeature);
1362 if (TcgResult != TcgResultSuccess) {
1363 return EFI_DEVICE_ERROR;
1364 }
1365
1366 return OpalDiskUpdateOwnerShip (OpalDisk);
1367}
UINT64 UINTN
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
RETURN_STATUS EFIAPI AsciiStrToUnicodeStrS(IN CONST CHAR8 *Source, OUT CHAR16 *Destination, IN UINTN DestMax)
Definition: SafeString.c:2873
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
Definition: HiiLib.c:723
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
Definition: HiiLib.c:2872
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
Definition: HiiLib.c:3051
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
Definition: HiiLib.c:3085
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
Definition: HiiLib.c:3411
BOOLEAN EFIAPI HiiSetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, IN CONST UINT8 *Buffer, IN CONST CHAR16 *RequestElement OPTIONAL)
Definition: HiiLib.c:2954
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:211
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
Definition: HiiLib.c:4410
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
Definition: HiiLib.c:2813
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
Definition: HiiString.c:52
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
#define EFI_IFR_EXTEND_OP_LABEL
Definition: MdeModuleHii.h:33
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
UINT8 GetDeviceCount(VOID)
Definition: OpalDriver.c:2351
TCG_RESULT EFIAPI OpalSupportGetAvailableActions(IN OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, IN TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature, IN UINT16 OwnerShip, OUT OPAL_DISK_ACTIONS *AvalDiskActions)
Definition: OpalDriver.c:51
EFI_STATUS EFIAPI ExtractConfig(CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, CONST EFI_STRING Request, EFI_STRING *Progress, EFI_STRING *Results)
Definition: OpalHii.c:1073
VOID OpalHiiGetBrowserData(VOID)
Definition: OpalHii.c:1181
EFI_STATUS HiiPopulateMainMenuForm(VOID)
Definition: OpalHii.c:471
EFI_STATUS OpalDiskUpdateOwnerShip(OPAL_DISK *OpalDisk)
Definition: OpalHii.c:1314
EFI_STATUS HiiConfirmDataRemovalAction(IN OPAL_DISK *OpalDisk, IN CHAR16 *ActionString)
Definition: OpalHii.c:536
EFI_STATUS EFIAPI RouteConfig(CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, CONST EFI_STRING Configuration, EFI_STRING *Progress)
Definition: OpalHii.c:1025
EFI_STATUS HiiSelectDisk(UINT8 Index)
Definition: OpalHii.c:876
EFI_STATUS OpalDiskUpdateStatus(OPAL_DISK *OpalDisk)
Definition: OpalHii.c:1349
EFI_STATUS HiiUninstall(VOID)
Definition: OpalHii.c:436
EFI_STATUS HiiPopulateDiskInfoForm(VOID)
Definition: OpalHii.c:894
EFI_STATUS HiiInstall(VOID)
Definition: OpalHii.c:349
EFI_STRING_ID GetDiskNameStringId(UINT8 DiskIndex)
Definition: OpalHii.c:511
EFI_STATUS HiiSetFormString(EFI_STRING_ID DestStringId, CHAR8 *SrcAsciiStr)
Definition: OpalHii.c:1204
VOID HiiSetCurrentConfiguration(VOID)
Definition: OpalHii.c:276
VOID OpalHiiSetBrowserData(VOID)
Definition: OpalHii.c:1162
EFI_STATUS OpalDiskInitialize(IN OPAL_DRIVER_DEVICE *Dev)
Definition: OpalHii.c:1256
VOID SaveOpalRequest(IN OPAL_DISK *OpalDisk, IN OPAL_REQUEST OpalRequest)
Definition: OpalHii.c:156
EFI_STATUS HiiSetBlockSidAction(IN UINT32 PpRequest)
Definition: OpalHii.c:984
VOID GetSavedOpalRequest(IN OPAL_DISK *OpalDisk, OUT OPAL_REQUEST *OpalRequest)
Definition: OpalHii.c:85
EFI_STATUS EFIAPI DriverCallback(CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, EFI_BROWSER_ACTION Action, EFI_QUESTION_ID QuestionId, UINT8 Type, EFI_IFR_TYPE_VALUE *Value, EFI_BROWSER_ACTION_REQUEST *ActionRequest)
Definition: OpalHii.c:606
EFI_STATUS OpalHiiAddPackages(VOID)
Definition: OpalHii.c:399
EFI_HANDLE HiiGetDriverImageHandleCB(VOID)
OPAL_DISK * HiiGetOpalDiskCB(UINT8 DiskIndex)
CHAR8 * HiiDiskGetNameCB(UINT8 DiskIndex)
UINT32 EFIAPI Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction(IN UINT32 OperationRequest, IN UINT32 RequestParameter)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STRING_ID NewString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
Definition: Setup.c:981
UINT32 EFIAPI Tcg2PhysicalPresenceLibGetManagementFlags(VOID)
TCG_RESULT
TCG_RESULT EFIAPI OpalGetSupportedAttributesInfo(OPAL_SESSION *Session, OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, UINT16 *OpalBaseComId)
BOOLEAN EFIAPI OpalFeatureSupported(OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes)
TCG_RESULT EFIAPI OpalUtilGetActiveDataRemovalMechanism(OPAL_SESSION *Session, const VOID *GeneratedSid, UINT32 SidLength, UINT8 *ActiveDataRemovalMechanism)
TCG_RESULT EFIAPI OpalGetLockingInfo(OPAL_SESSION *Session, TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature)
OPAL_OWNER_SHIP EFIAPI OpalUtilDetermineOwnership(OPAL_SESSION *Session, UINT8 *Msid, UINT32 MsidLength)
TCG_RESULT EFIAPI OpalUtilGetDataRemovalMechanismLists(IN OPAL_SESSION *Session, OUT UINT32 *RemovalMechanismLists)
TCG_RESULT EFIAPI OpalUtilGetMsid(OPAL_SESSION *Session, UINT8 *Msid, UINT32 MsidBufferLength, UINT32 *MsidLength)
BOOLEAN EFIAPI OpalFeatureEnabled(OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
#define STRING_TOKEN(t)
VOID * EFI_HII_HANDLE
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
Definition: UefiLib.c:1317
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
Definition: Console.c:393
#define EFI_VARIABLE_NON_VOLATILE
Definition: Base.h:213