From d6d462f2039416db48768b9dcec7c498f7dc5aa2 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 4 Apr 2010 00:00:21 +0000 Subject: [PATCH] [PCI] - Handle IRP_MN_QUERY_DEVICE_RELATIONS for TargetDeviceRelation for PCI's child PDOs svn path=/trunk/; revision=46706 --- reactos/drivers/bus/pci/pdo.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/bus/pci/pdo.c b/reactos/drivers/bus/pci/pdo.c index 27cd878b9c3..6fde92e8311 100644 --- a/reactos/drivers/bus/pci/pdo.c +++ b/reactos/drivers/bus/pci/pdo.c @@ -1290,6 +1290,33 @@ PdoWriteConfig( return STATUS_SUCCESS; } +static NTSTATUS +PdoQueryDeviceRelations( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + PIO_STACK_LOCATION IrpSp) +{ + PDEVICE_RELATIONS DeviceRelations; + + /* We only support TargetDeviceRelation for child PDOs */ + if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation) + return Irp->IoStatus.Status; + + /* We can do this because we only return 1 PDO for TargetDeviceRelation */ + DeviceRelations = ExAllocatePool(PagedPool, sizeof(*DeviceRelations)); + if (!DeviceRelations) + return STATUS_INSUFFICIENT_RESOURCES; + + DeviceRelations->Count = 1; + DeviceRelations->Objects[0] = DeviceObject; + + /* The PnP manager will remove this when it is done with the PDO */ + ObReferenceObject(DeviceObject); + + Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations; + + return STATUS_SUCCESS; +} static NTSTATUS PdoSetPower( @@ -1362,8 +1389,7 @@ PdoPnpControl( break; case IRP_MN_QUERY_DEVICE_RELATIONS: - /* FIXME: Possibly handle for RemovalRelations */ - DPRINT("Unimplemented IRP_MN_QUERY_DEVICE_RELATIONS received\n"); + Status = PdoQueryDeviceRelations(DeviceObject, Irp, IrpSp); break; case IRP_MN_QUERY_DEVICE_TEXT: