blob: 1a86db886adc7a0aed887017ba174cf70dbf3df7 [file] [log] [blame]
Simon Glass647f56e2014-11-14 20:56:31 -07001/******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
3 * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * Contributors:
9 * IBM Corporation - initial implementation
10 *****************************************************************************/
11#ifndef _VBE_H
12#define _VBE_H
13
14/* these structs are for input from and output to OF */
Bin Menga4520022015-07-06 16:31:36 +080015struct __packed vbe_screen_info {
Simon Glass647f56e2014-11-14 20:56:31 -070016 u8 display_type; /* 0=NONE, 1= analog, 2=digital */
17 u16 screen_width;
18 u16 screen_height;
19 /* bytes per line in framebuffer, may be more than screen_width */
20 u16 screen_linebytes;
21 u8 color_depth; /* color depth in bits per pixel */
22 u32 framebuffer_address;
23 u8 edid_block_zero[128];
24};
25
Bin Menga4520022015-07-06 16:31:36 +080026struct __packed vbe_screen_info_input {
Simon Glass647f56e2014-11-14 20:56:31 -070027 u8 signature[4];
28 u16 size_reserved;
29 u8 monitor_number;
30 u16 max_screen_width;
31 u8 color_depth;
32};
33
34/* these structs only store the required a subset of the VBE-defined fields */
35struct __packed vbe_info {
36 char signature[4];
37 u16 version;
Simon Glass222f25f2014-12-29 19:32:26 -070038 u32 oem_string_ptr;
Simon Glass647f56e2014-11-14 20:56:31 -070039 u32 capabilities;
Simon Glass222f25f2014-12-29 19:32:26 -070040 u32 modes_ptr;
Simon Glass647f56e2014-11-14 20:56:31 -070041 u16 total_memory;
Simon Glass222f25f2014-12-29 19:32:26 -070042 u16 oem_version;
43 u32 vendor_name_ptr;
44 u32 product_name_ptr;
45 u32 product_rev_ptr;
Simon Glass647f56e2014-11-14 20:56:31 -070046};
47
48struct __packed vesa_mode_info {
49 u16 mode_attributes; /* 00 */
50 u8 win_a_attributes; /* 02 */
51 u8 win_b_attributes; /* 03 */
52 u16 win_granularity; /* 04 */
53 u16 win_size; /* 06 */
54 u16 win_a_segment; /* 08 */
55 u16 win_b_segment; /* 0a */
56 u32 win_func_ptr; /* 0c */
57 u16 bytes_per_scanline; /* 10 */
58 u16 x_resolution; /* 12 */
59 u16 y_resolution; /* 14 */
60 u8 x_charsize; /* 16 */
61 u8 y_charsize; /* 17 */
62 u8 number_of_planes; /* 18 */
63 u8 bits_per_pixel; /* 19 */
64 u8 number_of_banks; /* 20 */
65 u8 memory_model; /* 21 */
66 u8 bank_size; /* 22 */
67 u8 number_of_image_pages; /* 23 */
68 u8 reserved_page;
69 u8 red_mask_size;
70 u8 red_mask_pos;
71 u8 green_mask_size;
72 u8 green_mask_pos;
73 u8 blue_mask_size;
74 u8 blue_mask_pos;
75 u8 reserved_mask_size;
76 u8 reserved_mask_pos;
77 u8 direct_color_mode_info;
78 u32 phys_base_ptr;
79 u32 offscreen_mem_offset;
80 u16 offscreen_mem_size;
81 u8 reserved[206];
82};
83
84struct vbe_mode_info {
85 u16 video_mode;
86 bool valid;
87 union {
88 struct vesa_mode_info vesa;
89 u8 mode_info_block[256];
90 };
91};
92
93struct vbe_ddc_info {
94 u8 port_number; /* i.e. monitor number */
95 u8 edid_transfer_time;
96 u8 ddc_level;
97 u8 edid_block_zero[128];
98};
99
100#define VESA_GET_INFO 0x4f00
101#define VESA_GET_MODE_INFO 0x4f01
102#define VESA_SET_MODE 0x4f02
Simon Glass222f25f2014-12-29 19:32:26 -0700103#define VESA_GET_CUR_MODE 0x4f03
Simon Glass647f56e2014-11-14 20:56:31 -0700104
105struct graphic_device;
106int vbe_get_video_info(struct graphic_device *gdev);
107
108#endif