aboutsummaryrefslogtreecommitdiff
path: root/src/tcgbios.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2017-11-14 15:03:47 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-11-15 13:17:20 -0500
commitdf46d10c8a7b88eb82f3ceb2aa31782dee15593d (patch)
tree910969b38c4bb88ff901c230baa4924c043e5f62 /src/tcgbios.c
parent0541f2f0f246e77d7c726926976920e8072d1119 (diff)
downloadseabios-hppa-df46d10c8a7b88eb82f3ceb2aa31782dee15593d.zip
seabios-hppa-df46d10c8a7b88eb82f3ceb2aa31782dee15593d.tar.gz
seabios-hppa-df46d10c8a7b88eb82f3ceb2aa31782dee15593d.tar.bz2
tpm: Add support for TPM2 ACPI table
Add support for the TPM2 ACPI table. If we find it and its of the appropriate size, we can get the log_area_start_address and log_area_minimum_size from it. The latest version of the spec can be found here: https://trustedcomputinggroup.org/tcg-acpi-specification/ Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Diffstat (limited to 'src/tcgbios.c')
-rw-r--r--src/tcgbios.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/src/tcgbios.c b/src/tcgbios.c
index bde1ef8..40b3028 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -48,15 +48,9 @@ struct {
u8 * log_area_last_entry;
} tpm_state VARLOW;
-static int
-tpm_tcpa_probe(void)
+static int tpm_set_log_area(u8 *log_area_start_address,
+ u32 log_area_minimum_length)
{
- struct tcpa_descriptor_rev2 *tcpa = find_acpi_table(TCPA_SIGNATURE);
- if (!tcpa)
- return -1;
-
- u8 *log_area_start_address = (u8*)(long)tcpa->log_area_start_address;
- u32 log_area_minimum_length = tcpa->log_area_minimum_length;
if (!log_area_start_address || !log_area_minimum_length)
return -1;
@@ -69,6 +63,39 @@ tpm_tcpa_probe(void)
return 0;
}
+static int
+tpm_tcpa_probe(void)
+{
+ struct tcpa_descriptor_rev2 *tcpa = find_acpi_table(TCPA_SIGNATURE);
+ if (!tcpa)
+ return -1;
+
+ dprintf(DEBUG_tcg, "TCGBIOS: TCPA: LASA = %p, LAML = %u\n",
+ (u8 *)(long)tcpa->log_area_start_address,
+ tcpa->log_area_minimum_length);
+
+ return tpm_set_log_area((u8*)(long)tcpa->log_area_start_address,
+ tcpa->log_area_minimum_length);
+}
+
+static int
+tpm_tpm2_probe(void)
+{
+ struct tpm2_descriptor_rev2 *tpm2 = find_acpi_table(TPM2_SIGNATURE);
+ if (!tpm2)
+ return -1;
+
+ if (tpm2->length < 76)
+ return -1;
+
+ dprintf(DEBUG_tcg, "TCGBIOS: TPM2: LASA = %p, LAML = %u\n",
+ (u8 *)(long)tpm2->log_area_start_address,
+ tpm2->log_area_minimum_length);
+
+ return tpm_set_log_area((u8*)(long)tpm2->log_area_start_address,
+ tpm2->log_area_minimum_length);
+}
+
/*
* Extend the ACPI log with the given entry by copying the
* entry data into the log.
@@ -949,9 +976,12 @@ tpm_setup(void)
"TCGBIOS: Detected a TPM %s.\n",
(TPM_version == TPM_VERSION_1_2) ? "1.2" : "2");
- int ret = tpm_tcpa_probe();
- if (ret)
- return;
+ int ret = tpm_tpm2_probe();
+ if (ret) {
+ ret = tpm_tcpa_probe();
+ if (ret)
+ return;
+ }
TPM_working = 1;