mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 13:34:53 +00:00
- Fixes VideoPortGetAccessRanges.
- Previous implementation was missing the Device number when searching the bus resulting in failure to find Device and Vendor ID. - Function was also passing NULL for first 4 parameters of HalAssignSlotResources causing failure. - Due to this, the device object was then deleted causing failure when trying to find the display device in Csrss:CsrpInitVideo(). - Part 3 of ? fixes for bug 2286. svn path=/trunk/; revision=38394
This commit is contained in:
parent
943a74b328
commit
ca9d98020a
|
@ -401,6 +401,7 @@ VideoPortGetAccessRanges(
|
|||
IN PULONG Slot)
|
||||
{
|
||||
PCI_SLOT_NUMBER PciSlotNumber;
|
||||
ULONG DeviceNumber;
|
||||
ULONG FunctionNumber;
|
||||
PCI_COMMON_CONFIG Config;
|
||||
PCM_RESOURCE_LIST AllocatedResources;
|
||||
|
@ -413,6 +414,7 @@ VideoPortGetAccessRanges(
|
|||
USHORT DeviceIdToFind;
|
||||
ULONG SlotIdToFind;
|
||||
ULONG ReturnedLength;
|
||||
BOOLEAN DeviceAndVendorFound = FALSE;
|
||||
|
||||
TRACE_(VIDEOPRT, "VideoPortGetAccessRanges\n");
|
||||
|
||||
|
@ -453,36 +455,40 @@ VideoPortGetAccessRanges(
|
|||
/*
|
||||
* Search for the device id and vendor id on this bus.
|
||||
*/
|
||||
|
||||
for (FunctionNumber = 0; FunctionNumber < 8; FunctionNumber++)
|
||||
for (DeviceNumber = 0; DeviceNumber < PCI_MAX_DEVICES; DeviceNumber++)
|
||||
{
|
||||
INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
|
||||
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
||||
ReturnedLength = HalGetBusData(
|
||||
PCIConfiguration,
|
||||
DeviceExtension->SystemIoBusNumber,
|
||||
PciSlotNumber.u.AsULONG,
|
||||
&Config,
|
||||
sizeof(PCI_COMMON_CONFIG));
|
||||
INFO_(VIDEOPRT, "- Length of data: %x\n", ReturnedLength);
|
||||
if (ReturnedLength == sizeof(PCI_COMMON_CONFIG))
|
||||
PciSlotNumber.u.bits.DeviceNumber = DeviceNumber;
|
||||
for (FunctionNumber = 0; FunctionNumber < 8; FunctionNumber++)
|
||||
{
|
||||
INFO_(VIDEOPRT, "- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
|
||||
"DeviceId 0x%04x\n",
|
||||
PciSlotNumber.u.AsULONG,
|
||||
PciSlotNumber.u.bits.DeviceNumber,
|
||||
PciSlotNumber.u.bits.FunctionNumber,
|
||||
Config.VendorID,
|
||||
Config.DeviceID);
|
||||
|
||||
if ((VendorIdToFind == 0 || Config.VendorID == VendorIdToFind) &&
|
||||
(DeviceIdToFind == 0 || Config.DeviceID == DeviceIdToFind))
|
||||
INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
|
||||
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
||||
ReturnedLength = HalGetBusData(
|
||||
PCIConfiguration,
|
||||
DeviceExtension->SystemIoBusNumber,
|
||||
PciSlotNumber.u.AsULONG,
|
||||
&Config,
|
||||
sizeof(PCI_COMMON_CONFIG));
|
||||
INFO_(VIDEOPRT, "- Length of data: %x\n", ReturnedLength);
|
||||
if (ReturnedLength == sizeof(PCI_COMMON_CONFIG))
|
||||
{
|
||||
break;
|
||||
INFO_(VIDEOPRT, "- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
|
||||
"DeviceId 0x%04x\n",
|
||||
PciSlotNumber.u.AsULONG,
|
||||
PciSlotNumber.u.bits.DeviceNumber,
|
||||
PciSlotNumber.u.bits.FunctionNumber,
|
||||
Config.VendorID,
|
||||
Config.DeviceID);
|
||||
|
||||
if ((VendorIdToFind == 0 || Config.VendorID == VendorIdToFind) &&
|
||||
(DeviceIdToFind == 0 || Config.DeviceID == DeviceIdToFind))
|
||||
{
|
||||
DeviceAndVendorFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DeviceAndVendorFound) break;
|
||||
}
|
||||
|
||||
if (FunctionNumber == 8)
|
||||
{
|
||||
WARN_(VIDEOPRT, "Didn't find device.\n");
|
||||
|
@ -491,7 +497,10 @@ VideoPortGetAccessRanges(
|
|||
}
|
||||
|
||||
Status = HalAssignSlotResources(
|
||||
NULL, NULL, NULL, NULL,
|
||||
&DeviceExtension->RegistryPath,
|
||||
NULL,
|
||||
DeviceExtension->DriverObject,
|
||||
DeviceExtension->DriverObject->DeviceObject,
|
||||
DeviceExtension->AdapterInterfaceType,
|
||||
DeviceExtension->SystemIoBusNumber,
|
||||
PciSlotNumber.u.AsULONG,
|
||||
|
@ -499,13 +508,13 @@ VideoPortGetAccessRanges(
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
WARN_(VIDEOPRT, "HalAssignSlotResources failed with status %x.\n",Status);
|
||||
return Status;
|
||||
}
|
||||
DeviceExtension->AllocatedResources = AllocatedResources;
|
||||
}
|
||||
if (AllocatedResources == NULL)
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
AssignedCount = 0;
|
||||
for (FullList = AllocatedResources->List;
|
||||
FullList < AllocatedResources->List + AllocatedResources->Count;
|
||||
|
@ -515,7 +524,7 @@ VideoPortGetAccessRanges(
|
|||
FullList->BusNumber == DeviceExtension->SystemIoBusNumber &&
|
||||
1 == FullList->PartialResourceList.Version &&
|
||||
1 == FullList->PartialResourceList.Revision);
|
||||
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
||||
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
||||
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
|
||||
Descriptor++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue