Commit a452002259e172c93277dbe5752817e0732afe78

Authored by Bin Meng
Committed by Simon Glass
1 parent 7aaff9bf81

x86: Configure VESA parameters before loading Linux kernel

Store VESA parameters to Linux setup header so that vesafb driver
in the kernel could work.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Jian Luo <jian.luo4@boschrexroth.de>

Showing 4 changed files with 33 additions and 2 deletions Side-by-side Diff

arch/x86/include/asm/zimage.h
... ... @@ -38,6 +38,7 @@
38 38 ulong *load_addressp);
39 39 int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
40 40 unsigned long initrd_addr, unsigned long initrd_size);
  41 +void setup_video(struct screen_info *screen_info);
41 42  
42 43 #endif
arch/x86/lib/zimage.c
... ... @@ -273,6 +273,8 @@
273 273 build_command_line(cmd_line, auto_boot);
274 274 }
275 275  
  276 + setup_video(&setup_base->screen_info);
  277 +
276 278 return 0;
277 279 }
278 280  
drivers/pci/pci_rom.c
... ... @@ -31,6 +31,7 @@
31 31 #include <pci_rom.h>
32 32 #include <vbe.h>
33 33 #include <video_fb.h>
  34 +#include <linux/screen_info.h>
34 35  
35 36 #ifdef CONFIG_HAVE_ACPI_RESUME
36 37 #include <asm/acpi.h>
... ... @@ -227,6 +228,33 @@
227 228 return gdev->winSizeX ? 0 : -ENOSYS;
228 229 #else
229 230 return -ENOSYS;
  231 +#endif
  232 +}
  233 +
  234 +void setup_video(struct screen_info *screen_info)
  235 +{
  236 +#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
  237 + struct vesa_mode_info *vesa = &mode_info.vesa;
  238 +
  239 + screen_info->orig_video_isVGA = VIDEO_TYPE_VLFB;
  240 +
  241 + screen_info->lfb_width = vesa->x_resolution;
  242 + screen_info->lfb_height = vesa->y_resolution;
  243 + screen_info->lfb_depth = vesa->bits_per_pixel;
  244 + screen_info->lfb_linelength = vesa->bytes_per_scanline;
  245 + screen_info->lfb_base = vesa->phys_base_ptr;
  246 + screen_info->lfb_size =
  247 + ALIGN(screen_info->lfb_linelength * screen_info->lfb_height,
  248 + 65536);
  249 + screen_info->lfb_size >>= 16;
  250 + screen_info->red_size = vesa->red_mask_size;
  251 + screen_info->red_pos = vesa->red_mask_pos;
  252 + screen_info->green_size = vesa->green_mask_size;
  253 + screen_info->green_pos = vesa->green_mask_pos;
  254 + screen_info->blue_size = vesa->blue_mask_size;
  255 + screen_info->blue_pos = vesa->blue_mask_pos;
  256 + screen_info->rsvd_size = vesa->reserved_mask_size;
  257 + screen_info->rsvd_pos = vesa->reserved_mask_pos;
230 258 #endif
231 259 }
232 260  
... ... @@ -12,7 +12,7 @@
12 12 #define _VBE_H
13 13  
14 14 /* these structs are for input from and output to OF */
15   -struct __packed screen_info {
  15 +struct __packed vbe_screen_info {
16 16 u8 display_type; /* 0=NONE, 1= analog, 2=digital */
17 17 u16 screen_width;
18 18 u16 screen_height;
... ... @@ -23,7 +23,7 @@
23 23 u8 edid_block_zero[128];
24 24 };
25 25  
26   -struct __packed screen_info_input {
  26 +struct __packed vbe_screen_info_input {
27 27 u8 signature[4];
28 28 u16 size_reserved;
29 29 u8 monitor_number;