- Fixed handling of IRP_MN_QUERY_BUS_INFORMATION.

- Add basic handling of IRP_MN_QUERY_CAPABILITIES for getting device specific bus address.

svn path=/trunk/; revision=8717
This commit is contained in:
Filip Navara 2004-03-14 17:10:43 +00:00
parent c72fe4771e
commit c5058d5a3c
3 changed files with 37 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* $Id: fdo.c,v 1.6 2004/03/12 19:40:05 navaraf Exp $ /* $Id: fdo.c,v 1.7 2004/03/14 17:10:43 navaraf Exp $
* *
* PROJECT: ReactOS PCI bus driver * PROJECT: ReactOS PCI bus driver
* FILE: fdo.c * FILE: fdo.c
@ -13,7 +13,7 @@
#include "pcidef.h" #include "pcidef.h"
#include "pci.h" #include "pci.h"
//#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/*** PRIVATE *****************************************************************/ /*** PRIVATE *****************************************************************/
@ -249,6 +249,11 @@ FdoQueryBusRelations(
PdoDeviceExtension->BusNumber = Device->BusNumber; PdoDeviceExtension->BusNumber = Device->BusNumber;
RtlCopyMemory(
&PdoDeviceExtension->SlotNumber,
&Device->SlotNumber,
sizeof(PCI_SLOT_NUMBER));
/* FIXME: Get device properties (Hardware IDs, etc.) */ /* FIXME: Get device properties (Hardware IDs, etc.) */
swprintf( swprintf(

View file

@ -1,4 +1,4 @@
/* $Id: pci.h,v 1.5 2004/03/12 19:40:05 navaraf Exp $ */ /* $Id: pci.h,v 1.6 2004/03/14 17:10:43 navaraf Exp $ */
#ifndef __PCI_H #ifndef __PCI_H
#define __PCI_H #define __PCI_H
@ -58,6 +58,8 @@ typedef struct _PDO_DEVICE_EXTENSION
PDEVICE_OBJECT Fdo; PDEVICE_OBJECT Fdo;
// PCI bus number // PCI bus number
ULONG BusNumber; ULONG BusNumber;
// PCI slot number
PCI_SLOT_NUMBER SlotNumber;
// Device ID // Device ID
UNICODE_STRING DeviceID; UNICODE_STRING DeviceID;
// Instance ID // Instance ID
@ -85,8 +87,6 @@ typedef struct _FDO_DEVICE_EXTENSION
ULONG DeviceListCount; ULONG DeviceListCount;
// Lock for namespace device list // Lock for namespace device list
KSPIN_LOCK DeviceListLock; KSPIN_LOCK DeviceListLock;
// PCI bus number
/* ULONG BusNumber;*/
// Lower device object // Lower device object
PDEVICE_OBJECT Ldo; PDEVICE_OBJECT Ldo;
} __attribute((packed)) FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION; } __attribute((packed)) FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;

View file

@ -1,4 +1,4 @@
/* $Id: pdo.c,v 1.3 2004/03/12 19:40:05 navaraf Exp $ /* $Id: pdo.c,v 1.4 2004/03/14 17:10:43 navaraf Exp $
* *
* PROJECT: ReactOS PCI bus driver * PROJECT: ReactOS PCI bus driver
* FILE: pdo.c * FILE: pdo.c
@ -99,9 +99,30 @@ PdoQueryBusInformation(
BusInformation->LegacyBusType = PCIBus; BusInformation->LegacyBusType = PCIBus;
BusInformation->BusNumber = DeviceExtension->BusNumber; BusInformation->BusNumber = DeviceExtension->BusNumber;
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_SUCCESS;
} }
return STATUS_INSUFFICIENT_RESOURCES;
}
NTSTATUS
PdoQueryCapabilities(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
PIO_STACK_LOCATION IrpSp)
{
PPDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_CAPABILITIES DeviceCapabilities;
DPRINT("Called\n");
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
DeviceCapabilities = IrpSp->Parameters.DeviceCapabilities.Capabilities;
DeviceCapabilities->Address =
DeviceCapabilities->UINumber = DeviceExtension->SlotNumber.u.AsULONG;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -176,10 +197,11 @@ PdoPnpControl(
Status = PdoQueryBusInformation(DeviceObject, Irp, IrpSp); Status = PdoQueryBusInformation(DeviceObject, Irp, IrpSp);
break; break;
#if 0
case IRP_MN_QUERY_CAPABILITIES: case IRP_MN_QUERY_CAPABILITIES:
Status = PdoQueryCapabilities(DeviceObject, Irp, IrpSp);
break; break;
#if 0
case IRP_MN_QUERY_DEVICE_RELATIONS: case IRP_MN_QUERY_DEVICE_RELATIONS:
/* FIXME: Possibly handle for RemovalRelations */ /* FIXME: Possibly handle for RemovalRelations */
break; break;
@ -187,9 +209,11 @@ PdoPnpControl(
case IRP_MN_QUERY_DEVICE_TEXT: case IRP_MN_QUERY_DEVICE_TEXT:
break; break;
#endif #endif
case IRP_MN_QUERY_ID: case IRP_MN_QUERY_ID:
Status = PdoQueryId(DeviceObject, Irp, IrpSp); Status = PdoQueryId(DeviceObject, Irp, IrpSp);
break; break;
#if 0 #if 0
case IRP_MN_QUERY_PNP_DEVICE_STATE: case IRP_MN_QUERY_PNP_DEVICE_STATE:
break; break;