ReactOS  0.4.14-dev-317-g96040ec
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.

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"
 

Function Documentation

◆ DriverEntry()

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

Definition at line 246 of file vmx_svga.c.

248 {
250 
251  /* Zero initialization structure and array of extensions, one per screen */
252  DPRINT1("VMX-SVGAII Loading...\n");
254  VideoPortZeroMemory(&InitData, sizeof(InitData));
255 
256  /* Setup the initialization structure with VideoPort */
257  InitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA);
258  InitData.HwFindAdapter = VmxFindAdapter;
259  InitData.HwInitialize = VmxInitialize;
260  InitData.HwInterrupt = VmxInterrupt;
261  InitData.HwStartIO = VmxStartIO;
262  InitData.HwResetHw = VmxResetHw;
266  InitData.AdapterInterfaceType = PCIBus;
267  InitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA);
268  InitData.HwDeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
269  return VideoPortInitialize(Context1, Context2, &InitData, NULL);
270 }
VP_STATUS NTAPI VmxGetPowerState(IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: vmx_svga.c:201
PVIDEO_HW_POWER_SET HwSetPowerState
Definition: video.h:675
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:677
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:665
VPAPI ULONG NTAPI VideoPortInitialize(IN PVOID Argument1, IN PVOID Argument2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
Definition: videoprt.c:455
PVIDEO_HW_POWER_GET HwGetPowerState
Definition: video.h:676
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
BOOLEAN NTAPI VmxInitialize(IN PVOID HwDeviceExtension)
Definition: vmx_svga.c:171
PVIDEO_HW_START_IO HwStartIO
Definition: video.h:669
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:84
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
smooth NULL
Definition: ftsmooth.c:416
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
BOOLEAN NTAPI VmxResetHw(IN PVOID DeviceExtension, IN ULONG Columns, IN ULONG Rows)
Definition: vmx_svga.c:190
PVIDEO_HW_INITIALIZE HwInitialize
Definition: video.h:667
PVIDEO_HW_FIND_ADAPTER HwFindAdapter
Definition: video.h:666
PVIDEO_HW_RESET_HW HwResetHw
Definition: video.h:672
PVIDEO_HW_INTERRUPT HwInterrupt
Definition: video.h:668
PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]
Definition: vmx_svga.c:16
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:232
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1094
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1094
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI VmxInterrupt(IN PVOID HwDeviceExtension)
Definition: vmx_svga.c:223
VP_STATUS NTAPI VmxSetPowerState(IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: vmx_svga.c:212
BOOLEAN NTAPI VmxStartIO(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET RequestPacket)
Definition: vmx_svga.c:180

◆ 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 84 of file vmx_svga.c.

89 {
91  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
92  DPRINT1("VMX searching for adapter\n");
93 
94  /* Zero out the fields */
95  VideoPortZeroMemory(DeviceExtension, sizeof(HW_DEVICE_EXTENSION));
96 
97  /* Validate the Config Info */
98  if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO))
99  {
100  /* Incorrect OS version? */
101  DPRINT1("Invalid configuration info\n");
103  }
104 
105  /* Initialize the device extension and find the adapter */
106  Status = VmxInitDevice(DeviceExtension);
107  DPRINT1("Init status: %lx\n", Status);
108  if (Status != NO_ERROR) return ERROR_DEV_NOT_EXIST;
109 
110  /* Save this adapter extension */
111  VmxDeviceExtensionArray[0] = DeviceExtension;
112 
113  /* Create the sync event */
114  VideoPortCreateEvent(DeviceExtension,
116  NULL,
117  &DeviceExtension->SyncEvent);
118 
119  /* Check for multi-monitor configuration */
120  if (VmxIsMultiMon(DeviceExtension))
121  {
122  /* Let's not go so far */
124  while (TRUE);
125  }
126 
127  /* Zero the frame buffer */
129  DeviceExtension->VramSize.LowPart);
130 
131  /* Initialize the video modes */
132  VmxInitModes(DeviceExtension);
133 
134  /* Setup registry keys */
135  VideoPortSetRegistryParameters(DeviceExtension,
136  L"HardwareInformation.ChipType",
138  sizeof(AdapterString));
139  VideoPortSetRegistryParameters(DeviceExtension,
140  L"HardwareInformation.DacType",
142  sizeof(AdapterString));
143  VideoPortSetRegistryParameters(DeviceExtension,
144  L"HardwareInformation.MemorySize",
145  &DeviceExtension->VramSize.LowPart,
146  sizeof(ULONG));
147  VideoPortSetRegistryParameters(DeviceExtension,
148  L"HardwareInformation.AdapterString",
150  sizeof(AdapterString));
151  VideoPortSetRegistryParameters(DeviceExtension,
152  L"HardwareInformation.BiosString",
154  sizeof(AdapterString));
155 
156  /* No VDM support */
157  ConfigInfo->NumEmulatorAccessEntries = 0;
158  ConfigInfo->EmulatorAccessEntries = 0;
159  ConfigInfo->EmulatorAccessEntriesContext = 0;
160  ConfigInfo->HardwareStateSize = 0;
161  ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0;
162  ConfigInfo->VdmPhysicalVideoMemoryLength = 0;
163 
164  /* Write that this is Windows XP or higher */
165  VmxWriteUlong(DeviceExtension, SVGA_REG_GUEST_ID, 0x5000 | 0x08);
166  return NO_ERROR;
167 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
VPAPI VP_STATUS NTAPI VideoPortCreateEvent(IN PVOID HwDeviceExtension, IN ULONG EventFlag, IN PVOID Unused, OUT PEVENT *ppEvent)
Definition: event.c:24
VP_STATUS NTAPI VmxInitDevice(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:54
BOOLEAN NTAPI VmxIsMultiMon(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:64
#define NO_ERROR
Definition: dderror.h:5
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define NOTIFICATION_EVENT
Definition: video.h:109
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI VmxWriteUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index, IN ULONG Value)
Definition: vmx_svga.c:33
PHYSICAL_ADDRESS FrameBuffer
Definition: precomp.h:18
ULONG NTAPI VmxInitModes(IN PHW_DEVICE_EXTENSION DeviceExtension)
Definition: vmx_svga.c:44
PENG_EVENT SyncEvent
Definition: precomp.h:28
static const WCHAR L[]
Definition: oid.c:1250
static WCHAR AdapterString[]
Definition: vmx_svga.c:17
ULONG LowPart
Definition: typedefs.h:104
PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]
Definition: vmx_svga.c:16
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER VramSize
Definition: precomp.h:19
#define DPRINT1
Definition: precomp.h:8
VPAPI VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:785
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
LONG VP_STATUS
Definition: video.h:153
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by DriverEntry().

