Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85326?usp=email )
Change subject: ec/google/chromeec: Add debug timestamp for host EC commands ......................................................................
ec/google/chromeec: Add debug timestamp for host EC commands
Improve host EC command debugging with timestamps and duration for better analysis, this feature can be enabled by selecting the config EC_GOOGLE_CHROMEEC_HOST_CMD_DEBUG.
BUG=none TEST=Brox/lotso device successfully built and booted. Debug messages confirmed in device logs only when the specific configuration is selected. Sample print: "EC HOST CMD Duration: 661 us, Command: 0x4b, version: 0x0"
Change-Id: I8ab89830ede940d2237ad21187b137dca9689fb0 Signed-off-by: Jayvik Desai jayvik@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/85326 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Subrata Banik subratabanik@google.com --- M src/ec/google/chromeec/Kconfig M src/ec/google/chromeec/ec_lpc.c 2 files changed, 28 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Subrata Banik: Looks good to me, approved
diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig index a56565c..a39ac8e 100644 --- a/src/ec/google/chromeec/Kconfig +++ b/src/ec/google/chromeec/Kconfig @@ -98,6 +98,12 @@ help Microchip EC variant for LPC register access.
+config EC_GOOGLE_CHROMEEC_EC_HOST_CMD_DEBUG + depends on EC_GOOGLE_CHROMEEC_LPC && HAVE_MONOTONIC_TIMER + def_bool n + help + Enables timestamp and duration logging for host EC commands. + config EC_GOOGLE_CHROMEEC_PD def_bool n help diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c index e661cf5..b86ba7b 100644 --- a/src/ec/google/chromeec/ec_lpc.c +++ b/src/ec/google/chromeec/ec_lpc.c @@ -401,17 +401,36 @@ int google_chromeec_command(struct chromeec_command *cec_command) { static int command_version; + struct stopwatch sw; + uint16_t cmd_code; + int result = -1;
if (command_version <= 0) command_version = google_chromeec_command_version();
+ if (CONFIG(EC_GOOGLE_CHROMEEC_EC_HOST_CMD_DEBUG)) { + cmd_code = cec_command->cmd_code; + stopwatch_init(&sw); + } + switch (command_version) { case EC_HOST_CMD_FLAG_VERSION_3: - return google_chromeec_command_v3(cec_command); + result = google_chromeec_command_v3(cec_command); + break; case EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED: - return google_chromeec_command_v1(cec_command); + result = google_chromeec_command_v1(cec_command); + break; } - return -1; + + if (CONFIG(EC_GOOGLE_CHROMEEC_EC_HOST_CMD_DEBUG)) { + stopwatch_tick(&sw); + printk(BIOS_DEBUG, "EC HOST CMD end Duration: %llu us, Command: 0x%x, Version: 0x%x\n", + stopwatch_duration_usecs(&sw), + cmd_code, + command_version); + } + + return result; }
static void lpc_ec_init(struct device *dev)