設定指定之PCI Express SR-IOV 虛擬函式 (VF) 的電源狀態。
語法
SRIOV_SET_POWER_STATE SriovSetPowerState;
NTSTATUS SriovSetPowerState(
[in] PVOID Context,
[in] USHORT VfIndex,
[in] DEVICE_POWER_STATE PowerState,
[in] BOOLEAN Wake
)
{...}
參數
[in] Context
驅動程式定義內容的指標。
[in] VfIndex
套用此電源狀態集作業之 VF 之以零起始的索引。
[in] PowerState
DEVICE_POWER_STATE型別值,指出要設定 Dx 電源狀態。
[in] Wake
布爾值,指出是否要為裝置提供喚醒訊號 (PCI Express 裝置的 PME),因為它進入低功率狀態。 TRUE 表示裝置已武裝;否則為 FALSE。 如果 PowerState PowerDeviceD0,這個值必須是 FALSE。
傳回值
如果要求成功,請將 設定為 STATUS_SUCCESS。 否則,傳回適當的 NTSTATUS 程式代碼,以指出錯誤狀況。
言論
此回呼函式是由實體函式 (PF) 驅動程序實作。 當系統想要變更虛擬函式的電源狀態時,會叫用回呼。
PF 驅動程式會藉由設定SRIOV_DEVICE_INTERFACE_STANDARD的 SetVfPowerState 成員、設定 WDF_QUERY_INTERFACE_CONFIG 結構,以及呼叫 WdfDeviceAddQueryInterface來註冊其實作。
以下是此回呼函式的範例實作。
NTSTATUS
Virtualization_SetPowerState (
__inout PVOID Context,
USHORT VfIndex,
DEVICE_POWER_STATE PowerState,
BOOLEAN Wake
)
{
PDEVICE_CONTEXT deviceContext;
WDF_POWER_DEVICE_STATE wdfPowerState;
NTSTATUS status;
PAGED_CODE();
status = STATUS_SUCCESS;
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INTERFACE,
"Virtualization_SetPowerState received with \
VFIndex = %d, PowerState = %d, Wake = %d\n",
VfIndex, PowerState, Wake);
deviceContext = (PDEVICE_CONTEXT) Context;
if (VfIndex >= deviceContext->NumVFs)
{
TraceEvents(TRACE_LEVEL_ERROR, DBG_INTERFACE,
"VfIndex specified: %d was out of bounds. NumVFs: %d\n",
VfIndex, deviceContext->NumVFs);
return STATUS_INVALID_PARAMETER;
}
switch (PowerState)
{
case PowerDeviceD0:
wdfPowerState = WdfPowerDeviceD0;
break;
case PowerDeviceD1:
wdfPowerState = WdfPowerDeviceD1;
break;
case PowerDeviceD2:
wdfPowerState = WdfPowerDeviceD2;
break;
case PowerDeviceD3:
wdfPowerState = WdfPowerDeviceD3;
break;
default:
return STATUS_INVALID_PARAMETER;
}
WdfWaitLockAcquire(deviceContext->PowerStateLock, NULL);
deviceContext->VfContext[VfIndex].VfPowerDeviceState = wdfPowerState;
deviceContext->VfContext[VfIndex].VfWake = Wake;
WdfWaitLockRelease(deviceContext->PowerStateLock);
return status;
}
要求
要求 | 價值 |
---|---|
最低支援的用戶端 | Windows 10 |
支援的最低伺服器 | Windows Server 2016 |
目標平臺 | 窗戶 |
標頭 | pcivirt.h |
IRQL | PASSIVE_LEVEL |