]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Csm / BiosThunk / VideoDxe / VesaBiosExtensions.h
1 /** @file
2
3 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _VESA_BIOS_EXTENSIONS_H_
10 #define _VESA_BIOS_EXTENSIONS_H_
11
12 //
13 // Turn on byte packing of data structures
14 //
15 #pragma pack(1)
16 //
17 // VESA BIOS Extensions status codes
18 //
19 #define VESA_BIOS_EXTENSIONS_STATUS_SUCCESS 0x004f
20
21 //
22 // VESA BIOS Extensions Services
23 //
24 #define VESA_BIOS_EXTENSIONS_RETURN_CONTROLLER_INFORMATION 0x4f00
25
26 /*++
27
28 Routine Description:
29 Function 00 : Return Controller Information
30
31 Arguments:
32 Inputs:
33 AX = 0x4f00
34 ES:DI = Pointer to buffer to place VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK structure
35 Outputs:
36 AX = Return Status
37
38 --*/
39 #define VESA_BIOS_EXTENSIONS_RETURN_MODE_INFORMATION 0x4f01
40
41 /*++
42
43 Routine Description:
44 Function 01 : Return Mode Information
45
46 Arguments:
47 Inputs:
48 AX = 0x4f01
49 CX = Mode Number
50 ES:DI = Pointer to buffer to place VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK structure
51 Outputs:
52 AX = Return Status
53
54 --*/
55 #define VESA_BIOS_EXTENSIONS_SET_MODE 0x4f02
56
57 /*++
58
59 Routine Description:
60 Function 02 : Set Mode
61
62 Arguments:
63 Inputs:
64 AX = 0x4f02
65 BX = Desired mode to set
66 D0-D8 = Mode Number
67 D9-D10 = Reserved (must be 0)
68 D11 = 0 - Use current default refresh rate
69 = 1 - Use user specfieid CRTC values for refresh rate
70 D12-D13 = Reserved (must be 0)
71 D14 = 0 - Use windowed frame buffer model
72 = 1 - Use linear/flat frame buffer model
73 D15 = 0 - Clear display memory
74 = 1 - Don't clear display memory
75 ES:DI = Pointer to buffer to the VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK structure
76 Outputs:
77 AX = Return Status
78
79 --*/
80 #define VESA_BIOS_EXTENSIONS_RETURN_CURRENT_MODE 0x4f03
81
82 /*++
83
84 Routine Description:
85 Function 03 : Return Current Mode
86
87 Arguments:
88 Inputs:
89 AX = 0x4f03
90 Outputs:
91 AX = Return Status
92 BX = Current mode
93 D0-D13 = Mode Number
94 D14 = 0 - Windowed frame buffer model
95 = 1 - Linear/flat frame buffer model
96 D15 = 0 - Memory cleared at last mode set
97 = 1 - Memory not cleared at last mode set
98
99 --*/
100 #define VESA_BIOS_EXTENSIONS_SAVE_RESTORE_STATE 0x4f04
101
102 /*++
103
104 Routine Description:
105 Function 04 : Save/Restore State
106
107 Arguments:
108 Inputs:
109 AX = 0x4f03
110 DL = 0x00 - Return Save/Restore State buffer size
111 = 0x01 - Save State
112 = 0x02 - Restore State
113 CX = Requested Status
114 D0 = Save/Restore controller hardware state
115 D1 = Save/Restore BIOS data state
116 D2 = Save/Restore DAC state
117 D3 = Save/Restore Regsiter state
118 ES:BX = Pointer to buffer if DL=1 or DL=2
119 Outputs:
120 AX = Return Status
121 BX = Number of 64 byte blocks to hold the state buffer if DL=0
122
123 --*/
124 #define VESA_BIOS_EXTENSIONS_EDID 0x4f15
125
126 /*++
127
128 Routine Description:
129 Function 15 : implement VBE/DDC service
130
131 Arguments:
132 Inputs:
133 AX = 0x4f15
134 BL = 0x00 - Report VBE/DDC Capabilities
135 CX = 0x00 - Controller unit number (00 = primary controller)
136 ES:DI = Null pointer, must be 0:0 in version 1.0
137 Outputs:
138 AX = Return Status
139 BH = Approx. time in seconds, rounded up, to transfer one EDID block(128 bytes)
140 BL = DDC level supported
141 D0 = 0 DDC1 not supported
142 = 1 DDC1 supported
143 D1 = 0 DDC2 not supported
144 = 1 DDC2 supported
145 D2 = 0 Screen not blanked during data transfer
146 = 1 Screen blanked during data transfer
147
148 Inputs:
149 AX = 0x4f15
150 BL = 0x01 - Read EDID
151 CX = 0x00 - Controller unit number (00 = primary controller)
152 DX = 0x00 - EDID block number
153 ES:DI = Pointer to buffer in which the EDID block is returned
154 Outputs:
155 AX = Return Status
156 --*/
157
158 //
159 // Timing data from EDID data block
160 //
161 #define VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE 128
162 #define VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_TIMING_MAX_NUMBER 17
163
164 //
165 // Established Timings: 24 possible resolutions
166 // Standard Timings: 8 possible resolutions
167 // Detailed Timings: 4 possible resolutions
168 //
169 #define VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER 36
170
171 //
172 // Timing data size for Established Timings, Standard Timings and Detailed Timings
173 //
174 #define VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE 3
175 #define VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE 16
176 #define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_EACH_DESCRIPTOR_SIZE 18
177 #define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE 72
178
179 typedef struct {
180 UINT16 HorizontalResolution;
181 UINT16 VerticalResolution;
182 UINT16 RefreshRate;
183 } VESA_BIOS_EXTENSIONS_EDID_TIMING;
184
185 typedef struct {
186 UINT32 ValidNumber;
187 UINT32 Key[VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER];
188 } VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING;
189
190 typedef struct {
191 UINT8 Header[8]; // EDID header "00 FF FF FF FF FF FF 00"
192 UINT16 ManufactureName; // EISA 3-character ID
193 UINT16 ProductCode; // Vendor assigned code
194 UINT32 SerialNumber; // 32-bit serial number
195 UINT8 WeekOfManufacture; // Week number
196 UINT8 YearOfManufacture; // Year
197 UINT8 EdidVersion; // EDID Structure Version
198 UINT8 EdidRevision; // EDID Structure Revision
199 UINT8 VideoInputDefinition;
200 UINT8 MaxHorizontalImageSize; // cm
201 UINT8 MaxVerticalImageSize; // cm
202 UINT8 DisplayTransferCharacteristic;
203 UINT8 FeatureSupport;
204 UINT8 RedGreenLowBits; // Rx1 Rx0 Ry1 Ry0 Gx1 Gx0 Gy1Gy0
205 UINT8 BlueWhiteLowBits; // Bx1 Bx0 By1 By0 Wx1 Wx0 Wy1 Wy0
206 UINT8 RedX; // Red-x Bits 9 - 2
207 UINT8 RedY; // Red-y Bits 9 - 2
208 UINT8 GreenX; // Green-x Bits 9 - 2
209 UINT8 GreenY; // Green-y Bits 9 - 2
210 UINT8 BlueX; // Blue-x Bits 9 - 2
211 UINT8 BlueY; // Blue-y Bits 9 - 2
212 UINT8 WhiteX; // White-x Bits 9 - 2
213 UINT8 WhiteY; // White-x Bits 9 - 2
214 UINT8 EstablishedTimings[VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE];
215 UINT8 StandardTimingIdentification[VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE];
216 UINT8 DetailedTimingDescriptions[VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE];
217 UINT8 ExtensionFlag; // Number of (optional) 128-byte EDID extension blocks to follow
218 UINT8 Checksum;
219 } VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK;
220
221 //
222 // Super VGA Information Block
223 //
224 typedef struct {
225 UINT32 VESASignature; // 'VESA' 4 byte signature
226 UINT16 VESAVersion; // VBE version number
227 UINT32 OEMStringPtr; // Pointer to OEM string
228 UINT32 Capabilities; // Capabilities of video card
229 UINT32 VideoModePtr; // Pointer to an array of 16-bit supported modes values terminated by 0xFFFF
230 UINT16 TotalMemory; // Number of 64kb memory blocks
231 UINT16 OemSoftwareRev; // VBE implementation Software revision
232 UINT32 OemVendorNamePtr; // VbeFarPtr to Vendor Name String
233 UINT32 OemProductNamePtr; // VbeFarPtr to Product Name String
234 UINT32 OemProductRevPtr; // VbeFarPtr to Product Revision String
235 UINT8 Reserved[222]; // Reserved for VBE implementation scratch area
236 UINT8 OemData[256]; // Data area for OEM strings. Pad to 512 byte block size
237 } VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK;
238
239 //
240 // Super VGA Information Block VESASignature values
241 //
242 #define VESA_BIOS_EXTENSIONS_VESA_SIGNATURE SIGNATURE_32 ('V', 'E', 'S', 'A')
243 #define VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE SIGNATURE_32 ('V', 'B', 'E', '2')
244
245 //
246 // Super VGA Information Block VESAVersion values
247 //
248 #define VESA_BIOS_EXTENSIONS_VERSION_1_2 0x0102
249 #define VESA_BIOS_EXTENSIONS_VERSION_2_0 0x0200
250 #define VESA_BIOS_EXTENSIONS_VERSION_3_0 0x0300
251
252 //
253 // Super VGA Information Block Capabilities field bit definitions
254 //
255 #define VESA_BIOS_EXTENSIONS_CAPABILITY_8_BIT_DAC 0x01 // 0: DAC width is fixed at 6 bits/color
256 // 1: DAC width switchable to 8 bits/color
257 //
258 #define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_VGA 0x02 // 0: Controller is VGA compatible
259 // 1: Controller is not VGA compatible
260 //
261 #define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_NORMAL_RAMDAC 0x04 // 0: Normal RAMDAC operation
262 // 1: Use blank bit in function 9 to program RAMDAC
263 //
264 #define VESA_BIOS_EXTENSIONS_CAPABILITY_STEREOSCOPIC 0x08 // 0: No hardware stereoscopic signal support
265 // 1: Hardware stereoscopic signal support
266 //
267 #define VESA_BIOS_EXTENSIONS_CAPABILITY_VESA_EVC 0x10 // 0: Stero signaling supported via external VESA stereo connector
268 // 1: Stero signaling supported via VESA EVC connector
269 //
270 // Super VGA mode number bite field definitions
271 //
272 #define VESA_BIOS_EXTENSIONS_MODE_NUMBER_VESA 0x0100 // 0: Not a VESA defined VBE mode
273 // 1: A VESA defined VBE mode
274 //
275 #define VESA_BIOS_EXTENSIONS_MODE_NUMBER_REFRESH_CONTROL_USER 0x0800 // 0: Use current BIOS default referesh rate
276 // 1: Use the user specified CRTC values for refresh rate
277 //
278 #define VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER 0x4000 // 0: Use a banked/windowed frame buffer
279 // 1: Use a linear/flat frame buffer
280 //
281 #define VESA_BIOS_EXTENSIONS_MODE_NUMBER_PRESERVE_MEMORY 0x8000 // 0: Clear display memory
282 // 1: Preseve display memory
283 //
284 // Super VGA Information Block mode list terminator value
285 //
286 #define VESA_BIOS_EXTENSIONS_END_OF_MODE_LIST 0xffff
287
288 //
289 // Window Function
290 //
291 typedef
292 VOID
293 (*VESA_BIOS_EXTENSIONS_WINDOW_FUNCTION) (
294 VOID
295 );
296
297 //
298 // Super VGA Mode Information Block
299 //
300 typedef struct {
301 //
302 // Manadory fields for all VESA Bios Extensions revisions
303 //
304 UINT16 ModeAttributes; // Mode attributes
305 UINT8 WinAAttributes; // Window A attributes
306 UINT8 WinBAttributes; // Window B attributes
307 UINT16 WinGranularity; // Window granularity in k
308 UINT16 WinSize; // Window size in k
309 UINT16 WinASegment; // Window A segment
310 UINT16 WinBSegment; // Window B segment
311 UINT32 WindowFunction; // Pointer to window function
312 UINT16 BytesPerScanLine; // Bytes per scanline
313 //
314 // Manadory fields for VESA Bios Extensions 1.2 and above
315 //
316 UINT16 XResolution; // Horizontal resolution
317 UINT16 YResolution; // Vertical resolution
318 UINT8 XCharSize; // Character cell width
319 UINT8 YCharSize; // Character cell height
320 UINT8 NumberOfPlanes; // Number of memory planes
321 UINT8 BitsPerPixel; // Bits per pixel
322 UINT8 NumberOfBanks; // Number of CGA style banks
323 UINT8 MemoryModel; // Memory model type
324 UINT8 BankSize; // Size of CGA style banks
325 UINT8 NumberOfImagePages; // Number of images pages
326 UINT8 Reserved1; // Reserved
327 UINT8 RedMaskSize; // Size of direct color red mask
328 UINT8 RedFieldPosition; // Bit posn of lsb of red mask
329 UINT8 GreenMaskSize; // Size of direct color green mask
330 UINT8 GreenFieldPosition; // Bit posn of lsb of green mask
331 UINT8 BlueMaskSize; // Size of direct color blue mask
332 UINT8 BlueFieldPosition; // Bit posn of lsb of blue mask
333 UINT8 RsvdMaskSize; // Size of direct color res mask
334 UINT8 RsvdFieldPosition; // Bit posn of lsb of res mask
335 UINT8 DirectColorModeInfo; // Direct color mode attributes
336 //
337 // Manadory fields for VESA Bios Extensions 2.0 and above
338 //
339 UINT32 PhysBasePtr; // Physical Address for flat memory frame buffer
340 UINT32 Reserved2; // Reserved
341 UINT16 Reserved3; // Reserved
342 //
343 // Manadory fields for VESA Bios Extensions 3.0 and above
344 //
345 UINT16 LinBytesPerScanLine; // Bytes/scan line for linear modes
346 UINT8 BnkNumberOfImagePages; // Number of images for banked modes
347 UINT8 LinNumberOfImagePages; // Number of images for linear modes
348 UINT8 LinRedMaskSize; // Size of direct color red mask (linear mode)
349 UINT8 LinRedFieldPosition; // Bit posiiton of lsb of red mask (linear modes)
350 UINT8 LinGreenMaskSize; // Size of direct color green mask (linear mode)
351 UINT8 LinGreenFieldPosition; // Bit posiiton of lsb of green mask (linear modes)
352 UINT8 LinBlueMaskSize; // Size of direct color blue mask (linear mode)
353 UINT8 LinBlueFieldPosition; // Bit posiiton of lsb of blue mask (linear modes)
354 UINT8 LinRsvdMaskSize; // Size of direct color reserved mask (linear mode)
355 UINT8 LinRsvdFieldPosition; // Bit posiiton of lsb of reserved mask (linear modes)
356 UINT32 MaxPixelClock; // Maximum pixel clock (in Hz) for graphics mode
357 UINT8 Pad[190]; // Pad to 256 byte block size
358 } VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK;
359
360 //
361 // Super VGA Mode Information Block ModeAttributes field bit definitions
362 //
363 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_HARDWARE 0x0001 // 0: Mode not supported in handware
364 // 1: Mode supported in handware
365 //
366 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_TTY 0x0004 // 0: TTY Output functions not supported by BIOS
367 // 1: TTY Output functions supported by BIOS
368 //
369 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_COLOR 0x0008 // 0: Monochrome mode
370 // 1: Color mode
371 //
372 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_GRAPHICS 0x0010 // 0: Text mode
373 // 1: Graphics mode
374 //
375 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_VGA 0x0020 // 0: VGA compatible mode
376 // 1: Not a VGA compatible mode
377 //
378 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_WINDOWED 0x0040 // 0: VGA compatible windowed memory mode
379 // 1: Not a VGA compatible windowed memory mode
380 //
381 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER 0x0080 // 0: No linear fram buffer mode available
382 // 1: Linear frame buffer mode available
383 //
384 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_DOUBLE_SCAN 0x0100 // 0: No double scan mode available
385 // 1: Double scan mode available
386 //
387 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_INTERLACED 0x0200 // 0: No interlaced mode is available
388 // 1: Interlaced mode is available
389 //
390 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NO_TRIPPLE_BUFFER 0x0400 // 0: No hardware triple buffer mode support available
391 // 1: Hardware triple buffer mode support available
392 //
393 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_STEREOSCOPIC 0x0800 // 0: No hardware steroscopic display support
394 // 1: Hardware steroscopic display support
395 //
396 #define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_DUAL_DISPLAY 0x1000 // 0: No dual display start address support
397 // 1: Dual display start address support
398 //
399 // Super VGA Mode Information Block WinAAttribite/WinBAttributes field bit definitions
400 //
401 #define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_RELOCATABLE 0x01 // 0: Single non-relocatable window only
402 // 1: Relocatable window(s) are supported
403 //
404 #define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_READABLE 0x02 // 0: Window is not readable
405 // 1: Window is readable
406 //
407 #define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_WRITABLE 0x04 // 0: Window is not writable
408 // 1: Window is writable
409 //
410 // Super VGA Mode Information Block DirectColorMode field bit definitions
411 //
412 #define VESA_BIOS_EXTENSIONS_DIRECT_COLOR_MODE_PROG_COLOR_RAMP 0x01 // 0: Color ram is fixed
413 // 1: Color ramp is programmable
414 //
415 #define VESA_BIOS_EXTENSIONS_DIRECT_COLOR_MODE_RSVD_USABLE 0x02 // 0: Bits in Rsvd field are reserved
416 // 1: Bits in Rsdv field are usable
417 //
418 // Super VGA Memory Models
419 //
420 typedef enum {
421 MemPL = 3, // Planar memory model
422 MemPK = 4, // Packed pixel memory model
423 MemRGB = 6, // Direct color RGB memory model
424 MemYUV = 7 // Direct color YUV memory model
425 } VESA_BIOS_EXTENSIONS_MEMORY_MODELS;
426
427 //
428 // Super VGA CRTC Information Block
429 //
430 typedef struct {
431 UINT16 HorizontalTotal; // Horizontal total in pixels
432 UINT16 HorizontalSyncStart; // Horizontal sync start in pixels
433 UINT16 HorizontalSyncEnd; // Horizontal sync end in pixels
434 UINT16 VericalTotal; // Vertical total in pixels
435 UINT16 VericalSyncStart; // Vertical sync start in pixels
436 UINT16 VericalSyncEnd; // Vertical sync end in pixels
437 UINT8 Flags; // Flags (Interlaced/DoubleScan/etc).
438 UINT32 PixelClock; // Pixel clock in units of Hz
439 UINT16 RefreshRate; // Refresh rate in units of 0.01 Hz
440 UINT8 Reserved[40]; // Pad
441 } VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK;
442
443 #define VESA_BIOS_EXTENSIONS_CRTC_FLAGS_DOUBLE_SCAN 0x01 // 0: Graphics mode is not souble scanned
444 // 1: Graphics mode is double scanned
445 //
446 #define VESA_BIOS_EXTENSIONS_CRTC_FLAGSINTERLACED 0x02 // 0: Graphics mode is not interlaced
447 // 1: Graphics mode is interlaced
448 //
449 #define VESA_BIOS_EXTENSIONS_CRTC_HORIZONTAL_SYNC_NEGATIVE 0x04 // 0: Horizontal sync polarity is positive(+)
450 // 0: Horizontal sync polarity is negative(-)
451 //
452 #define VESA_BIOS_EXTENSIONS_CRTC_VERITICAL_SYNC_NEGATIVE 0x08 // 0: Verical sync polarity is positive(+)
453 // 0: Verical sync polarity is negative(-)
454 //
455 // Turn off byte packing of data structures
456 //
457 #pragma pack()
458
459 #endif