[VIDEOPRT]

- Don't try to incorrectly and unnecessarily parse multiple resource descriptors
CORE-10146

svn path=/trunk/; revision=69573
This commit is contained in:
Thomas Faber 2015-10-17 19:31:46 +00:00
parent 6be0925245
commit e0f1e0177b
2 changed files with 77 additions and 83 deletions

View file

@ -588,31 +588,28 @@ IntVideoPortPnPStartDevice(
ResourceListSize); ResourceListSize);
/* Get the interrupt level/vector - needed by HwFindAdapter sometimes */ /* Get the interrupt level/vector - needed by HwFindAdapter sometimes */
for (FullList = AllocatedResources->List; FullList = AllocatedResources->List;
FullList < AllocatedResources->List + AllocatedResources->Count; ASSERT(AllocatedResources->Count == 1);
FullList++) INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
{ FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
/* FIXME: Is this ASSERT ok for resources from the PNP manager? */ /* FIXME: Is this ASSERT ok for resources from the PNP manager? */
ASSERT(FullList->InterfaceType == PCIBus); ASSERT(FullList->InterfaceType == PCIBus);
ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber); ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
ASSERT(1 == FullList->PartialResourceList.Version); ASSERT(1 == FullList->PartialResourceList.Version);
ASSERT(1 == FullList->PartialResourceList.Revision); ASSERT(1 == FullList->PartialResourceList.Revision);
for (Descriptor = FullList->PartialResourceList.PartialDescriptors; for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count; Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
Descriptor++) Descriptor++)
{
if (Descriptor->Type == CmResourceTypeInterrupt)
{ {
if (Descriptor->Type == CmResourceTypeInterrupt) DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
{ DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level; if (Descriptor->ShareDisposition == CmResourceShareShared)
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector; DeviceExtension->InterruptShared = TRUE;
if (Descriptor->ShareDisposition == CmResourceShareShared) else
DeviceExtension->InterruptShared = TRUE; DeviceExtension->InterruptShared = FALSE;
else
DeviceExtension->InterruptShared = FALSE;
}
} }
} }
} }

View file

@ -744,71 +744,68 @@ VideoPortGetAccessRanges(
/* Return the slot number if the caller wants it */ /* Return the slot number if the caller wants it */
if (Slot != NULL) *Slot = DeviceExtension->SystemIoBusNumber; if (Slot != NULL) *Slot = DeviceExtension->SystemIoBusNumber;
for (FullList = AllocatedResources->List; FullList = AllocatedResources->List;
FullList < AllocatedResources->List + AllocatedResources->Count; ASSERT(AllocatedResources->Count == 1);
FullList++) INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
ASSERT(FullList->InterfaceType == PCIBus);
ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
ASSERT(1 == FullList->PartialResourceList.Version);
ASSERT(1 == FullList->PartialResourceList.Revision);
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
Descriptor++)
{ {
INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n", if ((Descriptor->Type == CmResourceTypeMemory ||
FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision); Descriptor->Type == CmResourceTypePort) &&
AssignedCount >= NumAccessRanges)
ASSERT(FullList->InterfaceType == PCIBus);
ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
ASSERT(1 == FullList->PartialResourceList.Version);
ASSERT(1 == FullList->PartialResourceList.Revision);
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
Descriptor++)
{ {
if ((Descriptor->Type == CmResourceTypeMemory || ERR_(VIDEOPRT, "Too many access ranges found\n");
Descriptor->Type == CmResourceTypePort) && return ERROR_NOT_ENOUGH_MEMORY;
AssignedCount >= NumAccessRanges) }
{ if (Descriptor->Type == CmResourceTypeMemory)
ERR_(VIDEOPRT, "Too many access ranges found\n"); {
return ERROR_NOT_ENOUGH_MEMORY; INFO_(VIDEOPRT, "Memory range starting at 0x%08x length 0x%08x\n",
} Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length);
if (Descriptor->Type == CmResourceTypeMemory) AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start;
{ AccessRanges[AssignedCount].RangeLength = Descriptor->u.Memory.Length;
INFO_(VIDEOPRT, "Memory range starting at 0x%08x length 0x%08x\n", AccessRanges[AssignedCount].RangeInIoSpace = 0;
Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length); AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start; AccessRanges[AssignedCount].RangeShareable =
AccessRanges[AssignedCount].RangeLength = Descriptor->u.Memory.Length; (Descriptor->ShareDisposition == CmResourceShareShared);
AccessRanges[AssignedCount].RangeInIoSpace = 0; AccessRanges[AssignedCount].RangePassive = 0;
AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */ AssignedCount++;
AccessRanges[AssignedCount].RangeShareable = }
(Descriptor->ShareDisposition == CmResourceShareShared); else if (Descriptor->Type == CmResourceTypePort)
AccessRanges[AssignedCount].RangePassive = 0; {
AssignedCount++; INFO_(VIDEOPRT, "Port range starting at 0x%04x length %d\n",
} Descriptor->u.Port.Start.u.LowPart, Descriptor->u.Port.Length);
else if (Descriptor->Type == CmResourceTypePort) AccessRanges[AssignedCount].RangeStart = Descriptor->u.Port.Start;
{ AccessRanges[AssignedCount].RangeLength = Descriptor->u.Port.Length;
INFO_(VIDEOPRT, "Port range starting at 0x%04x length %d\n", AccessRanges[AssignedCount].RangeInIoSpace = 1;
Descriptor->u.Port.Start.u.LowPart, Descriptor->u.Port.Length); AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
AccessRanges[AssignedCount].RangeStart = Descriptor->u.Port.Start; AccessRanges[AssignedCount].RangeShareable =
AccessRanges[AssignedCount].RangeLength = Descriptor->u.Port.Length; (Descriptor->ShareDisposition == CmResourceShareShared);
AccessRanges[AssignedCount].RangeInIoSpace = 1; AccessRanges[AssignedCount].RangePassive = 0;
AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */ if (Descriptor->Flags & CM_RESOURCE_PORT_10_BIT_DECODE)
AccessRanges[AssignedCount].RangeShareable = AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_10_BIT_DECODE;
(Descriptor->ShareDisposition == CmResourceShareShared); if (Descriptor->Flags & CM_RESOURCE_PORT_PASSIVE_DECODE)
AccessRanges[AssignedCount].RangePassive = 0; AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_PASSIVE_DECODE;
if (Descriptor->Flags & CM_RESOURCE_PORT_10_BIT_DECODE) AssignedCount++;
AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_10_BIT_DECODE; }
if (Descriptor->Flags & CM_RESOURCE_PORT_PASSIVE_DECODE) else if (Descriptor->Type == CmResourceTypeInterrupt)
AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_PASSIVE_DECODE; {
AssignedCount++; DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
} DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
else if (Descriptor->Type == CmResourceTypeInterrupt) if (Descriptor->ShareDisposition == CmResourceShareShared)
{ DeviceExtension->InterruptShared = TRUE;
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level; else
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector; DeviceExtension->InterruptShared = FALSE;
if (Descriptor->ShareDisposition == CmResourceShareShared)
DeviceExtension->InterruptShared = TRUE;
else
DeviceExtension->InterruptShared = FALSE;
}
} }
} }
return NO_ERROR; return NO_ERROR;
} }
/* /*