mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-05 14:31:31 +00:00
host_command: Suppress individual host command debug log
Host command handler prints every single host command except when commands are repeated back-to-back. This patch allows each board decide which commands should be ignored. When debug printf is suppressed, a global counter is incremented. Developers know there were commands processed but not reported to the console. BUG=chromium:803955 BRANCH=none TEST=Observe 0x97 and 0x98 were not printed. Global suppress counter is incremented. Change-Id: I05e8cde9039f602e8fc06c20e89b328e797bd733 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/876952 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
d9f4ce13f2
commit
c06d7fea8f
@@ -54,6 +54,12 @@
|
||||
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
|
||||
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
|
||||
|
||||
uint16_t host_command_suppressed[] = {
|
||||
EC_CMD_CONSOLE_SNAPSHOT,
|
||||
EC_CMD_CONSOLE_READ,
|
||||
HOST_COMMAND_SUPPRESS_DELIMITER,
|
||||
};
|
||||
|
||||
static void tcpc_alert_event(enum gpio_signal signal)
|
||||
{
|
||||
if (!gpio_get_level(GPIO_USB_C0_PD_RST_ODL))
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#define CONFIG_DPTF
|
||||
#define CONFIG_FLASH_SIZE 0x80000
|
||||
#define CONFIG_FPU
|
||||
#define CONFIG_SUPPRESS_HOST_COMMANDS
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_I2C_MASTER
|
||||
#undef CONFIG_LID_SWITCH
|
||||
|
||||
@@ -560,6 +560,22 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CMD_VERSIONS,
|
||||
host_command_get_cmd_versions,
|
||||
EC_VER_MASK(0) | EC_VER_MASK(1));
|
||||
|
||||
extern uint16_t host_command_suppressed[];
|
||||
/* Default suppress list. Define yours in board.c. */
|
||||
static uint32_t suppressed_count;
|
||||
|
||||
static int host_command_is_suppressed(uint16_t cmd)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_HOST_COMMANDS
|
||||
uint16_t *p = host_command_suppressed;
|
||||
while (*p != HOST_COMMAND_SUPPRESS_DELIMITER) {
|
||||
if (*p++ == cmd)
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print debug output for the host command request, before it's processed.
|
||||
*
|
||||
@@ -578,6 +594,10 @@ static void host_command_debug_request(struct host_cmd_handler_args *args)
|
||||
*/
|
||||
if (hcdebug == HCDEBUG_NORMAL) {
|
||||
uint64_t t = get_time().val;
|
||||
if (host_command_is_suppressed(args->command)) {
|
||||
suppressed_count++;
|
||||
return;
|
||||
}
|
||||
if (args->command == hc_prev_cmd &&
|
||||
t - hc_prev_time < HCDEBUG_MAX_REPEAT_DELAY) {
|
||||
hc_prev_count++;
|
||||
@@ -846,6 +866,7 @@ static int command_hcdebug(int argc, char **argv)
|
||||
|
||||
ccprintf("Host command debug mode is %s\n",
|
||||
hcdebug_mode_names[hcdebug]);
|
||||
ccprintf("%u suppressed\n", suppressed_count);
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1601,6 +1601,9 @@
|
||||
/* Set SKU ID from AP */
|
||||
#undef CONFIG_HOSTCMD_AP_SET_SKUID
|
||||
|
||||
/* Suppress debug output for commands in host_command_suppressed */
|
||||
#undef CONFIG_SUPPRESS_HOST_COMMANDS
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Enable debugging and profiling statistics for hook functions */
|
||||
|
||||
@@ -337,4 +337,7 @@ void host_send_sysrq(uint8_t key);
|
||||
uint32_t get_feature_flags0(void);
|
||||
uint32_t get_feature_flags1(void);
|
||||
|
||||
/* Used to define the end of host_command_suppressed */
|
||||
#define HOST_COMMAND_SUPPRESS_DELIMITER 0xFFFF
|
||||
|
||||
#endif /* __CROS_EC_HOST_COMMAND_H */
|
||||
|
||||
Reference in New Issue
Block a user