[PATCH 2/2] tpm: get tpm event log from bloblist

Raymond Mao raymond.mao at linaro.org
Fri Dec 13 23:55:40 CET 2024


Get tpm event log from bloblist instead of FDT when bloblist is
enabled and valid from previous boot stage.

Note:
This patch depends on:
[PATCH 1/2] bloblist: Introduce BLOBLIST_PRIOR_STAGE options
https://lore.kernel.org/u-boot/20241212151142.1562825-1-trini@konsulko.com/

Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
---
 lib/tpm_tcg2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/tpm_tcg2.c b/lib/tpm_tcg2.c
index 7f868cc883..acaf0acb88 100644
--- a/lib/tpm_tcg2.c
+++ b/lib/tpm_tcg2.c
@@ -19,6 +19,7 @@
 #include <linux/unaligned/generic.h>
 #include <linux/unaligned/le_byteshift.h>
 #include "tpm-utils.h"
+#include <bloblist.h>
 
 int tcg2_get_pcr_info(struct udevice *dev, u32 *supported_pcr, u32 *active_pcr,
 		      u32 *pcr_banks)
@@ -672,6 +673,12 @@ __weak int tcg2_platform_get_log(struct udevice *dev, void **addr, u32 *size)
 	*addr = NULL;
 	*size = 0;
 
+	if (CONFIG_IS_ENABLED(BLOBLIST_PRIOR_STAGE) && !bloblist_maybe_init()) {
+		*addr = bloblist_get_blob(BLOBLISTT_TPM_EVLOG, size);
+		if (*addr && *size)
+			return 0;
+	}
+
 	addr_prop = dev_read_prop(dev, "tpm_event_log_addr", &asize);
 	if (!addr_prop)
 		addr_prop = dev_read_prop(dev, "linux,sml-base", &asize);
-- 
2.25.1



More information about the U-Boot mailing list