diff --git a/common/x86_power.c b/common/x86_power.c index eb127c55ad..4d4e0fef5d 100644 --- a/common/x86_power.c +++ b/common/x86_power.c @@ -98,6 +98,7 @@ static const char * const state_names[] = { static enum x86_state state = X86_G3; /* Current state */ static uint32_t in_signals; /* Current input signal states (IN_PGOOD_*) */ static uint32_t in_want; /* Input signal state we're waiting for */ +static uint32_t in_debug; /* Signal values which print debug output */ static int want_g3_exit; /* Should we exit the G3 state? */ static int throttle_cpu; /* Throttle CPU? */ @@ -146,6 +147,9 @@ static void update_in_signals(void) /* Copy SUSWARN# signal from PCH to SUSACK# */ gpio_set_level(GPIO_PCH_SUSACKn, v); + if ((in_signals & in_debug) != (inew & in_debug)) + CPRINTF("[%T x86 in 0x%04x]\n", inew); + in_signals = inew; } @@ -675,6 +679,29 @@ DECLARE_CONSOLE_COMMAND(x86shutdown, command_x86shutdown, "Force x86 shutdown", NULL); +static int command_x86indebug(int argc, char **argv) +{ + char *e; + + /* If one arg, set the mask */ + if (argc == 2) { + int m = strtoi(argv[1], &e, 0); + if (*e) + return EC_ERROR_PARAM1; + + in_debug = m; + } + + /* Print the mask */ + ccprintf("x86 in: 0x%04x\n", in_signals); + ccprintf("debug mask: 0x%04x\n", in_debug); + return EC_SUCCESS; +}; +DECLARE_CONSOLE_COMMAND(x86indebug, command_x86indebug, + "[mask]", + "Get/set x86 input debug mask", + NULL); + /*****************************************************************************/ /* Host commands */