VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/BIOS/vbe.h@ 5627

Last change on this file since 5627 was 5450, checked in by vboxsync, 17 years ago

Synced with updated VGA/VESA BIOS.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.8 KB
Line 
1#ifndef vbe_h_included
2#define vbe_h_included
3
4#include "vgabios.h"
5
6// DISPI helper function
7void dispi_set_enable(enable);
8
9/** VBE int10 API
10 *
11 * See the function descriptions in vbe.c for more information
12 */
13Boolean vbe_has_vbe_display();
14void vbe_biosfn_return_controller_information(AX, ES, DI);
15void vbe_biosfn_return_mode_information(AX, CX, ES, DI);
16void vbe_biosfn_set_mode(AX, BX, ES, DI);
17void vbe_biosfn_save_restore_state(AX, CX, DX, ES, BX);
18void vbe_biosfn_return_protected_mode_interface(AX);
19
20// The official VBE Information Block
21typedef struct VbeInfoBlock
22{
23 Bit8u VbeSignature[4];
24 Bit16u VbeVersion;
25 Bit16u OemStringPtr_Off;
26 Bit16u OemStringPtr_Seg;
27 Bit8u Capabilities[4];
28 Bit16u VideoModePtr_Off;
29 Bit16u VideoModePtr_Seg;
30 Bit16u TotalMemory;
31 Bit16u OemSoftwareRev;
32 Bit16u OemVendorNamePtr_Off;
33 Bit16u OemVendorNamePtr_Seg;
34 Bit16u OemProductNamePtr_Off;
35 Bit16u OemProductNamePtr_Seg;
36 Bit16u OemProductRevPtr_Off;
37 Bit16u OemProductRevPtr_Seg;
38 Bit16u Reserved[111]; // used for dynamicly generated mode list
39 Bit8u OemData[256];
40} VbeInfoBlock;
41
42
43// This one is for compactly storing a static list of mode info blocks
44// this saves us 189 bytes per block
45typedef struct ModeInfoBlockCompact
46{
47// Mandatory information for all VBE revisions
48 Bit16u ModeAttributes;
49 Bit8u WinAAttributes;
50 Bit8u WinBAttributes;
51 Bit16u WinGranularity;
52 Bit16u WinSize;
53 Bit16u WinASegment;
54 Bit16u WinBSegment;
55 Bit32u WinFuncPtr;
56 Bit16u BytesPerScanLine;
57// Mandatory information for VBE 1.2 and above
58 Bit16u XResolution;
59 Bit16u YResolution;
60 Bit8u XCharSize;
61 Bit8u YCharSize;
62 Bit8u NumberOfPlanes;
63 Bit8u BitsPerPixel;
64 Bit8u NumberOfBanks;
65 Bit8u MemoryModel;
66 Bit8u BankSize;
67 Bit8u NumberOfImagePages;
68 Bit8u Reserved_page;
69// Direct Color fields (required for direct/6 and YUV/7 memory models)
70 Bit8u RedMaskSize;
71 Bit8u RedFieldPosition;
72 Bit8u GreenMaskSize;
73 Bit8u GreenFieldPosition;
74 Bit8u BlueMaskSize;
75 Bit8u BlueFieldPosition;
76 Bit8u RsvdMaskSize;
77 Bit8u RsvdFieldPosition;
78 Bit8u DirectColorModeInfo;
79// Mandatory information for VBE 2.0 and above
80 Bit32u PhysBasePtr;
81 Bit32u OffScreenMemOffset;
82 Bit16u OffScreenMemSize;
83// Mandatory information for VBE 3.0 and above
84 Bit16u LinBytesPerScanLine;
85 Bit8u BnkNumberOfPages;
86 Bit8u LinNumberOfPages;
87 Bit8u LinRedMaskSize;
88 Bit8u LinRedFieldPosition;
89 Bit8u LinGreenMaskSize;
90 Bit8u LinGreenFieldPosition;
91 Bit8u LinBlueMaskSize;
92 Bit8u LinBlueFieldPosition;
93 Bit8u LinRsvdMaskSize;
94 Bit8u LinRsvdFieldPosition;
95 Bit32u MaxPixelClock;
96// Bit8u Reserved[189]; // DO NOT PUT THIS IN HERE because of Compact Mode Info storage in bios
97} ModeInfoBlockCompact;
98
99typedef struct ModeInfoBlock
100{
101// Mandatory information for all VBE revisions
102 Bit16u ModeAttributes;
103 Bit8u WinAAttributes;
104 Bit8u WinBAttributes;
105 Bit16u WinGranularity;
106 Bit16u WinSize;
107 Bit16u WinASegment;
108 Bit16u WinBSegment;
109 Bit32u WinFuncPtr;
110 Bit16u BytesPerScanLine;
111// Mandatory information for VBE 1.2 and above
112 Bit16u XResolution;
113 Bit16u YResolution;
114 Bit8u XCharSize;
115 Bit8u YCharSize;
116 Bit8u NumberOfPlanes;
117 Bit8u BitsPerPixel;
118 Bit8u NumberOfBanks;
119 Bit8u MemoryModel;
120 Bit8u BankSize;
121 Bit8u NumberOfImagePages;
122 Bit8u Reserved_page;
123// Direct Color fields (required for direct/6 and YUV/7 memory models)
124 Bit8u RedMaskSize;
125 Bit8u RedFieldPosition;
126 Bit8u GreenMaskSize;
127 Bit8u GreenFieldPosition;
128 Bit8u BlueMaskSize;
129 Bit8u BlueFieldPosition;
130 Bit8u RsvdMaskSize;
131 Bit8u RsvdFieldPosition;
132 Bit8u DirectColorModeInfo;
133// Mandatory information for VBE 2.0 and above
134 Bit32u PhysBasePtr;
135 Bit32u OffScreenMemOffset;
136 Bit16u OffScreenMemSize;
137// Mandatory information for VBE 3.0 and above
138 Bit16u LinBytesPerScanLine;
139 Bit8u BnkNumberOfPages;
140 Bit8u LinNumberOfPages;
141 Bit8u LinRedMaskSize;
142 Bit8u LinRedFieldPosition;
143 Bit8u LinGreenMaskSize;
144 Bit8u LinGreenFieldPosition;
145 Bit8u LinBlueMaskSize;
146 Bit8u LinBlueFieldPosition;
147 Bit8u LinRsvdMaskSize;
148 Bit8u LinRsvdFieldPosition;
149 Bit32u MaxPixelClock;
150 Bit8u Reserved[189];
151} ModeInfoBlock;
152
153typedef struct ModeInfoListItem
154{
155 Bit16u mode;
156 ModeInfoBlockCompact info;
157} ModeInfoListItem;
158
159// VBE Return Status Info
160// AL
161#define VBE_RETURN_STATUS_SUPPORTED 0x4F
162#define VBE_RETURN_STATUS_UNSUPPORTED 0x00
163// AH
164#define VBE_RETURN_STATUS_SUCCESSFULL 0x00
165#define VBE_RETURN_STATUS_FAILED 0x01
166#define VBE_RETURN_STATUS_NOT_SUPPORTED 0x02
167#define VBE_RETURN_STATUS_INVALID 0x03
168
169// VBE Mode Numbers
170
171#define VBE_MODE_VESA_DEFINED 0x0100
172#define VBE_MODE_REFRESH_RATE_USE_CRTC 0x0800
173#define VBE_MODE_LINEAR_FRAME_BUFFER 0x4000
174#define VBE_MODE_PRESERVE_DISPLAY_MEMORY 0x8000
175
176// VBE GFX Mode Number
177
178#define VBE_VESA_MODE_640X400X8 0x100
179#define VBE_VESA_MODE_640X480X8 0x101
180#define VBE_VESA_MODE_800X600X4 0x102
181#define VBE_VESA_MODE_800X600X8 0x103
182#define VBE_VESA_MODE_1024X768X4 0x104
183#define VBE_VESA_MODE_1024X768X8 0x105
184#define VBE_VESA_MODE_1280X1024X4 0x106
185#define VBE_VESA_MODE_1280X1024X8 0x107
186#define VBE_VESA_MODE_320X200X1555 0x10D
187#define VBE_VESA_MODE_320X200X565 0x10E
188#define VBE_VESA_MODE_320X200X888 0x10F
189#define VBE_VESA_MODE_640X480X1555 0x110
190#define VBE_VESA_MODE_640X480X565 0x111
191#define VBE_VESA_MODE_640X480X888 0x112
192#define VBE_VESA_MODE_800X600X1555 0x113
193#define VBE_VESA_MODE_800X600X565 0x114
194#define VBE_VESA_MODE_800X600X888 0x115
195#define VBE_VESA_MODE_1024X768X1555 0x116
196#define VBE_VESA_MODE_1024X768X565 0x117
197#define VBE_VESA_MODE_1024X768X888 0x118
198#define VBE_VESA_MODE_1280X1024X1555 0x119
199#define VBE_VESA_MODE_1280X1024X565 0x11A
200#define VBE_VESA_MODE_1280X1024X888 0x11B
201#define VBE_VESA_MODE_1600X1200X8 0x11C
202#define VBE_VESA_MODE_1600X1200X1555 0x11D
203#define VBE_VESA_MODE_1600X1200X565 0x11E
204#define VBE_VESA_MODE_1600X1200X888 0x11F
205
206// BOCHS/PLEX86 'own' mode numbers
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
214#define VBE_OWN_MODE_1600X1200X8888 0x147
215#define VBE_OWN_MODE_1152X864X8 0x148
216#define VBE_OWN_MODE_1152X864X1555 0x149
217#define VBE_OWN_MODE_1152X864X565 0x14a
218#define VBE_OWN_MODE_1152X864X888 0x14b
219#define VBE_OWN_MODE_1152X864X8888 0x14c
220
221#define VBE_VESA_MODE_END_OF_LIST 0xFFFF
222
223// Capabilities
224
225#define VBE_CAPABILITY_8BIT_DAC 0x0001
226#define VBE_CAPABILITY_NOT_VGA_COMPATIBLE 0x0002
227#define VBE_CAPABILITY_RAMDAC_USE_BLANK_BIT 0x0004
228#define VBE_CAPABILITY_STEREOSCOPIC_SUPPORT 0x0008
229#define VBE_CAPABILITY_STEREO_VIA_VESA_EVC 0x0010
230
231// Mode Attributes
232
233#define VBE_MODE_ATTRIBUTE_SUPPORTED 0x0001
234#define VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE 0x0002
235#define VBE_MODE_ATTRIBUTE_TTY_BIOS_SUPPORT 0x0004
236#define VBE_MODE_ATTRIBUTE_COLOR_MODE 0x0008
237#define VBE_MODE_ATTRIBUTE_GRAPHICS_MODE 0x0010
238#define VBE_MODE_ATTRIBUTE_NOT_VGA_COMPATIBLE 0x0020
239#define VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW 0x0040
240#define VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE 0x0080
241#define VBE_MODE_ATTRIBUTE_DOUBLE_SCAN_MODE 0x0100
242#define VBE_MODE_ATTRIBUTE_INTERLACE_MODE 0x0200
243#define VBE_MODE_ATTRIBUTE_HARDWARE_TRIPLE_BUFFER 0x0400
244#define VBE_MODE_ATTRIBUTE_HARDWARE_STEREOSCOPIC_DISPLAY 0x0800
245#define VBE_MODE_ATTRIBUTE_DUAL_DISPLAY_START_ADDRESS 0x1000
246
247#define VBE_MODE_ATTTRIBUTE_LFB_ONLY ( VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW | VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE )
248
249// Window attributes
250
251#define VBE_WINDOW_ATTRIBUTE_RELOCATABLE 0x01
252#define VBE_WINDOW_ATTRIBUTE_READABLE 0x02
253#define VBE_WINDOW_ATTRIBUTE_WRITEABLE 0x04
254
255// Memory model
256
257#define VBE_MEMORYMODEL_TEXT_MODE 0x00
258#define VBE_MEMORYMODEL_CGA_GRAPHICS 0x01
259#define VBE_MEMORYMODEL_HERCULES_GRAPHICS 0x02
260#define VBE_MEMORYMODEL_PLANAR 0x03
261#define VBE_MEMORYMODEL_PACKED_PIXEL 0x04
262#define VBE_MEMORYMODEL_NON_CHAIN_4_256 0x05
263#define VBE_MEMORYMODEL_DIRECT_COLOR 0x06
264#define VBE_MEMORYMODEL_YUV 0x07
265
266// DirectColorModeInfo
267
268#define VBE_DIRECTCOLOR_COLOR_RAMP_PROGRAMMABLE 0x01
269#define VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 0x02
270
271// GUEST <-> HOST Communication API
272
273// FIXME: either dynamicly ask host for this or put somewhere high in physical memory
274// like 0xE0000000
275
276
277 #define VBE_DISPI_BANK_ADDRESS 0xA0000
278 #define VBE_DISPI_BANK_SIZE_KB 64
279
280 #define VBE_DISPI_MAX_XRES 1024
281 #define VBE_DISPI_MAX_YRES 768
282
283 #define VBE_DISPI_IOPORT_INDEX 0x01CE
284 #define VBE_DISPI_IOPORT_DATA 0x01CF
285
286 #define VBE_DISPI_INDEX_ID 0x0
287 #define VBE_DISPI_INDEX_XRES 0x1
288 #define VBE_DISPI_INDEX_YRES 0x2
289 #define VBE_DISPI_INDEX_BPP 0x3
290 #define VBE_DISPI_INDEX_ENABLE 0x4
291 #define VBE_DISPI_INDEX_BANK 0x5
292 #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
293 #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
294 #define VBE_DISPI_INDEX_X_OFFSET 0x8
295 #define VBE_DISPI_INDEX_Y_OFFSET 0x9
296
297 #define VBE_DISPI_ID0 0xB0C0
298 #define VBE_DISPI_ID1 0xB0C1
299 #define VBE_DISPI_ID2 0xB0C2
300 #define VBE_DISPI_ID3 0xB0C3
301 #define VBE_DISPI_ID4 0xB0C4
302
303 #define VBE_DISPI_DISABLED 0x00
304 #define VBE_DISPI_ENABLED 0x01
305 #define VBE_DISPI_GETCAPS 0x02
306 #define VBE_DISPI_8BIT_DAC 0x20
307 #define VBE_DISPI_LFB_ENABLED 0x40
308 #define VBE_DISPI_NOCLEARMEM 0x80
309
310 #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
311
312 /**
313 * VBE Bios Extra Data structure.
314 * @remark duplicated in vga_int.h.
315 */
316 typedef struct VBEHeader
317 {
318 /** Signature (VBEHEADER_MAGIC). */
319 Bit16u u16Signature;
320 /** Data size. */
321 Bit16u cbData;
322 } VBEHeader;
323
324 /** The value of the VBEHEADER::u16Signature field.
325 * @remark duplicated in vga_int.h. */
326 #define VBEHEADER_MAGIC 0x77CC
327
328 /** The extra port which is used to read the mode list.
329 * @remark duplicated in vga_int.h. */
330 #define VBE_EXTRA_PORT 0x3b6
331
332 /** The extra port which is used for debug printf.
333 * @remark duplicated in vga_int.h. */
334 #define VBE_PRINTF_PORT 0x3b7
335
336
337#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette