OUT UINT32 *AlgorithmSet\r
);\r
\r
+/**\r
+ This function will query if the command is supported.\r
+\r
+ @param[In] Command TPM_CC command starts from TPM_CC_FIRST.\r
+ @param[out] IsCmdImpl The command is supported or not.\r
+\r
+ @retval EFI_SUCCESS Operation completed successfully.\r
+ @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm2GetCapabilityIsCommandImplemented (\r
+ IN TPM_CC Command,\r
+ OUT BOOLEAN *IsCmdImpl\r
+ );\r
+\r
/**\r
This command is used to check to see if specific combinations of algorithm parameters are supported.\r
\r
\r
#pragma pack()\r
\r
+#define TPMA_CC_COMMANDINDEX_MASK 0x2000FFFF\r
+\r
/**\r
This command returns various information regarding the TPM and its current state.\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ This function will query if the command is supported.\r
+\r
+ @param[In] Command TPM_CC command starts from TPM_CC_FIRST.\r
+ @param[out] IsCmdImpl The command is supported or not.\r
+\r
+ @retval EFI_SUCCESS Operation completed successfully.\r
+ @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm2GetCapabilityIsCommandImplemented (\r
+ IN TPM_CC Command,\r
+ OUT BOOLEAN *IsCmdImpl\r
+ )\r
+{\r
+ TPMS_CAPABILITY_DATA TpmCap;\r
+ TPMI_YES_NO MoreData;\r
+ EFI_STATUS Status;\r
+ UINT32 Attribute;\r
+\r
+ Status = Tpm2GetCapability (\r
+ TPM_CAP_COMMANDS,\r
+ Command,\r
+ 1,\r
+ &MoreData,\r
+ &TpmCap\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0], sizeof (UINT32));\r
+ *IsCmdImpl = (Command == (SwapBytes32(Attribute) & TPMA_CC_COMMANDINDEX_MASK));\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
/**\r
This command is used to check to see if specific combinations of algorithm parameters are supported.\r
\r