From 3130c410c6b4e2f8608de1c0f8f73b0e7124b033 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 18 Feb 2025 12:27:43 +0530 Subject: [PATCH] soc/intel/pantherlake: Implement UX help APIs for eSOL handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86509 Reviewed-by: Kapil Porwal Reviewed-by: Jérémy Compostella Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) --- .../intel/pantherlake/romstage/Makefile.mk | 1 + src/soc/intel/pantherlake/romstage/ux.c | 67 +++++++++++++++++++ src/soc/intel/pantherlake/romstage/ux.h | 9 +++ 3 files changed, 77 insertions(+) create mode 100644 src/soc/intel/pantherlake/romstage/ux.c create mode 100644 src/soc/intel/pantherlake/romstage/ux.h diff --git a/src/soc/intel/pantherlake/romstage/Makefile.mk b/src/soc/intel/pantherlake/romstage/Makefile.mk index 99c1d2ca25..999241c738 100644 --- a/src/soc/intel/pantherlake/romstage/Makefile.mk +++ b/src/soc/intel/pantherlake/romstage/Makefile.mk @@ -4,3 +4,4 @@ romstage-y += fsp_params.c 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 0000000000..9fcb418157 --- /dev/null +++ b/src/soc/intel/pantherlake/romstage/ux.c @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +#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 0000000000..bcee87f24d --- /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_ */