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