@@ -120,7 +120,6 @@ tpm_simple_cmd(uint8_t locty, uint32_t ordinal, int param_size, uint16_t param,
uint16_t param;
} __attribute__((packed)) req = {
.trqh.totlen = cpu_to_be32(sizeof(req.trqh) + param_size),
- .trqh.tag = cpu_to_be16(TPM_TAG_RQU_CMD),
.trqh.ordinal = cpu_to_be32(ordinal),
};
uint8_t obuffer[64];
@@ -128,6 +127,15 @@ tpm_simple_cmd(uint8_t locty, uint32_t ordinal, int param_size, uint16_t param,
uint32_t obuffer_len = sizeof(obuffer);
int ret;
+ switch (TPM_version) {
+ case TPM_VERSION_1_2:
+ req.trqh.tag = cpu_to_be16(TPM_TAG_RQU_CMD);
+ break;
+ case TPM_VERSION_2:
+ req.trqh.tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
+ break;
+ }
+
switch (param_size) {
case 2:
req.param = cpu_to_be16(param);
@@ -195,4 +195,12 @@ struct tpm_rsp_getcap_buffersize {
#define TPM_PPI_OP_SET_OWNERINSTALL_TRUE 8
#define TPM_PPI_OP_SET_OWNERINSTALL_FALSE 9
+/****************************************************************
+ * TPM v2.0 hardware commands
+ ****************************************************************/
+
+/* TPM 2 command tags */
+#define TPM2_ST_NO_SESSIONS 0x8001
+#define TPM2_ST_SESSIONS 0x8002
+
#endif /* TCGBIOS_INT_H */