The PnP Manager Redistributes System Resources

If a user adds a device to a system, and if the device requires system resources that the PnP manager has already assigned to another device, the PnP manager attempts to reassign resources.

During this process, the PnP manager stops devices and takes them out of their working (D0) states. It then delivers new resource lists to the devices so that they can restart, using the new resources.

When redistributing resources, the PnP manager will not alter a device's resource assignment if one of the device's drivers has:

Power-Down Sequence

For each function and filter driver that supports the device being stopped, the framework does the following, in sequence, one driver at a time, starting with the driver that is highest in the driver stack:

  1. If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoSuspend callback function.

  2. The framework stops all of the device's power-managed I/O queues.

  3. If the hardware and driver support DMA, the framework calls the driver's EvtDmaEnablerSelfManagedIoStop, EvtDmaEnablerFlush, and EvtDmaEnablerDisable callback functions for each DMA channel that was created.

  4. Calls the driver's EvtDeviceD0ExitPreInterruptsDisabled and EvtInterruptDisable callback functions (if they exist) so that the driver can disable device interrupts.

  5. The framework calls the driver's EvtDeviceD0Exit callback function (if it exists).

  6. The framework calls the driver's EvtDeviceReleaseHardware callback function (if it exists) passing the list of hardware resources that the PnP manager has assigned to the device.

The bus driver is the lowest driver in the stack and is called last. When the framework calls the bus driver's EvtDeviceD0Exit callback function, it passes a handle to the framework device object representing the device's PDO and a TargetState value of WdfPowerDeviceD3Final. The bus driver can control when the framework calls its EvtDeviceReleaseHardware callback function by calling WdfDeviceInitSetReleaseHardwareOrderOnFailure.

Power-Up Sequence

The first driver called is the bus driver. When the framework calls the bus driver's EvtDeviceD0Entry callback function, the callback function restores the device (a child device of the bus) to its working (D0) 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:

  1. The framework calls the driver's EvtDevicePrepareHardware callback function (if it exists), passing the list of hardware resources that the PnP manager has assigned to the device.

  2. The framework calls the driver's EvtDeviceD0Entry callback function (if it exists).

  3. The framework calls the driver's EvtInterruptEnable and EvtDeviceD0EntryPostInterruptsEnabled callback functions (if they exist) so that the driver can enable device interrupts.

  4. If the hardware and driver support DMA, the framework calls the driver's EvtDmaEnablerFill, EvtDmaEnablerEnable, and EvtDmaEnablerSelfManagedIoStart callback functions for each DMA channel that was created.

  5. The framework calls the driver's EvtChildListScanForChildren callback function (if it exists).

  6. The framework restarts all of the device's power-managed I/O queues.

  7. If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoRestart callback function.