Interrupt resource sharing in WDF driver on WIndows 7

I am writing a PCI driver. My driver has both FDO and PDO funcitonality. I implemented EvtDeviceResourceQuery call back to report the interrupt resouce for it’s child driver. I called WdfCmResourceListInsertDescriptor method to do the same. The driver work fine (loads child driver) on Windows XP and Windows Vista. But, on Windows 7 this method fails and returns “STATUS_ACCESS_DENIED”. So, the child driver is not loaded.
Is there anything I need to do it differently for Windows 7 in this path?

What exactly is returning STATUS_ACCESS_DENIED? A kmdf DDI? If so, !wdfkd.wdflogdump (your driver name) should tell you why it was returned.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@yahoo.com
Sent: Tuesday, April 14, 2009 9:36 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Interrupt resource sharing in WDF driver on WIndows 7

I am writing a PCI driver. My driver has both FDO and PDO funcitonality. I implemented EvtDeviceResourceQuery call back to report the interrupt resouce for it’s child driver. I called WdfCmResourceListInsertDescriptor method to do the same. The driver work fine (loads child driver) on Windows XP and Windows Vista. But, on Windows 7 this method fails and returns “STATUS_ACCESS_DENIED”. So, the child driver is not loaded.
Is there anything I need to do it differently for Windows 7 in this path?


NTDEV is sponsored by OSR

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

Here is the log dump.

1: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
2: imp_WdfObjectGetTypedContextWorker - Attempting to get context type WqWdfCtx from WDFOBJECT 0x7B1F07E0
3: imp_WdfObjectGetTypedContextWorker - Attempting to get context type WqWdfCtx from WDFOBJECT 0x7B1F07E0
4: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
5: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
6: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
7: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
8: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
9: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
10: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
11: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
12: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
13: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
14: FxPkgPnp::Dispatch - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x84DC3818
15: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
16: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
17: FxInterrupt::AssignResources - Is MSI? 0, MSI-ID 0, AffinityPolicy WdfIrqPolicyOneCloseProcessor, Priority WdfIrqPriorityUndefined, Group 0, Affinity 0x3, Irql 0xa, Vector 0xb6
18: imp_WdfObjectGetTypedContextWorker - Attempting to get context type WqWdfCtx from WDFOBJECT 0x7AC0F1B0
19: FxPkgPnp::Dispatch - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type TargetDeviceRelation IRP 0x85439610
20: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
21: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleStarted from FxIdleStopped
22: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
23: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
24: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
25: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
26: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
27: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x79B03DC8
28: FxSelfManagedIoMachine::ProcessEvent - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering self managed io state FxSelfManagedIoInit from FxSelfManagedIoCreated
29: FxSelfManagedIoMachine::ProcessEvent - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering self managed io state FxSelfManagedIoStarted from FxSelfManagedIoInit
30: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleStartedPowerUp from FxIdleStarted
31: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleDisabled from FxIdleStartedPowerUp
32: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
33: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0 from WdfDevStatePowerDecideD0State
34: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarting
35: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStartingDecideS0Wake from WdfDevStatePwrPolStartingSucceeded
36: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStartingDecideS0Wake
37: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleDisabled from FxIdleDisabled
38: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
39: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
40: FxPkgPnp::Dispatch - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x84DC3818
41: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79971438 !devobj 0x8482A350 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
42: FxChildList::ProcessBusRelations - PDO created successfully, WDFDEVICE 79971438 !devobj 8482A350
43: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 79B03DC8 returning 1 devices in relations ACA583F8
44: FxPkgPdo::_PnpQueryId - WDFDEVICE 79971438 does not have a string for PnP query IdType BusQueryContainerID, 0xc00000bb(STATUS_NOT_SUPPORTED)
45: FxResourceCollection::AddAt - Adds not allowed on handle 7AF0D178, add at index -1failed

Please post your code where you are attempting to add the resource to the list

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Wednesday, April 15, 2009 10:13 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Interrupt resource sharing in WDF driver on WIndows 7

Here is the log dump.

