1 /* 2 * PROJECT: VGA Miniport Driver 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: win32ss/drivers/miniport/vga_new/vbe.h 5 * PURPOSE: VESA VBE Registers and Structures 6 * PROGRAMMERS: ReactOS Portable Systems Group 7 */ 8 9 #pragma once 10 11 #define LOWORD(l) ((USHORT)((ULONG_PTR)(l))) 12 #define HIWORD(l) ((USHORT)(((ULONG_PTR)(l)>>16)&0xFFFF)) 13 14 15 /* 16 * VBE Command Definitions 17 */ 18 19 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00 20 #define VBE_GET_MODE_INFORMATION 0x4F01 21 #define VBE_SET_VBE_MODE 0x4F02 22 #define VBE_GET_CURRENT_VBE_MODE 0x4F03 23 #define VBE_SAVE_RESTORE_STATE 0x4F04 24 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05 25 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06 26 #define VBE_SET_GET_DISPLAY_START 0x4F07 27 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08 28 #define VBE_SET_GET_PALETTE_DATA 0x4F09 29 30 /* VBE 2.0+ */ 31 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A 32 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B 33 34 /* Extensions */ 35 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10 36 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11 37 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12 38 #define VBE_OEM_EXTENSIONS 0x4F13 39 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14 40 #define VBE_DDC 0x4F15 41 42 /* 43 * VBE DDC Sub-Functions 44 */ 45 46 #define VBE_DDC_READ_EDID 0x01 47 #define VBE_DDC_REPORT_CAPABILITIES 0x10 48 #define VBE_DDC_BEGIN_SCL_SDA_CONTROL 0x11 49 #define VBE_DDC_END_SCL_SDA_CONTROL 0x12 50 #define VBE_DDC_WRITE_SCL_CLOCK_LINE 0x13 51 #define VBE_DDC_WRITE_SDA_DATA_LINE 0x14 52 #define VBE_DDC_READ_SCL_CLOCK_LINE 0x15 53 #define VBE_DDC_READ_SDA_DATA_LINE 0x16 54 55 /* 56 * VBE Video Mode Information Definitions 57 */ 58 #define VBE_MODEATTR_VALID 0x01 59 #define VBE_MODEATTR_COLOR 0x08 60 #define VBE_MODEATTR_GRAPHICS 0x10 61 #define VBE_MODEATTR_NON_VGA 0x20 62 #define VBE_MODEATTR_NO_BANK_SWITCH 0x40 63 #define VBE_MODEATTR_LINEAR 0x80 64 65 #define VBE_MODE_BITS 8 66 #define VBE_MODE_RESERVED_1 0x200 67 #define VBE_MODE_RESERVED_2 0x400 68 #define VBE_MODE_REFRESH_CONTROL 0x800 69 #define VBE_MODE_ACCELERATED_1 0x1000 70 #define VBE_MODE_ACCELERATED_2 0x2000 71 #define VBE_MODE_LINEAR_FRAMEBUFFER 0x4000 72 #define VBE_MODE_PRESERVE_DISPLAY 0x8000 73 #define VBE_MODE_MASK ((1 << (VBE_MODE_BITS + 1)) - 1) 74 75 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04 76 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06 77 78 /* 79 * VBE Return Codes 80 */ 81 82 #define VBE_SUCCESS 0x4F 83 #define VBE_UNSUCCESSFUL 0x14F 84 #define VBE_NOT_SUPPORTED 0x24F 85 #define VBE_FUNCTION_INVALID 0x34F 86 87 #define VBE_GETRETURNCODE(x) (x & 0xFFFF) 88 89 #include <pshpack1.h> 90 91 /* 92 * VBE specification defined structure for general adapter info 93 * returned by function VBE_GET_CONTROLLER_INFORMATION command. 94 */ 95 96 typedef struct _VBE_CONTROLLER_INFO 97 { 98 ULONG Signature; 99 USHORT Version; 100 ULONG OemStringPtr; 101 LONG Capabilities; 102 ULONG VideoModePtr; 103 USHORT TotalMemory; 104 USHORT OemSoftwareRevision; 105 ULONG OemVendorNamePtr; 106 ULONG OemProductNamePtr; 107 ULONG OemProductRevPtr; 108 CHAR Reserved[222]; 109 CHAR OemData[256]; 110 } VBE_CONTROLLER_INFO, *PVBE_CONTROLLER_INFO; 111 112 /* 113 * VBE specification defined structure for specific video mode 114 * info returned by function VBE_GET_MODE_INFORMATION command. 115 */ 116 117 typedef struct _VBE_MODE_INFO 118 { 119 /* Mandatory information for all VBE revisions */ 120 USHORT ModeAttributes; 121 UCHAR WinAAttributes; 122 UCHAR WinBAttributes; 123 USHORT WinGranularity; 124 USHORT WinSize; 125 USHORT WinASegment; 126 USHORT WinBSegment; 127 ULONG WinFuncPtr; 128 USHORT BytesPerScanLine; 129 130 /* Mandatory information for VBE 1.2 and above */ 131 USHORT XResolution; 132 USHORT YResolution; 133 UCHAR XCharSize; 134 UCHAR YCharSize; 135 UCHAR NumberOfPlanes; 136 UCHAR BitsPerPixel; 137 UCHAR NumberOfBanks; 138 UCHAR MemoryModel; 139 UCHAR BankSize; 140 UCHAR NumberOfImagePages; 141 UCHAR Reserved1; 142 143 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */ 144 UCHAR RedMaskSize; 145 UCHAR RedFieldPosition; 146 UCHAR GreenMaskSize; 147 UCHAR GreenFieldPosition; 148 UCHAR BlueMaskSize; 149 UCHAR BlueFieldPosition; 150 UCHAR ReservedMaskSize; 151 UCHAR ReservedFieldPosition; 152 UCHAR DirectColorModeInfo; 153 154 /* Mandatory information for VBE 2.0 and above */ 155 ULONG PhysBasePtr; 156 ULONG Reserved2; 157 USHORT Reserved3; 158 159 /* Mandatory information for VBE 3.0 and above */ 160 USHORT LinBytesPerScanLine; 161 UCHAR BnkNumberOfImagePages; 162 UCHAR LinNumberOfImagePages; 163 UCHAR LinRedMaskSize; 164 UCHAR LinRedFieldPosition; 165 UCHAR LinGreenMaskSize; 166 UCHAR LinGreenFieldPosition; 167 UCHAR LinBlueMaskSize; 168 UCHAR LinBlueFieldPosition; 169 UCHAR LinReservedMaskSize; 170 UCHAR LinReservedFieldPosition; 171 ULONG MaxPixelClock; 172 173 CHAR Reserved4[190]; 174 } VBE_MODE_INFO, *PVBE_MODE_INFO; 175 176 #include <poppack.h> 177 178 typedef struct _VBE_INFO 179 { 180 VBE_CONTROLLER_INFO Info; 181 VBE_MODE_INFO Modes; 182 USHORT ModeArray[129]; 183 } VBE_INFO, *PVBE_INFO; 184 185 C_ASSERT(sizeof(VBE_CONTROLLER_INFO) == 0x200); 186 C_ASSERT(sizeof(VBE_MODE_INFO) == 0x100); 187 188 typedef struct _VBE_COLOR_REGISTER 189 { 190 UCHAR Blue; 191 UCHAR Green; 192 UCHAR Red; 193 UCHAR Pad; 194 } VBE_COLOR_REGISTER, *PVBE_COLOR_REGISTER; 195 196 VOID 197 NTAPI 198 InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension); 199 200 VP_STATUS 201 NTAPI 202 VbeSetMode(IN PHW_DEVICE_EXTENSION VgaDeviceExtension, 203 IN PVIDEOMODE VgaMode, 204 OUT PULONG PhysPtrChange); 205 206 VP_STATUS 207 NTAPI 208 VbeSetColorLookup(IN PHW_DEVICE_EXTENSION VgaExtension, 209 IN PVIDEO_CLUT ClutBuffer); 210 211 BOOLEAN 212 NTAPI 213 ValidateVbeInfo(IN PHW_DEVICE_EXTENSION VgaExtension, 214 IN PVBE_INFO VbeInfo); 215 216 extern BOOLEAN g_bIntelBrookdaleBIOS; 217 218 /* VBE2 magic number */ 219 #define VBE2_MAGIC ('V' + ('B' << 8) + ('E' << 16) + ('2' << 24)) 220 221 /* EOF */ 222