[coreboot-gerrit] Patch set updated for coreboot: 9334a93 Add TCPA table.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Thu May 21 09:11:08 CEST 2015


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10274

-gerrit

commit 9334a933c480ab46d7ab50788d0ede235946d49e
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Wed May 20 19:52:01 2015 +0200

    Add TCPA table.
    
    This allows SeaBIOS to fill it as necessarry.
    This is the last step to make BitLocker work.
    
    Change-Id: I35858cd31a90c799ee1a240547c4b4a80fa13dd8
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/arch/x86/boot/acpi.c         | 54 ++++++++++++++++++++++++++++++++++++++++
 src/arch/x86/include/arch/acpi.h |  7 ++++++
 src/include/cbmem.h              |  1 +
 3 files changed, 62 insertions(+)

diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index b2e0df3..ad1927c 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -249,6 +249,50 @@ void acpi_create_mcfg(acpi_mcfg_t *mcfg)
 	header->checksum = acpi_checksum((void *)mcfg, header->length);
 }
 
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+
+static void acpi_create_tcpa(acpi_tcpa_t *tcpa)
+{
+	acpi_header_t *header = &(tcpa->header);
+	const u32 tcpa_log_len = 0x10000;
+	void *lasa;
+
+	memset((void *)tcpa, 0, sizeof(acpi_tcpa_t));
+
+	lasa = cbmem_find(CBMEM_ID_TCPA_LOG);
+	if (!lasa) {
+		lasa = cbmem_add(CBMEM_ID_TCPA_LOG, tcpa_log_len);
+
+		if (!lasa) {
+			printk(BIOS_DEBUG, "TCPA log creation failed\n");
+			return;
+		}
+
+		printk(BIOS_DEBUG, "TCPA log created at %p\n", lasa);
+		memset (lasa, 0, tcpa_log_len);
+	} else {
+		printk(BIOS_DEBUG, "TCPA log found at %p\n", lasa);
+	}
+
+	/* Fill out header fields. */
+	memcpy(header->signature, "TCPA", 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_tcpa_t);
+	header->revision = 2;
+
+	tcpa->platform_class = 0;
+	tcpa->laml = tcpa_log_len;
+	tcpa->lasa = (u32) lasa;
+
+	/* Calculate checksum. */
+	header->checksum = acpi_checksum((void *)tcpa, header->length);
+}
+
+#endif
+
 #if !IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
 /*
  * This can be overridden by platform ACPI setup code, if it calls
@@ -710,6 +754,7 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_header_t *ssdt;
 	acpi_header_t *dsdt;
 	acpi_mcfg_t *mcfg;
+	acpi_tcpa_t *tcpa;
 	acpi_madt_t *madt;
 	struct device *dev;
 	unsigned long fw;
@@ -808,6 +853,15 @@ 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;
+		ALIGN_CURRENT;
+		acpi_add_table(rsdp, tcpa);
+	}
+
 	printk(BIOS_DEBUG, "ACPI:    * MADT\n");
 
 	madt = (acpi_madt_t *) current;
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index 588de93..938b663 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -129,6 +129,13 @@ typedef struct acpi_mcfg {
 	u8 reserved[8];
 } __attribute__ ((packed)) acpi_mcfg_t;
 
+typedef struct acpi_tcpa {
+	struct acpi_table_header header;
+	u16 platform_class;
+	u32 laml;
+	u64 lasa;
+} __attribute__ ((packed)) acpi_tcpa_t;
+
 typedef struct acpi_mcfg_mmconfig {
 	u32 base_address;
 	u32 base_reserved;
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 08c1d64..94a4e82 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -86,6 +86,7 @@
 #define CBMEM_ID_VBOOT_HANDOFF	0x780074f0
 #define CBMEM_ID_VBOOT_WORKBUF	0x78007343
 #define CBMEM_ID_WIFI_CALIBRATION 0x57494649
+#define CBMEM_ID_TCPA_LOG       0x54435041
 
 #ifndef __ASSEMBLER__
 #include <stddef.h>



More information about the coreboot-gerrit mailing list