1: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
2: imp_WdfObjectGetTypedContextWorker - Attempting to get context type WqWdfCtx from WDFOBJECT 0x7B1F07E0
3: imp_WdfObjectGetTypedContextWorker - Attempting to get context type WqWdfCtx from WDFOBJECT 0x7B1F07E0
4: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
5: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
6: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
7: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
8: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
9: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
10: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
11: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
12: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
13: imp_WdfRegistryQueryULong - WDFKEY 7AFC7B90, QueryULong, 0xc0000034(STATUS_OBJECT_NAME_NOT_FOUND)
14: FxPkgPnp::Dispatch - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x84DC3818
15: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
16: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
17: FxInterrupt::AssignResources - Is MSI? 0, MSI-ID 0, AffinityPolicy WdfIrqPolicyOneCloseProcessor, Priority WdfIrqPriorityUndefined, Group 0, Affinity 0x3, Irql 0xa, Vector 0xb6
18: imp_WdfObjectGetTypedContextWorker - Attempting to get context type WqWdfCtx from WDFOBJECT 0x7AC0F1B0
19: FxPkgPnp::Dispatch - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type TargetDeviceRelation IRP 0x85439610
20: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
21: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleStarted from FxIdleStopped
22: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
23: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
24: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
25: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
26: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
27: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x79B03DC8
28: FxSelfManagedIoMachine::ProcessEvent - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering self managed io state FxSelfManagedIoInit from FxSelfManagedIoCreated
29: FxSelfManagedIoMachine::ProcessEvent - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering self managed io state FxSelfManagedIoStarted from FxSelfManagedIoInit
30: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleStartedPowerUp from FxIdleStarted
31: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleDisabled from FxIdleStartedPowerUp
32: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
33: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering Power State WdfDevStatePowerD0 from WdfDevStatePowerDecideD0State
34: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarting
35: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStartingDecideS0Wake from WdfDevStatePwrPolStartingSucceeded
36: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power policy state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStartingDecideS0Wake
37: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering power idle state FxIdleDisabled from FxIdleDisabled
38: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
39: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
40: FxPkgPnp::Dispatch - WDFDEVICE 0x79B03DC8 !devobj 0x8505D7B8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x84DC3818
41: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x79971438 !devobj 0x8482A350 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
42: FxChildList::ProcessBusRelations - PDO created successfully, WDFDEVICE 79971438 !devobj 8482A350
43: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 79B03DC8 returning 1 devices in relations ACA583F8
44: FxPkgPdo::_PnpQueryId - WDFDEVICE 79971438 does not have a string for PnP query IdType BusQueryContainerID, 0xc00000bb(STATUS_NOT_SUPPORTED)
45: FxResourceCollection::AddAt - Adds not allowed on handle 7AF0D178, add at index -1failed


NTDEV is sponsored by OSR

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

CM_PARTIAL_RESOURCE_DESCRIPTOR intrRes;

EvtParentDevicePrepareHardware(
IN WDFCMRESLIST ResourcesRaw,
IN WDFCMRESLIST ResourcesTranslated
)
{
PCM_PARTIAL_RESOURCE_DESCRIPTOR resourceTrans;
NTSTATUS ntStatus = STATUS_SUCCESS:

RtlZeroMemory (&intrRes, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));

for(ULONG i=0;
i < WdfCmResourceListGetCount(ResourcesTranslated);
i++)
{
resourceTrans = WdfCmResourceListGetDescriptor(ResourcesTranslated,i);

if(!resourceTrans)
{
return STATUS_DEVICE_CONFIGURATION_ERROR ;
}

switch (resourceTrans->Type)
{

case CmResourceTypePort:
//not hanlded
break;

case CmResourceTypeMemory:
//map the memory
break;

case CmResourceTypeInterrupt:
RtlCopyMemory (&m_intrRes,resourceTrans, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
bResInterrupt = TRUE;
break;

default:
break;
} // end of switch

} // end of for

if (!bResInterrupt)
{
return STATUS_DEVICE_CONFIGURATION_ERROR;
}
return ntStatus ;
}

NTSTATUS
EvtChildDeviceResourcesQuery(
IN WDFCMRESLIST Resources
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;

// Insert the interrupt info
ntStatus = WdfCmResourceListInsertDescriptor(
Resources,
&intrRes
WDF_INSERT_AT_END
);

return ntStatus;
}

This isn’t going to work. Interrupts are not transferrable from one device
node to another.

The full story is long and you can find it in the archives if you search for
it.

The short story is that there isn’t enough information in the interrupt
parameters to fully connect an interrupt, and the parameters can’t be
changed without breaking lots of drivers. So the PnP manager caches all the
information necessary and gives your driver only the information that fits
in those old parameters. When you call IoConnectInterrupt, the PnP manager
looks up the full set based on the partial set you pass in and reconstructs
the missing parts. When you call IoConnectInterruptEx (in the
not-fully-specified mode, as WDF does) then it just uses your PDO to look up
your assignment.

In order to do what you’re trying to accomplish, you need one of two
strategies:

  1. Use MF.sys, if it can fit your situation.

  2. Have the parent connect the interrupt and re-dispatch interrupts when
    it’s triggered.


Jake Oshins
Hyper-V I/O Architect (former interrupt guy)
Windows Kernel Group

This post implies no warranties and confers no rights.


