ReactOS 0.4.17-dev-1281-g065abb3
IdleMachine Class Reference

Posts run to completion under m_PostLock; IRP completion and callbacks run after it is dropped. More...

#include <idlesm.h>

Inheritance diagram for IdleMachine:
Collaboration diagram for IdleMachine:

Public Member Functions

VOID Initialize (_In_ HubPdo *Pdo)
 
NTSTATUS Post (_In_ IdleEvent Event, _In_opt_ PIRP Irp)
 Irp is the new idle IRP for RequestSubmitted, else NULL.
 
HubPdo * Pdo () const
 
PIRP HeldIrp () const
 
- Public Member Functions inherited from SmMachine< IdleMachine, IdleEvent >
VOID SmInitialize (_In_ const State *Initial)
 
BOOLEAN SmPost (_In_ IdleEvent Ev)
 
VOID SmContinueOnPassive ()
 
const State * SmCurrent () const
 
ULONG SmDepth () const
 
const State * SmFrame (_In_ ULONG Index) const
 
BOOLEAN SmIsIn (_In_ const State *Ancestor) const
 
BOOLEAN SmIsPaused () const
 
BOOLEAN SmIsWaitingForTimer () const
 
ULONG SmUnexpectedCount () const
 

Static Public Attributes

static const SM_EVENT_INFO EventInfo []
 

Private Types

enum  IDLE_FOLLOW_UP {
  FollowUpNone , FollowUpCompleteHeld , FollowUpRejectNew , FollowUpCallback ,
  FollowUpWorkItem
}
 
enum  IDLE_POWER_CHANGE { PowerUnchanged , PowerUp , PowerDown }
 

Private Member Functions

SM_RESULT OnStarting (_In_ IdleEvent Event)
 
SM_RESULT OnPresent (_In_ IdleEvent Event)
 
SM_RESULT OnNoRequest (_In_ IdleEvent Event)
 
SM_RESULT OnReady (_In_ IdleEvent Event)
 
SM_RESULT OnSuspendUnsupported (_In_ IdleEvent Event)
 
SM_RESULT OnParked (_In_ IdleEvent Event)
 
SM_RESULT OnHolding (_In_ IdleEvent Event)
 
SM_RESULT OnPending (_In_ IdleEvent Event)
 
SM_RESULT OnAwaitingWorkItem (_In_ IdleEvent Event)
 
SM_RESULT OnCallbackRunning (_In_ IdleEvent Event)
 
SM_RESULT OnAwaitingCancel (_In_ IdleEvent Event)
 
SM_RESULT OnRemoved (_In_ IdleEvent Event)
 
SM_RESULT OnCallbackRemoved (_In_ IdleEvent Event)
 
SM_RESULT OnAwaitingCancelRemoved (_In_ IdleEvent Event)
 
VOID FinishHeld (_In_ NTSTATUS Status)
 
VOID RejectNew (_In_ NTSTATUS Status)
 
VOID HoldNew ()
 
SM_RESULT Release (_In_ NTSTATUS Status)
 
SM_RESULT ReleaseForRemoval ()
 
SM_RESULT EndCallback ()
 
BOOLEAN SelectiveSuspendSupported ()
 
VOID MarkRequestPending (_In_ PIRP Irp)
 
BOOLEAN ArmCancel (_In_ PIRP Irp)
 
BOOLEAN DisarmCancel (_In_ PIRP Irp)
 
VOID QueueIdleWorkItem ()
 
VOID InvokeIdleCallback (_In_ PIRP Irp)
 
VOID CompleteIdleRequest (_In_ PIRP Irp, _In_ NTSTATUS Status)
 

Private Attributes

KSPIN_LOCK m_PostLock
 
HubPdo * m_Pdo
 
PIRP m_HeldIrp
 
PIRP m_NewIrp
 
NTSTATUS m_FollowUpStatus
 
IDLE_FOLLOW_UP m_FollowUp
 
IDLE_POWER_CHANGE m_PowerChange
 
BOOLEAN m_ReturnPending
 
BOOLEAN m_SuspendSupported
 
BOOLEAN m_CancelSeen
 

Static Private Attributes

static const State Starting
 
static const State Present
 
static const State NoRequest
 
static const State Ready
 
static const State SuspendUnsupported
 
static const State Parked
 
