Commit 153e1dda2ff62b0ecffa186a950bbfb82f1b474d

Authored by Bin Meng
Committed by Simon Glass
1 parent 3ff2f001c2

video: coreboot: Save VESA mode for future use

When booting as a coreboot payload, the framebuffer details are
passed from coreboot via configuration tables. We save these
information into vesa_mode_info structure for future use.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Showing 3 changed files with 27 additions and 1 deletions Side-by-side Diff

drivers/pci/pci_rom.c
... ... @@ -187,7 +187,7 @@
187 187 return 0;
188 188 }
189 189  
190   -static struct vbe_mode_info mode_info;
  190 +struct vbe_mode_info mode_info;
191 191  
192 192 int vbe_get_video_info(struct graphic_device *gdev)
193 193 {
drivers/video/coreboot_fb.c
... ... @@ -9,6 +9,7 @@
9 9 #include <common.h>
10 10 #include <asm/arch/tables.h>
11 11 #include <asm/arch/sysinfo.h>
  12 +#include <vbe.h>
12 13 #include <video_fb.h>
13 14 #include "videomodes.h"
14 15  
... ... @@ -17,6 +18,26 @@
17 18 */
18 19 GraphicDevice ctfb;
19 20  
  21 +static void save_vesa_mode(void)
  22 +{
  23 + struct vesa_mode_info *vesa = &mode_info.vesa;
  24 + struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
  25 +
  26 + vesa->x_resolution = fb->x_resolution;
  27 + vesa->y_resolution = fb->y_resolution;
  28 + vesa->bits_per_pixel = fb->bits_per_pixel;
  29 + vesa->bytes_per_scanline = fb->bytes_per_line;
  30 + vesa->phys_base_ptr = fb->physical_address;
  31 + vesa->red_mask_size = fb->red_mask_size;
  32 + vesa->red_mask_pos = fb->red_mask_pos;
  33 + vesa->green_mask_size = fb->green_mask_size;
  34 + vesa->green_mask_pos = fb->green_mask_pos;
  35 + vesa->blue_mask_size = fb->blue_mask_size;
  36 + vesa->blue_mask_pos = fb->blue_mask_pos;
  37 + vesa->reserved_mask_size = fb->reserved_mask_size;
  38 + vesa->reserved_mask_pos = fb->reserved_mask_pos;
  39 +}
  40 +
20 41 static int parse_coreboot_table_fb(GraphicDevice *gdev)
21 42 {
22 43 struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
... ... @@ -80,6 +101,9 @@
80 101  
81 102 memset((void *)gdev->pciBase, 0,
82 103 gdev->winSizeX * gdev->winSizeY * gdev->gdfBytesPP);
  104 +
  105 + /* Initialize vesa_mode_info structure */
  106 + save_vesa_mode();
83 107  
84 108 return (void *)gdev;
85 109 }
... ... @@ -102,6 +102,8 @@
102 102 #define VESA_SET_MODE 0x4f02
103 103 #define VESA_GET_CUR_MODE 0x4f03
104 104  
  105 +extern struct vbe_mode_info mode_info;
  106 +
105 107 struct graphic_device;
106 108 int vbe_get_video_info(struct graphic_device *gdev);
107 109