From e306e52267ebcf56c7a25d264edc7d6e0bd6bd03 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 24 Aug 2011 17:05:58 +0000 Subject: [PATCH] [HAL] - Handle IRP_MN_QUERY_CAPABILITIES for the ACPI_HAL device object [PNPMGR] - Don't bring up a device if a required IRP has failed - Don't perform operations on a child if it is not ready yet svn path=/trunk/; revision=53421 --- reactos/hal/halx86/generic/acpi/halpnpdd.c | 9 +++++- reactos/ntoskrnl/io/pnpmgr/pnpmgr.c | 35 ++++++++++++++++++---- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/reactos/hal/halx86/generic/acpi/halpnpdd.c b/reactos/hal/halx86/generic/acpi/halpnpdd.c index 1d6b86095e2..cb04ded83c5 100644 --- a/reactos/hal/halx86/generic/acpi/halpnpdd.c +++ b/reactos/hal/halx86/generic/acpi/halpnpdd.c @@ -667,9 +667,16 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject, (PVOID)&Irp->IoStatus.Information); break; + case IRP_MN_QUERY_CAPABILITIES: + + /* Call the worker */ + DPRINT("Querying the capabilities for the FDO\n"); + Status = HalpQueryCapabilities(DeviceObject, + IoStackLocation->Parameters.DeviceCapabilities.Capabilities); + break; + default: - /* Pass it to the PDO */ DPRINT("Other IRP: %lx\n", Minor); Status = Irp->IoStatus.Status; break; diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index 5157c822347..c973a70cd51 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -320,7 +320,7 @@ IopStartDevice2(IN PDEVICE_OBJECT DeviceObject) Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities); if (!NT_SUCCESS(Status)) { - DPRINT("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); + DPRINT1("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); } /* Invalidate device state so IRP_MN_QUERY_PNP_DEVICE_STATE is sent */ @@ -762,6 +762,7 @@ IopCreateDeviceNode(PDEVICE_NODE ParentNode, } IopDeviceNodeSetFlag(Node, DNF_LEGACY_DRIVER); + IopDeviceNodeSetFlag(Node, DNF_PROCESSED); IopDeviceNodeSetFlag(Node, DNF_ADDED); IopDeviceNodeSetFlag(Node, DNF_STARTED); } @@ -1523,7 +1524,7 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, Status = ZwQueryDefaultLocale(FALSE, &LocaleId); if (!NT_SUCCESS(Status)) { - DPRINT("ZwQueryDefaultLocale() failed with status 0x%lx\n", Status); + DPRINT1("ZwQueryDefaultLocale() failed with status 0x%lx\n", Status); return Status; } @@ -1551,7 +1552,10 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, } else { - DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); + DPRINT1("IopInitiatePnpIrp() failed (Status %x)\n", Status); + + /* We have to return success otherwise we abort the traverse operation */ + return STATUS_SUCCESS; } DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after enumeration)\n"); @@ -1559,7 +1563,10 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities); if (!NT_SUCCESS(Status)) { - DPRINT("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); + DPRINT1("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); + + /* We have to return success otherwise we abort the traverse operation */ + return STATUS_SUCCESS; } /* This bit is only check after enumeration */ @@ -1579,7 +1586,10 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, Status = IopGetParentIdPrefix(DeviceNode, &ParentIdPrefix); if (!NT_SUCCESS(Status)) { - DPRINT("IopGetParentIdPrefix() failed (Status 0x%08lx)\n", Status); + DPRINT1("IopGetParentIdPrefix() failed (Status 0x%08lx)\n", Status); + + /* We have to return success otherwise we abort the traverse operation */ + return STATUS_SUCCESS; } } @@ -1630,6 +1640,9 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, if (!NT_SUCCESS(Status)) { DPRINT1("Failed to create the instance key! (Status %lx)\n", Status); + + /* We have to return success otherwise we abort the traverse operation */ + return STATUS_SUCCESS; } IopQueryHardwareIds(DeviceNode, InstanceKey); @@ -2030,6 +2043,12 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode, return STATUS_SUCCESS; } + if (!(DeviceNode->Flags & DNF_PROCESSED)) + { + DPRINT1("Child not ready to be configured\n"); + return STATUS_SUCCESS; + } + if (!(DeviceNode->Flags & (DNF_DISABLED | DNF_STARTED | DNF_ADDED))) { WCHAR RegKeyBuffer[MAX_PATH]; @@ -2157,6 +2176,12 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode, return STATUS_SUCCESS; } + if (!(DeviceNode->Flags & DNF_PROCESSED)) + { + DPRINT1("Child not ready to be added\n"); + return STATUS_SUCCESS; + } + if (IopDeviceNodeHasFlag(DeviceNode, DNF_STARTED) || IopDeviceNodeHasFlag(DeviceNode, DNF_ADDED) || IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED))