blob: f420f493ee1b05ce2bae5d8c39068832ec23daac [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: BSD-2-Clause */
Simon Glass647f56e2014-11-14 20:56:31 -07002/******************************************************************************
3 * Copyright (c) 2004, 2008 IBM Corporation
4 * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
5 * All rights reserved.
6 *
Simon Glass647f56e2014-11-14 20:56:31 -07007 * Contributors:
8 * IBM Corporation - initial implementation
9 *****************************************************************************/
10#ifndef _VBE_H
11#define _VBE_H
12
13/* these structs are for input from and output to OF */
Bin Menga4520022015-07-06 16:31:36 +080014struct __packed vbe_screen_info {
Simon Glass647f56e2014-11-14 20:56:31 -070015 u8 display_type; /* 0=NONE, 1= analog, 2=digital */
16 u16 screen_width;
17 u16 screen_height;
18 /* bytes per line in framebuffer, may be more than screen_width */
19 u16 screen_linebytes;
20 u8 color_depth; /* color depth in bits per pixel */
21 u32 framebuffer_address;
22 u8 edid_block_zero[128];
23};
24
Bin Menga4520022015-07-06 16:31:36 +080025struct __packed vbe_screen_info_input {
Simon Glass647f56e2014-11-14 20:56:31 -070026 u8 signature[4];
27 u16 size_reserved;
28 u8 monitor_number;
29 u16 max_screen_width;
30 u8 color_depth;
31};
32
33/* these structs only store the required a subset of the VBE-defined fields */
34struct __packed vbe_info {
35 char signature[4];
36 u16 version;
Simon Glass222f25f2014-12-29 19:32:26 -070037 u32 oem_string_ptr;
Simon Glass647f56e2014-11-14 20:56:31 -070038 u32 capabilities;
Simon Glass222f25f2014-12-29 19:32:26 -070039 u32 modes_ptr;
Simon Glass647f56e2014-11-14 20:56:31 -070040 u16 total_memory;
Simon Glass222f25f2014-12-29 19:32:26 -070041 u16 oem_version;
42 u32 vendor_name_ptr;
43 u32 product_name_ptr;
44 u32 product_rev_ptr;
Simon Glass647f56e2014-11-14 20:56:31 -070045};
46
47struct __packed vesa_mode_info {
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};
82
83struct vbe_mode_info {
84 u16 video_mode;
85 bool valid;
86 union {
87 struct vesa_mode_info vesa;
88 u8 mode_info_block[256];
89 };
90};
91
92struct vbe_ddc_info {
93 u8 port_number; /* i.e. monitor number */
94 u8 edid_transfer_time;
95 u8 ddc_level;
96 u8 edid_block_zero[128];
97};
98
99#define VESA_GET_INFO 0x4f00
100#define VESA_GET_MODE_INFO 0x4f01
101#define VESA_SET_MODE 0x4f02
Simon Glass222f25f2014-12-29 19:32:26 -0700102#define VESA_GET_CUR_MODE 0x4f03
Simon Glass647f56e2014-11-14 20:56:31 -0700103
Bin Meng153e1dd2015-08-13 00:29:16 -0700104extern struct vbe_mode_info mode_info;
105
Simon Glassee87ee82016-10-05 20:42:17 -0600106struct video_priv;
Bin Meng5f6ad022016-10-09 04:14:15 -0700107struct video_uc_platdata;
108int vbe_setup_video_priv(struct vesa_mode_info *vesa,
109 struct video_priv *uc_priv,
110 struct video_uc_platdata *plat);
Simon Glassee87ee82016-10-05 20:42:17 -0600111int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void));
Simon Glass647f56e2014-11-14 20:56:31 -0700112
113#endif