VOID FxPoxInterface::ComponentIdleCallback( __in PVOID Context, __in ULONG Component ) { PPOX_SETTINGS poxSettings = NULL; FxPoxInterface * pThis = NULL; pThis = (FxPoxInterface*) Context; DoTraceLevelMessage( pThis->m_PkgPnp->GetDriverGlobals(), TRACE_LEVEL_VERBOSE, TRACINGPNP, "WDFDEVICE 0x%p !devobj 0x%p PO_FX_COMPONENT_IDLE_CONDITION_CALLBACK " "invoked.", pThis->m_PkgPnp->GetDevice()->GetHandle(), pThis->m_PkgPnp->GetDevice()->GetDeviceObject() ); // // If the client driver has specified power framework settings, retrieve // them. // poxSettings = pThis->GetPowerFrameworkSettings(); // // If the client driver has specified a component-idle callback, invoke it // if ((NULL != poxSettings) && (NULL != poxSettings->ComponentIdleConditionCallback)) { DoTraceLevelMessage( pThis->m_PkgPnp->GetDriverGlobals(), TRACE_LEVEL_VERBOSE, TRACINGPNP, "WDFDEVICE 0x%p !devobj 0x%p Invoking client driver's " "PO_FX_COMPONENT_IDLE_CONDITION_CALLBACK.", pThis->m_PkgPnp->GetDevice()->GetHandle(), pThis->m_PkgPnp->GetDevice()->GetDeviceObject() ); poxSettings->ComponentIdleConditionCallback( poxSettings->PoFxDeviceContext, Component ); } else { // // We're being notified that we're idle, but there is no action that we // need to take here. We power down the device only when we get the // device-power-not-required event. // PoFxCompleteIdleCondition(pThis->m_PoHandle, Component); } return; }
VOID PcPowerFxComponentIdleConditionCallback( _In_ PVOID Context, _In_ ULONG Component ) { PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context; PortClassDeviceContext* pExtension = static_cast<PortClassDeviceContext*>(DeviceObject->DeviceExtension); DPF(D_VERBOSE, ("PcPowerFxComponentIdleConditionCallback Context %p, Component %d", Context, Component)); PoFxCompleteIdleCondition(pExtension->m_poHandle, Component); }
/////////////////////////////////////////////////////////////////////////////// // SmplQueueEvtStatePoFxStopComplete // Callback invoked by KMDF when stop transiton of the supplied queue has // completed. /////////////////////////////////////////////////////////////////////////////// VOID SmplQueueEvtStatePoFxStopComplete( _In_ WDFQUEUE Queue, _In_ WDFCONTEXT Context ) { DEVICE_CONTEXT *pDeviceContext = WdfObjectGetTypedContext(WdfIoQueueGetDevice(Queue), DEVICE_CONTEXT); UNREFERENCED_PARAMETER(Context); // // Queue has been stopped. Complete the idle transition. // PoFxCompleteIdleCondition(pDeviceContext->PoHandle, 0 /* Component */); } // end SmplQueueEvtStatePoFxStopComplete
VOID SingleCompEvtQueueStopComplete( _In_ WDFQUEUE Queue, _In_ WDFCONTEXT Context ) /*++ Routine Description: Callback invoked by KMDF when stop transiton of the supplied queue has completed. Arguments: Queue - Queue whose stop transition has completed Context - The context we supply while calling WdfIoQueueStop. Return value: None --*/ { PFDO_DATA fdoContext; WDFDEVICE device; UNREFERENCED_PARAMETER(Context); device = WdfIoQueueGetDevice(Queue); fdoContext = WdfObjectGetTypedContext(device, FDO_DATA); if (0 == InterlockedDecrement(&(fdoContext->QueueStopCount))) { // // All the queues have been stopped. Mark ourselves as idle and complete // the idle transition. // fdoContext->IsActive = FALSE; PoFxCompleteIdleCondition(fdoContext->PoHandle, 0 /* Component */); } }