diff options
author | Yicheng Li <yichengli@chromium.org> | 2020-04-28 15:40:28 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-09 18:13:36 +0000 |
commit | 94492ef4046034935a1f8c6ac0887f2453c70151 (patch) | |
tree | e3bfa3ec58a858095e023ad9fd65a4486a4529f7 | |
parent | f6392851299ee41e006febcf0029d00f1b31c5be (diff) | |
download | chrome-ec-94492ef4046034935a1f8c6ac0887f2453c70151.tar.gz |
common: Restrict gpioset console command for FPMCU
Generally, we don't want people to be able to modify GPIOs in
production. The main EC already disables the whole console input
in production. For the FPMCU, the host command version of gpioset
is already restricted. This change restricts the console command
version on FPMCU, without changing other boards' behavior.
BRANCH=none
BUG=b:154655729
TEST=make -j buildall
TEST=(change bloonchipper board's USART settings to be the same as
nucleo-f412zg's)
make -j BOARD=bloonchipper
flash the resulting firmware to a nucleo-f412zg device
gpioset USER_PRES_L 0 ==> Success
syslock ==> Check sysinfo, shows locked
gpioset USER_PRES_L 0 ==> Access Denied
Change-Id: I9ab893b5742926732148e7c363d8aa7dcd7466f2
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2172056
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | common/gpio_commands.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/gpio_commands.c b/common/gpio_commands.c index 166f955df4..967d051f6c 100644 --- a/common/gpio_commands.c +++ b/common/gpio_commands.c @@ -210,13 +210,15 @@ static int command_gpio_set(int argc, char **argv) #endif return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(gpioset, command_gpio_set, +DECLARE_CONSOLE_COMMAND_FLAGS(gpioset, command_gpio_set, #ifdef CONFIG_CMD_GPIO_EXTENDED - "name <0 | 1 | IN | A | ALT [func]>", + "name <0 | 1 | IN | A | ALT [func]>", #else - "name <0 | 1>", + "name <0 | 1>", #endif - "Set a GPIO"); + "Set a GPIO", + CMD_FLAG_RESTRICTED +); /*****************************************************************************/ /* Host commands */ |