summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-08-13 13:46:51 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-14 21:40:50 +0000
commita27cf95f95439f3af0d312d176b9f2d4d8a80da4 (patch)
tree267f4b652684dc613b6a75a47d6aeece37c8f7bc /common/system.c
parent968d1a154be811a6619f54c59003707998005aac (diff)
downloadchrome-ec-a27cf95f95439f3af0d312d176b9f2d4d8a80da4.tar.gz
System: Set stay-in-RO reset flag for sysjump and host command
With EFS2, the EC can jump itself straight from RO to RW without AP intervention. However, sometimes the AP or a developer may want the EC to remain on RO to perform operations there. In these cases, set the reset flag to say in RO. BRANCH=None BUG=b:161887378 TEST=on waddledee, run "sysjump ro/rw" while the AP is on and confirm the AP remains on. Run "flashrom -p ec -w /tmp/ec.bin" and confirm the operation completes successfully. Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I036bd04514858a55e4e52abfc05eb67896436505 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2354742 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/common/system.c b/common/system.c
index 38c824640e..4f308c6795 100644
--- a/common/system.c
+++ b/common/system.c
@@ -563,7 +563,8 @@ int system_is_in_rw(void)
return is_rw_image(system_get_image_copy());
}
-test_mockable int system_run_image_copy(enum ec_image copy)
+static int system_run_image_copy_with_flags(enum ec_image copy,
+ uint32_t add_reset_flags)
{
uintptr_t base;
uintptr_t init_addr;
@@ -616,6 +617,8 @@ test_mockable int system_run_image_copy(enum ec_image copy)
return EC_ERROR_UNKNOWN;
}
+ system_set_reset_flags(add_reset_flags);
+
CPRINTS("Jumping to image %s", ec_image_to_string(copy));
jump_to_image(init_addr);
@@ -624,6 +627,12 @@ test_mockable int system_run_image_copy(enum ec_image copy)
return EC_ERROR_UNKNOWN;
}
+test_mockable int system_run_image_copy(enum ec_image copy)
+{
+ /* No reset flags needed for most jumps */
+ return system_run_image_copy_with_flags(copy, 0);
+}
+
enum ec_image system_get_active_copy(void)
{
uint8_t slot;
@@ -868,7 +877,8 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
case EC_REBOOT_CANCEL:
return EC_SUCCESS;
case EC_REBOOT_JUMP_RO:
- return system_run_image_copy(EC_IMAGE_RO);
+ return system_run_image_copy_with_flags(EC_IMAGE_RO,
+ EC_RESET_FLAG_STAY_IN_RO);
case EC_REBOOT_JUMP_RW:
return system_run_image_copy(system_get_active_copy());
case EC_REBOOT_COLD:
@@ -1201,7 +1211,8 @@ static int command_sysjump(int argc, char **argv)
/* Handle named images */
if (!strcasecmp(argv[1], "RO"))
- return system_run_image_copy(EC_IMAGE_RO);
+ return system_run_image_copy_with_flags(EC_IMAGE_RO,
+ EC_RESET_FLAG_STAY_IN_RO);
else if (!strcasecmp(argv[1], "RW") || !strcasecmp(argv[1], "A"))
return system_run_image_copy(EC_IMAGE_RW);
else if (!strcasecmp(argv[1], "B")) {