设备电源管理参考

驱动程序可以将设备硬件划分为多个逻辑组件,以实现精细电源管理。 组件具有一组电源状态,可以独立于同一设备中其他组件的电源状态进行管理。 在 F0 状态下,组件已完全打开。 该组件可能支持其他低功率状态 F1、F2 等。

设备的电源策略所有者通常是设备的函数驱动程序。 若要启用组件级电源管理,此驱动程序会将设备注册到电源管理框架(PoFx)。 通过注册设备,驱动程序负责在主动使用组件时以及组件处于空闲状态时通知 PoFx。 PoFx 根据有关组件活动、延迟容忍度、预期空闲持续时间和唤醒要求的信息,为设备做出智能空闲状态选择。 通过在组件级别控制电源使用情况,PoFx 可以降低电源需求,同时保持系统响应能力。 有关详细信息,请参阅 Component-Level 电源管理

设备电源管理例程

这些例程由电源管理框架(PoFx)实现,以实现设备电源管理。 这些例程由设备电源策略所有者(PPO)的驱动程序调用。 通常,设备的函数驱动程序是此设备的 PPO。

Topic Description
PoFxActivateComponent The PoFxActivateComponent routine increments the activation reference count on the specified component.
PoFxCompleteDevicePowerNotRequired The PoFxCompleteDevicePowerNotRequired routine notifies the power management framework (PoFx) that the calling driver has completed its response to a call to the driver's DevicePowerNotRequiredCallback callback routine.
PoFxCompleteIdleCondition The PoFxCompleteIdleCondition routine informs the power management framework (PoFx) that the specified component has completed a pending change to the idle condition.
PoFxCompleteIdleState PoFxCompleteIdleState 例程通知电源管理框架(PoFx)指定组件已完成对 Fx 状态的挂起更改。
PoFxIdleComponent The PoFxIdleComponent routine decrements the activation reference count on the specified component.
PoFxIssueComponentPerfStateChange The PoFxIssueComponentPerfStateChange routine submits a request to place a device component in a particular performance state.
PoFxIssueComponentPerfStateChangeMultiple The PoFxIssueComponentPerfStateChangeMultiple routine submits a request to change the performance states in multiple performance state sets simultaneously for a device component.
PoFxNotifySurprisePowerOn The PoFxNotifySurprisePowerOn routine notifies the power management framework (PoFx) that a device was turned on as a side effect of supplying power to some other device.
PoFxPowerControl The PoFxPowerControl routine sends a power control request to the power management framework (PoFx).
PoFxQueryCurrentComponentPerfState The PoFxQueryCurrentComponentPerfState routine retrieves the active performance state in a component's performance state set.
PoFxRegisterComponentPerfStates The PoFxRegisterComponentPerfStates routine registers a device component for performance state management by the power management framework (PoFx).
PoFxRegisterDevice The PoFxRegisterDevice routine registers a device with the power management framework (PoFx).
PoFxReportDevicePoweredOn The PoFxReportDevicePoweredOn routine notifies the power management framework (PoFx) that the device completed the requested transition to the D0 (fully on) power state.
PoFxSetComponentLatency The PoFxSetComponentLatency routine specifies the maximum latency that can be tolerated in the transition from the idle condition to the active condition in the specified component.
PoFxSetComponentResidency The PoFxSetComponentResidency routine sets the estimated time for how long a component is likely to remain idle after the component enters the idle condition.
PoFxSetComponentWake The PoFxSetComponentWake routine indicates whether the driver arms the specified component to wake whenever the component enters the idle condition.
PoFxSetDeviceIdleTimeout The PoFxSetDeviceIdleTimeout routine specifies the minimum time interval from when the last component of the device enters the idle condition to when the power management framework (PoFx) calls the driver's DevicePowerNotRequiredCallback callback routine.
PoFxStartDevicePowerManagement The PoFxStartDevicePowerManagement routine completes the registration of a device with the power management framework (PoFx) and starts device power management.
PoFxUnregisterDevice The PoFxUnregisterDevice routine removes the registration of a device from the power management framework (PoFx).

设备电源管理回调

电源管理框架(PoFx)需要这些回调例程才能启用设备电源管理。 设备电源策略所有者的驱动程序实现这些回调例程。 PoFx 调用这些例程来查询和配置设备中组件的电源状态。

Topic Description
ComponentActiveConditionCallback The ComponentActiveConditionCallback callback routine notifies the driver that the specified component completed a transition from the idle condition to the active condition.
ComponentIdleConditionCallback The ComponentIdleConditionCallback callback routine notifies the driver that the specified component completed a transition from the active condition to the idle condition.
ComponentIdleStateCallback The ComponentIdleStateCallback callback routine notifies the driver of a pending change to the Fx power state of the specified component.
ComponentPerfStateCallback The ComponentPerfStateCallback callback routine notifies the driver that its request to change the performance state of a component is complete.
DevicePowerNotRequiredCallback The DevicePowerNotRequiredCallback callback routine notifies the device driver that the device is not required to stay in the D0 power state.
DevicePowerRequiredCallback The DevicePowerRequiredCallback callback routine notifies the device driver that the device must enter and remain in the D0 power state.
PowerControlCallback The PowerControlCallback callback routine performs a power control operation that is requested by the power management framework (PoFx).

