From cf20b3e4f0852ff3d467ee1c4553bbd5a0cf6f09 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Fri, 3 Aug 2012 12:41:08 -0700 Subject: [PATCH] Add x86indebug command Prints all x86 signal power state transitions at interrupt level, so we can see lines toggle more precisely. BUG=chrome-os-partner:12229 TEST=manual 1. power on system 2. no debug output that looks like [501.001742 x86 in 0x563f] 3. reboot 4. x86indebug 0xffff 5. power on system 6. should see lots of lines that look like [501.001742 x86 in 0x563f] Change-Id: Ie3b346ee4d4beee3f13ac1245f1eb022b48dabf4 Signed-off-by: Randall Spangler Reviewed-on: https://gerrit.chromium.org/gerrit/29192 Reviewed-by: Bill Richardson --- common/x86_power.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 */