1 | #ifndef vbe_h_included
|
---|
2 | #define vbe_h_included
|
---|
3 |
|
---|
4 | #include "vgabios.h"
|
---|
5 |
|
---|
6 | #include <VBox/Hardware/VBoxVideoVBE.h>
|
---|
7 |
|
---|
8 | // DISPI helper function
|
---|
9 | void dispi_set_enable(enable);
|
---|
10 |
|
---|
11 | /** VBE int10 API
|
---|
12 | *
|
---|
13 | * See the function descriptions in vbe.c for more information
|
---|
14 | */
|
---|
15 | Boolean vbe_has_vbe_display();
|
---|
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_save_restore_state(AX, CX, DX, ES, BX);
|
---|
20 | void vbe_biosfn_return_protected_mode_interface(AX);
|
---|
21 |
|
---|
22 | // The official VBE Information Block
|
---|
23 | typedef struct VbeInfoBlock
|
---|
24 | {
|
---|
25 | Bit8u VbeSignature[4];
|
---|
26 | Bit16u VbeVersion;
|
---|
27 | Bit16u OemStringPtr_Off;
|
---|
28 | Bit16u OemStringPtr_Seg;
|
---|
29 | Bit8u Capabilities[4];
|
---|
30 | Bit16u VideoModePtr_Off;
|
---|
31 | Bit16u VideoModePtr_Seg;
|
---|
32 | Bit16u TotalMemory;
|
---|
33 | Bit16u OemSoftwareRev;
|
---|
34 | Bit16u OemVendorNamePtr_Off;
|
---|
35 | Bit16u OemVendorNamePtr_Seg;
|
---|
36 | Bit16u OemProductNamePtr_Off;
|
---|
37 | Bit16u OemProductNamePtr_Seg;
|
---|
38 | Bit16u OemProductRevPtr_Off;
|
---|
39 | Bit16u OemProductRevPtr_Seg;
|
---|
40 | Bit16u Reserved[111]; // used for dynamicly generated mode list
|
---|
41 | Bit8u OemData[256];
|
---|
42 | } VbeInfoBlock;
|
---|
43 |
|
---|
44 |
|
---|
45 | // This one is for compactly storing a static list of mode info blocks
|
---|
46 | // this saves us 189 bytes per block
|
---|
47 | typedef struct ModeInfoBlockCompact
|
---|
48 | {
|
---|
49 | // Mandatory information for all VBE revisions
|
---|
50 | Bit16u ModeAttributes;
|
---|
51 | Bit8u WinAAttributes;
|
---|
52 | Bit8u WinBAttributes;
|
---|
53 | Bit16u WinGranularity;
|
---|
54 | Bit16u WinSize;
|
---|
55 | Bit16u WinASegment;
|
---|
56 | Bit16u WinBSegment;
|
---|
57 | Bit32u WinFuncPtr;
|
---|
58 | Bit16u BytesPerScanLine;
|
---|
59 | // Mandatory information for VBE 1.2 and above
|
---|
60 | Bit16u XResolution;
|
---|
61 | Bit16u YResolution;
|
---|
62 | Bit8u XCharSize;
|
---|
63 | Bit8u YCharSize;
|
---|
64 | Bit8u NumberOfPlanes;
|
---|
65 | Bit8u BitsPerPixel;
|
---|
66 | Bit8u NumberOfBanks;
|
---|
67 | Bit8u MemoryModel;
|
---|
68 | Bit8u BankSize;
|
---|
69 | Bit8u NumberOfImagePages;
|
---|
70 | Bit8u Reserved_page;
|
---|
71 | // Direct Color fields (required for direct/6 and YUV/7 memory models)
|
---|
72 | Bit8u RedMaskSize;
|
---|
73 | Bit8u RedFieldPosition;
|
---|
74 | Bit8u GreenMaskSize;
|
---|
75 | Bit8u GreenFieldPosition;
|
---|
76 | Bit8u BlueMaskSize;
|
---|
77 | Bit8u BlueFieldPosition;
|
---|
78 | Bit8u RsvdMaskSize;
|
---|
79 | Bit8u RsvdFieldPosition;
|
---|
80 | Bit8u DirectColorModeInfo;
|
---|
81 | // Mandatory information for VBE 2.0 and above
|
---|
82 | Bit32u PhysBasePtr;
|
---|
83 | Bit32u OffScreenMemOffset;
|
---|
84 | Bit16u OffScreenMemSize;
|
---|
85 | // Mandatory information for VBE 3.0 and above
|
---|
86 | Bit16u LinBytesPerScanLine;
|
---|
87 | Bit8u BnkNumberOfPages;
|
---|
88 | Bit8u LinNumberOfPages;
|
---|
89 | Bit8u LinRedMaskSize;
|
---|
90 | Bit8u LinRedFieldPosition;
|
---|
91 | Bit8u LinGreenMaskSize;
|
---|
92 | Bit8u LinGreenFieldPosition;
|
---|
93 | Bit8u LinBlueMaskSize;
|
---|
94 | Bit8u LinBlueFieldPosition;
|
---|
95 | Bit8u LinRsvdMaskSize;
|
---|
96 | Bit8u LinRsvdFieldPosition;
|
---|
97 | Bit32u MaxPixelClock;
|
---|
98 | // Bit8u Reserved[189]; // DO NOT PUT THIS IN HERE because of Compact Mode Info storage in bios
|
---|
99 | } ModeInfoBlockCompact;
|
---|
100 |
|
---|
101 | typedef struct ModeInfoBlock
|
---|
102 | {
|
---|
103 | // Mandatory information for all VBE revisions
|
---|
104 | Bit16u ModeAttributes;
|
---|
105 | Bit8u WinAAttributes;
|
---|
106 | Bit8u WinBAttributes;
|
---|
107 | Bit16u WinGranularity;
|
---|
108 | Bit16u WinSize;
|
---|
109 | Bit16u WinASegment;
|
---|
110 | Bit16u WinBSegment;
|
---|
111 | Bit32u WinFuncPtr;
|
---|
112 | Bit16u BytesPerScanLine;
|
---|
113 | // Mandatory information for VBE 1.2 and above
|
---|
114 | Bit16u XResolution;
|
---|
115 | Bit16u YResolution;
|
---|
116 | Bit8u XCharSize;
|
---|
117 | Bit8u YCharSize;
|
---|
118 | Bit8u NumberOfPlanes;
|
---|
119 | Bit8u BitsPerPixel;
|
---|
120 | Bit8u NumberOfBanks;
|
---|
121 | Bit8u MemoryModel;
|
---|
122 | Bit8u BankSize;
|
---|
123 | Bit8u NumberOfImagePages;
|
---|
124 | Bit8u Reserved_page;
|
---|
125 | // Direct Color fields (required for direct/6 and YUV/7 memory models)
|
---|
126 | Bit8u RedMaskSize;
|
---|
127 | Bit8u RedFieldPosition;
|
---|
128 | Bit8u GreenMaskSize;
|
---|
129 | Bit8u GreenFieldPosition;
|
---|
130 | Bit8u BlueMaskSize;
|
---|
131 | Bit8u BlueFieldPosition;
|
---|
132 | Bit8u RsvdMaskSize;
|
---|
133 | Bit8u RsvdFieldPosition;
|
---|
134 | Bit8u DirectColorModeInfo;
|
---|
135 | // Mandatory information for VBE 2.0 and above
|
---|
136 | Bit32u PhysBasePtr;
|
---|
137 | Bit32u OffScreenMemOffset;
|
---|
138 | Bit16u OffScreenMemSize;
|
---|
139 | // Mandatory information for VBE 3.0 and above
|
---|
140 | Bit16u LinBytesPerScanLine;
|
---|
141 | Bit8u BnkNumberOfPages;
|
---|
142 | Bit8u LinNumberOfPages;
|
---|
143 | Bit8u LinRedMaskSize;
|
---|
144 | Bit8u LinRedFieldPosition;
|
---|
145 | Bit8u LinGreenMaskSize;
|
---|
146 | Bit8u LinGreenFieldPosition;
|
---|
147 | Bit8u LinBlueMaskSize;
|
---|
148 | Bit8u LinBlueFieldPosition;
|
---|
149 | Bit8u LinRsvdMaskSize;
|
---|
150 | Bit8u LinRsvdFieldPosition;
|
---|
151 | Bit32u MaxPixelClock;
|
---|
152 | Bit8u Reserved[189];
|
---|
153 | } ModeInfoBlock;
|
---|
154 |
|
---|
155 | typedef struct ModeInfoListItem
|
---|
156 | {
|
---|
157 | Bit16u mode;
|
---|
158 | ModeInfoBlockCompact info;
|
---|
159 | } ModeInfoListItem;
|
---|
160 |
|
---|
161 | // VBE Return Status Info
|
---|
162 | // AL
|
---|
163 | #define VBE_RETURN_STATUS_SUPPORTED 0x4F
|
---|
164 | #define VBE_RETURN_STATUS_UNSUPPORTED 0x00
|
---|
165 | // AH
|
---|
166 | #define VBE_RETURN_STATUS_SUCCESSFULL 0x00
|
---|
167 | #define VBE_RETURN_STATUS_FAILED 0x01
|
---|
168 | #define VBE_RETURN_STATUS_NOT_SUPPORTED 0x02
|
---|
169 | #define VBE_RETURN_STATUS_INVALID 0x03
|
---|
170 |
|
---|
171 | // VBE Mode Numbers
|
---|
172 |
|
---|
173 | #define VBE_MODE_VESA_DEFINED 0x0100
|
---|
174 | #define VBE_MODE_REFRESH_RATE_USE_CRTC 0x0800
|
---|
175 | #define VBE_MODE_LINEAR_FRAME_BUFFER 0x4000
|
---|
176 | #define VBE_MODE_PRESERVE_DISPLAY_MEMORY 0x8000
|
---|
177 |
|
---|
178 | // VBE GFX Mode Number
|
---|
179 |
|
---|
180 | #define VBE_VESA_MODE_640X400X8 0x100
|
---|
181 | #define VBE_VESA_MODE_640X480X8 0x101
|
---|
182 | #define VBE_VESA_MODE_800X600X4 0x102
|
---|
183 | #define VBE_VESA_MODE_800X600X8 0x103
|
---|
184 | #define VBE_VESA_MODE_1024X768X4 0x104
|
---|
185 | #define VBE_VESA_MODE_1024X768X8 0x105
|
---|
186 | #define VBE_VESA_MODE_1280X1024X4 0x106
|
---|
187 | #define VBE_VESA_MODE_1280X1024X8 0x107
|
---|
188 | #define VBE_VESA_MODE_320X200X1555 0x10D
|
---|
189 | #define VBE_VESA_MODE_320X200X565 0x10E
|
---|
190 | #define VBE_VESA_MODE_320X200X888 0x10F
|
---|
191 | #define VBE_VESA_MODE_640X480X1555 0x110
|
---|
192 | #define VBE_VESA_MODE_640X480X565 0x111
|
---|
193 | #define VBE_VESA_MODE_640X480X888 0x112
|
---|
194 | #define VBE_VESA_MODE_800X600X1555 0x113
|
---|
195 | #define VBE_VESA_MODE_800X600X565 0x114
|
---|
196 | #define VBE_VESA_MODE_800X600X888 0x115
|
---|
197 | #define VBE_VESA_MODE_1024X768X1555 0x116
|
---|
198 | #define VBE_VESA_MODE_1024X768X565 0x117
|
---|
199 | #define VBE_VESA_MODE_1024X768X888 0x118
|
---|
200 | #define VBE_VESA_MODE_1280X1024X1555 0x119
|
---|
201 | #define VBE_VESA_MODE_1280X1024X565 0x11A
|
---|
202 | #define VBE_VESA_MODE_1280X1024X888 0x11B
|
---|
203 | #define VBE_VESA_MODE_1600X1200X8 0x11C
|
---|
204 | #define VBE_VESA_MODE_1600X1200X1555 0x11D
|
---|
205 | #define VBE_VESA_MODE_1600X1200X565 0x11E
|
---|
206 | #define VBE_VESA_MODE_1600X1200X888 0x11F
|
---|
207 |
|
---|
208 | // BOCHS/PLEX86 'own' mode numbers
|
---|
209 | #define VBE_OWN_MODE_320X200X8888 0x140
|
---|
210 | #define VBE_OWN_MODE_640X400X8888 0x141
|
---|
211 | #define VBE_OWN_MODE_640X480X8888 0x142
|
---|
212 | #define VBE_OWN_MODE_800X600X8888 0x143
|
---|
213 | #define VBE_OWN_MODE_1024X768X8888 0x144
|
---|
214 | #define VBE_OWN_MODE_1280X1024X8888 0x145
|
---|
215 | #define VBE_OWN_MODE_320X200X8 0x146
|
---|
216 | #define VBE_OWN_MODE_1600X1200X8888 0x147
|
---|
217 | #define VBE_OWN_MODE_1152X864X8 0x148
|
---|
218 | #define VBE_OWN_MODE_1152X864X1555 0x149
|
---|
219 | #define VBE_OWN_MODE_1152X864X565 0x14a
|
---|
220 | #define VBE_OWN_MODE_1152X864X888 0x14b
|
---|
221 | #define VBE_OWN_MODE_1152X864X8888 0x14c
|
---|
222 |
|
---|
223 | #define VBE_VESA_MODE_END_OF_LIST 0xFFFF
|
---|
224 |
|
---|
225 | // Capabilities
|
---|
226 |
|
---|
227 | #define VBE_CAPABILITY_8BIT_DAC 0x0001
|
---|
228 | #define VBE_CAPABILITY_NOT_VGA_COMPATIBLE 0x0002
|
---|
229 | #define VBE_CAPABILITY_RAMDAC_USE_BLANK_BIT 0x0004
|
---|
230 | #define VBE_CAPABILITY_STEREOSCOPIC_SUPPORT 0x0008
|
---|
231 | #define VBE_CAPABILITY_STEREO_VIA_VESA_EVC 0x0010
|
---|
232 |
|
---|
233 | // Mode Attributes
|
---|
234 |
|
---|
235 | #define VBE_MODE_ATTRIBUTE_SUPPORTED 0x0001
|
---|
236 | #define VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE 0x0002
|
---|
237 | #define VBE_MODE_ATTRIBUTE_TTY_BIOS_SUPPORT 0x0004
|
---|
238 | #define VBE_MODE_ATTRIBUTE_COLOR_MODE 0x0008
|
---|
239 | #define VBE_MODE_ATTRIBUTE_GRAPHICS_MODE 0x0010
|
---|
240 | #define VBE_MODE_ATTRIBUTE_NOT_VGA_COMPATIBLE 0x0020
|
---|
241 | #define VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW 0x0040
|
---|
242 | #define VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE 0x0080
|
---|
243 | #define VBE_MODE_ATTRIBUTE_DOUBLE_SCAN_MODE 0x0100
|
---|
244 | #define VBE_MODE_ATTRIBUTE_INTERLACE_MODE 0x0200
|
---|
245 | #define VBE_MODE_ATTRIBUTE_HARDWARE_TRIPLE_BUFFER 0x0400
|
---|
246 | #define VBE_MODE_ATTRIBUTE_HARDWARE_STEREOSCOPIC_DISPLAY 0x0800
|
---|
247 | #define VBE_MODE_ATTRIBUTE_DUAL_DISPLAY_START_ADDRESS 0x1000
|
---|
248 |
|
---|
249 | #define VBE_MODE_ATTTRIBUTE_LFB_ONLY ( VBE_MODE_ATTRIBUTE_NO_VGA_COMPATIBLE_WINDOW | VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE )
|
---|
250 |
|
---|
251 | // Window attributes
|
---|
252 |
|
---|
253 | #define VBE_WINDOW_ATTRIBUTE_RELOCATABLE 0x01
|
---|
254 | #define VBE_WINDOW_ATTRIBUTE_READABLE 0x02
|
---|
255 | #define VBE_WINDOW_ATTRIBUTE_WRITEABLE 0x04
|
---|
256 |
|
---|
257 | // Memory model
|
---|
258 |
|
---|
259 | #define VBE_MEMORYMODEL_TEXT_MODE 0x00
|
---|
260 | #define VBE_MEMORYMODEL_CGA_GRAPHICS 0x01
|
---|
261 | #define VBE_MEMORYMODEL_HERCULES_GRAPHICS 0x02
|
---|
262 | #define VBE_MEMORYMODEL_PLANAR 0x03
|
---|
263 | #define VBE_MEMORYMODEL_PACKED_PIXEL 0x04
|
---|
264 | #define VBE_MEMORYMODEL_NON_CHAIN_4_256 0x05
|
---|
265 | #define VBE_MEMORYMODEL_DIRECT_COLOR 0x06
|
---|
266 | #define VBE_MEMORYMODEL_YUV 0x07
|
---|
267 |
|
---|
268 | // DirectColorModeInfo
|
---|
269 |
|
---|
270 | #define VBE_DIRECTCOLOR_COLOR_RAMP_PROGRAMMABLE 0x01
|
---|
271 | #define VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 0x02
|
---|
272 |
|
---|
273 | /**
|
---|
274 | * VBE Bios Extra Data structure.
|
---|
275 | * @remark duplicated in DevVGA.h.
|
---|
276 | */
|
---|
277 | typedef struct VBEHeader
|
---|
278 | {
|
---|
279 | /** Signature (VBEHEADER_MAGIC). */
|
---|
280 | Bit16u u16Signature;
|
---|
281 | /** Data size. */
|
---|
282 | Bit16u cbData;
|
---|
283 | } VBEHeader;
|
---|
284 |
|
---|
285 | /** The value of the VBEHEADER::u16Signature field.
|
---|
286 | * @remark duplicated in DevVGA.h. */
|
---|
287 | #define VBEHEADER_MAGIC 0x77CC
|
---|
288 |
|
---|
289 | /** The extra port which is used to read the mode list.
|
---|
290 | * @remark duplicated in DevVGA.h. */
|
---|
291 | #define VBE_EXTRA_PORT 0x3b6
|
---|
292 |
|
---|
293 | /** The extra port which is used for debug printf.
|
---|
294 | * @remark duplicated in DevVGA.h. */
|
---|
295 | #define VBE_PRINTF_PORT 0x3b7
|
---|
296 |
|
---|
297 | #endif
|
---|