From be5609bdaf082295a7b9f49a4f0d14a201f96fb9 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 9 Jun 2025 21:01:49 +0530 Subject: [PATCH] lib: Introduce a new function `bmp_load_logo_by_type()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/88013 Reviewed-by: Kapil Porwal Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) --- src/include/bootsplash.h | 1 + src/lib/bmp_logo.c | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/include/bootsplash.h b/src/include/bootsplash.h index f935476e44..9dffc28eb8 100644 --- a/src/include/bootsplash.h +++ b/src/include/bootsplash.h @@ -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. diff --git a/src/lib/bmp_logo.c b/src/lib/bmp_logo.c index 9822ca00f3..b62cb867fa 100644 --- a/src/lib/bmp_logo.c +++ b/src/lib/bmp_logo.c @@ -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)