A User Plugs in a Device
In the following scenario, the device node includes a KMDF bus driver and one or more KMDF function or filter drivers that support a PnP device.
When a user plugs the device into the bus while the system is running, the device's bus driver and the framework perform the following tasks:
The bus driver for the device detects the device and calls WdfChildListAddOrUpdateChildDescriptionAsPresent. (This process is known as "dynamic enumeration.")
For more information about the power-up sequence for a KMDF bus driver, see Power-Up Sequence for a Bus Driver.
Next, the PnP manager determines which additional drivers (function drivers and filter drivers) the device requires. If these drivers are not already loaded, the PnP manager loads them and calls their DriverEntry routines. For each function or filter driver, the following actions occur:
The framework calls each additional driver's EvtDriverDeviceAdd callback function so that the driver can call WdfDeviceCreate to create a framework device object that represents the device for the driver. Function drivers create a functional device object (FDO), and filter drivers create a filter device object (Filter DO).
The framework calls each function and filter driver's EvtDeviceFilterRemoveResourceRequirements callback function and then each driver's EvtDeviceFilterAddResourceRequirements callback function. Immediately before the device is started, the framework calls the EvtDeviceRemoveAddedResources callback function. These three callback functions allow the filter and function drivers to modify the list of hardware resources that the device requires, before the PnP manager assigns resources to the device. For more information, see Hardware Resources for Framework-Based Drivers
The framework ensures that the device has reached its working (D0) power state.
- For each function and filter driver that supports the device, the framework does the following, in sequence, one driver at a time, starting with the driver that is lowest in the driver stack:
- The framework calls the driver's EvtDevicePrepareHardware callback function (if it exists) and passes the list of hardware resources that the PnP manager has assigned to the device.
- The framework calls the driver's EvtDeviceD0Entry callback function (if it exists).
- The framework calls the driver's EvtInterruptEnable callback function (if it exists) for each interrupt, and then it calls the driver's EvtDeviceD0EntryPostInterruptsEnabled callback function (if it exists), so that the driver can enable device interrupts.
- If the hardware and driver support DMA, the framework calls the driver's EvtDmaEnablerFill, EvtDmaEnablerEnable, and EvtDmaEnablerSelfManagedIoStart callback functions (if they exist) for each DMA channel that was created.
- The framework calls the driver's EvtChildListScanForChildren callback function (if it exists).
- The framework starts all of the device's power-managed I/O queues.
- If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoInit callback function.
For more information about the power-up sequence for KMDF function or filter drivers, Power-Up Sequence for a Function or Filter Driver.