static const State Holding
 
static const State Pending
 
static const State AwaitingWorkItem
 
static const State CallbackDone
 
static const State CallbackRunning
 
static const State AwaitingCancel
 
static const State Removed
 
static const State Gone
 
static const State CallbackRemoved
 
static const State AwaitingCancelRemoved
 

Friends

class SmMachine< IdleMachine, IdleEvent >
 

Additional Inherited Members

- Public Types inherited from SmMachine< IdleMachine, IdleEvent >
typedef SmState< IdleMachine, IdleEvent > State
 
- Protected Member Functions inherited from SmMachine< IdleMachine, IdleEvent >
VOID SmBeginPause ()
 
VOID SmDiscardQueued (_In_ IdleEvent Ev)
 
BOOLEAN SmAccepts (_In_ IdleEvent Ev)
 
VOID SmReference ()
 
VOID SmDereference ()
 
VOID SmQueuePassive ()
 
VOID SmOnDequeue (_In_ IdleEvent Ev)
 
VOID SmStateChanged ()
 
BOOLEAN SmCancelTimer ()
 
- Static Protected Member Functions inherited from SmMachine< IdleMachine, IdleEvent >
static SM_RESULT SmMakeResult (_In_ SM_RESULT_KIND Kind, _In_ USHORT Ev, _In_opt_ const VOID *Target)
 
static SM_RESULT SmHandled ()
 
static SM_RESULT SmUnhandled ()
 
static SM_RESULT SmTransition (_In_ const State *Target)
 
static SM_RESULT SmPaused ()
 
static SM_RESULT SmCall (_In_ const State *Start)
 
static SM_RESULT SmReturn (_In_ IdleEvent Ev)
 
- Static Protected Attributes inherited from SmMachine< IdleMachine, IdleEvent >
static const BOOLEAN SmCompletionsFirst
 
static const USHORT SmTimerEventId
 

Detailed Description

Posts run to completion under m_PostLock; IRP completion and callbacks run after it is dropped.

Definition at line 43 of file idlesm.h.

Member Enumeration Documentation

◆ IDLE_FOLLOW_UP

Enumerator
FollowUpNone 
FollowUpCompleteHeld 
FollowUpRejectNew 
FollowUpCallback 
FollowUpWorkItem 

Definition at line 73 of file idlesm.h.

74 {
80 };
@ FollowUpCompleteHeld
Definition: idlesm.h:76
@ FollowUpNone
Definition: idlesm.h:75
@ FollowUpCallback
Definition: idlesm.h:78
@ FollowUpRejectNew
Definition: idlesm.h:77
@ FollowUpWorkItem
Definition: idlesm.h:79

◆ IDLE_POWER_CHANGE

Enumerator
PowerUnchanged 
PowerUp 
PowerDown 

Definition at line 82 of file idlesm.h.

83 {
85 PowerUp,
87 };
@ PowerUp
Definition: idlesm.h:85
@ PowerUnchanged
Definition: idlesm.h:84
@ PowerDown
Definition: idlesm.h:86

Member Function Documentation

◆ ArmCancel()

BOOLEAN IdleMachine::ArmCancel ( _In_ PIRP  Irp)
private

Definition at line 108 of file suspend.cpp.

110{
112
113 if (!Irp->Cancel)
114 return TRUE;
115
116 /* NULL here means the cancel routine already owns it and will post */
118 return TRUE;
119
120 DPRINT("Idle IRP %p was canceled before it was held\n", Irp);
121 return FALSE;
122}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
IoSetCancelRoutine(Irp, CancelRoutine)
_In_ PIRP Irp
Definition: kse.h:79
#define DPRINT
Definition: sndvol32.h:73
static VOID NTAPI HubIdleCancel(_Inout_ PDEVICE_OBJECT DeviceObject, _Inout_ _IRQL_uses_cancel_ PIRP Irp)
Definition: suspend.cpp:19

Referenced by OnReady(), and OnSuspendUnsupported().

◆ CompleteIdleRequest()

VOID IdleMachine::CompleteIdleRequest ( _In_ PIRP  Irp,
_In_ NTSTATUS  Status 
)
private

Definition at line 152 of file suspend.cpp.

