Inform HAL about the switch to graphics mode as late as possible. Fixes bug 880.
[reactos.git] / reactos / drivers / video / videoprt / videoprt.h
1 /*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * $Id$
22 */
23
24 #ifndef VIDEOPRT_H
25 #define VIDEOPRT_H
26
27 #include <stdio.h>
28 #include <ddk/ntddk.h>
29 #include <ddk/miniport.h>
30 #include <ddk/video.h>
31 #include <ddk/ntddvdeo.h>
32 #include <ddk/ntagp.h>
33 #include <ddk/ntifs.h>
34 #include <ndk/ntndk.h>
35 #include <reactos/helper.h>
36
37 #define NDEBUG
38 #include <debug.h>
39
40 #define TAG_VIDEO_PORT TAG('V', 'I', 'D', 'P')
41
42 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
43 {
44 LIST_ENTRY List;
45 PVOID MappedAddress;
46 ULONG NumberOfUchars;
47 PHYSICAL_ADDRESS IoAddress;
48 ULONG SystemIoBusNumber;
49 UINT MappingCount;
50 } VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
51
52 struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING;
53
54 typedef struct _VIDEO_PORT_AGP_MAPPING
55 {
56 ULONG NumberOfPages;
57 PVOID MapHandle;
58 PHYSICAL_ADDRESS PhysicalAddress;
59 } VIDEO_PORT_AGP_MAPPING, *PVIDEO_PORT_AGP_MAPPING;
60
61 typedef struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
62 {
63 PVIDEO_PORT_AGP_MAPPING AgpMapping;
64 HANDLE ProcessHandle;
65 PVOID MappedAddress;
66 } VIDEO_PORT_AGP_VIRTUAL_MAPPING, *PVIDEO_PORT_AGP_VIRTUAL_MAPPING;
67
68 typedef struct _VIDEO_PORT_DRIVER_EXTENSION
69 {
70 VIDEO_HW_INITIALIZATION_DATA InitializationData;
71 PVOID HwContext;
72 UNICODE_STRING RegistryPath;
73 } VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
74
75 typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
76 {
77 ULONG DeviceNumber;
78 PDRIVER_OBJECT DriverObject;
79 PDEVICE_OBJECT PhysicalDeviceObject;
80 PDEVICE_OBJECT FunctionalDeviceObject;
81 PDEVICE_OBJECT NextDeviceObject;
82 UNICODE_STRING RegistryPath;
83 PKINTERRUPT InterruptObject;
84 KSPIN_LOCK InterruptSpinLock;
85 PCM_RESOURCE_LIST AllocatedResources;
86 ULONG InterruptVector;
87 ULONG InterruptLevel;
88 BOOLEAN InterruptShared;
89 INTERFACE_TYPE AdapterInterfaceType;
90 ULONG SystemIoBusNumber;
91 ULONG SystemIoSlotNumber;
92 LIST_ENTRY AddressMappingListHead;
93 KDPC DpcObject;
94 VIDEO_PORT_DRIVER_EXTENSION *DriverExtension;
95 ULONG DeviceOpened;
96 AGP_BUS_INTERFACE_STANDARD AgpInterface;
97 KMUTEX DeviceLock;
98 CHAR MiniPortDeviceExtension[1];
99 } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
100
101 #define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
102 CONTAINING_RECORD( \
103 HwDeviceExtension, \
104 VIDEO_PORT_DEVICE_EXTENSION, \
105 MiniPortDeviceExtension)
106
107 /* agp.c */
108
109 NTSTATUS NTAPI
110 IntAgpGetInterface(
111 IN PVOID HwDeviceExtension,
112 IN OUT PINTERFACE Interface);
113
114 /* dispatch.c */
115
116 NTSTATUS NTAPI
117 IntVideoPortAddDevice(
118 IN PDRIVER_OBJECT DriverObject,
119 IN PDEVICE_OBJECT PhysicalDeviceObject);
120
121 NTSTATUS NTAPI
122 IntVideoPortDispatchOpen(
123 IN PDEVICE_OBJECT DeviceObject,
124 IN PIRP Irp);
125
126 NTSTATUS NTAPI
127 IntVideoPortDispatchClose(
128 IN PDEVICE_OBJECT DeviceObject,
129 IN PIRP Irp);
130
131 NTSTATUS NTAPI
132 IntVideoPortDispatchCleanup(
133 IN PDEVICE_OBJECT DeviceObject,
134 IN PIRP Irp);
135
136 NTSTATUS NTAPI
137 IntVideoPortDispatchDeviceControl(
138 IN PDEVICE_OBJECT DeviceObject,
139 IN PIRP Irp);
140
141 NTSTATUS NTAPI
142 IntVideoPortDispatchPnp(
143 IN PDEVICE_OBJECT DeviceObject,
144 IN PIRP Irp);
145
146 NTSTATUS NTAPI
147 IntVideoPortDispatchPower(
148 IN PDEVICE_OBJECT DeviceObject,
149 IN PIRP Irp);
150
151 NTSTATUS NTAPI
152 IntVideoPortDispatchWrite(
153 IN PDEVICE_OBJECT DeviceObject,
154 IN PIRP Irp);
155
156 VOID NTAPI
157 IntVideoPortUnload(PDRIVER_OBJECT DriverObject);
158
159 /* timer.c */
160
161 BOOLEAN NTAPI
162 IntVideoPortSetupTimer(
163 IN PDEVICE_OBJECT DeviceObject,
164 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension);
165
166 /* interrupt.c */
167
168 BOOLEAN NTAPI
169 IntVideoPortSetupInterrupt(
170 IN PDEVICE_OBJECT DeviceObject,
171 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
172 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo);
173
174 /* resource.c */
175
176 NTSTATUS NTAPI
177 IntVideoPortMapPhysicalMemory(
178 IN HANDLE Process,
179 IN PHYSICAL_ADDRESS PhysicalAddress,
180 IN ULONG SizeInBytes,
181 IN ULONG Protect,
182 IN OUT PVOID *VirtualAddress OPTIONAL);
183
184 /* videoprt.c */
185
186 extern ULONG CsrssInitialized;
187 extern PKPROCESS Csrss;
188
189 VP_STATUS NTAPI
190 VideoPortEnumerateChildren(
191 IN PVOID HwDeviceExtension,
192 IN PVOID Reserved);
193
194 PVOID NTAPI
195 VideoPortGetProcAddress(
196 IN PVOID HwDeviceExtension,
197 IN PUCHAR FunctionName);
198
199 VOID FASTCALL
200 IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
201
202 VOID FASTCALL
203 IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
204
205 NTSTATUS NTAPI
206 IntVideoPortCreateAdapterDeviceObject(
207 IN PDRIVER_OBJECT DriverObject,
208 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
209 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
210 OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
211
212 NTSTATUS NTAPI
213 IntVideoPortFindAdapter(
214 IN PDRIVER_OBJECT DriverObject,
215 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
216 IN PDEVICE_OBJECT DeviceObject);
217
218 /* int10.c */
219
220 VP_STATUS NTAPI
221 IntInt10AllocateBuffer(
222 IN PVOID Context,
223 OUT PUSHORT Seg,
224 OUT PUSHORT Off,
225 IN OUT PULONG Length);
226
227 VP_STATUS NTAPI
228 IntInt10FreeBuffer(
229 IN PVOID Context,
230 IN USHORT Seg,
231 IN USHORT Off);
232
233 VP_STATUS NTAPI
234 IntInt10ReadMemory(
235 IN PVOID Context,
236 IN USHORT Seg,
237 IN USHORT Off,
238 OUT PVOID Buffer,
239 IN ULONG Length);
240
241 VP_STATUS NTAPI
242 IntInt10WriteMemory(
243 IN PVOID Context,
244 IN USHORT Seg,
245 IN USHORT Off,
246 IN PVOID Buffer,
247 IN ULONG Length);
248
249 VP_STATUS NTAPI
250 IntInt10CallBios(
251 IN PVOID Context,
252 IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
253
254 VP_STATUS NTAPI
255 VideoPortInt10(
256 IN PVOID HwDeviceExtension,
257 IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
258
259 #endif /* VIDEOPRT_H */