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/intel_x86.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/intel_x86.c')
-rw-r--r-- | power/intel_x86.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/power/intel_x86.c b/power/intel_x86.c index 1cc8beadf5..15c1cf1b4a 100644 --- a/power/intel_x86.c +++ b/power/intel_x86.c @@ -219,7 +219,7 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) case POWER_S3: if (!power_has_signals(IN_PGOOD_ALL_CORE)) { /* Required rail went away */ - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); return POWER_S3S5; } else if (chipset_get_sleep_signal(SYS_SLEEP_S3) == 1) { /* Power up to next state */ @@ -232,7 +232,7 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) case POWER_S0: if (!power_has_signals(IN_PGOOD_ALL_CORE)) { - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); return POWER_S0S3; } else if (chipset_get_sleep_signal(SYS_SLEEP_S3) == 0) { /* Power down to next state */ @@ -293,7 +293,8 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) if (tries == CHARGER_INITIALIZED_TRIES) { CPRINTS("power-up inhibited"); power_up_inhibited = 1; - chipset_force_shutdown(); + chipset_force_shutdown( + CHIPSET_SHUTDOWN_BATTERY_INHIBIT); return POWER_G3; } @@ -320,7 +321,7 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) #endif if (power_wait_signals(CHIPSET_G3S5_POWERUP_SIGNAL)) { - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_WAIT); return POWER_G3; } @@ -330,7 +331,7 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) case POWER_S5S3: if (!power_has_signals(IN_PGOOD_ALL_CORE)) { /* Required rail went away */ - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); return POWER_S5G3; } @@ -349,7 +350,7 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) case POWER_S3S0: if (!power_has_signals(IN_PGOOD_ALL_CORE)) { /* Required rail went away */ - chipset_force_shutdown(); + chipset_force_shutdown(CHIPSET_SHUTDOWN_POWERFAIL); return POWER_S3S5; } @@ -563,7 +564,7 @@ void power_chipset_handle_host_sleep_event(enum host_sleep_event state) #endif -void chipset_reset(void) +void chipset_reset(enum chipset_reset_reason reason) { /* * Irrespective of cold_reset value, always toggle SYS_RESET_L to @@ -574,7 +575,7 @@ void chipset_reset(void) * The EC cannot control warm vs cold reset of the chipset using * SYS_RESET_L; it's more of a request. */ - CPRINTS("%s", __func__); + CPRINTS("%s: %d", __func__, reason); /* * Toggling SYS_RESET_L will not have any impact when it's already @@ -585,6 +586,8 @@ void chipset_reset(void) return; } + report_ap_reset(reason); + gpio_set_level(GPIO_SYS_RESET_L, 0); /* * Debounce time for SYS_RESET_L is 16 ms. Wait twice that period |