设备电源管理结构

电源管理框架(PoFx)定义了这些结构以支持设备电源管理。

Topic Description
PO_FX_COMPONENT_V1PO_FX_COMPONENT_V2 The PO_FX_COMPONENT structure describes the power state attributes of a component in a device.
PO_FX_COMPONENT_IDLE_STATE The PO_FX_COMPONENT_IDLE_STATE structure specifies the attributes of an Fx power state of a component in a device.
PO_FX_COMPONENT_PERF_INFO The PO_FX_COMPONENT_PERF_INFO structure describes all the sets of performance states for a single component within a device.
PO_FX_COMPONENT_PERF_SET The PO_FX_COMPONENT_PERF_SET structure represents a set of performance states for a single component within a device.
PO_FX_DEVICE_V1PO_FX_DEVICE_V2PO_FX_DEVICE_V3 The PO_FX_DEVICE structure describes the power attributes of a device to the power management framework (PoFx).
PO_FX_PERF_STATE The PO_FX_PERF_STATE structure represents a performance state for a single component within a device.
PO_FX_PERF_STATE_CHANGE The PO_FX_PERF_STATE_CHANGE structure contains information about a change to a performance state that is being requested by calling the PoFxIssueComponentPerfStateChange or PoFxIssueComponentPerfStateChangeMultiple routine.

设备电源管理枚举

电源管理框架(PoFx)定义这些枚举以支持设备电源管理。

Topic Description
PO_FX_PERF_STATE_TYPE The PO_FX_PERF_STATE_TYPE enumeration contains values that describe the type of performance states in a PO_FX_COMPONENT_PERF_SET.
PO_FX_PERF_STATE_UNIT The PO_FX_PERF_STATE_UNIT enumeration contains values that describe the type of unit that is controlled by the performance states in a PO_FX_COMPONENT_PERF_SET.

设备电源管理常量

PO_FX_FLAG_XXX标志位

The PO_FX_FLAG_XXX constants are flag bits that indicate whether a request to change the condition of component is performed synchronously or asynchronously.

#define PO_FX_FLAG_BLOCKING   0x1
#define PO_FX_FLAG_ASYNC_ONLY 0x2

PO_FX_FLAG_XXX constants

Constant Description
PO_FX_FLAG_BLOCKING 使条件更改同步。 如果设置了此标志,则请求条件更改的例程不会将控制权返回到调用驱动程序,直到组件硬件完成到新条件的转换。 仅当调用方在 IRQL < DISPATCH_LEVEL运行时,才能使用此标志。
PO_FX_FLAG_ASYNC_ONLY 使条件更改完全异步。 如果设置了此标志,则调用驱动程序的回调例程从调用条件更改的线程以外的线程调用。 因此,请求条件更改的例程始终以异步方式返回,而无需等待回调完成。

PO_FX_FLAG_XXX remarks

The Flags parameter to the following routines can be set to a PO_FX_FLAG_XXX constant:

The PO_FX_FLAG_BLOCKING and PO_FX_FLAG_ASYNC_ONLY flag bits are mutually exclusive. 调用方可以在 Flags 参数中设置一个或多个标志位,但不能同时设置这两个标志位。

PO_FX_FLAG_XXX Requirements

Version Header
从 Windows 8 开始支持。 Wdm.h

PO_FX_FLAG_PERF_XXX标志位

The PO_FX_FLAG_PERF_XXX constants are flag bits that define how the power management framework (PoFx) manages performance states for a device component.

#define PO_FX_FLAG_PERF_PEP_OPTIONAL   0x1
#define PO_FX_FLAG_PERF_QUERY_ON_F0 0x2
#define PO_FX_FLAG_PERF_QUERY_ON_ALL_IDLE_STATES 0x4
Constant Value Description
PO_FX_FLAG_PERF_PEP_OPTIONAL 1 (0x1) 指示驱动程序可以在没有平台扩展插件(PEP)帮助的情况下更改性能状态,或者驱动程序仅出于日志记录目的向 PoFx 注册性能状态。 If this flag is set, the PoFxRegisterComponentPerfStates call will still succeeded if the PEP does not support performance states for the component.
PO_FX_FLAG_PERF_QUERY_ON_F0 2 (0x2) 对于某些设备,PEP 可能需要将组件的性能状态设置为特定性能状态(称为 名义性能状态),当组件空闲时。 如果组件包含名义性能状态,驱动程序将设置此标志,在这种情况下,PoFx 将查询 PEP 以确定组件转换为 F0 时的当前性能状态。
PO_FX_FLAG_PERF_QUERY_ON_ALL_IDLE_STATES 4 (0x4) 对于某些设备,在将组件在空闲状态之间转换组件时,PEP 可能需要将组件的性能状态设置为特定性能状态(称为 名义性能状态)。 如果此组件包含名义性能状态,驱动程序将设置此标志,在这种情况下,PoFx 将查询 PEP 以确定当组件在空闲状态之间转换时当前性能状态。

PO_FX_FLAG_PERF_XXX remarks

The Flags parameter to the PoFxRegisterComponentPerfStates routine can be set to a PO_FX_FLAG_PERF_XXX constant.

PO_FX_FLAG_PERF_XXX requirements

Requirements Version
从 Windows 10 开始支持。 Wdm.h