155{
157 DPRINT("Idle IRP %p on port %u completed 0x%lx\n", Irp, m_Pdo->m_PortNumber, Status);
158 else
159 DPRINT1("Idle IRP %p on port %u failed 0x%lx\n", Irp, m_Pdo->m_PortNumber, Status);
160
161 Irp->IoStatus.Status = Status;
163}
#define DPRINT1
Definition: precomp.h:8
USHORT m_PortNumber
Definition: childpdo.h:58
HubPdo * m_Pdo
Definition: idlesm.h:194
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
#define IoCompleteRequest
Definition: irp.c:1272
#define STATUS_POWER_STATE_INVALID
Definition: ntstatus.h:957
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by Post().

◆ DisarmCancel()

BOOLEAN IdleMachine::DisarmCancel ( _In_ PIRP  Irp)
private

Definition at line 126 of file suspend.cpp.

128{
129 return IoSetCancelRoutine(Irp, NULL) != NULL;
130}

Referenced by Release(), and ReleaseForRemoval().

◆ EndCallback()

SM_RESULT IdleMachine::EndCallback ( )
private

Definition at line 220 of file idlesm.cpp.

221{
223
224 if (m_PowerChange == PowerUp)
226 else if (m_PowerChange == PowerDown)
228 else
230
231 if (m_CancelSeen)
232 {
234 return SmTransition(&Ready);
235 }
236
238 return SmTransition(&CallbackDone);
239
240 return Release(status);
241}
LONG NTSTATUS
Definition: precomp.h:26
_In_ BOOLEAN Release
Definition: cdrom.h:920
BOOLEAN m_CancelSeen
Definition: idlesm.h:202
IDLE_POWER_CHANGE m_PowerChange
Definition: idlesm.h:199
static const State CallbackDone
Definition: idlesm.h:99
VOID FinishHeld(_In_ NTSTATUS Status)
Definition: idlesm.cpp:171
static const State Ready
Definition: idlesm.h:93
static SM_RESULT SmTransition(_In_ const State *Target)
Definition: smengine.h:194
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ps.c:97

Referenced by OnCallbackRunning().

◆ FinishHeld()

VOID IdleMachine::FinishHeld ( _In_ NTSTATUS  Status)
private

◆ HeldIrp()

PIRP IdleMachine::HeldIrp ( ) const
inline

Definition at line 65 of file idlesm.h.

66 {
67 return m_HeldIrp;
68 }
PIRP m_HeldIrp
Definition: idlesm.h:195

◆ HoldNew()

VOID IdleMachine::HoldNew ( )
private

Definition at line 188 of file idlesm.cpp.

189{
191
194}
PIRP m_NewIrp
Definition: idlesm.h:196
VOID MarkRequestPending(_In_ PIRP Irp)
Definition: suspend.cpp:100
#define NT_ASSERT
Definition: rtlfuncs.h:3334

Referenced by OnReady(), and OnSuspendUnsupported().

◆ Initialize()

VOID IdleMachine::Initialize ( _In_ HubPdo *  Pdo)

Definition at line 87 of file idlesm.cpp.

89{
91 m_Pdo = Pdo;
93 m_NewIrp = NULL;
100
102}
BOOLEAN m_SuspendSupported
Definition: idlesm.h:201
BOOLEAN m_ReturnPending
Definition: idlesm.h:200
HubPdo * Pdo() const
Definition: idlesm.h:58
KSPIN_LOCK m_PostLock
Definition: idlesm.h:193
static const State Starting
Definition: idlesm.h:90
VOID SmInitialize(_In_ const State *Initial)
Definition: smengine.h:349
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define STATUS_PENDING
Definition: telnetd.h:14

◆ InvokeIdleCallback()

VOID IdleMachine::InvokeIdleCallback ( _In_ PIRP  Irp)
private

Definition at line 140 of file suspend.cpp.

142{
144 PUSB_IDLE_CALLBACK_INFO Info = (PUSB_IDLE_CALLBACK_INFO)Stack->Parameters.DeviceIoControl.Type3InputBuffer;
145
146 DPRINT("Calling idle callback of port %u\n", m_Pdo->m_PortNumber);
147 Info->IdleCallback(Info->IdleContext);
148}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639

Referenced by Post().

◆ MarkRequestPending()

VOID IdleMachine::MarkRequestPending ( _In_ PIRP  Irp)
private

