Change detection method to see if a driver is a legacy one

Fix last issues with PCI driver

svn path=/trunk/; revision=24149
This commit is contained in:
Hervé Poussineau 2006-09-16 20:53:27 +00:00
parent 78ef70deda
commit 47f4f5c36a
3 changed files with 17 additions and 10 deletions

View file

@ -354,6 +354,7 @@ FdoStartDevice(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
{ {
static BOOLEAN FoundBuggyAllocatedResourcesList = FALSE;
PFDO_DEVICE_EXTENSION DeviceExtension; PFDO_DEVICE_EXTENSION DeviceExtension;
PCM_RESOURCE_LIST AllocatedResources; PCM_RESOURCE_LIST AllocatedResources;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
@ -363,21 +364,22 @@ FdoStartDevice(
DPRINT("Called\n"); DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
AllocatedResources = IoGetCurrentIrpStackLocation(Irp)->Parameters.StartDevice.AllocatedResources; 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 */ /* 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"); DPRINT1("No bus number resource found (bug in acpi.sys?), assuming bus number #0\n");
DeviceExtension->BusNumber = 0; DeviceExtension->BusNumber = 0;
goto next; goto next;
} }
/* END HACK */ /* END HACK */
if (!AllocatedResources)
{
DPRINT("No allocated resources sent to driver\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
if (AllocatedResources->Count < 1) if (AllocatedResources->Count < 1)
{ {
DPRINT("Not enough allocated resources sent to driver\n"); DPRINT("Not enough allocated resources sent to driver\n");

View file

@ -135,8 +135,6 @@ PciAddDevice(
NTSTATUS Status; NTSTATUS Status;
DPRINT("Called\n"); DPRINT("Called\n");
if (PhysicalDeviceObject == NULL)
return STATUS_SUCCESS;
Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION), Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION),
NULL, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_SECURE_OPEN, TRUE, &Fdo); NULL, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_SECURE_OPEN, TRUE, &Fdo);

View file

@ -66,7 +66,7 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
DPRINT("Calling driver AddDevice entrypoint at %08lx\n", DPRINT("Calling driver AddDevice entrypoint at %08lx\n",
DriverObject->DriverExtension->AddDevice); DriverObject->DriverExtension->AddDevice);
IsPnpDriver = !IopDeviceNodeHasFlag(DeviceNode, DNF_LEGACY_DRIVER); IsPnpDriver = (DeviceNode->PhysicalDeviceObject != NULL);
Status = DriverObject->DriverExtension->AddDevice( Status = DriverObject->DriverExtension->AddDevice(
DriverObject, IsPnpDriver ? DeviceNode->PhysicalDeviceObject : NULL); DriverObject, IsPnpDriver ? DeviceNode->PhysicalDeviceObject : NULL);
@ -1215,6 +1215,13 @@ IopAssignDeviceResources(PDEVICE_NODE DeviceNode)
ULONG i; ULONG i;
NTSTATUS Status; 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; /* Fill DeviceNode->ResourceList and DeviceNode->ResourceListTranslated;
* by using DeviceNode->ResourceRequirements */ * by using DeviceNode->ResourceRequirements */