summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-01-09 20:38:43 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-02-09 07:52:31 +0000
commit4949a3dd626560aa504cee18d936d0d7602becfa (patch)
treeaa804caed95d613a0c9a1def5c44debfa22ef1ab /src/lib
parent1aaa72836d1a51b583b7a4352bceff72ab6ff091 (diff)
downloadcoreboot-4949a3dd626560aa504cee18d936d0d7602becfa.tar.xz
drivers/intel/fsp1_1,fsp2_0: Refactor logo display
Hide the detail of allocation from cbmem from the FSP. Loading of a BMP logo file from CBFS is not tied to FSP version and we do not need two copies of the code, move it under lib/. Change-Id: I909f2771af534993cf8ba99ff0acd0bbd2c78f04 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50359 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc1
-rw-r--r--src/lib/bmp_logo.c37
2 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 8424cbfac3..074cb2a1f2 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -139,6 +139,7 @@ ramstage-y += stack.c
ramstage-y += hexstrtobin.c
ramstage-y += wrdd.c
ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
+ramstage-$(CONFIG_BMP_LOGO) += bmp_logo.c
ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c
ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
diff --git a/src/lib/bmp_logo.c b/src/lib/bmp_logo.c
new file mode 100644
index 0000000000..330ed6fff4
--- /dev/null
+++ b/src/lib/bmp_logo.c
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <acpi/acpi.h>
+#include <bootsplash.h>
+#include <cbfs.h>
+#include <cbmem.h>
+#include <stdint.h>
+
+static const struct cbmem_entry *logo_entry;
+
+void bmp_load_logo(uint32_t *logo_ptr, uint32_t *logo_size)
+{
+ void *logo_buffer;
+
+ /* CBMEM is locked for S3 resume path. */
+ if (acpi_is_wakeup_s3())
+ return;
+
+ logo_entry = cbmem_entry_add(CBMEM_ID_FSP_LOGO, 1 * MiB);
+ if (!logo_entry)
+ return;
+
+ logo_buffer = cbmem_entry_start(logo_entry);
+ if (!logo_buffer)
+ return;
+
+ *logo_size = cbfs_load("logo.bmp", logo_buffer, 1 * MiB);
+ if (*logo_size)
+ *logo_ptr = (uintptr_t)logo_buffer;
+}
+
+void bmp_release_logo(void)
+{
+ if (logo_entry)
+ cbmem_entry_remove(logo_entry);
+ logo_entry = NULL;
+}