SRIOV_SET_POWER_STATE funzione di callback (pcivirt.h)
Imposta lo stato di alimentazione dell'VF (Virtual Function) PCI Express SR-IOV specificato.
Sintassi
SRIOV_SET_POWER_STATE SriovSetPowerState;
NTSTATUS SriovSetPowerState(
[in] PVOID Context,
[in] USHORT VfIndex,
[in] DEVICE_POWER_STATE PowerState,
[in] BOOLEAN Wake
)
{...}
Parametri
[in] Context
Puntatore a un contesto definito dal driver.
[in] VfIndex
Indice in base zero dell'oggetto VF a cui si applica questa operazione del set di stati di alimentazione.
[in] PowerState
Valore DEVICE_POWER_STATE-type che indica lo stato di alimentazione Dx da impostare.
[in] Wake
Valore booleano che indica se armere il dispositivo per un segnale di riattivazione (PME per dispositivi PCI Express), perché entra nello stato di basso consumo. TRUE indica che il dispositivo è armato; FALSE in caso contrario. Questo valore deve essere FALSE se PowerState è PowerDeviceD0.
Valore restituito
Impostare su STATUS_SUCCESS se la richiesta ha esito positivo. In caso contrario, restituire un codice NTSTATUS appropriato per indicare la condizione di errore.
Osservazioni
Questa funzione di callback viene implementata dal driver pf (Physical Function). Il callback viene richiamato quando il sistema vuole modificare lo stato di alimentazione di una funzione virtuale.
Il driver PF registra l'implementazione impostando il membro SetVfPowerState del SRIOV_DEVICE_INTERFACE_STANDARD, configurando una struttura WDF_QUERY_INTERFACE_CONFIG e chiamando WdfDeviceAddQueryInterface.
Di seguito è riportato un esempio di implementazione di questa funzione di callback.
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;
}
Fabbisogno
Requisito | Valore |
---|---|
client minimo supportato | Windows 10 |
server minimo supportato | Windows Server 2016 |
piattaforma di destinazione | Finestre |
intestazione | pcivirt.h |
IRQL | PASSIVE_LEVEL |