soc/intel/pantherlake/romstage: Configure VGA mode 12 planar buffer

This commit implements the configuration of VGA mode 12 in the
Intel Pantherlake SoC's romstage. It integrates the newly added
text rendering API to display user messages using a planar buffer
instead of the standard VGA message string.

The changes include:
- A call to `render_text_to_bitmap_buffer()` to draw the message
  on the bitmap buffer.
- Determining the display orientation from the common SoC
  configuration, with an override for a closed lid.
- Calculating and setting the correct position of the rendered
  text in the VGA buffer.
- Duplicating the single-plane bitmap data to all required planes
  for VGA mode 12.
- Setting the `VGA_INIT_CONTROL_MODE12` bit in the FSP-M UPD
  to inform FSP to use the new mode.
- Implementing the `soc_set_vga_mode12_buffer()` API to set the
  corresponding FSP-M UPD for VGA mode12 buffer address.

BUG=b:406725440
TEST=Verify VGA text rotation on Google/Felino.

Change-Id: Ic69fff0479020a31c7e6f0c52b4bdb25b1483bb9
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89091
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Kapil Porwal 2025-09-07 19:46:07 +05:30 committed by Matt DeVillier
commit 824992ddef
2 changed files with 43 additions and 1 deletions

View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <bootmode.h>
#include <bootsplash.h>
#include <console/console.h>
#include <fsp/util.h>
#include <timestamp.h>
@ -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);

View file

@ -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_ */