ReactOS  0.4.15-dev-1207-g698a8e6
pc98vid.c File Reference
#include "pc98vid.h"
Include dependency graph for pc98vid.c:

Go to the source code of this file.

Macros

#define CONTROL_RANGE_INDEX   17
 
#define FRAMEBUFFER_RANGE_INDEX   18
 

Functions

VP_STATUS NTAPI Pc98VidFindAdapter (_In_ PVOID HwDeviceExtension, _In_opt_ PVOID HwContext, _In_opt_ PWSTR ArgumentString, _Inout_ PVIDEO_PORT_CONFIG_INFO ConfigInfo, _Out_ PUCHAR Again)
 
BOOLEAN NTAPI Pc98VidInitialize (_In_ PVOID HwDeviceExtension)
 
VP_STATUS NTAPI Pc98VidGetVideoChildDescriptor (_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

const VIDEOMODE VideoModes []
 
static VIDEO_ACCESS_RANGE LegacyRangeList []
 

Macro Definition Documentation

◆ CONTROL_RANGE_INDEX

#define CONTROL_RANGE_INDEX   17

Definition at line 50 of file pc98vid.c.

◆ FRAMEBUFFER_RANGE_INDEX

#define FRAMEBUFFER_RANGE_INDEX   18

Definition at line 51 of file pc98vid.c.

Function Documentation

◆ DriverEntry()

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

Definition at line 199 of file pc98vid.c.

202 {
204  ULONG Status;
205  BOOLEAN IsLiveCd;
206 
207  VideoDebugPrint((Trace, "(%s:%d) %s()\n",
208  __FILE__, __LINE__, __FUNCTION__));
209 
210  // FIXME: Detect IsLiveCd
211  IsLiveCd = TRUE;
212 
214  InitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA);
215  InitData.HwDeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
217  InitData.HwInitialize = Pc98VidInitialize;
218  InitData.HwStartIO = Pc98VidStartIO;
219  /*
220  * On LiveCD, we expect to see the initialized video
221  * before starting the device enumeration,
222  * so we should mark the driver as non-PnP miniport.
223  */
224  if (!IsLiveCd)
225  {
229  }
230 
233 
234  InitData.AdapterInterfaceType = Isa;
235 
237  if (!NT_SUCCESS(Status))
238  {
239  VideoDebugPrint((Error, "(%s:%d) %s() Initialization failed 0x%lX\n",
240  __FILE__, __LINE__, __FUNCTION__, Status));
241  }
242 
243  return Status;
244 }
VP_STATUS NTAPI Pc98VidGetVideoChildDescriptor(_In_ PVOID HwDeviceExtension, _In_ PVIDEO_CHILD_ENUM_INFO ChildEnumInfo, _Out_ PVIDEO_CHILD_TYPE VideoChildType, _Out_ PUCHAR pChildDescriptor, _Out_ PULONG UId, _Out_ PULONG pUnused)
Definition: pc98vid.c:166
static VIDEO_ACCESS_RANGE LegacyRangeList[]
Definition: pc98vid.c:28
PVIDEO_HW_POWER_SET HwSetPowerState
Definition: video.h:675
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:677
#define TRUE
Definition: types.h:120
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:592
PVIDEO_HW_POWER_GET HwGetPowerState
Definition: video.h:676
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
PVIDEO_HW_START_IO HwStartIO
Definition: video.h:669
VP_STATUS NTAPI Pc98VidFindAdapter(_In_ PVOID HwDeviceExtension, _In_opt_ PVOID HwContext, _In_opt_ PWSTR ArgumentString, _Inout_ PVIDEO_PORT_CONFIG_INFO ConfigInfo, _Out_ PUCHAR Again)
Definition: pc98vid.c:57
VP_STATUS NTAPI Pc98VidSetPowerState(_In_ PVOID HwDeviceExtension, _In_ ULONG HwId, _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: hardware.c:324
unsigned char BOOLEAN
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
smooth NULL
Definition: ftsmooth.c:416
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
PVIDEO_HW_INITIALIZE HwInitialize
Definition: video.h:667
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PVIDEO_HW_FIND_ADAPTER HwFindAdapter
Definition: video.h:666
VP_STATUS NTAPI Pc98VidGetPowerState(_In_ PVOID HwDeviceExtension, _In_ ULONG HwId, _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: hardware.c:296
BOOL Error
Definition: chkdsk.c:66
Status
Definition: gdiplustypes.h:24
#define Trace(x)
Definition: inflate.c:42
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1094
#define VideoDebugPrint(x)
Definition: video.h:75
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1094
BOOLEAN NTAPI Pc98VidInitialize(_In_ PVOID HwDeviceExtension)
Definition: pc98vid.c:149
PVIDEO_ACCESS_RANGE HwLegacyResourceList
Definition: video.h:680
unsigned int ULONG
Definition: retypes.h:1
#define __FUNCTION__
Definition: types.h:112
BOOLEAN NTAPI Pc98VidStartIO(_In_ PVOID HwDeviceExtension, _Inout_ PVIDEO_REQUEST_PACKET RequestPacket)
Definition: ioctl.c:209

◆ Pc98VidFindAdapter()

VP_STATUS NTAPI Pc98VidFindAdapter ( _In_ PVOID  HwDeviceExtension,
_In_opt_ PVOID  HwContext,
_In_opt_ PWSTR  ArgumentString,
_Inout_ PVIDEO_PORT_CONFIG_INFO  ConfigInfo,
_Out_ PUCHAR  Again 
)

Definition at line 57 of file pc98vid.c.

63 {
65  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
66  ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
67  static WCHAR AdapterChipType[] = L"Onboard";
68  static WCHAR AdapterDacType[] = L"8 bit";
69  static WCHAR AdapterString[] = L"PEGC";
70 
71  PAGED_CODE();
72 
73  VideoDebugPrint((Trace, "%s()\n", __FUNCTION__));
74 
75  if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO))
77 
78  Status = VideoPortVerifyAccessRanges(DeviceExtension,
81  if (Status != NO_ERROR)
82  {
83  VideoDebugPrint((Error, "%s() Resource conflict was found\n", __FUNCTION__));
84 
86  }
87 
92 
93  Status = VideoPortMapMemory(DeviceExtension,
94  DeviceExtension->PegcControl,
95  &DeviceExtension->PegcControlLength,
96  &inIoSpace,
97  (PVOID)&DeviceExtension->PegcControlVa);
98  if (Status != NO_ERROR)
99  {
100  VideoDebugPrint((Error, "%s() Failed to map control memory\n", __FUNCTION__));
101 
102  VideoPortVerifyAccessRanges(DeviceExtension, 0, NULL);
103 
104  return ERROR_DEV_NOT_EXIST;
105  }
106 
107  if (!HasPegcController(DeviceExtension))
108  {
109  VideoDebugPrint((Error, "%s() Unsupported hardware\n", __FUNCTION__));
110 
111  VideoPortVerifyAccessRanges(DeviceExtension, 0, NULL);
112  VideoPortUnmapMemory(DeviceExtension,
113  (PVOID)DeviceExtension->PegcControlVa,
114  NULL);
115 
116  return ERROR_DEV_NOT_EXIST;
117  }
118 
119  /* Not VGA-compatible */
120  ConfigInfo->NumEmulatorAccessEntries = 0;
121  ConfigInfo->EmulatorAccessEntries = NULL;
122  ConfigInfo->EmulatorAccessEntriesContext = 0;
123  ConfigInfo->HardwareStateSize = 0;
124  ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0;
125  ConfigInfo->VdmPhysicalVideoMemoryLength = 0;
126 
127  VideoPortSetRegistryParameters(DeviceExtension,
128  L"HardwareInformation.ChipType",
129  AdapterChipType,
130  sizeof(AdapterChipType));
131  VideoPortSetRegistryParameters(DeviceExtension,
132  L"HardwareInformation.DacType",
133  AdapterDacType,
134  sizeof(AdapterDacType));
135  VideoPortSetRegistryParameters(DeviceExtension,
136  L"HardwareInformation.MemorySize",
137  &DeviceExtension->FrameBufferLength,
138  sizeof(ULONG));
139  VideoPortSetRegistryParameters(DeviceExtension,
140  L"HardwareInformation.AdapterString",
142  sizeof(AdapterString));
143 
144  return NO_ERROR;
145 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static VIDEO_ACCESS_RANGE LegacyRangeList[]
Definition: pc98vid.c:28
#define NO_ERROR
Definition: dderror.h:5
ULONG_PTR PegcControlVa
Definition: pc98vid.h:46
PHYSICAL_ADDRESS PegcControl
Definition: pc98vid.h:44
smooth NULL
Definition: ftsmooth.c:416
static BOOLEAN HasPegcController(VOID)
Definition: bootvid.c:50
PHYSICAL_ADDRESS FrameBuffer
Definition: pc98vid.h:47
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG PegcControlLength
Definition: pc98vid.h:45
BOOL Error
Definition: chkdsk.c:66
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define FRAMEBUFFER_RANGE_INDEX
Definition: pc98vid.c:51
static WCHAR AdapterString[]
Definition: vmx_svga.c:17
#define Trace(x)
Definition: inflate.c:42
VPAPI VP_STATUS NTAPI VideoPortUnmapMemory(IN PVOID HwDeviceExtension, IN OUT PVOID VirtualAddress, IN HANDLE ProcessHandle)
#define VideoDebugPrint(x)
Definition: video.h:75
#define CONTROL_RANGE_INDEX
Definition: pc98vid.c:50
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
VPAPI VP_STATUS NTAPI VideoPortVerifyAccessRanges(IN PVOID HwDeviceExtension, IN ULONG NumAccessRanges, IN PVIDEO_ACCESS_RANGE AccessRanges)
Definition: resource.c:822
VPAPI VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:925
unsigned int ULONG
Definition: retypes.h:1
LONG VP_STATUS
Definition: video.h:153
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
#define __FUNCTION__
Definition: types.h:112
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
ULONG FrameBufferLength
Definition: pc98vid.h:48
ULONG RangeLength
Definition: video.h:216
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215
#define PAGED_CODE()

Referenced by DriverEntry().

◆ Pc98VidGetVideoChildDescriptor()

VP_STATUS NTAPI Pc98VidGetVideoChildDescriptor ( _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 166 of file pc98vid.c.

173 {
174  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
175 
176  UNREFERENCED_PARAMETER(pChildDescriptor);
177 
178  PAGED_CODE();
179 
180  VideoDebugPrint((Trace, "%s() Index %d\n",
181  __FUNCTION__, ChildEnumInfo->ChildIndex));
182 
183  *pUnused = 0;
184 
185  if (ChildEnumInfo->ChildIndex > 0 &&
186  ChildEnumInfo->ChildIndex <= DeviceExtension->MonitorCount)
187  {
188  *VideoChildType = Monitor;
189  *UId = MONITOR_HW_ID;
190 
192  }
193 
194  return ERROR_NO_MORE_DEVICES;
195 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MONITOR_HW_ID
Definition: pc98vid.h:24
#define ERROR_NO_MORE_DEVICES
Definition: dderror.h:18
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139
#define Trace(x)
Definition: inflate.c:42
#define VideoDebugPrint(x)
Definition: video.h:75
Definition: video.h:270
#define __FUNCTION__
Definition: types.h:112
#define PAGED_CODE()

Referenced by DriverEntry().

◆ Pc98VidInitialize()

BOOLEAN NTAPI Pc98VidInitialize ( _In_ PVOID  HwDeviceExtension)

Definition at line 149 of file pc98vid.c.

151 {
152  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
153 
154  PAGED_CODE();
155 
156  VideoDebugPrint((Trace, "%s()\n", __FUNCTION__));
157 
158  DeviceExtension->ModeCount = RTL_NUMBER_OF(VideoModes);
159  DeviceExtension->MonitorCount = 1;
160 
161  return TRUE;
162 }
#define TRUE
Definition: types.h:120
#define Trace(x)
Definition: inflate.c:42
const VIDEOMODE VideoModes[]
Definition: pc98vid.c:21
#define VideoDebugPrint(x)
Definition: video.h:75
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define __FUNCTION__
Definition: types.h:112
#define PAGED_CODE()

Referenced by DriverEntry().

Variable Documentation

◆ LegacyRangeList

VIDEO_ACCESS_RANGE LegacyRangeList[]
static
Initial value:
=
{
{ {{0x60, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x62, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x68, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x6A, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x7C, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xA0, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xA2, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xA4, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xA6, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xA8, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xAA, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xAC, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xAE, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x9A0, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x9A2, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x9A8, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0xFAC, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{VRAM_NORMAL_PLANE_I, 0}}, PEGC_CONTROL_SIZE, 0, 0, 1, 0 },
}
#define PEGC_FRAMEBUFFER_PACKED
Definition: video.h:22
#define PEGC_FRAMEBUFFER_SIZE
Definition: video.h:23
#define PEGC_CONTROL_SIZE
Definition: video.h:25
#define VRAM_NORMAL_PLANE_I
Definition: video.h:15

Definition at line 28 of file pc98vid.c.

Referenced by DriverEntry(), and Pc98VidFindAdapter().

◆ VideoModes

const VIDEOMODE VideoModes[]
Initial value:
=
{
{0, 80, 12, 2, 4, 4, 6, 480, 37}, {0, 80, 12, 2, 4, 132, 6, 480, 37}}
}
#define GDC2_MODE_LINES_800
Definition: video.h:302
#define GRAPH_HF_31KHZ
Definition: video.h:362
#define GDC2_CLOCK2_5MHZ
Definition: video.h:308
#define GDC2_CLOCK1_5MHZ
Definition: video.h:306

Definition at line 21 of file pc98vid.c.

Referenced by Pc98VidInitialize().