[PATCH u-boot v2019.04-aspeed-openbmc 4/4] ast2600: Measure the boot

Eddie James eajames at linux.ibm.com
Thu Jan 26 04:30:25 AEDT 2023


Add the configuration option for measured boot and add the
event log reserved memory to the device tree.

Signed-off-by: Eddie James <eajames at linux.ibm.com>
---
 arch/arm/dts/ast2600-p10bmc.dts            | 22 ++++++++++++++
 board/aspeed/ast2600_ibm/ibm.c             | 34 ----------------------
 configs/ast2600_openbmc_spl_emmc_defconfig |  1 +
 3 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/arch/arm/dts/ast2600-p10bmc.dts b/arch/arm/dts/ast2600-p10bmc.dts
index 1d0f88bf96..f6b5db5b50 100755
--- a/arch/arm/dts/ast2600-p10bmc.dts
+++ b/arch/arm/dts/ast2600-p10bmc.dts
@@ -13,6 +13,17 @@
 		reg = <0x80000000 0x40000000>;
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		event_log: tcg_event_log at b3d00000 {
+			no-map;
+			reg = <0xb3d00000 0x100000>;
+		};
+	};
+
 	chosen {
 		stdout-path = &uart5;
 	};
@@ -107,12 +118,23 @@
 	u-boot,dm-pre-reloc;
 };
 
+&i2c {
+	u-boot,dm-pre-reloc;
+};
+
+&i2cglobal {
+	u-boot,dm-pre-reloc;
+};
+
 &i2c12 {
+	u-boot,dm-pre-reloc;
 	status = "okay";
 
 	tpm at 2e {
+		u-boot,dm-pre-reloc;
 		compatible = "nuvoton,npct75x";
 		reg = <0x2e>;
+		memory-region = <&event_log>;
 	};
 };
 
diff --git a/board/aspeed/ast2600_ibm/ibm.c b/board/aspeed/ast2600_ibm/ibm.c
index 3782bbdee2..7e402932a5 100644
--- a/board/aspeed/ast2600_ibm/ibm.c
+++ b/board/aspeed/ast2600_ibm/ibm.c
@@ -3,41 +3,7 @@
  * Copyright 2022 IBM Corp.
  */
 
-#include <common.h>
-#include <dm/uclass.h>
-#include <tpm-common.h>
-#include <tpm-v2.h>
-
 int board_late_init(void)
 {
-	int rc;
-	struct udevice *dev;
-	/*
-	 * The digest is just an arbitrary sequence for now to ensure that the
-	 * TPM gets "poisoned."
-	 */
-	const unsigned char digest[32] = {
-		0x6e, 0x65, 0x76, 0x65, 0x72, 0x67, 0x6f, 0x6e,
-		0x6e, 0x61, 0x67, 0x69, 0x76, 0x65, 0x79, 0x6f,
-		0x75, 0x75, 0x70, 0x6e, 0x65, 0x76, 0x65, 0x72,
-		0x67, 0x6f, 0x6e, 0x6e, 0x61, 0x6c, 0x65, 0x74
-	};
-
-	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;
-
-	rc = tpm2_pcr_extend(dev, 0, digest);
-	if (!rc)
-		printf("TPM: PCR0 extended.\n");
-
 	return 0;
 }
diff --git a/configs/ast2600_openbmc_spl_emmc_defconfig b/configs/ast2600_openbmc_spl_emmc_defconfig
index cf2e937fe2..7d70521c0a 100644
--- a/configs/ast2600_openbmc_spl_emmc_defconfig
+++ b/configs/ast2600_openbmc_spl_emmc_defconfig
@@ -136,4 +136,5 @@ CONFIG_USE_TINY_PRINTF=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPM=y
 CONFIG_SPL_TPM=y
+CONFIG_MEASURED_BOOT=y
 # CONFIG_EFI_LOADER is not set
-- 
2.31.1



More information about the openbmc mailing list