summaryrefslogtreecommitdiff
path: root/src/arch/x86/acpi.c
diff options
context:
space:
mode:
authorMichał Żygowski <michal.zygowski@3mdeb.com>2018-11-22 16:57:50 +0100
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-11-23 12:56:44 +0000
commit6e8692e184e919c25feade059e30775798b640c2 (patch)
tree13efeab16393e22ee459d295fac1f350fcbd779c /src/arch/x86/acpi.c
parent6b522c31aa55f1e09b63843e183c0f6f298a5605 (diff)
src/arch/x86/acpi.c: Create log area and extend TPM2 table
According to newest TCG ACPI Specification for Family 1.2 and 2.0 Version 1.2, Revision 8, TPM2 ACPI table has two more fields LAML and LASA. Update the table structure definition, create the log area for TPM2 in coreboot tables and fill the missing fields in TPM2 table. TPM2 should be now probed well in SeaBIOS rel-1.12.0 or master. Tested on apu2 with Infineon SLB9665 TT2.0. Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com> Change-Id: Ie482cba0a3093aae996f7431251251f145fe64f3 Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/29800 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/arch/x86/acpi.c')
-rw-r--r--src/arch/x86/acpi.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c
index f54aa19271..3b33f1ba7f 100644
--- a/src/arch/x86/acpi.c
+++ b/src/arch/x86/acpi.c
@@ -308,12 +308,47 @@ static void acpi_create_tcpa(acpi_tcpa_t *tcpa)
header->checksum = acpi_checksum((void *)tcpa, header->length);
}
+static void *get_tpm2_log(u32 *size)
+{
+ const struct cbmem_entry *ce;
+ const u32 tpm2_default_log_len = 0x10000;
+ void *lasa;
+ ce = cbmem_entry_find(CBMEM_ID_TPM2_TCG_LOG);
+ if (ce) {
+ lasa = cbmem_entry_start(ce);
+ *size = cbmem_entry_size(ce);
+ printk(BIOS_DEBUG, "TPM2 log found at %p\n", lasa);
+ return lasa;
+ }
+ lasa = cbmem_add(CBMEM_ID_TPM2_TCG_LOG, tpm2_default_log_len);
+ if (!lasa) {
+ printk(BIOS_ERR, "TPM2 log creation failed\n");
+ return NULL;
+ }
+
+ printk(BIOS_DEBUG, "TPM2 log created at %p\n", lasa);
+ memset(lasa, 0, tpm2_default_log_len);
+
+ *size = tpm2_default_log_len;
+ return lasa;
+}
+
static void acpi_create_tpm2(acpi_tpm2_t *tpm2)
{
acpi_header_t *header = &(tpm2->header);
+ u32 tpm2_log_len;
+ void *lasa;
memset((void *)tpm2, 0, sizeof(acpi_tpm2_t));
+ /*
+ * Some payloads like SeaBIOS depend on log area to use TPM2.
+ * Get the memory size and address of TPM2 log area or initialize it.
+ */
+ lasa = get_tpm2_log(&tpm2_log_len);
+ if (!lasa)
+ tpm2_log_len = 0;
+
/* Fill out header fields. */
memcpy(header->signature, "TPM2", 4);
memcpy(header->oem_id, OEM_ID, 6);
@@ -331,6 +366,10 @@ static void acpi_create_tpm2(acpi_tpm2_t *tpm2)
tpm2->start_method = 6;
memset(tpm2->msp, 0, sizeof(tpm2->msp));
+ /* Fill the log area size and start address fields. */
+ tpm2->laml = tpm2_log_len;
+ tpm2->lasa = (uintptr_t) lasa;
+
/* Calculate checksum. */
header->checksum = acpi_checksum((void *)tpm2, header->length);
}