Writing a PCI filter to read / write PCI configuration space

Hello All,

I read this threads
http://www.osronline.com/showthread.cfm?link=230053#top
But, there is no more further discussion in this threads…

I have the same problem on it.
I write a AP to send IOCTL to my PCI filter driver
After my PCI filter driver get this IOCTL, it will do

busInterface=(PBUS_INTERFACE_STANDARD)ExAllocatePool(NonPagedPool,
sizeof(BUS_INTERFACE_STANDARD));
if (busInterface==NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}

KeInitializeEvent(&event, NotificationEvent, FALSE);

irp=IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
pcido,
NULL,
0,
NULL,
&event,
&ioStatus);

if (irp==NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}

irpStack=IoGetNextIrpStackLocation(irp);
irpStack->MinorFunction=IRP_MN_QUERY_INTERFACE;
irpStack->Parameters.QueryInterface.InterfaceType=(LPGUID)&GUID_BUS_INTERFACE_ST
ANDARD;
irpStack->Parameters.QueryInterface.Size=sizeof(BUS_INTERFACE_STANDARD);
irpStack->Parameters.QueryInterface.Version=BUS_INTERFACE_STANDARD_VERSION;
irpStack->Parameters.QueryInterface.Interface=(PINTERFACE)busInterface;
irpStack->Parameters.QueryInterface.InterfaceSpecificData=NULL;

//initialize the status to error in case the bus driver does not
//set it correctly.
irp->IoStatus.Status=STATUS_NOT_SUPPORTED ;

ntStatus=IoCallDriver(pcido, irp);

if (ntStatus==STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);

ntStatus=ioStatus.Status;
}

I check the IRP Tracker.
I’m sure that the IRP be passed to pci bus.
But pci bus return NOT_SUPPORTED.

Is there any idea of it?

Are you sending this to a PCI bus driver FDO or one of its child PDOs? You
have to send it to a PDO that is a child of the bus driver.

Mark Roddy

On Tue, Dec 10, 2013 at 2:17 AM, wrote:

> Hello All,
>
> I read this threads
> http://www.osronline.com/showthread.cfm?link=230053#top
> But, there is no more further discussion in this threads…
>
> I have the same problem on it.
> I write a AP to send IOCTL to my PCI filter driver
> After my PCI filter driver get this IOCTL, it will do
>
> busInterface=(PBUS_INTERFACE_STANDARD)ExAllocatePool(NonPagedPool,
> sizeof(BUS_INTERFACE_STANDARD));
> if (busInterface==NULL)
> {
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> KeInitializeEvent(&event, NotificationEvent, FALSE);
>
> irp=IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
>
> pcido,
>
> NULL,
> 0,
>
> NULL,
>
> &event,
>
> &ioStatus);
>
> if (irp==NULL)
> {
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> irpStack=IoGetNextIrpStackLocation(irp);
> irpStack->MinorFunction=IRP_MN_QUERY_INTERFACE;
>
> irpStack->Parameters.QueryInterface.InterfaceType=(LPGUID)&GUID_BUS_INTERFACE_ST
> ANDARD;
>
> irpStack->Parameters.QueryInterface.Size=sizeof(BUS_INTERFACE_STANDARD);
>
> irpStack->Parameters.QueryInterface.Version=BUS_INTERFACE_STANDARD_VERSION;
>
> irpStack->Parameters.QueryInterface.Interface=(PINTERFACE)busInterface;
> irpStack->Parameters.QueryInterface.InterfaceSpecificData=NULL;
>
> //initialize the status to error in case the bus driver does not
> //set it correctly.
> irp->IoStatus.Status=STATUS_NOT_SUPPORTED ;
>
> ntStatus=IoCallDriver(pcido, irp);
>
> if (ntStatus==STATUS_PENDING)
> {
> KeWaitForSingleObject(&event, Executive, KernelMode,
> FALSE, NULL);
>
> ntStatus=ioStatus.Status;
> }
>
>
> I check the IRP Tracker.
> I’m sure that the IRP be passed to pci bus.
> But pci bus return NOT_SUPPORTED.
>
> Is there any idea of it?
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Well, I use both my pci bus filter device object and pci bus PDO

2013/12/10 Mark Roddy

> Are you sending this to a PCI bus driver FDO or one of its child PDOs? You
> have to send it to a PDO that is a child of the bus driver.
>
> Mark Roddy
>
>
> On Tue, Dec 10, 2013 at 2:17 AM, wrote:
>
>> Hello All,
>>
>> I read this threads
>> http://www.osronline.com/showthread.cfm?link=230053#top
>> But, there is no more further discussion in this threads…
>>
>> I have the same problem on it.
>> I write a AP to send IOCTL to my PCI filter driver
>> After my PCI filter driver get this IOCTL, it will do
>>
>> busInterface=(PBUS_INTERFACE_STANDARD)ExAllocatePool(NonPagedPool,
>> sizeof(BUS_INTERFACE_STANDARD));
>> if (busInterface==NULL)
>> {
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> KeInitializeEvent(&event, NotificationEvent, FALSE);
>>
>> irp=IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
>>
>> pcido,
>>
>> NULL,
>>
>> 0,
>>
>> NULL,
>>
>> &event,
>>
>> &ioStatus);
>>
>> if (irp==NULL)
>> {
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> irpStack=IoGetNextIrpStackLocation(irp);
>> irpStack->MinorFunction=IRP_MN_QUERY_INTERFACE;
>>
>> irpStack->Parameters.QueryInterface.InterfaceType=(LPGUID)&GUID_BUS_INTERFACE_ST
>> ANDARD;
>>
>> irpStack->Parameters.QueryInterface.Size=sizeof(BUS_INTERFACE_STANDARD);
>>
>> irpStack->Parameters.QueryInterface.Version=BUS_INTERFACE_STANDARD_VERSION;
>>
>> irpStack->Parameters.QueryInterface.Interface=(PINTERFACE)busInterface;
>> irpStack->Parameters.QueryInterface.InterfaceSpecificData=NULL;
>>
>> //initialize the status to error in case the bus driver does not
>> //set it correctly.
>> irp->IoStatus.Status=STATUS_NOT_SUPPORTED ;
>>
>> ntStatus=IoCallDriver(pcido, irp);
>>
>> if (ntStatus==STATUS_PENDING)
>> {
>> KeWaitForSingleObject(&event, Executive, KernelMode,
>> FALSE, NULL);
>>
>> ntStatus=ioStatus.Status;
>> }
>>
>>
>> I check the IRP Tracker.
>> I’m sure that the IRP be passed to pci bus.
>> But pci bus return NOT_SUPPORTED.
>>
>> Is there any idea of it?
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer