diff options
author | Keith Short <keithshort@chromium.org> | 2021-02-16 13:13:07 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-17 21:53:29 +0000 |
commit | e8a96e49e310cd6a8a5f915e3c53b92f18fb8ace (patch) | |
tree | 32fcbf152edee2649df37f9bee8cf6c9c2cc5e22 /common/console_output.c | |
parent | 844783bbd9e11ce936c78b03299197cc85adafd2 (diff) | |
download | chrome-ec-e8a96e49e310cd6a8a5f915e3c53b92f18fb8ace.tar.gz |
zephyr: add support for disabling console channels
Add support in the device tree for disabling console output channels by
default.
BUG=b:180421120
BRANCH=none
TEST=make buildall
TEST=zmake testall
TEST=On Volteer, verify "hostcmd" channel is disabled by default
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I9fa1fe78ee3927346ede8e75378260f6061075cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2698268
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/console_output.c')
-rw-r--r-- | common/console_output.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/common/console_output.c b/common/console_output.c index 23c208c61b..237c45cba6 100644 --- a/common/console_output.c +++ b/common/console_output.c @@ -35,6 +35,34 @@ static const char * const channel_names[] = { BUILD_ASSERT(ARRAY_SIZE(channel_names) == CC_CHANNEL_COUNT); /* ensure that we are not silently masking additional channels */ BUILD_ASSERT(CC_CHANNEL_COUNT <= 8*sizeof(uint32_t)); + +static int console_channel_name_to_index(const char *name) +{ + int i; + + for (i = 0; i < CC_CHANNEL_COUNT; i++) { + if (!strncasecmp(name, channel_names[i], strlen(name))) + return i; + } + + /* Not found */ + return -1; +} + +void console_channel_enable(const char *name) +{ + int index = console_channel_name_to_index(name); + + if (index >= 0 && index != CC_COMMAND) + channel_mask |= CC_MASK(index); +} +void console_channel_disable(const char *name) +{ + int index = console_channel_name_to_index(name); + + if (index >= 0 && index != CC_COMMAND) + channel_mask &= ~CC_MASK(index); +} #endif /* CONFIG_CONSOLE_CHANNEL */ /*****************************************************************************/ |