arch/x86/acpi: Add TPM2 table support
* Distinguish between TPM 1.2 and 2.0 ACPI table support * Add TPM2 table support for TIS interface only Change-Id: I030c7ea744bcfe61ebef8d66d1295273b5dccda5 Signed-off-by: Philipp Deppenwiese <zaolin@das-labor.org> Reviewed-on: https://review.coreboot.org/29181 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
parent
3c37b5a682
commit
296164e0fe
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue