From 63632d7d82648f77067eadb1bf8c539d7b2d7aaf Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Wed, 16 Feb 2022 13:44:48 -0700 Subject: [PATCH] security/tpm: Add vendor-specific tis functions to read/write TPM regs In order to abstract bus-specific logic from TPM logic, the prototype for two vendor-specific tis functions are added in this patch. tis_vendor_read() can be used to read directly from TPM registers, and tis_vendor_write() can be used to write directly to TPM registers. Signed-off-by: Tim Wawrzynczak Change-Id: I939cf5b6620b6f5f6d454c53fcaf37c153702acc Reviewed-on: https://review.coreboot.org/c/coreboot/+/62058 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/security/tpm/tis.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/security/tpm/tis.h b/src/security/tpm/tis.h index 5b2c001070..3b65134d27 100644 --- a/src/security/tpm/tis.h +++ b/src/security/tpm/tis.h @@ -5,6 +5,7 @@ #include #include +#include enum tis_access { TPM_ACCESS_VALID = (1 << 7), @@ -84,4 +85,31 @@ int tis_sendrecv(const u8 *sendbuf, size_t send_size, u8 *recvbuf, */ int tis_plat_irq_status(void); +/* + * tis_vendor_write() + * + * Vendor-specific function to send the requested data to the TPM. + * + * @addr - address of the register to write to + * @sendbuf - buffer of the data to send + * @send_size - size of the data to send + * + * Returns CB_SUCCESS 0 on success, CB_ERR on failure. + */ +cb_err_t tis_vendor_write(unsigned int addr, const void *sendbuf, size_t send_size); + +/* + * tis_vendor_read() + * + * Vendor-specific function to read the requested data from the TPM. + * + * @addr - address of the register to read from + * @recvbuf - buffer of the data to read + * @recv_size - size of the output buffer + * + * Returns CB_SUCCESS on success or -1 on failure. + */ +cb_err_t tis_vendor_read(unsigned int addr, void *recvbuf, size_t recv_size); + + #endif /* TIS_H_ */ -- 2.11.4.GIT