mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
Don't send multiple IRP_MJ_PNP/IRP_MN_START_DEVICE in case of a device with lower/upper filters
svn path=/trunk/; revision=15347
This commit is contained in:
parent
d0ea6a10df
commit
903edc501a
5 changed files with 59 additions and 31 deletions
|
@ -501,6 +501,10 @@ IopInitializeDevice(
|
||||||
PDEVICE_NODE DeviceNode,
|
PDEVICE_NODE DeviceNode,
|
||||||
PDRIVER_OBJECT DriverObject);
|
PDRIVER_OBJECT DriverObject);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
IopStartDevice(
|
||||||
|
PDEVICE_NODE DeviceNode);
|
||||||
|
|
||||||
/* driver.c */
|
/* driver.c */
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
|
|
|
@ -80,8 +80,6 @@ FASTCALL
|
||||||
IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||||
PDRIVER_OBJECT DriverObject)
|
PDRIVER_OBJECT DriverObject)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
|
||||||
IO_STACK_LOCATION Stack;
|
|
||||||
PDEVICE_OBJECT Fdo;
|
PDEVICE_OBJECT Fdo;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
@ -115,8 +113,37 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||||
|
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
|
IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
|
||||||
|
|
||||||
|
if (Fdo->DeviceType == FILE_DEVICE_ACPI)
|
||||||
|
{
|
||||||
|
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
|
||||||
|
|
||||||
|
/* There can be only one system power device */
|
||||||
|
if (!SystemPowerDeviceNodeCreated)
|
||||||
|
{
|
||||||
|
PopSystemPowerDeviceNode = DeviceNode;
|
||||||
|
SystemPowerDeviceNodeCreated = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(Fdo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
IopStartDevice(
|
||||||
|
PDEVICE_NODE DeviceNode)
|
||||||
|
{
|
||||||
|
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
IO_STACK_LOCATION Stack;
|
||||||
|
PDEVICE_OBJECT Fdo;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("Sending IRP_MN_START_DEVICE to driver\n");
|
DPRINT("Sending IRP_MN_START_DEVICE to driver\n");
|
||||||
|
|
||||||
|
Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
|
||||||
/* FIXME: Should be DeviceNode->ResourceList */
|
/* FIXME: Should be DeviceNode->ResourceList */
|
||||||
Stack.Parameters.StartDevice.AllocatedResources = DeviceNode->BootResources;
|
Stack.Parameters.StartDevice.AllocatedResources = DeviceNode->BootResources;
|
||||||
/* FIXME: Should be DeviceNode->ResourceListTranslated */
|
/* FIXME: Should be DeviceNode->ResourceListTranslated */
|
||||||
|
@ -131,39 +158,21 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IopInitiatePnpIrp() failed\n");
|
DPRINT("IopInitiatePnpIrp() failed\n");
|
||||||
ObDereferenceObject(Fdo);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (Fdo->DeviceType == FILE_DEVICE_ACPI)
|
|
||||||
{
|
{
|
||||||
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
|
|
||||||
|
|
||||||
/* There can be only one system power device */
|
|
||||||
if (!SystemPowerDeviceNodeCreated)
|
|
||||||
{
|
|
||||||
PopSystemPowerDeviceNode = DeviceNode;
|
|
||||||
SystemPowerDeviceNodeCreated = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Fdo->DeviceType == FILE_DEVICE_BUS_EXTENDER ||
|
if (Fdo->DeviceType == FILE_DEVICE_BUS_EXTENDER ||
|
||||||
Fdo->DeviceType == FILE_DEVICE_ACPI)
|
Fdo->DeviceType == FILE_DEVICE_ACPI)
|
||||||
{
|
{
|
||||||
DPRINT("Bus extender found\n");
|
DPRINT("Bus extender found\n");
|
||||||
|
|
||||||
Status = IopInvalidateDeviceRelations(DeviceNode, BusRelations);
|
Status = IopInvalidateDeviceRelations(DeviceNode, BusRelations);
|
||||||
if (!NT_SUCCESS(Status))
|
}
|
||||||
{
|
}
|
||||||
|
|
||||||
ObDereferenceObject(Fdo);
|
ObDereferenceObject(Fdo);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(Fdo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -1202,6 +1202,10 @@ IopInitializeBuiltinDriver(
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
Status = IopStartDevice(DeviceNode);
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1938,6 +1942,7 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
|
||||||
}
|
}
|
||||||
|
|
||||||
IopInitializeDevice(DeviceNode, DriverObject);
|
IopInitializeDevice(DeviceNode, DriverObject);
|
||||||
|
Status = IopStartDevice(DeviceNode);
|
||||||
|
|
||||||
ReleaseCapturedString:
|
ReleaseCapturedString:
|
||||||
RtlReleaseCapturedUnicodeString(&CapturedDriverServiceName,
|
RtlReleaseCapturedUnicodeString(&CapturedDriverServiceName,
|
||||||
|
|
|
@ -378,6 +378,14 @@ IoInit2(BOOLEAN BootLog)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = IopStartDevice(DeviceNode);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
IopFreeDeviceNode(DeviceNode);
|
||||||
|
CPRINT("IopInitializeDevice() failed with status (%x)\n", Status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize PnP root releations
|
* Initialize PnP root releations
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1523,9 +1523,11 @@ IopActionInitChildServices(
|
||||||
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
|
||||||
/* Attach upper level filter drivers. */
|
/* Attach upper level filter drivers. */
|
||||||
IopAttachFilterDrivers(DeviceNode, FALSE);
|
IopAttachFilterDrivers(DeviceNode, FALSE);
|
||||||
|
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
||||||
|
|
||||||
|
Status = IopStartDevice(DeviceNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue