diff options
author | Sergii Dmytruk <sergii.dmytruk@3mdeb.com> | 2022-10-29 20:42:28 +0300 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-12-21 14:48:00 +0000 |
commit | d43154486d27323f64334203e9bc8baf08af6845 (patch) | |
tree | 0f232ce82fc77c1aa7ed5aba2303283fe7a5e78c /src/security/tpm/tis.h | |
parent | 86f845ad0d864f44c21db964f0fdb213c41a152c (diff) |
security/tpm/: turn tis_{init,open} into tis_probe
Init was always followed by open and after successful initialization we
need only send-receive function, which is now returned by tis_probe on
success further reducing number of functions to export from drivers.
Change-Id: Ib4ce35ada24e3959ea1a518c29d431b4ae123809
Ticket: https://ticket.coreboot.org/issues/433
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68991
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/security/tpm/tis.h')
-rw-r--r-- | src/security/tpm/tis.h | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/security/tpm/tis.h b/src/security/tpm/tis.h index 04a137f12e..b6a258f491 100644 --- a/src/security/tpm/tis.h +++ b/src/security/tpm/tis.h @@ -34,25 +34,6 @@ enum tis_status { }; /* - * tis_init() - * - * Initialize the TPM device. Returns 0 on success or -1 on - * failure (in case device probing did not succeed). - */ -int tis_init(void); - -/* - * tis_open() - * - * Requests access to locality 0 for the caller. - * - * Returns 0 on success, -1 on failure. - */ -int tis_open(void); - -/* - * tis_sendrecv() - * * Send the requested data to the TPM and then try to get its response * * @sendbuf - buffer of the data to send @@ -63,8 +44,19 @@ int tis_open(void); * Returns 0 on success (and places the number of response bytes at recv_len) * or -1 on failure. */ -int tis_sendrecv(const u8 *sendbuf, size_t send_size, u8 *recvbuf, - size_t *recv_len); +typedef int (*tis_sendrecv_fn)(const u8 *sendbuf, size_t send_size, u8 *recvbuf, + size_t *recv_len); + +/* + * tis_probe() + * + * Probe for the TPM device and set it up for use within locality 0. Returns + * pointer to send-receive function on success or NULL on failure. + * + * Do not call this explicitly, it's meant to be used exclusively by TSS + * implementation (tlcl_lib_init() function to be specific). + */ +tis_sendrecv_fn tis_probe(void); /* TODO: This is supposed to be used only for Google TPM. Consider moving this to drivers/tpm/cr50.h. */ |