diff --git a/src/soc/intel/common/reset.c b/src/soc/intel/common/reset.c index c6c394bd44..3fefa57d30 100644 --- a/src/soc/intel/common/reset.c +++ b/src/soc/intel/common/reset.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include @@ -21,3 +23,13 @@ void do_board_reset(void) { full_reset(); } + +void do_low_battery_poweroff(void) +{ + if (CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR)) { + elog_add_event_byte(ELOG_TYPE_LOW_BATTERY_INDICATOR, ELOG_FW_ISSUE_SHUTDOWN); + delay(CONFIG_PLATFORM_LOW_BATTERY_SHUTDOWN_DELAY_SEC); + } + + poweroff(); +} diff --git a/src/soc/intel/common/reset.h b/src/soc/intel/common/reset.h index 658223c32a..8331853023 100644 --- a/src/soc/intel/common/reset.h +++ b/src/soc/intel/common/reset.h @@ -25,4 +25,11 @@ __noreturn void global_reset(void); */ efi_return_status_t fsp_get_pch_reset_status(void); +/* + * Issue power off due to low battery + * + * Call this function to power off the platform if the battery level is critically low. + */ +void do_low_battery_poweroff(void); + #endif /* _INTEL_COMMON_RESET_H_ */