ReactOS  0.4.15-dev-3453-gff89651
FxPoxInterface Class Reference

#include <fxpoxinterface.hpp>

Collaboration diagram for FxPoxInterface:

Public Member Functions

 FxPoxInterface (__in FxPkgPnp *PkgPnp)
 
 ~FxPoxInterface (VOID)
 
NTSTATUS CreateDevicePowerRequirementMachine (VOID)
 
NTSTATUS NotifyDevicePowerDown (VOID)
 
VOID DeviceIsPoweredOn (VOID)
 
FxPkgPnpPkgPnp (VOID)
 
POHANDLE GetPoHandle (VOID)
 
NTSTATUS InitializeComponents (VOID)
 
VOID UninitializeComponents (VOID)
 
VOID RequestComponentActive (VOID)
 
BOOLEAN DeclareComponentIdle (VOID)
 
VOID UpdateIdleTimeoutHint (VOID)
 
VOID SimulateDevicePowerRequired (VOID)
 
VOID SimulateDevicePowerNotRequired (VOID)
 
VOID PoxReportDevicePoweredOn (VOID)
 
VOID PowerRequiredCallbackInvoked (VOID)
 
VOID PowerNotRequiredCallbackInvoked (VOID)
 

Public Attributes

FxDevicePwrRequirementMachinem_DevicePowerRequirementMachine
 
ULONG m_NextIdleTimeoutHint
 

Private Member Functions

NTSTATUS PoxRegisterDevice (VOID)
 
VOID DprProcessEventFromPoxCallback (__in FxDevicePwrRequirementEvents Event)
 
struct _POX_SETTINGSGetPowerFrameworkSettings (VOID)
 
VOID PowerRequiredCallbackWorker (__in BOOLEAN InvokedFromPoxCallback)
 
VOID PowerNotRequiredCallbackWorker (__in BOOLEAN InvokedFromPoxCallback)
 
VOID PoxStartDevicePowerManagement (VOID)
 
VOID PoxUnregisterDevice (VOID)
 
VOID PoxActivateComponent (VOID)
 
VOID PoxIdleComponent (VOID)
 
VOID PoxSetDeviceIdleTimeout (__in ULONGLONG IdleTimeout)
 

Private Attributes

FxPkgPnpm_PkgPnp
 
POHANDLE m_PoHandle
 
BOOLEAN m_DevicePowerRequired
 
MxLock m_DevicePowerRequiredLock
 
ULONG m_CurrentIdleTimeoutHint
 

Static Private Attributes

static PO_FX_COMPONENT_IDLE_STATE_CALLBACK StateCallback
 
static PO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK ComponentActiveCallback
 
static PO_FX_COMPONENT_IDLE_CONDITION_CALLBACK ComponentIdleCallback
 
static PO_FX_DEVICE_POWER_REQUIRED_CALLBACK PowerRequiredCallback
 
static PO_FX_DEVICE_POWER_NOT_REQUIRED_CALLBACK PowerNotRequiredCallback
 
static PO_FX_POWER_CONTROL_CALLBACK PowerControlCallback
 

Friends

class FxDevicePwrRequirementMachine
 

Detailed Description

Definition at line 9 of file fxpoxinterface.hpp.

Constructor & Destructor Documentation

◆ FxPoxInterface()

FxPoxInterface::FxPoxInterface ( __in FxPkgPnp PkgPnp)

Definition at line 22 of file poxinterface.cpp.

25 {
26  m_PkgPnp = PkgPnp;
27  m_PoHandle = NULL;
32 }
BOOLEAN m_DevicePowerRequired
#define TRUE
Definition: types.h:120
FxDevicePwrRequirementMachine * m_DevicePowerRequirementMachine
FxPkgPnp * PkgPnp(VOID)
ULONG m_CurrentIdleTimeoutHint
#define NULL
Definition: types.h:112
FxPkgPnp * m_PkgPnp

◆ ~FxPoxInterface()

FxPoxInterface::~FxPoxInterface ( VOID  )

Definition at line 34 of file poxinterface.cpp.

37 {
40  }
41 }
FxDevicePwrRequirementMachine * m_DevicePowerRequirementMachine
#define NULL
Definition: types.h:112

Member Function Documentation

◆ CreateDevicePowerRequirementMachine()

NTSTATUS FxPoxInterface::CreateDevicePowerRequirementMachine ( VOID  )

Definition at line 44 of file poxinterface.cpp.

