4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
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 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
35 /* PSEH for SEH Support */
36 #include <pseh/pseh2.h>
38 #define TAG_VIDEO_PORT 'PDIV'
39 #define TAG_VIDEO_PORT_BUFFER '\0mpV'
40 #define TAG_REQUEST_PACKET 'qRpV'
42 #define GUID_STRING_LENGTH (38 * sizeof(WCHAR))
44 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
49 PHYSICAL_ADDRESS IoAddress
;
50 ULONG SystemIoBusNumber
;
52 } VIDEO_PORT_ADDRESS_MAPPING
, *PVIDEO_PORT_ADDRESS_MAPPING
;
54 struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
;
56 typedef struct _VIDEO_PORT_AGP_MAPPING
60 PHYSICAL_ADDRESS PhysicalAddress
;
61 } VIDEO_PORT_AGP_MAPPING
, *PVIDEO_PORT_AGP_MAPPING
;
63 typedef struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
65 PVIDEO_PORT_AGP_MAPPING AgpMapping
;
68 } VIDEO_PORT_AGP_VIRTUAL_MAPPING
, *PVIDEO_PORT_AGP_VIRTUAL_MAPPING
;
70 typedef struct _VIDEO_PORT_DRIVER_EXTENSION
72 VIDEO_HW_INITIALIZATION_DATA InitializationData
;
74 UNICODE_STRING RegistryPath
;
75 } VIDEO_PORT_DRIVER_EXTENSION
, *PVIDEO_PORT_DRIVER_EXTENSION
;
77 typedef struct _VIDEO_PORT_COMMON_EXTENSION
80 } VIDEO_PORT_COMMON_EXTENSION
, *PVIDEO_PORT_COMMON_EXTENSION
;
82 typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
84 VIDEO_PORT_COMMON_EXTENSION Common
;
86 PDRIVER_OBJECT DriverObject
;
87 PDEVICE_OBJECT PhysicalDeviceObject
;
88 PDEVICE_OBJECT FunctionalDeviceObject
;
89 PDEVICE_OBJECT NextDeviceObject
;
90 UNICODE_STRING RegistryPath
;
91 UNICODE_STRING NewRegistryPath
;
92 PKINTERRUPT InterruptObject
;
93 KSPIN_LOCK InterruptSpinLock
;
94 PCM_RESOURCE_LIST AllocatedResources
;
95 ULONG InterruptVector
;
97 BOOLEAN InterruptShared
;
98 INTERFACE_TYPE AdapterInterfaceType
;
99 ULONG SystemIoBusNumber
;
100 ULONG SystemIoSlotNumber
;
101 LIST_ENTRY AddressMappingListHead
;
103 VIDEO_PORT_DRIVER_EXTENSION
*DriverExtension
;
105 AGP_BUS_INTERFACE_STANDARD AgpInterface
;
107 LIST_ENTRY DmaAdapterList
, ChildDeviceList
;
108 LIST_ENTRY HwResetListEntry
;
110 USHORT AdapterNumber
;
111 USHORT DisplayNumber
;
112 ULONG NumberOfSecondaryDisplays
;
113 CHAR POINTER_ALIGNMENT MiniPortDeviceExtension
[1];
114 } VIDEO_PORT_DEVICE_EXTENSION
, *PVIDEO_PORT_DEVICE_EXTENSION
;
116 typedef struct _VIDEO_PORT_CHILD_EXTENSION
118 VIDEO_PORT_COMMON_EXTENSION Common
;
121 VIDEO_CHILD_TYPE ChildType
;
122 UCHAR ChildDescriptor
[256];
126 PDRIVER_OBJECT DriverObject
;
127 PDEVICE_OBJECT PhysicalDeviceObject
;
129 LIST_ENTRY ListEntry
;
131 CHAR ChildDeviceExtension
[1];
132 } VIDEO_PORT_CHILD_EXTENSION
, *PVIDEO_PORT_CHILD_EXTENSION
;
134 #define VIDEO_PORT_GET_CHILD_EXTENSION(MiniportExtension) \
137 VIDEO_PORT_CHILD_EXTENSION, \
138 ChildDeviceExtension)
140 #define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
143 VIDEO_PORT_DEVICE_EXTENSION, \
144 MiniPortDeviceExtension)
146 typedef struct _VIDEO_PORT_EVENT
149 } VIDEO_PORT_EVENT
, *PVIDEO_PORT_EVENT
;
155 PDEVICE_OBJECT DeviceObject
,
156 PIO_STATUS_BLOCK IoStatusBlock
,
158 PIO_STACK_LOCATION Stack OPTIONAL
);
162 IN PVOID HwDeviceExtension
,
163 IN OUT PINTERFACE Interface
);
168 IntVideoPortDispatchPdoPnp(
169 IN PDEVICE_OBJECT DeviceObject
,
175 IntVideoPortAddDevice(
176 IN PDRIVER_OBJECT DriverObject
,
177 IN PDEVICE_OBJECT PhysicalDeviceObject
);
180 IntVideoPortDispatchOpen(
181 IN PDEVICE_OBJECT DeviceObject
,
185 IntVideoPortDispatchClose(
186 IN PDEVICE_OBJECT DeviceObject
,
190 IntVideoPortDispatchCleanup(
191 IN PDEVICE_OBJECT DeviceObject
,
195 IntVideoPortDispatchDeviceControl(
196 IN PDEVICE_OBJECT DeviceObject
,
200 IntVideoPortDispatchPnp(
201 IN PDEVICE_OBJECT DeviceObject
,
205 IntVideoPortDispatchPower(
206 IN PDEVICE_OBJECT DeviceObject
,
210 IntVideoPortDispatchSystemControl(
211 IN PDEVICE_OBJECT DeviceObject
,
215 IntVideoPortUnload(PDRIVER_OBJECT DriverObject
);
220 IntVideoPortSetupTimer(
221 IN PDEVICE_OBJECT DeviceObject
,
222 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
);
227 IntVideoPortSetupInterrupt(
228 IN PDEVICE_OBJECT DeviceObject
,
229 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
,
230 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo
);
235 IntVideoPortFilterResourceRequirements(
236 IN PDEVICE_OBJECT DeviceObject
,
237 IN PIO_STACK_LOCATION IrpStack
,
241 IntVideoPortReleaseResources(
242 _In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
);
245 IntVideoPortMapPhysicalMemory(
247 IN PHYSICAL_ADDRESS PhysicalAddress
,
248 IN ULONG SizeInBytes
,
250 IN OUT PVOID
*VirtualAddress OPTIONAL
);
254 extern PKPROCESS CsrProcess
;
255 extern ULONG VideoPortDeviceNumber
;
256 extern BOOLEAN VideoPortUseNewKey
;
257 extern KMUTEX VideoPortInt10Mutex
;
258 extern KSPIN_LOCK HwResetAdaptersLock
;
259 extern LIST_ENTRY HwResetAdaptersList
;
262 IntAttachToCSRSS(PKPROCESS
*CallingProcess
, PKAPC_STATE ApcState
);
265 IntDetachFromCSRSS(PKPROCESS
*CallingProcess
, PKAPC_STATE ApcState
);
268 IntVideoPortCreateAdapterDeviceObject(
269 _In_ PDRIVER_OBJECT DriverObject
,
270 _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
,
271 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject
,
272 _In_ USHORT AdapterNumber
,
273 _In_ USHORT DisplayNumber
,
274 _Out_opt_ PDEVICE_OBJECT
*DeviceObject
);
277 IntVideoPortFindAdapter(
278 IN PDRIVER_OBJECT DriverObject
,
279 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
,
280 IN PDEVICE_OBJECT DeviceObject
);
283 IntVideoPortGetProcAddress(
284 IN PVOID HwDeviceExtension
,
285 IN PUCHAR FunctionName
);
288 IntVideoPortEnumerateChildren(
289 IN PDEVICE_OBJECT DeviceObject
,
296 IntInitializeVideoAddressSpace(VOID
);
299 IntInt10AllocateBuffer(
303 IN OUT PULONG Length
);
330 IN OUT PINT10_BIOS_ARGUMENTS BiosArguments
);
337 _In_ HANDLE SourceKeyHandle
,
338 _In_ HANDLE DestKeyHandle
);
342 IntCopyRegistryValue(
343 HANDLE SourceKeyHandle
,
344 HANDLE DestKeyHandle
,
349 IntSetupDeviceSettingsKey(
350 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
);
354 IntCreateNewRegistryPath(
355 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
);
359 IntCreateRegistryPath(
360 IN PCUNICODE_STRING DriverRegistryPath
,
361 IN ULONG DeviceNumber
,
362 OUT PUNICODE_STRING DeviceRegistryPath
);
365 #endif /* VIDEOPRT_H */