Implement VideoPortGetAssociatedDeviceExtension and VideoPortCheckForDeviceExistence
[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 <ntddk.h>
29 #include <miniport.h>
30 #include <video.h>
31 #include <ntddvdeo.h>
32 #include <ntagp.h>
33 #include <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 #define DPFLTR_IHVVIDEO_ID 0 /* FIXME */
43
44 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
45 {
46 LIST_ENTRY List;
47 PVOID MappedAddress;
48 ULONG NumberOfUchars;
49 PHYSICAL_ADDRESS IoAddress;
50 ULONG SystemIoBusNumber;
51 UINT MappingCount;
52 } VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
53
54 struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING;
55
56 typedef struct _VIDEO_PORT_AGP_MAPPING
57 {
58 ULONG NumberOfPages;
59 PVOID MapHandle;
60 PHYSICAL_ADDRESS PhysicalAddress;
61 } VIDEO_PORT_AGP_MAPPING, *PVIDEO_PORT_AGP_MAPPING;
62
63 typedef struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
64 {
65 PVIDEO_PORT_AGP_MAPPING AgpMapping;
66 HANDLE ProcessHandle;
67 PVOID MappedAddress;
68 } VIDEO_PORT_AGP_VIRTUAL_MAPPING, *PVIDEO_PORT_AGP_VIRTUAL_MAPPING;
69
70 typedef struct _VIDEO_PORT_DRIVER_EXTENSION
71 {
72 VIDEO_HW_INITIALIZATION_DATA InitializationData;
73 PVOID HwContext;
74 UNICODE_STRING RegistryPath;
75 } VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
76
77 typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
78 {
79 ULONG DeviceNumber;
80 PDRIVER_OBJECT DriverObject;
81 PDEVICE_OBJECT PhysicalDeviceObject;
82 PDEVICE_OBJECT FunctionalDeviceObject;
83 PDEVICE_OBJECT NextDeviceObject;
84 UNICODE_STRING RegistryPath;
85 PKINTERRUPT InterruptObject;
86 KSPIN_LOCK InterruptSpinLock;
87 PCM_RESOURCE_LIST AllocatedResources;
88 ULONG InterruptVector;
89 ULONG InterruptLevel;
90 BOOLEAN InterruptShared;
91 INTERFACE_TYPE AdapterInterfaceType;
92 ULONG SystemIoBusNumber;
93 ULONG SystemIoSlotNumber;
94 LIST_ENTRY AddressMappingListHead;
95 KDPC DpcObject;
96 VIDEO_PORT_DRIVER_EXTENSION *DriverExtension;
97 ULONG DeviceOpened;
98 AGP_BUS_INTERFACE_STANDARD AgpInterface;
99 KMUTEX DeviceLock;
100 CHAR MiniPortDeviceExtension[1];
101 } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
102
103 #define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
104 CONTAINING_RECORD( \
105 HwDeviceExtension, \
106 VIDEO_PORT_DEVICE_EXTENSION, \
107 MiniPortDeviceExtension)
108
109 /* agp.c */
110
111 NTSTATUS
112 IopInitiatePnpIrp(
113 PDEVICE_OBJECT DeviceObject,
114 PIO_STATUS_BLOCK IoStatusBlock,
115 ULONG MinorFunction,
116 PIO_STACK_LOCATION Stack OPTIONAL);
117
118 NTSTATUS NTAPI
119 IntAgpGetInterface(
120 IN PVOID HwDeviceExtension,
121 IN OUT PINTERFACE Interface);
122
123 /* dispatch.c */
124
125 NTSTATUS NTAPI
126 IntVideoPortAddDevice(
127 IN PDRIVER_OBJECT DriverObject,
128 IN PDEVICE_OBJECT PhysicalDeviceObject);
129
130 NTSTATUS NTAPI
131 IntVideoPortDispatchOpen(
132 IN PDEVICE_OBJECT DeviceObject,
133 IN PIRP Irp);
134
135 NTSTATUS NTAPI
136 IntVideoPortDispatchClose(
137 IN PDEVICE_OBJECT DeviceObject,
138 IN PIRP Irp);
139
140 NTSTATUS NTAPI
141 IntVideoPortDispatchCleanup(
142 IN PDEVICE_OBJECT DeviceObject,
143 IN PIRP Irp);
144
145 NTSTATUS NTAPI
146 IntVideoPortDispatchDeviceControl(
147 IN PDEVICE_OBJECT DeviceObject,
148 IN PIRP Irp);
149
150 NTSTATUS NTAPI
151 IntVideoPortDispatchPnp(
152 IN PDEVICE_OBJECT DeviceObject,
153 IN PIRP Irp);
154
155 NTSTATUS NTAPI
156 IntVideoPortDispatchPower(
157 IN PDEVICE_OBJECT DeviceObject,
158 IN PIRP Irp);
159
160 NTSTATUS NTAPI
161 IntVideoPortDispatchWrite(
162 IN PDEVICE_OBJECT DeviceObject,
163 IN PIRP Irp);
164
165 VOID NTAPI
166 IntVideoPortUnload(PDRIVER_OBJECT DriverObject);
167
168 /* timer.c */
169
170 BOOLEAN NTAPI
171 IntVideoPortSetupTimer(
172 IN PDEVICE_OBJECT DeviceObject,
173 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension);
174
175 /* interrupt.c */
176
177 BOOLEAN NTAPI
178 IntVideoPortSetupInterrupt(
179 IN PDEVICE_OBJECT DeviceObject,
180 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
181 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo);
182
183 /* resource.c */
184
185 NTSTATUS NTAPI
186 IntVideoPortMapPhysicalMemory(
187 IN HANDLE Process,
188 IN PHYSICAL_ADDRESS PhysicalAddress,
189 IN ULONG SizeInBytes,
190 IN ULONG Protect,
191 IN OUT PVOID *VirtualAddress OPTIONAL);
192
193 /* videoprt.c */
194
195 extern ULONG CsrssInitialized;
196 extern PKPROCESS Csrss;
197
198 VP_STATUS NTAPI
199 VideoPortEnumerateChildren(
200 IN PVOID HwDeviceExtension,
201 IN PVOID Reserved);
202
203 PVOID NTAPI
204 VideoPortGetProcAddress(
205 IN PVOID HwDeviceExtension,
206 IN PUCHAR FunctionName);
207
208 VOID FASTCALL
209 IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
210
211 VOID FASTCALL
212 IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
213
214 NTSTATUS NTAPI
215 IntVideoPortCreateAdapterDeviceObject(
216 IN PDRIVER_OBJECT DriverObject,
217 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
218 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
219 OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
220
221 NTSTATUS NTAPI
222 IntVideoPortFindAdapter(
223 IN PDRIVER_OBJECT DriverObject,
224 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
225 IN PDEVICE_OBJECT DeviceObject);
226
227 /* int10.c */
228
229 VP_STATUS NTAPI
230 IntInt10AllocateBuffer(
231 IN PVOID Context,
232 OUT PUSHORT Seg,
233 OUT PUSHORT Off,
234 IN OUT PULONG Length);
235
236 VP_STATUS NTAPI
237 IntInt10FreeBuffer(
238 IN PVOID Context,
239 IN USHORT Seg,
240 IN USHORT Off);
241
242 VP_STATUS NTAPI
243 IntInt10ReadMemory(
244 IN PVOID Context,
245 IN USHORT Seg,
246 IN USHORT Off,
247 OUT PVOID Buffer,
248 IN ULONG Length);
249
250 VP_STATUS NTAPI
251 IntInt10WriteMemory(
252 IN PVOID Context,
253 IN USHORT Seg,
254 IN USHORT Off,
255 IN PVOID Buffer,
256 IN ULONG Length);
257
258 VP_STATUS NTAPI
259 IntInt10CallBios(
260 IN PVOID Context,
261 IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
262
263 VP_STATUS NTAPI
264 VideoPortInt10(
265 IN PVOID HwDeviceExtension,
266 IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
267
268 #endif /* VIDEOPRT_H */