I am developing a driver for a PCI Express card.
There are 2 PCI Express slots suitable for the device on my board.
When the card is inserted to the first slot the driver works fine.
When the card is inserted to the 2nd slot the driver fails since its call to IoConnectInterrupt returns STATUS_INVALID_PARAMETER.
Ths OS is XPSP2. The machine is dual core. The interrupt parameters (as I parse them) are “Latched”, “Sahred” with affinity 3.
In device manager I can see that Windows creates a parent “PCI Express port” device (that uses pci.sys as a driver) and a child device for my card which uses my driver.
Both the Port and card devices have IRQ resources.
In the working slot the Port is assigned with IRQ 16 and the card with IRQ 17.
In the non working slot both are assigned with IRQ 19.
I assume that IRQs are assigned by BIOS. Is it?
Any hints regarding what the problem can be?
Is it invalid for parent and child devices to have the same IRQ?
Can it be a BIOS problem assigning the wrong IRQ?
You should be using the settings from AddDevice for IoConnectInterrupt.
Latched is typically for legacy devices, and cannot be shared, so that
parameter is wrong for a PCI device. The IRQ’s you are seeing are OS
assigned not directly from the BIOS.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
wrote in message news:xxxxx@ntdev…
>I am developing a driver for a PCI Express card.
> There are 2 PCI Express slots suitable for the device on my board.
> When the card is inserted to the first slot the driver works fine.
> When the card is inserted to the 2nd slot the driver fails since its call
> to IoConnectInterrupt returns STATUS_INVALID_PARAMETER.
> Ths OS is XPSP2. The machine is dual core. The interrupt parameters (as I
> parse them) are “Latched”, “Sahred” with affinity 3.
>
> In device manager I can see that Windows creates a parent “PCI Express
> port” device (that uses pci.sys as a driver) and a child device for my
> card which uses my driver.
> Both the Port and card devices have IRQ resources.
>
> In the working slot the Port is assigned with IRQ 16 and the card with
> IRQ 17.
> In the non working slot both are assigned with IRQ 19.
>
> I assume that IRQs are assigned by BIOS. Is it?
>
> Any hints regarding what the problem can be?
> Is it invalid for parent and child devices to have the same IRQ?
> Can it be a BIOS problem assigning the wrong IRQ?
>
>
I use for IoConnectInterrupt the parameters that I receive during IRP_MN_START_DEVICE in
Irp–>Parameters.StartDevice.AllocatedResourcesTranslated
What does it mean: “using the settings from AddDevice”?
Should I disregard the “latched” in the resource descriptor and force LevelSensitive?
Sorry it is early morning for me, you are right start device not add
device. Something is seriously wrong if you are seeing Latched and Shared.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
wrote in message news:xxxxx@ntdev…
I use for IoConnectInterrupt the parameters that I receive during
IRP_MN_START_DEVICE in
Irp->Parameters.StartDevice.AllocatedResourcesTranslated
What does it mean: “using the settings from AddDevice”?
Should I disregard the “latched” in the resource descriptor and force
LevelSensitive?
I found a bug in the parsing of the resources. It should be LevelSensitive and now it works.
Thanks.
One thing though is that from the documentation one could think that the Flags in CM_PARTIAL_RESOURCE_DESCRIPTOR is a bit field while in fact for the case of CmResourceTypeInterrupt it seems to actually be the value itself.
If someone is unaware that CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE is defined to be 0 he could test for:
If ( Flags & CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE ) …
And this code will give the wrong result.