Handling Child Device Resources

Handling Child Device Resources

If your device is a controller type, the child devices that plug in to it presumably claim their own I/O resources. If you have an automated way to discover the devices resource requirements, you can return a list of them in response to an IRP_MN_QUERY_RESOURCE_REQUIREMENTS request. If there is no automated way to discover the resource requirements, the child device s INF file should have a LogConfig section to establish them.

If you re dealing with a multifunction device, chances are that the parent device claims all the I/O resources that the child functions use. If the child functions have separate WDM drivers, you have to devise a way to separate the resources by function and let each function driver know which ones belong to it. This task is not simple. The PnP Manager normally tells a function driver about its resource assignments in an IRP_MN_START_DEVICE request. (See the detailed discussion in Chapter 7.) There s no normal way for you to force the PnP Manager to use some of your resources instead of the ones it assigns, though. Note that responding to a requirements query or a filter request doesn t help because those requests deal with requirements that the PnP Manager will then go on to satisfy using new resources.

Microsoft s MF.SYS driver deals with resource subdivision by using some internal interfaces with the system s resource arbitrators that aren t accessible to us as third-party developers. There are two different ways of subdividing resources: one that works in Windows XP and another one that works in Windows 98/Me. Since we can t do what MF.SYS does, we need to find some other way to suballocate resources owned by the parent device.

If you can control all of the child device function drivers, your parent driver can export a direct-call interface. In this case, child drivers obtain a pointer to the interface descriptor by sending an IRP_MN_QUERY_INTERFACE request to the parent driver. They call functions in the parent driver at start device and stop device time to obtain and release resources that the parent actually owns.

If you can t modify the function drivers for your child devices, you can solve the resource subdivision problem by installing a tiny upper filter see Chapter 16 above each of the child device s FDOs. The only purpose of the filter is to plug a list of assigned resources in to each IRP_MN_START_DEVICE. The filter can communicate via a direct-call interface with the parent driver. MULFUNC actually works this way, and you can study it to learn more about the mechanics.



Programming the Microsoft Windows Driver Model
Programming the Microsoft Windows Driver Model
ISBN: 0735618038
EAN: 2147483647
Year: 2003
Pages: 119
Authors: Walter Oney

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net