summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/fizz/board.c6
-rw-r--r--board/fizz/board.h1
-rw-r--r--common/host_command.c21
-rw-r--r--include/config.h3
-rw-r--r--include/host_command.h3
5 files changed, 34 insertions, 0 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c
index 9756aa05c0..20aacd5650 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -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))
diff --git a/board/fizz/board.h b/board/fizz/board.h
index 67b7d20aad..e3c49e5f5f 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -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
diff --git a/common/host_command.c b/common/host_command.c
index bd397a6616..3de9c27850 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -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;
}
diff --git a/include/config.h b/include/config.h
index fb3b9bd54a..06de830e0a 100644
--- a/include/config.h
+++ b/include/config.h
@@ -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 */
diff --git a/include/host_command.h b/include/host_command.h
index f83ffcc616..de99a6894e 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -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 */