18EFI_GUID mOpalDeviceLockBoxGuid = OPAL_DEVICE_LOCKBOX_GUID;
20BOOLEAN mOpalEndOfDxe =
FALSE;
22UINTN mOpalRequestVariableSize = 0;
23CHAR16 mPopUpString[100];
58 BOOLEAN ExistingPassword;
60 NULL_CHECK (AvalDiskActions);
62 AvalDiskActions->AdminPass = 1;
63 AvalDiskActions->UserPass = 0;
64 AvalDiskActions->DisableUser = 0;
65 AvalDiskActions->Unlock = 0;
70 if (LockingFeature->LockingEnabled) {
71 AvalDiskActions->Revert = 1;
77 if (SupportedAttributes->PyriteSscV2 || SupportedAttributes->MediaEncryption) {
83 AvalDiskActions->PsidRevert = 1;
84 AvalDiskActions->RevertKeepDataForced = 0;
90 if (SupportedAttributes->MediaEncryption) {
91 AvalDiskActions->SecureErase = 1;
93 AvalDiskActions->SecureErase = 0;
96 AvalDiskActions->PsidRevert = 0;
97 AvalDiskActions->SecureErase = 0;
103 AvalDiskActions->RevertKeepDataForced = 1;
106 if (LockingFeature->Locked) {
107 AvalDiskActions->Unlock = 1;
109 AvalDiskActions->Unlock = 0;
116 AvalDiskActions->UserPass = ExistingPassword;
121 AvalDiskActions->DisableUser = ExistingPassword;
123 return TcgResultSuccess;
141 IN UINT32 MsidLength,
148 NULL_CHECK (Session);
150 NULL_CHECK (Password);
159 if (Ret == TcgResultSuccess) {
167 OPAL_LOCKING_SP_LOCKING_GLOBALRANGE,
192 IN UINT32 PasswordLength
195 CopyMem (OpalDisk->Password, Password, PasswordLength);
196 OpalDisk->PasswordLength = (UINT8)PasswordLength;
210 OUT UINT32 *DevInfoLength,
221 ASSERT (DevicePath !=
NULL);
222 ASSERT (DevInfoLength !=
NULL);
224 DeviceType = OPAL_DEVICE_TYPE_UNKNOWN;
227 TmpDevPath = DevicePath;
236 if (DevInfo !=
NULL) {
238 CopyMem (DevInfo->DevicePath, DevicePath, DevInfo->DevicePathLength);
241 DeviceType = (TmpDevPath->
SubType ==
MSG_SATA_DP) ? OPAL_DEVICE_TYPE_ATA : OPAL_DEVICE_TYPE_NVME;
253 TmpDevPath = DevicePath;
261 if (DevInfo !=
NULL) {
262 PciDevice = &DevInfo->Device;
263 PciDevice->Segment = 0;
264 PciDevice->Bus = BusNum;
265 PciDevice->Device = PciDevPath->
Device;
266 PciDevice->Function = PciDevPath->
Function;
279 ASSERT (DeviceType != OPAL_DEVICE_TYPE_UNKNOWN);
295 UINTN TotalDevInfoLength;
296 UINT32 DevInfoLength;
299 BOOLEAN S3InitDevicesExist;
300 UINTN S3InitDevicesLength;
307 TotalDevInfoLength = 0;
309 while (TmpDev !=
NULL) {
315 TotalDevInfoLength += DevInfoLength;
316 TmpDev = TmpDev->
Next;
319 if (TotalDevInfoLength == 0) {
323 S3InitDevicesLength =
sizeof (DummyData);
325 &gS3StorageDeviceInitListGuid,
329 ASSERT ((Status == EFI_NOT_FOUND) || (Status == EFI_BUFFER_TOO_SMALL));
330 if (Status == EFI_NOT_FOUND) {
331 S3InitDevices =
NULL;
332 S3InitDevicesExist =
FALSE;
333 }
else if (Status == EFI_BUFFER_TOO_SMALL) {
335 ASSERT (S3InitDevices !=
NULL);
336 if (S3InitDevices ==
NULL) {
341 &gS3StorageDeviceInitListGuid,
346 S3InitDevicesExist =
TRUE;
352 ASSERT (DevInfo !=
NULL);
353 if (DevInfo ==
NULL) {
357 TempDevInfo = DevInfo;
359 while (TmpDev !=
NULL) {
365 TempDevInfo->Length = DevInfoLength;
366 TempDevInfo->OpalBaseComId = TmpDev->
OpalDisk.OpalBaseComId;
368 TempDevInfo->Password,
372 TempDevInfo->PasswordLength = TmpDev->
OpalDisk.PasswordLength;
374 S3InitDevicesBak = S3InitDevices;
379 if (S3InitDevicesBak !=
NULL) {
383 ASSERT (S3InitDevices !=
NULL);
384 if (S3InitDevices ==
NULL) {
389 TmpDev = TmpDev->
Next;
393 &mOpalDeviceLockBoxGuid,
400 &mOpalDeviceLockBoxGuid,
401 LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY
406 if (S3InitDevicesExist) {
408 &gS3StorageDeviceInitListGuid,
416 &gS3StorageDeviceInitListGuid,
423 &gS3StorageDeviceInitListGuid,
424 LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY
429 ZeroMem (DevInfo, TotalDevInfoLength);
447 UINT32 PpStorageFlag;
450 if ((PpStorageFlag & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) != 0) {
455 while (Itr !=
NULL) {
456 if (Itr->
OpalDisk.SupportedAttributes.BlockSid) {
457 ZeroMem (&Session,
sizeof (Session));
459 Session.MediaId = Itr->
OpalDisk.MediaId;
460 Session.OpalBaseComId = Itr->
OpalDisk.OpalBaseComId;
462 DEBUG ((DEBUG_INFO,
"OpalPassword: EndOfDxe point, send BlockSid command to device!\n"));
464 if (Result != TcgResultSuccess) {
465 DEBUG ((DEBUG_ERROR,
"OpalBlockSid fail\n"));
498 DEBUG ((DEBUG_INFO,
"%a() - enter\n", __func__));
500 mOpalEndOfDxe =
TRUE;
502 if (mOpalRequestVariable !=
NULL) {
508 mOpalRequestVariable =
NULL;
509 mOpalRequestVariableSize = 0;
516 gBS->CloseEvent (Event);
526 while (TmpDev !=
NULL) {
528 TmpDev = TmpDev->
Next;
536 DEBUG ((DEBUG_INFO,
"%a() - exit\n", __func__));
538 gBS->CloseEvent (Event);
558 IN CHAR16 *PopUpString,
559 IN CHAR16 *PopUpString2,
560 IN CHAR16 *PopUpString3,
561 OUT BOOLEAN *PressEsc
566 CHAR16 Mask[PSID_CHARACTER_LENGTH + 1];
567 CHAR16 Unicode[PSID_CHARACTER_LENGTH + 1];
570 ZeroMem (Unicode,
sizeof (Unicode));
579 Mask[InputLength] = L
'_';
580 if (PopUpString2 ==
NULL) {
582 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
585 L
"---------------------",
590 if (PopUpString3 ==
NULL) {
592 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
596 L
"---------------------",
602 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
607 L
"---------------------",
617 if (InputKey.ScanCode == SCAN_NULL) {
621 if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN) {
625 Unicode[InputLength] = 0;
626 Mask[InputLength] = 0;
628 }
else if ((InputKey.UnicodeChar == CHAR_NULL) ||
629 (InputKey.UnicodeChar == CHAR_TAB) ||
630 (InputKey.UnicodeChar == CHAR_LINEFEED)
638 if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
639 if (InputLength > 0) {
640 Unicode[InputLength] = 0;
641 Mask[InputLength] = 0;
648 Unicode[InputLength] = InputKey.UnicodeChar;
649 Mask[InputLength] = InputKey.UnicodeChar;
651 if (InputLength == PSID_CHARACTER_LENGTH) {
655 Unicode[InputLength] = 0;
656 Mask[InputLength] = 0;
666 if (InputKey.ScanCode == SCAN_ESC) {
674 if ((InputLength == 0) || (InputKey.ScanCode == SCAN_ESC)) {
675 ZeroMem (Unicode,
sizeof (Unicode));
682 ZeroMem (Unicode,
sizeof (Unicode));
688 ZeroMem (Unicode,
sizeof (Unicode));
710 IN CHAR16 *PopUpString1,
711 IN CHAR16 *PopUpString2,
712 IN CHAR16 *PopUpString3,
713 OUT BOOLEAN *PressEsc
718 CHAR16 Mask[OPAL_MAX_PASSWORD_SIZE + 1];
719 CHAR16 Unicode[OPAL_MAX_PASSWORD_SIZE + 1];
722 ZeroMem (Unicode,
sizeof (Unicode));
731 Mask[InputLength] = L
'_';
732 if (PopUpString2 ==
NULL) {
734 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
737 L
"---------------------",
742 if (PopUpString3 ==
NULL) {
744 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
748 L
"---------------------",
754 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
759 L
"---------------------",
769 if (InputKey.ScanCode == SCAN_NULL) {
773 if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN) {
777 Unicode[InputLength] = 0;
778 Mask[InputLength] = 0;
780 }
else if ((InputKey.UnicodeChar == CHAR_NULL) ||
781 (InputKey.UnicodeChar == CHAR_TAB) ||
782 (InputKey.UnicodeChar == CHAR_LINEFEED)
790 if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
791 if (InputLength > 0) {
792 Unicode[InputLength] = 0;
793 Mask[InputLength] = 0;
800 Unicode[InputLength] = InputKey.UnicodeChar;
801 Mask[InputLength] = L
'*';
803 if (InputLength == OPAL_MAX_PASSWORD_SIZE) {
807 Unicode[InputLength] = 0;
808 Mask[InputLength] = 0;
818 if (InputKey.ScanCode == SCAN_ESC) {
826 if ((InputLength == 0) || (InputKey.ScanCode == SCAN_ESC)) {
827 ZeroMem (Unicode,
sizeof (Unicode));
833 ZeroMem (Unicode,
sizeof (Unicode));
838 ZeroMem (Unicode,
sizeof (Unicode));
855 IN CHAR16 *RequestString
858 if (Dev->Name16 ==
NULL) {
859 UnicodeSPrint (mPopUpString,
sizeof (mPopUpString), L
"%s Disk", RequestString);
861 UnicodeSPrint (mPopUpString,
sizeof (mPopUpString), L
"%s %s", RequestString, Dev->Name16);
877 IN CHAR16 *RequestString
895 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
901 IsEnabled =
OpalFeatureEnabled (&Dev->OpalDisk.SupportedAttributes, &Dev->OpalDisk.LockingFeature);
903 ZeroMem (&Session,
sizeof (Session));
904 Session.Sscp = Dev->OpalDisk.Sscp;
905 Session.MediaId = Dev->OpalDisk.MediaId;
906 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
908 IsLocked =
OpalDeviceLocked (&Dev->OpalDisk.SupportedAttributes, &Dev->OpalDisk.LockingFeature);
926 while (Count < MAX_PASSWORD_TRY_COUNT) {
937 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
939 L
"Press ENTER to skip the request and continue boot,",
940 L
"Press ESC to input password again",
943 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
945 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
965 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
967 L
"Press ENTER to shutdown, Press ESC to input password again",
970 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
972 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
983 if (Password ==
NULL) {
994 if (Ret == TcgResultSuccess) {
999 if (Ret == TcgResultSuccess) {
1001 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1003 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1006 if (Password !=
NULL) {
1007 ZeroMem (Password, PasswordLen);
1011 if (Ret == TcgResultSuccess) {
1019 if (Ret == TcgResultFailureInvalidType) {
1020 Count = MAX_PASSWORD_TRY_COUNT;
1028 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1030 L
"Invalid password.",
1031 L
"Press ENTER to retry",
1034 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1037 if (Count >= MAX_PASSWORD_TRY_COUNT) {
1040 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1042 L
"Opal password retry count exceeds the limit. Must shutdown!",
1043 L
"Press ENTER to shutdown",
1046 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1063 IN CHAR16 *RequestString
1069 CHAR8 *PasswordConfirm;
1070 UINT32 PasswordLenConfirm;
1075 CHAR16 *PopUpString;
1081 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
1087 ZeroMem (&Session,
sizeof (Session));
1088 Session.Sscp = Dev->OpalDisk.Sscp;
1089 Session.MediaId = Dev->OpalDisk.MediaId;
1090 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1092 while (Count < MAX_PASSWORD_TRY_COUNT) {
1097 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1099 L
"Press ENTER to skip the request and continue boot,",
1100 L
"Press ESC to input password again",
1103 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1105 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
1116 if (Password ==
NULL) {
1124 if (PasswordConfirm ==
NULL) {
1125 ZeroMem (Password, PasswordLen);
1131 PasswordLenConfirm = (UINT32)
AsciiStrLen (PasswordConfirm);
1132 if ((PasswordLen != PasswordLenConfirm) ||
1133 (
CompareMem (Password, PasswordConfirm, PasswordLen) != 0))
1135 ZeroMem (Password, PasswordLen);
1137 ZeroMem (PasswordConfirm, PasswordLenConfirm);
1141 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1143 L
"Passwords are not the same.",
1144 L
"Press ENTER to retry",
1147 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1153 if (PasswordConfirm !=
NULL) {
1154 ZeroMem (PasswordConfirm, PasswordLenConfirm);
1159 if (Ret == TcgResultSuccess) {
1161 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1163 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1166 if (Password !=
NULL) {
1167 ZeroMem (Password, PasswordLen);
1171 if (Ret == TcgResultSuccess) {
1179 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1182 L
"Press ENTER to retry",
1185 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1188 if (Count >= MAX_PASSWORD_TRY_COUNT) {
1191 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1193 L
"Opal password retry count exceeds the limit.",
1194 L
"Press ENTER to skip the request and continue boot",
1197 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1213 IN CHAR16 *RequestString
1223 BOOLEAN PasswordFailed;
1224 CHAR16 *PopUpString;
1230 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
1236 ZeroMem (&Session,
sizeof (Session));
1237 Session.Sscp = Dev->OpalDisk.Sscp;
1238 Session.MediaId = Dev->OpalDisk.MediaId;
1239 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1241 while (Count < MAX_PASSWORD_TRY_COUNT) {
1246 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1248 L
"Press ENTER to skip the request and continue boot,",
1249 L
"Press ESC to input password again",
1252 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1254 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
1265 if (Password ==
NULL) {
1273 if (Ret == TcgResultSuccess) {
1275 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1277 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1280 if (Password !=
NULL) {
1281 ZeroMem (Password, PasswordLen);
1285 if (Ret == TcgResultSuccess) {
1293 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1295 L
"Invalid password, request failed.",
1296 L
"Press ENTER to retry",
1299 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1302 if (Count >= MAX_PASSWORD_TRY_COUNT) {
1305 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1307 L
"Opal password retry count exceeds the limit.",
1308 L
"Press ENTER to skip the request and continue boot",
1311 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1327 IN CHAR16 *RequestString
1337 CHAR16 *PopUpString;
1338 CHAR16 *PopUpString2;
1339 CHAR16 *PopUpString3;
1346 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
1350 if (Dev->OpalDisk.EstimateTimeCost > MAX_ACCEPTABLE_REVERTING_TIME) {
1351 BufferSize =
StrSize (L
"Warning: Revert action will take about ####### seconds");
1353 ASSERT (PopUpString2 !=
NULL);
1357 L
"WARNING: Revert action will take about %d seconds",
1358 Dev->OpalDisk.EstimateTimeCost
1360 PopUpString3 = L
"DO NOT power off system during the revert action!";
1362 PopUpString2 =
NULL;
1363 PopUpString3 =
NULL;
1368 ZeroMem (&Session,
sizeof (Session));
1369 Session.Sscp = Dev->OpalDisk.Sscp;
1370 Session.MediaId = Dev->OpalDisk.MediaId;
1371 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1373 while (Count < MAX_PSID_TRY_COUNT) {
1378 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1380 L
"Press ENTER to skip the request and continue boot,",
1381 L
"Press ESC to input Psid again",
1384 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1386 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
1405 if (Ret == TcgResultSuccess) {
1406 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1408 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1416 if (Ret == TcgResultSuccess) {
1424 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1426 L
"Invalid Psid, request failed.",
1427 L
"Press ENTER to retry",
1430 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1433 if (Count >= MAX_PSID_TRY_COUNT) {
1436 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1438 L
"Opal Psid retry count exceeds the limit.",
1439 L
"Press ENTER to skip the request and continue boot",
1442 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1448 if (PopUpString2 !=
NULL) {
1464 IN BOOLEAN KeepUserData,
1465 IN CHAR16 *RequestString
1475 BOOLEAN PasswordFailed;
1476 CHAR16 *PopUpString;
1477 CHAR16 *PopUpString2;
1478 CHAR16 *PopUpString3;
1485 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
1489 if ((!KeepUserData) &&
1490 (Dev->OpalDisk.EstimateTimeCost > MAX_ACCEPTABLE_REVERTING_TIME))
1492 BufferSize =
StrSize (L
"Warning: Revert action will take about ####### seconds");
1494 ASSERT (PopUpString2 !=
NULL);
1498 L
"WARNING: Revert action will take about %d seconds",
1499 Dev->OpalDisk.EstimateTimeCost
1501 PopUpString3 = L
"DO NOT power off system during the revert action!";
1503 PopUpString2 =
NULL;
1504 PopUpString3 =
NULL;
1509 ZeroMem (&Session,
sizeof (Session));
1510 Session.Sscp = Dev->OpalDisk.Sscp;
1511 Session.MediaId = Dev->OpalDisk.MediaId;
1512 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1514 while (Count < MAX_PASSWORD_TRY_COUNT) {
1519 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1521 L
"Press ENTER to skip the request and continue boot,",
1522 L
"Press ESC to input password again",
1525 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1527 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
1538 if (Password ==
NULL) {
1545 if ((Dev->OpalDisk.SupportedAttributes.PyriteSsc == 1) &&
1546 (Dev->OpalDisk.LockingFeature.MediaEncryption == 0))
1560 Dev->OpalDisk.MsidLength
1570 Dev->OpalDisk.MsidLength
1574 if (Ret == TcgResultSuccess) {
1576 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1578 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1581 if (Password !=
NULL) {
1582 ZeroMem (Password, PasswordLen);
1586 if (Ret == TcgResultSuccess) {
1594 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1596 L
"Invalid password, request failed.",
1597 L
"Press ENTER to retry",
1600 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1603 if (Count >= MAX_PASSWORD_TRY_COUNT) {
1606 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1608 L
"Opal password retry count exceeds the limit.",
1609 L
"Press ENTER to skip the request and continue boot",
1612 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1618 if (PopUpString2 !=
NULL) {
1633 IN CHAR16 *RequestString
1643 BOOLEAN PasswordFailed;
1644 CHAR16 *PopUpString;
1645 CHAR16 *PopUpString2;
1646 CHAR16 *PopUpString3;
1653 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
1657 if (Dev->OpalDisk.EstimateTimeCost > MAX_ACCEPTABLE_REVERTING_TIME) {
1658 BufferSize =
StrSize (L
"Warning: Secure erase action will take about ####### seconds");
1660 ASSERT (PopUpString2 !=
NULL);
1664 L
"WARNING: Secure erase action will take about %d seconds",
1665 Dev->OpalDisk.EstimateTimeCost
1667 PopUpString3 = L
"DO NOT power off system during the action!";
1669 PopUpString2 =
NULL;
1670 PopUpString3 =
NULL;
1675 ZeroMem (&Session,
sizeof (Session));
1676 Session.Sscp = Dev->OpalDisk.Sscp;
1677 Session.MediaId = Dev->OpalDisk.MediaId;
1678 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1680 while (Count < MAX_PASSWORD_TRY_COUNT) {
1685 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1687 L
"Press ENTER to skip the request and continue boot,",
1688 L
"Press ESC to input password again",
1691 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1693 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
1704 if (Password ==
NULL) {
1712 if (Ret == TcgResultSuccess) {
1714 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1716 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1719 if (Password !=
NULL) {
1720 ZeroMem (Password, PasswordLen);
1724 if (Ret == TcgResultSuccess) {
1732 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1734 L
"Invalid password, request failed.",
1735 L
"Press ENTER to retry",
1738 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1741 if (Count >= MAX_PASSWORD_TRY_COUNT) {
1744 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1746 L
"Opal password retry count exceeds the limit.",
1747 L
"Press ENTER to skip the request and continue boot",
1750 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1756 if (PopUpString2 !=
NULL) {
1771 IN CHAR16 *RequestString
1776 UINT32 OldPasswordLen;
1779 CHAR8 *PasswordConfirm;
1780 UINT32 PasswordLenConfirm;
1785 CHAR16 *PopUpString;
1791 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
1797 while (Count < MAX_PASSWORD_TRY_COUNT) {
1802 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1804 L
"Press ENTER to skip the request and continue boot,",
1805 L
"Press ESC to input password again",
1808 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1810 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
1821 if (OldPassword ==
NULL) {
1826 OldPasswordLen = (UINT32)
AsciiStrLen (OldPassword);
1828 ZeroMem (&Session,
sizeof (Session));
1829 Session.Sscp = Dev->OpalDisk.Sscp;
1830 Session.MediaId = Dev->OpalDisk.MediaId;
1831 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1833 if (Ret == TcgResultSuccess) {
1834 DEBUG ((DEBUG_INFO,
"Verify with USER1 authority : Success\n"));
1837 if (Ret == TcgResultSuccess) {
1838 DEBUG ((DEBUG_INFO,
"Verify with ADMIN1 authority: Success\n"));
1840 ZeroMem (OldPassword, OldPasswordLen);
1842 DEBUG ((DEBUG_INFO,
"Verify: Failure\n"));
1845 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1847 L
"Incorrect password.",
1848 L
"Press ENTER to retry",
1851 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1859 if (Password ==
NULL) {
1860 ZeroMem (OldPassword, OldPasswordLen);
1869 if (PasswordConfirm ==
NULL) {
1870 ZeroMem (OldPassword, OldPasswordLen);
1872 ZeroMem (Password, PasswordLen);
1878 PasswordLenConfirm = (UINT32)
AsciiStrLen (PasswordConfirm);
1879 if ((PasswordLen != PasswordLenConfirm) ||
1880 (
CompareMem (Password, PasswordConfirm, PasswordLen) != 0))
1882 ZeroMem (OldPassword, OldPasswordLen);
1884 ZeroMem (Password, PasswordLen);
1886 ZeroMem (PasswordConfirm, PasswordLenConfirm);
1890 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1892 L
"Passwords are not the same.",
1893 L
"Press ENTER to retry",
1896 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1902 if (PasswordConfirm !=
NULL) {
1903 ZeroMem (PasswordConfirm, PasswordLenConfirm);
1907 ZeroMem (&Session,
sizeof (Session));
1908 Session.Sscp = Dev->OpalDisk.Sscp;
1909 Session.MediaId = Dev->OpalDisk.MediaId;
1910 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
1918 if (Ret == TcgResultSuccess) {
1920 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
1922 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
1925 if (OldPassword !=
NULL) {
1926 ZeroMem (OldPassword, OldPasswordLen);
1930 if (Password !=
NULL) {
1931 ZeroMem (Password, PasswordLen);
1935 if (Ret == TcgResultSuccess) {
1943 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1946 L
"Press ENTER to retry",
1949 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1952 if (Count >= MAX_PASSWORD_TRY_COUNT) {
1955 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1957 L
"Opal password retry count exceeds the limit.",
1958 L
"Press ENTER to skip the request and continue boot",
1961 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1977 IN CHAR16 *RequestString
1982 UINT32 OldPasswordLen;
1985 CHAR8 *PasswordConfirm;
1986 UINT32 PasswordLenConfirm;
1991 CHAR16 *PopUpString;
1997 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
2003 while (Count < MAX_PASSWORD_TRY_COUNT) {
2008 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
2010 L
"Press ENTER to skip the request and continue boot,",
2011 L
"Press ESC to input password again",
2014 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
2016 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
2027 if (OldPassword ==
NULL) {
2032 OldPasswordLen = (UINT32)
AsciiStrLen (OldPassword);
2034 ZeroMem (&Session,
sizeof (Session));
2035 Session.Sscp = Dev->OpalDisk.Sscp;
2036 Session.MediaId = Dev->OpalDisk.MediaId;
2037 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
2039 if (Ret == TcgResultSuccess) {
2040 DEBUG ((DEBUG_INFO,
"Verify: Success\n"));
2042 ZeroMem (OldPassword, OldPasswordLen);
2044 DEBUG ((DEBUG_INFO,
"Verify: Failure\n"));
2047 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
2049 L
"Incorrect password.",
2050 L
"Press ENTER to retry",
2053 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
2060 if (Password ==
NULL) {
2061 ZeroMem (OldPassword, OldPasswordLen);
2070 if (PasswordConfirm ==
NULL) {
2071 ZeroMem (OldPassword, OldPasswordLen);
2073 ZeroMem (Password, PasswordLen);
2079 PasswordLenConfirm = (UINT32)
AsciiStrLen (PasswordConfirm);
2080 if ((PasswordLen != PasswordLenConfirm) ||
2081 (
CompareMem (Password, PasswordConfirm, PasswordLen) != 0))
2083 ZeroMem (OldPassword, OldPasswordLen);
2085 ZeroMem (Password, PasswordLen);
2087 ZeroMem (PasswordConfirm, PasswordLenConfirm);
2091 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
2093 L
"Passwords are not the same.",
2094 L
"Press ENTER to retry",
2097 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
2103 if (PasswordConfirm !=
NULL) {
2104 ZeroMem (PasswordConfirm, PasswordLenConfirm);
2108 ZeroMem (&Session,
sizeof (Session));
2109 Session.Sscp = Dev->OpalDisk.Sscp;
2110 Session.MediaId = Dev->OpalDisk.MediaId;
2111 Session.OpalBaseComId = Dev->OpalDisk.OpalBaseComId;
2119 if (Ret == TcgResultSuccess) {
2121 DEBUG ((DEBUG_INFO,
"%s Success\n", RequestString));
2123 DEBUG ((DEBUG_INFO,
"%s Failure\n", RequestString));
2126 if (OldPassword !=
NULL) {
2127 ZeroMem (OldPassword, OldPasswordLen);
2131 if (Password !=
NULL) {
2132 ZeroMem (Password, PasswordLen);
2136 if (Ret == TcgResultSuccess) {
2144 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
2147 L
"Press ENTER to retry",
2150 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
2153 if (Count >= MAX_PASSWORD_TRY_COUNT) {
2156 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
2158 L
"Opal password retry count exceeds the limit.",
2159 L
"Press ENTER to skip the request and continue boot",
2162 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
2184 UINTN DevicePathSizeInVariable;
2186 UINTN DevicePathSize;
2187 BOOLEAN KeepUserData;
2189 DEBUG ((DEBUG_INFO,
"%a() - enter\n", __func__));
2191 if (mOpalRequestVariable ==
NULL) {
2193 OPAL_REQUEST_VARIABLE_NAME,
2194 &gHiiSetupVariableGuid,
2198 if (EFI_ERROR (Status) || (Variable ==
NULL)) {
2202 mOpalRequestVariable = Variable;
2203 mOpalRequestVariableSize = VariableSize;
2208 Status =
gRT->SetVariable (
2209 OPAL_REQUEST_VARIABLE_NAME,
2210 (
EFI_GUID *)&gHiiSetupVariableGuid,
2217 Variable = mOpalRequestVariable;
2218 VariableSize = mOpalRequestVariableSize;
2224 TempVariable = Variable;
2226 (VariableSize >= TempVariable->Length) &&
2231 DevicePath = Dev->OpalDisk.OpalDevicePath;
2233 if ((DevicePathSize == DevicePathSizeInVariable) &&
2234 (
CompareMem (DevicePath, DevicePathInVariable, DevicePathSize) == 0))
2239 if (TempVariable->OpalRequest.SetAdminPwd != 0) {
2243 if (TempVariable->OpalRequest.SetUserPwd != 0) {
2247 if (TempVariable->OpalRequest.SecureErase != 0) {
2251 if (TempVariable->OpalRequest.Revert != 0) {
2252 KeepUserData = (BOOLEAN)TempVariable->OpalRequest.KeepUserData;
2256 KeepUserData ? L
"Admin Revert(keep):" : L
"Admin Revert:"
2260 if (TempVariable->OpalRequest.PsidRevert != 0) {
2264 if (TempVariable->OpalRequest.DisableUser != 0) {
2268 if (TempVariable->OpalRequest.EnableFeature != 0) {
2281 VariableSize -= TempVariable->Length;
2285 DEBUG ((DEBUG_INFO,
"%a() - exit\n", __func__));
2306 TmpDev = TmpDev->
Next;
2337 if (TmpDev->
Next == Dev) {
2361 while (TmpDev !=
NULL) {
2363 TmpDev = TmpDev->
Next;
2407 gBS->CloseProtocol (
2409 &gEfiStorageSecurityCommandProtocolGuid,
2414 gBS->CloseProtocol (
2416 &gEfiBlockIoProtocolGuid,
2438 UINTN NumAllHandles,
2444 UINTN NumProtocolHandles;
2455 if ((Dev ==
NULL) || (AllHandlesBuffer ==
NULL) || (NumAllHandles == 0)) {
2459 Protocol = UseComp1 ? gEfiComponentNameProtocolGuid : gEfiComponentName2ProtocolGuid;
2464 Status =
gBS->LocateHandleBuffer (
2468 &NumProtocolHandles,
2469 &ProtocolHandlesBuffer
2471 if (EFI_ERROR (Status)) {
2478 if (NumProtocolHandles == 0) {
2488 Status = EFI_DEVICE_ERROR;
2489 for (Index1 = 0; Index1 < NumProtocolHandles; Index1++) {
2496 TmpHandle = ProtocolHandlesBuffer[Index1];
2498 Status =
gBS->OpenProtocol (
2504 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2506 if (EFI_ERROR (Status) || (Cnp1_2 ==
NULL)) {
2513 for (Index2 = 0; Index2 < NumAllHandles; Index2++) {
2514 Status = Cnp1_2->GetControllerName (
2516 AllHandlesBuffer[Index2],
2518 LANGUAGE_ISO_639_2_ENGLISH,
2521 if (EFI_ERROR (Status)) {
2522 Status = Cnp1_2->GetControllerName (
2524 AllHandlesBuffer[Index2],
2526 LANGUAGE_RFC_3066_ENGLISH,
2531 if (!EFI_ERROR (Status) && (DevName !=
NULL)) {
2532 StrLength =
StrLen (DevName) + 1;
2543 Status =
gBS->OpenProtocol (
2545 &gEfiDevicePathProtocolGuid,
2546 (VOID **)&TmpDevPath,
2549 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2551 if (!EFI_ERROR (Status)) {
2586 UINTN NumAllHandles;
2590 DEBUG ((DEBUG_ERROR | DEBUG_INIT,
"OpalDriverGetDriverDeviceName Exiting, Dev=NULL\n"));
2598 DEBUG ((DEBUG_ERROR | DEBUG_INIT,
"Name is null, update it\n"));
2602 Status =
gBS->LocateHandleBuffer (
2609 if (EFI_ERROR (Status)) {
2610 DEBUG ((DEBUG_INFO,
"LocateHandleBuffer for AllHandles failed %r\n", Status));
2618 DEBUG ((DEBUG_ERROR | DEBUG_INIT,
"ComponentName2 failed to get device name, try ComponentName\n"));
2620 DEBUG ((DEBUG_ERROR | DEBUG_INIT,
"ComponentName failed to get device name, skip device\n"));
2650 &gOpalDriverBinding,
2652 &gOpalComponentName,
2653 &gOpalComponentName2
2656 if (EFI_ERROR (Status)) {
2657 DEBUG ((DEBUG_ERROR,
"Install protocols to Opal driver Handle failed\n"));
2664 ZeroMem (&mOpalDriver,
sizeof (mOpalDriver));
2665 mOpalDriver.
Handle = ImageHandle;
2667 Status =
gBS->CreateEventEx (
2672 &gEfiEndOfDxeEventGroupGuid,
2720 if (mOpalEndOfDxe) {
2721 return EFI_UNSUPPORTED;
2727 Status =
gBS->OpenProtocol (
2729 &gEfiStorageSecurityCommandProtocolGuid,
2730 (VOID **)&SecurityCommand,
2731 This->DriverBindingHandle,
2733 EFI_OPEN_PROTOCOL_BY_DRIVER
2736 if (Status == EFI_ALREADY_STARTED) {
2740 if (EFI_ERROR (Status)) {
2747 gBS->CloseProtocol (
2749 &gEfiStorageSecurityCommandProtocolGuid,
2750 This->DriverBindingHandle,
2803 while (Itr !=
NULL) {
2804 if (Controller == Itr->
Handle) {
2817 return EFI_OUT_OF_RESOURCES;
2820 Dev->
Handle = Controller;
2825 Status =
gBS->OpenProtocol (
2827 &gEfiStorageSecurityCommandProtocolGuid,
2828 (VOID **)&Dev->Sscp,
2829 This->DriverBindingHandle,
2831 EFI_OPEN_PROTOCOL_BY_DRIVER
2833 if (EFI_ERROR (Status)) {
2842 Status =
gBS->OpenProtocol (
2844 &gEfiBlockIoProtocolGuid,
2846 This->DriverBindingHandle,
2848 EFI_OPEN_PROTOCOL_BY_DRIVER
2850 if (EFI_ERROR (Status)) {
2854 if (Status == EFI_UNSUPPORTED) {
2860 gBS->CloseProtocol (
2862 &gEfiStorageSecurityCommandProtocolGuid,
2863 This->DriverBindingHandle,
2875 if (BlkIo ==
NULL) {
2881 gBS->CloseProtocol (
2883 &gEfiBlockIoProtocolGuid,
2884 This->DriverBindingHandle,
2898 if (EFI_ERROR (Status)) {
2920 gBS->CloseProtocol (
2922 &gEfiStorageSecurityCommandProtocolGuid,
2923 This->DriverBindingHandle,
2929 return EFI_DEVICE_ERROR;
2950 UINTN NumberOfChildren,
2961 while (Itr !=
NULL) {
2962 if (Itr->
Handle == Controller) {
2970 return EFI_NOT_FOUND;
2993 return (EFI_INVALID_PARAMETER);
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
RETURN_STATUS EFIAPI UnicodeStrToAsciiStrS(IN CONST CHAR16 *Source, OUT CHAR8 *Destination, IN UINTN DestMax)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
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
#define MSG_NVME_NAMESPACE_DP
#define MESSAGING_DEVICE_PATH
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
RETURN_STATUS EFIAPI SetLockBoxAttributes(IN GUID *Guid, IN UINT64 Attributes)
RETURN_STATUS EFIAPI RestoreLockBox(IN GUID *Guid, IN VOID *Buffer OPTIONAL, IN OUT UINTN *Length OPTIONAL)
RETURN_STATUS EFIAPI UpdateLockBox(IN GUID *Guid, IN UINTN Offset, IN VOID *Buffer, IN UINTN Length)
RETURN_STATUS EFIAPI SaveLockBox(IN GUID *Guid, IN VOID *Buffer, IN UINTN Length)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
UINT8 EFIAPI PciRead8(IN UINTN Address)
#define PCI_LIB_ADDRESS(Bus, Device, Function, Register)
VOID OpalSupportUpdatePassword(IN OUT OPAL_DISK *OpalDisk, IN VOID *Password, IN UINT32 PasswordLength)
VOID ProcessOpalRequest(IN OPAL_DRIVER_DEVICE *Dev)
VOID EFIAPI OpalEndOfDxeEventNotify(EFI_EVENT Event, VOID *Context)
CHAR8 * OpalDriverPopUpPasswordInput(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *PopUpString1, IN CHAR16 *PopUpString2, IN CHAR16 *PopUpString3, OUT BOOLEAN *PressEsc)
VOID ProcessOpalRequestRevert(IN OPAL_DRIVER_DEVICE *Dev, IN BOOLEAN KeepUserData, IN CHAR16 *RequestString)
VOID SendBlockSidCommand(VOID)
VOID BuildOpalDeviceInfo(VOID)
EFI_STATUS EFIAPI OpalEfiDriverBindingStop(EFI_DRIVER_BINDING_PROTOCOL *This, EFI_HANDLE Controller, UINTN NumberOfChildren, EFI_HANDLE *ChildHandleBuffer)
VOID ProcessOpalRequestEnableFeature(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
VOID AddDeviceToTail(IN OPAL_DRIVER_DEVICE *Dev)
VOID OpalDriverRequestPassword(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
UINT8 GetDeviceCount(VOID)
VOID ProcessOpalRequestDisableUser(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
EFI_STATUS EFIAPI OpalEfiDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
CHAR8 * OpalDriverPopUpPsidInput(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *PopUpString, IN CHAR16 *PopUpString2, IN CHAR16 *PopUpString3, OUT BOOLEAN *PressEsc)
OPAL_DRIVER_DEVICE * OpalDriverGetDeviceList(VOID)
BOOLEAN OpalDriverGetDriverDeviceName(OPAL_DRIVER_DEVICE *Dev)
EFI_STATUS EFIAPI EfiDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID RemoveDevice(IN OPAL_DRIVER_DEVICE *Dev)
TCG_RESULT EFIAPI OpalSupportEnableOpalFeature(IN OPAL_SESSION *Session, IN VOID *Msid, IN UINT32 MsidLength, IN VOID *Password, IN UINT32 PassLength)
EFI_STATUS EFIAPI OpalEfiDriverUnload(IN EFI_HANDLE ImageHandle)
VOID OpalDriverStopDevice(OPAL_DRIVER_DEVICE *Dev)
VOID ProcessOpalRequestSecureErase(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
BOOLEAN OpalDriverGetDeviceNameByProtocol(EFI_HANDLE *AllHandlesBuffer, UINTN NumAllHandles, OPAL_DRIVER_DEVICE *Dev, BOOLEAN UseComp1)
EFI_STATUS EFIAPI OpalEfiDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
VOID ProcessOpalRequestSetAdminPwd(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
VOID ExtractDeviceInfoFromDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *DevInfoLength, OUT OPAL_DEVICE_LOCKBOX_DATA *DevInfo OPTIONAL)
VOID ProcessOpalRequestSetUserPwd(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
VOID ProcessOpalRequestPsidRevert(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
CHAR16 * OpalGetPopUpString(IN OPAL_DRIVER_DEVICE *Dev, IN CHAR16 *RequestString)
TCG_RESULT EFIAPI OpalSupportGetAvailableActions(IN OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, IN TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature, IN UINT16 OwnerShip, OUT OPAL_DISK_ACTIONS *AvalDiskActions)
EFI_STATUS OpalDiskUpdateOwnerShip(OPAL_DISK *OpalDisk)
EFI_STATUS HiiUninstall(VOID)
EFI_STATUS HiiInstall(VOID)
EFI_STATUS OpalDiskInitialize(IN OPAL_DRIVER_DEVICE *Dev)
#define PcdGetBool(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT32 EFIAPI Tcg2PhysicalPresenceLibGetManagementFlags(VOID)
TCG_RESULT EFIAPI OpalUtilSetAdminPasswordAsSid(OPAL_SESSION *AdminSpSession, const VOID *GeneratedSid, UINT32 SidLength, const VOID *Password, UINT32 PassLength)
TCG_RESULT EFIAPI OpalUtilSecureErase(OPAL_SESSION *LockingSpSession, const VOID *Password, UINT32 PasswordLength, BOOLEAN *PasswordFailed)
TCG_RESULT EFIAPI OpalBlockSid(OPAL_SESSION *Session, BOOLEAN HardwareReset)
TCG_RESULT EFIAPI OpalUtilUpdateGlobalLockingRange(OPAL_SESSION *LockingSpSession, const VOID *Password, UINT32 PasswordLength, BOOLEAN ReadLocked, BOOLEAN WriteLocked)
BOOLEAN OpalDeviceLocked(OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature)
TCG_RESULT EFIAPI OpalUtilVerifyPassword(OPAL_SESSION *LockingSpSession, const VOID *Password, UINT32 PasswordLength, TCG_UID HostSigningAuthority)
TCG_RESULT EFIAPI OpalUtilDisableUser(OPAL_SESSION *LockingSpSession, const VOID *Password, UINT32 PasswordLength, BOOLEAN *PasswordFailed)
BOOLEAN EFIAPI OpalUtilAdminPasswordExists(IN UINT16 OwnerShip, IN TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature)
TCG_RESULT EFIAPI OpalUtilSetAdminPassword(OPAL_SESSION *AdminSpSession, const VOID *OldPassword, UINT32 OldPasswordLength, const VOID *NewPassword, UINT32 NewPasswordLength)
TCG_RESULT EFIAPI OpalUtilRevert(OPAL_SESSION *LockingSpSession, BOOLEAN KeepUserData, const VOID *Password, UINT32 PasswordLength, BOOLEAN *PasswordFailed, UINT8 *Msid, UINT32 MsidLength)
TCG_RESULT EFIAPI OpalUtilPsidRevert(OPAL_SESSION *AdminSpSession, const VOID *Psid, UINT32 PsidLength)
TCG_RESULT EFIAPI OpalUtilSetUserPassword(OPAL_SESSION *LockingSpSession, const VOID *OldPassword, UINT32 OldPasswordLength, const VOID *NewPassword, UINT32 NewPasswordLength)
TCG_RESULT EFIAPI OpalUtilSetOpalLockingRange(OPAL_SESSION *LockingSpSession, const VOID *Password, UINT32 PassLength, TCG_UID LockingRangeUid, UINT64 RangeStart, UINT64 RangeLength, BOOLEAN ReadLockEnabled, BOOLEAN WriteLockEnabled, BOOLEAN ReadLocked, BOOLEAN WriteLocked)
BOOLEAN EFIAPI OpalFeatureEnabled(OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes, TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
EFI_BLOCK_IO_MEDIA * Media
EFI_HANDLE DriverBindingHandle
CHAR8 * NameZ
Allocated/freed by UEFI Filter Driver at device creation/removal.
EFI_HANDLE Handle
Device handle.
EFI_DEVICE_PATH_PROTOCOL * OpalDevicePath
Device protocols consumed.
CHAR16 * Name16
Allocated/freed by UEFI Filter Driver at device creation/removal.
UINT32 MediaId
Required parameter for EFI_STORAGE_SECURITY_COMMAND_PROTOCOL, from BLOCK_IO_MEDIA.
OPAL_DISK OpalDisk
User context.
OPAL_DRIVER_DEVICE * Next
Linked list pointer.
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
EFI_HANDLE Handle
Driver image handle.
OPAL_DRIVER_DEVICE * DeviceList
Linked list of controllers owned by this Driver.