mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
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:
parent
78ef70deda
commit
47f4f5c36a
3 changed files with 17 additions and 10 deletions
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Reference in a new issue