diff options
author | Sergii Dmytruk <sergii.dmytruk@3mdeb.com> | 2024-04-12 15:47:04 +0300 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-04-15 13:35:00 +0000 |
commit | 1a90314ac5123aa5d4d612831807dea2ed76a6d1 (patch) | |
tree | 429352dc1ba1d4522dbec0d6232e8cb62694aa1a | |
parent | 45145ba805a83d89de8888b7dc9f06db0a636b06 (diff) |
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81860
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | src/acpi/acpi.c | 2 | ||||
-rw-r--r-- | src/drivers/crb/tis.c | 14 | ||||
-rw-r--r-- | src/drivers/crb/tpm.c | 24 | ||||
-rw-r--r-- | src/drivers/crb/tpm.h | 14 |
4 files changed, 27 insertions, 27 deletions
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index c33d195515..39eadc3a7f 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -273,7 +273,7 @@ static void acpi_create_tpm2(acpi_header_t *header, void *unused) /* 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 04e255aa7f..1b398f74f4 100644 --- a/src/drivers/crb/tis.c +++ b/src/drivers/crb/tis.c @@ -23,7 +23,7 @@ static const struct { {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 const char *tis_get_dev_name(struct tpm2_info *info) 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 @@ static tpm_result_t crb_tpm_sendrecv(const uint8_t *sendbuf, size_t sbuf_size, u 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 tpm_result_t tpm_get_cap(uint32_t property, uint32_t *value) 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 @@ static int smbios_write_type43_tpm(struct device *dev, int *handle, unsigned lon 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 b568dcc7f4..ea5e7017fc 100644 --- a/src/drivers/crb/tpm.c +++ b/src/drivers/crb/tpm.c @@ -54,7 +54,7 @@ static void crb_readControlArea(void) * 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 @@ static tpm_result_t crb_switch_to_ready(void) } /* - * 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 @@ static void set_ptt_cmd_resp_buffers(void) } /* - * 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 @@ size_t tpm2_process_command(const void *tpm2_command, size_t command_size, void * 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 60020c3ff9..fbe390167d 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); |