2011-10-12 23:25:07 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2004, 2008 IBM Corporation
|
|
|
|
* Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
|
|
|
|
* All rights reserved.
|
|
|
|
* This program and the accompanying materials
|
|
|
|
* are made available under the terms of the BSD License
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.opensource.org/licenses/bsd-license.php
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial implementation
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
// these structs are for input from and output to OF
|
|
|
|
typedef struct {
|
|
|
|
u8 display_type; // 0=NONE, 1= analog, 2=digital
|
|
|
|
u16 screen_width;
|
|
|
|
u16 screen_height;
|
|
|
|
u16 screen_linebytes; // bytes per line in framebuffer, may be more than screen_width
|
|
|
|
u8 color_depth; // color depth in bpp
|
|
|
|
u32 framebuffer_address;
|
|
|
|
u8 edid_block_zero[128];
|
|
|
|
} __attribute__ ((__packed__)) screen_info_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u8 signature[4];
|
|
|
|
u16 size_reserved;
|
|
|
|
u8 monitor_number;
|
|
|
|
u16 max_screen_width;
|
|
|
|
u8 color_depth;
|
|
|
|
} __attribute__ ((__packed__)) screen_info_input_t;
|
|
|
|
|
|
|
|
// these structs only store a subset of the VBE defined fields
|
|
|
|
// only those needed.
|
|
|
|
typedef struct {
|
|
|
|
char signature[4];
|
|
|
|
u16 version;
|
|
|
|
u8 *oem_string_ptr;
|
|
|
|
u32 capabilities;
|
|
|
|
u16 video_mode_list[256]; // lets hope we never have more than 256 video modes...
|
|
|
|
u16 total_memory;
|
|
|
|
} vbe_info_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u16 mode_attributes; // 00
|
|
|
|
u8 win_a_attributes; // 02
|
|
|
|
u8 win_b_attributes; // 03
|
|
|
|
u16 win_granularity; // 04
|
|
|
|
u16 win_size; // 06
|
|
|
|
u16 win_a_segment; // 08
|
|
|
|
u16 win_b_segment; // 0a
|
|
|
|
u32 win_func_ptr; // 0c
|
|
|
|
u16 bytes_per_scanline; // 10
|
|
|
|
u16 x_resolution; // 12
|
|
|
|
u16 y_resolution; // 14
|
|
|
|
u8 x_charsize; // 16
|
|
|
|
u8 y_charsize; // 17
|
|
|
|
u8 number_of_planes; // 18
|
|
|
|
u8 bits_per_pixel; // 19
|
|
|
|
u8 number_of_banks; // 20
|
|
|
|
u8 memory_model; // 21
|
|
|
|
u8 bank_size; // 22
|
|
|
|
u8 number_of_image_pages; // 23
|
|
|
|
u8 reserved_page;
|
|
|
|
u8 red_mask_size;
|
|
|
|
u8 red_mask_pos;
|
|
|
|
u8 green_mask_size;
|
|
|
|
u8 green_mask_pos;
|
|
|
|
u8 blue_mask_size;
|
|
|
|
u8 blue_mask_pos;
|
|
|
|
u8 reserved_mask_size;
|
|
|
|
u8 reserved_mask_pos;
|
|
|
|
u8 direct_color_mode_info;
|
|
|
|
u32 phys_base_ptr;
|
|
|
|
u32 offscreen_mem_offset;
|
|
|
|
u16 offscreen_mem_size;
|
|
|
|
u8 reserved[206];
|
|
|
|
} __attribute__ ((__packed__)) vesa_mode_info_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u16 video_mode;
|
|
|
|
union {
|
|
|
|
vesa_mode_info_t vesa;
|
|
|
|
u8 mode_info_block[256];
|
|
|
|
};
|
|
|
|
// our crap
|
|
|
|
//u16 attributes;
|
|
|
|
//u16 linebytes;
|
|
|
|
//u16 x_resolution;
|
|
|
|
//u16 y_resolution;
|
|
|
|
//u8 x_charsize;
|
|
|
|
//u8 y_charsize;
|
|
|
|
//u8 bits_per_pixel;
|
|
|
|
//u8 memory_model;
|
|
|
|
//u32 framebuffer_address;
|
|
|
|
} vbe_mode_info_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u8 port_number; // i.e. monitor number
|
|
|
|
u8 edid_transfer_time;
|
|
|
|
u8 ddc_level;
|
|
|
|
u8 edid_block_zero[128];
|
|
|
|
} vbe_ddc_info_t;
|
|
|
|
|
|
|
|
struct lb_framebuffer;
|
|
|
|
|
2011-10-12 23:30:59 +02:00
|
|
|
void vbe_set_graphics(void);
|
oprom: Ensure that mode information is valid before putting it in the tables.
At least when CONFIG_CHROMEOS is turned on, it's possible for
CONFIG_FRAMEBUFFER_KEEP_VESA_MODE to be set but for there not to be any valid
information to put into the framebuffer coreboot table. That means that what's
put in there is junk, probably all zeroes from the uninitialized global
variable the mode information is stored in (mode_info).
When a payload uses libpayload and turns on the coreboot framebuffer console,
that console will attempt to scroll at some point and decrease the cursor's y
coordinate until it is less than the number of rows claimed by the console.
The number of rows is computed by taking the vertical resolution of the
framebuffer and dividing it by the height of the font. Because the mode
information was all zeroes, the coreboot table info is all zeroes, and that
means that the number of rows the console claims is zero. You can't get the
unsigned y coordinate of the cursor to be less than zero, so libpayload gets
stuck in an infinite loop.
The solution this change implements is to add a new function,
vbe_mode_info_valid, which simply returns whether or not mode_info has anything
in it. If not, the framebuffer coreboot table is not created, and libpayload
doesn't get stuck.
Change-Id: I08f3ec628e4453f0cfe9e15c4d8dfd40327f91c9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/1758
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2012-09-30 13:47:48 +02:00
|
|
|
// A way to check if mode information collected by vbe_set_graphics is valid
|
|
|
|
// and fill_lb_framebuffer will have real information to use.
|
|
|
|
int vbe_mode_info_valid(void);
|
2011-10-12 23:25:07 +02:00
|
|
|
void vbe_textmode_console(void);
|
2011-10-12 23:30:59 +02:00
|
|
|
void fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
|
2011-10-12 23:25:07 +02:00
|
|
|
|
2011-10-12 23:30:59 +02:00
|
|
|
#define VESA_GET_INFO 0x4f00
|
|
|
|
#define VESA_GET_MODE_INFO 0x4f01
|
|
|
|
#define VESA_SET_MODE 0x4f02
|
2011-10-12 23:25:07 +02:00
|
|
|
|