blob: 009dabd53113fbb04774e767a6c4ae3349f58d10 [file] [log] [blame]
Stefan Reinauer216fa462011-10-12 14:25:07 -07001/******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
3 * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
4 * All rights reserved.
5 * This program and the accompanying materials
6 * are made available under the terms of the BSD License
7 * which accompanies this distribution, and is available at
8 * http://www.opensource.org/licenses/bsd-license.php
9 *
10 * Contributors:
11 * IBM Corporation - initial implementation
12 *****************************************************************************/
Ronald G. Minnichb2893a012013-04-23 10:59:11 -070013#ifndef VBE_H
14#define VBE_H
Stefan Reinauer216fa462011-10-12 14:25:07 -070015
Ronald G. Minnichb2893a012013-04-23 10:59:11 -070016#include <boot/coreboot_tables.h>
Stefan Reinauer216fa462011-10-12 14:25:07 -070017// these structs are for input from and output to OF
18typedef struct {
19 u8 display_type; // 0=NONE, 1= analog, 2=digital
20 u16 screen_width;
21 u16 screen_height;
22 u16 screen_linebytes; // bytes per line in framebuffer, may be more than screen_width
Ronald G. Minnich9518b562013-09-19 16:45:22 -070023 u8 color_depth; // color depth in bits per pixel
Stefan Reinauer216fa462011-10-12 14:25:07 -070024 u32 framebuffer_address;
25 u8 edid_block_zero[128];
26} __attribute__ ((__packed__)) screen_info_t;
27
28typedef struct {
29 u8 signature[4];
30 u16 size_reserved;
31 u8 monitor_number;
32 u16 max_screen_width;
33 u8 color_depth;
34} __attribute__ ((__packed__)) screen_info_input_t;
35
36// these structs only store a subset of the VBE defined fields
37// only those needed.
38typedef struct {
39 char signature[4];
40 u16 version;
41 u8 *oem_string_ptr;
42 u32 capabilities;
43 u16 video_mode_list[256]; // lets hope we never have more than 256 video modes...
44 u16 total_memory;
45} vbe_info_t;
46
47typedef struct {
48 u16 mode_attributes; // 00
49 u8 win_a_attributes; // 02
50 u8 win_b_attributes; // 03
51 u16 win_granularity; // 04
52 u16 win_size; // 06
53 u16 win_a_segment; // 08
54 u16 win_b_segment; // 0a
55 u32 win_func_ptr; // 0c
56 u16 bytes_per_scanline; // 10
57 u16 x_resolution; // 12
58 u16 y_resolution; // 14
59 u8 x_charsize; // 16
60 u8 y_charsize; // 17
61 u8 number_of_planes; // 18
62 u8 bits_per_pixel; // 19
63 u8 number_of_banks; // 20
64 u8 memory_model; // 21
65 u8 bank_size; // 22
66 u8 number_of_image_pages; // 23
67 u8 reserved_page;
68 u8 red_mask_size;
69 u8 red_mask_pos;
70 u8 green_mask_size;
71 u8 green_mask_pos;
72 u8 blue_mask_size;
73 u8 blue_mask_pos;
74 u8 reserved_mask_size;
75 u8 reserved_mask_pos;
76 u8 direct_color_mode_info;
77 u32 phys_base_ptr;
78 u32 offscreen_mem_offset;
79 u16 offscreen_mem_size;
80 u8 reserved[206];
81} __attribute__ ((__packed__)) vesa_mode_info_t;
82
83typedef struct {
84 u16 video_mode;
85 union {
86 vesa_mode_info_t vesa;
87 u8 mode_info_block[256];
88 };
89 // our crap
90 //u16 attributes;
91 //u16 linebytes;
92 //u16 x_resolution;
93 //u16 y_resolution;
94 //u8 x_charsize;
95 //u8 y_charsize;
96 //u8 bits_per_pixel;
97 //u8 memory_model;
98 //u32 framebuffer_address;
99} vbe_mode_info_t;
100
101typedef struct {
102 u8 port_number; // i.e. monitor number
103 u8 edid_transfer_time;
104 u8 ddc_level;
105 u8 edid_block_zero[128];
106} vbe_ddc_info_t;
107
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700108#define VESA_GET_INFO 0x4f00
109#define VESA_GET_MODE_INFO 0x4f01
110#define VESA_SET_MODE 0x4f02
Stefan Reinauer216fa462011-10-12 14:25:07 -0700111
Ronald G. Minnichb2893a012013-04-23 10:59:11 -0700112int vbe_mode_info_valid(void);
113void fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
114void vbe_set_graphics(void);
115void vbe_textmode_console(void);
116
117#endif // VBE_H