blob: 2c40d0507ee59b8a96bab7ef1d834d4e1a987aaa [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 {
Elyes HAOUASa0fed372016-09-16 20:17:40 +020019 u8 display_type; // 0 = NONE, 1 = analog, 2 = digital
Stefan Reinauer216fa462011-10-12 14:25:07 -070020 u16 screen_width;
21 u16 screen_height;
Lee Leahy6a566d72017-03-07 17:45:12 -080022 u16 screen_linebytes; // bytes per line in framebuffer, may be more
23 // than screen_width
Ronald G. Minnich9518b562013-09-19 16:45:22 -070024 u8 color_depth; // color depth in bits per pixel
Stefan Reinauer216fa462011-10-12 14:25:07 -070025 u32 framebuffer_address;
26 u8 edid_block_zero[128];
Stefan Reinauer6a001132017-07-13 02:20:27 +020027} __packed screen_info_t;
Stefan Reinauer216fa462011-10-12 14:25:07 -070028
29typedef struct {
30 u8 signature[4];
31 u16 size_reserved;
32 u8 monitor_number;
33 u16 max_screen_width;
34 u8 color_depth;
Stefan Reinauer6a001132017-07-13 02:20:27 +020035} __packed screen_info_input_t;
Stefan Reinauer216fa462011-10-12 14:25:07 -070036
37// these structs only store a subset of the VBE defined fields
38// only those needed.
39typedef struct {
40 char signature[4];
41 u16 version;
42 u8 *oem_string_ptr;
43 u32 capabilities;
Lee Leahy6a566d72017-03-07 17:45:12 -080044 u16 video_mode_list[256]; // lets hope we never have more than
45 // 256 video modes...
Stefan Reinauer216fa462011-10-12 14:25:07 -070046 u16 total_memory;
47} vbe_info_t;
48
49typedef struct {
50 u16 mode_attributes; // 00
51 u8 win_a_attributes; // 02
52 u8 win_b_attributes; // 03
53 u16 win_granularity; // 04
54 u16 win_size; // 06
55 u16 win_a_segment; // 08
56 u16 win_b_segment; // 0a
57 u32 win_func_ptr; // 0c
58 u16 bytes_per_scanline; // 10
59 u16 x_resolution; // 12
60 u16 y_resolution; // 14
61 u8 x_charsize; // 16
62 u8 y_charsize; // 17
63 u8 number_of_planes; // 18
64 u8 bits_per_pixel; // 19
65 u8 number_of_banks; // 20
66 u8 memory_model; // 21
67 u8 bank_size; // 22
68 u8 number_of_image_pages; // 23
69 u8 reserved_page;
70 u8 red_mask_size;
71 u8 red_mask_pos;
72 u8 green_mask_size;
73 u8 green_mask_pos;
74 u8 blue_mask_size;
75 u8 blue_mask_pos;
76 u8 reserved_mask_size;
77 u8 reserved_mask_pos;
78 u8 direct_color_mode_info;
79 u32 phys_base_ptr;
80 u32 offscreen_mem_offset;
81 u16 offscreen_mem_size;
82 u8 reserved[206];
Stefan Reinauer6a001132017-07-13 02:20:27 +020083} __packed vesa_mode_info_t;
Stefan Reinauer216fa462011-10-12 14:25:07 -070084
85typedef struct {
86 u16 video_mode;
87 union {
88 vesa_mode_info_t vesa;
89 u8 mode_info_block[256];
90 };
91 // our crap
92 //u16 attributes;
93 //u16 linebytes;
94 //u16 x_resolution;
95 //u16 y_resolution;
96 //u8 x_charsize;
97 //u8 y_charsize;
98 //u8 bits_per_pixel;
99 //u8 memory_model;
100 //u32 framebuffer_address;
101} vbe_mode_info_t;
102
103typedef struct {
104 u8 port_number; // i.e. monitor number
105 u8 edid_transfer_time;
106 u8 ddc_level;
107 u8 edid_block_zero[128];
108} vbe_ddc_info_t;
109
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700110#define VESA_GET_INFO 0x4f00
111#define VESA_GET_MODE_INFO 0x4f01
112#define VESA_SET_MODE 0x4f02
Stefan Reinauer216fa462011-10-12 14:25:07 -0700113
Ronald G. Minnichb2893a012013-04-23 10:59:11 -0700114void vbe_set_graphics(void);
115void vbe_textmode_console(void);
116
117#endif // VBE_H