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