Create child FDO with given resources

Hello!

I am trying to think how I could share the resources of my PCI card.
Is there a way for a bus driver to create a child FDO with some given resources? That way each child could get its resources from EvtPrepareHardware callback.
I have seen EvtDeviceResourceRequirementsQuery but I don?t see where the bus driver could give resources to its childs.

Thank you very much!

No, you can’t do this. The interfaces required to hand hw resources to children (called arbitration) are not documented (it is not simple enough to assign them to the child). The simplest path is to create a custom interface with IRP_MN_QUERY_INTERFACE (there are WDF wrappers to register the interface as well as to query) that hands the assigned resources to the child behind the scenes

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, March 18, 2015 11:19 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Create child FDO with given resources

Hello!

I am trying to think how I could share the resources of my PCI card.
Is there a way for a bus driver to create a child FDO with some given resources? That way each child could get its resources from EvtPrepareHardware callback.
I have seen EvtDeviceResourceRequirementsQuery but I don?t see where the bus driver could give resources to its childs.

Thank you very much!


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

multi function pci devices should expose separate functions as per the pci
spec, then they will behave as (more or less) independent devices in
windows and you don’t have to do anything with resource allocation.

otherwise see the documentation and discussions here on mf.sys, the
microsoft multifunction driver, and how to write an inf file that works
with mf to do resource allocation for a device that has separable resources.

otherwise if all the child functions are your own proprietary drivers then
you can use the bus driver to perform the hardware operations, by using
your own custom device interface based api for example, or by routing
requests from pdo’s to the bus fdo using the kmdf facility for doing that.

otherwise you need to write a resource arbiter which is a ton of work and
really should be avoided and really isn’t supported.

Mark Roddy

On Wed, Mar 18, 2015 at 2:19 PM, wrote:

> Hello!
>
> I am trying to think how I could share the resources of my PCI card.
> Is there a way for a bus driver to create a child FDO with some given
> resources? That way each child could get its resources from
> EvtPrepareHardware callback.
> I have seen EvtDeviceResourceRequirementsQuery but I don´t see where the
> bus driver could give resources to its childs.
>
> Thank you very much!
>
> —
> 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
>

This is an area which seems to confuse a lot of hardware engineers. I’ve sold a set of drivers quite a number of times in the last couple of years because the hardware types lay things out with one BAR with separate areas for each device, and one interrupt for the whole device. I know a number of the people who bought it were told by the FPGA vendor, that this was “Windows compliant, no special drivers needed”, in fact I have a contact at the moment that the final customer still believes this and is watching the product slip schedule because upper management wants to find a Windows consultant that will make the broken design work with existing drivers.

I really think the documentation by Microsoft could be reworked to make it clearer. Or perhaps we need an NT Insider article that describes all the nuances.

Don Burn
Windows Driver Consulting
Website: http://www.windrvr.com

Messy. Clearly, somebody is not reading the PCI specification the same way we are. I’ve seen quite a few “old school” ISA-type devices (for embedded systems, for example) that had NT V4 style drivers that “worked” this way.

Ugh.

In modern-day systems I see two separate issues:

a) The memory resources that need to be distributed

b) The interrupt resources that needs to be shared

Item A, above, is a mess.

There is quite obviously native support in Windows for item B, above. This is, after all, how things like GPIO controller drivers pass interrupts to GPIO client drivers. Someday perhaps this facility will be made available to the masses.

Now THAT would have made for an interesting bullet-point on a WinHEC slide,

Peter
OSR
@OSRDrivers