Child Device Enumeration (KMDF PDOs Only)


KMDF supports both static and dynamic enumeration of child devices. It also includes additional PDO-specific features. This section briefly describes these features.

Static and Dynamic Enumeration in Bus Drivers

The framework invokes a bus driver's EvtDriverDeviceAdd callback after another driver has created a PDO for the bus. The bus driver creates an FDO for the device itself and then enumerates the child devices that are attached to the device and creates a PDO for each one. The driver can enumerate the child devices either statically or dynamically.

A KMDF driver supplies information about its children in a WDFCHILDLIST object, and the framework reports information from this object to the PnP manager in response to its requests for information.

If the driver calls WdfFdoInitSetDefaultChildListConfig, the framework creates an empty default WDFCHILDLIST object and sets the FDO as the parent of the WDFCHILDLIST. The child-list object maintains information about the child devices that a parent device enumerates.

Dynamic Enumeration

If the driver performs dynamic enumeration, it must at a minimum:

  • Call WdfFdoInitSetDefaultChildListConfig from EvtDriverDeviceAdd to configure the child list and register the EvtChildListXxx callbacks before it creates the FDO for the bus.

  • Enumerate the child devices after creating the FDO and use WdfChildListXxx methods to populate the child list.

    The driver can do this at any time after it has created the device object.

  • Implement EvtChildListCreateDevice, which creates the PDO for a child device. The framework passes a pointer to a WDFDEVICE_INIT structure when it invokes this callback.

    The callback fills in the structure and calls WdfDeviceCreate to create the child PDO.

  • Implement other EvtChildListXxx callbacks as required to support the device's children.

A driver that performs dynamic enumeration uses WdfChildListXxx methods to change its child list.

Static Enumeration

If the driver performs static enumeration, it is not required to implement any EvtChildListXxx callback functions. Instead, its EvtDriverDeviceAdd callback must:

  • Enumerate the child devices after the driver creates the FDO.

  • Call WdfPdoInitAllocate to obtain a pointer to a WDFDEVICE_INIT structure for each child PDO.

  • Initialize the WDFDEVICE_INIT structure appropriately for each child and create the child PDO by calling WdfDeviceCreate.

  • Update the default child list by calling WdfFdoAddStaticChild.

In general, drivers that perform static enumeration do not change their child lists. However, if changes are required, a driver uses WdfFdoXxx methods to change a static child list.

PDO-Specific Initialization

Certain callback functions apply only to device objects that represent PDOs. PDOs can support callbacks that respond to queries about device resources and resource requirements, requests to lock or eject the device, and requests to enable and disable the device wake signal. KMDF drivers register the callbacks during device object initialization by calling WdfPdoInitSetEventCallbacks. Table 6-5 lists the PDO-specific callbacks.

Table 6-5: PDO-Specific Callbacks
Open table as spreadsheet

KMDF callback

Description

EvtDeviceDisableWakeAtBus

Sets the bus so that one of its devices can no longer trigger a wake signal.

EvtDeviceEject

Handles device ejection.

EvtDeviceEnableWakeAtBus

Sets the bus so that one of its devices can trigger a wake signal.

EvtDeviceResourceRequirementsQuery

Reports the range of resources that satisfy device requirements.

EvtDeviceResourcesQuery

Reports resources assigned to the device at boot time.

EvtDeviceSetLock

Locks the device-for example, to prevent ejection.

Additional WdfPdoInitXxx methods enable the driver to specify device-specific data, such as device IDs.




Developing Drivers with the Microsoft Windows Driver Foundation
Developing Drivers with the Windows Driver Foundation (Pro Developer)
ISBN: 0735623740
EAN: 2147483647
Year: 2007
Pages: 224

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