Definition at line 100 of file suspend.cpp.

102{
104}
IoMarkIrpPending(Irp)

Referenced by HoldNew().

◆ OnAwaitingCancel()

SM_RESULT IdleMachine::OnAwaitingCancel ( _In_ IdleEvent  Event)
private

Definition at line 426 of file idlesm.cpp.

428{
429 switch (Event)
430 {
431 case IdleEvent::RequestCanceled:
433 return SmTransition(&Ready);
434
435 case IdleEvent::Cleanup:
437
438 default:
439 return SmUnhandled();
440 }
441}
static const State AwaitingCancelRemoved
Definition: idlesm.h:105
static SM_RESULT SmUnhandled()
Definition: smengine.h:188
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287

◆ OnAwaitingCancelRemoved()

SM_RESULT IdleMachine::OnAwaitingCancelRemoved ( _In_ IdleEvent  Event)
private

Definition at line 474 of file idlesm.cpp.

476{
477 if (Event != IdleEvent::RequestCanceled)
478 return SmUnhandled();
479
481 return SmTransition(&Gone);
482}
static const State Gone
Definition: idlesm.h:103
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136

◆ OnAwaitingWorkItem()

SM_RESULT IdleMachine::OnAwaitingWorkItem ( _In_ IdleEvent  Event)
private

Definition at line 382 of file idlesm.cpp.

384{
385 if (Event != IdleEvent::WorkItemRan)
386 return SmUnhandled();
387
392}
static const State CallbackRunning
Definition: idlesm.h:100

◆ OnCallbackRemoved()

SM_RESULT IdleMachine::OnCallbackRemoved ( _In_ IdleEvent  Event)
private

Definition at line 464 of file idlesm.cpp.

466{
467 if (Event == IdleEvent::ClientCallbackFinished)
468 return SmTransition(&Gone);
469
470 return SmUnhandled();
471}

◆ OnCallbackRunning()

SM_RESULT IdleMachine::OnCallbackRunning ( _In_ IdleEvent  Event)
private

Definition at line 395 of file idlesm.cpp.

397{
398 switch (Event)
399 {
400 case IdleEvent::ClientCallbackFinished:
401 return EndCallback();
402
403 case IdleEvent::PoweredUp:
404 case IdleEvent::PoweringDown:
406 m_PowerChange = (Event == IdleEvent::PoweredUp) ? PowerUp : PowerDown;
407 return SmHandled();
408
409 case IdleEvent::RequestCanceled:
410 /* A second cancel is not expected */
411 if (m_CancelSeen)
412 return SmUnhandled();
413
415 return SmHandled();
416
417 case IdleEvent::Cleanup:
419
420 default:
421 return SmUnhandled();
422 }
423}
SM_RESULT EndCallback()
Definition: idlesm.cpp:220
static const State CallbackRemoved
Definition: idlesm.h:104
static SM_RESULT SmHandled()
Definition: smengine.h:182

◆ OnHolding()

SM_RESULT IdleMachine::OnHolding ( _In_ IdleEvent  Event)
private

Definition at line 340 of file idlesm.cpp.

342{
343 switch (Event)
344 {
345 case IdleEvent::RequestSubmitted:
347 return SmHandled();
348
349 case IdleEvent::WorkItemRan:
350 return SmHandled();
351
352 default:
353 return SmUnhandled();
354 }
355}
VOID RejectNew(_In_ NTSTATUS Status)
Definition: idlesm.cpp:180
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129

◆ OnNoRequest()

SM_RESULT IdleMachine::OnNoRequest ( _In_ IdleEvent  Event)
private

Definition at line 265 of file idlesm.cpp.

267{
268 if (Event == IdleEvent::Cleanup)
269 return SmTransition(&Gone);
270
271 return SmUnhandled();
272}

◆ OnParked()

SM_RESULT IdleMachine::OnParked ( _In_ IdleEvent  Event)
private

Definition at line 318 of file idlesm.cpp.

320{
321 switch (Event)
322 {
323 case IdleEvent::RequestSubmitted:
325 return SmHandled();
326
327 case IdleEvent::RequestCanceled:
330
331 case IdleEvent::Cleanup:
332 return ReleaseForRemoval();
333
334 default:
335 return SmUnhandled();
336 }
337}
SM_RESULT ReleaseForRemoval()
Definition: idlesm.cpp:209
static const State SuspendUnsupported
Definition: idlesm.h:94

