[PC98VID] Fix MSVC 2015 build for PC-98 target

Addendum to 3adf450867

Also isolate the constant structures into page section
and restore the previous sections for start IO and entrypoint routines.
This commit is contained in:
Dmitry Borisov 2021-05-13 02:17:27 +06:00 committed by Stanislav Motylkov
parent 0bd8a2110b
commit f7d825e620
3 changed files with 25 additions and 3 deletions

View file

@ -206,6 +206,7 @@ Pc98VidGetChildState(
return NO_ERROR;
}
CODE_SEG("PAGE")
BOOLEAN
NTAPI
Pc98VidStartIO(

View file

@ -11,6 +11,7 @@
/* GLOBALS ********************************************************************/
DATA_SEG("PAGECONS")
const VIDEOMODE VideoModes[] =
{
{640, 480, GRAPH_HF_31KHZ, GDC2_CLOCK1_5MHZ, GDC2_CLOCK2_5MHZ,
@ -18,7 +19,8 @@ const VIDEOMODE VideoModes[] =
{0, 80, 12, 2, 4, 4, 6, 480, 37}, {0, 80, 12, 2, 4, 132, 6, 480, 37}}
};
static VIDEO_ACCESS_RANGE LegacyRangeList[] =
DATA_SEG("PAGECONS")
const VIDEO_ACCESS_RANGE LegacyRangeList[] =
{
{ {{0x60, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x62, 0}}, 0x00000001, 1, 1, 1, 0 },
@ -72,7 +74,7 @@ Pc98VidFindAdapter(
Status = VideoPortVerifyAccessRanges(DeviceExtension,
RTL_NUMBER_OF(LegacyRangeList),
LegacyRangeList);
(PVIDEO_ACCESS_RANGE)LegacyRangeList);
if (Status != NO_ERROR)
{
VideoDebugPrint((Error, "%s() Resource conflict was found\n", __FUNCTION__));
@ -193,6 +195,15 @@ Pc98VidGetVideoChildDescriptor(
return ERROR_NO_MORE_DEVICES;
}
#if defined(_MSC_VER)
/*
* Avoid C2983 error for MSVC 2015. There is no such thing
* as DRIVER_INITIALIZE for video miniport drivers.
*/
#pragma alloc_text(INIT, DriverEntry)
#else
CODE_SEG("INIT")
#endif
ULONG
NTAPI
DriverEntry(
@ -227,7 +238,7 @@ DriverEntry(
InitData.HwGetVideoChildDescriptor = Pc98VidGetVideoChildDescriptor;
}
InitData.HwLegacyResourceList = LegacyRangeList;
InitData.HwLegacyResourceList = (PVIDEO_ACCESS_RANGE)LegacyRangeList;
InitData.HwLegacyResourceCount = RTL_NUMBER_OF(LegacyRangeList);
InitData.AdapterInterfaceType = Isa;

View file

@ -22,6 +22,10 @@
#define READ_PORT_UCHAR(p) VideoPortReadPortUchar(p)
#include <drivers/pc98/video.h>
#if defined(_MSC_VER)
#pragma section("PAGECONS", read)
#endif
#define MONITOR_HW_ID 0x1033FACE /* Dummy */
typedef struct _VIDEOMODE
@ -54,23 +58,27 @@ NTAPI
HasPegcController(
_In_ PHW_DEVICE_EXTENSION DeviceExtension);
CODE_SEG("PAGE")
BOOLEAN
NTAPI
Pc98VidStartIO(
_In_ PVOID HwDeviceExtension,
_Inout_ PVIDEO_REQUEST_PACKET RequestPacket);
CODE_SEG("PAGE")
VP_STATUS
FASTCALL
Pc98VidSetCurrentMode(
_In_ PHW_DEVICE_EXTENSION DeviceExtension,
_In_ PVIDEO_MODE RequestedMode);
CODE_SEG("PAGE")
VP_STATUS
FASTCALL
Pc98VidSetColorRegisters(
_In_ PVIDEO_CLUT ColorLookUpTable);
CODE_SEG("PAGE")
VP_STATUS
NTAPI
Pc98VidGetPowerState(
@ -78,6 +86,7 @@ Pc98VidGetPowerState(
_In_ ULONG HwId,
_In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl);
CODE_SEG("PAGE")
VP_STATUS
NTAPI
Pc98VidSetPowerState(
@ -85,6 +94,7 @@ Pc98VidSetPowerState(
_In_ ULONG HwId,
_In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl);
DATA_SEG("PAGECONS")
extern const VIDEOMODE VideoModes[];
#endif /* _PC98VID_PCH_ */