summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2019-10-17 21:52:35 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-23 21:08:15 +0000
commit21394c99a5301e1b0be083dab77f03aefd2594ad (patch)
tree916eee488eaf325b42c68e2ea0479f19b7940e87 /common
parent3ca7a99d01b5b7e3b9593ed3d097f7ab1330e637 (diff)
downloadchrome-ec-21394c99a5301e1b0be083dab77f03aefd2594ad.tar.gz
mem_commands: Flag md and rw cmds as restricted
This marks both the md and rw console commands as restricted. This alone does nothing, unless the specific board has enabled console flags, enabled restricted console commands, and provided an implementation for console_is_restricted(). The idea is to allow boards to deny access to these commands under some runtime condition, for example when system_is_locked(). Restricted console commands were introduced in crrev.com/c/376185/4. See crrev.com/c/1867388 as an example board usage. BRANCH=nocturne BRANCH=hatch BUG=b:142559996, b:142505927 TEST=# Test on nocturne_fp, since it has not enabled # console restricted commands, at this CL. # Note that this will not be the case in future CLs. make BOARD=nocturne_fp scp build/nocturne_fp/ec.bin dut1:~/ ssh dut1 flash_fp_mcu ./ec.bin # From FPMCU UART console version # Ensure that version is custom based on workstation syslock help # Ensure that md and rw are not prefixed with "-" help list # Ensure that no "Flags" column exists md 0x0 # Ensure that this successfully reads the word rw 0x24000000 # Ensure that this successfully reads the word TEST=A positive test case is done in crrev.com/c/1867388. Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ica6b1f24d9b89186ad0ff854bb6e0786392fd1df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868430 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/memory_commands.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/memory_commands.c b/common/memory_commands.c
index 6a6455acdc..98c64d918b 100644
--- a/common/memory_commands.c
+++ b/common/memory_commands.c
@@ -106,9 +106,11 @@ static int command_mem_dump(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(md, command_mem_dump,
- "[.b|.h|.s] addr [count]",
- "dump memory values, optionally specifying the format");
+DECLARE_CONSOLE_COMMAND_FLAGS
+ (md, command_mem_dump,
+ "[.b|.h|.s] addr [count]",
+ "dump memory values, optionally specifying the format",
+ CMD_FLAG_RESTRICTED);
#endif /* CONFIG_CMD_MD */
#ifdef CONFIG_CMD_RW
@@ -188,8 +190,9 @@ static int command_read_word(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND
+DECLARE_CONSOLE_COMMAND_FLAGS
(rw, command_read_word,
"[.b|.h] addr [value]",
- "Read or write a word in memory optionally specifying the size");
+ "Read or write a word in memory optionally specifying the size",
+ CMD_FLAG_RESTRICTED);
#endif /* CONFIG_CMD_RW */