wrote in message news:xxxxx@ntdev…
> CM_PARTIAL_RESOURCE_DESCRIPTOR intrRes;
>
> EvtParentDevicePrepareHardware(
> IN WDFCMRESLIST ResourcesRaw,
> IN WDFCMRESLIST ResourcesTranslated
> )
> {
> PCM_PARTIAL_RESOURCE_DESCRIPTOR resourceTrans;
> NTSTATUS ntStatus = STATUS_SUCCESS:
>
> RtlZeroMemory (&intrRes, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
>
> for(ULONG i=0;
> i < WdfCmResourceListGetCount(ResourcesTranslated);
> i++)
> {
> resourceTrans =
> WdfCmResourceListGetDescriptor(ResourcesTranslated,i);
>
> if(!resourceTrans)
> {
> return STATUS_DEVICE_CONFIGURATION_ERROR ;
> }
>
> switch (resourceTrans->Type)
> {
>
> case CmResourceTypePort:
> //not hanlded
> break;
>
> case CmResourceTypeMemory:
> //map the memory
> break;
>
> case CmResourceTypeInterrupt:
> RtlCopyMemory (&m_intrRes,resourceTrans,
> sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
> bResInterrupt = TRUE;
> break;
>
> default:
> break;
> } // end of switch
>
> } // end of for
>
> if (!bResInterrupt)
> {
> return STATUS_DEVICE_CONFIGURATION_ERROR;
> }
> return ntStatus ;
> }
>
> NTSTATUS
> EvtChildDeviceResourcesQuery(
> IN WDFCMRESLIST Resources
> )
> {
> NTSTATUS ntStatus = STATUS_SUCCESS;
>
> // Insert the interrupt info
> ntStatus = WdfCmResourceListInsertDescriptor(
> Resources,
> &intrRes
> WDF_INSERT_AT_END
> );
>
> return ntStatus;
> }
>

The inability to modify the WDFCMRESLIST is a regression on win7. A bug has been filed to track the issue

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Thursday, April 16, 2009 8:43 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Interrupt resource sharing in WDF driver on WIndows 7

CM_PARTIAL_RESOURCE_DESCRIPTOR intrRes;

EvtParentDevicePrepareHardware(
IN WDFCMRESLIST ResourcesRaw,
IN WDFCMRESLIST ResourcesTranslated
)
{
PCM_PARTIAL_RESOURCE_DESCRIPTOR resourceTrans;
NTSTATUS ntStatus = STATUS_SUCCESS:

RtlZeroMemory (&intrRes, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));

for(ULONG i=0;
i < WdfCmResourceListGetCount(ResourcesTranslated);
i++)
{
resourceTrans = WdfCmResourceListGetDescriptor(ResourcesTranslated,i);

if(!resourceTrans)
{
return STATUS_DEVICE_CONFIGURATION_ERROR ;
}

switch (resourceTrans->Type)
{

case CmResourceTypePort:
//not hanlded
break;

case CmResourceTypeMemory:
//map the memory
break;

case CmResourceTypeInterrupt:
RtlCopyMemory (&m_intrRes,resourceTrans, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
bResInterrupt = TRUE;
break;

default:
break;
} // end of switch

} // end of for

if (!bResInterrupt)
{
return STATUS_DEVICE_CONFIGURATION_ERROR;
}
return ntStatus ;
}

NTSTATUS
EvtChildDeviceResourcesQuery(
IN WDFCMRESLIST Resources
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;

// Insert the interrupt info
ntStatus = WdfCmResourceListInsertDescriptor(
Resources,
&intrRes
WDF_INSERT_AT_END
);

return ntStatus;
}


NTDEV is sponsored by OSR

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

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This isn’t going to work. Interrupts are not transferrable from one device
node to another.

[CHANDRA] The same code works in Vista and XP.
My driver is functional driver and also a bus driver. The interrupt
resource I am reporting in “EvtChildDeviceResourcesQuery” is sharable. Even then, is bus driver
not allowed to report the interrupt resource for it’s child device through this callback?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
In order to do what you’re trying to accomplish, you need one of two
strategies:

  1. Use MF.sys, if it can fit your situation.
    [CHANDRA] It is not a multifuction PCI device.

  2. Have the parent connect the interrupt and re-dispatch interrupts when
    it’s triggered.
    [CHANDRA] In this case, child device’s interrupt callbacks
    will not be called. right?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

xxxxx@yahoo.com wrote:

This isn’t going to work. Interrupts are not transferrable from one device
node to another.

[CHANDRA] The same code works in Vista and XP.

That is an accident.

My driver is functional driver and also a bus driver. The interrupt
resource I am reporting in “EvtChildDeviceResourcesQuery” is sharable. Even then, is bus driver
not allowed to report the interrupt resource for it’s child device through this callback?

No. The interrupt is an attribute of the bus functional device, not
your child devices. You register with the PCI driver so you can get
callbacks, through the ISR. You just need to have your child device do
the same thing, through your own mechanism.

In order to do what you’re trying to accomplish, you need one of two
strategies:

  1. Use MF.sys, if it can fit your situation.
    [CHANDRA] It is not a multifuction PCI device.

That doesn’t matter. MF.SYS is a general-purpose driver that can be
used in many situations where a single device’s resources need to be
shared between multiple drivers.

  1. Have the parent connect the interrupt and re-dispatch interrupts when
    it’s triggered.
    [CHANDRA] In this case, child device’s interrupt callbacks
    will not be called. right?

Come on. You can think this through, can’t you? He’s saying the parent
device would have the interrupt callback, not the child device. The
child device would register with the parent, so the parent would call
the child’s handler, not the operating system.


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