Remove unused CONFIG_CONSOLE_RESTRICTED_INPUT option

Nothing has used this config option since Spring and Skate, back
in early 2014. There's nothing in ToT that uses it at all. I want
to add something similar for other purposes, and having two
similar-sounding options will just cause confusion.

NOTE: Although the comments in include/system.h said that the two
functions

  system_get_console_force_enabled()
  system_set_console_force_enabled()

were only useful when CONFIG_CONSOLE_RESTRICTED_INPUT is defined,
they were being used in chip/stm32/system.c. But since the
bkpdata registers are only accessible to the EC, there was no way
to initialize or modify the one relevant bit that those functions
cared about, so they almost certainly had no effect.

BUG=chrome-os-partner:55322
BRANCH=none
TEST=make buildall

Change-Id: Id41541193d4559f5c507bdd0268b049166af4497
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374525
This commit is contained in:
Bill Richardson
2016-08-23 15:14:56 -07:00
committed by chrome-bot
parent 68eb480a88
commit 3071b82b58
4 changed files with 3 additions and 78 deletions

View File

@@ -18,8 +18,6 @@
#include "version.h"
#include "watchdog.h"
#define CONSOLE_BIT_MASK 0x8000
enum bkpdata_index {
BKPDATA_INDEX_SCRATCHPAD, /* General-purpose scratchpad */
BKPDATA_INDEX_SAVED_RESET_FLAGS, /* Saved reset flags */
@@ -128,15 +126,12 @@ static void check_reset_cause(void)
uint32_t raw_cause = STM32_RCC_CSR;
uint32_t pwr_status = STM32_PWR_CSR;
uint32_t console_en = flags & CONSOLE_BIT_MASK;
flags &= ~CONSOLE_BIT_MASK;
/* Clear the hardware reset cause by setting the RMVF bit */
STM32_RCC_CSR |= 1 << 24;
/* Clear SBF in PWR_CSR */
STM32_PWR_CR |= 1 << 3;
/* Clear saved reset flags */
bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS, 0 | console_en);
bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS, 0);
if (raw_cause & 0x60000000) {
/*
@@ -248,9 +243,6 @@ void system_reset(int flags)
{
uint32_t save_flags = 0;
uint32_t console_en = bkpdata_read(BKPDATA_INDEX_SAVED_RESET_FLAGS) &
CONSOLE_BIT_MASK;
/* Disable interrupts to avoid task swaps during reboot */
interrupt_disable();
@@ -265,7 +257,7 @@ void system_reset(int flags)
if (flags & SYSTEM_RESET_HARD)
save_flags |= RESET_FLAG_HARD;
bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS, save_flags | console_en);
bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS, save_flags);
if (flags & SYSTEM_RESET_HARD) {
#ifdef CONFIG_SOFTWARE_PANIC
@@ -336,10 +328,7 @@ const char *system_get_chip_vendor(void)
const char *system_get_chip_name(void)
{
if (system_get_console_force_enabled())
return STRINGIFY(CHIP_VARIANT-unsafe);
else
return STRINGIFY(CHIP_VARIANT);
return STRINGIFY(CHIP_VARIANT);
}
const char *system_get_chip_revision(void)
@@ -380,26 +369,6 @@ int system_set_vbnvcontext(const uint8_t *block)
return EC_SUCCESS;
}
int system_set_console_force_enabled(int val)
{
uint16_t flags = bkpdata_read(BKPDATA_INDEX_SAVED_RESET_FLAGS);
if (val)
flags |= CONSOLE_BIT_MASK;
else
flags &= ~CONSOLE_BIT_MASK;
return bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS, flags);
}
int system_get_console_force_enabled(void)
{
if (bkpdata_read(BKPDATA_INDEX_SAVED_RESET_FLAGS) & CONSOLE_BIT_MASK)
return 1;
else
return 0;
}
int system_is_reboot_warm(void)
{
#if defined(CHIP_FAMILY_STM32F0) || defined(CHIP_FAMILY_STM32F3)

View File

@@ -646,15 +646,6 @@ void console_has_input(void)
void console_task(void)
{
#ifdef CONFIG_CONSOLE_RESTRICTED_INPUT
/* the console is not available due to security restrictions */
if (system_is_locked() && !system_get_console_force_enabled()) {
ccprintf("Console is DISABLED (WP is ON).\n");
while (1)
task_wait_event(-1);
}
#endif
console_init();
while (1) {
@@ -741,27 +732,6 @@ DECLARE_CONSOLE_COMMAND(help, command_help,
"[ list | <name> ]",
"Print command help");
#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");
#endif
#ifdef CONFIG_CONSOLE_HISTORY
static int command_history(int argc, char **argv)
{

View File

@@ -668,13 +668,6 @@
/* Max length of a single line of input */
#define CONFIG_CONSOLE_INPUT_LINE_SIZE 80
/*
* Disable EC console input if the system is locked. This is needed for
* security on platforms where the EC console is accessible from outside the
* case - for example, via a special USB dongle.
*/
#undef CONFIG_CONSOLE_RESTRICTED_INPUT
/*
* Enable the experimental console.
*

View File

@@ -301,13 +301,6 @@ void board_hibernate_late(void) __attribute__((weak));
/* Minimum duration to get proper hibernation */
#define SYSTEM_HIB_MINIMUM_DURATION 0, 150000
/**
* Get/Set console force enable status. This is only supported/used on platform
* with CONFIG_CONSOLE_RESTRICTED_INPUT defined.
*/
int system_get_console_force_enabled(void);
int system_set_console_force_enabled(int enabled);
/**
* Read the real-time clock.
*