diff options
author | Jonathan Brandmeyer <jbrandmeyer@chromium.org> | 2018-07-16 15:02:22 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-26 04:07:41 -0700 |
commit | dda2f778befed39e449d96b471b94d489ed23d60 (patch) | |
tree | fc0db938c092a609fbf47e9758d8f0113e5b0cce /power/braswell.c | |
parent | 48113728b689870e6aeda6534d36eeffd3b738b3 (diff) | |
download | chrome-ec-dda2f778befed39e449d96b471b94d489ed23d60.tar.gz |
reset: Log the reason for AP resets.
Provides a new EC host command 'uptime info' which gathers up some
information which may be useful for debugging spurious resets on the AP
(was the EC reset recently? Why was the EC reset? If the EC reset the
AP, why did it do so?, etc.). Provide ectool support for the same.
Example results of `ectool uptimeinfo`:
```
localhost ~ # ectool uptimeinfo
EC uptime: 475.368 seconds
AP resets since EC boot: 2
Most recent AP reset causes:
315.903: reset: console command
363.507: reset: keyboard warm reboot
EC reset flags at last EC boot: reset-pin | sysjump
```
BRANCH=none
TEST=Perform some `apreset` commands from the EC console and observe
their side-effects via the `ectool uptimeinfo` command on the AP side.
Test sequences include no-resets through 5 resets, observing that the
ring buffer handling was correct.
BUG=b:110788201, b:79529789
Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Change-Id: I0bf29d69de471c64f905ee8aa070b15b4f34f2ba
Reviewed-on: https://chromium-review.googlesource.com/1139028
Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'power/braswell.c')
-rw-r--r-- | power/braswell.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/power/braswell.c b/power/braswell.c index e04918c055..4140c02adf 100644 --- a/power/braswell.c +++ b/power/braswell.c @@ -53,9 +53,10 @@ static int throttle_cpu; /* Throttle CPU? */ static int forcing_shutdown; /* Forced shutdown in progress? */ -void chipset_force_shutdown(void) +void chipset_force_shutdown(enum chipset_shutdown_reason reason) { - CPRINTS("%s()", __func__); + CPRINTS("%s(%d)", __func__, reason); + report_ap_reset(reason); /* * Force power off. This condition will reset once the state machine @@ -68,9 +69,10 @@ void chipset_force_shutdown(void) forcing_shutdown = 1; } -void chipset_reset(void) +void chipset_reset(enum chipset_reset_reason reason) { - CPRINTS("%s", __func__); + CPRINTS("%s: %d", __func__, reason); + report_ap_reset(reason); /* * Send a reset pulse to the PCH. This just causes it to @@ -138,7 +140,7 @@ enum power_state power_handle_state(enum power_state state) CPRINTS("Exit SOC G3"); if (power_wait_signals(IN_PGOOD_S5)) { - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_WAIT); return POWER_G3; } @@ -165,7 +167,7 @@ enum power_state power_handle_state(enum power_state state) /* Check for state transitions */ if (!power_has_signals(IN_PGOOD_S3)) { /* Required rail went away */ - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); return POWER_S3S5; } else if (gpio_get_level(GPIO_PCH_SLP_S3_L) == 1) { /* Power up to next state */ @@ -182,7 +184,7 @@ enum power_state power_handle_state(enum power_state state) /*wireless_set_state(WIRELESS_ON);*/ if (!power_has_signals(IN_PGOOD_S3)) { - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); /*wireless_set_state(WIRELESS_OFF);*/ return POWER_S3S5; @@ -222,7 +224,7 @@ enum power_state power_handle_state(enum power_state state) case POWER_S0: if (!power_has_signals(IN_PGOOD_ALWAYS_ON)) { - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); return POWER_S0S3; } |