6 // DISPI helper function
7 void dispi_set_enable(enable
);
11 * See the function descriptions in vbe.c for more information
13 Boolean
vbe_has_vbe_display();
14 void vbe_biosfn_return_controller_information(AX
, ES
, DI
);
15 void vbe_biosfn_return_mode_information(AX
, CX
, ES
, DI
);
16 void vbe_biosfn_set_mode(AX
, BX
, ES
, DI
);
17 void vbe_biosfn_save_restore_state(AX
, DL
, CX
, ES
, BX
);
18 void vbe_biosfn_set_get_palette_data(AX
);
19 void vbe_biosfn_return_protected_mode_interface(AX
);
21 // The official VBE Information Block
22 typedef struct VbeInfoBlock
24 Bit8u VbeSignature
[4];
26 Bit16u OemStringPtr_Off
;
27 Bit16u OemStringPtr_Seg
;
28 Bit8u Capabilities
[4];
29 Bit16u VideoModePtr_Off
;
30 Bit16u VideoModePtr_Seg
;
32 Bit16u OemSoftwareRev
;
33 Bit16u OemVendorNamePtr_Off
;
34 Bit16u OemVendorNamePtr_Seg
;
35 Bit16u OemProductNamePtr_Off
;
36 Bit16u OemProductNamePtr_Seg
;
37 Bit16u OemProductRevPtr_Off
;
38 Bit16u OemProductRevPtr_Seg
;
39 Bit16u Reserved
[111]; // used for dynamicly generated mode list
44 // This one is for compactly storing a static list of mode info blocks
45 // this saves us 189 bytes per block
46 typedef struct ModeInfoBlockCompact
48 // Mandatory information for all VBE revisions
49 Bit16u ModeAttributes
;
52 Bit16u WinGranularity
;
57 Bit16u BytesPerScanLine
;
58 // Mandatory information for VBE 1.2 and above
68 Bit8u NumberOfImagePages
;
70 // Direct Color fields (required for direct/6 and YUV/7 memory models)
72 Bit8u RedFieldPosition
;
74 Bit8u GreenFieldPosition
;
76 Bit8u BlueFieldPosition
;
78 Bit8u RsvdFieldPosition
;
79 Bit8u DirectColorModeInfo
;
80 // Mandatory information for VBE 2.0 and above
82 Bit32u OffScreenMemOffset
;
83 Bit16u OffScreenMemSize
;
84 // Mandatory information for VBE 3.0 and above
85 Bit16u LinBytesPerScanLine
;
86 Bit8u BnkNumberOfPages
;
87 Bit8u LinNumberOfPages
;
89 Bit8u LinRedFieldPosition
;
90 Bit8u LinGreenMaskSize
;
91 Bit8u LinGreenFieldPosition
;
92 Bit8u LinBlueMaskSize
;
93 Bit8u LinBlueFieldPosition
;
94 Bit8u LinRsvdMaskSize
;
95 Bit8u LinRsvdFieldPosition
;
97 // Bit8u Reserved[189]; // DO NOT PUT THIS IN HERE because of Compact Mode Info storage in bios
98 } ModeInfoBlockCompact
;
100 typedef struct ModeInfoBlock
102 // Mandatory information for all VBE revisions
103 Bit16u ModeAttributes
;
104 Bit8u WinAAttributes
;
105 Bit8u WinBAttributes
;
106 Bit16u WinGranularity
;
111 Bit16u BytesPerScanLine
;
112 // Mandatory information for VBE 1.2 and above
117 Bit8u NumberOfPlanes
;
122 Bit8u NumberOfImagePages
;
124 // Direct Color fields (required for direct/6 and YUV/7 memory models)
126 Bit8u RedFieldPosition
;
128 Bit8u GreenFieldPosition
;
130 Bit8u BlueFieldPosition
;
132 Bit8u RsvdFieldPosition
;
133 Bit8u DirectColorModeInfo
;
134 // Mandatory information for VBE 2.0 and above
136 Bit32u OffScreenMemOffset
;
137 Bit16u OffScreenMemSize
;
138 // Mandatory information for VBE 3.0 and above
139 Bit16u LinBytesPerScanLine
;
140 Bit8u BnkNumberOfPages
;
141 Bit8u LinNumberOfPages
;
142 Bit8u LinRedMaskSize
;
143 Bit8u LinRedFieldPosition
;
144 Bit8u LinGreenMaskSize
;
145 Bit8u LinGreenFieldPosition
;
146 Bit8u LinBlueMaskSize
;
147 Bit8u LinBlueFieldPosition
;
148 Bit8u LinRsvdMaskSize
;
149 Bit8u LinRsvdFieldPosition
;
150 Bit32u MaxPixelClock
;
154 // VBE Return Status Info
156 #define VBE_RETURN_STATUS_SUPPORTED 0x4F
157 #define VBE_RETURN_STATUS_UNSUPPORTED 0x00
159 #define VBE_RETURN_STATUS_SUCCESSFULL 0x00
160 #define VBE_RETURN_STATUS_FAILED 0x01
161 #define VBE_RETURN_STATUS_NOT_SUPPORTED 0x02
162 #define VBE_RETURN_STATUS_INVALID 0x03
166 #define VBE_MODE_VESA_DEFINED 0x0100
167 #define VBE_MODE_REFRESH_RATE_USE_CRTC 0x0800
168 #define VBE_MODE_LINEAR_FRAME_BUFFER 0x4000
169 #define VBE_MODE_PRESERVE_DISPLAY_MEMORY 0x8000
171 // VBE GFX Mode Number
173 #define VBE_VESA_MODE_640X400X8 0x100
174 #define VBE_VESA_MODE_640X480X8 0x101
175 #define VBE_VESA_MODE_800X600X4 0x102
176 #define VBE_VESA_MODE_800X600X8 0x103
177 #define VBE_VESA_MODE_1024X768X4 0x104
178 #define VBE_VESA_MODE_1024X768X8 0x105
179 #define VBE_VESA_MODE_1280X1024X4 0x106
180 #define VBE_VESA_MODE_1280X1024X8 0x107
181 #define VBE_VESA_MODE_320X200X1555 0x10D
182 #define VBE_VESA_MODE_320X200X565 0x10E
183 #define VBE_VESA_MODE_320X200X888 0x10F
184 #define VBE_VESA_MODE_640X480X1555 0x110
185 #define VBE_VESA_MODE_640X480X565 0x111
186 #define VBE_VESA_MODE_640X480X888 0x112
187 #define VBE_VESA_MODE_800X600X1555 0x113
188 #define VBE_VESA_MODE_800X600X565 0x114
189 #define VBE_VESA_MODE_800X600X888 0x115
190 #define VBE_VESA_MODE_1024X768X1555 0x116
191 #define VBE_VESA_MODE_1024X768X565 0x117
192 #define VBE_VESA_MODE_1024X768X888 0x118
193 #define VBE_VESA_MODE_1280X1024X1555 0x119
194 #define VBE_VESA_MODE_1280X1024X565 0x11A
195 #define VBE_VESA_MODE_1280X1024X888 0x11B
197 // BOCHS/PLEX86 'own' mode numbers
198 #define VBE_OWN_MODE_320X200X8888 0x140
199 #define VBE_OWN_MODE_640X400X8888 0x141
200 #define VBE_OWN_MODE_640X480X8888 0x142
201 #define VBE_OWN_MODE_800X600X8888 0x143
202 #define VBE_OWN_MODE_1024X768X8888 0x144
203 #define VBE_OWN_MODE_1280X1024X8888 0x145
204 #define VBE_OWN_MODE_320X200X8 0x146
206 #define VBE_VESA_MODE_END_OF_LIST 0xFFFF
210 #define VBE_CAPABILITY_8BIT_DAC 0x0001
211 #define VBE_CAPABILITY_NOT_VGA_COMPATIBLE 0x0002
212 #define VBE_CAPABILITY_RAMDAC_USE_BLANK_BIT 0x0004
213 #define VBE_CAPABILITY_STEREOSCOPIC_SUPPORT 0x0008
214 #define VBE_CAPABILITY_STEREO_VIA_VESA_EVC 0x0010
218 #define VBE_MODE_ATTRIBUTE_SUPPORTED 0x0001
219 #define VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE 0x0002
220 #define VBE_MODE_ATTRIBUTE_TTY_BIOS_SUPPORT 0x0004
221 #define VBE_MODE_ATTRIBUTE_COLOR_MODE 0x0008
222 #define VBE_MODE_ATTRIBUTE_GRAPHICS_MODE 0x0010
223 #define VBE_MODE_ATTRIBUTE_NOT_VGA_COMPATIBLE 0x0020
224 #define VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW 0x0040
225 #define VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE 0x0080
226 #define VBE_MODE_ATTRIBUTE_DOUBLE_SCAN_MODE 0x0100
227 #define VBE_MODE_ATTRIBUTE_INTERLACE_MODE 0x0200
228 #define VBE_MODE_ATTRIBUTE_HARDWARE_TRIPLE_BUFFER 0x0400
229 #define VBE_MODE_ATTRIBUTE_HARDWARE_STEREOSCOPIC_DISPLAY 0x0800
230 #define VBE_MODE_ATTRIBUTE_DUAL_DISPLAY_START_ADDRESS 0x1000
232 #define VBE_MODE_ATTTRIBUTE_LFB_ONLY ( VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW | VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE )
236 #define VBE_WINDOW_ATTRIBUTE_RELOCATABLE 0x01
237 #define VBE_WINDOW_ATTRIBUTE_READABLE 0x02
238 #define VBE_WINDOW_ATTRIBUTE_WRITEABLE 0x04
242 #define VBE_MEMORYMODEL_TEXT_MODE 0x00
243 #define VBE_MEMORYMODEL_CGA_GRAPHICS 0x01
244 #define VBE_MEMORYMODEL_HERCULES_GRAPHICS 0x02
245 #define VBE_MEMORYMODEL_PLANAR 0x03
246 #define VBE_MEMORYMODEL_PACKED_PIXEL 0x04
247 #define VBE_MEMORYMODEL_NON_CHAIN_4_256 0x05
248 #define VBE_MEMORYMODEL_DIRECT_COLOR 0x06
249 #define VBE_MEMORYMODEL_YUV 0x07
251 // DirectColorModeInfo
253 #define VBE_DIRECTCOLOR_COLOR_RAMP_PROGRAMMABLE 0x01
254 #define VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 0x02
256 // GUEST <-> HOST Communication API
258 // FIXME: either dynamicly ask host for this or put somewhere high in physical memory
262 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
264 #define VBE_DISPI_BANK_ADDRESS 0xA0000
265 #define VBE_DISPI_BANK_SIZE_KB 64
267 #define VBE_DISPI_MAX_XRES 1024
268 #define VBE_DISPI_MAX_YRES 768
270 #define VBE_DISPI_IOPORT_INDEX 0x01CE
271 #define VBE_DISPI_IOPORT_DATA 0x01CF
273 #define VBE_DISPI_INDEX_ID 0x0
274 #define VBE_DISPI_INDEX_XRES 0x1
275 #define VBE_DISPI_INDEX_YRES 0x2
276 #define VBE_DISPI_INDEX_BPP 0x3
277 #define VBE_DISPI_INDEX_ENABLE 0x4
278 #define VBE_DISPI_INDEX_BANK 0x5
279 #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
280 #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
281 #define VBE_DISPI_INDEX_X_OFFSET 0x8
282 #define VBE_DISPI_INDEX_Y_OFFSET 0x9
284 #define VBE_DISPI_ID0 0xB0C0
285 #define VBE_DISPI_ID1 0xB0C1
286 #define VBE_DISPI_ID2 0xB0C2
287 #define VBE_DISPI_ID3 0xB0C3
289 #define VBE_DISPI_DISABLED 0x00
290 #define VBE_DISPI_ENABLED 0x01
291 #define VBE_DISPI_GETCAPS 0x02
292 #define VBE_DISPI_8BIT_DAC 0x20
293 #define VBE_DISPI_LFB_ENABLED 0x40
294 #define VBE_DISPI_NOCLEARMEM 0x80
296 #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
299 #define VBE_TOTAL_VIDEO_MEMORY_DIV_64K (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB*1024/64)