Creating a Resource Requirements List
When a bus driver detects a child device, the driver is responsible for creating a resource requirements list for the device. Each item in the list is a logical configuration for the device.
After the driver reports the device during bus enumeration, the framework calls the driver's EvtDeviceResourceRequirementsQuery callback function. This callback function receives a handle to a resource-requirements-list object that represents an empty resource requirements list.
The driver must then do the following to add information to a resource requirements list:
Create an empty logical configuration.
For each logical configuration that the driver will specify, the driver must call WdfIoResourceListCreate to create an empty logical configuration.
Add resource descriptors to the logical configuration.
To add resource descriptors to a logical configuration, the driver must do the following, for each type of hardware resource that the device requires:
- Fill in a driver-allocated IO_RESOURCE_DESCRIPTOR structure, which specifies a range of valid values for a particular resource.
- Call WdfIoResourceListAppendDescriptor or WdfIoResourceListInsertDescriptor to add the contents of the IO_RESOURCE_DESCRIPTOR structure to a logical configuration.
If a device uses more than one instance of a resource type, all drivers in the stack that access the resource must be aware of the order in which resources are added. For example, if a device requires two ranges of I/O port addresses, all drivers that access the resource descriptors must be aware of the order in which the two ranges are added to the logical configuration.
Add the logical configuration to the resource requirements list.
When assigning resources to a device, the PnP manager attempts to match the requirements of the first logical configuration in the list. If the resources required for that configuration are not available, the PnP manager matches the next configuration in the list for which resources are available.
After the driver's EvtDeviceResourceRequirementsQuery callback function returns, the framework passes the resource requirements list to the PnP manager.