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 <twawrzynczak@chromium.org>
Change-Id: I939cf5b6620b6f5f6d454c53fcaf37c153702acc
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62058
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Tim Wawrzynczak 2022-02-16 13:44:48 -07:00 committed by Felix Held
parent 591c7ebf18
commit 63632d7d82
1 changed files with 28 additions and 0 deletions

View File

@ -5,6 +5,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <types.h>
enum tis_access { enum tis_access {
TPM_ACCESS_VALID = (1 << 7), 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); 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_ */ #endif /* TIS_H_ */