Power Management for Legacy Miniport Drivers (NDIS 5.1)
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.
NDIS treats a miniport driver as a legacy miniport driver that is not power management-aware if:
During initialization, the bus driver indicates that the system and/or the NIC is not power management-aware.
The miniport driver returns NDIS_STATUS_UNSUPPORTED in response to the OID_PNP_CAPABILITIES query.
The user disables power management in the user interface.
NDIS supports only two device power states for legacy miniport drivers: the highest-powered (D0) state and the D3 state.
During initialization, a legacy miniport driver can indicate that NDIS should not halt it before the system transitions to the sleeping (D3) state. A miniport driver makes such an indication by setting the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag in the AttributeFlagsparameter that the miniport driver passes to the NdisMSetAttributesExfunction. A legacy miniport driver should set this flag only if it can:
Save all hardware context that it might require.
Put its NIC in an appropriate state for the sleeping state (D3).
Reactivate the NIC to the highest-powered state (D0).
If NDIS determines from the bus driver that the NIC is not power management-aware and if the miniport driver did not set the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag, NDIS will not query the miniport driver's power management capabilities. However, if the miniport driver set the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag, NDIS issues an OID_PNP_CAPABILITIESrequest to the miniport driver. In this case, the miniport driver should succeed the OID_PNP_CAPABILITIES request with NDIS_STATUS_SUCCESS. In the NDIS_PM_WAKE_UP_CAPABILITIES structure that the miniport driver returns in response to this request, the miniport driver must also specify a device power state of NdisDeviceStateUnspecified for each wake-up capability.
NDIS provides the following power management support for legacy miniport drivers:
NDIS succeeds all IRP_MN_QUERY_POWER requests that the system power manager sends to the device object that represents the NIC. That is, NDIS guarantees that the miniport driver's NIC will transition to the D3 state in response to any IRP_MN_QUERY_POWER request from the system.
If the miniport driver did not set the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag during initialization, NDIS calls the miniport driver's MiniportHalt function before the miniport driver's NIC transitions to state D3. The miniport driver's NIC loses all hardware context information.
If the miniport driver set the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag during initialization, NDIS does not halt the miniport driver before the system transitions to state D3. Instead, NDIS issues the miniport driver an OID_PNP_SET_POWER request to D3 state. The miniport driver must save any hardware context that it uses and put its NIC in a state appropriate for the D3 state.
While the system is transitioning to the S0 System Power States, NDIS calls the miniport driver's MiniportInitialize function if NDIS halted the miniport driver. If NDIS did not halt the miniport driver, NDIS issues the miniport driver an OID_PNP_SET_POWER request to D0 state. The miniport driver must put its NIC in a state appropriate for the D0 state.
If the miniport driver was halted and reinitialized, NDIS restores all the appropriate miniport driver settings, such as packet filters and multicast address lists, by issuing OID requests. If the miniport driver was not halted and then reinitialized, the miniport driver must restore such settings.