47 {
48 // NTSTATUS status;
49 // FxDevicePwrRequirementMachine * fxDprMachine = NULL;
50 
51 // ASSERT(NULL == m_DevicePowerRequirementMachine);
52 
53 // fxDprMachine = new (m_PkgPnp->GetDriverGlobals())
54 // FxDevicePwrRequirementMachine(this);
55 // if (NULL == fxDprMachine) {
56 // status = STATUS_INSUFFICIENT_RESOURCES;
57 // DoTraceLevelMessage(
58 // m_PkgPnp->GetDriverGlobals(),
59 // TRACE_LEVEL_ERROR, TRACINGPNP,
60 // "WDFDEVICE 0x%p !devobj 0x%p failed to allocate "
61 // "FxDevicePwrRequirementMachine. %!STATUS!.",
62 // m_PkgPnp->GetDevice()->GetHandle(),
63 // m_PkgPnp->GetDevice()->GetDeviceObject(),
64 // status);
65 // goto exit;
66 // }
67 
68 // status = fxDprMachine->Initialize(m_PkgPnp->GetDriverGlobals());
69 // if (FALSE == NT_SUCCESS(status)) {
70 // DoTraceLevelMessage(
71 // m_PkgPnp->GetDriverGlobals(),
72 // TRACE_LEVEL_ERROR, TRACINGPNP,
73 // "WDFDEVICE 0x%p !devobj 0x%p Device Power Requirement State Machine"
74 // " Initialize() failed, %!STATUS!",
75 // m_PkgPnp->GetDevice()->GetHandle(),
76 // m_PkgPnp->GetDevice()->GetDeviceObject(),
77 // status);
78 // goto exit;
79 // }
80 
81 // status = fxDprMachine->Init(
82 // m_PkgPnp,
83 // FxDevicePwrRequirementMachine::_ProcessEventInner
84 // );
85 // if (!NT_SUCCESS(status)) {
86 // DoTraceLevelMessage(
87 // m_PkgPnp->GetDriverGlobals(),
88 // TRACE_LEVEL_ERROR, TRACINGPNP,
89 // "WDFDEVICE 0x%p !devobj 0x%p Device Power Requirement State Machine"
90 // " Init() failed, %!STATUS!",
91 // m_PkgPnp->GetDevice()->GetHandle(),
92 // m_PkgPnp->GetDevice()->GetDeviceObject(),
93 // status);
94 // goto exit;
95 // }
96 
97 // m_DevicePowerRequirementMachine = fxDprMachine;
98 
99 // status = STATUS_SUCCESS;
100 
101 // exit:
102 // if (FALSE == NT_SUCCESS(status)) {
103 // if (NULL != fxDprMachine) {
104 // delete fxDprMachine;
105 // }
106 // }
107 // return status;
109  return STATUS_SUCCESS;
110 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ DeclareComponentIdle()

BOOLEAN FxPoxInterface::DeclareComponentIdle ( VOID  )

Definition at line 306 of file poxinterface.cpp.

309 {
310  // BOOLEAN canPowerDown;
311 
312  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
313  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
314  // //
315  // // Driver-managed idle timeout. We can power down immediately, without
316  // // waiting for device-power-not-required notification.
317  // //
318  // canPowerDown = TRUE;
319  // } else {
320  // //
321  // // System-managed idle timeout
322  // //
323  // PoxIdleComponent();
324 
325  // //
326  // // We must wait for device-power-not-required notification before
327  // // powering down.
328  // //
329  // canPowerDown = FALSE;
330  // }
331 
332  // return canPowerDown;
334  return TRUE;
335 }
#define TRUE
Definition: types.h:120
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ DeviceIsPoweredOn()

VOID FxPoxInterface::DeviceIsPoweredOn ( VOID  )

Definition at line 423 of file poxinterface.cpp.

426 {
428  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
429  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
430  // //
431  // // Driver-managed idle timeout. Nothing to do.
432  // //
433  // return;
434  // }
435 
436  // //
437  // // System-managed idle timeout. Notify the device power requirement state
438  // // machine that we are back in D0.
439  // //
440  // m_DevicePowerRequirementMachine->ProcessEvent(
441  // DprEventDeviceReturnedToD0
442  // );
443  // return;
444 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ DprProcessEventFromPoxCallback()

VOID FxPoxInterface::DprProcessEventFromPoxCallback ( __in FxDevicePwrRequirementEvents  Event)
private

Definition at line 467 of file poxinterface.cpp.

470 {
472  // KIRQL irql;
473 
474  // //
475  // // We should not run the state machine from within a power framework
476  // // callback because we might end up reaching a state where we unregister
477  // // with the power framework. Unregistering from a callback leads to a
478  // // deadlock. Therefore, we raise IRQL before queueing an event to the state
479  // // machine. Raising IRQL causes the event processing to be deferred to a
480  // // worker thread.
481  // //
482 
483  // //
484  // // This path should only be invoked for kernel mode. For user mode, this
485  // // condition is avoided by reflector guranteeing that it queues a worker
486  // // item to send a Pofx event corresponding to any PoFx callback
487  // //
488  // ASSERT(FX_IS_KERNEL_MODE);
489 
490  // Mx::MxRaiseIrql(DISPATCH_LEVEL, &irql);
491  // m_DevicePowerRequirementMachine->ProcessEvent(Event);
492  // Mx::MxLowerIrql(irql);
493 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ GetPoHandle()

POHANDLE FxPoxInterface::GetPoHandle ( VOID  )
inline

Definition at line 47 of file fxpoxinterface.hpp.

50  {
51  return m_PoHandle;
52  }

◆ GetPowerFrameworkSettings()

PPOX_SETTINGS FxPoxInterface::GetPowerFrameworkSettings ( VOID  )
private

Definition at line 447 of file poxinterface.cpp.

450 {
451  PPOX_SETTINGS poxSettings = NULL;
452 
454  // if (m_PkgPnp->m_PowerPolicyMachine.m_Owner->
455  // m_IdleSettings.m_TimeoutMgmt.DriverSpecifiedPowerFrameworkSettings()) {
456 
457  // poxSettings = m_PkgPnp->m_PowerPolicyMachine.m_Owner->
458  // m_IdleSettings.m_TimeoutMgmt.GetPowerFrameworkSettings();
459 
460  // ASSERT(NULL != poxSettings);
461  // }
462 
463  return poxSettings;
464 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52
#define NULL
Definition: types.h:112

Referenced by _Function_class_(), and PoxRegisterDevice().

◆ InitializeComponents()

NTSTATUS FxPoxInterface::InitializeComponents ( VOID  )

Definition at line 113 of file poxinterface.cpp.

116 {
117 // NTSTATUS status;
118 // PPOX_SETTINGS poxSettings = NULL;
119 // WDFDEVICE fxDevice = NULL;
120 
121 
122 // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
123 // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
124 // //
125 // // Driver-managed idle timeout. Nothing to do.
126 // //
127 // return STATUS_SUCCESS;
128 // }
129 
130 // //
131 // // We create the device power requirement state machine only if system-
132 // // managed idle timeout is being used.
133 // //
134 // if (NULL == m_DevicePowerRequirementMachine) {
135 // status = CreateDevicePowerRequirementMachine();
136 // if (FALSE == NT_SUCCESS(status)) {
137 // goto exit;
138 // }
139 // }
140 
141 // ASSERT(NULL != m_DevicePowerRequirementMachine);
142 
143 // //
144 // // Register with the power framework
145 // //
146 // status = PoxRegisterDevice();
147 
148 // if (FALSE == NT_SUCCESS(status)) {
149 // DoTraceLevelMessage(
150 // m_PkgPnp->GetDriverGlobals(),
151 // TRACE_LEVEL_ERROR, TRACINGPNP,
152 // "WDFDEVICE 0x%p !devobj 0x%p FxPox::PoxRegisterDevice failed. "
153 // "%!STATUS!.",
154 // m_PkgPnp->GetDevice()->GetHandle(),
155 // m_PkgPnp->GetDevice()->GetDeviceObject(),
156 // status);
157 // goto exit;
158 // }
159 
160 // //
161 // // At the time of registration, all components are active. When we start the
162 // // power framework's device power management (see below), all components are
163 // // moved to the idle state by default. Take an extra reference on the
164 // // component to prevent this from happening. The power policy state machine
165 // // will evaluate the S0-idle policy later and ask us to drop this reference
166 // // if the policy requires it.
167 // //
168 // PoxActivateComponent();
169 
170 // //
171 // // Tell the power framework to start its device power management. This will
172 // // drop a reference on the component, but the component will still remain
173 // // active because of the extra reference we took above.
174 // //
175 // PoxStartDevicePowerManagement();
176 
177 // //
178 // // If the client driver has specified power framework settings, retrieve
179 // // them.
180 // //
181 // poxSettings = GetPowerFrameworkSettings();
182 
183 // //
184 // // If the driver wanted to receive the POHANDLE, invoke their callback now
185 // //
186 // if ((NULL != poxSettings) &&
187 // (NULL != poxSettings->EvtDeviceWdmPostPoFxRegisterDevice)) {
188 
189 // fxDevice = m_PkgPnp->GetDevice()->GetHandle();
190 
191 // status = poxSettings->EvtDeviceWdmPostPoFxRegisterDevice(
192 // fxDevice,
193 // m_PoHandle
194 // );
195 // if (FALSE == NT_SUCCESS(status)) {
196 
197 // DoTraceLevelMessage(
198 // m_PkgPnp->GetDriverGlobals(),
199 // TRACE_LEVEL_ERROR, TRACINGPNP,
200 // "WDFDEVICE 0x%p !devobj 0x%p. The client driver has failed the "
201 // "EvtDeviceWdmPostPoFxRegisterDevice callback with %!STATUS!.",
202 // m_PkgPnp->GetDevice()->GetHandle(),
203 // m_PkgPnp->GetDevice()->GetDeviceObject(),
204 // status);
205 
206 // //
207 // // Notify the driver that the POHANDLE is about to become invalid
208 // //
209 // if (NULL != poxSettings->EvtDeviceWdmPrePoFxUnregisterDevice) {
210 // poxSettings->EvtDeviceWdmPrePoFxUnregisterDevice(
211 // fxDevice,
212 // m_PoHandle
213 // );
214 // }
215 
216 // //
217 // // Unregister with the power framework
218 // //
219 // PoxUnregisterDevice();
220 // goto exit;
221 // }
222 // }
223 
224 // //
225 // // Tell the device power requirement state machine that we have registered
226 // // with the power framework
227 // //
228 // m_DevicePowerRequirementMachine->ProcessEvent(DprEventRegisteredWithPox);
229 
230 // exit:
231 // return status;
233  return STATUS_SUCCESS;
234 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ NotifyDevicePowerDown()

NTSTATUS FxPoxInterface::NotifyDevicePowerDown ( VOID  )

Definition at line 368 of file poxinterface.cpp.

371 {
372  // KIRQL irql;
373  // BOOLEAN canPowerOff;
374 
375  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
376  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
377  // //
378  // // Driver-managed idle timeout. We don't have to take power framework's
379  // // device power requirement into consideration. Just return success.
380  // //
381  // return STATUS_SUCCESS;
382  // }
383 
384  // //
385  // // Acquire the lock to ensure that device power requirement doesn't change.
386  // //
387  // m_DevicePowerRequiredLock.Acquire(&irql);
388  // if (FALSE == m_DevicePowerRequired) {
389  // //
390  // // Send an event to the device power requirement state machine to tell
391  // // it that we are about to go to Dx.
392  // //
393  // // We send the event inside a lock in order to handle the race condition
394  // // when the power framework notifies us that device power is required at
395  // // the same time that we are about to go to Dx. By sending the event
396  // // inside the lock, we ensure that the DprEventDeviceGoingToDx event is
397  // // always queued to device power requirement state machine before the
398  // // DprEventPoxRequiresPower.
399  // //
400  // // This allows for a clean design in the device power requirement state
401  // // machine by ensuring that it does not have to handle a non-intuitive
402  // // sequence, i.e. DprEventPoxRequiresPower followed by
403  // // DprEventDeviceGoingToDx. This sequence is non-intuitive because it
404  // // doesn't make sense for a device to go to Dx after it has been
405  // // informed that device power is required. Avoiding this non-intuitive
406  // // sequence via locking enables a clean design for the device power
407  // // requirement state machine.
408  // //
409  // m_DevicePowerRequirementMachine->ProcessEvent(DprEventDeviceGoingToDx);
410  // canPowerOff = TRUE;
411 
412  // } else {
413  // canPowerOff = FALSE;
414  // }
415  // m_DevicePowerRequiredLock.Release(irql);
416 
417  // return canPowerOff ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
419  return STATUS_SUCCESS;
420 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ PkgPnp()

FxPkgPnp* FxPoxInterface::PkgPnp ( VOID  )
inline

Definition at line 39 of file fxpoxinterface.hpp.

42  {
43  return m_PkgPnp;
44  }
FxPkgPnp * m_PkgPnp

Referenced by FxPoxInterface(), and FxDevicePwrRequirementMachine::ProcessEventInner().

◆ PowerNotRequiredCallbackInvoked()

VOID FxPoxInterface::PowerNotRequiredCallbackInvoked ( VOID  )

Definition at line 106 of file poxinterfaceum.cpp.

109 {
110  //
111  // Notice that it is important that we first acknowledge the callback
112  // because once we queue an event in the state machine, the state machine
113  // could end up calling PoFxUnregister from the same thread
114  //
115  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxCompleteDevicePowerNotRequired();
116 
117  //
118  // The contract with the reflector is that the reflector guarantees to
119  // not send this event from the PoFx callback
120  //
121  PowerNotRequiredCallbackWorker(FALSE /* InvokedFromPoxCallback */);
122 
123  return;
124 }
__inline CfxDevice * GetDevice(VOID)
Definition: fxpackage.hpp:46
#define FALSE
Definition: types.h:117
IWudfDeviceStack2 * GetDeviceStack2(VOID)
Definition: fxdeviceum.hpp:444
FxPkgPnp * m_PkgPnp
VOID PowerNotRequiredCallbackWorker(__in BOOLEAN InvokedFromPoxCallback)

◆ PowerNotRequiredCallbackWorker()

VOID FxPoxInterface::PowerNotRequiredCallbackWorker ( __in BOOLEAN  InvokedFromPoxCallback)
private

Definition at line 567 of file poxinterface.cpp.

570 {
572  // KIRQL irql;
573 
574  // //
575  // // Make a note of the fact that device power is not required
576  // //
577  // m_DevicePowerRequiredLock.Acquire(&irql);
578  // m_DevicePowerRequired = FALSE;
579  // m_DevicePowerRequiredLock.Release(irql);
580 
581  // //
582  // // Send the device-power-not-required event to the device power
583  // // requirement state machine.
584  // //
585  // if (InvokedFromPoxCallback) {
586  // DprProcessEventFromPoxCallback(DprEventPoxDoesNotRequirePower);
587  // } else {
588  // m_DevicePowerRequirementMachine->ProcessEvent(
589  // DprEventPoxDoesNotRequirePower
590  // );
591  // }
592  // return;
593 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

Referenced by PowerNotRequiredCallbackInvoked().

◆ PowerRequiredCallbackInvoked()

VOID FxPoxInterface::PowerRequiredCallbackInvoked ( VOID  )

Definition at line 97 of file poxinterfaceum.cpp.

100 {
101  PowerRequiredCallbackWorker(FALSE /* InvokedFromPoxCallback */);
102  return;
103 }
VOID PowerRequiredCallbackWorker(__in BOOLEAN InvokedFromPoxCallback)
#define FALSE
Definition: types.h:117

◆ PowerRequiredCallbackWorker()

VOID FxPoxInterface::PowerRequiredCallbackWorker ( __in BOOLEAN  InvokedFromPoxCallback)
private

Definition at line 540 of file poxinterface.cpp.

543 {
545  // KIRQL irql;
546 
547  // //
548  // // Make a note of the fact that device power is required
549  // //
550  // m_DevicePowerRequiredLock.Acquire(&irql);
551  // m_DevicePowerRequired = TRUE;
552  // m_DevicePowerRequiredLock.Release(irql);
553 
554  // //
555  // // Send the device-power-required event to the device power requirement
556  // // state machine.
557  // //
558  // if (InvokedFromPoxCallback) {
559  // DprProcessEventFromPoxCallback(DprEventPoxRequiresPower);
560  // } else {
561  // m_DevicePowerRequirementMachine->ProcessEvent(DprEventPoxRequiresPower);
562  // }
563  // return;
564 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

Referenced by PowerRequiredCallbackInvoked().

◆ PoxActivateComponent()

VOID FxPoxInterface::PoxActivateComponent ( VOID  )
private

Definition at line 413 of file poxinterfacekm.cpp.

416 {
417  //
418  // We only support single component and don't
419  // need to set any flags
420  //
421  PoFxActivateComponent(m_PoHandle,
422  0, //component
423  0 //flags
424  );
425 }

◆ PoxIdleComponent()

VOID FxPoxInterface::PoxIdleComponent ( VOID  )
private

Definition at line 429 of file poxinterfacekm.cpp.

432 {
433  //
434  // We only support single component and don't
435  // need to set any flags
436  //
437  PoFxIdleComponent(m_PoHandle,
438  0, //component
439  0 //flags
440  );
441 }

◆ PoxRegisterDevice()

NTSTATUS FxPoxInterface::PoxRegisterDevice ( VOID  )
private

Definition at line 274 of file poxinterfacekm.cpp.

277 {
278 
280  PO_FX_DEVICE poxDevice;
281  PO_FX_COMPONENT_IDLE_STATE idleState;
282  PPOX_SETTINGS poxSettings = NULL;
283 
284  RtlZeroMemory(&poxDevice, sizeof(poxDevice));
285  RtlZeroMemory(&idleState, sizeof(idleState));
286 
287  poxDevice.Version = PO_FX_VERSION_V1;
288 
289  //
290  // Specify callbacks and context
291  //
292  poxDevice.ComponentIdleStateCallback =
298  poxDevice.DevicePowerRequiredCallback =
302  poxDevice.DeviceContext = this;
303 
304  //
305  // We register as a single component device
306  //
307  poxDevice.ComponentCount = 1;
308 
309  //
310  // If the client driver has specified power framework settings, retrieve
311  // them.
312  //
313  poxSettings = GetPowerFrameworkSettings();
314 
315  //
316  // We specify a power control callback only if the client driver supplies us
317  // a power control callback
318  //
319  poxDevice.PowerControlCallback =
320  ((NULL == poxSettings) || (NULL == poxSettings->PowerControlCallback)) ?
321  NULL :
323 
324  //
325  // If the client driver has specified any settings for component 0, use
326  // them. Otherwise use the default settings.
327  //
328  if ((NULL == poxSettings) || (NULL == poxSettings->Component)) {
329  //
330  // Default settings
331  //
332 
333  //
334  // We only support F0
335  //
336  poxDevice.Components[0].IdleStateCount = 1;
337 
338  //
339  // Transition latency should be 0 for F0
340  //
341  idleState.TransitionLatency = 0;
342 
343  //
344  // Residency requirement should be 0 for F0
345  //
346  idleState.ResidencyRequirement = 0;
347 
348  //
349  // The value doesn't matter because we do not support multiple F-states.
350  //
351  idleState.NominalPower = PO_FX_UNKNOWN_POWER;
352 
353  //
354  // Specify the state information for F0
355  //
356  poxDevice.Components[0].IdleStates = &idleState;
357  }
358  else {
359  //
360  // Client driver's settings
361  //
362  RtlCopyMemory(&(poxDevice.Components[0]),
363  poxSettings->Component,
364  sizeof(poxDevice.Components[0]));
365  }
366 
367  //
368  // Register with the power framework
369  //
370  status = PoFxRegisterDevice(
372  &poxDevice,
373  &(m_PoHandle)
374  );
375  if (FALSE == NT_SUCCESS(status)) {
379  "WDFDEVICE 0x%p !devobj 0x%p FxPox::PoxRegisterDevice failed. "
380  "%!STATUS!.",
383  status);
384  goto exit;
385  }
386 
388 
389 exit:
390  return status;
391 
392 }
__inline CfxDevice * GetDevice(VOID)
Definition: fxpackage.hpp:46
static PO_FX_DEVICE_POWER_NOT_REQUIRED_CALLBACK PowerNotRequiredCallback
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
PPO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK ComponentActiveConditionCallback
Definition: potypes.h:584
LONG NTSTATUS
Definition: precomp.h:26
PPO_FX_COMPONENT_IDLE_STATE_CALLBACK ComponentIdleStateCallback
Definition: potypes.h:586
PPO_FX_POWER_CONTROL_CALLBACK PowerControlCallback
Definition: potypes.h:589
#define FALSE
Definition: types.h:117
#define PO_FX_VERSION_V1
Definition: potypes.h:483
struct _POX_SETTINGS * GetPowerFrameworkSettings(VOID)
static PO_FX_DEVICE_POWER_REQUIRED_CALLBACK PowerRequiredCallback
static PO_FX_POWER_CONTROL_CALLBACK PowerControlCallback
ULONGLONG ResidencyRequirement
Definition: potypes.h:568
MdDeviceObject __inline GetPhysicalDevice(VOID)
Definition: fxdevice.hpp:228
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static PO_FX_COMPONENT_IDLE_STATE_CALLBACK StateCallback
PPO_FX_DEVICE_POWER_REQUIRED_CALLBACK DevicePowerRequiredCallback
Definition: potypes.h:587
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PVOID DeviceContext
Definition: potypes.h:590
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
PPO_FX_COMPONENT Component
PPO_FX_POWER_CONTROL_CALLBACK PowerControlCallback
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
ULONG ComponentCount
Definition: potypes.h:583
PPO_FX_DEVICE_POWER_NOT_REQUIRED_CALLBACK DevicePowerNotRequiredCallback
Definition: potypes.h:588
static PO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK ComponentActiveCallback
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
FxPkgPnp * m_PkgPnp
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
static PO_FX_COMPONENT_IDLE_CONDITION_CALLBACK ComponentIdleCallback
#define STATUS_SUCCESS
Definition: shellext.h:65
void exit(int exitcode)
Definition: _exit.c:33
static SERVICE_STATUS status
Definition: service.c:31
PPO_FX_COMPONENT_IDLE_CONDITION_CALLBACK ComponentIdleConditionCallback
Definition: potypes.h:585
Definition: ps.c:97

◆ PoxReportDevicePoweredOn()

VOID FxPoxInterface::PoxReportDevicePoweredOn ( VOID  )

Definition at line 445 of file poxinterfacekm.cpp.

448 {
449  PoFxReportDevicePoweredOn(m_PoHandle);
450 }

◆ PoxSetDeviceIdleTimeout()

VOID FxPoxInterface::PoxSetDeviceIdleTimeout ( __in ULONGLONG  IdleTimeout)
private

Definition at line 454 of file poxinterfacekm.cpp.

457 {
458  PoFxSetDeviceIdleTimeout(m_PoHandle, IdleTimeout);
459 }

◆ PoxStartDevicePowerManagement()

VOID FxPoxInterface::PoxStartDevicePowerManagement ( VOID  )
private

Definition at line 395 of file poxinterfacekm.cpp.

398 {
399  PoFxStartDevicePowerManagement(m_PoHandle);
400 }

◆ PoxUnregisterDevice()

VOID FxPoxInterface::PoxUnregisterDevice ( VOID  )
private

Definition at line 404 of file poxinterfacekm.cpp.

407 {
408  PoFxUnregisterDevice(m_PoHandle);
409 }

◆ RequestComponentActive()

VOID FxPoxInterface::RequestComponentActive ( VOID  )

Definition at line 288 of file poxinterface.cpp.

291 {
292  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
293  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
294  // //
295  // // Driver-managed idle timeout. Nothing to do.
296  // //
297  // return;
298  // }
299 
300  // PoxActivateComponent();
301  // return;
303 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ SimulateDevicePowerNotRequired()

VOID FxPoxInterface::SimulateDevicePowerNotRequired ( VOID  )

Definition at line 518 of file poxinterface.cpp.

521 {
523  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
524  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
525  // //
526  // // Driver-managed idle timeout. Nothing to do.
527  // //
528  // return;
529  // }
530 
531  // //
532  // // System-managed idle timeout. Notify the device power requirement state
533  // // machine that device power is not required.
534  // //
535  // PowerNotRequiredCallbackWorker(FALSE /* InvokedFromPoxCallback */);
536  // return;
537 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ SimulateDevicePowerRequired()

VOID FxPoxInterface::SimulateDevicePowerRequired ( VOID  )

Definition at line 496 of file poxinterface.cpp.

499 {
501  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
502  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
503  // //
504  // // Driver-managed idle timeout. Nothing to do.
505  // //
506  // return;
507  // }
508 
509  // //
510  // // System-managed idle timeout. Notify the device power requirement state
511  // // machine that device power is required.
512  // //
513  // PowerRequiredCallbackWorker(FALSE /* InvokedFromPoxCallback */);
514  // return;
515 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ UninitializeComponents()

VOID FxPoxInterface::UninitializeComponents ( VOID  )

Definition at line 237 of file poxinterface.cpp.

240 {
241  // PPOX_SETTINGS poxSettings = NULL;
242 
243  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
244  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
245  // //
246  // // Driver-managed idle timeout. Nothing to do.
247  // //
248  // return;
249  // }
250 
251  // ASSERT(NULL != m_DevicePowerRequirementMachine);
252 
253  // //
254  // // If the client driver has specified power framework settings, retrieve
255  // // them.
256  // //
257  // poxSettings = GetPowerFrameworkSettings();
258 
259  // //
260  // // Notify the client driver that the POHANDLE is about to become invalid
261  // //
262  // if ((NULL != poxSettings) &&
263  // (NULL != poxSettings->EvtDeviceWdmPrePoFxUnregisterDevice)) {
264 
265  // poxSettings->EvtDeviceWdmPrePoFxUnregisterDevice(
266  // m_PkgPnp->GetDevice()->GetHandle(),
267  // m_PoHandle
268  // );
269  // }
270 
271  // //
272  // // Unregister with the power framework
273  // //
274  // PoxUnregisterDevice();
275 
276  // //
277  // // Tell the device power requirement state machine that we have unregistered
278  // // with the power framework
279  // //
280  // m_DevicePowerRequirementMachine->ProcessEvent(
281  // DprEventUnregisteredWithPox
282  // );
283  // return;
285 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

◆ UpdateIdleTimeoutHint()

VOID FxPoxInterface::UpdateIdleTimeoutHint ( VOID  )

Definition at line 338 of file poxinterface.cpp.

341 {
342  // ULONGLONG idleTimeoutHint;
343 
344  // if (FALSE == m_PkgPnp->m_PowerPolicyMachine.m_Owner->m_IdleSettings.
345  // m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
346  // //
347  // // Driver-managed idle timeout. Nothing to do.
348  // //
349  // return;
350  // }
351 
352  // if (m_NextIdleTimeoutHint != m_CurrentIdleTimeoutHint) {
353  // m_CurrentIdleTimeoutHint = m_NextIdleTimeoutHint;
354 
355  // //
356  // // Convert the idle timeout from milliseconds to 100-nanosecond units
357  // //
358  // idleTimeoutHint = ((ULONGLONG) m_CurrentIdleTimeoutHint) * 10 * 1000;
359  // PoxSetDeviceIdleTimeout(idleTimeoutHint);
360  // }
361 
362  // return;
364 }
#define ROSWDFNOTIMPLEMENTED
Definition: fxglobals.h:52

Friends And Related Function Documentation

◆ FxDevicePwrRequirementMachine

Definition at line 11 of file fxpoxinterface.hpp.

Member Data Documentation

◆ ComponentActiveCallback

VOID FxPoxInterface::ComponentActiveCallback
staticprivate

Definition at line 158 of file fxpoxinterface.hpp.

Referenced by PoxRegisterDevice().

◆ ComponentIdleCallback

VOID FxPoxInterface::ComponentIdleCallback
staticprivate

Definition at line 159 of file fxpoxinterface.hpp.

Referenced by PoxRegisterDevice().

◆ m_CurrentIdleTimeoutHint

ULONG FxPoxInterface::m_CurrentIdleTimeoutHint
private

Definition at line 194 of file fxpoxinterface.hpp.

Referenced by FxPoxInterface().

◆ m_DevicePowerRequired

BOOLEAN FxPoxInterface::m_DevicePowerRequired
private

Definition at line 188 of file fxpoxinterface.hpp.

Referenced by FxPoxInterface().

◆ m_DevicePowerRequiredLock

MxLock FxPoxInterface::m_DevicePowerRequiredLock
private

Definition at line 189 of file fxpoxinterface.hpp.

◆ m_DevicePowerRequirementMachine

FxDevicePwrRequirementMachine* FxPoxInterface::m_DevicePowerRequirementMachine

◆ m_NextIdleTimeoutHint

ULONG FxPoxInterface::m_NextIdleTimeoutHint

Definition at line 174 of file fxpoxinterface.hpp.

Referenced by FxPoxInterface(), and FxPkgPnp::PowerPolicySetS0IdleSettings().

◆ m_PkgPnp

◆ m_PoHandle

◆ PowerControlCallback

PO_FX_POWER_CONTROL_CALLBACK FxPoxInterface::PowerControlCallback
staticprivate

Definition at line 162 of file fxpoxinterface.hpp.

Referenced by PoxRegisterDevice().

◆ PowerNotRequiredCallback

VOID FxPoxInterface::PowerNotRequiredCallback
staticprivate

Definition at line 161 of file fxpoxinterface.hpp.

Referenced by PoxRegisterDevice().

◆ PowerRequiredCallback

VOID FxPoxInterface::PowerRequiredCallback
staticprivate

Definition at line 160 of file fxpoxinterface.hpp.

Referenced by PoxRegisterDevice().

◆ StateCallback

VOID FxPoxInterface::StateCallback
staticprivate

Definition at line 157 of file fxpoxinterface.hpp.

Referenced by PoxRegisterDevice().


The documentation for this class was generated from the following files: