/* The function returns whether or not the device is Opal Locked. TRUE means that the device is partially or fully locked. This will perform a Level 0 Discovery and parse the locking feature descriptor */
BOOLEAN IsOpalDeviceLocked(OPAL_PEI_DEVICE *OpalDev, BOOLEAN *BlockSidSupported)
/* The function returns whether or not the device is Opal Locked. TRUE means that the device is partially or fully locked. This will perform a Level 0 Discovery and parse the locking feature descriptor */
BOOLEAN IsOpalDeviceLocked(OPAL_PEI_DEVICE *OpalDev, BOOLEAN *BlockSidSupported)
{
  OPAL_SESSION                    Session;
  OPAL_DISK_SUPPORT_ATTRIBUTE     SupportedAttributes;
  TCG_LOCKING_FEATURE_DESCRIPTOR  LockingFeature;
  UINT16                          OpalBaseComId;
  TCG_RESULT                      Ret;
  Session.Sscp    = &OpalDev->Sscp;
  Session.MediaId = 0;
  Ret = OpalGetSupportedAttributesInfo (&Session, &SupportedAttributes, &OpalBaseComId);
  if (Ret != TcgResultSuccess) {
    return FALSE;
  }
  Session.OpalBaseComId = OpalBaseComId;
  *BlockSidSupported    = SupportedAttributes.BlockSid == 1 ? TRUE : FALSE;
  Ret = OpalGetLockingInfo (&Session, &LockingFeature);
  if (Ret != TcgResultSuccess) {
    return FALSE;
  }
  return OpalDeviceLocked (&SupportedAttributes, &LockingFeature);
}