summaryrefslogtreecommitdiff
path: root/common/console.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-14 12:09:54 +0800
committerChromeBot <chrome-bot@google.com>2013-05-15 20:12:47 -0700
commitc8b7b430fe5e4aa3d5f27fbd160dfee31254e36d (patch)
tree745a6de72919add31ec11a0b4747825e316b9d65 /common/console.c
parent3bcc4af4b6bb23280b3f87072b90162bb4ff73f5 (diff)
downloadchrome-ec-c8b7b430fe5e4aa3d5f27fbd160dfee31254e36d.tar.gz
Add console command to force enable console
When system is locked, the console is disabled. However, we need console for debugging and testing. This CL uses a bit from back-up register to indicate if the console should always be enabled. (This bit is currently used by fake WP, which is removed in this CL.) With this, we can set this bit with console command 'forceen 1' to ensure console is never disabled. To prevent device shipped in this state, the chip name is postfixed with '-unsafe' so that the device is not able to pass HWID check. BUG=chrome-os-partner:19293 TEST=Manual BRANCH=spring Change-Id: I88556e973ca542c1bdc27ba64988718291e01a26 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51086 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/common/console.c b/common/console.c
index e7b4564dcb..e59760237d 100644
--- a/common/console.c
+++ b/common/console.c
@@ -167,7 +167,7 @@ void console_task(void)
{
#ifdef CONFIG_CONSOLE_RESTRICTED_INPUT
/* the console is not available due to security restrictions */
- if (system_is_locked()) {
+ if (system_is_locked() && !system_get_console_force_enabled()) {
ccprintf("Console is DISABLED (WP is ON).\n");
while (1)
task_wait_event(-1);
@@ -246,3 +246,25 @@ DECLARE_CONSOLE_COMMAND(help, command_help,
"[ list | <name> ]",
"Print command help",
NULL);
+
+#ifdef CONFIG_CONSOLE_RESTRICTED_INPUT
+static int command_force_enabled(int argc, char **argv)
+{
+ int val;
+
+ if (argc < 2)
+ return EC_ERROR_PARAM_COUNT;
+
+ if (!parse_bool(argv[1], &val))
+ return EC_ERROR_PARAM1;
+
+ system_set_console_force_enabled(val);
+ ccprintf("Console force enabled = %s\n", val ? "on" : "off");
+
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(forceen, command_force_enabled,
+ "<on | off>",
+ "Force enable console",
+ NULL);
+#endif