Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenvmx_svga.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Boot Loader 00003 * LICENSE: BSD - See COPYING.ARM in the top level directory 00004 * FILE: drivers/video/miniport/vmx_svga/vmx_svga.c 00005 * PURPOSE: VMWARE SVGA-II Card Main Driver File 00006 * PROGRAMMERS: ReactOS Portable Systems Group 00007 */ 00008 00009 /* INCLUDES *******************************************************************/ 00010 00011 #include "precomp.h" 00012 #include "debug.h" 00013 00014 /* GLOBALS ********************************************************************/ 00015 00016 PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]; 00017 static WCHAR AdapterString[] = L"VMware SVGA II"; 00018 00019 /* FUNCTIONS ******************************************************************/ 00020 00021 ULONG 00022 NTAPI 00023 VmxReadUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, 00024 IN ULONG Index) 00025 { 00026 /* Program the index first, then read the value */ 00027 VideoPortWritePortUlong(DeviceExtension->IndexPort, Index); 00028 return VideoPortReadPortUlong(DeviceExtension->ValuePort); 00029 } 00030 00031 VOID 00032 NTAPI 00033 VmxWriteUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, 00034 IN ULONG Index, 00035 IN ULONG Value) 00036 { 00037 /* Program the index first, then write the value */ 00038 VideoPortWritePortUlong(DeviceExtension->IndexPort, Index); 00039 VideoPortWritePortUlong(DeviceExtension->ValuePort, Value); 00040 } 00041 00042 ULONG 00043 NTAPI 00044 VmxInitModes(IN PHW_DEVICE_EXTENSION DeviceExtension) 00045 { 00046 /* Not here yet */ 00047 UNIMPLEMENTED; 00048 while (TRUE); 00049 return 0; 00050 } 00051 00052 VP_STATUS 00053 NTAPI 00054 VmxInitDevice(IN PHW_DEVICE_EXTENSION DeviceExtension) 00055 { 00056 /* Not here yet */ 00057 UNIMPLEMENTED; 00058 while (TRUE); 00059 return NO_ERROR; 00060 } 00061 00062 BOOLEAN 00063 NTAPI 00064 VmxIsMultiMon(IN PHW_DEVICE_EXTENSION DeviceExtension) 00065 { 00066 ULONG Capabilities; 00067 00068 /* Get the caps */ 00069 Capabilities = DeviceExtension->Capabilities; 00070 00071 /* Check for multi-mon support */ 00072 if ((Capabilities & SVGA_CAP_MULTIMON) && (Capabilities & SVGA_CAP_PITCHLOCK)) 00073 { 00074 /* Query the monitor count */ 00075 if (VmxReadUlong(DeviceExtension, SVGA_REG_NUM_DISPLAYS) > 1) return TRUE; 00076 } 00077 00078 /* Either no support, or just one screen */ 00079 return FALSE; 00080 } 00081 00082 VP_STATUS 00083 NTAPI 00084 VmxFindAdapter(IN PVOID HwDeviceExtension, 00085 IN PVOID HwContext, 00086 IN PWSTR ArgumentString, 00087 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, 00088 OUT PUCHAR Again) 00089 { 00090 VP_STATUS Status; 00091 PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension; 00092 DPRINT1("VMX searching for adapter\n"); 00093 00094 /* Zero out the fields */ 00095 VideoPortZeroMemory(DeviceExtension, sizeof(HW_DEVICE_EXTENSION)); 00096 00097 /* Validate the Config Info */ 00098 if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO)) 00099 { 00100 /* Incorrect OS version? */ 00101 DPRINT1("Invalid configuration info\n"); 00102 return ERROR_INVALID_PARAMETER; 00103 } 00104 00105 /* Initialize the device extension and find the adapter */ 00106 Status = VmxInitDevice(DeviceExtension); 00107 DPRINT1("Init status: %lx\n", Status); 00108 if (Status != NO_ERROR) return ERROR_DEV_NOT_EXIST; 00109 00110 /* Save this adapter extension */ 00111 VmxDeviceExtensionArray[0] = DeviceExtension; 00112 00113 /* Create the sync event */ 00114 VideoPortCreateEvent(DeviceExtension, 00115 NOTIFICATION_EVENT, 00116 NULL, 00117 &DeviceExtension->SyncEvent); 00118 00119 /* Check for multi-monitor configuration */ 00120 if (VmxIsMultiMon(DeviceExtension)) 00121 { 00122 /* Let's not go so far */ 00123 UNIMPLEMENTED; 00124 while (TRUE); 00125 } 00126 00127 /* Zero the frame buffer */ 00128 VideoPortZeroMemory((PVOID)DeviceExtension->FrameBuffer.LowPart, 00129 DeviceExtension->VramSize.LowPart); 00130 00131 /* Initialize the video modes */ 00132 VmxInitModes(DeviceExtension); 00133 00134 /* Setup registry keys */ 00135 VideoPortSetRegistryParameters(DeviceExtension, 00136 L"HardwareInformation.ChipType", 00137 AdapterString, 00138 sizeof(AdapterString)); 00139 VideoPortSetRegistryParameters(DeviceExtension, 00140 L"HardwareInformation.DacType", 00141 AdapterString, 00142 sizeof(AdapterString)); 00143 VideoPortSetRegistryParameters(DeviceExtension, 00144 L"HardwareInformation.MemorySize", 00145 &DeviceExtension->VramSize.LowPart, 00146 sizeof(ULONG)); 00147 VideoPortSetRegistryParameters(DeviceExtension, 00148 L"HardwareInformation.AdapterString", 00149 AdapterString, 00150 sizeof(AdapterString)); 00151 VideoPortSetRegistryParameters(DeviceExtension, 00152 L"HardwareInformation.BiosString", 00153 AdapterString, 00154 sizeof(AdapterString)); 00155 00156 /* No VDM support */ 00157 ConfigInfo->NumEmulatorAccessEntries = 0; 00158 ConfigInfo->EmulatorAccessEntries = 0; 00159 ConfigInfo->EmulatorAccessEntriesContext = 0; 00160 ConfigInfo->HardwareStateSize = 0; 00161 ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0; 00162 ConfigInfo->VdmPhysicalVideoMemoryLength = 0; 00163 00164 /* Write that this is Windows XP or higher */ 00165 VmxWriteUlong(DeviceExtension, SVGA_REG_GUEST_ID, 0x5000 | 0x08); 00166 return NO_ERROR; 00167 } 00168 00169 BOOLEAN 00170 NTAPI 00171 VmxInitialize(IN PVOID HwDeviceExtension) 00172 { 00173 UNIMPLEMENTED; 00174 while (TRUE); 00175 return TRUE; 00176 } 00177 00178 BOOLEAN 00179 NTAPI 00180 VmxStartIO(IN PVOID HwDeviceExtension, 00181 IN PVIDEO_REQUEST_PACKET RequestPacket) 00182 { 00183 UNIMPLEMENTED; 00184 while (TRUE); 00185 return TRUE; 00186 } 00187 00188 BOOLEAN 00189 NTAPI 00190 VmxResetHw(IN PVOID DeviceExtension, 00191 IN ULONG Columns, 00192 IN ULONG Rows) 00193 { 00194 UNIMPLEMENTED; 00195 while (TRUE); 00196 return FALSE; 00197 } 00198 00199 VP_STATUS 00200 NTAPI 00201 VmxGetPowerState(IN PVOID HwDeviceExtension, 00202 IN ULONG HwId, 00203 IN PVIDEO_POWER_MANAGEMENT VideoPowerControl) 00204 { 00205 UNIMPLEMENTED; 00206 while (TRUE); 00207 return NO_ERROR; 00208 } 00209 00210 VP_STATUS 00211 NTAPI 00212 VmxSetPowerState(IN PVOID HwDeviceExtension, 00213 IN ULONG HwId, 00214 IN PVIDEO_POWER_MANAGEMENT VideoPowerControl) 00215 { 00216 UNIMPLEMENTED; 00217 while (TRUE); 00218 return NO_ERROR; 00219 } 00220 00221 BOOLEAN 00222 NTAPI 00223 VmxInterrupt(IN PVOID HwDeviceExtension) 00224 { 00225 UNIMPLEMENTED; 00226 while (TRUE); 00227 return TRUE; 00228 } 00229 00230 VP_STATUS 00231 NTAPI 00232 VmxGetVideoChildDescriptor(IN PVOID HwDeviceExtension, 00233 IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo, 00234 OUT PVIDEO_CHILD_TYPE VideoChildType, 00235 OUT PUCHAR pChildDescriptor, 00236 OUT PULONG UId, 00237 OUT PULONG pUnused) 00238 { 00239 UNIMPLEMENTED; 00240 while (TRUE); 00241 return NO_ERROR; 00242 } 00243 00244 ULONG 00245 NTAPI 00246 DriverEntry(IN PVOID Context1, 00247 IN PVOID Context2) 00248 { 00249 VIDEO_HW_INITIALIZATION_DATA InitData; 00250 00251 /* Zero initialization structure and array of extensions, one per screen */ 00252 DPRINT1("VMX-SVGAII Loading...\n"); 00253 VideoPortZeroMemory(VmxDeviceExtensionArray, sizeof(VmxDeviceExtensionArray)); 00254 VideoPortZeroMemory(&InitData, sizeof(InitData)); 00255 00256 /* Setup the initialization structure with VideoPort */ 00257 InitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA); 00258 InitData.HwFindAdapter = VmxFindAdapter; 00259 InitData.HwInitialize = VmxInitialize; 00260 InitData.HwInterrupt = VmxInterrupt; 00261 InitData.HwStartIO = VmxStartIO; 00262 InitData.HwResetHw = VmxResetHw; 00263 InitData.HwGetPowerState = VmxGetPowerState; 00264 InitData.HwSetPowerState = VmxSetPowerState; 00265 InitData.HwGetVideoChildDescriptor = VmxGetVideoChildDescriptor; 00266 InitData.AdapterInterfaceType = PCIBus; 00267 InitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA); 00268 InitData.HwDeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION); 00269 return VideoPortInitialize(Context1, Context2, &InitData, NULL); 00270 } Generated on Thu May 24 2012 04:38:18 for ReactOS by
1.7.6.1
|