Paz Zcharya has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86566?usp=email )
Change subject: refactor: Consolidate bmp_logo_filename() logic ......................................................................
refactor: Consolidate bmp_logo_filename() logic
Function bmp_logo_filename() is intended to be the sole method for selecting which logo will be displayed. Currently, however, this logic is distributed across two locations: bmp_load_logo() and bmp_logo_filename(). Consolidate all logo selection logic into bmp_logo_filename() exclusively.
Furthermore, the inclusion of <fsp/api.h> is specific to the FSP environment and compromises cross-compatibility. Therefore, add conditional compilation directives to ensure that this header is only included when appropriate.
Change-Id: Ifd91af411aff6ccd6f5974a0b6c849794b9a2794 Signed-off-by: Paz Zcharya pazz@google.com --- M src/lib/bmp_logo.c M src/vendorcode/google/chromeos/splash.c 2 files changed, 9 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/86566/1
diff --git a/src/lib/bmp_logo.c b/src/lib/bmp_logo.c index 5a5adaa..26fbe5b 100644 --- a/src/lib/bmp_logo.c +++ b/src/lib/bmp_logo.c @@ -4,7 +4,6 @@ #include <bootsplash.h> #include <cbfs.h> #include <cbmem.h> -#include <fsp/api.h> #include <stdint.h> #include <vendorcode/google/chromeos/chromeos.h>
@@ -20,7 +19,7 @@ void *bmp_load_logo(size_t *logo_size) { void *logo_buffer; - const char *logo_name; + const char *logo_name = bmp_logo_filename();
/* CBMEM is locked for S3 resume path. */ if (acpi_is_wakeup_s3()) @@ -34,11 +33,6 @@ if (!logo_buffer) return NULL;
- if (platform_is_low_battery_shutdown_needed()) - logo_name = "low_battery.bmp"; - else - logo_name = bmp_logo_filename(); - *logo_size = cbfs_load(logo_name, logo_buffer, 1 * MiB); if (*logo_size == 0) return NULL; diff --git a/src/vendorcode/google/chromeos/splash.c b/src/vendorcode/google/chromeos/splash.c index f63f526..6da6bba 100644 --- a/src/vendorcode/google/chromeos/splash.c +++ b/src/vendorcode/google/chromeos/splash.c @@ -3,8 +3,16 @@ #include <bootsplash.h> #include <vendorcode/google/chromeos/chromeos.h>
+#if CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR) +#include <fsp/api.h> +#endif + const char *bmp_logo_filename(void) { +#if CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR) + if (platform_is_low_battery_shutdown_needed()) + return "low_battery.bmp"; +#endif if (chromeos_device_branded_plus_hard()) return "cb_plus_logo.bmp"; else if (chromeos_device_branded_plus_soft())