summaryrefslogtreecommitdiff
path: root/src/drivers/spi/tpm/tpm.c
diff options
context:
space:
mode:
authorJon Murphy <jpmurphy@google.com>2023-09-05 11:36:43 -0600
committerRaul Rangel <rrangel@chromium.org>2023-09-28 16:54:37 +0000
commitd7b8dc9cf5978809912dcffefce2eda5937c9653 (patch)
tree56befbc9563ce2baca6f31ccbfb041e99fb858d6 /src/drivers/spi/tpm/tpm.c
parent53fc667943052bd592b8406bdf4bf652c6c9cd3a (diff)
treewide: convert to tpm_result_t
Convert TPM functions to return TPM error codes(referred to as tpm_result_t) values to match the TCG standard. BUG=b:296439237 TEST=build and boot to Skyrim BRANCH=None Change-Id: Ifdf9ff6c2a1f9b938dbb04d245799391115eb6b1 Signed-off-by: Jon Murphy <jpmurphy@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/77666 Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/spi/tpm/tpm.c')
-rw-r--r--src/drivers/spi/tpm/tpm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c
index 01f04f4a36..13f44f9448 100644
--- a/src/drivers/spi/tpm/tpm.c
+++ b/src/drivers/spi/tpm/tpm.c
@@ -394,7 +394,7 @@ static const uint32_t supported_did_vids[] = {
0x0000104a /* ST33HTPH2E32 */
};
-int tpm2_init(struct spi_slave *spi_if)
+tpm_result_t tpm2_init(struct spi_slave *spi_if)
{
uint32_t did_vid, status, intf_id;
uint8_t cmd;
@@ -433,7 +433,7 @@ int tpm2_init(struct spi_slave *spi_if)
if (!retries) {
printk(BIOS_ERR, "\n%s: Failed to connect to the TPM\n",
__func__);
- return -1;
+ return TPM_CB_FAIL;
}
printk(BIOS_INFO, " done!\n");
@@ -444,11 +444,11 @@ int tpm2_init(struct spi_slave *spi_if)
if (tpm2_read_reg(TPM_INTF_ID_REG, &intf_id, sizeof(intf_id)) != CB_SUCCESS) {
printk(BIOS_ERR, "\n%s: Failed to read interface ID register\n",
__func__);
- return -1;
+ return TPM_CB_FAIL;
}
if ((be32toh(intf_id) & 0xF) == 0xF) {
printk(BIOS_DEBUG, "\n%s: Not a TPM2 device\n", __func__);
- return -1;
+ return TPM_CB_FAIL;
}
}
@@ -459,16 +459,16 @@ int tpm2_init(struct spi_slave *spi_if)
* initialization after reset.
*/
if (tpm2_claim_locality() != CB_SUCCESS)
- return -1;
+ return TPM_CB_FAIL;
if (read_tpm_sts(&status) != CB_SUCCESS) {
printk(BIOS_ERR, "Reading status reg failed\n");
- return -1;
+ return TPM_CB_FAIL;
}
if ((status & TPM_STS_FAMILY_MASK) != TPM_STS_FAMILY_TPM_2_0) {
printk(BIOS_ERR, "unexpected TPM family value, status: %#x\n",
status);
- return -1;
+ return TPM_CB_FAIL;
}
/*
@@ -492,7 +492,7 @@ int tpm2_init(struct spi_slave *spi_if)
cr50_set_board_cfg();
}
}
- return 0;
+ return TPM_SUCCESS;
}
/*