diff options
Diffstat (limited to 'include/chipset.h')
-rw-r--r-- | include/chipset.h | 85 |
1 files changed, 81 insertions, 4 deletions
diff --git a/include/chipset.h b/include/chipset.h index 5169689d8a..5e51e5991a 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -39,6 +39,66 @@ enum chipset_state_mask { CHIPSET_STATE_STANDBY), }; +/* + * Reason codes used by the AP after a shutdown to figure out why it was reset + * by the EC. These are sent in EC commands. Therefore, to maintain protocol + * compatibility: + * - New entries must be inserted prior to the _COUNT field + * - If an existing entry is no longer in service, it must be replaced with a + * RESERVED entry instead. + * - The semantic meaning of an entry should not change. + * - Do not exceed 2^15 - 1 for reset reasons or 2^16 - 1 for shutdown reasons. + */ +enum chipset_reset_reason { + CHIPSET_RESET_BEGIN = 0, + CHIPSET_RESET_UNKNOWN = CHIPSET_RESET_BEGIN, + /* Custom reason defined by a board.c or baseboard.c file */ + CHIPSET_RESET_BOARD_CUSTOM, + /* Believe that the AP has hung */ + CHIPSET_RESET_HANG_REBOOT, + /* Reset by EC console command */ + CHIPSET_RESET_CONSOLE_CMD, + /* Keyboard module reset key combination */ + CHIPSET_RESET_KB_SYSRESET, + /* Keyboard module warm reboot */ + CHIPSET_RESET_KB_WARM_REBOOT, + /* Debug module warm reboot */ + CHIPSET_RESET_DBG_WARM_REBOOT, + /* I cannot self-terminate. You must lower me into the steel. */ + CHIPSET_RESET_AP_REQ, + /* Reset as side-effect of startup sequence */ + CHIPSET_RESET_INIT, + CHIPSET_RESET_COUNT, +}; + +/* + * Hard shutdowns are logged on the same path as resets. + */ +enum chipset_shutdown_reason { + CHIPSET_SHUTDOWN_BEGIN = 1 << 15, + CHIPSET_SHUTDOWN_POWERFAIL = CHIPSET_SHUTDOWN_BEGIN, + /* Forcing a shutdown as part of EC initialization */ + CHIPSET_SHUTDOWN_INIT, + /* Custom reason on a per-board basis. */ + CHIPSET_SHUTDOWN_BOARD_CUSTOM, + /* This is a reason to inhibit startup, not cause shut down. */ + CHIPSET_SHUTDOWN_BATTERY_INHIBIT, + /* A power_wait_signal is being asserted */ + CHIPSET_SHUTDOWN_WAIT, + /* Critical battery level. */ + CHIPSET_SHUTDOWN_BATTERY_CRIT, + /* Because you told me to. */ + CHIPSET_SHUTDOWN_CONSOLE_CMD, + /* Forcing a shutdown to effect entry to G3. */ + CHIPSET_SHUTDOWN_G3, + /* Force shutdown due to over-temperature. */ + CHIPSET_SHUTDOWN_THERMAL, + /* Force a chipset shutdown from the power button through EC */ + CHIPSET_SHUTDOWN_BUTTON, + + CHIPSET_SHUTDOWN_COUNT, +}; + #ifdef HAS_TASK_CHIPSET /** @@ -70,12 +130,12 @@ void chipset_throttle_cpu(int throttle); * This is intended for use when the system is too hot or battery power is * critical. */ -void chipset_force_shutdown(void); +void chipset_force_shutdown(enum chipset_shutdown_reason reason); /** * Reset the CPU and/or chipset. */ -void chipset_reset(void); +void chipset_reset(enum chipset_reset_reason reason); /** * Interrupt handler to power GPIO inputs. @@ -102,8 +162,11 @@ static inline int chipset_in_state(int state_mask) static inline void chipset_exit_hard_off(void) { } static inline void chipset_throttle_cpu(int throttle) { } -static inline void chipset_force_shutdown(void) { } -static inline void chipset_reset(void) { } +static inline void chipset_force_shutdown(enum chipset_shutdown_reason reason) +{ +} + +static inline void chipset_reset(enum chipset_reset_reason reason) { } static inline void power_interrupt(enum gpio_signal signal) { } static inline void chipset_handle_espi_reset_assert(void) { } static inline void chipset_handle_reboot(void) { } @@ -139,4 +202,18 @@ void chipset_reset_request_interrupt(enum gpio_signal signal); */ void chipset_power_signal_interrupt(enum gpio_signal signal); + +#ifdef CONFIG_CMD_AP_RESET_LOG + +/** + * Report that the AP is being reset to the reset log. + */ +void report_ap_reset(enum chipset_shutdown_reason reason); + +#else + +static inline void report_ap_reset(enum chipset_shutdown_reason reason) { } + +#endif /* !CONFIG_CMD_AP_RESET_LOG */ + #endif /* __CROS_EC_CHIPSET_H */ |