Attention is currently required from: Dinesh Gehlot, Intel coreboot Reviewers, Jayvik Desai, Kapil Porwal, Nick Vaccaro.
Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86227?usp=email )
Change subject: soc/intel/adl: Handle critical low battery early in romstage ......................................................................
soc/intel/adl: Handle critical low battery early in romstage
This commit implements early handling of critical low battery conditions in the romstage for Alder Lake platforms.
A message is displayed to the user via ux_inform_user_of_poweroff_operation. A short delay is introduced to allow the user to see the message. A low battery event is logged. The system is shut down via the Chrome EC.
This early handling prevents the system from proceeding with boot (while performing firmware update) if the battery is critically low and ensures a clean shutdown. This is particularly important for ChromeOS devices.
BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown.
Change-Id: Ib4be86ed17818ee05b7bec0337a90f80017183c2 Signed-off-by: Subrata Banik subratabanik@google.com --- M src/soc/intel/alderlake/romstage/fsp_params.c 1 file changed, 18 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/86227/1
diff --git a/src/soc/intel/alderlake/romstage/fsp_params.c b/src/soc/intel/alderlake/romstage/fsp_params.c index 4a03b74..0f02818 100644 --- a/src/soc/intel/alderlake/romstage/fsp_params.c +++ b/src/soc/intel/alderlake/romstage/fsp_params.c @@ -5,12 +5,15 @@ #include <cpu/x86/msr.h> #include <cpu/intel/common/common.h> #include <cpu/intel/cpu_ids.h> +#include <delay.h> #include <device/device.h> #include <drivers/wifi/generic/wifi.h> +#include <ec/google/chromeec/ec.h> #include <elog.h> #include <fsp/fsp_debug_event.h> #include <fsp/util.h> #include <gpio.h> +#include <halt.h> #include <intelbasecode/debug_feature.h> #include <intelblocks/cpulib.h> #include <intelblocks/cse.h> @@ -413,6 +416,18 @@ debug_get_pch_cpu_tracehub_modes(&mupd->CpuTraceHubMode, &mupd->PchTraceHubMode); }
+static void is_early_critical_shutdown_needed(void) +{ + if (CONFIG(EC_GOOGLE_CHROMEEC) && google_chromeec_is_below_critical_threshold()) { + ux_inform_user_of_poweroff_operation("critical battery"); + /* Allow user to notice the low battery indicator before poweroff */ + delay(3); + elog_add_event_byte(ELOG_TYPE_LOW_BATTERY_INDICATOR, ELOG_FW_ISSUE_SHUTDOWN); + /* Send Shutdown command to EC */ + google_chromeec_reboot(EC_REBOOT_COLD_AP_OFF,0); + } +} + static void fill_fspm_sign_of_life(FSP_M_CONFIG *m_cfg, FSPM_ARCH_UPD *arch_upd) { @@ -427,6 +442,9 @@ * user with an on-screen text message. */ if (!arch_upd->NvsBufferPtr) { + if (CONFIG(CHROMEOS_LOW_BATTERY_INDICATOR_SCREEN_EARLY)) + is_early_critical_shutdown_needed(); + esol_required = true; name = "memory training"; elog_add_event_byte(ELOG_TYPE_FW_EARLY_SOL, ELOG_FW_EARLY_SOL_MRC);