summaryrefslogtreecommitdiff
path: root/src/drivers/pc80/tpm/tis.c
diff options
context:
space:
mode:
authorSergii Dmytruk <sergii.dmytruk@3mdeb.com>2022-12-22 19:35:25 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-12-23 21:31:11 +0000
commit4ee03170e058313477b8f0bbfc81d093a6197d98 (patch)
treec7a86dddbaa044167ac0ba7916cf4ebf76889118 /src/drivers/pc80/tpm/tis.c
parent025d20eaebb4680396a7e9e558295d28f7ad0988 (diff)
Revert "security/tpm/: turn tis_{init,open} into tis_probe"
This reverts commit d43154486d27323f64334203e9bc8baf08af6845. From CB:68991: This causes CraterLake boot up process to die. Investigation in progress. Change-Id: I4a6c11b0e638a891108fe230bdaea92d5fbca020 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71205 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Tested-by: siemens-bot Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/drivers/pc80/tpm/tis.c')
-rw-r--r--src/drivers/pc80/tpm/tis.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/drivers/pc80/tpm/tis.c b/src/drivers/pc80/tpm/tis.c
index 42ad19298c..ce88ae012d 100644
--- a/src/drivers/pc80/tpm/tis.c
+++ b/src/drivers/pc80/tpm/tis.c
@@ -373,7 +373,7 @@ static int tis_command_ready(u8 locality)
* Returns 0 on success (the device is found or was found during an earlier
* invocation) or TPM_DRIVER_ERR if the device is not found.
*/
-static u32 pc80_tis_probe(void)
+static u32 tis_probe(void)
{
const char *device_name = "unknown";
const char *vendor_name = device_name;
@@ -608,11 +608,26 @@ static u32 tis_readresponse(u8 *buffer, size_t *len)
}
/*
+ * tis_init()
+ *
+ * Initialize the TPM device. Returns 0 on success or TPM_DRIVER_ERR on
+ * failure (in case device probing did not succeed).
+ */
+int tis_init(void)
+{
+ if (tis_probe())
+ return TPM_DRIVER_ERR;
+ return 0;
+}
+
+/*
+ * tis_open()
+ *
* Requests access to locality 0 for the caller.
*
* Returns 0 on success, TPM_DRIVER_ERR on failure.
*/
-static int pc80_tis_open(void)
+int tis_open(void)
{
u8 locality = 0; /* we use locality zero for everything */
@@ -638,6 +653,8 @@ static int pc80_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
@@ -648,8 +665,8 @@ static int pc80_tis_open(void)
* Returns 0 on success (and places the number of response bytes at recv_len)
* or TPM_DRIVER_ERR on failure.
*/
-static int pc80_tpm_sendrecv(const uint8_t *sendbuf, size_t send_size,
- uint8_t *recvbuf, size_t *recv_len)
+int tis_sendrecv(const uint8_t *sendbuf, size_t send_size,
+ uint8_t *recvbuf, size_t *recv_len)
{
if (tis_senddata(sendbuf, send_size)) {
printf("%s:%d failed sending data to TPM\n",
@@ -661,23 +678,6 @@ static int pc80_tpm_sendrecv(const uint8_t *sendbuf, size_t send_size,
}
/*
- * 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.
- */
-tis_sendrecv_fn tis_probe(void)
-{
- if (pc80_tis_probe())
- return NULL;
-
- if (pc80_tis_open())
- return NULL;
-
- return &pc80_tpm_sendrecv;
-}
-
-/*
* tis_setup_interrupt()
*
* Set up the interrupt vector and polarity for locality 0 and