coreboot/src/include/vbe.h
Subrata Banik a260215a64 device/oprom: List all supported vesa mode by oprom
This patch lists all supported vesa mode by oprom
using Function 0x4F00 (return vbe controller information).
This information might be useful for user to select correct vesa
mode for oprom.

TEST=Enabling external pcie based graphics card on ICLRVP

Case 1: with unsupported vesa mode 0x118

Now coreboot will show below msg to user to know there is a potential
issue with choosen vesa mode and better users know the failure rather
going to depthcharge and debug further.

Calling Option ROM...
... Option ROM returned.
VBE: Getting information about VESA mode 4118
VBE: Function call invalid with unsupported video mode 0x118!
User to select mode from below list -
Supported Video Mode list for OpRom are:
0x110
0x111
0x113
0x114
0x116
0x117
0x119
0x11a
0x165
0x166
0x121
0x122
0x123
0x124
0x145
0x146
0x175
0x176
0x1d2
0x1d4

Error: In vbe_get_mode_info function

Case 2: with supported vesa mode 0x116

Calling Option ROM...
... Option ROM returned.
VBE: Getting information about VESA mode 4116
VBE: resolution:  1024x768@16
VBE: framebuffer: a0000000
VBE: Setting VESA mode 4116
VGA Option ROM was run

Change-Id: I02cba44374bc50ec3ec2819c97b6f5027c58387f
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34284
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2019-07-19 17:11:07 +00:00

105 lines
2.6 KiB
C

/******************************************************************************
* 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
*****************************************************************************/
#ifndef VBE_H
#define VBE_H
#include <boot/coreboot_tables.h>
// 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 bits per pixel
u32 framebuffer_address;
u8 edid_block_zero[128];
} __packed screen_info_t;
typedef struct {
u8 signature[4];
u16 size_reserved;
u8 monitor_number;
u16 max_screen_width;
u8 color_depth;
} __packed screen_info_input_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];
} __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;
#define VESA_GET_INFO 0x4f00
#define VESA_GET_MODE_INFO 0x4f01
#define VESA_SET_MODE 0x4f02
void vbe_set_graphics(void);
void vbe_textmode_console(void);
#endif // VBE_H