diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2020-02-19 12:54:06 +0100 |
---|---|---|
committer | Patrick Rudolph <siro@das-labor.org> | 2020-12-14 08:21:22 +0000 |
commit | 92106b166671a315a2b1e8f5cc467f2fa0823301 (patch) | |
tree | cafe3140a79757b87133b1e12f2420c43e02618c /src/device/oprom | |
parent | a3495c0d7b249ce5cf53335d2036e31f1a86739c (diff) |
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>
Diffstat (limited to 'src/device/oprom')
-rw-r--r-- | src/device/oprom/realmode/x86.c | 52 | ||||
-rw-r--r-- | src/device/oprom/yabel/vbe.c | 50 |
2 files changed, 38 insertions, 64 deletions
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index d230d5cbea..6b80ac5f62 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -12,6 +12,7 @@ #include <pc80/i8254.h> #include <string.h> #include <vbe.h> +#include <framebuffer_info.h> /* we use x86emu's register file representation */ #include <x86emu/regs.h> @@ -208,11 +209,6 @@ static void setup_realmode_idt(void) static vbe_mode_info_t mode_info; static int mode_info_valid; -static int vbe_mode_info_valid(void) -{ - return mode_info_valid; -} - const vbe_mode_info_t *vbe_mode_info(void) { if (!mode_info_valid || !mode_info.vesa.phys_base_ptr) @@ -351,6 +347,24 @@ void vbe_set_graphics(void) } vbe_set_mode(&mode_info); + const struct lb_framebuffer fb = { + .physical_address = mode_info.vesa.phys_base_ptr, + .x_resolution = le16_to_cpu(mode_info.vesa.x_resolution), + .y_resolution = le16_to_cpu(mode_info.vesa.y_resolution), + .bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline), + .bits_per_pixel = mode_info.vesa.bits_per_pixel, + .red_mask_pos = mode_info.vesa.red_mask_pos, + .red_mask_size = mode_info.vesa.red_mask_size, + .green_mask_pos = mode_info.vesa.green_mask_pos, + .green_mask_size = mode_info.vesa.green_mask_size, + .blue_mask_pos = mode_info.vesa.blue_mask_pos, + .blue_mask_size = mode_info.vesa.blue_mask_size, + .reserved_mask_pos = mode_info.vesa.reserved_mask_pos, + .reserved_mask_size = mode_info.vesa.reserved_mask_size, + .orientation = LB_FB_ORIENTATION_NORMAL, + }; + + fb_add_framebuffer_info_ex(&fb); } void vbe_textmode_console(void) @@ -362,34 +376,6 @@ void vbe_textmode_console(void) die("\nError: In %s function\n", __func__); } -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) -{ - if (!vbe_mode_info_valid()) - return -1; - - framebuffer->physical_address = mode_info.vesa.phys_base_ptr; - - framebuffer->x_resolution = le16_to_cpu(mode_info.vesa.x_resolution); - framebuffer->y_resolution = le16_to_cpu(mode_info.vesa.y_resolution); - framebuffer->bytes_per_line = - le16_to_cpu(mode_info.vesa.bytes_per_scanline); - framebuffer->bits_per_pixel = mode_info.vesa.bits_per_pixel; - - framebuffer->red_mask_pos = mode_info.vesa.red_mask_pos; - framebuffer->red_mask_size = mode_info.vesa.red_mask_size; - - framebuffer->green_mask_pos = mode_info.vesa.green_mask_pos; - framebuffer->green_mask_size = mode_info.vesa.green_mask_size; - - framebuffer->blue_mask_pos = mode_info.vesa.blue_mask_pos; - framebuffer->blue_mask_size = mode_info.vesa.blue_mask_size; - - framebuffer->reserved_mask_pos = mode_info.vesa.reserved_mask_pos; - framebuffer->reserved_mask_size = mode_info.vesa.reserved_mask_size; - - return 0; -} - #endif void run_bios(struct device *dev, unsigned long addr) diff --git a/src/device/oprom/yabel/vbe.c b/src/device/oprom/yabel/vbe.c index a3d736fa93..5f03e19261 100644 --- a/src/device/oprom/yabel/vbe.c +++ b/src/device/oprom/yabel/vbe.c @@ -33,6 +33,7 @@ *****************************************************************************/ #include <boot/coreboot_tables.h> +#include <framebuffer_info.h> #include <string.h> #include <types.h> @@ -163,11 +164,6 @@ vbe_info(vbe_info_t * info) static int mode_info_valid; -static int vbe_mode_info_valid(void) -{ - return mode_info_valid; -} - // VBE Function 01h static u8 vbe_get_mode_info(vbe_mode_info_t * mode_info) @@ -747,33 +743,25 @@ void vbe_set_graphics(void) mode_info.video_mode = (1 << 14) | CONFIG_FRAMEBUFFER_VESA_MODE; vbe_get_mode_info(&mode_info); vbe_set_mode(&mode_info); -} - -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) -{ - if (!vbe_mode_info_valid()) - return -1; - framebuffer->physical_address = le32_to_cpu(mode_info.vesa.phys_base_ptr); - - framebuffer->x_resolution = le16_to_cpu(mode_info.vesa.x_resolution); - framebuffer->y_resolution = le16_to_cpu(mode_info.vesa.y_resolution); - framebuffer->bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline); - framebuffer->bits_per_pixel = mode_info.vesa.bits_per_pixel; - - framebuffer->red_mask_pos = mode_info.vesa.red_mask_pos; - framebuffer->red_mask_size = mode_info.vesa.red_mask_size; - - framebuffer->green_mask_pos = mode_info.vesa.green_mask_pos; - framebuffer->green_mask_size = mode_info.vesa.green_mask_size; - - framebuffer->blue_mask_pos = mode_info.vesa.blue_mask_pos; - framebuffer->blue_mask_size = mode_info.vesa.blue_mask_size; - - framebuffer->reserved_mask_pos = mode_info.vesa.reserved_mask_pos; - framebuffer->reserved_mask_size = mode_info.vesa.reserved_mask_size; - - return 0; + const struct lb_framebuffer fb = { + .physical_address = mode_info.vesa.phys_base_ptr, + .x_resolution = le16_to_cpu(mode_info.vesa.x_resolution), + .y_resolution = le16_to_cpu(mode_info.vesa.y_resolution), + .bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline), + .bits_per_pixel = mode_info.vesa.bits_per_pixel, + .red_mask_pos = mode_info.vesa.red_mask_pos, + .red_mask_size = mode_info.vesa.red_mask_size, + .green_mask_pos = mode_info.vesa.green_mask_pos, + .green_mask_size = mode_info.vesa.green_mask_size, + .blue_mask_pos = mode_info.vesa.blue_mask_pos, + .blue_mask_size = mode_info.vesa.blue_mask_size, + .reserved_mask_pos = mode_info.vesa.reserved_mask_pos, + .reserved_mask_size = mode_info.vesa.reserved_mask_size, + .orientation = LB_FB_ORIENTATION_NORMAL, + }; + + fb_add_framebuffer_info_ex(&fb); } void vbe_textmode_console(void) |