ReactOS 0.4.15-dev-8109-gd7be748
vmx_svga.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: win32ss/drivers/miniport/vmx_svga/vmx_svga.c
5 * PURPOSE: VMWARE SVGA-II Card Main Driver File
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "precomp.h"
12
13#define NDEBUG
14#include <debug.h>
15
16/* GLOBALS ********************************************************************/
17
19static WCHAR AdapterString[] = L"VMware SVGA II";
20
21/* FUNCTIONS ******************************************************************/
22
27{
28 /* Program the index first, then read the value */
29 VideoPortWritePortUlong(DeviceExtension->IndexPort, Index);
30 return VideoPortReadPortUlong(DeviceExtension->ValuePort);
31}
32
33VOID
38{
39 /* Program the index first, then write the value */
40 VideoPortWritePortUlong(DeviceExtension->IndexPort, Index);
41 VideoPortWritePortUlong(DeviceExtension->ValuePort, Value);
42}
43
47{
48 /* Not here yet */
50 while (TRUE);
51 return 0;
52}
53
57{
58 /* Not here yet */
60 while (TRUE);
61 return NO_ERROR;
62}
63
67{
69
70 /* Get the caps */
71 Capabilities = DeviceExtension->Capabilities;
72
73 /* Check for multi-mon support */
75 {
76 /* Query the monitor count */
77 if (VmxReadUlong(DeviceExtension, SVGA_REG_NUM_DISPLAYS) > 1) return TRUE;
78 }
79
80 /* Either no support, or just one screen */
81 return FALSE;
82}
83
86VmxFindAdapter(IN PVOID HwDeviceExtension,
88 IN PWSTR ArgumentString,
90 OUT PUCHAR Again)
91{
93 PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
94 DPRINT("VMX searching for adapter\n");
95
96 /* Zero out the fields */
97 VideoPortZeroMemory(DeviceExtension, sizeof(HW_DEVICE_EXTENSION));
98
99 /* Validate the Config Info */
100 if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO))
101 {
102 /* Incorrect OS version? */
103 DPRINT1("Invalid configuration info\n");
105 }
106
107 /* Initialize the device extension and find the adapter */
108 Status = VmxInitDevice(DeviceExtension);
109 DPRINT("Init status: %lx\n", Status);
110 if (Status != NO_ERROR) return ERROR_DEV_NOT_EXIST;
111
112 /* Save this adapter extension */
113 VmxDeviceExtensionArray[0] = DeviceExtension;
114
115 /* Create the sync event */
116 VideoPortCreateEvent(DeviceExtension,
118 NULL,
119 &DeviceExtension->SyncEvent);
120
121 /* Check for multi-monitor configuration */
122 if (VmxIsMultiMon(DeviceExtension))
123 {
124 /* Let's not go so far */
126 while (TRUE);
127 }
128
129 /* Zero the frame buffer */
131 DeviceExtension->VramSize.LowPart);
132
133 /* Initialize the video modes */
134 VmxInitModes(DeviceExtension);
135
136 /* Setup registry keys */
137 VideoPortSetRegistryParameters(DeviceExtension,
138 L"HardwareInformation.ChipType",
140 sizeof(AdapterString));
141 VideoPortSetRegistryParameters(DeviceExtension,
142 L"HardwareInformation.DacType",
144 sizeof(AdapterString));
145 VideoPortSetRegistryParameters(DeviceExtension,
146 L"HardwareInformation.MemorySize",
147 &DeviceExtension->VramSize.LowPart,
148 sizeof(ULONG));
149 VideoPortSetRegistryParameters(DeviceExtension,
150 L"HardwareInformation.AdapterString",
152 sizeof(AdapterString));
153 VideoPortSetRegistryParameters(DeviceExtension,
154 L"HardwareInformation.BiosString",
156 sizeof(AdapterString));
157
158 /* No VDM support */
159 ConfigInfo->NumEmulatorAccessEntries = 0;
160 ConfigInfo->EmulatorAccessEntries = 0;
161 ConfigInfo->EmulatorAccessEntriesContext = 0;
162 ConfigInfo->HardwareStateSize = 0;
163 ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0;
164 ConfigInfo->VdmPhysicalVideoMemoryLength = 0;
165
166 /* Write that this is Windows XP or higher */
167 VmxWriteUlong(DeviceExtension, SVGA_REG_GUEST_ID, 0x5000 | 0x08);
168 return NO_ERROR;
169}
170
172NTAPI
173VmxInitialize(IN PVOID HwDeviceExtension)
174{
176 while (TRUE);
177 return TRUE;
178}
179
181NTAPI
182VmxStartIO(IN PVOID HwDeviceExtension,
183 IN PVIDEO_REQUEST_PACKET RequestPacket)
184{
186 while (TRUE);
187 return TRUE;
188}
189
191NTAPI
192VmxResetHw(IN PVOID DeviceExtension,
194 IN ULONG Rows)
195{
197 while (TRUE);
198 return FALSE;
199}
200
202NTAPI
203VmxGetPowerState(IN PVOID HwDeviceExtension,
204 IN ULONG HwId,
205 IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
206{
208 while (TRUE);
209 return NO_ERROR;
210}
211
213NTAPI
214VmxSetPowerState(IN PVOID HwDeviceExtension,
215 IN ULONG HwId,
216 IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
217{
219 while (TRUE);
220 return NO_ERROR;
221}
222
224NTAPI
225VmxInterrupt(IN PVOID HwDeviceExtension)
226{
228 while (TRUE);
229 return TRUE;
230}
231
233NTAPI
235 IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
236 OUT PVIDEO_CHILD_TYPE VideoChildType,
237 OUT PUCHAR pChildDescriptor,
238 OUT PULONG UId,
239 OUT PULONG pUnused)
240{
242 while (TRUE);
243 return NO_ERROR;
244}
245
246ULONG
247NTAPI
250{
252
253 /* Zero initialization structure and array of extensions, one per screen */
254 DPRINT("VMX-SVGAII Loading...\n");
256 VideoPortZeroMemory(&InitData, sizeof(InitData));
257
258 /* Setup the initialization structure with VideoPort */
260 InitData.HwFindAdapter = VmxFindAdapter;
261 InitData.HwInitialize = VmxInitialize;
262 InitData.HwInterrupt = VmxInterrupt;
263 InitData.HwStartIO = VmxStartIO;
264 InitData.HwResetHw = VmxResetHw;
268 InitData.AdapterInterfaceType = PCIBus;
271 return VideoPortInitialize(Context1, Context2, &InitData, NULL);
272}
unsigned char BOOLEAN
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
static const COLUMN_LIST Columns[]
Definition: listview.c:19
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:118
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define NO_ERROR
Definition: dderror.h:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
Status
Definition: gdiplustypes.h:25
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
@ PCIBus
Definition: hwresource.cpp:142
#define L(x)
Definition: ntvdm.h:50
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:907
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
LONG VP_STATUS
Definition: video.h:153
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
VPAPI ULONG NTAPI VideoPortReadPortUlong(IN PULONG Port)
VPAPI VOID NTAPI VideoPortWritePortUlong(IN PULONG Port, IN ULONG Value)
VPAPI ULONG NTAPI VideoPortInitialize(IN PVOID Argument1, IN PVOID Argument2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
Definition: videoprt.c:740
VPAPI VP_STATUS NTAPI VideoPortCreateEvent(IN PVOID HwDeviceExtension, IN ULONG EventFlag, IN PVOID Unused, OUT PEVENT *ppEvent)
enum _VIDEO_CHILD_TYPE * PVIDEO_CHILD_TYPE
VPAPI VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:1081
#define NOTIFICATION_EVENT
Definition: video.h:109
#define DPRINT
Definition: sndvol32.h:73
PENG_EVENT SyncEvent
Definition: precomp.h:28
PHYSICAL_ADDRESS FrameBuffer
Definition: pc98vid.h:52
LARGE_INTEGER VramSize
Definition: precomp.h:19
PVIDEO_HW_FIND_ADAPTER HwFindAdapter
Definition: video.h:674
PVIDEO_HW_START_IO HwStartIO
Definition: video.h:677
PVIDEO_HW_POWER_SET HwSetPowerState
Definition: video.h:683
PVIDEO_HW_POWER_GET HwGetPowerState
Definition: video.h:684
PVIDEO_HW_INTERRUPT HwInterrupt
Definition: video.h:676
PVIDEO_HW_RESET_HW HwResetHw
Definition: video.h:680
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:685
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:673
PVIDEO_HW_INITIALIZE HwInitialize
Definition: video.h:675
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1095
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1096
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
#define SVGA_MAX_DISPLAYS
Definition: vmx_regs.h:75
@ SVGA_REG_NUM_DISPLAYS
Definition: vmx_regs.h:119
@ SVGA_REG_GUEST_ID
Definition: vmx_regs.h:111
#define SVGA_CAP_MULTIMON
Definition: vmx_regs.h:50
#define SVGA_CAP_PITCHLOCK
Definition: vmx_regs.h:51
VP_STATUS NTAPI VmxInitDevice(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:56
BOOLEAN NTAPI VmxStartIO(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET RequestPacket)
Definition: vmx_svga.c:182
ULONG NTAPI VmxInitModes(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:46
VP_STATUS NTAPI VmxGetVideoChildDescriptor(IN PVOID HwDeviceExtension, IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo, OUT PVIDEO_CHILD_TYPE VideoChildType, OUT PUCHAR pChildDescriptor, OUT PULONG UId, OUT PULONG pUnused)
Definition: vmx_svga.c:234
BOOLEAN NTAPI VmxInterrupt(IN PVOID HwDeviceExtension)
Definition: vmx_svga.c:225
BOOLEAN NTAPI VmxResetHw(IN PVOID DeviceExtension, IN ULONG Columns, IN ULONG Rows)
Definition: vmx_svga.c:192
VOID NTAPI VmxWriteUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index, IN ULONG Value)
Definition: vmx_svga.c:35
PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]
Definition: vmx_svga.c:18
VP_STATUS NTAPI VmxFindAdapter(IN PVOID HwDeviceExtension, IN PVOID HwContext, IN PWSTR ArgumentString, IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, OUT PUCHAR Again)
Definition: vmx_svga.c:86
BOOLEAN NTAPI VmxIsMultiMon(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:66
BOOLEAN NTAPI VmxInitialize(IN PVOID HwDeviceExtension)
Definition: vmx_svga.c:173
ULONG NTAPI VmxReadUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index)
Definition: vmx_svga.c:25
static WCHAR AdapterString[]
Definition: vmx_svga.c:19
VP_STATUS NTAPI VmxGetPowerState(IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: vmx_svga.c:203
VP_STATUS NTAPI VmxSetPowerState(IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: vmx_svga.c:214
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_ ULONG Rows
Definition: haltypes.h:7
__wchar_t WCHAR
Definition: xmlstorage.h:180