◆ OnPending()

SM_RESULT IdleMachine::OnPending ( _In_ IdleEvent  Event)
private

Definition at line 358 of file idlesm.cpp.

360{
361 switch (Event)
362 {
363 case IdleEvent::RequestCanceled:
365 return SmTransition(&Ready);
366
367 case IdleEvent::PoweredUp:
368 return Release(STATUS_SUCCESS);
369
370 case IdleEvent::PoweringDown:
372
373 case IdleEvent::Cleanup:
374 return ReleaseForRemoval();
375
376 default:
377 return SmUnhandled();
378 }
379}

◆ OnPresent()

SM_RESULT IdleMachine::OnPresent ( _In_ IdleEvent  Event)
private

Definition at line 255 of file idlesm.cpp.

257{
258 if (Event == IdleEvent::PoweredUp || Event == IdleEvent::PoweringDown)
259 return SmHandled();
260
261 return SmUnhandled();
262}

◆ OnReady()

SM_RESULT IdleMachine::OnReady ( _In_ IdleEvent  Event)
private

Definition at line 275 of file idlesm.cpp.

277{
278 switch (Event)
279 {
280 case IdleEvent::RequestSubmitted:
281 HoldNew();
282 if (ArmCancel(m_HeldIrp))
283 {
286 }
287
288 /* Already canceled; the IRP was marked pending, so return pending */
291 return SmHandled();
292
293 case IdleEvent::RequestCanceled:
294 case IdleEvent::WorkItemRan:
295 return SmHandled();
296
297 default:
298 return SmUnhandled();
299 }
300}
VOID HoldNew()
Definition: idlesm.cpp:188
BOOLEAN ArmCancel(_In_ PIRP Irp)
Definition: suspend.cpp:108
static const State AwaitingWorkItem
Definition: idlesm.h:98

◆ OnRemoved()

SM_RESULT IdleMachine::OnRemoved ( _In_ IdleEvent  Event)
private

Definition at line 444 of file idlesm.cpp.

446{
447 switch (Event)
448 {
449 case IdleEvent::RequestSubmitted:
451 return SmHandled();
452
453 case IdleEvent::RequestCanceled:
454 case IdleEvent::WorkItemRan:
455 return SmHandled();
456
457 default:
458 return SmUnhandled();
459 }
460}

◆ OnStarting()

SM_RESULT IdleMachine::OnStarting ( _In_ IdleEvent  Event)
private

Definition at line 244 of file idlesm.cpp.

246{
247 if (Event != IdleEvent::Start)
248 return SmUnhandled();
249
252}
BOOLEAN SelectiveSuspendSupported()
Definition: suspend.cpp:88

◆ OnSuspendUnsupported()

SM_RESULT IdleMachine::OnSuspendUnsupported ( _In_ IdleEvent  Event)
private

Definition at line 303 of file idlesm.cpp.

305{
306 if (Event != IdleEvent::RequestSubmitted)
307 return SmUnhandled();
308
309 HoldNew();
310 if (ArmCancel(m_HeldIrp))
311 return SmTransition(&Parked);
312
314 return SmHandled();
315}
static const State Parked
Definition: idlesm.h:95

◆ Pdo()

HubPdo * IdleMachine::Pdo ( ) const
inline

Definition at line 58 of file idlesm.h.

59 {
60 return m_Pdo;
61 }

Referenced by Initialize().

◆ Post()

NTSTATUS IdleMachine::Post ( _In_ IdleEvent  Event,
_In_opt_ PIRP  Irp 
)

Irp is the new idle IRP for RequestSubmitted, else NULL.

Returns
STATUS_PENDING, or the status the IRP of this post was completed with.

Definition at line 112 of file idlesm.cpp.

