summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/main.c4
-rw-r--r--common/power_button_x86.c5
-rw-r--r--include/config.h4
-rw-r--r--power/common.c66
4 files changed, 79 insertions, 0 deletions
diff --git a/common/main.c b/common/main.c
index e60a57f6bc..269781f9f6 100644
--- a/common/main.c
+++ b/common/main.c
@@ -111,6 +111,10 @@ test_mockable int main(void)
CPRINTF("[Image: %s, %s]\n",
system_get_image_copy_string(), system_get_build_info());
+#ifdef CONFIG_BRINGUP
+ ccprintf("\n\nWARNING: BRINGUP BUILD\n\n\n");
+#endif
+
#ifdef CONFIG_WATCHDOG
/*
* Intialize watchdog timer. All lengthy operations between now and
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index dc035fbb5b..539bfce347 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -214,8 +214,13 @@ static void set_initial_pwrbtn_state(void)
* All other EC reset conditions power on the main processor so
* it can verify the EC.
*/
+#ifdef CONFIG_BRINGUP
+ CPRINTS("PB idle");
+ pwrbtn_state = PWRBTN_STATE_IDLE;
+#else
CPRINTS("PB init-on");
pwrbtn_state = PWRBTN_STATE_INIT_ON;
+#endif
}
}
diff --git a/include/config.h b/include/config.h
index e266ea9b80..4700e00dbb 100644
--- a/include/config.h
+++ b/include/config.h
@@ -164,6 +164,10 @@
#undef CONFIG_BOOTCFG_VALUE
/*****************************************************************************/
+/* Modify the default behavior to make system bringup easier. */
+#undef CONFIG_BRINGUP
+
+/*****************************************************************************/
/*
* Number of extra buttons not on the keyboard scan matrix. Doesn't include
diff --git a/power/common.c b/power/common.c
index 1dffd64163..7489f1939f 100644
--- a/power/common.c
+++ b/power/common.c
@@ -20,6 +20,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHIPSET, outstr)
#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
/*
* Default timeout in us; if we've been waiting this long for an input
@@ -332,8 +333,73 @@ DECLARE_HOOK(HOOK_AC_CHANGE, power_ac_change, HOOK_PRIO_DEFAULT);
/*****************************************************************************/
/* Interrupts */
+#ifdef CONFIG_BRINGUP
+#define MAX_SIGLOG_ENTRIES 24
+
+static unsigned int siglog_entries;
+static unsigned int siglog_truncated;
+
+static struct {
+ timestamp_t time;
+ enum gpio_signal signal;
+ int level;
+} siglog[MAX_SIGLOG_ENTRIES];
+
+static void siglog_deferred(void)
+{
+ const struct gpio_info *g = gpio_list;
+ unsigned int i;
+ timestamp_t tdiff = {.val = 0};
+
+ /* Disable interrupts for input signals while we print stuff.*/
+ for (i = 0; i < POWER_SIGNAL_COUNT; i++)
+ gpio_disable_interrupt(power_signal_list[i].gpio);
+
+ CPRINTF("%d signal changes:\n", siglog_entries);
+ for (i = 0; i < siglog_entries; i++) {
+ if (i)
+ tdiff.val = siglog[i].time.val - siglog[i-1].time.val;
+ CPRINTF(" %.6ld +%.6ld %s => %d\n",
+ siglog[i].time.val, tdiff.val,
+ g[siglog[i].signal].name,
+ siglog[i].level);
+ }
+ if (siglog_truncated)
+ CPRINTF(" SIGNAL LOG TRUNCATED...\n");
+ siglog_entries = siglog_truncated = 0;
+
+ /* Okay, turn 'em on again. */
+ for (i = 0; i < POWER_SIGNAL_COUNT; i++)
+ gpio_enable_interrupt(power_signal_list[i].gpio);
+}
+DECLARE_DEFERRED(siglog_deferred);
+
+static void siglog_add(enum gpio_signal signal)
+{
+ if (siglog_entries >= MAX_SIGLOG_ENTRIES) {
+ siglog_truncated = 1;
+ return;
+ }
+
+ siglog[siglog_entries].time = get_time();
+ siglog[siglog_entries].signal = signal;
+ siglog[siglog_entries].level = gpio_get_level(signal);
+ siglog_entries++;
+
+ hook_call_deferred(siglog_deferred, SECOND);
+}
+
+#define SIGLOG(S) siglog_add(S)
+
+#else
+#define SIGLOG(S)
+#endif /* CONFIG_BRINGUP */
+
+
void power_signal_interrupt(enum gpio_signal signal)
{
+ SIGLOG(signal);
+
/* Shadow signals and compare with our desired signal state. */
power_update_signals();