Attention is currently required from: Cliff Huang, Lance Zhao, Tim Wawrzynczak.
Sergii Dmytruk has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81860?usp=email )
Change subject: drivers/crb: use crb_tpm_ prefix instead of tpm2_ ......................................................................
drivers/crb: use crb_tpm_ prefix instead of tpm2_
This prevents name clashes with drivers/spi/tpm and allows both to be potentially compiled in at the same time.
Change-Id: I0aa2686103546e0696ab8dcf77e2b99bf9734915 Signed-off-by: Sergii Dmytruk sergii.dmytruk@3mdeb.com --- M src/acpi/acpi.c M src/drivers/crb/tis.c M src/drivers/crb/tpm.c M src/drivers/crb/tpm.h 4 files changed, 27 insertions(+), 27 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/81860/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index c33d195..39eadc3 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -273,7 +273,7 @@
/* Hard to detect for coreboot. Just set it to 0 */ tpm2->platform_class = 0; - if (CONFIG(CRB_TPM) && tpm2_has_crb_active()) { + if (CONFIG(CRB_TPM) && crb_tpm_is_active()) { /* Must be set to 7 for CRB Support */ tpm2->control_area = CONFIG_CRB_TPM_BASE_ADDRESS + 0x40; tpm2->start_method = 7; diff --git a/src/drivers/crb/tis.c b/src/drivers/crb/tis.c index 04e255a..1b398f7 100644 --- a/src/drivers/crb/tis.c +++ b/src/drivers/crb/tis.c @@ -23,7 +23,7 @@ {0xa13a, 0x8086, "Intel iTPM"} };
-static const char *tis_get_dev_name(struct tpm2_info *info) +static const char *tis_get_dev_name(struct crb_tpm_info *info) { int i;
@@ -36,7 +36,7 @@ static tpm_result_t crb_tpm_sendrecv(const uint8_t *sendbuf, size_t sbuf_size, uint8_t *recvbuf, size_t *rbuf_len) { - int len = tpm2_process_command(sendbuf, sbuf_size, recvbuf, *rbuf_len); + int len = crb_tpm_process_command(sendbuf, sbuf_size, recvbuf, *rbuf_len);
if (len == 0) return TPM_CB_FAIL; @@ -48,17 +48,17 @@
tis_sendrecv_fn tis_probe(enum tpm_family *family) { - struct tpm2_info info; + struct crb_tpm_info info;
/* Wake TPM up (if necessary) */ - if (tpm2_init()) + if (crb_tpm_init()) return NULL;
/* CRB interface exists only in TPM2 */ if (family != NULL) *family = TPM_2;
- tpm2_get_info(&info); + crb_tpm_get_info(&info);
printk(BIOS_INFO, "Initialized TPM device %s revision %d\n", tis_get_dev_name(&info), info.revision); @@ -137,7 +137,7 @@
static int smbios_write_type43_tpm(struct device *dev, int *handle, unsigned long *current) { - struct tpm2_info info; + struct crb_tpm_info info; uint32_t tpm_manuf, tpm_family; uint32_t fw_ver1, fw_ver2; uint8_t major_spec_ver, minor_spec_ver; @@ -145,7 +145,7 @@ if (tlcl_get_family() == TPM_1) return 0;
- tpm2_get_info(&info); + crb_tpm_get_info(&info);
/* If any of these have invalid values, assume TPM not present or disabled */ if (info.vendor_id == 0 || info.vendor_id == 0xFFFF || diff --git a/src/drivers/crb/tpm.c b/src/drivers/crb/tpm.c index b568dcc..ea5e701 100644 --- a/src/drivers/crb/tpm.c +++ b/src/drivers/crb/tpm.c @@ -54,7 +54,7 @@ * register before each command submission otherwise the control area * is all zeroed. This has been observed on Alder Lake S CPU and may be * applicable to other new microarchitectures. Update the local control - * area data to make tpm2_process_command not fail on buffer checks. + * area data to make crb_tpm_process_command() not fail on buffer checks. * PTT command/response buffer is fixed to be at offset 0x80 and spans * up to the end of 4KB region for the current locality. */ @@ -181,14 +181,14 @@ }
/* - * tpm2_init + * crb_tpm_init * * Even though the TPM does not need an initialization we check * if the TPM responds and is in IDLE mode, which should be the * normal bring up mode. * */ -tpm_result_t tpm2_init(void) +tpm_result_t crb_tpm_init(void) { tpm_result_t rc = crb_probe(); if (rc) { @@ -227,10 +227,10 @@ }
/* - * tpm2_process_command + * crb_tpm_process_command */ -size_t tpm2_process_command(const void *tpm2_command, size_t command_size, void *tpm2_response, - size_t max_response) +size_t crb_tpm_process_command(const void *tpm2_command, size_t command_size, + void *tpm2_response, size_t max_response) { tpm_result_t rc;
@@ -312,24 +312,24 @@ * Returns information about the TPM * */ -void tpm2_get_info(struct tpm2_info *tpm2_info) +void crb_tpm_get_info(struct crb_tpm_info *crb_tpm_info) { uint64_t interfaceReg = read64(CRB_REG(cur_loc, CRB_REG_INTF_ID));
- tpm2_info->vendor_id = (interfaceReg >> 48) & 0xFFFF; - tpm2_info->device_id = (interfaceReg >> 32) & 0xFFFF; - tpm2_info->revision = (interfaceReg >> 24) & 0xFF; + crb_tpm_info->vendor_id = (interfaceReg >> 48) & 0xFFFF; + crb_tpm_info->device_id = (interfaceReg >> 32) & 0xFFFF; + crb_tpm_info->revision = (interfaceReg >> 24) & 0xFF; }
/* - * tpm2_has_crb_active + * crb_tpm_is_active * * Checks that CRB interface is available and active. * * The body was derived from crb_probe() which unlike this function can also * write to registers. */ -bool tpm2_has_crb_active(void) +bool crb_tpm_is_active(void) { uint64_t tpmStatus = read64(CRB_REG(0, CRB_REG_INTF_ID)); printk(BIOS_SPEW, "Interface ID Reg. %llx\n", tpmStatus); diff --git a/src/drivers/crb/tpm.h b/src/drivers/crb/tpm.h index 60020c3..fbe3901 100644 --- a/src/drivers/crb/tpm.h +++ b/src/drivers/crb/tpm.h @@ -53,15 +53,15 @@ /* START Register related */ #define CRB_REG_START_START 0x01
-/* TPM Info Struct */ -struct tpm2_info { +/* CRB TPM Info Struct */ +struct crb_tpm_info { uint16_t vendor_id; uint16_t device_id; uint16_t revision; };
-tpm_result_t tpm2_init(void); -void tpm2_get_info(struct tpm2_info *tpm2_info); -size_t tpm2_process_command(const void *tpm2_command, size_t command_size, - void *tpm2_response, size_t max_response); -bool tpm2_has_crb_active(void); +tpm_result_t crb_tpm_init(void); +void crb_tpm_get_info(struct crb_tpm_info *crb_tpm_info); +size_t crb_tpm_process_command(const void *tpm2_command, size_t command_size, + void *tpm2_response, size_t max_response); +bool crb_tpm_is_active(void);