[ACPI] Properly return a single alternative in Bus_PDO_QueryResourceRequirements. CORE-12892 CORE-14688

In ACPI resource descriptors, alternatives are marked with
StartDependent tags. Only the last set is terminated with EndDependent.
Therefore, since we only return the first alternative list for now,
ignore the first StartDependent tag and terminate enumeration at the second.

In the future we will need to build the full set of alternative lists here,
which will also make the unit test succeed fully.

This should fix random resource conflicts and make COM ports usable.
This commit is contained in:
Thomas Faber 2020-04-05 23:02:57 +02:00
parent 28be285da5
commit 152265729b
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -1310,6 +1310,7 @@ Bus_PDO_QueryResourceRequirements(
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
BOOLEAN CurrentRes = FALSE;
BOOLEAN SeenStartDependent;
PAGED_CODE ();
@ -1360,10 +1361,19 @@ Bus_PDO_QueryResourceRequirements(
return STATUS_UNSUCCESSFUL;
}
resource= Buffer.Pointer;
SeenStartDependent = FALSE;
resource = Buffer.Pointer;
/* Count number of resources */
while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG && resource->Type != ACPI_RESOURCE_TYPE_END_DEPENDENT)
{
if (resource->Type == ACPI_RESOURCE_TYPE_START_DEPENDENT)
{
if (SeenStartDependent)
{
break;
}
SeenStartDependent = TRUE;
}
switch (resource->Type)
{
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
@ -1433,9 +1443,18 @@ Bus_PDO_QueryResourceRequirements(
RequirementDescriptor = RequirementsList->List[0].Descriptors;
/* Fill resources list structure */
resource = Buffer.Pointer;
SeenStartDependent = FALSE;
resource = Buffer.Pointer;
while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG && resource->Type != ACPI_RESOURCE_TYPE_END_DEPENDENT)
{
if (resource->Type == ACPI_RESOURCE_TYPE_START_DEPENDENT)
{
if (SeenStartDependent)
{
break;
}
SeenStartDependent = TRUE;
}
switch (resource->Type)
{
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: