diff options
author | Jon Murphy <jpmurphy@google.com> | 2023-09-05 11:36:43 -0600 |
---|---|---|
committer | Raul Rangel <rrangel@chromium.org> | 2023-09-28 16:54:37 +0000 |
commit | d7b8dc9cf5978809912dcffefce2eda5937c9653 (patch) | |
tree | 56befbc9563ce2baca6f31ccbfb041e99fb858d6 /src/drivers/i2c/tpm/tpm.c | |
parent | 53fc667943052bd592b8406bdf4bf652c6c9cd3a (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/i2c/tpm/tpm.c')
-rw-r--r-- | src/drivers/i2c/tpm/tpm.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/i2c/tpm/tpm.c b/src/drivers/i2c/tpm/tpm.c index c88dcdd4b9..4dbefb44f3 100644 --- a/src/drivers/i2c/tpm/tpm.c +++ b/src/drivers/i2c/tpm/tpm.c @@ -451,7 +451,7 @@ out_err: /* Initialization of I2C TPM */ -int tpm_vendor_probe(unsigned int bus, uint32_t addr) +tpm_result_t tpm_vendor_probe(unsigned int bus, uint32_t addr) { struct stopwatch sw; uint8_t buf = 0; @@ -487,18 +487,18 @@ int tpm_vendor_probe(unsigned int bus, uint32_t addr) * Claim failure if the ValidSts (bit 7) is clear. */ if (!(buf & TPM_STS_VALID)) - return -1; + return TPM_CB_FAIL; - return 0; + return TPM_SUCCESS; } -int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr) +tpm_result_t tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr) { uint32_t vendor; if (dev_addr == 0) { printk(BIOS_ERR, "%s: missing device address\n", __func__); - return -1; + return TPM_CB_FAIL; } tpm_dev.chip_type = UNKNOWN; @@ -518,7 +518,7 @@ int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr) chip->cancel = &tpm_tis_i2c_ready; if (request_locality(0) != 0) - return -1; + return TPM_CB_FAIL; /* Read four bytes from DID_VID register */ if (iic_tpm_read(TPM_DID_VID(0), (uint8_t *)&vendor, 4) < 0) @@ -543,9 +543,9 @@ int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr) * Standard timeout values are used so far */ - return 0; + return TPM_SUCCESS; out_err: release_locality(0, 1); - return -1; + return TPM_CB_FAIL; } |