diff options
Diffstat (limited to 'src/drivers/intel/fsp2_0')
-rw-r--r-- | src/drivers/intel/fsp2_0/graphics.c | 87 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/include/fsp/graphics.h | 16 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/include/fsp/util.h | 4 |
3 files changed, 50 insertions, 57 deletions
diff --git a/src/drivers/intel/fsp2_0/graphics.c b/src/drivers/intel/fsp2_0/graphics.c index f6686c4f57..ddf8f0b857 100644 --- a/src/drivers/intel/fsp2_0/graphics.c +++ b/src/drivers/intel/fsp2_0/graphics.c @@ -2,9 +2,11 @@ #include <boot/coreboot_tables.h> #include <console/console.h> +#include <fsp/graphics.h> #include <fsp/util.h> #include <soc/intel/common/vbt.h> #include <types.h> +#include <framebuffer_info.h> enum pixel_format { pixel_rgbx_8bpc = 0, @@ -46,75 +48,54 @@ static const struct fsp_framebuffer { [pixel_bgrx_8bpc] = { {16, 8}, {8, 8}, {0, 8}, {24, 8} }, }; -enum cb_err fsp_fill_lb_framebuffer(struct lb_framebuffer *framebuffer) + +void fsp_report_framebuffer_info(const uintptr_t framebuffer_bar) { size_t size; const struct hob_graphics_info *ginfo; const struct fsp_framebuffer *fbinfo; + /* + * Pci enumeration happens after silicon init. + * After enumeration graphic framebuffer base may be relocated. + */ + if (!framebuffer_bar) { + printk(BIOS_ALERT, "Framebuffer BAR invalid\n"); + return; + } + ginfo = fsp_find_extension_hob_by_guid(fsp_graphics_info_guid, &size); if (!ginfo) { printk(BIOS_ALERT, "Graphics hand-off block not found\n"); - return CB_ERR; + return; } if (ginfo->pixel_format >= ARRAY_SIZE(fsp_framebuffer_format_map)) { printk(BIOS_ALERT, "FSP set unknown framebuffer format: %d\n", ginfo->pixel_format); - return CB_ERR; + return; } fbinfo = fsp_framebuffer_format_map + ginfo->pixel_format; - framebuffer->physical_address = ginfo->framebuffer_base; - framebuffer->x_resolution = ginfo->horizontal_resolution; - framebuffer->y_resolution = ginfo->vertical_resolution; - framebuffer->bytes_per_line = ginfo->pixels_per_scanline * 4; - framebuffer->bits_per_pixel = 32; - framebuffer->red_mask_pos = fbinfo->red.pos; - framebuffer->red_mask_size = fbinfo->red.size; - framebuffer->green_mask_pos = fbinfo->green.pos; - framebuffer->green_mask_size = fbinfo->green.size; - framebuffer->blue_mask_pos = fbinfo->blue.pos; - framebuffer->blue_mask_size = fbinfo->blue.size; - framebuffer->reserved_mask_pos = fbinfo->rsvd.pos; - framebuffer->reserved_mask_size = fbinfo->rsvd.pos; - - return CB_SUCCESS; -} - -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) -{ - enum cb_err ret; - uintptr_t framebuffer_bar; - - /* Pci enumeration happens after silicon init. - * After enumeration graphic framebuffer base may be relocated. - * Get framebuffer base from soc. - */ - framebuffer_bar = fsp_soc_get_igd_bar(); - - if (!framebuffer_bar) { - printk(BIOS_ALERT, "Framebuffer BAR invalid\n"); - return -1; - } - - ret = fsp_fill_lb_framebuffer(framebuffer); - if (ret != CB_SUCCESS) { - printk(BIOS_ALERT, "FSP did not return a valid framebuffer\n"); - return -1; - } - - /* Resource allocator can move the BAR around after FSP configures it */ - framebuffer->physical_address = framebuffer_bar; - printk(BIOS_DEBUG, "Graphics framebuffer located at 0x%llx\n", - framebuffer->physical_address); - - return 0; -} - -__weak uintptr_t fsp_soc_get_igd_bar(void) -{ - return 0; + const struct lb_framebuffer fb = { + .physical_address = framebuffer_bar, + .x_resolution = ginfo->horizontal_resolution, + .y_resolution = ginfo->vertical_resolution, + .bytes_per_line = ginfo->pixels_per_scanline * 4, + .bits_per_pixel = fbinfo->rsvd.size + fbinfo->red.size + + fbinfo->green.size + fbinfo->blue.size, + .red_mask_pos = fbinfo->red.pos, + .red_mask_size = fbinfo->red.size, + .green_mask_pos = fbinfo->green.pos, + .green_mask_size = fbinfo->green.size, + .blue_mask_pos = fbinfo->blue.pos, + .blue_mask_size = fbinfo->blue.size, + .reserved_mask_pos = fbinfo->rsvd.pos, + .reserved_mask_size = fbinfo->rsvd.size, + .orientation = LB_FB_ORIENTATION_NORMAL, + }; + + fb_add_framebuffer_info_ex(&fb); } diff --git a/src/drivers/intel/fsp2_0/include/fsp/graphics.h b/src/drivers/intel/fsp2_0/include/fsp/graphics.h new file mode 100644 index 0000000000..2d8138332f --- /dev/null +++ b/src/drivers/intel/fsp2_0/include/fsp/graphics.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _FSP2_0_GRAPHICS_H_ +#define _FSP2_0_GRAPHICS_H_ + +#include <types.h> + +/* + * Report the fsp_graphics_info_guid HOB to framebuffer info. + * + * Must be called after PCI enumeration to make sure that the BAR + * doesn't change any more. + */ +void fsp_report_framebuffer_info(const uintptr_t framebuffer_bar); + +#endif /* _FSP2_0_GRAPHICS_H_ */ diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h index 315db056e9..7393305f0b 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/util.h +++ b/src/drivers/intel/fsp2_0/include/fsp/util.h @@ -88,7 +88,6 @@ const void *fsp_get_hob_list(void); void *fsp_get_hob_list_ptr(void); const void *fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size); const void *fsp_find_nv_storage_data(size_t *size); -enum cb_err fsp_fill_lb_framebuffer(struct lb_framebuffer *framebuffer); int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]); void fsp_display_fvi_version_hob(void); void fsp_find_reserved_memory(struct range_entry *re); @@ -123,9 +122,6 @@ struct fsp_load_descriptor { * header object will be validated and filled in on successful load. */ enum cb_err fsp_load_component(struct fsp_load_descriptor *fspld, struct fsp_header *hdr); -/* Get igd framebuffer bar from SoC */ -uintptr_t fsp_soc_get_igd_bar(void); - /* * Handle FSP reboot request status. Chipset/soc is expected to provide * chipset_handle_reset() that deals with reset type codes specific to given |