* 10-09-2001 CSH Created
*/
-#include <ddk/ntddk.h>
-
-#include "pcidef.h"
#include "pci.h"
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <debug.h>
/*** PRIVATE *****************************************************************/
Status = FdoLocateChildDevice(&Device, DeviceExtension, SlotNumber, &PciConfig);
if (!NT_SUCCESS(Status))
{
- Device = (PPCI_DEVICE)ExAllocatePool(PagedPool, sizeof(PCI_DEVICE));
+ Device = (PPCI_DEVICE)ExAllocatePoolWithTag(NonPagedPool, sizeof(PCI_DEVICE),TAG_PCI);
if (!Device)
{
/* FIXME: Cleanup resources for already discovered devices */
IN PIRP Irp,
PIO_STACK_LOCATION IrpSp)
{
- PPDO_DEVICE_EXTENSION PdoDeviceExtension;
+ PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
PFDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_RELATIONS Relations;
PLIST_ENTRY CurrentEntry;
ULONG Size;
ULONG i;
+ UNREFERENCED_PARAMETER(IrpSp);
+
DPRINT("Called\n");
ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
break;
}
- Device->Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
-
Device->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
//Device->Pdo->Flags |= DO_POWER_PAGABLE;
DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
+
AllocatedResources = IoGetCurrentIrpStackLocation(Irp)->Parameters.StartDevice.AllocatedResources;
if (!AllocatedResources)
{
- DPRINT("PCI: No allocated resources sent to driver\n");
+ DPRINT("No allocated resources sent to driver\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
if (AllocatedResources->Count < 1)
{
- DPRINT("PCI: Not enough allocated resources sent to driver\n");
+ DPRINT("Not enough allocated resources sent to driver\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
if (AllocatedResources->List[0].PartialResourceList.Version != 1
ASSERT(DeviceExtension->State == dsStopped);
+ /* By default, use the bus number in the resource list header */
+ DeviceExtension->BusNumber = AllocatedResources->List[0].BusNumber;
+
for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++)
{
ResourceDescriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i];
{
if (FoundBusNumber || ResourceDescriptor->u.BusNumber.Length != 1)
return STATUS_INVALID_PARAMETER;
+ /* Use this one instead */
+ ASSERT(AllocatedResources->List[0].BusNumber == ResourceDescriptor->u.BusNumber.Start);
DeviceExtension->BusNumber = ResourceDescriptor->u.BusNumber.Start;
- DPRINT("PCI: Found bus number resource: %lu\n", DeviceExtension->BusNumber);
+ DPRINT("Found bus number resource: %lu\n", DeviceExtension->BusNumber);
FoundBusNumber = TRUE;
break;
}
default:
- DPRINT1("PCI: Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type);
+ DPRINT("Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type);
}
}
- if (!FoundBusNumber)
- {
- DPRINT("PCI: All required resources were not found in allocated resources list\n");
- return STATUS_INSUFFICIENT_RESOURCES;
- }
InitializeListHead(&DeviceExtension->DeviceListHead);
KeInitializeSpinLock(&DeviceExtension->DeviceListLock);
DeviceExtension->DeviceListCount = 0;
DeviceExtension->State = dsStarted;
+ ExInterlockedInsertTailList(
+ &DriverExtension->BusListHead,
+ &DeviceExtension->ListEntry,
+ &DriverExtension->BusListLock);
+
Irp->IoStatus.Information = 0;
return STATUS_SUCCESS;
PFDO_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
+ UNREFERENCED_PARAMETER(Irp);
+
DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
break;
#endif
default:
- DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction);
+ DPRINT1("Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
+ /* fall through */
+ case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
/*
* Do NOT complete the IRP as it will be processed by the lower
* device object, which will complete the IRP