ReactOS  0.4.15-dev-3187-ge372f2b
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

static VP_STATUS NTAPI Pc98VidFindAdapter (_In_ PVOID HwDeviceExtension, _In_opt_ PVOID HwContext, _In_opt_ PWSTR ArgumentString, _Inout_ PVIDEO_PORT_CONFIG_INFO ConfigInfo, _Out_ PUCHAR Again)
 
static BOOLEAN NTAPI Pc98VidInitialize (_In_ PVOID HwDeviceExtension)
 
static 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 []
 
const VIDEO_ACCESS_RANGE LegacyRangeList []
 

Macro Definition Documentation

◆ CONTROL_RANGE_INDEX

#define CONTROL_RANGE_INDEX   17

Definition at line 45 of file pc98vid.c.

◆ FRAMEBUFFER_RANGE_INDEX

#define FRAMEBUFFER_RANGE_INDEX   18

Definition at line 46 of file pc98vid.c.

Function Documentation

◆ DriverEntry()

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

Definition at line 209 of file pc98vid.c.

212 {
214  ULONG Status;
215  BOOLEAN IsLiveCd;
216 
217  VideoDebugPrint((Trace, "(%s:%d) %s()\n",
218  __FILE__, __LINE__, __FUNCTION__));
219 
220  // FIXME: Detect IsLiveCd
221  IsLiveCd = TRUE;
222 
224  InitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA);
225  InitData.HwDeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
227  InitData.HwInitialize = Pc98VidInitialize;
228  InitData.HwStartIO = Pc98VidStartIO;
229  /*
230  * On LiveCD, we expect to see the initialized video
231  * before starting the device enumeration,
232  * so we should mark the driver as non-PnP miniport.
233  */
234  if (!IsLiveCd)
235  {
239  }
240 
243 
244  InitData.AdapterInterfaceType = Isa;
245 
247  if (!NT_SUCCESS(Status))
248  {
249  VideoDebugPrint((Error, "(%s:%d) %s() Initialization failed 0x%lX\n",
250  __FILE__, __LINE__, __FUNCTION__, Status));
251  }
252 
253  return Status;
254 }
PVIDEO_HW_POWER_SET HwSetPowerState
Definition: video.h:675
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:677
static 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:54
#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:645
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
const VIDEO_ACCESS_RANGE LegacyRangeList[]
Definition: pc98vid.c:23
VP_STATUS NTAPI Pc98VidSetPowerState(_In_ PVOID HwDeviceExtension, _In_ ULONG HwId, _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: hardware.c:321
unsigned char BOOLEAN
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
PVIDEO_HW_INITIALIZE HwInitialize
Definition: video.h:667
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PVIDEO_HW_FIND_ADAPTER HwFindAdapter
Definition: video.h:666
struct _VIDEO_ACCESS_RANGE * PVIDEO_ACCESS_RANGE
VP_STATUS NTAPI Pc98VidGetPowerState(_In_ PVOID HwDeviceExtension, _In_ ULONG HwId, _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: hardware.c:292
BOOL Error
Definition: chkdsk.c:66
#define Trace(x)
Definition: inflate.c:42
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1094
static 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:167
#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
#define NULL
Definition: types.h:112
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:212
static BOOLEAN NTAPI Pc98VidInitialize(_In_ PVOID HwDeviceExtension)
Definition: pc98vid.c:148

◆ Pc98VidFindAdapter()

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

Definition at line 54 of file pc98vid.c.

60 {
62  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
63  ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
64  static WCHAR AdapterChipType[] = L"Onboard";
65  static WCHAR AdapterDacType[] = L"8 bit";
66  static WCHAR AdapterString[] = L"PEGC";
67 
68  PAGED_CODE();
69 
70  VideoDebugPrint((Trace, "%s()\n", __FUNCTION__));
71 
72  if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO))
74 
75  Status = VideoPortVerifyAccessRanges(DeviceExtension,
78  if (Status != NO_ERROR)
79  {
80  VideoDebugPrint((Error, "%s() Resource conflict was found\n", __FUNCTION__));
81 
83  }
84 
89 
90  Status = VideoPortMapMemory(DeviceExtension,
91  DeviceExtension->PegcControl,
92  &DeviceExtension->PegcControlLength,
93  &inIoSpace,
94  (PVOID)&DeviceExtension->PegcControlVa);
95  if (Status != NO_ERROR)
96  {
97  VideoDebugPrint((Error, "%s() Failed to map control memory\n", __FUNCTION__));
98 
99  VideoPortVerifyAccessRanges(DeviceExtension, 0, NULL);
100 
101  return ERROR_DEV_NOT_EXIST;
102  }
103 
104  if (!HasPegcController(DeviceExtension))
105  {
106  VideoDebugPrint((Error, "%s() Unsupported hardware\n", __FUNCTION__));
107 
108  VideoPortVerifyAccessRanges(DeviceExtension, 0, NULL);
109  VideoPortUnmapMemory(DeviceExtension,
110  (PVOID)DeviceExtension->PegcControlVa,
111  NULL);
112 
113  return ERROR_DEV_NOT_EXIST;
114  }
115 
116  /* Not VGA-compatible */
117  ConfigInfo->NumEmulatorAccessEntries = 0;
118  ConfigInfo->EmulatorAccessEntries = NULL;
119  ConfigInfo->EmulatorAccessEntriesContext = 0;
120  ConfigInfo->HardwareStateSize = 0;
121  ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0;
122  ConfigInfo->VdmPhysicalVideoMemoryLength = 0;
123 
124  VideoPortSetRegistryParameters(DeviceExtension,
125  L"HardwareInformation.ChipType",
126  AdapterChipType,
127  sizeof(AdapterChipType));
128  VideoPortSetRegistryParameters(DeviceExtension,
129  L"HardwareInformation.DacType",
130  AdapterDacType,
131  sizeof(AdapterDacType));
132  VideoPortSetRegistryParameters(DeviceExtension,
133  L"HardwareInformation.MemorySize",
134  &DeviceExtension->FrameBufferLength,
135  sizeof(ULONG));
136  VideoPortSetRegistryParameters(DeviceExtension,
137  L"HardwareInformation.AdapterString",
139  sizeof(AdapterString));
140 
141  return NO_ERROR;
142 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define NO_ERROR
Definition: dderror.h:5
const VIDEO_ACCESS_RANGE LegacyRangeList[]
Definition: pc98vid.c:23
ULONG_PTR PegcControlVa
Definition: pc98vid.h:51
PHYSICAL_ADDRESS PegcControl
Definition: pc98vid.h:49
static BOOLEAN HasPegcController(VOID)
Definition: bootvid.c:50
Status
Definition: gdiplustypes.h:24
PHYSICAL_ADDRESS FrameBuffer
Definition: pc98vid.h:52
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:50
BOOL Error
Definition: chkdsk.c:66
static const WCHAR L[]
Definition: oid.c:1250
#define FRAMEBUFFER_RANGE_INDEX
Definition: pc98vid.c:46
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:45
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NULL
Definition: types.h:112
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:978
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:53
ULONG RangeLength
Definition: video.h:216
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215
#define PAGED_CODE()

Referenced by DriverEntry().

◆ Pc98VidGetVideoChildDescriptor()

static 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 
)
static

Definition at line 167 of file pc98vid.c.

174 {
175  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
176 
177  UNREFERENCED_PARAMETER(pChildDescriptor);
178 
179  PAGED_CODE();
180 
181  VideoDebugPrint((Trace, "%s() Index %d\n",
182  __FUNCTION__, ChildEnumInfo->ChildIndex));
183 
184  *pUnused = 0;
185 
186  if (ChildEnumInfo->ChildIndex > 0 &&
187  ChildEnumInfo->ChildIndex <= DeviceExtension->MonitorCount)
188  {
189  *VideoChildType = Monitor;
190  *UId = MONITOR_HW_ID;
191 
193  }
194 
195  return ERROR_NO_MORE_DEVICES;
196 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MONITOR_HW_ID
Definition: pc98vid.h:29
#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()

static BOOLEAN NTAPI Pc98VidInitialize ( _In_ PVOID  HwDeviceExtension)
static

Definition at line 148 of file pc98vid.c.

150 {
151  PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension;
152 
153  PAGED_CODE();
154 
155  VideoDebugPrint((Trace, "%s()\n", __FUNCTION__));
156 
157  DeviceExtension->ModeCount = RTL_NUMBER_OF(VideoModes);
158  DeviceExtension->MonitorCount = 1;
159 
160  return TRUE;
161 }
#define TRUE
Definition: types.h:120
#define Trace(x)
Definition: inflate.c:42
const VIDEOMODE VideoModes[]
Definition: pc98vid.c:15
#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

const VIDEO_ACCESS_RANGE LegacyRangeList[]
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 23 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 15 of file pc98vid.c.

Referenced by Pc98VidInitialize().