summaryrefslogtreecommitdiff
path: root/src/acpi/acpi.c
diff options
context:
space:
mode:
authorSergii Dmytruk <sergii.dmytruk@3mdeb.com>2022-11-02 00:50:03 +0200
committerMartin L Roth <gaumless@gmail.com>2024-03-28 15:18:04 +0000
commit47e9e8cde1810ee9f249027b14ee9f82a7a52d84 (patch)
tree77771e49f8121bebb1b5904940ff7abf2714dccb /src/acpi/acpi.c
parent094a051732341d20e82c349ea10f85faea6e58d1 (diff)
security/tpm: replace CONFIG(TPMx) checks with runtime check
This prepares the code for enabling both CONFIG_TPM1 and CONFIG_TPM2 during compilation, in which case actual TPM family in use can be determined at runtime. In some places both compile-time and runtime checks are necessary. Yet in places like probe functions runtime state checks don't make sense as runtime state is defined by results of probing. Change-Id: Id9cc25aad8d1d7bfad12b7a92059b1b3641bbfa9 Ticket: https://ticket.coreboot.org/issues/433 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69161 Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/acpi/acpi.c')
-rw-r--r--src/acpi/acpi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index 98c8ecdc13..30a07bfda0 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -25,7 +25,9 @@
#include <device/device.h>
#include <device/mmio.h>
#include <device/pci.h>
+#include <drivers/crb/tpm.h>
#include <drivers/uart/pl011.h>
+#include <security/tpm/tss.h>
#include <string.h>
#include <types.h>
#include <version.h>
@@ -205,7 +207,7 @@ static void *get_tcpa_log(u32 *size)
static void acpi_create_tcpa(acpi_header_t *header, void *unused)
{
- if (!CONFIG(TPM1))
+ if (tlcl_get_family() != TPM_1)
return;
acpi_tcpa_t *tcpa = (acpi_tcpa_t *)header;
@@ -251,7 +253,7 @@ static void *get_tpm2_log(u32 *size)
static void acpi_create_tpm2(acpi_header_t *header, void *unused)
{
- if (!CONFIG(TPM2))
+ if (tlcl_get_family() != TPM_2)
return;
acpi_tpm2_t *tpm2 = (acpi_tpm2_t *)header;
@@ -271,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)) {
+ if (CONFIG(CRB_TPM) && tpm2_has_crb_active()) {
/* Must be set to 7 for CRB Support */
tpm2->control_area = CONFIG_CRB_TPM_BASE_ADDRESS + 0x40;
tpm2->start_method = 7;