Skip to content

Commit

Permalink
Load UEFI Logo into CBMEM
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Kopeć <[email protected]>
  • Loading branch information
mkopec authored and miczyg1 committed Jul 4, 2023
1 parent 6d7caea commit d62eabf
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#define CBMEM_ID_SMM_COMBUFFER 0x53534d32
#define CBMEM_ID_TYPE_C_INFO 0x54595045
#define CBMEM_ID_MEM_CHIP_INFO 0x5048434D
#define CBMEM_ID_TIANOCORE_LOGO 0x42475254

#define CBMEM_ID_TO_NAME_TABLE \
{ CBMEM_ID_ACPI, "ACPI " }, \
Expand Down Expand Up @@ -157,5 +158,6 @@
{ CBMEM_ID_FSP_LOGO, "FSP LOGO "}, \
{ CBMEM_ID_SMM_COMBUFFER, "SMM COMBUFFER"}, \
{ CBMEM_ID_TYPE_C_INFO, "TYPE_C INFO"},\
{ CBMEM_ID_MEM_CHIP_INFO, "MEM CHIP INFO"}
{ CBMEM_ID_MEM_CHIP_INFO, "MEM CHIP INFO"},\
{ CBMEM_ID_TIANOCORE_LOGO, "UEFI LOGO "}
#endif /* _CBMEM_ID_H_ */
9 changes: 9 additions & 0 deletions src/commonlib/include/commonlib/coreboot_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ enum {
LB_TAG_TYPE_C_INFO = 0x0042,
LB_TAG_ACPI_RSDP = 0x0043,
LB_TAG_PCIE = 0x0044,
LB_TAG_LOGO = 0x00a0,
/* The following options are CMOS-related */
LB_TAG_CMOS_OPTION_TABLE = 0x00c8,
LB_TAG_OPTION = 0x00c9,
Expand Down Expand Up @@ -573,4 +574,12 @@ struct lb_acpi_rsdp {
lb_uint64_t rsdp_pointer; /* Address of the ACPI RSDP */
};

/*
* Bootlogo header for TianoCore boot logo
* * size Contains the size of the BMP file
*/
struct bootlogo_header {
uint64_t size;
} __packed;

#endif
32 changes: 32 additions & 0 deletions src/lib/coreboot_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ static void add_cbmem_pointers(struct lb_header *header)
{CBMEM_ID_FMAP, LB_TAG_FMAP},
{CBMEM_ID_VBOOT_WORKBUF, LB_TAG_VBOOT_WORKBUF},
{CBMEM_ID_TYPE_C_INFO, LB_TAG_TYPE_C_INFO},
{CBMEM_ID_TIANOCORE_LOGO, LB_TAG_LOGO},
};
int i;

Expand Down Expand Up @@ -403,6 +404,37 @@ void __weak lb_board(struct lb_header *header) { /* NOOP */ }
*/
void __weak lb_spi_flash(struct lb_header *header) { /* NOOP */ }


/*
* Allocator for bootlogo that prepends a header to the logo CBMEM entry
*/
static void *logo_cbmem_allocator(void *arg, size_t size, const union cbfs_mdata *unused)
{
struct bootlogo_header header;
void *logo_loc;

header.size = size;
logo_loc = cbmem_entry_start(cbmem_entry_add((uintptr_t)arg, size + sizeof(header)));
memcpy(logo_loc, &header, sizeof(header));
return logo_loc + sizeof(header);
}

/*
* Loads the logo bitmap file from the BOOTSPLASH fmap region into CBMEM
*/
static void tianocore_logo_load(int ignored)
{
size_t logo_size;

cbfs_unverified_area_alloc("BOOTSPLASH",
"logo.bmp",
logo_cbmem_allocator,
(void *)CBMEM_ID_TIANOCORE_LOGO,
&logo_size);
}

CBMEM_READY_HOOK(tianocore_logo_load);

static struct lb_forward *lb_forward(struct lb_header *header,
struct lb_header *next_header)
{
Expand Down

0 comments on commit d62eabf

Please sign in to comment.