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/+/86224?usp=email )
Change subject: soc/intel/adl: Display low battery message on screen ......................................................................
soc/intel/adl: Display low battery message on screen
This commit adds a function ux_inform_user_of_poweroff_operation to display a message on the screen when the system is powering off due to critically low battery. The message is centered on the screen and displays a localized string "Battery critically low. Shutting down". If no localized string is found, a default English message is displayed.
This implementation rely on CHROMEOS_ENABLE_ESOL Kconfig which is use to render text message for early sign-off life.
BUG=b:339673254 TEST=Able to capture the eventlog for low battery boot event.
Change-Id: I3b24d2c89ade8cc62b7e47c487d52d47b7f3376d Signed-off-by: Subrata Banik subratabanik@google.com --- M src/soc/intel/alderlake/romstage/ux.c M src/soc/intel/alderlake/romstage/ux.h 2 files changed, 24 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/86224/1
diff --git a/src/soc/intel/alderlake/romstage/ux.c b/src/soc/intel/alderlake/romstage/ux.c index 0fb73c18..b79298d 100644 --- a/src/soc/intel/alderlake/romstage/ux.c +++ b/src/soc/intel/alderlake/romstage/ux.c @@ -34,3 +34,26 @@ timestamp_add_now(TS_ESOL_END); return true; } + +bool ux_inform_user_of_poweroff_operation(const char *name) +{ + timestamp_add_now(TS_ESOL_START); + + if (!CONFIG(CHROMEOS_ENABLE_ESOL) || + !early_graphics_init()) { + timestamp_add_now(TS_ESOL_END); + return false; + } + + printk(BIOS_INFO, "Informing user on-display of %s.\n", name); + + const char *text = ux_locales_get_text(UX_MEMORY_TRAINING_DESC); + /* No localized text found; fallback to built-in English. */ + if (!text) + text = "Battery critically low. Shutting down"; + vga_write_text(VGA_TEXT_CENTER, VGA_TEXT_HORIZONTAL_MIDDLE, + (const unsigned char *)text); + ux_locales_unmap(); + timestamp_add_now(TS_ESOL_END); + return true; +} diff --git a/src/soc/intel/alderlake/romstage/ux.h b/src/soc/intel/alderlake/romstage/ux.h index 14c10e7..c556c63 100644 --- a/src/soc/intel/alderlake/romstage/ux.h +++ b/src/soc/intel/alderlake/romstage/ux.h @@ -4,5 +4,6 @@ #define _SOC_INTEL_ALDERLAKE_ROMSTAGE_UX_H_
bool ux_inform_user_of_update_operation(const char *name); +bool ux_inform_user_of_poweroff_operation(const char *name);
#endif /* _SOC_INTEL_ALDERLAKE_ROMSTAGE_UX_H_ */