115{
116 IDLE_FOLLOW_UP followUp;
117 PIRP finished = NULL;
118 PIRP callbackIrp = NULL;
120 BOOLEAN MustPend;
121 KIRQL irql;
122
124
125 m_NewIrp = Irp;
129
130 SmPost(Event);
131
132 followUp = m_FollowUp;
134 MustPend = m_ReturnPending;
135
136 if (followUp == FollowUpCompleteHeld)
137 {
138 finished = m_HeldIrp;
139 m_HeldIrp = NULL;
140 }
141 else if (followUp == FollowUpRejectNew)
142 {
143 finished = Irp;
144 }
145 else if (followUp == FollowUpCallback)
146 {
147 callbackIrp = m_HeldIrp;
148 }
149
150 m_NewIrp = NULL;
152
153 if (followUp == FollowUpCallback)
154 {
155 InvokeIdleCallback(callbackIrp);
156 Post(IdleEvent::ClientCallbackFinished, NULL);
157 }
158 else if (followUp == FollowUpWorkItem)
159 {
161 }
162
163 if (finished != NULL)
164 CompleteIdleRequest(finished, status);
165
166 return MustPend ? STATUS_PENDING : status;
167}
unsigned char BOOLEAN
Definition: actypes.h:127
NTSTATUS Post(_In_ IdleEvent Event, _In_opt_ PIRP Irp)
Irp is the new idle IRP for RequestSubmitted, else NULL.
Definition: idlesm.cpp:112
VOID QueueIdleWorkItem()
Definition: suspend.cpp:134
IDLE_FOLLOW_UP
Definition: idlesm.h:74
VOID CompleteIdleRequest(_In_ PIRP Irp, _In_ NTSTATUS Status)
Definition: suspend.cpp:152
VOID InvokeIdleCallback(_In_ PIRP Irp)
Definition: suspend.cpp:140
BOOLEAN SmPost(_In_ IdleEvent Ev)
Definition: smengine.h:370
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609

Referenced by Post().

◆ QueueIdleWorkItem()

VOID IdleMachine::QueueIdleWorkItem ( )
private

Definition at line 134 of file suspend.cpp.

135{
137}
WDFWORKITEM m_IdleWorkItem
Definition: childpdo.h:107
WdfWorkItemEnqueue(WorkItem)

Referenced by Post().

◆ RejectNew()

VOID IdleMachine::RejectNew ( _In_ NTSTATUS  Status)
private

Definition at line 180 of file idlesm.cpp.

Referenced by OnHolding(), OnParked(), and OnRemoved().

◆ Release()

SM_RESULT IdleMachine::Release ( _In_ NTSTATUS  Status)
private

Definition at line 198 of file idlesm.cpp.

200{
203
205 return SmTransition(&Ready);
206}
BOOLEAN DisarmCancel(_In_ PIRP Irp)
Definition: suspend.cpp:126
static const State AwaitingCancel
Definition: idlesm.h:101

◆ ReleaseForRemoval()

SM_RESULT IdleMachine::ReleaseForRemoval ( )
private

Definition at line 209 of file idlesm.cpp.

210{
213
215 return SmTransition(&Gone);
216}

Referenced by OnParked(), and OnPending().

◆ SelectiveSuspendSupported()

BOOLEAN IdleMachine::SelectiveSuspendSupported ( )
private

Definition at line 88 of file suspend.cpp.

89{
90 if (m_Pdo->m_Hub->HasFlag(HubFlag::ParentNoSelectiveSuspend))
91 {
92 DPRINT("Port %u: parent stack has no selective suspend\n", m_Pdo->m_PortNumber);
93 return FALSE;
94 }
95
96 return TRUE;
97}
BOOLEAN HasFlag(_In_ HubFlag Flag) const
Definition: fdo.h:153
HubFdo * m_Hub
Definition: childpdo.h:56

Referenced by OnStarting().

Friends And Related Function Documentation

◆ SmMachine< IdleMachine, IdleEvent >

friend class SmMachine< IdleMachine, IdleEvent >
friend

Definition at line 1 of file idlesm.h.

Member Data Documentation

◆ AwaitingCancel

const IdleMachine::State IdleMachine::AwaitingCancel
staticprivate
Initial value:
=
{ &Holding, "AwaitingCancel", 0, &IdleMachine::OnAwaitingCancel, NULL }
static const State Holding
Definition: idlesm.h:96
SM_RESULT OnAwaitingCancel(_In_ IdleEvent Event)
Definition: idlesm.cpp:426

Definition at line 101 of file idlesm.h.

Referenced by Release().

◆ AwaitingCancelRemoved

