lib: Add support for different bootsplash types

This commit introduces an enumerated type `bootsplash_type` to
differentiate between various bootsplash logos, such as
`BOOTSPLASH_LOW_BATTERY` and `BOOTSPLASH_CENTER`.

A `bootsplash_list` array is added to map these types to their
corresponding default filenames. A new function,
`bmp_get_logo_filename`, is provided to retrieve the correct logo
filename based on the specified bootsplash type. This function also
handles overriding the `BOOTSPLASH_CENTER` logo name if
`CONFIG(HAVE_CUSTOM_BMP_LOGO)` is enabled.

The `bmp_load_logo` function is updated to utilize the new
`bootsplash_type` and `bmp_get_logo_filename` to dynamically select the
appropriate logo for display. This change streamlines logo management
and improves flexibility for different boot scenarios.

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

Change-Id: I882deda56b5d30bb15cc7def408c4ea479ffd6ba
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88052
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2025-06-11 14:29:16 +05:30
commit a1dbb4076c
2 changed files with 31 additions and 7 deletions

View file

@ -5,6 +5,16 @@
#include <types.h>
enum bootsplash_type {
/* Indicates a low battery bootsplash logo. */
BOOTSPLASH_LOW_BATTERY,
/* Indicates a Main OEM defined bootsplash logo for center of the splash screen. */
BOOTSPLASH_CENTER,
/* It's used to determine the total number of bootsplash types. */
BOOTSPLASH_MAX_NUM,
};
/**
* Sets up the framebuffer with the bootsplash.jpg from cbfs.
* Returns 0 on success

View file

@ -9,17 +9,31 @@
static const struct cbmem_entry *logo_entry;
#if !CONFIG(HAVE_CUSTOM_BMP_LOGO)
const char *bmp_logo_filename(void)
/* Mapping of different bootsplash logo name based on bootsplash type */
static const char *bootsplash_list[BOOTSPLASH_MAX_NUM] = {
[BOOTSPLASH_LOW_BATTERY] = "low_battery.bmp",
[BOOTSPLASH_CENTER] = "logo.bmp"
};
/*
* Return the appropriate logo filename based on the bootsplash type.
* This will be the default filename from 'bootsplash_list' or the
* custom one if it was overridden for BOOTSPLASH_OEM.
*/
static const char *bmp_get_logo_filename(enum bootsplash_type type)
{
return "logo.bmp";
/* Override `BOOTSPLASH_CENTER` logo name if required */
if ((type == BOOTSPLASH_CENTER) && CONFIG(HAVE_CUSTOM_BMP_LOGO))
return bmp_logo_filename();
return bootsplash_list[type];
}
#endif
void *bmp_load_logo(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())
@ -34,9 +48,9 @@ void *bmp_load_logo(size_t *logo_size)
return NULL;
if (platform_is_low_battery_shutdown_needed())
logo_name = "low_battery.bmp";
else
logo_name = bmp_logo_filename();
type = BOOTSPLASH_LOW_BATTERY;
logo_name = bmp_get_logo_filename(type);
*logo_size = cbfs_load(logo_name, logo_buffer, 1 * MiB);
if (*logo_size == 0)