Condividi tramite


How NDIS Sets the Power Policy for a NIC (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 serves as the device power policy owner for each network device. As such, NDIS sets and administers the power policy for each network device. For more information about managing device power policy, see Managing Device Power Policy.

NDIS uses the following information to set the power policy for a NIC:

Using the DEVICE_CAPABILITIES Structure (NDIS 5.1)

When a NIC is enumerated, NDIS queries the NIC's capabilities by issuing, in addition to other requests, an IRP_MN_QUERY_CAPABILITIESrequest. In response to this request, the bus driver returns a DEVICE_CAPABILITIESstructure. NDIS copies this structure and uses the following information from this structure when setting the power policy for the NIC.

Member Description

DeviceD1 and DeviceD2

TRUE if the device supports the D1 power state.

DeviceD1 and DeviceD2

TRUE if the device supports the D2 power state.

WakeFromD0, WakeFromD1, WakeFromD2, and WakeFromD3

TRUE if the device can respond to an external wake signal while in the D0 power state.

WakeFromD0, WakeFromD1, WakeFromD2, and WakeFromD3

TRUE if the device can respond to an external wake signal while in the D1 power state.

WakeFromD0, WakeFromD1, WakeFromD2, and WakeFromD3

TRUE if the device can respond to an external wake signal while in the D2 power state.

WakeFromD0, WakeFromD1, WakeFromD2, and WakeFromD3

TRUE if the device can respond to an external wake signal while in the D3 power state.

DeviceState[PowerSystemMaximum]

Specifies the highest-powered device state that this device can maintain for each system power state, from PowerSystemUnspecified to PowerSystemShutdown.

SystemWake

Specifies lowest-powered system power state (S0 through S4) from which the device can signal a wake event.

DeviceWake

Specifies lowest-powered device power state (D0 through D3) from which the device can signal a wake event.

 

NDIS uses the DEVICE_CAPABILITIES information to answer the following questions:

  • Do both the system and the NIC support power management? If so, which device power states can the NIC be in for each system power state?

  • Do both the system and the NIC support wake-on-LAN? If so, from which device power states can the NIC wake the system?

WakeFromD0 through WakeFromD3 indicate the device power states from which the NIC can wake the system.

The DeviceState array indicates, for each system power state, the highest-powered device power state in which the NIC can be and still support that system power state. For example, consider the following array values:

DeviceState[PowerSystemWorking] PowerDeviceD0 DeviceState[PowerSystemSleeping1] PowerDeviceD1 DeviceState[PowerSystemSleeping2] PowerDeviceD2 DeviceState[PowerSystemSleeping3] PowerDeviceD2 DeviceState[PowerSystemHibernate] PowerDeviceD3 DeviceState[PowerSystemShutdown] PowerDeviceD3

As indicated by this array of sample values, when the system is in system power state S1, the NIC can be in device power state D1, D2, or D3. When the system is in system power state S2 or S3, the NIC can be in device power state D2 or D3.

To determine whether both the system and NIC support wake-on-LAN, NDIS examines both the SystemWake and DeviceWake members. If both SystemWake and DeviceWake are set to PowerSystemUnspecified, NDIS treats the NIC as capable of power management. In this case, or if the miniport driver set the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag during initialization, NDIS subsequently issues the miniport driver an OID_PNP_CAPABILITIESrequest to obtain more information about the NIC's wake-up capabilities.

Using OID_PNP_CAPABILITIES (NDIS 5.1)

After a miniport driver successfully returns from its MiniportInitializefunction, NDIS sends an OID_PNP_CAPABILITIES request to the driver if either of the following is true:

  • Both the SystemWake and DeviceWake members of the DEVICE_CAPABILITIES structure returned by the bus driver are not set to PowerSystemUnspecified.

  • The miniport driver set the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag when it called NdisMSetAttributesEx during initialization.

Note that NDIS issues an OID_PNP_CAPABILITIES request regardless of whether the user has enabled wake-on-LAN in the user interface.

If the miniport driver returns NDIS_STATUS_SUCCESS in response to a query of OID_PNP_CAPABILITIES, NDIS treats the miniport driver as PM-capable. If the miniport driver returns NDIS_STATUS_NOT_SUPPORTED, NDIS treats the miniport driver as a legacy miniport driver that is not PM-capable. See Power Management for Legacy Miniport Driversfor more information.

A miniport driver that succeeds an OID_PNP_CAPABILITIES request returns to NDIS the following information in response to the request:

  • The lowest device power state from which the NIC can wake the system on receipt of a Magic Packet.

  • The lowest device power state from which the NIC can wake the system on receipt of a network frame that contains a pattern specified by the protocol driver.

As soon as NDIS gets this information, it determines, for each system power state, the device power states to which it can set the NIC if wake-on-LAN is enabled by the user in the UI. If there are no allowable low-power device states from which the NIC can generate a wake-up signal (that is, if all the low-power device power states specified in the DeviceWakearray of DEVICE_CAPABILITIES structures are lower than lowest device power states from which the NIC can wake the system), NDIS shades the Allow the device to bring the computer out of standby check box in the Power Management tab for the NIC. This prevents the user from enabling wake-on-LAN.

Note   Wake-on-LAN is possible only if both the NIC and the system are PM-capable. If the system is not PM-capable, NDIS will not query a NIC's power management capabilities.

 

Using User Input (NDIS 5.1)

For a PM-capable NIC, Microsoft Windows 2000 and Windows Millennium Edition (Me) provide the following check boxes in the Power Management tab of a NIC's Properties dialog box:

Allow the computer to turn off this device to save power

Allow the device to bring the computer out of standby

The first check box is selected by default, thereby enabling power management for the NIC. If the user clears the check box, NDIS treats the NIC as a legacy NIC with regard to power management. For more information, see Power Management for Legacy Miniport Drivers.

The second check box is clear by default. If NDIS determines that there is no allowable low-power state from which the NIC can generate a wake-up signal, NDIS makes the second check box unavailable. For example, if the DeviceState array member of the DEVICE_CAPABILITIES structure indicates that the NIC must be in D3 for all low-power system states, and if DeviceWake indicates that the lowest-powered device state from which the NIC can wake the system is D2, then NDIS shades makes the second check box unavailable.

In addition to the above two check boxes, Windows XP provides a third check box on the Power Management tab for a NIC:

Only allow management stations to bring the computer out of standby

This check box, which is subordinate to the second check box described earlier, is available only if:

  • The user selected the second check box in order to enable wake-on-LAN.

  • The miniport driver, in responding to the OID_PNP_CAPABILITIES, indicated that the NIC could wake the system on receipt of a Magic Packet.

This check box is clear by default. The user can select this check box to specify that only the receipt of a Magic Packet will cause the NIC to generate a wake-up signal to the system.

Whenever a user selects or clears a power management check box for a NIC, the system notifies NDIS of the change. NDIS writes the new setting to the registry so that the changed setting persists across reboots.

 

 

Send comments about this topic to Microsoft