const IdleMachine::State IdleMachine::AwaitingCancelRemoved
staticprivate
Initial value:
=
{ &Removed, "AwaitingCancelRemoved", 0, &IdleMachine::OnAwaitingCancelRemoved, NULL }
SM_RESULT OnAwaitingCancelRemoved(_In_ IdleEvent Event)
Definition: idlesm.cpp:474
static const State Removed
Definition: idlesm.h:102

Definition at line 105 of file idlesm.h.

Referenced by OnAwaitingCancel(), and ReleaseForRemoval().

◆ AwaitingWorkItem

const IdleMachine::State IdleMachine::AwaitingWorkItem
staticprivate
Initial value:
=
{ &Pending, "AwaitingWorkItem", 0, &IdleMachine::OnAwaitingWorkItem, NULL }
static const State Pending
Definition: idlesm.h:97
SM_RESULT OnAwaitingWorkItem(_In_ IdleEvent Event)
Definition: idlesm.cpp:382

Definition at line 98 of file idlesm.h.

Referenced by OnReady().

◆ CallbackDone

const IdleMachine::State IdleMachine::CallbackDone
staticprivate
Initial value:
=
{ &Pending, "CallbackDone", 0, NULL, NULL }

Definition at line 99 of file idlesm.h.

Referenced by EndCallback().

◆ CallbackRemoved

const IdleMachine::State IdleMachine::CallbackRemoved
staticprivate
Initial value:
=
{ &Removed, "CallbackRemoved", 0, &IdleMachine::OnCallbackRemoved, NULL }
SM_RESULT OnCallbackRemoved(_In_ IdleEvent Event)
Definition: idlesm.cpp:464

Definition at line 104 of file idlesm.h.

Referenced by OnCallbackRunning().

◆ CallbackRunning

const IdleMachine::State IdleMachine::CallbackRunning
staticprivate
Initial value:
=
{ &Holding, "CallbackRunning", 0, &IdleMachine::OnCallbackRunning, NULL }
SM_RESULT OnCallbackRunning(_In_ IdleEvent Event)
Definition: idlesm.cpp:395

Definition at line 100 of file idlesm.h.

Referenced by OnAwaitingWorkItem().

◆ EventInfo

const SM_EVENT_INFO IdleMachine::EventInfo
static
Initial value:
=
{
{ "Start", SmEventCompletion, FALSE },
{ "RequestSubmitted", SmEventCompletion, FALSE },
{ "RequestCanceled", SmEventCompletion, FALSE },
{ "WorkItemRan", SmEventCompletion, FALSE },
{ "ClientCallbackFinished", SmEventCompletion, FALSE },
{ "PoweredUp", SmEventCompletion, FALSE },
{ "PoweringDown", SmEventCompletion, FALSE },
{ "Cleanup", SmEventCompletion, FALSE },
}
@ SmEventCompletion
Definition: smengine.h:24

Definition at line 70 of file idlesm.h.

◆ Gone

const IdleMachine::State IdleMachine::Gone
staticprivate
Initial value:
=
{ &Removed, "Gone", 0, NULL, NULL }

Definition at line 103 of file idlesm.h.

Referenced by OnAwaitingCancelRemoved(), OnCallbackRemoved(), OnNoRequest(), and ReleaseForRemoval().

◆ Holding

const IdleMachine::State IdleMachine::Holding
staticprivate
Initial value:
=
{ &Present, "Holding", 0, &IdleMachine::OnHolding, NULL }
static const State Present
Definition: idlesm.h:91
SM_RESULT OnHolding(_In_ IdleEvent Event)
Definition: idlesm.cpp:340

Definition at line 96 of file idlesm.h.

◆ m_CancelSeen

BOOLEAN IdleMachine::m_CancelSeen
private

Definition at line 202 of file idlesm.h.

Referenced by EndCallback(), Initialize(), OnAwaitingWorkItem(), and OnCallbackRunning().

◆ m_FollowUp

IDLE_FOLLOW_UP IdleMachine::m_FollowUp
private

Definition at line 198 of file idlesm.h.

Referenced by FinishHeld(), Initialize(), OnAwaitingWorkItem(), OnReady(), Post(), and RejectNew().

◆ m_FollowUpStatus

NTSTATUS IdleMachine::m_FollowUpStatus
private

Definition at line 197 of file idlesm.h.

Referenced by FinishHeld(), Initialize(), Post(), and RejectNew().

