1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /******************************************************************************
3 * Copyright (c) 2004, 2008 IBM Corporation
4 * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
8 * IBM Corporation - initial implementation
9 *****************************************************************************/
13 /* these structs are for input from and output to OF */
14 struct __packed vesa_screen_info
{
15 u8 display_type
; /* 0=NONE, 1= analog, 2=digital */
18 /* bytes per line in framebuffer, may be more than screen_width */
20 u8 color_depth
; /* color depth in bits per pixel */
21 u32 framebuffer_address
;
22 u8 edid_block_zero
[128];
25 struct __packed vesa_screen_info_input
{
34 * These structs only store the required subset of fields in Vesa BIOS
37 struct __packed vesa_bios_ext_info
{
50 struct __packed vesa_mode_info
{
51 u16 mode_attributes
; /* 00 */
52 u8 win_a_attributes
; /* 02 */
53 u8 win_b_attributes
; /* 03 */
54 u16 win_granularity
; /* 04 */
55 u16 win_size
; /* 06 */
56 u16 win_a_segment
; /* 08 */
57 u16 win_b_segment
; /* 0a */
58 u32 win_func_ptr
; /* 0c */
59 u16 bytes_per_scanline
; /* 10 */
60 u16 x_resolution
; /* 12 */
61 u16 y_resolution
; /* 14 */
62 u8 x_charsize
; /* 16 */
63 u8 y_charsize
; /* 17 */
64 u8 number_of_planes
; /* 18 */
65 u8 bits_per_pixel
; /* 19 */
66 u8 number_of_banks
; /* 20 */
67 u8 memory_model
; /* 21 */
68 u8 bank_size
; /* 22 */
69 u8 number_of_image_pages
; /* 23 */
77 u8 reserved_mask_size
;
79 u8 direct_color_mode_info
;
81 u32 offscreen_mem_offset
;
82 u16 offscreen_mem_size
;
90 struct vesa_mode_info vesa
;
91 u8 mode_info_block
[256];
95 struct vesa_ddc_info
{
96 u8 port_number
; /* i.e. monitor number */
97 u8 edid_transfer_time
;
99 u8 edid_block_zero
[128];
102 #define VESA_GET_INFO 0x4f00
103 #define VESA_GET_MODE_INFO 0x4f01
104 #define VESA_SET_MODE 0x4f02
105 #define VESA_GET_CUR_MODE 0x4f03
107 extern struct vesa_state mode_info
;
110 struct video_uc_plat
;
113 * vesa_setup_video_priv() - Set up a video device using VESA information
115 * The vesa struct is used by various x86 drivers, so this is a common function
116 * to use it to set up the video.
118 * @vesa: Vesa information to use (vesa->phys_base_ptr is ignored)
119 * @fb: Frame buffer address (since vesa->phys_base_ptr is only 32 bits)
120 * @uc_priv: Video device's uclass-private information
121 * @plat: Video devices's uclass-private platform data
122 * Returns: 0 if OK, -ENXIO if the x resolution is 0, -EEPROTONOSUPPORT if the
123 * pixel format is not supported
125 int vesa_setup_video_priv(struct vesa_mode_info
*vesa
, u64 fb
,
126 struct video_priv
*uc_priv
,
127 struct video_uc_plat
*plat
);
128 int vesa_setup_video(struct udevice
*dev
, int (*int15_handler
)(void));