2 * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
9 #include <SupportDefs.h>
12 /* VBE info block structure */
14 #define VESA_SIGNATURE 'ASEV'
15 #define VBE2_SIGNATURE '2EBV'
17 struct vbe_info_block
{
27 uint16 total_memory
; // in 64k blocks
28 // VBE 2.0+ fields only
29 // Note, the block is 256 bytes in size for VBE 1.x as well,
30 // but doesn't define these fields. VBE 3 doesn't define
31 // any additional fields.
32 uint16 oem_software_revision
;
33 uint32 oem_vendor_name_string
;
34 uint32 oem_product_name_string
;
35 uint32 oem_product_revision_string
;
41 #define CAPABILITY_DAC_WIDTH 0x01
42 #define CAPABILITY_NOT_VGA_COMPATIBLE 0x02
45 /* VBE mode info structure */
47 struct vbe_mode_info
{
49 uint8 window_a_attributes
;
50 uint8 window_b_attributes
;
51 uint16 window_granularity
;
53 uint16 window_a_segment
;
54 uint16 window_b_segment
;
55 uint32 window_function
; // real mode pointer
68 uint8 num_image_pages
;
71 // direct color fields
73 uint8 red_field_position
;
74 uint8 green_mask_size
;
75 uint8 green_field_position
;
77 uint8 blue_field_position
;
78 uint8 reserved_mask_size
;
79 uint8 reserved_field_position
;
80 uint8 direct_color_mode_info
;
88 uint16 linear_bytes_per_row
;
89 uint8 banked_num_image_pages
;
90 uint8 linear_num_image_pages
;
92 uint8 linear_red_mask_size
;
93 uint8 linear_red_field_position
;
94 uint8 linear_green_mask_size
;
95 uint8 linear_green_field_position
;
96 uint8 linear_blue_mask_size
;
97 uint8 linear_blue_field_position
;
98 uint8 linear_reserved_mask_size
;
99 uint8 linear_reserved_field_position
;
101 uint32 max_pixel_clock
; // in Hz
103 uint8 _reserved
[189];
106 // definitions of mode info attributes
107 #define MODE_ATTR_AVAILABLE 1
108 #define MODE_ATTR_COLOR_MODE 8
109 #define MODE_ATTR_GRAPHICS_MODE 16
110 #define MODE_ATTR_LINEAR_BUFFER 128
113 #define MODE_MEMORY_TEXT 0
114 #define MODE_MEMORY_PLANAR 3
115 #define MODE_MEMORY_PACKED_PIXEL 4
116 #define MODE_MEMORY_DIRECT_COLOR 6
117 #define MODE_MEMORY_YUV 7
120 #define SET_MODE_MASK 0x01ff
121 #define SET_MODE_SPECIFY_CRTC (1 << 11)
122 #define SET_MODE_LINEAR_BUFFER (1 << 14)
123 #define SET_MODE_DONT_CLEAR_MEMORY (1 << 15)
126 /* CRTC info block structure */
128 struct crtc_info_block
{
129 uint16 horizontal_total
;
130 uint16 horizontal_sync_start
;
131 uint16 horizontal_sync_end
;
132 uint16 vertical_total
;
133 uint16 vertical_sync_start
;
134 uint16 vertical_sync_end
;
136 uint32 pixel_clock
; // in Hz
137 uint16 refresh_rate
; // in 0.01 Hz
142 #define CRTC_DOUBLE_SCAN 0x01
143 #define CRTC_INTERLACED 0x02
144 #define CRTC_NEGATIVE_HSYNC 0x04
145 #define CRTC_NEGATIVE_VSYNC 0x08
148 /* Power Management */
151 #define DPMS_STANDBY 0x01
152 #define DPMS_SUSPEND 0x02
153 #define DPMS_OFF 0x04
154 #define DPMS_REDUCED_ON 0x08
157 /* VBE 3.0 protected mode interface
158 * The BIOS area can be scanned for the protected mode
159 * signature that identifies the structure below.
162 #define VBE_PM_SIGNATURE 'DIMP'
164 struct vbe_protected_mode_info
{
168 uint16 data_selector
;
169 uint16 a000_selector
;
170 uint16 b000_selector
;
171 uint16 b800_selector
;
172 uint16 c000_selector
;
173 uint8 in_protected_mode
;