aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_tis_core.h
diff options
context:
space:
mode:
authorAlexander Steffen <Alexander.Steffen@infineon.com>2022-06-08 19:31:12 +0200
committerJarkko Sakkinen <jarkko@kernel.org>2022-08-03 23:56:19 +0300
commitf25534a68b8e1ed8266d23b464a3b512364b124d (patch)
treee6b0e4eca4ed8a8f8ed6c70e6c28ffa4da8a6197 /drivers/char/tpm/tpm_tis_core.h
parentdt-bindings: trivial-devices: Add Infineon SLB9673 TPM (diff)
downloadlinux-dev-f25534a68b8e1ed8266d23b464a3b512364b124d.tar.xz
linux-dev-f25534a68b8e1ed8266d23b464a3b512364b124d.zip
tpm: Add tpm_tis_verify_crc to the tpm_tis_phy_ops protocol layer
Some TPMs, e.g. those implementing the I2C variant of TIS, can verify data transfers to/from the FIFO with a CRC. The CRC is calculated over the entirety of the FIFO register. Since the phy_ops layer is not aware when the core layer is done reading/writing the FIFO, CRC verification must be triggered from the core layer. To this end, add an optional phy_ops API call. Co-developed-by: Johannes Holland <johannes.holland@infineon.com> Signed-off-by: Johannes Holland <johannes.holland@infineon.com> Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/char/tpm/tpm_tis_core.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
index 6c203f36b8a1..66a5a13cd1df 100644
--- a/drivers/char/tpm/tpm_tis_core.h
+++ b/drivers/char/tpm/tpm_tis_core.h
@@ -121,6 +121,8 @@ struct tpm_tis_phy_ops {
u8 *result, enum tpm_tis_io_mode mode);
int (*write_bytes)(struct tpm_tis_data *data, u32 addr, u16 len,
const u8 *value, enum tpm_tis_io_mode mode);
+ int (*verify_crc)(struct tpm_tis_data *data, size_t len,
+ const u8 *value);
};
static inline int tpm_tis_read_bytes(struct tpm_tis_data *data, u32 addr,
@@ -188,6 +190,14 @@ static inline int tpm_tis_write32(struct tpm_tis_data *data, u32 addr,
return rc;
}
+static inline int tpm_tis_verify_crc(struct tpm_tis_data *data, size_t len,
+ const u8 *value)
+{
+ if (!data->phy_ops->verify_crc)
+ return 0;
+ return data->phy_ops->verify_crc(data, len, value);
+}
+
static inline bool is_bsw(void)
{
#ifdef CONFIG_X86