[coreboot-gerrit] Change in coreboot[master]: cr50: verify if the new image needs to be turned on and act ...
Vadim Bendebury (Code Review)
gerrit at coreboot.org
Thu Mar 23 00:20:12 CET 2017
Vadim Bendebury has uploaded a new change for review. ( https://review.coreboot.org/18946 )
Change subject: cr50: verify if the new image needs to be turned on and act on it
......................................................................
cr50: verify if the new image needs to be turned on and act on it
The AP sends the CR50 a request to turn on the new firmware image. If
the new cr50 image was indeed present, the AP expects the cr50 to
reset the device in 1 second.
BRANCH=gru,reef
BUG=b:35580805
TEST=built a reef image, observed that in case cr50 image is updated,
after the next reboot the AP stops booting before loading depthcharge,
reports upcoming reset and waits for it.
Change-Id: I45fd6058c03f32ff8edccd56ca2aa5359d9b21b1
Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
---
M src/vendorcode/google/chromeos/Makefile.inc
A src/vendorcode/google/chromeos/cr50_turn_on.c
2 files changed, 54 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/46/18946/1
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index af5e178..0dab527 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -38,6 +38,10 @@
CFLAGS_common += -DMOCK_TPM=0
endif
+ifneq ($(CONFIG_I2C_TPM_CR50)$(CONFIG_SPI_TPM_CR50),)
+ramstage-y += cr50_turn_on.c
+endif
+
CONFIG_GBB_HWID := $(call strip_quotes,$(CONFIG_GBB_HWID))
CONFIG_GBB_BMPFV_FILE := $(call strip_quotes,$(CONFIG_GBB_BMPFV_FILE))
CONFIG_VBOOT_KEYBLOCK := $(call strip_quotes,$(CONFIG_VBOOT_KEYBLOCK))
diff --git a/src/vendorcode/google/chromeos/cr50_turn_on.c b/src/vendorcode/google/chromeos/cr50_turn_on.c
new file mode 100644
index 0000000..4e450c8
--- /dev/null
+++ b/src/vendorcode/google/chromeos/cr50_turn_on.c
@@ -0,0 +1,50 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <bootstate.h>
+#include <console/console.h>
+#include <tpm_lite/tlcl.h>
+#include <vb2_api.h>
+
+static void turn_on_inactive_rw(void *unused)
+{
+ int ret;
+ uint8_t reset_pending;
+
+ ret = tlcl_lib_init();
+
+ if (ret != VB2_SUCCESS) {
+ printk(BIOS_ERR, "%s: tlcl_lib_init() failed: %x\n",
+ __func__, ret);
+ return;
+ }
+
+ /* Reboot in 1000 ms if necessary. */
+ ret = tlcl_cr50_turn_update_on(1000, &reset_pending);
+
+ if (ret != TPM_SUCCESS) {
+ printk(BIOS_ERR, "%s Attempt to turn update on failed: %x\n",
+ __func__, ret);
+ } else {
+ if (reset_pending) {
+ printk(BIOS_INFO, "%s: waiting for reset\n",
+ __func__);
+ while(1)
+ ;
+ }
+ }
+}
+BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, turn_on_inactive_rw, NULL);
+
--
To view, visit https://review.coreboot.org/18946
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45fd6058c03f32ff8edccd56ca2aa5359d9b21b1
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Vadim Bendebury <vbendeb at chromium.org>
More information about the coreboot-gerrit
mailing list