Rediger

Del via


IRP_MN_FILTER_RESOURCE_REQUIREMENTS

The PnP manager sends this IRP to a device stack so the function driver can adjust the resources required by the device, if appropriate.

The function driver typically handles this IRP.

The parent bus driver (and bus filter drivers) should not handle this request for a child PDO; instead, such a driver should report resource requirements in response to an IRP_MN_QUERY_RESOURCE_REQUIREMENTS request.

Upper and lower-filter drivers do not handle this IRP.

Value

0x0D

Major Code

IRP_MJ_PNP

When Sent

The PnP manager sends this IRP when it is preparing to allocate resource(s) to a device.

The PnP manager sends this IRP at IRQL PASSIVE_LEVEL in the context of an arbitrary thread.

Input Parameters

Irp->IoStatus.Information points to an IO_RESOURCE_REQUIREMENTS_LIST containing the hardware resource requirements for the device. The pointer is NULL if the device consumes no hardware resources.

Parameters.FilterResourceRequirements.IoResourceRequirementList also points to an IO_RESOURCE_REQUIREMENTS_LIST, but the function driver should use the list in the IoStatus block.

Output Parameters

Returned in the I/O status block.

I/O Status Block

If a function driver handles this IRP, it handles it on the IRP's way back up the stack. If the function driver handles the IRP successfully, it sets Irp->IoStatus.Status to STATUS_SUCCESS and sets Irp->IoStatus.Information to a pointer to an IO_RESOURCE_REQUIREMENTS_LIST containing the filtered resource requirements. See the "Operation" section below for more information about setting the filtered resource list. If a function driver encounters an error when handling this IRP, it sets the error in Irp->IoStatus.Status. If a function driver does not handle this IRP, it uses IoSkipCurrentIrpStackLocation to pass the IRP down the stack unchanged.

Upper and lower-filter drivers do not handle this IRP. Such a driver calls IoSkipCurrentIrpStackLocation, passes the IRP down to the next driver, must not modify Irp->IoStatus, and must not complete the IRP.

The parent bus driver does not handle this IRP. It leaves Irp->IoStatus as is and completes the IRP.

Operation

The PnP manager sends an IRP_MN_QUERY_RESOURCE_REQUIREMENTS request to the parent bus driver for the device, before the function driver has attached its device object to the device stack. To give the function driver an opportunity to modify the device's resource requirements, if appropriate, the PnP manager later sends an IRP_MN_FILTER_RESOURCE_REQUIREMENTS request to the full device stack. The PnP manager sends this IRP before it allocates hardware resources to the device during initial device configuration. The PnP manager might also send this IRP during resource rebalancing.

When the PnP manager sends this IRP, it supplies the driver stack with a resource requirements list, which drivers can modify and return. The PnP manager supplies one of the following types of resource requirements list (listed in order of priority):

  • Forced configuration (modified from a resource list to a resource requirements list)

  • Override configuration

  • Basic configuration

  • Boot configuration (modified from a resource list to a resource requirements list)

If a function driver handles this IRP, it must set a completion routine and handle the IRP on its way back up the device stack. See Plug and Play for information about handling a PnP IRP on its way back up the device stack.

If the function driver is not changing the size of the current list pointed to by Irp->IoStatus.Information, the driver can modify the list in place. If the driver needs to change the size of the requirements list, the driver must allocate a new IO_RESOURCE_REQUIREMENTS_LIST list from paged memory and free the previous list. The PnP manager frees the returned structure when it is no longer needed.

A function driver must preserve the order of resources in the list pointed to by Irp->IoStatus.Information and must not alter resource tags that it does not handle. The driver must take care to adjust the requirements list in a way that the device's parent bus supports. If a function driver adds a new resource to the requirements list, and that resource is assigned to the device, the function driver should filter that resource out of the IRP_MN_START_DEVICE before passing the start IRP down to the bus driver.

If the function driver for the device does not handle this IRP, the PnP manager uses the resource requirements as specified by the parent bus driver in response to the IRP_MN_QUERY_RESOURCE_REQUIREMENTS request.

A function driver must be prepared to handle this IRP for a device at any time after the driver's AddDevice routine has been called for the device.

See Plug and Play for the general rules for handling Plug and Play minor IRPs.

Sending This IRP

Reserved for system use. Drivers must not send this IRP.

Requirements

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

See also

ExAllocatePoolWithTag

ExFreePool

IO_RESOURCE_REQUIREMENTS_LIST

IRP_MN_START_DEVICE