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();
15 void vbe_display_info();
16 void vbe_biosfn_return_controller_information(AX
, ES
, DI
);
17 void vbe_biosfn_return_mode_information(AX
, CX
, ES
, DI
);
18 void vbe_biosfn_set_mode(AX
, BX
, ES
, DI
);
19 void vbe_biosfn_return_current_mode(AX
, BX
);
20 void vbe_biosfn_save_restore_state(AX
, DL
, CX
, ES
, BX
);
21 void vbe_biosfn_display_window_control(AX
,BX
,DX
);
22 void vbe_biosfn_set_get_logical_scan_line_length(AX
,BX
,CX
,DX
);
23 void vbe_biosfn_set_get_display_start(AX
,BX
,CX
,DX
);
24 void vbe_biosfn_set_get_dac_palette_format(AX
);
25 void vbe_biosfn_set_get_palette_data(AX
);
26 void vbe_biosfn_return_protected_mode_interface(AX
);
28 // The official VBE Information Block
29 typedef struct VbeInfoBlock
31 Bit8u VbeSignature
[4];
33 Bit16u OemStringPtr_Off
;
34 Bit16u OemStringPtr_Seg
;
35 Bit8u Capabilities
[4];
36 Bit16u VideoModePtr_Off
;
37 Bit16u VideoModePtr_Seg
;
39 Bit16u OemSoftwareRev
;
40 Bit16u OemVendorNamePtr_Off
;
41 Bit16u OemVendorNamePtr_Seg
;
42 Bit16u OemProductNamePtr_Off
;
43 Bit16u OemProductNamePtr_Seg
;
44 Bit16u OemProductRevPtr_Off
;
45 Bit16u OemProductRevPtr_Seg
;
46 //Bit8u Reserved[222];
47 Bit16u Reserved
[111];// FIXME use this to put a dynamicly generated mode list in
52 // This one is for compactly storing a static list of mode info blocks
53 // this saves us 189 bytes per block
54 typedef struct ModeInfoBlockCompact
56 // Mandatory information for all VBE revisions
57 Bit16u ModeAttributes
;
60 Bit16u WinGranularity
;
65 Bit16u BytesPerScanLine
;
66 // Mandatory information for VBE 1.2 and above
76 Bit8u NumberOfImagePages
;
78 // Direct Color fields (required for direct/6 and YUV/7 memory models)
80 Bit8u RedFieldPosition
;
82 Bit8u GreenFieldPosition
;
84 Bit8u BlueFieldPosition
;
86 Bit8u RsvdFieldPosition
;
87 Bit8u DirectColorModeInfo
;
88 // Mandatory information for VBE 2.0 and above
90 Bit32u OffScreenMemOffset
;
91 Bit16u OffScreenMemSize
;
92 // Mandatory information for VBE 3.0 and above
93 Bit16u LinBytesPerScanLine
;
94 Bit8u BnkNumberOfPages
;
95 Bit8u LinNumberOfPages
;
97 Bit8u LinRedFieldPosition
;
98 Bit8u LinGreenMaskSize
;
99 Bit8u LinGreenFieldPosition
;
100 Bit8u LinBlueMaskSize
;
101 Bit8u LinBlueFieldPosition
;
102 Bit8u LinRsvdMaskSize
;
103 Bit8u LinRsvdFieldPosition
;
104 Bit32u MaxPixelClock
;
105 // Bit8u Reserved[189]; // DO NOT PUT THIS IN HERE because of Compact Mode Info storage in bios
106 } ModeInfoBlockCompact
;
108 typedef struct ModeInfoBlock
110 // Mandatory information for all VBE revisions
111 Bit16u ModeAttributes
;
112 Bit8u WinAAttributes
;
113 Bit8u WinBAttributes
;
114 Bit16u WinGranularity
;
119 Bit16u BytesPerScanLine
;
120 // Mandatory information for VBE 1.2 and above
125 Bit8u NumberOfPlanes
;
130 Bit8u NumberOfImagePages
;
132 // Direct Color fields (required for direct/6 and YUV/7 memory models)
134 Bit8u RedFieldPosition
;
136 Bit8u GreenFieldPosition
;
138 Bit8u BlueFieldPosition
;
140 Bit8u RsvdFieldPosition
;
141 Bit8u DirectColorModeInfo
;
142 // Mandatory information for VBE 2.0 and above
144 Bit32u OffScreenMemOffset
;
145 Bit16u OffScreenMemSize
;
146 // Mandatory information for VBE 3.0 and above
147 Bit16u LinBytesPerScanLine
;
148 Bit8u BnkNumberOfPages
;
149 Bit8u LinNumberOfPages
;
150 Bit8u LinRedMaskSize
;
151 Bit8u LinRedFieldPosition
;
152 Bit8u LinGreenMaskSize
;
153 Bit8u LinGreenFieldPosition
;
154 Bit8u LinBlueMaskSize
;
155 Bit8u LinBlueFieldPosition
;
156 Bit8u LinRsvdMaskSize
;
157 Bit8u LinRsvdFieldPosition
;
158 Bit32u MaxPixelClock
;
162 // VBE Return Status Info
164 #define VBE_RETURN_STATUS_SUPPORTED 0x4F
165 #define VBE_RETURN_STATUS_UNSUPPORTED 0x00
167 #define VBE_RETURN_STATUS_SUCCESSFULL 0x00
168 #define VBE_RETURN_STATUS_FAILED 0x01
169 #define VBE_RETURN_STATUS_NOT_SUPPORTED 0x02
170 #define VBE_RETURN_STATUS_INVALID 0x03
174 #define VBE_MODE_VESA_DEFINED 0x0100
175 #define VBE_MODE_REFRESH_RATE_USE_CRTC 0x0800
176 #define VBE_MODE_LINEAR_FRAME_BUFFER 0x4000
177 #define VBE_MODE_PRESERVE_DISPLAY_MEMORY 0x8000
179 // VBE GFX Mode Number
181 #define VBE_VESA_MODE_640X400X8 0x100
182 #define VBE_VESA_MODE_640X480X8 0x101
183 #define VBE_VESA_MODE_800X600X4 0x102
184 #define VBE_VESA_MODE_800X600X8 0x103
185 #define VBE_VESA_MODE_1024X768X4 0x104
186 #define VBE_VESA_MODE_1024X768X8 0x105
187 #define VBE_VESA_MODE_1280X1024X4 0x106
188 #define VBE_VESA_MODE_1280X1024X8 0x107
189 #define VBE_VESA_MODE_320X200X1555 0x10D
190 #define VBE_VESA_MODE_320X200X565 0x10E
191 #define VBE_VESA_MODE_320X200X888 0x10F
192 #define VBE_VESA_MODE_640X480X1555 0x110
193 #define VBE_VESA_MODE_640X480X565 0x111
194 #define VBE_VESA_MODE_640X480X888 0x112
195 #define VBE_VESA_MODE_800X600X1555 0x113
196 #define VBE_VESA_MODE_800X600X565 0x114
197 #define VBE_VESA_MODE_800X600X888 0x115
198 #define VBE_VESA_MODE_1024X768X1555 0x116
199 #define VBE_VESA_MODE_1024X768X565 0x117
200 #define VBE_VESA_MODE_1024X768X888 0x118
201 #define VBE_VESA_MODE_1280X1024X1555 0x119
202 #define VBE_VESA_MODE_1280X1024X565 0x11A
203 #define VBE_VESA_MODE_1280X1024X888 0x11B
205 // BOCHS/PLEX86 'own' mode numbers
206 // FIXME: Add more modi
207 #define VBE_OWN_MODE_320X200X8888 0x140
208 #define VBE_OWN_MODE_640X400X8888 0x141
209 #define VBE_OWN_MODE_640X480X8888 0x142
210 #define VBE_OWN_MODE_800X600X8888 0x143
211 #define VBE_OWN_MODE_1024X768X8888 0x144
212 #define VBE_OWN_MODE_1280X1024X8888 0x145
213 #define VBE_OWN_MODE_320X200X8 0x146
215 #define VBE_VESA_MODE_END_OF_LIST 0xFFFF
219 #define VBE_CAPABILITY_8BIT_DAC 0x0001
220 #define VBE_CAPABILITY_NOT_VGA_COMPATIBLE 0x0002
221 #define VBE_CAPABILITY_RAMDAC_USE_BLANK_BIT 0x0004
222 #define VBE_CAPABILITY_STEREOSCOPIC_SUPPORT 0x0008
223 #define VBE_CAPABILITY_STEREO_VIA_VESA_EVC 0x0010
227 #define VBE_MODE_ATTRIBUTE_SUPPORTED 0x0001
228 #define VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE 0x0002
229 #define VBE_MODE_ATTRIBUTE_TTY_BIOS_SUPPORT 0x0004
230 #define VBE_MODE_ATTRIBUTE_COLOR_MODE 0x0008
231 #define VBE_MODE_ATTRIBUTE_GRAPHICS_MODE 0x0010
232 #define VBE_MODE_ATTRIBUTE_NOT_VGA_COMPATIBLE 0x0020
233 #define VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW 0x0040
234 #define VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE 0x0080
235 #define VBE_MODE_ATTRIBUTE_DOUBLE_SCAN_MODE 0x0100
236 #define VBE_MODE_ATTRIBUTE_INTERLACE_MODE 0x0200
237 #define VBE_MODE_ATTRIBUTE_HARDWARE_TRIPLE_BUFFER 0x0400
238 #define VBE_MODE_ATTRIBUTE_HARDWARE_STEREOSCOPIC_DISPLAY 0x0800
239 #define VBE_MODE_ATTRIBUTE_DUAL_DISPLAY_START_ADDRESS 0x1000
241 #define VBE_MODE_ATTTRIBUTE_LFB_ONLY ( VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW | VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE )
245 #define VBE_WINDOW_ATTRIBUTE_RELOCATABLE 0x01
246 #define VBE_WINDOW_ATTRIBUTE_READABLE 0x02
247 #define VBE_WINDOW_ATTRIBUTE_WRITEABLE 0x04
251 #define VBE_MEMORYMODEL_TEXT_MODE 0x00
252 #define VBE_MEMORYMODEL_CGA_GRAPHICS 0x01
253 #define VBE_MEMORYMODEL_HERCULES_GRAPHICS 0x02
254 #define VBE_MEMORYMODEL_PLANAR 0x03
255 #define VBE_MEMORYMODEL_PACKED_PIXEL 0x04
256 #define VBE_MEMORYMODEL_NON_CHAIN_4_256 0x05
257 #define VBE_MEMORYMODEL_DIRECT_COLOR 0x06
258 #define VBE_MEMORYMODEL_YUV 0x07
260 // DirectColorModeInfo
262 #define VBE_DIRECTCOLOR_COLOR_RAMP_PROGRAMMABLE 0x01
263 #define VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 0x02
265 // GUEST <-> HOST Communication API
267 // FIXME: either dynamicly ask host for this or put somewhere high in physical memory
271 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
273 #define VBE_DISPI_BANK_ADDRESS 0xA0000
274 #define VBE_DISPI_BANK_SIZE_KB 64
276 #define VBE_DISPI_MAX_XRES 1024
277 #define VBE_DISPI_MAX_YRES 768
279 #define VBE_DISPI_IOPORT_INDEX 0x01CE
280 #define VBE_DISPI_IOPORT_DATA 0x01CF
282 #define VBE_DISPI_INDEX_ID 0x0
283 #define VBE_DISPI_INDEX_XRES 0x1
284 #define VBE_DISPI_INDEX_YRES 0x2
285 #define VBE_DISPI_INDEX_BPP 0x3
286 #define VBE_DISPI_INDEX_ENABLE 0x4
287 #define VBE_DISPI_INDEX_BANK 0x5
288 #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
289 #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
290 #define VBE_DISPI_INDEX_X_OFFSET 0x8
291 #define VBE_DISPI_INDEX_Y_OFFSET 0x9
293 #define VBE_DISPI_ID0 0xB0C0
294 #define VBE_DISPI_ID1 0xB0C1
295 #define VBE_DISPI_ID2 0xB0C2
297 #define VBE_DISPI_DISABLED 0x00
298 #define VBE_DISPI_ENABLED 0x01
299 #define VBE_DISPI_LFB_ENABLED 0x40
300 #define VBE_DISPI_NOCLEARMEM 0x80
302 #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
305 #define VBE_TOTAL_VIDEO_MEMORY_DIV_64K (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB*1024/64)