summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-03-20 09:40:00 -0700
committerRandall Spangler <rspangler@chromium.org>2012-03-20 09:43:46 -0700
commit41e3b582580e7b64fce0ba4379efed9fa54dbcfb (patch)
treec01b2dcf53b39e79a884bfccf0c6eb90b343861e
parent61748b4f04cd8d66c094a03bef0095c8c6a427dd (diff)
downloadchrome-ec-41e3b582580e7b64fce0ba4379efed9fa54dbcfb.tar.gz
Remove old scratchpad-based reboot-to-image interface
Now that we can jump directly to other images, we don't need this. We jump to image A by default, unless the recovery button or signal is asserted. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8562 TEST=manual Reboot -> runs image A Reboot with reload (F3) held down -> runs RO Reboot with 'dut-control goog_rec_mode:on' -> runs RO Change-Id: I8259fe0d738ce0ca897d2f4427d8cf61858b8901
-rw-r--r--chip/stm32l/keyboard_scan.c6
-rw-r--r--common/system_common.c9
-rw-r--r--common/vboot.c89
3 files changed, 37 insertions, 67 deletions
diff --git a/chip/stm32l/keyboard_scan.c b/chip/stm32l/keyboard_scan.c
index 108de81ec8..8ae1c7ff59 100644
--- a/chip/stm32l/keyboard_scan.c
+++ b/chip/stm32l/keyboard_scan.c
@@ -466,3 +466,9 @@ void keyboard_put_char(uint8_t chr, int send_irq)
{
/* TODO: needs to be implemented */
}
+
+int keyboard_scan_recovery_pressed(void)
+{
+ /* TODO: (crosbug.com/p/8573) needs to be implemented */
+ return 0;
+}
diff --git a/common/system_common.c b/common/system_common.c
index d75ac188ea..bf78622115 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -277,6 +277,15 @@ static int command_sysjump(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(sysjump, command_sysjump);
+static int command_reboot(int argc, char **argv)
+{
+ uart_puts("Rebooting!\n\n\n");
+ uart_flush_output();
+ system_reset(1);
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(reboot, command_reboot);
+
/*****************************************************************************/
/* Host commands */
diff --git a/common/vboot.c b/common/vboot.c
index f6e8ff1644..07b7f03e25 100644
--- a/common/vboot.c
+++ b/common/vboot.c
@@ -1,94 +1,49 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Verified boot module for Chrome EC */
-#include "common.h" /* for CONFIG_REBOOT_EC */
-#include "console.h"
-#include "host_command.h" /* for CONFIG_REBOOT_EC */
-#include "lpc_commands.h" /* for CONFIG_REBOOT_EC */
+#include "gpio.h"
+#include "keyboard_scan.h"
#include "system.h"
#include "uart.h"
#include "util.h"
#include "vboot.h"
-#define SCRATCHPAD_EMPTY 0
-#define SCRATCHPAD_REQUEST_A 0xb00daaaa
-#define SCRATCHPAD_REQUEST_B 0xb00dbbbb
-#define SCRATCHPAD_SELECTED_A 0x0000d1da
-#define SCRATCHPAD_SELECTED_B 0x0000d1db
-#define SCRATCHPAD_SELECTED_RO 0x0000d1d0
-#define SCRATCHPAD_FAILED_A 0x0000eeea
-#define SCRATCHPAD_FAILED_B 0x0000eeeb
-
-
/* Jumps to one of the RW images if necessary. */
static void jump_to_other_image(void)
{
- int s;
-
+ /* Only jump to another image if we're currently in RO */
if (system_get_image_copy() != SYSTEM_IMAGE_RO)
- return; /* Not in RO firmware, so ignore scratchpad */
+ return;
- if (system_get_reset_cause() != SYSTEM_RESET_SOFT_COLD) {
- /* In RO firmware, but not because of a warm boot.
- * Stay in RO regardless of scratchpad, and clear it
- * so we don't use it on the next boot. */
- system_set_scratchpad(SCRATCHPAD_EMPTY);
+ /* Don't jump if recovery requested */
+ if (keyboard_scan_recovery_pressed()) {
+ uart_puts("Vboot staying in RO because key pressed.\n");
return;
}
- /* TODO: check recovery button; if it's pressed, stay in RO */
-
- /* Check for a scratchpad value we recognize. Clear the
- * scratchpad before jumping, so we only do this once. */
- s = system_get_scratchpad();
- if (s == SCRATCHPAD_REQUEST_A) {
- system_set_scratchpad(SCRATCHPAD_SELECTED_A);
- system_run_image_copy(SYSTEM_IMAGE_RW_A);
- /* Shouldn't normally return; if we did, flag error */
- system_set_scratchpad(SCRATCHPAD_FAILED_A);
- } else if (s == SCRATCHPAD_REQUEST_B) {
- system_set_scratchpad(SCRATCHPAD_SELECTED_B);
- system_run_image_copy(SYSTEM_IMAGE_RW_B);
- /* Shouldn't normally return; if we did, flag error */
- system_set_scratchpad(SCRATCHPAD_FAILED_B);
- } else {
- system_set_scratchpad(SCRATCHPAD_EMPTY);
+#if !defined(BOARD_daisy) && !defined(BOARD_discovery)
+ /* TODO: (crosbug.com/p/8572) Daisy and discovery don't define a GPIO
+ * for the recovery signal from servo, so can't check it. */
+ if (gpio_get_level(GPIO_RECOVERYn) == 0) {
+ uart_puts("Vboot staying in RO due to recovery signal.\n");
+ return;
}
-}
-
-
-/*****************************************************************************/
-/* Console commands */
+#endif
-static int command_reboot(int argc, char **argv)
-{
- /* Handle request to boot to a specific image */
- if (argc >= 2) {
- if (!strcasecmp(argv[1], "a")) {
- uart_puts("Rebooting to image A!\n\n\n");
- system_set_scratchpad(SCRATCHPAD_REQUEST_A);
- } else if (!strcasecmp(argv[1], "b")) {
- uart_puts("Rebooting to image B!\n\n\n");
- system_set_scratchpad(SCRATCHPAD_REQUEST_B);
- } else {
- uart_puts("Usage: reboot [ A | B ]\n");
- return EC_ERROR_UNKNOWN;
- }
- } else {
- uart_puts("Rebooting to RO!\n\n\n");
- }
- uart_flush_output();
- /* TODO - param to specify warm/cold */
- system_reset(1);
- return EC_SUCCESS;
+#ifdef BOARD_link
+ /* TODO: (crosbug.com/p/8561) once daisy can warm-boot to another
+ * image, enable this there too. */
+ /* TODO: real verified boot (including recovery reason); for now, just
+ * jump to image A. */
+ system_run_image_copy(SYSTEM_IMAGE_RW_A);
+#endif
}
-DECLARE_CONSOLE_COMMAND(reboot, command_reboot);
/*****************************************************************************/
/* Initialization */