[HNETCFG] Sync with Wine 3.0. CORE-14225
[reactos.git] / win32ss / drivers / videoprt / services.c
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 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.
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 * Lesser General Public License for more details.
15 *
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
19 *
20 */
21
22 #include "videoprt.h"
23
24 #define NDEBUG
25 #include <debug.h>
26
27 VOID NTAPI
28 IntInterfaceReference(PVOID Context)
29 {
30 /* Do nothing */
31 }
32
33 VOID NTAPI
34 IntInterfaceDereference(PVOID Context)
35 {
36 /* Do nothing */
37 }
38
39 VP_STATUS NTAPI
40 VideoPortQueryServices(
41 IN PVOID HwDeviceExtension,
42 IN VIDEO_PORT_SERVICES ServicesType,
43 IN OUT PINTERFACE Interface)
44 {
45 TRACE_(VIDEOPRT, "VideoPortQueryServices - ServicesType: 0x%x\n", ServicesType);
46
47 switch (ServicesType)
48 {
49 #if defined(_M_IX86)
50 case VideoPortServicesInt10:
51 if (Interface->Version >= VIDEO_PORT_INT10_INTERFACE_VERSION_1 ||
52 Interface->Size >= sizeof(VIDEO_PORT_INT10_INTERFACE))
53 {
54 VIDEO_PORT_INT10_INTERFACE *Int10Interface =
55 (VIDEO_PORT_INT10_INTERFACE *)Interface;
56
57 Interface->InterfaceReference = IntInterfaceReference;
58 Interface->InterfaceDereference = IntInterfaceDereference;
59 Int10Interface->Int10AllocateBuffer = IntInt10AllocateBuffer;
60 Int10Interface->Int10FreeBuffer = IntInt10FreeBuffer;
61 Int10Interface->Int10ReadMemory = IntInt10ReadMemory;
62 Int10Interface->Int10WriteMemory = IntInt10WriteMemory;
63 Int10Interface->Int10CallBios = IntInt10CallBios;
64 return NO_ERROR;
65 }
66 break;
67 #endif
68 case VideoPortServicesAGP:
69 if ((Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_2 &&
70 Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE_2)) ||
71 (Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_1 &&
72 Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE)))
73 {
74 if (NT_SUCCESS(IntAgpGetInterface(HwDeviceExtension, Interface)))
75 {
76 return NO_ERROR;
77 }
78 }
79 break;
80
81 case VideoPortServicesI2C:
82 UNIMPLEMENTED;
83 return ERROR_INVALID_FUNCTION;
84
85 case VideoPortServicesHeadless:
86 UNIMPLEMENTED;
87 return ERROR_INVALID_FUNCTION;
88
89 default:
90 break;
91 }
92
93 return ERROR_INVALID_FUNCTION;
94 }
95
96 BOOLEAN NTAPI
97 VideoPortGetAgpServices(
98 IN PVOID HwDeviceExtension,
99 OUT PVIDEO_PORT_AGP_SERVICES AgpServices)
100 {
101 VIDEO_PORT_AGP_INTERFACE Interface;
102 VP_STATUS Status;
103
104 TRACE_(VIDEOPRT, "VideoPortGetAgpServices\n");
105
106 Interface.Size = sizeof(Interface);
107 Interface.Version = VIDEO_PORT_AGP_INTERFACE_VERSION_1;
108
109 Status = VideoPortQueryServices(HwDeviceExtension, VideoPortServicesAGP,
110 (PINTERFACE)&Interface);
111 if (Status != NO_ERROR)
112 {
113 WARN_(VIDEOPRT, "VideoPortQueryServices() failed!\n");
114 return FALSE;
115 }
116
117 RtlCopyMemory(AgpServices, &Interface.AgpReservePhysical, sizeof(VIDEO_PORT_AGP_SERVICES));
118 return TRUE;
119 }