ReactOS 0.4.16-dev-303-g11d5cb8
vmx_svga.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for vmx_svga.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

ULONG NTAPI VmxReadUlong (IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index)
 
VOID NTAPI VmxWriteUlong (IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index, IN ULONG Value)
 
ULONG NTAPI VmxInitModes (IN PHW_DEVICE_EXTENSION DeviceExtension)
 
VP_STATUS NTAPI VmxInitDevice (IN PHW_DEVICE_EXTENSION DeviceExtension)
 
BOOLEAN NTAPI VmxIsMultiMon (IN PHW_DEVICE_EXTENSION DeviceExtension)
 
VP_STATUS NTAPI VmxFindAdapter (IN PVOID HwDeviceExtension, IN PVOID HwContext, IN PWSTR ArgumentString, IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, OUT PUCHAR Again)
 
BOOLEAN NTAPI VmxInitialize (IN PVOID HwDeviceExtension)
 
BOOLEAN NTAPI VmxStartIO (IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET RequestPacket)
 
BOOLEAN NTAPI VmxResetHw (IN PVOID DeviceExtension, IN ULONG Columns, IN ULONG Rows)
 
VP_STATUS NTAPI VmxGetPowerState (IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
VP_STATUS NTAPI VmxSetPowerState (IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
BOOLEAN NTAPI VmxInterrupt (IN PVOID HwDeviceExtension)
 
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)
 
ULONG NTAPI DriverEntry (IN PVOID Context1, IN PVOID Context2)
 

Variables

PHW_DEVICE_EXTENSION VmxDeviceExtensionArray [SVGA_MAX_DISPLAYS]
 
static WCHAR AdapterString [] = L"VMware SVGA II"
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file vmx_svga.c.

Function Documentation

◆ DriverEntry()

ULONG NTAPI DriverEntry ( IN PVOID  Context1,
IN PVOID  Context2 
)

Definition at line 248 of file vmx_svga.c.

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}
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
#define NULL
Definition: types.h:112
@ PCIBus
Definition: hwresource.cpp:142
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
VPAPI ULONG NTAPI VideoPortInitialize(IN PVOID Argument1, IN PVOID Argument2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
Definition: videoprt.c:740
#define DPRINT
Definition: sndvol32.h:73
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
BOOLEAN NTAPI VmxStartIO(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET RequestPacket)
Definition: vmx_svga.c:182
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
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 VmxInitialize(IN PVOID HwDeviceExtension)
Definition: vmx_svga.c:173
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

◆ VmxFindAdapter()

VP_STATUS NTAPI VmxFindAdapter ( IN PVOID  HwDeviceExtension,
IN PVOID  HwContext,
IN PWSTR  ArgumentString,
IN OUT PVIDEO_PORT_CONFIG_INFO  ConfigInfo,
OUT PUCHAR  Again 
)

Definition at line 86 of file vmx_svga.c.

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}
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define NO_ERROR
Definition: dderror.h:5
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
Status
Definition: gdiplustypes.h:25
#define L(x)
Definition: ntvdm.h:50
LONG VP_STATUS
Definition: video.h:153
VPAPI VP_STATUS NTAPI VideoPortCreateEvent(IN PVOID HwDeviceExtension, IN ULONG EventFlag, IN PVOID Unused, OUT PEVENT *ppEvent)
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
PENG_EVENT SyncEvent
Definition: precomp.h:28
PHYSICAL_ADDRESS FrameBuffer
Definition: pc98vid.h:52
LARGE_INTEGER VramSize
Definition: precomp.h:19
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
@ SVGA_REG_GUEST_ID
Definition: vmx_regs.h:111
VP_STATUS NTAPI VmxInitDevice(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:56
ULONG NTAPI VmxInitModes(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:46
VOID NTAPI VmxWriteUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index, IN ULONG Value)
Definition: vmx_svga.c:35
BOOLEAN NTAPI VmxIsMultiMon(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:66
static WCHAR AdapterString[]
Definition: vmx_svga.c:19

Referenced by DriverEntry().

◆ VmxGetPowerState()

VP_STATUS NTAPI VmxGetPowerState ( IN PVOID  HwDeviceExtension,
IN ULONG  HwId,
IN PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 203 of file vmx_svga.c.

206{
208 while (TRUE);
209 return NO_ERROR;
210}

Referenced by DriverEntry().

◆ VmxGetVideoChildDescriptor()

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 at line 234 of file vmx_svga.c.

240{
242 while (TRUE);
243 return NO_ERROR;
244}

Referenced by DriverEntry().

◆ VmxInitDevice()

VP_STATUS NTAPI VmxInitDevice ( IN PHW_DEVICE_EXTENSION  DeviceExtension)

Definition at line 56 of file vmx_svga.c.

57{
58 /* Not here yet */
60 while (TRUE);
61 return NO_ERROR;
62}

Referenced by VmxFindAdapter().

◆ VmxInitialize()

BOOLEAN NTAPI VmxInitialize ( IN PVOID  HwDeviceExtension)

Definition at line 173 of file vmx_svga.c.

174{
176 while (TRUE);
177 return TRUE;
178}

Referenced by DriverEntry().

◆ VmxInitModes()

ULONG NTAPI VmxInitModes ( IN PHW_DEVICE_EXTENSION  DeviceExtension)

Definition at line 46 of file vmx_svga.c.

47{
48 /* Not here yet */
50 while (TRUE);
51 return 0;
52}

Referenced by VmxFindAdapter().

◆ VmxInterrupt()

BOOLEAN NTAPI VmxInterrupt ( IN PVOID  HwDeviceExtension)

Definition at line 225 of file vmx_svga.c.

226{
228 while (TRUE);
229 return TRUE;
230}

Referenced by DriverEntry().

◆ VmxIsMultiMon()

BOOLEAN NTAPI VmxIsMultiMon ( IN PHW_DEVICE_EXTENSION  DeviceExtension)

Definition at line 66 of file vmx_svga.c.

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}
#define FALSE
Definition: types.h:117
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
@ SVGA_REG_NUM_DISPLAYS
Definition: vmx_regs.h:119
#define SVGA_CAP_MULTIMON
Definition: vmx_regs.h:50
#define SVGA_CAP_PITCHLOCK
Definition: vmx_regs.h:51
ULONG NTAPI VmxReadUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index)
Definition: vmx_svga.c:25

Referenced by VmxFindAdapter().

◆ VmxReadUlong()

ULONG NTAPI VmxReadUlong ( IN PHW_DEVICE_EXTENSION  DeviceExtension,
IN ULONG  Index 
)

Definition at line 25 of file vmx_svga.c.

27{
28 /* Program the index first, then read the value */
29 VideoPortWritePortUlong(DeviceExtension->IndexPort, Index);
30 return VideoPortReadPortUlong(DeviceExtension->ValuePort);
31}
VPAPI ULONG NTAPI VideoPortReadPortUlong(IN PULONG Port)
VPAPI VOID NTAPI VideoPortWritePortUlong(IN PULONG Port, IN ULONG Value)
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by VmxIsMultiMon().

◆ VmxResetHw()

BOOLEAN NTAPI VmxResetHw ( IN PVOID  DeviceExtension,
IN ULONG  Columns,
IN ULONG  Rows 
)

Definition at line 192 of file vmx_svga.c.

195{
197 while (TRUE);
198 return FALSE;
199}

Referenced by DriverEntry().

◆ VmxSetPowerState()

VP_STATUS NTAPI VmxSetPowerState ( IN PVOID  HwDeviceExtension,
IN ULONG  HwId,
IN PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 214 of file vmx_svga.c.

217{
219 while (TRUE);
220 return NO_ERROR;
221}

Referenced by DriverEntry().

◆ VmxStartIO()

BOOLEAN NTAPI VmxStartIO ( IN PVOID  HwDeviceExtension,
IN PVIDEO_REQUEST_PACKET  RequestPacket 
)

Definition at line 182 of file vmx_svga.c.

184{
186 while (TRUE);
187 return TRUE;
188}

Referenced by DriverEntry().

◆ VmxWriteUlong()

VOID NTAPI VmxWriteUlong ( IN PHW_DEVICE_EXTENSION  DeviceExtension,
IN ULONG  Index,
IN ULONG  Value 
)

Definition at line 35 of file vmx_svga.c.

38{
39 /* Program the index first, then write the value */
40 VideoPortWritePortUlong(DeviceExtension->IndexPort, Index);
41 VideoPortWritePortUlong(DeviceExtension->ValuePort, Value);
42}
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by VmxFindAdapter().

Variable Documentation

◆ AdapterString

WCHAR AdapterString[] = L"VMware SVGA II"
static

Definition at line 19 of file vmx_svga.c.

Referenced by Pc98VidFindAdapter(), and VmxFindAdapter().

◆ VmxDeviceExtensionArray

PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]

Definition at line 18 of file vmx_svga.c.

Referenced by DriverEntry(), and VmxFindAdapter().