Help generating multiple MSI interrupts

Hello,

I’m looking for help in generating multiple MSI interrupts from our device to Windows. My driver is KMDF and the device is using PCI 2.2 MSI capability. It is configured to receive MSI interrupts and does not have any problem to receive MSI interrupt number 0 from our device. But I need to be able to signal more than one MSI.

I have read the microsoft MSI.doc white paper, and it indicates that to signal different messageId within via MSI, the device should modify the lowest X bits (X=0-4) of the data value in the message address provided by PnP Manager. Although the MSI.doc paper discusses this in terms of WDM driver and I am using KMDF framework with WdfInterruptCreate(), I think I have done this correctly otherwise I would not receive any interrupts whatsoever from the device.

When our device inserts any kind of MSI data value into the lower 4 bits of its allocated msi address, it never shows up in the MessageId parameter of my DeviceEvtInterruptIsr(WDFINTERRUPT WdfInterrupt, ULONG MessageId) function. The incoming MessageId is always 0.

During my EvtPrepareHardware() function, I examine the CM_PARTIAL_RESOURCE_DESCRIPTOR list for interrupt resources. There is only a single MSI Interrupt resource that arrives in the list (due to PCI 2.2 limitation?). The interrupt resource has CM_RESOURCE_INTERRUPT_MESSAGE flag set which seems correct, however the interruptDescTranslated->u.MessageInterrupt.Raw.MessageCount element always indicates 0. Shouldn’t this be at least 1 for my driver to even receive MSI interrupts at all?

Is this an indication that I have misconfigured my driver or device PCI-config space, and WDF has done automatic fallback to Legacy interrupt mapping somehow? How could I determine if this was the case?

Thanks,
PM

xxxxx@exacq.com wrote:

I’m looking for help in generating multiple MSI interrupts from our device to Windows. My driver is KMDF and the device is using PCI 2.2 MSI capability. It is configured to receive MSI interrupts and does not have any problem to receive MSI interrupt number 0 from our device. But I need to be able to signal more than one MSI.

Did you set MessageNumberLimit in the MessageSignaledInterruptProperties
key in the registry?
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544246.aspx

Has your device advertised multiple messages in its PCI configuration space?

During my EvtPrepareHardware() function, I examine the CM_PARTIAL_RESOURCE_DESCRIPTOR list for interrupt resources. There is only a single MSI Interrupt resource that arrives in the list (due to PCI 2.2 limitation?). The interrupt resource has CM_RESOURCE_INTERRUPT_MESSAGE flag set which seems correct, however the interruptDescTranslated->u.MessageInterrupt.Raw.MessageCount element always indicates 0. Shouldn’t this be at least 1 for my driver to even receive MSI interrupts at all?

Is there a chance you are running XP? XP doesn’t support MSI at all.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

The host system is win7. I have configured the driver INF file to support MSI as follows

[MSI_Interrupts]
HKR,Interrupt Management,0x00000010
HKR,Interrupt Management\MessageSignaledInterruptProperties,0x00000010
HKR,Interrupt Management\MessageSignaledInterruptProperties,MSISupported,0x00010001,1
HKR,Interrupt Management\MessageSignaledInterruptProperties,MessageNumberLimit,0x00010001,16

I downloaded a trial version of the PCIScope tool to more easily inspect my PCI config space registers, after my driver is loaded and the device is created. In PCIconfig location 0x52 (Message Control for MSI) is value 0x0089. For bit interpretation, it says that my MMC field (Multiple Message Capable) is 4, but my MMEN field (Multiple Message ENable) is 0 .