Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/86509?usp=email )
Change subject: soc/intel/pantherlake: Implement UX help APIs for eSOL handling ......................................................................
soc/intel/pantherlake: Implement UX help APIs for eSOL handling
This patch refactors the eSOL implementation for Panther Lake and introduces two new APIs, mirroring those in Alder Lake, to manage:
- Low battery shutdown notifications - Firmware update memory training
BUG=b:397302064 TEST=Built and booted google/fatcat successfully.
Change-Id: I14229af4a4920414f3c572576d67fa6d665681cd Signed-off-by: Subrata Banik subratabanik@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/86509 Reviewed-by: Kapil Porwal kapilporwal@google.com Reviewed-by: Jérémy Compostella jeremy.compostella@intel.com Reviewed-by: Jayvik Desai jayvik@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/intel/pantherlake/romstage/Makefile.mk A src/soc/intel/pantherlake/romstage/ux.c A src/soc/intel/pantherlake/romstage/ux.h 3 files changed, 77 insertions(+), 0 deletions(-)
Approvals: Kapil Porwal: Looks good to me, approved Jayvik Desai: Looks good to me, approved Jérémy Compostella: Looks good to me, but someone else must approve build bot (Jenkins): Verified
diff --git a/src/soc/intel/pantherlake/romstage/Makefile.mk b/src/soc/intel/pantherlake/romstage/Makefile.mk index 99c1d2c..999241c 100644 --- a/src/soc/intel/pantherlake/romstage/Makefile.mk +++ b/src/soc/intel/pantherlake/romstage/Makefile.mk @@ -4,3 +4,4 @@ romstage-y += ../../../../cpu/intel/car/romstage.c romstage-y += romstage.c romstage-y += systemagent.c +romstage-y += ux.c diff --git a/src/soc/intel/pantherlake/romstage/ux.c b/src/soc/intel/pantherlake/romstage/ux.c new file mode 100644 index 0000000..9fcb418 --- /dev/null +++ b/src/soc/intel/pantherlake/romstage/ux.c @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <bootmode.h> +#include <console/console.h> +#include <fsp/util.h> +#include <timestamp.h> +#include <ux_locales.h> + +#include "ux.h" + +static bool ux_inform_user_of_operation(const char *name, enum ux_locale_msg id, + FSPM_UPD *mupd) +{ + timestamp_add_now(TS_ESOL_START); + + if (!CONFIG(CHROMEOS_ENABLE_ESOL)) { + timestamp_add_now(TS_ESOL_END); + return false; + } + + FSP_M_CONFIG *m_cfg = &mupd->FspmConfig; + void *vbt; + size_t vbt_size; + static bool ux_done = false; + + /* + * Prevents multiple VGA text messages from being rendered during the boot process. + * + * This function is designed to be called only once. Subsequent calls are intentionally + * ignored to avoid overwriting previously displayed messages. For example, if a + * low-battery shutdown notification is scheduled, a later call with a firmware + * update notification could result in the low-battery message being lost. + */ + if (ux_done) { + timestamp_add_now(TS_ESOL_END); + return true; + } + + printk(BIOS_INFO, "Informing user on-display of %s.\n", name); + + vbt = cbfs_map("vbt.bin", &vbt_size); + if (!vbt) { + printk(BIOS_ERR, "Could not load vbt.bin\n"); + return false; + } + + m_cfg->VgaInitControl = 1; + m_cfg->VbtPtr = (efi_uintn_t)vbt; + m_cfg->VbtSize = vbt_size; + m_cfg->LidStatus = CONFIG(VBOOT_LID_SWITCH) ? get_lid_switch() : CONFIG(RUN_FSP_GOP); + m_cfg->VgaMessage = (efi_uintn_t)ux_locales_get_text(id); + + ux_done = true; + + timestamp_add_now(TS_ESOL_END); + return true; +} + +bool ux_inform_user_of_update_operation(const char *name, FSPM_UPD *mupd) +{ + return ux_inform_user_of_operation(name, UX_LOCALE_MSG_MEMORY_TRAINING, mupd); +} + +bool ux_inform_user_of_poweroff_operation(const char *name, FSPM_UPD *mupd) +{ + return ux_inform_user_of_operation(name, UX_LOCALE_MSG_LOW_BATTERY, mupd); +} diff --git a/src/soc/intel/pantherlake/romstage/ux.h b/src/soc/intel/pantherlake/romstage/ux.h new file mode 100644 index 0000000..bcee87f --- /dev/null +++ b/src/soc/intel/pantherlake/romstage/ux.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ +#define _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ + +bool ux_inform_user_of_update_operation(const char *name, FSPM_UPD *mupd); +bool ux_inform_user_of_poweroff_operation(const char *name, FSPM_UPD *mupd); + +#endif /* _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ */