diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-05-15 14:44:42 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-18 02:26:10 -0700 |
commit | 19aace4ec0cbf09debd3acde6848287ba6d524cd (patch) | |
tree | 9481c8842b5ddb934c679faf0982656ccd3b532b /common/host_command.c | |
parent | 8151b3f7e6b15c5de88f6d754aeda3fcf25bf6ad (diff) | |
download | chrome-ec-19aace4ec0cbf09debd3acde6848287ba6d524cd.tar.gz |
host_command: Throttle printing of "+" for repeated commands
When AP boots and FW screen is shown (e.g. in developer mode),
AP FW is querying MKBP status in a loop, leading to a lot of "+"
being printed in the EC console.
To avoid this issue, let's print "(++)" after a command is received
5 times in a row.
BRANCH=none
BUG=b:37925684
TEST=Set GBB flags to 0x4a38, reasonable number of "+" is printed
on EC console on boot, which firmware screen is being shown.
Change-Id: I8368c558b97e7a2513b979322bd4bba442626b27
Reviewed-on: https://chromium-review.googlesource.com/505948
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/host_command.c')
-rw-r--r-- | common/host_command.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/common/host_command.c b/common/host_command.c index 33eb813bda..e82887738e 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -26,6 +26,9 @@ /* Maximum delay to skip printing repeated host command debug output */ #define HCDEBUG_MAX_REPEAT_DELAY (50 * MSEC) +/* Stop printing repeated host commands "+" after this count */ +#define HCDEBUG_MAX_REPEAT_COUNT 5 + static struct host_cmd_handler_args *pending_args; /* Verify Boot Mode */ @@ -564,6 +567,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CMD_VERSIONS, static void host_command_debug_request(struct host_cmd_handler_args *args) { static int hc_prev_cmd; + static int hc_prev_count; static uint64_t hc_prev_time; /* @@ -575,10 +579,15 @@ static void host_command_debug_request(struct host_cmd_handler_args *args) uint64_t t = get_time().val; if (args->command == hc_prev_cmd && t - hc_prev_time < HCDEBUG_MAX_REPEAT_DELAY) { + hc_prev_count++; hc_prev_time = t; - CPUTS("+"); + if (hc_prev_count < HCDEBUG_MAX_REPEAT_COUNT) + CPUTS("+"); + else if (hc_prev_count == HCDEBUG_MAX_REPEAT_COUNT) + CPUTS("(++)"); return; } + hc_prev_count = 1; hc_prev_time = t; hc_prev_cmd = args->command; } |