diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h index be737b0bb9..3a5e31651c 100644 --- a/src/include/boot/coreboot_tables.h +++ b/src/include/boot/coreboot_tables.h @@ -33,9 +33,9 @@ void lb_efi_fw_info(struct lb_header *header); /* Adds LB_TAG_CAPSULE table entries. */ void lb_efi_capsules(struct lb_header *header); -/* Define this function to fill in the frame buffer returning 0 on success and - < 0 on error. */ -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer); +/* Define this function to get the frame buffer returning lb_framebuffer object + on success and NULL on error. */ +const struct lb_framebuffer *get_lb_framebuffer(void); /* Allow arch to add records. */ void lb_arch_add_records(struct lb_header *header); diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 9deefaf95b..d7cf8455b1 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -154,8 +154,8 @@ ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c ramstage-$(CONFIG_COVERAGE) += libgcov.c ramstage-y += dp_aux.c +ramstage-y += framebuffer_info.c ramstage-y += edid.c -ramstage-y += edid_fill_fb.c ramstage-y += memrange.c ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 85c5675507..6218784adc 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -142,13 +142,13 @@ static void lb_pcie(struct lb_header *header) static void lb_framebuffer(struct lb_header *header) { struct lb_framebuffer *framebuffer; - struct lb_framebuffer fb = {0}; + const struct lb_framebuffer *fb; - if (!CONFIG(LINEAR_FRAMEBUFFER) || fill_lb_framebuffer(&fb)) + if (!CONFIG(LINEAR_FRAMEBUFFER) || !(fb = get_lb_framebuffer())) return; framebuffer = (struct lb_framebuffer *)lb_new_record(header); - memcpy(framebuffer, &fb, sizeof(*framebuffer)); + memcpy(framebuffer, fb, sizeof(*framebuffer)); framebuffer->tag = LB_TAG_FRAMEBUFFER; framebuffer->size = sizeof(*framebuffer); diff --git a/src/lib/edid_fill_fb.c b/src/lib/framebuffer_info.c similarity index 97% rename from src/lib/edid_fill_fb.c rename to src/lib/framebuffer_info.c index a9ff31f5ca..f706377caa 100644 --- a/src/lib/edid_fill_fb.c +++ b/src/lib/framebuffer_info.c @@ -181,14 +181,13 @@ struct fb_info *fb_new_framebuffer_info_from_edid(const struct edid *edid, edid->bytes_per_line, edid->framebuffer_bits_per_pixel); } -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) +const struct lb_framebuffer *get_lb_framebuffer(void) { struct fb_info *i; list_for_each(i, list, node) { //TODO: Add support for advertising all framebuffers in this list - *framebuffer = i->fb; - return 0; + return &i->fb; } - return -1; + return NULL; } diff --git a/src/lib/render_bmp.c b/src/lib/render_bmp.c index 3a7e245eca..b91015bf89 100644 --- a/src/lib/render_bmp.c +++ b/src/lib/render_bmp.c @@ -689,16 +689,14 @@ void render_logo_to_framebuffer(struct logo_config *config) if (config->framebuffer_base == 0) { /* Try to load from already populated framebuffer information */ - struct lb_framebuffer framebuffer; - memset(&framebuffer, 0, sizeof(struct lb_framebuffer)); - fill_lb_framebuffer(&framebuffer); + const struct lb_framebuffer *fb = get_lb_framebuffer(); /* Exit if framebuffer is still not available */ - if (framebuffer.physical_address == 0) + if (!fb) return; - config->framebuffer_base = framebuffer.physical_address; - config->horizontal_resolution = framebuffer.x_resolution; - config->vertical_resolution = framebuffer.y_resolution; - config->bytes_per_scanline = framebuffer.bytes_per_line; + config->framebuffer_base = fb->physical_address; + config->horizontal_resolution = fb->x_resolution; + config->vertical_resolution = fb->y_resolution; + config->bytes_per_scanline = fb->bytes_per_line; } /*