◆ m_HeldIrp

PIRP IdleMachine::m_HeldIrp
private

◆ m_NewIrp

PIRP IdleMachine::m_NewIrp
private

Definition at line 196 of file idlesm.h.

Referenced by HoldNew(), Initialize(), and Post().

◆ m_Pdo

HubPdo* IdleMachine::m_Pdo
private

◆ m_PostLock

KSPIN_LOCK IdleMachine::m_PostLock
private

Definition at line 193 of file idlesm.h.

Referenced by Initialize(), and Post().

◆ m_PowerChange

IDLE_POWER_CHANGE IdleMachine::m_PowerChange
private

Definition at line 199 of file idlesm.h.

Referenced by EndCallback(), Initialize(), OnAwaitingWorkItem(), and OnCallbackRunning().

◆ m_ReturnPending

BOOLEAN IdleMachine::m_ReturnPending
private

Definition at line 200 of file idlesm.h.

Referenced by Initialize(), OnReady(), and Post().

◆ m_SuspendSupported

BOOLEAN IdleMachine::m_SuspendSupported
private

Definition at line 201 of file idlesm.h.

Referenced by Initialize(), and OnStarting().

◆ NoRequest

const IdleMachine::State IdleMachine::NoRequest
staticprivate
Initial value:
=
{ &Present, "NoRequest", 0, &IdleMachine::OnNoRequest, NULL }
SM_RESULT OnNoRequest(_In_ IdleEvent Event)
Definition: idlesm.cpp:265

Definition at line 92 of file idlesm.h.

◆ Parked

const IdleMachine::State IdleMachine::Parked
staticprivate
Initial value:
=
{ &Present, "Parked", 0, &IdleMachine::OnParked, NULL }
SM_RESULT OnParked(_In_ IdleEvent Event)
Definition: idlesm.cpp:318

Definition at line 95 of file idlesm.h.

Referenced by OnSuspendUnsupported().

◆ Pending

const IdleMachine::State IdleMachine::Pending
staticprivate
Initial value:
=
{ &Holding, "Pending", 0, &IdleMachine::OnPending, NULL }
SM_RESULT OnPending(_In_ IdleEvent Event)
Definition: idlesm.cpp:358

Definition at line 97 of file idlesm.h.

◆ Present

const IdleMachine::State IdleMachine::Present
staticprivate
Initial value:
=
{ NULL, "Present", 0, &IdleMachine::OnPresent, NULL }
SM_RESULT OnPresent(_In_ IdleEvent Event)
Definition: idlesm.cpp:255

Definition at line 91 of file idlesm.h.

◆ Ready

const IdleMachine::State IdleMachine::Ready
staticprivate
Initial value:
=
{ &NoRequest, "Ready", 0, &IdleMachine::OnReady, NULL }
SM_RESULT OnReady(_In_ IdleEvent Event)
Definition: idlesm.cpp:275
static const State NoRequest
Definition: idlesm.h:92

Definition at line 93 of file idlesm.h.

Referenced by EndCallback(), OnAwaitingCancel(), OnPending(), OnStarting(), and Release().

◆ Removed

const IdleMachine::State IdleMachine::Removed
staticprivate
Initial value:
=
{ NULL, "Removed", 0, &IdleMachine::OnRemoved, NULL }
SM_RESULT OnRemoved(_In_ IdleEvent Event)
Definition: idlesm.cpp:444

Definition at line 102 of file idlesm.h.

◆ Starting

const IdleMachine::State IdleMachine::Starting
staticprivate
Initial value:
=
{ NULL, "Starting", 0, &IdleMachine::OnStarting, NULL }
SM_RESULT OnStarting(_In_ IdleEvent Event)
Definition: idlesm.cpp:244

Definition at line 90 of file idlesm.h.

Referenced by Initialize().

◆ SuspendUnsupported

const IdleMachine::State IdleMachine::SuspendUnsupported
staticprivate
Initial value:
=
{ &NoRequest, "SuspendUnsupported", 0, &IdleMachine::OnSuspendUnsupported, NULL }
SM_RESULT OnSuspendUnsupported(_In_ IdleEvent Event)
Definition: idlesm.cpp:303

Definition at line 94 of file idlesm.h.

Referenced by OnParked(), and OnStarting().


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