https://git.reactos.org/?p=reactos.git;a=commitdiff;h=951dc66c6695cceebaeda1...
commit 951dc66c6695cceebaeda16b874847d43e263cda Author: Hervé Poussineau hpoussin@reactos.org AuthorDate: Thu Oct 7 21:40:13 2021 +0200 Commit: Hervé Poussineau hpoussin@reactos.org CommitDate: Thu Oct 14 23:39:30 2021 +0200
[VGAMP] Correctly check and report legacy resources (VGA I/O ports and memory)
As we are a non PNP driver, the call chain will be DriverEntry -> VidePortInitialize -> VideoPortFindAdapter -> HwFindAdapter.
If legacy resources are available, we will fail VGAFindAdapter, so DriverEntry will fail, so vgamp.sys driver won't be used.
CORE-17789 --- win32ss/drivers/miniport/vga/vgamp.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/win32ss/drivers/miniport/vga/vgamp.c b/win32ss/drivers/miniport/vga/vgamp.c index f4cd3a26c41..4b892cc281e 100644 --- a/win32ss/drivers/miniport/vga/vgamp.c +++ b/win32ss/drivers/miniport/vga/vgamp.c @@ -10,6 +10,13 @@ #include <dderror.h> #include <devioctl.h>
+VIDEO_ACCESS_RANGE VGAAccessRange[] = +{ + { {{0x3b0}}, 0x3bb - 0x3b0 + 1, 1, 0, 0 }, + { {{0x3c0}}, 0x3df - 0x3c0 + 1, 1, 0, 0 }, + { {{0xa0000}}, 0x20000, 0, 0, 0 }, +}; + // ------------------------------------------------------- Public Interface
// DriverEntry @@ -45,6 +52,8 @@ DriverEntry(IN PVOID Context1, /* InitData.HwInterrupt = VGAInterrupt; */ InitData.HwResetHw = VGAResetHw; /* InitData.HwTimer = VGATimer; */ + InitData.HwLegacyResourceList = VGAAccessRange; + InitData.HwLegacyResourceCount = ARRAYSIZE(VGAAccessRange);
return VideoPortInitialize(Context1, Context2, &InitData, NULL); } @@ -82,12 +91,21 @@ VGAFindAdapter(PVOID DeviceExtension, PVIDEO_PORT_CONFIG_INFO ConfigInfo, PUCHAR Again) { - /* FIXME: Determine if the adapter is present */ - *Again = FALSE; + VP_STATUS Status; + + /* FIXME: Determine if the adapter is present */ + *Again = FALSE; + + if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO)) + return ERROR_INVALID_PARAMETER; + + Status = VideoPortVerifyAccessRanges(DeviceExtension, ARRAYSIZE(VGAAccessRange), VGAAccessRange); + if (Status != NO_ERROR) + return Status;
- ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0xa000; - ConfigInfo->VdmPhysicalVideoMemoryLength = 0x2000; - return NO_ERROR; + ConfigInfo->VdmPhysicalVideoMemoryAddress = VGAAccessRange[2].RangeStart; + ConfigInfo->VdmPhysicalVideoMemoryLength = VGAAccessRange[2].RangeLength; + return NO_ERROR;
/* FIXME: Claim any necessary memory/IO resources for the adapter */ /* FIXME: Map resources into system memory for the adapter */