lib: Introduce a new function bmp_load_logo_by_type()

This patch introduces `bmp_load_logo_by_type()` to allow loading a
specific BMP logo from CBFS based on `enum bootsplash_type`.

Now, bmp_load_logo() leverages bmp_load_logo_by_type() with the
system-determined logo type. The new bmp_load_logo_by_type() function
provides a direct interface to load any specified BMP by `enum
bootsplash_type`, which is beneficial for scenarios requiring explicit
logo selection.

BUG=b:423591644
TEST=Able to build and boot google/fatcat. Ensure FW splash screen looks
proper.

Change-Id: I2473f7d48ca2d196ced89d81391cf387627a2f86
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88013
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2025-06-09 21:01:49 +05:30
commit be5609bdaf
2 changed files with 13 additions and 9 deletions

View file

@ -31,6 +31,7 @@ void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
*/
const char *bmp_logo_filename(void);
void *bmp_load_logo(size_t *logo_size);
void *bmp_load_logo_by_type(enum bootsplash_type type, size_t *logo_size);
void bmp_release_logo(void);
/*
* Platform specific callbacks for power-off handling.

View file

@ -29,11 +29,9 @@ static const char *bmp_get_logo_filename(enum bootsplash_type type)
return bootsplash_list[type];
}
void *bmp_load_logo(size_t *logo_size)
void *bmp_load_logo_by_type(enum bootsplash_type type, size_t *logo_size)
{
void *logo_buffer;
const char *logo_name;
enum bootsplash_type type = BOOTSPLASH_CENTER;
/* CBMEM is locked for S3 resume path. */
if (acpi_is_wakeup_s3())
@ -47,18 +45,23 @@ void *bmp_load_logo(size_t *logo_size)
if (!logo_buffer)
return NULL;
if (platform_is_low_battery_shutdown_needed())
type = BOOTSPLASH_LOW_BATTERY;
logo_name = bmp_get_logo_filename(type);
*logo_size = cbfs_load(logo_name, logo_buffer, 1 * MiB);
*logo_size = cbfs_load(bmp_get_logo_filename(type), logo_buffer, 1 * MiB);
if (*logo_size == 0)
return NULL;
return logo_buffer;
}
void *bmp_load_logo(size_t *logo_size)
{
enum bootsplash_type type = BOOTSPLASH_CENTER;
if (platform_is_low_battery_shutdown_needed())
type = BOOTSPLASH_LOW_BATTERY;
return bmp_load_logo_by_type(type, logo_size);
}
void bmp_release_logo(void)
{
if (logo_entry)