diff --git a/src/soc/intel/pantherlake/romstage/ux.c b/src/soc/intel/pantherlake/romstage/ux.c index 5f511a2827..4e346f439f 100644 --- a/src/soc/intel/pantherlake/romstage/ux.c +++ b/src/soc/intel/pantherlake/romstage/ux.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include @@ -10,6 +11,43 @@ #include "ux.h" +#if CONFIG(FSP_VGA_MODE12) +void soc_set_vga_mode12_buffer(FSPM_UPD *fspm_upd, uintptr_t buffer) +{ + fspm_upd->FspmConfig.VgaGraphicsMode12ImagePtr = buffer; +} +#endif + +static void setup_vga_mode12_params(FSP_M_CONFIG *m_cfg, enum ux_locale_msg id) +{ + struct soc_intel_common_config *common_config = chip_get_common_soc_structure(); + unsigned char *vga_bitmap_buffer = (unsigned char *)(uintptr_t)m_cfg->VgaGraphicsMode12ImagePtr; + enum lb_fb_orientation current_orientation = common_config->panel_orientation; + if (!vga_bitmap_buffer) { + return; + } + int img_width = VGA12_WIDTH; + int img_height = VGA12_HEIGHT; + if (!m_cfg->LidStatus) + current_orientation = LB_FB_ORIENTATION_NORMAL; + render_text_to_bitmap_buffer(vga_bitmap_buffer, + current_orientation, + ux_locales_get_text(id), + &img_width, &img_height); + int img_size = img_width * img_height / 8; // Image is a bitmap + // Duplicate the first plane data to all other planes + for (int i = 1; i < CONFIG_FSP_VGA_MODE12_BPP; i++) + memcpy(vga_bitmap_buffer + (i * img_size), + vga_bitmap_buffer, + img_size); + + m_cfg->LogoPixelHeight = img_height; + m_cfg->LogoPixelWidth = img_width; + m_cfg->LogoXPosition = (VGA12_WIDTH - img_width) / 2; + m_cfg->LogoYPosition = (VGA12_HEIGHT - img_height) / 2; + m_cfg->VgaInitControl |= VGA_INIT_CONTROL_MODE12; +} + static bool ux_inform_user_of_operation(const char *name, enum ux_locale_msg id, FSPM_UPD *mupd) { @@ -55,6 +93,9 @@ static bool ux_inform_user_of_operation(const char *name, enum ux_locale_msg id, 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); + if (CONFIG(FSP_VGA_MODE12)) + setup_vga_mode12_params(m_cfg, id); + ux_done = true; timestamp_add_now(TS_ESOL_END); diff --git a/src/soc/intel/pantherlake/romstage/ux.h b/src/soc/intel/pantherlake/romstage/ux.h index 85a641dec8..abdaa86eec 100644 --- a/src/soc/intel/pantherlake/romstage/ux.h +++ b/src/soc/intel/pantherlake/romstage/ux.h @@ -10,6 +10,7 @@ bool ux_inform_user_of_poweroff_operation(const char *name, FSPM_UPD *mupd); /* VGA initialization configuration */ #define VGA_INIT_CONTROL_ENABLE BIT(0) -#define VGA_INIT_DISABLE_ANIMATION BIT(4) +#define VGA_INIT_CONTROL_MODE12 BIT(1) +#define VGA_INIT_DISABLE_ANIMATION BIT(4) #endif /* _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ */