summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/acpi.c57
-rw-r--r--src/arch/x86/include/arch/acpi.h9
2 files changed, 59 insertions, 7 deletions
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c
index 1b430041f7..24db7c085d 100644
--- a/src/arch/x86/acpi.c
+++ b/src/arch/x86/acpi.c
@@ -308,6 +308,33 @@ static void acpi_create_tcpa(acpi_tcpa_t *tcpa)
header->checksum = acpi_checksum((void *)tcpa, header->length);
}
+static void acpi_create_tpm2(acpi_tpm2_t *tpm2)
+{
+ acpi_header_t *header = &(tpm2->header);
+
+ memset((void *)tpm2, 0, sizeof(acpi_tpm2_t));
+
+ /* Fill out header fields. */
+ memcpy(header->signature, "TPM2", 4);
+ memcpy(header->oem_id, OEM_ID, 6);
+ memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+ memcpy(header->asl_compiler_id, ASLC, 4);
+
+ header->length = sizeof(acpi_tpm2_t);
+ header->revision = get_acpi_table_revision(TPM2);
+
+ /* Hard to detect for coreboot. Just set it to 0 */
+ tpm2->platform_class = 0;
+ /* Must be set to 0 for TIS interface support */
+ tpm2->control_area = 0;
+ /* coreboot only supports the TIS interface driver. */
+ tpm2->start_method = 6;
+ memset(tpm2->msp, 0, sizeof(tpm2->msp));
+
+ /* Calculate checksum. */
+ header->checksum = acpi_checksum((void *)tpm2, header->length);
+}
+
static void acpi_ssdt_write_cbtable(void)
{
const struct cbmem_entry *cbtable;
@@ -1030,6 +1057,7 @@ unsigned long write_acpi_tables(unsigned long start)
acpi_header_t *dsdt_file, *dsdt;
acpi_mcfg_t *mcfg;
acpi_tcpa_t *tcpa;
+ acpi_tpm2_t *tpm2;
acpi_madt_t *madt;
struct device *dev;
unsigned long fw;
@@ -1163,13 +1191,26 @@ unsigned long write_acpi_tables(unsigned long start)
acpi_add_table(rsdp, mcfg);
}
- printk(BIOS_DEBUG, "ACPI: * TCPA\n");
- tcpa = (acpi_tcpa_t *) current;
- acpi_create_tcpa(tcpa);
- if (tcpa->header.length >= sizeof(acpi_tcpa_t)) {
- current += tcpa->header.length;
- current = acpi_align_current(current);
- acpi_add_table(rsdp, tcpa);
+ if (IS_ENABLED(CONFIG_TPM1)) {
+ printk(BIOS_DEBUG, "ACPI: * TCPA\n");
+ tcpa = (acpi_tcpa_t *) current;
+ acpi_create_tcpa(tcpa);
+ if (tcpa->header.length >= sizeof(acpi_tcpa_t)) {
+ current += tcpa->header.length;
+ current = acpi_align_current(current);
+ acpi_add_table(rsdp, tcpa);
+ }
+ }
+
+ if (IS_ENABLED(CONFIG_TPM2)) {
+ printk(BIOS_DEBUG, "ACPI: * TPM2\n");
+ tpm2 = (acpi_tpm2_t *) current;
+ acpi_create_tpm2(tpm2);
+ if (tpm2->header.length >= sizeof(acpi_tpm2_t)) {
+ current += tpm2->header.length;
+ current = acpi_align_current(current);
+ acpi_add_table(rsdp, tpm2);
+ }
}
printk(BIOS_DEBUG, "ACPI: * MADT\n");
@@ -1288,6 +1329,8 @@ int get_acpi_table_revision(enum acpi_tables table)
return 1;
case TCPA:
return 2;
+ case TPM2:
+ return 4;
case SSDT: /* ACPI 1.0/2.0: ?, ACPI 3.0/4.0: 2 */
return 2;
case SRAT: /* ACPI 1.0: N/A, 2.0: 1, 3.0: 2, 4.0: 3 */
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index 54be1f40b7..b5205c018e 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -191,6 +191,15 @@ typedef struct acpi_tcpa {
u64 lasa;
} __packed acpi_tcpa_t;
+typedef struct acpi_tpm2 {
+ struct acpi_table_header header;
+ u16 platform_class;
+ u8 reserved[2];
+ u64 control_area;
+ u32 start_method;
+ u8 msp[12];
+} __packed acpi_tpm2_t;
+
typedef struct acpi_mcfg_mmconfig {
u32 base_address;
u32 base_reserved;