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