ReactOS 0.4.15-dev-8135-g1bc6c90
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{
215 BOOLEAN IsLiveCd;
216
217 VideoDebugPrint((Trace, "(%s:%d) %s()\n",
218 __FILE__, __LINE__, __FUNCTION__));
219
220 // FIXME: Detect IsLiveCd
221 IsLiveCd = TRUE;
222
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}
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
BOOL Error
Definition: chkdsk.c:66
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define Trace(x)
Definition: inflate.c:42
#define __FUNCTION__
Definition: types.h:116
Status
Definition: gdiplustypes.h:25
@ Isa
Definition: hwresource.cpp:138
const VIDEO_ACCESS_RANGE LegacyRangeList[]
Definition: pc98vid.c:23
static BOOLEAN NTAPI Pc98VidInitialize(_In_ PVOID HwDeviceExtension)
Definition: pc98vid.c:148
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
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
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 VideoDebugPrint(x)
Definition: video.h:75
struct _VIDEO_ACCESS_RANGE * PVIDEO_ACCESS_RANGE
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_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:685
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:673
PVIDEO_ACCESS_RANGE HwLegacyResourceList
Definition: video.h:688
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
uint32_t ULONG
Definition: typedefs.h:59
VP_STATUS NTAPI Pc98VidGetPowerState(_In_ PVOID HwDeviceExtension, _In_ ULONG HwId, _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: hardware.c:292
VP_STATUS NTAPI Pc98VidSetPowerState(_In_ PVOID HwDeviceExtension, _In_ ULONG HwId, _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl)
Definition: hardware.c:321
BOOLEAN NTAPI Pc98VidStartIO(_In_ PVOID HwDeviceExtension, _Inout_ PVIDEO_REQUEST_PACKET RequestPacket)
Definition: ioctl.c:212

◆ 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;
64 static WCHAR AdapterChipType[] = L"Onboard";
65 static WCHAR AdapterDacType[] = L"8 bit";
66 static WCHAR AdapterString[] = L"PEGC";
67
68 PAGED_CODE();
69
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 PAGED_CODE()
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static BOOLEAN HasPegcController(VOID)
Definition: bootvid.c:50
#define L(x)
Definition: ntvdm.h:50
#define FRAMEBUFFER_RANGE_INDEX
Definition: pc98vid.c:46
#define CONTROL_RANGE_INDEX
Definition: pc98vid.c:45
VPAPI VP_STATUS NTAPI VideoPortVerifyAccessRanges(_In_ PVOID HwDeviceExtension, _In_opt_ ULONG NumAccessRanges, _In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges)
Claims or releases a range of hardware resources and checks for conflicts.
Definition: resource.c:916
VPAPI VP_STATUS NTAPI VideoPortUnmapMemory(IN PVOID HwDeviceExtension, IN OUT PVOID VirtualAddress, IN HANDLE ProcessHandle)
LONG VP_STATUS
Definition: video.h:153
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
VPAPI VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:1081
PHYSICAL_ADDRESS FrameBuffer
Definition: pc98vid.h:52
ULONG FrameBufferLength
Definition: pc98vid.h:53
PHYSICAL_ADDRESS PegcControl
Definition: pc98vid.h:49
ULONG_PTR PegcControlVa
Definition: pc98vid.h:51
ULONG PegcControlLength
Definition: pc98vid.h:50
ULONG RangeLength
Definition: video.h:216
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215
static WCHAR AdapterString[]
Definition: vmx_svga.c:19
__wchar_t WCHAR
Definition: xmlstorage.h:180

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
196}
#define ERROR_NO_MORE_DEVICES
Definition: dderror.h:18
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MONITOR_HW_ID
Definition: pc98vid.h:29
@ Monitor
Definition: video.h:270
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139

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}
const VIDEOMODE VideoModes[]
Definition: pc98vid.c:15

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_SIZE
Definition: video.h:23
#define VRAM_NORMAL_PLANE_I
Definition: video.h:15
#define PEGC_CONTROL_SIZE
Definition: video.h:25
#define PEGC_FRAMEBUFFER_PACKED
Definition: video.h:22

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 GRAPH_HF_31KHZ
Definition: video.h:362
#define GDC2_CLOCK2_5MHZ
Definition: video.h:308
#define GDC2_CLOCK1_5MHZ
Definition: video.h:306
#define GDC2_MODE_LINES_800
Definition: video.h:302

Definition at line 15 of file pc98vid.c.

Referenced by Pc98VidInitialize().