heads/patches/coreboot-4.7/0001-intel-fsp-Fix-TPM-initialization-when-vboot-is-disab.patch
Youness Alaoui 8bf187b50a
Add patches to coreboot to support Librem 13 v2 with TPM
Add a new series of patches which add measurement support for skylake,
add IOMMU for skylake, fix TPM support, and add support for TPM for
the Librem 13v2 and Librem 15v3 hardware.
2018-03-14 16:27:25 -04:00

73 lines
2.6 KiB
Diff

From feb246c6e8a87c1223c84b4b74f976d23506bb96 Mon Sep 17 00:00:00 2001
From: Youness Alaoui <youness.alaoui@puri.sm>
Date: Wed, 7 Feb 2018 11:49:35 -0500
Subject: [PATCH 1/9] intel/fsp: Fix TPM initialization when vboot is disabled
A change introduced by commit fe4983e5 [1] in order to prevent
re-initialization of the TPM if already setup in verstage
had the wrong logic in the if statement, causing the TPM
to never be initialized if vboot is disabled.
The RESUME_PATH_SAME_AS_BOOT config is enabled by default for
ARCH_X86 and therefore the if statement would be false. The
behavior that was intended was probably meant to use an OR
instead of an AND.
This patch also enabled TPM initialization for FSP 2.0.
[1] https://review.coreboot.org/#/c/coreboot/+/14106/
Change-Id: Ic43d1aa31a296386c7eab6d997f9b701e9ea0fe5
Signed-off-by: Youness Alaoui <youness.alaoui@puri.sm>
---
src/drivers/intel/fsp1_1/romstage.c | 4 ++--
src/drivers/intel/fsp2_0/memory_init.c | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/drivers/intel/fsp1_1/romstage.c b/src/drivers/intel/fsp1_1/romstage.c
index 81939c4c33..76b4ad7c4d 100644
--- a/src/drivers/intel/fsp1_1/romstage.c
+++ b/src/drivers/intel/fsp1_1/romstage.c
@@ -172,8 +172,8 @@ void romstage_common(struct romstage_params *params)
* in verstage and used to verify romstage.
*/
if (IS_ENABLED(CONFIG_LPC_TPM) &&
- !IS_ENABLED(CONFIG_RESUME_PATH_SAME_AS_BOOT) &&
- !IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK))
+ (!IS_ENABLED(CONFIG_RESUME_PATH_SAME_AS_BOOT) ||
+ !IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)))
init_tpm(params->power_state->prev_sleep_state ==
ACPI_S3);
}
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c
index 368fafa5d7..575f277466 100644
--- a/src/drivers/intel/fsp2_0/memory_init.c
+++ b/src/drivers/intel/fsp2_0/memory_init.c
@@ -28,6 +28,7 @@
#include <program_loading.h>
#include <reset.h>
#include <romstage_handoff.h>
+#include <tpm.h>
#include <string.h>
#include <symbols.h>
#include <timestamp.h>
@@ -146,6 +147,15 @@ static void do_fsp_post_memory_init(bool s3wake, uint32_t fsp_version)
/* Create romstage handof information */
romstage_handoff_init(s3wake);
+
+ /*
+ * Initialize the TPM, unless the TPM was already initialized
+ * in verstage and used to verify romstage.
+ */
+ if (IS_ENABLED(CONFIG_LPC_TPM) &&
+ (!IS_ENABLED(CONFIG_RESUME_PATH_SAME_AS_BOOT) ||
+ !IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)))
+ init_tpm(s3wake);
}
static int mrc_cache_verify_tpm_hash(const uint8_t *data, size_t size)
--
2.14.3