xref: /openbmc/u-boot/include/vbe.h (revision 3991f42e)
1 /******************************************************************************
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 */
15 struct __packed vbe_screen_info {
16 	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 
26 struct __packed vbe_screen_info_input {
27 	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 */
35 struct __packed vbe_info {
36 	char signature[4];
37 	u16 version;
38 	u32 oem_string_ptr;
39 	u32 capabilities;
40 	u32 modes_ptr;
41 	u16 total_memory;
42 	u16 oem_version;
43 	u32 vendor_name_ptr;
44 	u32 product_name_ptr;
45 	u32 product_rev_ptr;
46 };
47 
48 struct __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 
84 struct 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 
93 struct 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
103 #define VESA_GET_CUR_MODE	0x4f03
104 
105 extern struct vbe_mode_info mode_info;
106 
107 struct video_priv;
108 struct video_uc_platdata;
109 int vbe_setup_video_priv(struct vesa_mode_info *vesa,
110 			 struct video_priv *uc_priv,
111 			 struct video_uc_platdata *plat);
112 int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void));
113 
114 #endif
115