/* This function will query if the command is supported. */
EFI_STATUS EFIAPI Tpm2GetCapabilityIsCommandImplemented(IN TPM_CC Command, OUT BOOLEAN *IsCmdImpl)
/* This function will query if the command is supported. */
EFI_STATUS EFIAPI Tpm2GetCapabilityIsCommandImplemented(IN TPM_CC Command, OUT BOOLEAN *IsCmdImpl)
{
  TPMS_CAPABILITY_DATA  TpmCap;
  TPMI_YES_NO           MoreData;
  EFI_STATUS            Status;
  UINT32                Attribute;
  Status = Tpm2GetCapability (
             TPM_CAP_COMMANDS,
             Command,
             1,
             &MoreData,
             &TpmCap
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0], sizeof (UINT32));
  *IsCmdImpl = (Command == (SwapBytes32 (Attribute) & TPMA_CC_COMMANDINDEX_MASK));
  return EFI_SUCCESS;
}