Coexistent Line based and MSI interrupt

I have a storport miniport driver which currently capable of handling line based interrupts. Now in order to support another PCI based device we need to support MSI based interrupts.
For PCI device to get MSI interrupts I need to mandatory have below entry in inf (https://msdn.microsoft.com/en-us/library/windows/hardware/ff544246(v=vs.85).aspx) -

[pci_msi_addreg]
HKR, Interrupt Management, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, MSISupported, 0x00010001, 1
HKR, Interrupt Management\MessageSignaledInterruptProperties, MessageNumberLimit, 0x00010001, 32

After above change, the device which was based on line based interrupts is not getting HwInitialize. After FindAdapter OS is asking to remove the device - PnP StorRemoveDevice.

Is there a way for a driver to support both Line based and MSI interrupts?
Or I am doing something wrong somewhere?

Do the devices have different DeviceId?

xxxxx@yahoo.co.in wrote:

I have a storport miniport driver which currently capable of handling line based interrupts. Now in order to support another PCI based device we need to support MSI based interrupts.
For PCI device to get MSI interrupts I need to mandatory have below entry in inf

[pci_msi_addreg]
HKR, Interrupt Management, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, MSISupported, 0x00010001, 1
HKR, Interrupt Management\MessageSignaledInterruptProperties, MessageNumberLimit, 0x00010001, 32

After above change, the device which was based on line based interrupts is not getting HwInitialize. After FindAdapter OS is asking to remove the device - PnP StorRemoveDevice.

You must only include those entries for the device that does MSI. If
they have different vendor and device IDs, then it’s easy. You just
need different sections in the INF – one that includes an AddReg for
pci_msi_address and one that does not.

If they have the same vendor and device IDs, then you are screwed.


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

Lucky they have different device/vendor Ids.
Let me restructure my INF to address both devices separately (new area for me :slight_smile: ).
Thanks a lot Tim and Alex. It is very useful direction for me.
Thanks again.

I tried to write a sample inf to achieve this, but ‘chkinf’ is giving me a warning -
"Line 44: (W22.1.2004) Service test already defined in section [test_Service_Inst_second]. "

With above warning in INF, I able to get both interrupts (INTx and MSI) for respective devices (tested on both devices separately, still need to test with both devices on the same system).

But is my approach is correct as ‘chkinf’ is giving warning?

To solve above warning if I change below line
{quote1}
[test_first.Services]
AddService = test, 0x00000002, test_Service_Inst_first
{\quote1}
to
{quote2}
[test_first.Services]
AddService = test1, 0x00000002, test_Service_Inst_first
{\quote2}

I get error by ‘chkinf’ -
"?Line 65: (E22.1.1009) Cannot use same binary test for multiple services - already used for service named $WinDir$\system32\drivers\test.sys. "

:(:frowning:

Here is the whole INF for reference, if required -
{quote}

;Copyright (c) Test 2015. All rights reserved.

[Version]
Signature = “$Windows NT$”
Provider = %test%
ClassGUID = {4D36E97B-E325-11CE-BFC1-08002BE10318}
Class = SCSIAdapter
DriverVer = 04/16/2015,1.0.0.0000
CatalogFile.ntamd64 = test.cat
PnpLockDown = 1

[SourceDisksNames]
1 = %test_Desc%

[SourceDisksFiles]
test.sys = 1

[DestinationDirs]
DefaultDestDir = 12

[ControlFlags]
ExcludeFromSelect = *

[Manufacturer]
%test% = TEST,ntamd64

[TEST.ntamd64]
;second
%test_Desc%=test_second, PCI\CC_010802
; first
%test_Desc%=test_first,PCI\VEN_8086&DEV_A106&subsys_06A71028

[test_second]
CopyFiles = DefaultDestDir

[test_first]
CopyFiles = DefaultDestDir

[DefaultDestDir]
test.sys,0x00002004

[test_first.Services]
AddService = test, 0x00000002, test_Service_Inst_first

[test_second.Services]
AddService = test, 0x00000002, test_Service_Inst_second

[test_second.HW]
AddReg = msi_addreg

[msi_addreg]
HKR, Interrupt Management, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, MSISupported, %REG_DWORD%, 1
HKR, Interrupt Management\MessageSignaledInterruptProperties, MessageNumberLimit, %REG_DWORD%, 64
HKR, Interrupt Management\Affinity Policy, 0x00000010
HKR, Interrupt Management\Affinity Policy, DevicePolicy, %REG_DWORD%, 3

[test_Service_Inst_first]
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_BOOT_START%
ErrorControl = %SERVICE_ERROR_SEVERE%
ServiceBinary = %12%\test.sys
AddReg = test_Inst_AddReg_first

[test_Service_Inst_second]
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_BOOT_START%
ErrorControl = %SERVICE_ERROR_SEVERE%
ServiceBinary = %12%\test.sys
LoadOrderGroup = SCSI miniport
AddReg = test_Inst_AddReg_second

[test_Inst_AddReg_first]
HKR, “Parameters\PnpInterface”, 5, 0x00010001, 0x00000001
HKR, “Parameters\Device”, “NumberOfRequests”, 0x00010001, 254
HKR, “Parameters”, “BusType”, 0x00010001, 0x00000008

[test_Inst_AddReg_second]
HKR, “Parameters\PnpInterface”, 5, %REG_DWORD%, 0x00000001
HKR, “Parameters”, “BusType”, %REG_DWORD%, 0x00000011

[Strings]
test = “TEST”
test_Desc = “testing INF”

REG_EXPAND_SZ = 0x00020000
REG_DWORD = 0x00010001
SERVICE_KERNEL_DRIVER = 1
SERVICE_BOOT_START = 0
SERVICE_ERROR_NORMAL = 1
SERVICE_ERROR_SEVERE = 2
{\quote}

Have a single Services section for the service. Different device IDs can refer to the same AddService section.

xxxxx@broadcom.com wrote:

Have a single Services section for the service. Different device IDs can refer to the same AddService section.

I don’t see how. The name of the service section is derived from the
name of the DDInstall section. If your device IDs map to Test1 and
Test2, then it’s going to look for [Test1.Services] and [Test2.Services].


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

xxxxx@yahoo.co.in wrote:

I tried to write a sample inf to achieve this, but ‘chkinf’ is giving me a warning -
"Line 44: (W22.1.2004) Service test already defined in section [test_Service_Inst_second]. "

With above warning in INF, I able to get both interrupts (INTx and MSI) for respective devices (tested on both devices separately, still need to test with both devices on the same system).

But is my approach is correct as ‘chkinf’ is giving warning?

This an ugly problem. I’m not sure I see any solution other than having
two identical copies of your driver with different names. It’s just a
situation that was not anticipated.

I suppose you could try the co-installer route, and have the
co-installer modify the registry based on the hardware ID.


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

Sorry, I misspoke. Of course, you need to have different Services sections, but they all can refer to the same AddService= section.

The poster need just have different registry in the HW key. The .HW sections for diferent devices should just refer to different AddReg sections.

Do you actually use the same binary for types BusTypeRAID and BusTypeNvme? You’ll need to use separate binaries, even though they are identical. There is actually an IHV that do that for a binary that supports either FC or iSCSI.

xxxxx@broadcom.com wrote:

The poster need just have different registry in the HW key. The .HW sections for diferent devices should just refer to different AddReg sections.

Yes, but you can’t do that unless you also have two different Services
sections. That’s the problem. You can’t have two different Services
sections use the same service name in their AddService directive, and
you can’t have two different service names that refer to the same binary.

I don’t think this can be solved with an INF by itself.


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

@Tim Roberts:

Different .Services section is not a problem. Different AddService= sections for the same binary is.

The poster needs different services for the same binary. It may or may not work in Windows. TCPIP and TCPIP6 services refer to the same tcpip.sys binary, though.

Thanks Tim and Alex.
I just need a different registry in HW key for different devices.

Do you actually use the same binary for types BusTypeRAID and BusTypeNvme?
Yes, that is what I am trying to.
You’ll need to use separate binaries, even though they are identical. There is actually an IHV that do that for a binary that supports either FC or iSCSI.
Is there any particular reason for the need to use different binaries for same functionality?

(IHV - Independent Hardware Vendor : am I correct?)

I tried to follow Alex suggestion and modified my inf. Here is the change I made -

{quote1}
[test_first.Services]
AddService = test, 0x00000002, test_Service_Inst

[test_second.Services]
AddService = test, 0x00000002, test_Service_Inst
{\quote1}

With above changes now I don’t see any warning/erros by chkinf.

I am yet to test it with both type of devices. Will update how it goes?

Thanks for your valuable suggestions.

Here is the modified INF.

{/quote}

;Copyright (c) Test 2015. All rights reserved.

[Version]
Signature = “$Windows NT$”
Provider = %test%
ClassGUID = {4D36E97B-E325-11CE-BFC1-08002BE10318}
Class = SCSIAdapter
DriverVer = 04/16/2015,1.0.0.0000
CatalogFile.ntamd64 = test.cat
PnpLockDown = 1

[SourceDisksNames]
1 = %test_Desc%

[SourceDisksFiles]
test.sys = 1

[DestinationDirs]
DefaultDestDir = 12

[ControlFlags]
ExcludeFromSelect = *

[Manufacturer]
%test% = TEST,ntamd64

[TEST.ntamd64]
;second
%test_Desc%=test_second, PCI\CC_010802
; first
%test_Desc%=test_first,PCI\VEN_8086&DEV_A106&subsys_06A71028

[test_second]
CopyFiles = DefaultDestDir

[test_first]
CopyFiles = DefaultDestDir

[DefaultDestDir]
test.sys,0x00002004

[test_first.Services]
AddService = test, 0x00000002, test_Service_Inst

[test_second.Services]
AddService = test, 0x00000002, test_Service_Inst

[test_second.HW]
AddReg = msi_addreg

[msi_addreg]
HKR, Interrupt Management, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, 0x00000010
HKR, Interrupt Management\MessageSignaledInterruptProperties, MSISupported, %REG_DWORD%, 1
HKR, Interrupt Management\MessageSignaledInterruptProperties, MessageNumberLimit, %REG_DWORD%, 64
HKR, Interrupt Management\Affinity Policy, 0x00000010
HKR, Interrupt Management\Affinity Policy, DevicePolicy, %REG_DWORD%, 3

[test_Service_Inst]
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_BOOT_START%
ErrorControl = %SERVICE_ERROR_SEVERE%
ServiceBinary = %12%\test.sys
LoadOrderGroup = SCSI miniport
AddReg = test_Inst_AddReg

[test_Inst_AddReg]
HKR, “Parameters\PnpInterface”, 5, %REG_DWORD%, 0x00000001
HKR, “Parameters\Device”, “NumberOfRequests”, 0x00010001, 254
HKR, “Parameters”, “BusType”, %REG_DWORD%, 0x00000011

[Strings]
test = “TEST”
test_Desc = “testing INF”

REG_EXPAND_SZ = 0x00020000
REG_DWORD = 0x00010001
SERVICE_KERNEL_DRIVER = 1
SERVICE_BOOT_START = 0
SERVICE_ERROR_NORMAL = 1
SERVICE_ERROR_SEVERE = 2

{/quote}

xxxxx@yahoo.co.in wrote:

I tried to follow Alex suggestion and modified my inf. Here is the change I made -

{quote1}
[test_first.Services]
AddService = test, 0x00000002, test_Service_Inst

[test_second.Services]
AddService = test, 0x00000002, test_Service_Inst
{\quote1}

With above changes now I don’t see any warning/erros by chkinf.

I’m sorry, I thought you said you had tried that already and got an
error from chkinf.


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

If you want to use different STORAGE_BUS_TYPE for different devices, you need to have separate services. To have separate services, you need to have separate binaries.

Thanks Tim and Alex.

@Tim - No worries … rather I might not have put it nice way.

@Alex - Let me use BusTypeRAID as STORAGE_BUS_TYPE and see how it goes.

Thanks a lot to you people for your valuable inputs.