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 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;
|
||||||
|
@ -365,19 +366,20 @@ FdoStartDevice(
|
||||||
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");
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue