{drivers/security}: Replace `cb_err_t` with `enum cb_err`
This patch replaces remaining `cb_err_t` with `enum cb_err` after commit
hash 69cc557c (commonlib/bsd: Remove cb_err_t) removes majority of
`cb_err_t` instances.
TEST=Able to build the brya.
Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I3392f9c2cfb4a889a999c8ea25066c89979f0900
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62676
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c
index f8548a7..ce2278b 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -514,12 +514,12 @@
{
}
-cb_err_t tis_vendor_write(unsigned int addr, const void *buffer, size_t bytes)
+enum cb_err tis_vendor_write(unsigned int addr, const void *buffer, size_t bytes)
{
return cr50_i2c_write(addr & 0xff, buffer, bytes) ? CB_ERR : CB_SUCCESS;
}
-cb_err_t tis_vendor_read(unsigned int addr, void *buffer, size_t bytes)
+enum cb_err tis_vendor_read(unsigned int addr, void *buffer, size_t bytes)
{
return cr50_i2c_read(addr & 0xff, buffer, bytes) ? CB_ERR : CB_SUCCESS;
}
diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c
index 53b3a25..43fd933 100644
--- a/src/drivers/spi/tpm/tpm.c
+++ b/src/drivers/spi/tpm/tpm.c
@@ -728,12 +728,12 @@
return payload_size;
}
-cb_err_t tis_vendor_write(unsigned int addr, const void *buffer, size_t bytes)
+enum cb_err tis_vendor_write(unsigned int addr, const void *buffer, size_t bytes)
{
return tpm2_write_reg(addr, buffer, bytes);
}
-cb_err_t tis_vendor_read(unsigned int addr, void *buffer, size_t bytes)
+enum cb_err tis_vendor_read(unsigned int addr, void *buffer, size_t bytes)
{
return tpm2_read_reg(addr, buffer, bytes);
}
diff --git a/src/drivers/tpm/cr50.c b/src/drivers/tpm/cr50.c
index 4b5e813..f96e174 100644
--- a/src/drivers/tpm/cr50.c
+++ b/src/drivers/tpm/cr50.c
@@ -79,7 +79,7 @@
if (!cr50_fw_supports_board_cfg(&cr50_firmware_version))
return 0;
- const cb_err_t ret = tis_vendor_read(get_reg_addr(CR50_BOARD_CFG_REG), &value,
+ const enum cb_err ret = tis_vendor_read(get_reg_addr(CR50_BOARD_CFG_REG), &value,
sizeof(value));
if (ret != CB_SUCCESS) {
printk(BIOS_INFO, "Error reading from cr50\n");
@@ -92,10 +92,10 @@
/**
* Set the BOARD_CFG register on the TPM chip to a particular compile-time constant value.
*/
-cb_err_t cr50_set_board_cfg(void)
+enum cb_err cr50_set_board_cfg(void)
{
uint32_t value;
- cb_err_t ret;
+ enum cb_err ret;
if (!cr50_fw_supports_board_cfg(&cr50_firmware_version))
return CB_ERR;
@@ -139,7 +139,7 @@
return !!(cr50_get_board_cfg() & CR50_BOARD_CFG_100US_READY_PULSE);
}
-static cb_err_t cr50_parse_fw_version(const char *version_str,
+static enum cb_err cr50_parse_fw_version(const char *version_str,
struct cr50_firmware_version *ver)
{
int epoch, major, minor;
@@ -165,7 +165,7 @@
return CB_SUCCESS;
}
-cb_err_t cr50_get_firmware_version(struct cr50_firmware_version *version)
+enum cb_err cr50_get_firmware_version(struct cr50_firmware_version *version)
{
if (cr50_firmware_version.epoch || cr50_firmware_version.major ||
cr50_firmware_version.minor)
diff --git a/src/drivers/tpm/cr50.h b/src/drivers/tpm/cr50.h
index 4fdd06b..f754e13 100644
--- a/src/drivers/tpm/cr50.h
+++ b/src/drivers/tpm/cr50.h
@@ -16,9 +16,9 @@
bool cr50_is_long_interrupt_pulse_enabled(void);
/* Get the Cr50 firmware version information. */
-cb_err_t cr50_get_firmware_version(struct cr50_firmware_version *version);
+enum cb_err cr50_get_firmware_version(struct cr50_firmware_version *version);
/* Set the BOARD_CFG register depending on Cr50 Kconfigs */
-cb_err_t cr50_set_board_cfg(void);
+enum cb_err cr50_set_board_cfg(void);
#endif /* __DRIVERS_TPM_CR50_H__ */
diff --git a/src/security/tpm/tis.h b/src/security/tpm/tis.h
index 0ef5a8a..660ec81 100644
--- a/src/security/tpm/tis.h
+++ b/src/security/tpm/tis.h
@@ -96,7 +96,7 @@
*
* 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);
+enum cb_err tis_vendor_write(unsigned int addr, const void *sendbuf, size_t send_size);
/*
* tis_vendor_read()
@@ -109,7 +109,7 @@
*
* Returns CB_SUCCESS on success or -1 on failure.
*/
-cb_err_t tis_vendor_read(unsigned int addr, void *recvbuf, size_t recv_size);
+enum cb_err tis_vendor_read(unsigned int addr, void *recvbuf, size_t recv_size);
static inline bool tpm_first_access_this_boot(void)
{