1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * VideoPort driver
3*c2c66affSColin Finck *
4*c2c66affSColin Finck * Copyright (C) 2007 ReactOS Team
5*c2c66affSColin Finck *
6*c2c66affSColin Finck * This library is free software; you can redistribute it and/or
7*c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
8*c2c66affSColin Finck * License as published by the Free Software Foundation; either
9*c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
10*c2c66affSColin Finck *
11*c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
12*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14*c2c66affSColin Finck * Lesser General Public License for more details.
15*c2c66affSColin Finck *
16*c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
17*c2c66affSColin Finck * License along with this library; if not, write to the Free Software
18*c2c66affSColin Finck * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19*c2c66affSColin Finck *
20*c2c66affSColin Finck */
21*c2c66affSColin Finck
22*c2c66affSColin Finck #include "videoprt.h"
23*c2c66affSColin Finck
24*c2c66affSColin Finck #define NDEBUG
25*c2c66affSColin Finck #include <debug.h>
26*c2c66affSColin Finck
27*c2c66affSColin Finck typedef struct _VIDEO_PORT_FUNCTION_TABLE {
28*c2c66affSColin Finck PVOID Address;
29*c2c66affSColin Finck PCSZ Name;
30*c2c66affSColin Finck } *PVIDEO_PORT_FUNCTION_TABLE, VIDEO_PORT_FUNCTION_TABLE;
31*c2c66affSColin Finck
32*c2c66affSColin Finck /* GLOBAL VARIABLES ***********************************************************/
33*c2c66affSColin Finck
34*c2c66affSColin Finck /* Create an array of entries with pfn, psz, for IntVideoPortGetProcAddress */
35*c2c66affSColin Finck #define MAKE_ENTRY(FUNCTIONNAME) { FUNCTIONNAME, #FUNCTIONNAME }
36*c2c66affSColin Finck const VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] = {
37*c2c66affSColin Finck MAKE_ENTRY(VideoPortDDCMonitorHelper),
38*c2c66affSColin Finck MAKE_ENTRY(VideoPortDoDma),
39*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetCommonBuffer),
40*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetMdl),
41*c2c66affSColin Finck MAKE_ENTRY(VideoPortLockPages),
42*c2c66affSColin Finck MAKE_ENTRY(VideoPortSignalDmaComplete),
43*c2c66affSColin Finck MAKE_ENTRY(VideoPortUnlockPages),
44*c2c66affSColin Finck MAKE_ENTRY(VideoPortAssociateEventsWithDmaHandle),
45*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetBytesUsed),
46*c2c66affSColin Finck MAKE_ENTRY(VideoPortSetBytesUsed),
47*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetDmaContext),
48*c2c66affSColin Finck MAKE_ENTRY(VideoPortSetDmaContext),
49*c2c66affSColin Finck MAKE_ENTRY(VideoPortMapDmaMemory),
50*c2c66affSColin Finck MAKE_ENTRY(VideoPortUnmapDmaMemory),
51*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetAgpServices),
52*c2c66affSColin Finck MAKE_ENTRY(VideoPortAllocateContiguousMemory),
53*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetRomImage),
54*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetAssociatedDeviceExtension),
55*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetAssociatedDeviceID),
56*c2c66affSColin Finck MAKE_ENTRY(VideoPortAcquireDeviceLock),
57*c2c66affSColin Finck MAKE_ENTRY(VideoPortReleaseDeviceLock),
58*c2c66affSColin Finck MAKE_ENTRY(VideoPortAllocateBuffer),
59*c2c66affSColin Finck MAKE_ENTRY(VideoPortFreeCommonBuffer),
60*c2c66affSColin Finck MAKE_ENTRY(VideoPortReleaseBuffer),
61*c2c66affSColin Finck MAKE_ENTRY(VideoPortInterlockedIncrement),
62*c2c66affSColin Finck MAKE_ENTRY(VideoPortInterlockedDecrement),
63*c2c66affSColin Finck MAKE_ENTRY(VideoPortInterlockedExchange),
64*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetVgaStatus),
65*c2c66affSColin Finck MAKE_ENTRY(VideoPortQueueDpc),
66*c2c66affSColin Finck MAKE_ENTRY(VideoPortEnumerateChildren),
67*c2c66affSColin Finck MAKE_ENTRY(VideoPortQueryServices),
68*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetDmaAdapter),
69*c2c66affSColin Finck MAKE_ENTRY(VideoPortPutDmaAdapter),
70*c2c66affSColin Finck MAKE_ENTRY(VideoPortAllocateCommonBuffer),
71*c2c66affSColin Finck MAKE_ENTRY(VideoPortReleaseCommonBuffer),
72*c2c66affSColin Finck MAKE_ENTRY(VideoPortLockBuffer),
73*c2c66affSColin Finck MAKE_ENTRY(VideoPortUnlockBuffer),
74*c2c66affSColin Finck MAKE_ENTRY(VideoPortStartDma),
75*c2c66affSColin Finck MAKE_ENTRY(VideoPortCompleteDma),
76*c2c66affSColin Finck MAKE_ENTRY(VideoPortCreateEvent),
77*c2c66affSColin Finck MAKE_ENTRY(VideoPortDeleteEvent),
78*c2c66affSColin Finck MAKE_ENTRY(VideoPortSetEvent),
79*c2c66affSColin Finck MAKE_ENTRY(VideoPortClearEvent),
80*c2c66affSColin Finck MAKE_ENTRY(VideoPortReadStateEvent),
81*c2c66affSColin Finck MAKE_ENTRY(VideoPortWaitForSingleObject),
82*c2c66affSColin Finck MAKE_ENTRY(VideoPortAllocatePool),
83*c2c66affSColin Finck MAKE_ENTRY(VideoPortFreePool),
84*c2c66affSColin Finck MAKE_ENTRY(VideoPortCreateSpinLock),
85*c2c66affSColin Finck MAKE_ENTRY(VideoPortDeleteSpinLock),
86*c2c66affSColin Finck MAKE_ENTRY(VideoPortAcquireSpinLock),
87*c2c66affSColin Finck MAKE_ENTRY(VideoPortAcquireSpinLockAtDpcLevel),
88*c2c66affSColin Finck MAKE_ENTRY(VideoPortReleaseSpinLock),
89*c2c66affSColin Finck MAKE_ENTRY(VideoPortReleaseSpinLockFromDpcLevel),
90*c2c66affSColin Finck MAKE_ENTRY(VideoPortCheckForDeviceExistence),
91*c2c66affSColin Finck MAKE_ENTRY(VideoPortCreateSecondaryDisplay),
92*c2c66affSColin Finck MAKE_ENTRY(VideoPortFlushRegistry),
93*c2c66affSColin Finck MAKE_ENTRY(VideoPortQueryPerformanceCounter),
94*c2c66affSColin Finck MAKE_ENTRY(VideoPortGetVersion),
95*c2c66affSColin Finck MAKE_ENTRY(VideoPortRegisterBugcheckCallback),
96*c2c66affSColin Finck };
97*c2c66affSColin Finck #undef MAKE_ENTRY
98*c2c66affSColin Finck
99*c2c66affSColin Finck PVOID NTAPI
IntVideoPortGetProcAddress(IN PVOID HwDeviceExtension,IN PUCHAR FunctionName)100*c2c66affSColin Finck IntVideoPortGetProcAddress(
101*c2c66affSColin Finck IN PVOID HwDeviceExtension,
102*c2c66affSColin Finck IN PUCHAR FunctionName)
103*c2c66affSColin Finck {
104*c2c66affSColin Finck ULONG i;
105*c2c66affSColin Finck
106*c2c66affSColin Finck TRACE_(VIDEOPRT, "VideoPortGetProcAddress(%s)\n", FunctionName);
107*c2c66affSColin Finck
108*c2c66affSColin Finck /* Search by name */
109*c2c66affSColin Finck for (i = 0; i < ARRAYSIZE(VideoPortExports); i++)
110*c2c66affSColin Finck {
111*c2c66affSColin Finck if (!strcmp((PCHAR)FunctionName, VideoPortExports[i].Name))
112*c2c66affSColin Finck {
113*c2c66affSColin Finck return (PVOID)VideoPortExports[i].Address;
114*c2c66affSColin Finck }
115*c2c66affSColin Finck }
116*c2c66affSColin Finck
117*c2c66affSColin Finck ERR_(VIDEOPRT, "VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
118*c2c66affSColin Finck
119*c2c66affSColin Finck return NULL;
120*c2c66affSColin Finck }
121