mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Support for IRP_MN_QUERY_BUS_INFORMATION and devices on multiple PCI buses.
svn path=/trunk/; revision=8662
This commit is contained in:
parent
7b9bc747c8
commit
5c45ab6ac0
3 changed files with 112 additions and 68 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fdo.c,v 1.5 2003/12/12 21:54:42 ekohl Exp $
|
||||
/* $Id: fdo.c,v 1.6 2004/03/12 19:40:05 navaraf Exp $
|
||||
*
|
||||
* PROJECT: ReactOS PCI bus driver
|
||||
* FILE: fdo.c
|
||||
|
@ -13,7 +13,7 @@
|
|||
#include "pcidef.h"
|
||||
#include "pci.h"
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/*** PRIVATE *****************************************************************/
|
||||
|
@ -61,6 +61,7 @@ FdoEnumerateDevices(
|
|||
PLIST_ENTRY CurrentEntry;
|
||||
PPCI_DEVICE Device;
|
||||
PCI_SLOT_NUMBER SlotNumber;
|
||||
ULONG BusNumber;
|
||||
ULONG DeviceNumber;
|
||||
ULONG FunctionNumber;
|
||||
ULONG Size;
|
||||
|
@ -82,6 +83,8 @@ FdoEnumerateDevices(
|
|||
DeviceExtension->DeviceListCount = 0;
|
||||
|
||||
/* Enumerate devices on the PCI bus */
|
||||
for (BusNumber = 0; BusNumber < 8; BusNumber++)
|
||||
{
|
||||
SlotNumber.u.AsULONG = 0;
|
||||
for (DeviceNumber = 0; DeviceNumber < PCI_MAX_DEVICES; DeviceNumber++)
|
||||
{
|
||||
|
@ -91,7 +94,7 @@ FdoEnumerateDevices(
|
|||
SlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
||||
|
||||
Size= HalGetBusData(PCIConfiguration,
|
||||
DeviceExtension->BusNumber,
|
||||
BusNumber,
|
||||
SlotNumber.u.AsULONG,
|
||||
&PciConfig,
|
||||
sizeof(PCI_COMMON_CONFIG));
|
||||
|
@ -109,7 +112,7 @@ FdoEnumerateDevices(
|
|||
}
|
||||
|
||||
DPRINT("Bus %1lu Device %2lu Func %1lu VenID 0x%04hx DevID 0x%04hx\n",
|
||||
DeviceExtension->BusNumber,
|
||||
BusNumber,
|
||||
DeviceNumber,
|
||||
FunctionNumber,
|
||||
PciConfig.VendorID,
|
||||
|
@ -128,6 +131,8 @@ FdoEnumerateDevices(
|
|||
RtlZeroMemory (Device,
|
||||
sizeof(PCI_DEVICE));
|
||||
|
||||
Device->BusNumber = BusNumber;
|
||||
|
||||
RtlCopyMemory (&Device->SlotNumber,
|
||||
&SlotNumber,
|
||||
sizeof(PCI_SLOT_NUMBER));
|
||||
|
@ -148,6 +153,7 @@ FdoEnumerateDevices(
|
|||
DeviceExtension->DeviceListCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("Done\n");
|
||||
|
||||
|
@ -239,6 +245,10 @@ FdoQueryBusRelations(
|
|||
|
||||
PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0;
|
||||
|
||||
PdoDeviceExtension->Fdo = DeviceObject;
|
||||
|
||||
PdoDeviceExtension->BusNumber = Device->BusNumber;
|
||||
|
||||
/* FIXME: Get device properties (Hardware IDs, etc.) */
|
||||
|
||||
swprintf(
|
||||
|
@ -310,10 +320,6 @@ FdoStartDevice(
|
|||
InitializeListHead(&DeviceExtension->DeviceListHead);
|
||||
KeInitializeSpinLock(&DeviceExtension->DeviceListLock);
|
||||
DeviceExtension->DeviceListCount = 0;
|
||||
|
||||
/* FIXME: Find a way to get this information */
|
||||
DeviceExtension->BusNumber = 0;
|
||||
|
||||
DeviceExtension->State = dsStarted;
|
||||
|
||||
//Irp->IoStatus.Information = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pci.h,v 1.4 2003/12/12 21:54:42 ekohl Exp $ */
|
||||
/* $Id: pci.h,v 1.5 2004/03/12 19:40:05 navaraf Exp $ */
|
||||
|
||||
#ifndef __PCI_H
|
||||
#define __PCI_H
|
||||
|
@ -17,7 +17,9 @@ typedef struct _PCI_DEVICE
|
|||
LIST_ENTRY ListEntry;
|
||||
// Physical Device Object of device
|
||||
PDEVICE_OBJECT Pdo;
|
||||
/* PCI Slot number */
|
||||
// PCI bus number
|
||||
ULONG BusNumber;
|
||||
// PCI slot number
|
||||
PCI_SLOT_NUMBER SlotNumber;
|
||||
// PCI configuration data
|
||||
PCI_COMMON_CONFIG PciConfig;
|
||||
|
@ -52,6 +54,10 @@ typedef struct _PDO_DEVICE_EXTENSION
|
|||
{
|
||||
// Common device data
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
// Functional device object
|
||||
PDEVICE_OBJECT Fdo;
|
||||
// PCI bus number
|
||||
ULONG BusNumber;
|
||||
// Device ID
|
||||
UNICODE_STRING DeviceID;
|
||||
// Instance ID
|
||||
|
@ -71,8 +77,6 @@ typedef struct _FDO_DEVICE_EXTENSION
|
|||
{
|
||||
// Common device data
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
// Physical Device Object
|
||||
PDEVICE_OBJECT Pdo;
|
||||
// Current state of the driver
|
||||
PCI_DEVICE_STATE State;
|
||||
// Namespace device list
|
||||
|
@ -82,7 +86,7 @@ typedef struct _FDO_DEVICE_EXTENSION
|
|||
// Lock for namespace device list
|
||||
KSPIN_LOCK DeviceListLock;
|
||||
// PCI bus number
|
||||
ULONG BusNumber;
|
||||
/* ULONG BusNumber;*/
|
||||
// Lower device object
|
||||
PDEVICE_OBJECT Ldo;
|
||||
} __attribute((packed)) FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pdo.c,v 1.2 2003/12/12 21:54:42 ekohl Exp $
|
||||
/* $Id: pdo.c,v 1.3 2004/03/12 19:40:05 navaraf Exp $
|
||||
*
|
||||
* PROJECT: ReactOS PCI bus driver
|
||||
* FILE: pdo.c
|
||||
|
@ -16,6 +16,8 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
DEFINE_GUID(GUID_BUS_TYPE_PCI, 0xc8ebdfb0L, 0xb510, 0x11d0, 0x80, 0xe5, 0x00, 0xa0, 0xc9, 0x25, 0x42, 0xe3);
|
||||
|
||||
/*** PRIVATE *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
|
@ -75,6 +77,35 @@ PdoQueryId(
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
PdoQueryBusInformation(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
|
||||
PPNP_BUS_INFORMATION BusInformation;
|
||||
|
||||
DPRINT("Called\n");
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceExtension->Fdo->DeviceExtension;
|
||||
BusInformation = ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
|
||||
Irp->IoStatus.Information = (ULONG_PTR)BusInformation;
|
||||
if (BusInformation != NULL)
|
||||
{
|
||||
BusInformation->BusTypeGuid = GUID_BUS_TYPE_PCI;
|
||||
BusInformation->LegacyBusType = PCIBus;
|
||||
BusInformation->BusNumber = DeviceExtension->BusNumber;
|
||||
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
PdoSetPower(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -139,10 +170,13 @@ PdoPnpControl(
|
|||
|
||||
case IRP_MN_EJECT:
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IRP_MN_QUERY_BUS_INFORMATION:
|
||||
Status = PdoQueryBusInformation(DeviceObject, Irp, IrpSp);
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case IRP_MN_QUERY_CAPABILITIES:
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue