I'm writing a driver for programming performance counters in PIV
processor. I've wrote bus driver which enumerates devices and allocates
resources and function driver which will do main job. I'm having a
problem with allocating resources for functional driver. Currently my
IRP_MN_QUERY_RESOURCES handling function looks like this:
static NTSTATUS HandleQueryResources(PDEVICE_OBJECT pdo, PIRP Irp)
{
NTSTATUS status = Irp->IoStatus.Status;
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
KdPrint((DRIVERNAME " (PDO) - HandleQueryRequirements\n"));
PCM_RESOURCE_LIST resourceList;
PCM_FULL_RESOURCE_DESCRIPTOR frd;
PCM_PARTIAL_RESOURCE_DESCRIPTOR prd;
ULONG resourceListSize;
//
// Following code shows how to provide
// boot I/O port resource to a device.
//
resourceListSize = sizeof(CM_RESOURCE_LIST);
resourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag (PagedPool,
resourceListSize, APICBUS_POOL_TAG);
if (resourceList == NULL )
{
KdPrint((DRIVERNAME " (PDO) - HandleQueryRequirements:
STATUS_INSUFFICIENT_RESOURCES\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlZeroMemory( resourceList, resourceListSize );
resourceList->Count = 1;
frd = &resourceList->List[0];
frd->PartialResourceList.Count = 1;
//
// Get pointer to first Partial Resource
// Descriptor in this FRD.
//
prd = &frd->PartialResourceList.PartialDescriptors[0];
prd->Type = CmResourceTypeInterrupt;
prd->ShareDisposition = CmResourceShareShared;
prd->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
prd->u.Interrupt.Level = 3;
prd->u.Interrupt.Vector = 64;
prd->u.Interrupt.Affinity = -1;
Irp->IoStatus.Information = (ULONG_PTR)resourceList;
KdPrint((DRIVERNAME " (PDO) - HandleQueryRequirements:
STATUS_SUCCESS\n"));
return STATUS_SUCCESS;
}
But IRP_MN_START device in my function driver doesn't get any
resources(either translated or raw). Can anybody explain me
haw handle this IRP correctly?
And please anybody explain to newbie meaning of Interrupt.Level,
Interrupt.Vector fields?
How should I implement IRP_MN_QUERY_RESOURCE_REQUIREMENTS handling function?
Best
Darek