https://git.reactos.org/?p=reactos.git;a=commitdiff;h=152265729bd4959eef9b0…
commit 152265729bd4959eef9b043642b19d985a98e94b
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sun Apr 5 23:02:57 2020 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Apr 11 23:43:05 2020 +0200
[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.
---
drivers/bus/acpi/buspdo.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/drivers/bus/acpi/buspdo.c b/drivers/bus/acpi/buspdo.c
index 48e599f6aa4..35c452bfc59 100644
--- a/drivers/bus/acpi/buspdo.c
+++ b/drivers/bus/acpi/buspdo.c
@@ -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: