drivers: Replace multiple fill_lb_framebuffer with single instance
Currently it's not possible to add multiple graphics drivers into
one coreboot image. This patch series will fix this issue by providing
a single API that multiple graphics drivers can use.
This is required for platforms that have two graphic cards, but
different graphic drivers, like Intel+Aspeed on server platforms or
Intel+Nvidia on consumer notebooks.
The goal is to remove duplicated fill_fb_framebuffer(), the advertisment
of multiple independent framebuffers in coreboot tables, and better
runtime/build time graphic configuration options.
Replace all duplications of fill_fb_framebuffer and provide a single one
in edid_fill_fb.c. Should not change the current behaviour as still only
one graphic driver can be active at time.
Change-Id: Ife507f7e7beaf59854e533551b4b87ea6980c1f4
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39003
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index abac7fb..b5dd3c3 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -18,7 +18,6 @@
romstage-y += romstage.c
romstage-$(CONFIG_MMA) += mma_core.c
-ramstage-$(CONFIG_RUN_FSP_GOP) += fsp_gop.c
ramstage-y += fsp_relocate.c
ramstage-y += fsp_util.c
ramstage-y += hob.c
diff --git a/src/drivers/intel/fsp1_1/fsp_gop.c b/src/drivers/intel/fsp1_1/fsp_gop.c
deleted file mode 100644
index 4fcf1e3..0000000
--- a/src/drivers/intel/fsp1_1/fsp_gop.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <boot/coreboot_tables.h>
-#include <console/console.h>
-#include <fsp/util.h>
-
-int fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
-{
- VOID *hob_list_ptr;
- hob_list_ptr = get_hob_list();
- const EFI_GUID vbt_guid = EFI_PEI_GRAPHICS_INFO_HOB_GUID;
- u32 *vbt_hob;
- EFI_PEI_GRAPHICS_INFO_HOB *vbt_gop;
- vbt_hob = get_next_guid_hob(&vbt_guid, hob_list_ptr);
- if (vbt_hob == NULL) {
- printk(BIOS_ERR, "FSP_ERR: Graphics Data HOB is not present\n");
- return -1;
- }
- printk(BIOS_DEBUG, "FSP_DEBUG: Graphics Data HOB present\n");
- vbt_gop = GET_GUID_HOB_DATA(vbt_hob);
-
- framebuffer->physical_address = vbt_gop->FrameBufferBase;
- framebuffer->x_resolution = vbt_gop->GraphicsMode.HorizontalResolution;
- framebuffer->y_resolution = vbt_gop->GraphicsMode.VerticalResolution;
- framebuffer->bytes_per_line = vbt_gop->GraphicsMode.PixelsPerScanLine
- * 4;
- framebuffer->bits_per_pixel = 32;
- framebuffer->red_mask_pos = 16;
- framebuffer->red_mask_size = 8;
- framebuffer->green_mask_pos = 8;
- framebuffer->green_mask_size = 8;
- framebuffer->blue_mask_pos = 0;
- framebuffer->blue_mask_size = 8;
- framebuffer->reserved_mask_pos = 24;
- framebuffer->reserved_mask_size = 8;
-
- return 0;
-}
diff --git a/src/drivers/intel/fsp1_1/ramstage.c b/src/drivers/intel/fsp1_1/ramstage.c
index cd4a1e6..eb226db 100644
--- a/src/drivers/intel/fsp1_1/ramstage.c
+++ b/src/drivers/intel/fsp1_1/ramstage.c
@@ -5,6 +5,7 @@
#include <console/console.h>
#include <fsp/ramstage.h>
#include <fsp/util.h>
+#include <framebuffer_info.h>
#include <lib.h>
#include <stage_cache.h>
#include <string.h>
@@ -116,6 +117,28 @@
gfx_set_init_done(1);
#endif
+ if (CONFIG(RUN_FSP_GOP)) {
+ const EFI_GUID vbt_guid = EFI_PEI_GRAPHICS_INFO_HOB_GUID;
+ u32 *vbt_hob;
+
+ void *hob_list_ptr = get_hob_list();
+ vbt_hob = get_next_guid_hob(&vbt_guid, hob_list_ptr);
+ if (vbt_hob == NULL) {
+ printk(BIOS_ERR, "FSP_ERR: Graphics Data HOB is not present\n");
+ } else {
+ EFI_PEI_GRAPHICS_INFO_HOB *gop;
+
+ printk(BIOS_DEBUG, "FSP_DEBUG: Graphics Data HOB present\n");
+ gop = GET_GUID_HOB_DATA(vbt_hob);
+
+ fb_add_framebuffer_info(gop->FrameBufferBase,
+ gop->GraphicsMode.HorizontalResolution,
+ gop->GraphicsMode.VerticalResolution,
+ gop->GraphicsMode.PixelsPerScanLine * 4,
+ 32);
+ }
+ }
+
display_hob_info(fsp_info_header);
soc_after_silicon_init();
}