summary refs log tree commit diff stats
path: root/hw/tpm/tpm_util.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-01-30 15:20:01 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-01-30 15:20:01 +0000
commit6521130b0a7f699fdb82446d57df5627bfa7ed3c (patch)
tree4133f36786798486d7222df1dbcc9d1919708116 /hw/tpm/tpm_util.h
parent8ebb314b957403c1c9a3f1cf995f73c6ae9d5d10 (diff)
parent4ab6cb4c62273bb46102e5ae1d6af691b47cbcd8 (diff)
downloadfocaccia-qemu-6521130b0a7f699fdb82446d57df5627bfa7ed3c.tar.gz
focaccia-qemu-6521130b0a7f699fdb82446d57df5627bfa7ed3c.zip
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-01-26-2' into staging
Merge tpm 2018/01/26 v2

# gpg: Signature made Mon 29 Jan 2018 22:20:05 GMT
# gpg:                using RSA key 0x75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-01-26-2:
  tpm: add CRB device
  tpm: report backend request error
  tpm: replace GThreadPool with AIO threadpool
  tpm: lookup cancel path under tpm device class
  tpm: fix alignment issues
  tpm: Set the flags of the CMD_INIT command to 0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/tpm/tpm_util.h')
-rw-r--r--hw/tpm/tpm_util.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/hw/tpm/tpm_util.h b/hw/tpm/tpm_util.h
index 19b28474ae..f003d15615 100644
--- a/hw/tpm/tpm_util.h
+++ b/hw/tpm/tpm_util.h
@@ -31,9 +31,24 @@ bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len);
 
 int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version);
 
+static inline uint16_t tpm_cmd_get_tag(const void *b)
+{
+    return lduw_be_p(b);
+}
+
 static inline uint32_t tpm_cmd_get_size(const void *b)
 {
-    return be32_to_cpu(*(const uint32_t *)(b + 2));
+    return ldl_be_p(b + 2);
+}
+
+static inline uint32_t tpm_cmd_get_ordinal(const void *b)
+{
+    return ldl_be_p(b + 6);
+}
+
+static inline uint32_t tpm_cmd_get_errcode(const void *b)
+{
+    return ldl_be_p(b + 6);
 }
 
 int tpm_util_get_buffer_size(int tpm_fd, TPMVersion tpm_version,