◆ VmxGetPowerState()

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

Definition at line 201 of file vmx_svga.c.

204 {
206  while (TRUE);
207  return NO_ERROR;
208 }
#define TRUE
Definition: types.h:120
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:114

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 232 of file vmx_svga.c.

238 {
240  while (TRUE);
241  return NO_ERROR;
242 }
#define TRUE
Definition: types.h:120
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by DriverEntry().

◆ VmxInitDevice()

VP_STATUS NTAPI VmxInitDevice ( IN PHW_DEVICE_EXTENSION  DeviceExtension)

Definition at line 54 of file vmx_svga.c.

55 {
56  /* Not here yet */
58  while (TRUE);
59  return NO_ERROR;
60 }
#define TRUE
Definition: types.h:120
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by VmxFindAdapter().

◆ VmxInitialize()

BOOLEAN NTAPI VmxInitialize ( IN PVOID  HwDeviceExtension)

Definition at line 171 of file vmx_svga.c.

172 {
174  while (TRUE);
175  return TRUE;
176 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by DriverEntry().

◆ VmxInitModes()

ULONG NTAPI VmxInitModes ( IN PHW_DEVICE_EXTENSION  DeviceExtension)

Definition at line 44 of file vmx_svga.c.

45 {
46  /* Not here yet */
48  while (TRUE);
49  return 0;
50 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by VmxFindAdapter().

◆ VmxInterrupt()

BOOLEAN NTAPI VmxInterrupt ( IN PVOID  HwDeviceExtension)

Definition at line 223 of file vmx_svga.c.

224 {
226  while (TRUE);
227  return TRUE;
228 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by DriverEntry().

◆ VmxIsMultiMon()

BOOLEAN NTAPI VmxIsMultiMon ( IN PHW_DEVICE_EXTENSION  DeviceExtension)

Definition at line 64 of file vmx_svga.c.

65 {
67 
68  /* Get the caps */
69  Capabilities = DeviceExtension->Capabilities;
70 
71  /* Check for multi-mon support */
73  {
74  /* Query the monitor count */
75  if (VmxReadUlong(DeviceExtension, SVGA_REG_NUM_DISPLAYS) > 1) return TRUE;
76  }
77 
78  /* Either no support, or just one screen */
79  return FALSE;
80 }
#define TRUE
Definition: types.h:120
#define SVGA_CAP_MULTIMON
Definition: vmx_regs.h:50
ULONG NTAPI VmxReadUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, IN ULONG Index)
Definition: vmx_svga.c:23
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
unsigned int ULONG
Definition: retypes.h:1
#define SVGA_CAP_PITCHLOCK
Definition: vmx_regs.h:51

Referenced by VmxFindAdapter().

◆ VmxReadUlong()

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

Definition at line 23 of file vmx_svga.c.

25 {
26  /* Program the index first, then read the value */
27  VideoPortWritePortUlong(DeviceExtension->IndexPort, Index);
28  return VideoPortReadPortUlong(DeviceExtension->ValuePort);
29 }
VPAPI ULONG NTAPI VideoPortReadPortUlong(IN PULONG Port)
VPAPI VOID NTAPI VideoPortWritePortUlong(IN PULONG Port, IN ULONG Value)
static const UCHAR Index[8]
Definition: usbohci.c:18

Referenced by VmxIsMultiMon().

◆ VmxResetHw()

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

Definition at line 190 of file vmx_svga.c.

193 {
195  while (TRUE);
196  return FALSE;
197 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by DriverEntry().

◆ VmxSetPowerState()

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

Definition at line 212 of file vmx_svga.c.

215 {
217  while (TRUE);
218  return NO_ERROR;
219 }
#define TRUE
Definition: types.h:120
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by DriverEntry().

◆ VmxStartIO()

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

Definition at line 180 of file vmx_svga.c.

182 {
184  while (TRUE);
185  return TRUE;
186 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by DriverEntry().

◆ VmxWriteUlong()

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

Definition at line 33 of file vmx_svga.c.

36 {
37  /* Program the index first, then write the value */
38  VideoPortWritePortUlong(DeviceExtension->IndexPort, Index);
39  VideoPortWritePortUlong(DeviceExtension->ValuePort, Value);
40 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
VPAPI VOID NTAPI VideoPortWritePortUlong(IN PULONG Port, IN ULONG Value)
static const UCHAR Index[8]
Definition: usbohci.c:18

Referenced by VmxFindAdapter().

Variable Documentation

◆ AdapterString

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

Definition at line 17 of file vmx_svga.c.

Referenced by VmxFindAdapter().

◆ VmxDeviceExtensionArray

PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]

Definition at line 16 of file vmx_svga.c.

Referenced by DriverEntry(), and VmxFindAdapter().