coreboot/src/lib/bmp_logo.c
Subrata Banik 4373eea5d8 {lib, drivers/intel}: Add splash screen footer
This commit introduces the `SPLASH_SCREEN_FOOTER` Kconfig option,
enabling a custom footer image or logo on the firmware splash screen.
This provides an additional branding opportunity for device
manufacturers.

`soc_load_logo_by_coreboot()` now conditionally loads and renders
`footer_logo.bmp` when this option is enabled. The footer logo is
positioned at the bottom of the screen.

A new `SPLASH_SCREEN_FOOTER_LOGO_PATH` Kconfig option is added to
define the footer logo's file path. It defaults to a mainboard-specific
location. `Makefile.mk` is updated to ensure this logo is included in
the CBFS.

This additional branding is made possible by rendering bitmaps using
coreboot's native implementation (`USE_COREBOOT_FOR_BMP_RENDERING`).
FSP currently lacks the necessary callbacks to support this feature.

Currently, the OEM footer branding will appear even when the
system is booting in low-battery mode. A planned update will fix this
by exiting early from the boot process, preventing the footer from
showing and conserving power.

BUG=b:423591644
TEST=Able to display custom footer logo on boot.

Change-Id: I57f8af910e8b8f56e8a4a88f8cca6d60fad380b6
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88029
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-06-23 02:04:26 +00:00

71 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <bootsplash.h>
#include <cbfs.h>
#include <cbmem.h>
#include <stdint.h>
#include <vendorcode/google/chromeos/chromeos.h>
static const struct cbmem_entry *logo_entry;
/* 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",
[BOOTSPLASH_FOOTER] = "footer_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)
{
/* Override `BOOTSPLASH_CENTER` logo name if required */
if ((type == BOOTSPLASH_CENTER) && CONFIG(HAVE_CUSTOM_BMP_LOGO))
return bmp_logo_filename();
return bootsplash_list[type];
}
void *bmp_load_logo_by_type(enum bootsplash_type type, size_t *logo_size)
{
void *logo_buffer;
/* CBMEM is locked for S3 resume path. */
if (acpi_is_wakeup_s3())
return NULL;
logo_entry = cbmem_entry_add(CBMEM_ID_BMP_LOGO, 1 * MiB);
if (!logo_entry)
return NULL;
logo_buffer = cbmem_entry_start(logo_entry);
if (!logo_buffer)
return NULL;
*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)
cbmem_entry_remove(logo_entry);
logo_entry = NULL;
}