From 47f4f5c36a901f00c8cc2d9576f8cc000d4b3f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sat, 16 Sep 2006 20:53:27 +0000 Subject: [PATCH] Change detection method to see if a driver is a legacy one Fix last issues with PCI driver svn path=/trunk/; revision=24149 --- reactos/drivers/bus/pci/fdo.c | 16 +++++++++------- reactos/drivers/bus/pci/pci.c | 2 -- reactos/ntoskrnl/io/pnpmgr/pnpmgr.c | 9 ++++++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/reactos/drivers/bus/pci/fdo.c b/reactos/drivers/bus/pci/fdo.c index bf86f69ee3f..7f3d7420d9e 100644 --- a/reactos/drivers/bus/pci/fdo.c +++ b/reactos/drivers/bus/pci/fdo.c @@ -354,6 +354,7 @@ FdoStartDevice( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + static BOOLEAN FoundBuggyAllocatedResourcesList = FALSE; PFDO_DEVICE_EXTENSION DeviceExtension; PCM_RESOURCE_LIST AllocatedResources; PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; @@ -363,21 +364,22 @@ FdoStartDevice( DPRINT("Called\n"); DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - + AllocatedResources = IoGetCurrentIrpStackLocation(Irp)->Parameters.StartDevice.AllocatedResources; - if (!AllocatedResources) - { - DPRINT("No allocated resources sent to driver\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } /* HACK due to a bug in ACPI driver, which doesn't report the bus number */ - if (AllocatedResources->Count == 0) + if (!FoundBuggyAllocatedResourcesList || !AllocatedResources || AllocatedResources->Count == 0) { + FoundBuggyAllocatedResourcesList = TRUE; DPRINT1("No bus number resource found (bug in acpi.sys?), assuming bus number #0\n"); DeviceExtension->BusNumber = 0; goto next; } /* END HACK */ + if (!AllocatedResources) + { + DPRINT("No allocated resources sent to driver\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } if (AllocatedResources->Count < 1) { DPRINT("Not enough allocated resources sent to driver\n"); diff --git a/reactos/drivers/bus/pci/pci.c b/reactos/drivers/bus/pci/pci.c index f5590a086d4..9cd4b47fc76 100644 --- a/reactos/drivers/bus/pci/pci.c +++ b/reactos/drivers/bus/pci/pci.c @@ -135,8 +135,6 @@ PciAddDevice( NTSTATUS Status; DPRINT("Called\n"); - if (PhysicalDeviceObject == NULL) - return STATUS_SUCCESS; Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION), NULL, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_SECURE_OPEN, TRUE, &Fdo); diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index 6793ee67d57..00f3fcae53b 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -66,7 +66,7 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode, DPRINT("Calling driver AddDevice entrypoint at %08lx\n", DriverObject->DriverExtension->AddDevice); - IsPnpDriver = !IopDeviceNodeHasFlag(DeviceNode, DNF_LEGACY_DRIVER); + IsPnpDriver = (DeviceNode->PhysicalDeviceObject != NULL); Status = DriverObject->DriverExtension->AddDevice( DriverObject, IsPnpDriver ? DeviceNode->PhysicalDeviceObject : NULL); @@ -1215,6 +1215,13 @@ IopAssignDeviceResources(PDEVICE_NODE DeviceNode) ULONG i; NTSTATUS Status; + if (DeviceNode->BootResources) + { + /* FIXME: Not sure of this! */ + DeviceNode->ResourceList = DeviceNode->ResourceListTranslated = DeviceNode->BootResources; + return STATUS_SUCCESS; + } + /* Fill DeviceNode->ResourceList and DeviceNode->ResourceListTranslated; * by using DeviceNode->ResourceRequirements */