[coreboot-gerrit] Change in coreboot[master]: Fizz: Continue booting with EC in RW for EC-EFS

Daisuke Nojiri (Code Review) gerrit at coreboot.org
Wed Sep 27 00:08:30 CEST 2017


Daisuke Nojiri has uploaded this change for review. ( https://review.coreboot.org/21711


Change subject: Fizz: Continue booting with EC in RW for EC-EFS
......................................................................

Fizz: Continue booting with EC in RW for EC-EFS

If EC does EFS, it jumps to RW in all cases except when recovery
is requested manually. This patch makes Coreboot on EC-EFS systems
check whether EC is running in RO or not only when recovery is
requested manually.

BUG=b:66516882
BRANCH=none
TEST=Boot Fizz.

Change-Id: I45a874b73c46ea88cb831485757d194faa9f4c99
Signed-off-by: Daisuke Nojiri <dnojiri at chromium.org>
---
M src/ec/google/chromeec/ec.c
M src/vboot/bootmode.c
M src/vboot/vboot_common.h
3 files changed, 17 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/21711/1

diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 03d4c3b..1783281 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -668,6 +668,15 @@
 
 static int ec_image_type; /* Cached EC image type (ro or rw). */
 
+static
+int need_ec_in_ro(void)
+{
+	if (IS_ENABLED(CONFIG_VBOOT_EC_EFS))
+		return vboot_recovery_mode_enabled_manually();
+	else
+		return vboot_recovery_mode_enabled();
+}
+
 void google_chromeec_init(void)
 {
 	struct chromeec_command cec_cmd;
@@ -698,8 +707,7 @@
 	}
 
 	if (cec_cmd.cmd_code ||
-	    (vboot_recovery_mode_enabled() &&
-	     (cec_resp.current_image != EC_IMAGE_RO))) {
+	    (need_ec_in_ro() && (cec_resp.current_image != EC_IMAGE_RO))) {
 		/* Reboot the EC and make it come back in RO mode */
 		printk(BIOS_DEBUG, "Rebooting with EC in RO mode:\n");
 		post_code(0); /* clear current post code */
diff --git a/src/vboot/bootmode.c b/src/vboot/bootmode.c
index 1207448..23285dd 100644
--- a/src/vboot/bootmode.c
+++ b/src/vboot/bootmode.c
@@ -141,6 +141,11 @@
 	return !!vboot_check_recovery_request();
 }
 
+int vboot_recovery_mode_enabled_manually(void)
+{
+	return vboot_check_recovery_request() == VB2_RECOVERY_RO_MANUAL;
+}
+
 int __attribute__((weak)) clear_recovery_mode_switch(void)
 {
 	// Weak implementation. Nothing to do.
diff --git a/src/vboot/vboot_common.h b/src/vboot/vboot_common.h
index 8c92f7f..1636a5e 100644
--- a/src/vboot/vboot_common.h
+++ b/src/vboot/vboot_common.h
@@ -108,10 +108,12 @@
 #if IS_ENABLED(CONFIG_VBOOT)
 int vboot_developer_mode_enabled(void);
 int vboot_recovery_mode_enabled(void);
+int vboot_recovery_mode_enabled_manually(void);
 int vboot_recovery_mode_memory_retrain(void);
 #else /* !CONFIG_VBOOT */
 static inline int vboot_developer_mode_enabled(void) { return 0; }
 static inline int vboot_recovery_mode_enabled(void) { return 0; }
+static inline int vboot_recovery_mode_enabled_manually(void) { return 0; }
 static inline int vboot_recovery_mode_memory_retrain(void) { return 0; }
 #endif
 

-- 
To view, visit https://review.coreboot.org/21711
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45a874b73c46ea88cb831485757d194faa9f4c99
Gerrit-Change-Number: 21711
Gerrit-PatchSet: 1
Gerrit-Owner: Daisuke Nojiri <dnojiri at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170926/639b0ddf/attachment.html>


More information about the coreboot-gerrit mailing list