From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Cc: Eddie James <eajames@linux.ibm.com>, joel@jms.id.au
Subject: [PATCH u-boot v2019.04-aspeed-openbmc 5/5] aspeed: Add board_late_init to write TPM
Date: Thu, 5 May 2022 15:28:29 -0500 [thread overview]
Message-ID: <20220505202829.31466-6-eajames@linux.ibm.com> (raw)
In-Reply-To: <20220505202829.31466-1-eajames@linux.ibm.com>
If there is a TPM in the devicetree, use board_late_init to
extend PCR0 with some invalid digest. The purpose of this is to
prevent later undesired usage of the TPM.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
board/aspeed/evb_ast2600/evb_ast2600.c | 34 ++++++++++++++++++++++
configs/ast2600_openbmc_spl_emmc_defconfig | 1 +
2 files changed, 35 insertions(+)
diff --git a/board/aspeed/evb_ast2600/evb_ast2600.c b/board/aspeed/evb_ast2600/evb_ast2600.c
index 72ecb18c15..e11fc6973d 100644
--- a/board/aspeed/evb_ast2600/evb_ast2600.c
+++ b/board/aspeed/evb_ast2600/evb_ast2600.c
@@ -3,6 +3,11 @@
* Copyright (C) ASPEED Technology Inc.
*/
#include <common.h>
+#if defined(CONFIG_TPM_V2)
+#include <dm/uclass.h>
+#include <tpm-common.h>
+#include <tpm-v2.h>
+#endif
#include <asm/io.h>
#define SCU_BASE 0x1e6e2000
@@ -122,6 +127,35 @@ static void __maybe_unused espi_init(void)
writel(reg, ESPI_BASE + 0x000);
}
+__weak int board_late_init(void)
+{
+#if defined(CONFIG_TPM_V2)
+ int rc;
+ struct udevice *dev;
+ unsigned char digest[32] = {
+ 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x01,
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
+ 0xa0, 0xb1, 0xc2, 0xd3, 0xe4, 0xf5, 0x06, 0x17,
+ 0x28, 0x39, 0x4a, 0x5b, 0x6c, 0x7d, 0x8e, 0x9f
+ };
+
+ rc = uclass_first_device_err(UCLASS_TPM, &dev);
+ if (rc)
+ return 0;
+
+ rc = tpm_init(dev);
+ if (rc)
+ return 0;
+
+ rc = tpm2_startup(dev, TPM2_SU_CLEAR);
+ if (rc)
+ return 0;
+
+ tpm2_pcr_extend(dev, 0, digest);
+#endif
+ return 0;
+}
+
int board_early_init_f(void)
{
#if 0
diff --git a/configs/ast2600_openbmc_spl_emmc_defconfig b/configs/ast2600_openbmc_spl_emmc_defconfig
index 3bb44280c7..b506bc5e55 100644
--- a/configs/ast2600_openbmc_spl_emmc_defconfig
+++ b/configs/ast2600_openbmc_spl_emmc_defconfig
@@ -39,6 +39,7 @@ CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_ARCH_EARLY_INIT_R=y
CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_LATE_INIT=y
CONFIG_SPL_BOARD_INIT=y
# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
--
2.27.0
next prev parent reply other threads:[~2022-05-05 20:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 20:28 [PATCH u-boot v2019.04-aspeed-openbmc 0/5] ast2600: Add I2C TPMv2 driver Eddie James
2022-05-05 20:28 ` [PATCH u-boot v2019.04-aspeed-openbmc 1/5] i2c: ast_i2c: Remove SCL direct drive mode Eddie James
2022-05-10 2:29 ` Joel Stanley
2022-05-05 20:28 ` [PATCH u-boot v2019.04-aspeed-openbmc 2/5] tpm: Add I2C driver for TPMv2 devices Eddie James
2022-05-10 2:42 ` Joel Stanley
2022-05-11 20:10 ` Eddie James
2022-05-05 20:28 ` [PATCH u-boot v2019.04-aspeed-openbmc 3/5] arm: dts: ast2600-rainier: Add NPCT75X TPM Eddie James
2022-05-10 2:44 ` Joel Stanley
2022-05-05 20:28 ` [PATCH u-boot v2019.04-aspeed-openbmc 4/5] configs: ast2600_openbmc_spl_emmc: Enable TPMv2 over I2C Eddie James
2022-05-05 20:28 ` Eddie James [this message]
2022-05-10 2:44 ` [PATCH u-boot v2019.04-aspeed-openbmc 5/5] aspeed: Add board_late_init to write TPM Joel Stanley
2022-05-11 20:13 ` Eddie James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220505202829.31466-6-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.