ReactOS 0.4.17-dev-1281-g065abb3
portsm.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS USB Hub Driver
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Port state machine: event table, engine hooks, shared steps
5 * and the states used while the hub is not running
6 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "usbhub3.h"
12
13/* GLOBALS ********************************************************************/
14
16{
17 { "TimerExpired", SmEventCompletion, FALSE, FALSE },
18 { "ResetPollExpired", SmEventCritical, FALSE, FALSE },
19 { "TransferDone", SmEventCritical, FALSE, FALSE },
20 { "TransferFailed", SmEventCritical, FALSE, FALSE },
21 { "PortCleanup", SmEventCompletion, FALSE, FALSE },
22 { "HubStarted", SmEventCompletion, FALSE, FALSE },
23 { "HubResumed", SmEventCompletion, FALSE, FALSE },
24 { "HubResumedInS0", SmEventCompletion, FALSE, FALSE },
25 { "HubResumedWithReset", SmEventCompletion, FALSE, FALSE },
26 { "HubStopping", SmEventCompletion, FALSE, FALSE },
27 { "HubSuspending", SmEventCompletion, FALSE, FALSE },
28 { "HubResetting", SmEventCompletion, FALSE, FALSE },
29 { "StatusChanged", SmEventCompletion, FALSE, FALSE },
30 { "HubRemoved", SmEventCompletion, FALSE, FALSE },
31 { "UserOverCurrentReset", SmEventCompletion, FALSE, FALSE },
32 { "DeviceGone", SmEventCompletion, FALSE, FALSE },
33 { "HibernateRequest", SmEventRequest, FALSE, FALSE },
34 { "CycleRequest", SmEventRequest, FALSE, FALSE },
35 { "DisableRequest", SmEventRequest, FALSE, FALSE },
36 { "DisableSuperSpeedRequest", SmEventRequest, FALSE, FALSE },
37 { "ResetRequest", SmEventRequest, FALSE, FALSE },
38 { "WarmResetRequest", SmEventRequest, FALSE, FALSE },
39 { "ResumeRequest", SmEventRequest, FALSE, FALSE },
40 { "SuspendRequest", SmEventRequest, FALSE, FALSE },
41 { "SetU1Timeout", SmEventRequest, FALSE, TRUE },
42 { "SetU2Timeout", SmEventRequest, FALSE, TRUE },
43 { "ChangeConnect", SmEventCompletion, FALSE, FALSE },
44 { "ChangeOverCurrent", SmEventCompletion, FALSE, FALSE },
45 { "ChangeOverCurrentCleared", SmEventCompletion, FALSE, FALSE },
46 { "ChangeResetDone", SmEventCompletion, FALSE, FALSE },
47 { "ChangeResumed", SmEventCompletion, FALSE, FALSE },
48 { "ChangeDisabled", SmEventCompletion, FALSE, FALSE },
49 { "ChangeError", SmEventCompletion, FALSE, FALSE },
50 { "ChangeLinkError", SmEventCompletion, FALSE, FALSE },
51 { "ChangeNone", SmEventCompletion, FALSE, FALSE },
52 { "ChangeResetBusy", SmEventCompletion, FALSE, FALSE },
53 { "ChangeNeedsHubReset", SmEventCompletion, FALSE, FALSE },
54 { "ChangeNeedsReset", SmEventCompletion, FALSE, FALSE },
55 { "ErrorIgnore", SmEventCompletion, FALSE, FALSE },
56 { "ErrorCycle", SmEventCompletion, FALSE, FALSE },
57 { "ErrorDisableAndCycle", SmEventCompletion, FALSE, FALSE },
58 { "ErrorEnabledOnConnect", SmEventCompletion, FALSE, FALSE },
59 { "ErrorEnabledWhileReset", SmEventCompletion, FALSE, FALSE },
60 { "SubDone", SmEventCompletion, FALSE, FALSE },
61};
62
63static_assert(RTL_NUMBER_OF(PortMachine::EventInfo) == static_cast<ULONG>(PortEvent::Count),
64 "EventInfo must have one entry per PortEvent");
65
66/* Device requests a port drops while it has nothing to do with them */
67static const PortEvent IdleRequests[] =
68{
74};
75
77{
82};
83
85{
87};
88
90{
92};
93
94static const PortEvent GoneOnly[] =
95{
97};
98
99/* Hub is stopped or suspended, the port only waits for the hub to come back */
102
103/* Where a new port starts: OffEmpty without its entry having run */
105 { &Off, "OffInitial", 0, &PortMachine::OnOffEmpty, NULL, IdleRequests };
106
109
111 { &Off, "OffAttached", 0, &PortMachine::OnOffAttached, NULL, OffAttachedDrops };
112
113/* 3.0 port whose device went away while the port still needs a reset */
115 { &Off, "OffResetNeeded", 0, &PortMachine::OnOffResetNeeded, NULL, IdleRequests };
116
118 { &Off, "OffSuperSpeedDisabled", 0,
120
122 { &Off, "OffSuspendedUsb3", 0,
124
125/* A suspended 2.0 port behind a suspended hub leaves device requests queued */
127 { NULL, "OffSuspendedUsb2", PSM_STATE_IDLE,
129
132
134 { NULL, "Deleted", PSM_STATE_IDLE_USB2, NULL, NULL, GoneOnly };
135
136/* Transient, hands m_ReturnEvent to the frame that called this one */
138 { NULL, "Returning", 0, NULL, &PortMachine::EnterReturning, NULL };
139
140/* FUNCTIONS ******************************************************************/
141
142VOID
145 _In_ BOOLEAN SuperSpeed)
146{
147 m_Port = Port;
148 m_Usb3 = SuperSpeed;
154 m_SuspendReport = PortEvent::ChangeError;
155 m_D3FlushReturn = PortEvent::HubStopping;
156 m_ReturnEvent = PortEvent::SubDone;
160 m_LpmU2 = FALSE;
167
169}
170
171/* ENGINE HOOKS ***************************************************************/
172
173VOID
175{
177}
178
179VOID
181{
183}
184
185VOID
187{
189}
190
191VOID
194{
195 if (Event == PortEvent::DeviceGone)
197}
198
199static
201NTAPI
205{
206 for (; Target != NULL; Target = Target->Parent)
207 {
208 if (Target->Flags & Flag)
209 return TRUE;
210 }
211
212 return FALSE;
213}
214
217 _In_ const State* Target) const
218{
220}
221
226VOID
228{
229 ULONG frame = SmDepth();
230
231 while ((frame > 0) && PsmHasFlag(SmFrame(frame), SM_STATE_YIELDS_TO_CALLER))
232 frame -= 1;
233
235}
236
237VOID
240{
241 if (Idle)
242 {
243 if (m_HubPowerHeld)
244 {
245 HubPowerDrop();
247 }
248 }
249 else if (!m_HubPowerHeld && HubPowerTake())
250 {
252 }
253}
254
255/* Work done in code that used to pass through a busy state */
256VOID
258{
260}
261
262/* SHARED STEPS ***************************************************************/
263
266 _In_ const State* Target)
267{
269 return SmTransition(Target);
270}
271
274 _In_ const State* Target)
275{
277 return SmTransition(Target);
278}
279
282 _In_ const State* Target)
283{
285 return SmTransition(Target);
286}
287
291{
293 return SmTransition(&Returning);
294}
295
298{
299 return SmReturn(m_ReturnEvent);
300}
301
302/* Something may be on the empty port, look before debouncing */
305{
306 if (!m_Usb3)
308
309 if (!DevicePresent())
310 return SmTransition(&Disconnected);
311
313}
314
318{
319 if (OldDevicePresent())
320 {
321 m_OldDevice = Kind;
323 }
324
325 return DeviceArrived(Kind);
326}
327
335{
336 static const PortEvent Stale20[] =
337 {
338 PortEvent::ResumeRequest, PortEvent::DisableRequest, PortEvent::CycleRequest,
339 PortEvent::SuspendRequest, PortEvent::ResetRequest, PortEvent::HibernateRequest
340 };
341 static const PortEvent Stale30[] =
342 {
343 PortEvent::WarmResetRequest, PortEvent::HibernateRequest, PortEvent::ResetRequest,
344 PortEvent::CycleRequest, PortEvent::ResumeRequest, PortEvent::DeviceGone,
345 PortEvent::SetU1Timeout, PortEvent::SuspendRequest, PortEvent::DisableRequest,
346 PortEvent::SetU2Timeout, PortEvent::DisableSuperSpeedRequest
347 };
348 ULONG index;
349
350 if (!m_Usb3)
351 {
352 for (index = 0; index < RTL_NUMBER_OF(Stale20); index++)
353 SmDiscardQueued(Stale20[index]);
354
356 {
359 }
360
361 if (!CreateDevice())
363
365 if (!ConnectDevice())
367
369 }
370
371 for (index = 0; index < RTL_NUMBER_OF(Stale30); index++)
372 SmDiscardQueued(Stale30[index]);
373
374 if ((Kind == OldDevicePlain) && NeedsDebounce())
376
377 return ReattachOrCreate(Kind);
378}
379
383{
385 {
388 }
389
390 if (Kind == OldDeviceResetInProgress)
391 {
392 /* The previous table retried here until creation worked */
393 while (!CreateDevice())
394 NOTHING;
395 }
396 else if (!CreateDevice())
397 {
398 return CheckOldDevice(Kind);
399 }
400
401 if (Kind != OldDevicePlain)
403
405 if (!ConnectDevice())
406 {
409 }
410
411 if (Kind == OldDevicePlain)
412 return SmTransition(&Enabled);
413
415}
416
419{
422}
423
424/* A port change on an attached port without a running timer */
428{
430
431 if (Change == PortEvent::ChangeOverCurrent)
432 return StartOverCurrentWait();
433
434 if (Change == PortEvent::ChangeOverCurrentCleared)
435 return SmTransition(&PoweringPort);
436
437 return CheckConnection();
438}
439
440/* Same, while the port holds an interrupt reference and runs a timer */
444{
445 if ((Change != PortEvent::ChangeOverCurrentCleared) && !m_Usb3)
446 {
449 }
450 else
451 {
454 }
455
456 if (Change == PortEvent::ChangeOverCurrent)
458
459 if (Change == PortEvent::ChangeOverCurrentCleared)
461
463}
464
467{
471}
472
475 _In_ TIMER_FOLLOW_UP FollowUp)
476{
477 if (StopTimer())
478 return FollowTimer(FollowUp);
479
480 m_AfterTimer = FollowUp;
481 return SmTransition(&TimerFlush);
482}
483
486 _In_ TIMER_FOLLOW_UP FollowUp)
487{
488 if (FollowUp == FollowOverCurrent)
489 return StartOverCurrentWait();
490
491 if (FollowUp == FollowOverCurrentCleared)
492 return SmTransition(&PoweringPort);
493
494 return CheckConnection();
495}
496
503 _In_ const State* Stay)
504{
505 PortEvent response = ErrorResponse();
506
507 switch (response)
508 {
509 case PortEvent::ErrorIgnore:
510 return SmTransition(Stay);
511
512 case PortEvent::ChangeNeedsHubReset:
513 if (Stay == &ResumeAckWait)
514 return ResetHubThen(Stay);
516
517 case PortEvent::ErrorCycle:
518 return CycleDetach();
519
520 case PortEvent::ErrorDisableAndCycle:
523
524 case PortEvent::ChangeConnect:
525 case PortEvent::ChangeOverCurrent:
526 case PortEvent::ChangeOverCurrentCleared:
527 return DetachThen(response);
528
529 default:
530 SM_BREAK("Port error response not valid here");
531 return SmHandled();
532 }
533}
534
535/* Same for a 2.0 port with a timer running, DuringReset picks the reset rules */
538 _In_ const State* Stay,
539 _In_ BOOLEAN DuringReset)
540{
541 PortEvent response = DuringReset ? ErrorResponseDuringReset() : ErrorResponse();
542
543 switch (response)
544 {
545 case PortEvent::ErrorIgnore:
546 return SmTransition(Stay);
547
548 case PortEvent::ErrorEnabledWhileReset:
550
551 case PortEvent::ChangeNeedsHubReset:
552 return TimedHubReset();
553
554 case PortEvent::ErrorCycle:
558
559 case PortEvent::ErrorDisableAndCycle:
563
564 case PortEvent::ChangeConnect:
565 case PortEvent::ChangeOverCurrent:
566 case PortEvent::ChangeOverCurrentCleared:
567 return DetachTimed(response);
568
569 default:
570 SM_BREAK("Port error response not valid here");
571 return SmHandled();
572 }
573}
574
577{
579 return ReleaseAndStopTimer();
580}
581
582/* Give up on a timed operation: fail it to the device and wait for the hub */
585{
586 BOOLEAN stopped = StopTimer();
587
590 return SmTransition(stopped ? &HubResetWait : &HubResetTimerWait);
591}
592
595 _In_ const State* Start,
596 _In_ const State* Refused)
597{
599 return SmTransition(Start);
600
602 return SmTransition(Refused);
603}
604
607{
610 return SmTransition(&Enabled);
611}
612
615{
616 if (m_Usb3)
617 {
620 }
621 else
622 {
625 }
626
628}
629
632{
633 if (m_Usb3)
634 {
637 }
638 else
639 {
642 }
643
644 return SmTransition(&Enabled);
645}
646
649{
652}
653
654/* HUB NOT RUNNING ************************************************************/
655
659{
661 return SmUnhandled();
662}
663
666{
668 return SmHandled();
669}
670
674{
675 switch (Event)
676 {
677 case PortEvent::HubResumed:
678 case PortEvent::HubResumedWithReset:
680
681 case PortEvent::HubStarted:
682 if (m_Usb3 && SuperSpeedBlocked())
685
686 case PortEvent::HubResumedInS0:
687 return PowerUp(&Disconnected);
688
689 case PortEvent::HubResetting:
691 return SmTransition(&OffEmpty);
692
693 case PortEvent::PortCleanup:
694 return SmTransition(&Deleted);
695
696 default:
697 return SmUnhandled();
698 }
699}
700
704{
705 switch (Event)
706 {
707 case PortEvent::HubResumed:
708 case PortEvent::HubResumedWithReset:
709 if (!m_Usb3)
713
714 case PortEvent::HubStarted:
716
717 case PortEvent::HubResumedInS0:
718 return PowerUp(&AttachedDisabled);
719
720 case PortEvent::HubResetting:
723 return SmTransition(&OffEmpty);
724
725 case PortEvent::CycleRequest:
728
729 case PortEvent::PortCleanup:
730 return SmTransition(&CleaningUp);
731
732 default:
733 return SmUnhandled();
734 }
735}
736
740{
741 switch (Event)
742 {
743 case PortEvent::HubResumed:
744 case PortEvent::HubResumedWithReset:
745 case PortEvent::HubStarted:
746 case PortEvent::HubResumedInS0:
749
750 case PortEvent::HubResetting:
752 return SmTransition(&OffEmpty);
753
754 case PortEvent::PortCleanup:
755 return SmTransition(&Deleted);
756
757 default:
758 return SmUnhandled();
759 }
760}
761
765{
766 switch (Event)
767 {
768 case PortEvent::HubResumed:
769 case PortEvent::HubResumedInS0:
770 return PowerUp(&SsLinkDisabled);
771
772 case PortEvent::HubStarted:
773 case PortEvent::HubResumedWithReset:
775
776 case PortEvent::HubResetting:
779
780 case PortEvent::PortCleanup:
781 return SmTransition(&Deleted);
782
783 default:
784 return SmUnhandled();
785 }
786}
787
790{
792 return SmHandled();
793}
794
798{
799 switch (Event)
800 {
801 case PortEvent::HubResumedInS0:
802 return PowerUp(&Suspended);
803
804 case PortEvent::HubStopping:
805 return SmTransition(&OffAttached);
806
807 case PortEvent::HubResumed:
808 case PortEvent::HubResumedWithReset:
809 if (m_Usb3)
811 m_WarmResume = (Event == PortEvent::HubResumed);
813
814 case PortEvent::CycleRequest:
817
818 case PortEvent::PortCleanup:
819 return SmTransition(&CleaningUp);
820
821 default:
822 return SmUnhandled();
823 }
824}
825
828{
830 return SmHandled();
831}
832
836{
837 if (Event == PortEvent::DeviceGone)
838 return SmTransition(&Deleted);
839
840 return SmUnhandled();
841}
static _Out_opt_ PULONGLONG Start
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned char BOOLEAN
Definition: actypes.h:127
#define index(s, c)
Definition: various.h:29
USHORT Change
Definition: bootdev.cpp:133
VOID ReattachBootDevice()
Definition: hubport.cpp:380
static const State CleaningUp
Definition: portsm.h:203
VOID UpdateHubPower(_In_ BOOLEAN Idle)
Definition: portsm.cpp:238
VOID DropInterruptReference()
Definition: fanout.cpp:1000
static const State ResetRequestWait
Definition: portsm.h:228
static const State TimerFlush
Definition: portsm.h:216
PortEvent ErrorResponseDuringReset()
Definition: portxfer.cpp:640
static const State OffEmpty
Definition: portsm.h:197
BOOLEAN m_D3AfterResume
Definition: portsm.h:966
@ D3PendingStop
Definition: portsm.h:186
static const State DisablingForCycleTimed
Definition: portsm.h:264
BOOLEAN OldDevicePresent()
Definition: hubport.cpp:552
static const State DisablingForCycle
Definition: portsm.h:261
TIMER_FOLLOW_UP
Definition: portsm.h:160
@ FollowOverCurrent
Definition: portsm.h:163
@ FollowOverCurrentCleared
Definition: portsm.h:164
@ FollowConnect
Definition: portsm.h:161
SM_RESULT DetachThen(_In_ PortEvent Change)
Definition: portsm.cpp:426
SM_RESULT DetachTimed(_In_ PortEvent Change)
Definition: portsm.cpp:442
SM_RESULT OnOff(_In_ PortEvent Event)
Definition: portsm.cpp:657
static const State Returning
Definition: portsm.h:344
static const State DebouncingUsb2
Definition: portsm.h:210
VOID SmStateChanged()
The innermost frame that does not yield to its caller decides whether the port holds the hub awake.
Definition: portsm.cpp:227
static const State HubResetTimerWait
Definition: portsm.h:246
static const State AttachFailedWait
Definition: portsm.h:249
HubPort * m_Port
Definition: portsm.h:950
SM_RESULT FailToHubReset()
Definition: portsm.cpp:648
BOOLEAN m_ParkResetsHub
Definition: portsm.h:965
static const State ResumingAttached
Definition: portsm.h:230
READ_KIND m_ReadKind
Definition: portsm.h:955
VOID DisconnectDevice()
Definition: hubport.cpp:369
VOID SmQueuePassive()
Definition: portsm.cpp:186
BOOLEAN m_HubPowerHeld
Definition: portsm.h:952
PortEvent m_SuspendReport
Definition: portsm.h:957
BOOLEAN BootDeviceReturning()
Definition: hubport.cpp:558
static const State ErrorRestarting
Definition: portsm.h:233
BOOLEAN AllowsHubSuspend(_In_ const State *Target) const
Definition: portsm.cpp:216
SM_RESULT OnOffResetNeeded(_In_ PortEvent Event)
Definition: portsm.cpp:738
BOOLEAN LinkInU0()
Definition: hubport.cpp:510
BOOLEAN DeviceConnected()
Definition: hubport.cpp:477
BOOLEAN NeedsDebounce()
Definition: hubport.cpp:565
SM_RESULT PowerDown(_In_ const State *Target)
Definition: portsm.cpp:265
HubPort * Port() const
Definition: portsm.h:138
BOOLEAN m_D3PowerUpWarm
Definition: portsm.h:967
BOOLEAN SuperSpeedBlocked()
Definition: portxfer.cpp:697
BOOLEAN m_ReadFresh
Definition: portsm.h:960
static const State HubResetWait
Definition: portsm.h:245
static const State ResumeAckWait
Definition: portsm.h:227
SM_RESULT OnOffSuspended(_In_ PortEvent Event)
Definition: portsm.cpp:796
static const State Off
Definition: portsm.h:195
SM_RESULT ResumeSucceeded()
Definition: portsm.cpp:631
SM_RESULT TimedHubReset()
Definition: portsm.cpp:576
SM_RESULT TakeInterruptForReset(_In_ const State *Start, _In_ const State *Refused)
Definition: portsm.cpp:594
BOOLEAN StopTimer()
Definition: hubport.cpp:301
static const State OffResetNeeded
Definition: portsm.h:199
VOID SmOnDequeue(_In_ PortEvent Event)
Definition: portsm.cpp:192
SM_RESULT EnterReturning()
Definition: portsm.cpp:297
VOID ForceResetOnEnumeration()
Definition: hubport.cpp:451
static const State OffSuperSpeedDisabled
Definition: portsm.h:200
VOID ReferencePort()
Definition: hubport.cpp:176
SM_RESULT ReleaseAndStopTimer()
Definition: portsm.cpp:584
SM_RESULT ResetSucceeded()
Definition: portsm.cpp:606
SM_RESULT EnterOffSuspended()
Definition: portsm.cpp:789
SM_RESULT OnOffSuperSpeedDisabled(_In_ PortEvent Event)
Definition: portsm.cpp:763
static const State OffAttached
Definition: portsm.h:198
static const State DisablingSuperSpeed
Definition: portsm.h:270
OLD_DEVICE_KIND m_OldDevice
Definition: portsm.h:954
BOOLEAN TakeInterruptReference()
Definition: fanout.cpp:994
static const State Enabled
Definition: portsm.h:222
VOID ClearPortStatus()
Definition: portxfer.cpp:685
PortEvent m_D3FlushReturn
Definition: portsm.h:958
VOID HubPowerDrop()
Definition: hubport.cpp:218
static const State SystemResuming
Definition: portsm.h:232
SM_RESULT CheckConnection()
Definition: portsm.cpp:304
VOID DropHubResetReference()
Definition: fanout.cpp:988
VOID DereferencePort()
Definition: hubport.cpp:182
static const State Deleted
Definition: portsm.h:204
static const State OverCurrentWait
Definition: portsm.h:213
static const State ResetEnabledWait
Definition: portsm.h:238
SM_RESULT StartOverCurrentWait()
Definition: portsm.cpp:418
VOID TakePortPowerReference()
Definition: fanout.cpp:976
SM_RESULT OnOffAttached(_In_ PortEvent Event)
Definition: portsm.cpp:702
BOOLEAN m_AttachForcedReset
Definition: portsm.h:962
VOID TellDevice(_In_ PSM_DEVICE_NOTICE Notice)
Definition: hubport.cpp:309
BOOLEAN m_LpmU2
Definition: portsm.h:963
static const State Suspended
Definition: portsm.h:224
@ ReadPlain
Definition: portsm.h:178
BOOLEAN m_ArmForEmpty
Definition: portsm.h:964
SM_RESULT ResetHubThen(_In_ const State *Target)
Definition: portsm.cpp:281
static const State OffInitial
Definition: portsm.h:196
SM_RESULT OnOffEmpty(_In_ PortEvent Event)
Definition: portsm.cpp:672
VOID QueuePassiveWork()
Definition: hubport.cpp:188
VOID MarkUsb3Device()
Definition: hubport.cpp:445
SM_RESULT PowerUp(_In_ const State *Target)
Definition: portsm.cpp:273
OLD_DEVICE_KIND
Definition: portsm.h:169
@ OldDeviceResetInProgress
Definition: portsm.h:172
@ OldDeviceResetNeeded
Definition: portsm.h:171
@ OldDevicePlain
Definition: portsm.h:170
static const State AttachedDisabled
Definition: portsm.h:223
SM_RESULT EnterOffEmpty()
Definition: portsm.cpp:665
SM_RESULT HandleConnectedFault(_In_ const State *Stay)
Handles a 2.0 port status that makes no sense for an attached port.
Definition: portsm.cpp:502
SM_RESULT CheckOldDevice(_In_ OLD_DEVICE_KIND Kind)
Definition: portsm.cpp:316
D3_PENDING m_D3Pending
Definition: portsm.h:956
static const State OffSuspendedUsb3
Definition: portsm.h:201
static const State PoweringPort
Definition: portsm.h:254
BOOLEAN ConnectDevice()
Definition: hubport.cpp:346
SM_RESULT EnterCleaningUp()
Definition: portsm.cpp:827
VOID MarkUsb2Device()
Definition: hubport.cpp:439
SM_RESULT ReattachOrCreate(_In_ OLD_DEVICE_KIND Kind)
Definition: portsm.cpp:381
SM_RESULT OnCleaningUp(_In_ PortEvent Event)
Definition: portsm.cpp:834
VOID DropPortPowerReference()
Definition: fanout.cpp:982
static const State StartingAttached
Definition: portsm.h:229
PortEvent m_ReturnEvent
Definition: portsm.h:959
VOID StartTimer(_In_ PSM_TIMER Timer)
Definition: hubport.cpp:230
static const State OldDeviceWait
Definition: portsm.h:212
VOID SmDereference()
Definition: portsm.cpp:180
BOOLEAN HubPowerTake()
Definition: hubport.cpp:198
SM_RESULT DeviceArrived(_In_ OLD_DEVICE_KIND Kind)
Drops requests the previous device left behind, then reattaches or creates a device.
Definition: portsm.cpp:333
VOID SmReference()
Definition: portsm.cpp:174
TIMER_FOLLOW_UP m_AfterTimer
Definition: portsm.h:953
static const State SsLinkDisabled
Definition: portsm.h:251
SM_RESULT ReturnFromFrame(_In_ PortEvent Event)
Definition: portsm.cpp:289
BOOLEAN DevicePresent()
Definition: hubport.cpp:484
PortEvent ErrorResponse()
Definition: portxfer.cpp:673
BOOLEAN CreateDevice()
Definition: hubport.cpp:339
SM_RESULT CycleDetach()
Definition: portsm.cpp:466
static const State DebouncingUsb3
Definition: portsm.h:211
BOOLEAN m_WarmResume
Definition: portsm.h:961
SM_RESULT TimedError(_In_ const State *Stay, _In_ BOOLEAN DuringReset)
Definition: portsm.cpp:537
SM_RESULT ResetTransferFailed()
Definition: portsm.cpp:614
SM_RESULT StopTimerThen(_In_ TIMER_FOLLOW_UP FollowUp)
Definition: portsm.cpp:474
SM_RESULT FollowTimer(_In_ TIMER_FOLLOW_UP FollowUp)
Definition: portsm.cpp:485
BOOLEAN m_ReconnectFlushOnStop
Definition: portsm.h:968
static const State HubResetIssued
Definition: portsm.h:244
static const SM_EVENT_INFO EventInfo[]
Definition: portsm.h:155
VOID KeepHubAwake()
Definition: portsm.cpp:257
BOOLEAN m_Usb3
Definition: portsm.h:951
VOID RequestHubReset()
Definition: fanout.cpp:1006
static const State Disconnected
Definition: portsm.h:207
static const State OffSuspendedUsb2
Definition: portsm.h:202
VOID ForgetDetachedDevice()
Definition: hubport.cpp:389
BOOLEAN m_DrainReturnsEmpty
Definition: portsm.h:969
static const State StartingEmpty
Definition: portsm.h:208
VOID Initialize(_In_ HubPort *Port, _In_ BOOLEAN SuperSpeed)
Definition: portsm.cpp:143
static const State ResumingDisabled
Definition: portsm.h:231
VOID SmDiscardQueued(_In_ PortEvent Ev)
Definition: smengine.h:522
VOID SmInitialize(_In_ const State *Initial)
Definition: smengine.h:349
static SM_RESULT SmTransition(_In_ const State *Target)
Definition: smengine.h:194
static SM_RESULT SmReturn(_In_ PortEvent Ev)
Definition: smengine.h:217
static SM_RESULT SmHandled()
Definition: smengine.h:182
static SM_RESULT SmUnhandled()
Definition: smengine.h:188
const State * SmFrame(_In_ ULONG Index) const
Definition: smengine.h:142
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint index
Definition: glext.h:6031
CPPORT Port[4]
Definition: headless.c:38
#define NOTHING
Definition: input_list.c:10
#define _In_
Definition: no_sal2.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
@ Idle
Definition: ntdd8042.h:62
static const PortEvent StatusAndRemoved[]
Definition: portsm.cpp:89
static const PortEvent GoneOnly[]
Definition: portsm.cpp:94
static const PortEvent OffAttachedDrops[]
Definition: portsm.cpp:76
static BOOLEAN NTAPI PsmHasFlag(_In_ const PortMachine::State *Target, _In_ ULONG Flag)
Definition: portsm.cpp:202
static const PortEvent RemovedAndStopped[]
Definition: portsm.cpp:84
static const PortEvent IdleRequests[]
Definition: portsm.cpp:67
PortEvent
Definition: portsm.h:15
@ DisableSuperSpeedRequest
@ WarmResetRequest
@ HibernateRequest
@ PsmNoticeResetRefused
Definition: portsm.h:76
@ PsmNoticeResumed
Definition: portsm.h:77
@ PsmNoticeFailed
Definition: portsm.h:74
@ PsmNoticeStateDisabled
Definition: portsm.h:81
@ PsmNoticeResetComplete
Definition: portsm.h:85
#define PSM_STATE_IDLE_USB3
Definition: portsm.h:124
@ PsmTimerOverCurrent
Definition: portsm.h:94
#define PSM_STATE_IDLE
Definition: portsm.h:125
#define PSM_STATE_IDLE_USB2
Definition: portsm.h:123
#define SM_STATE_TAKES_REQUESTS
Definition: smengine.h:39
#define SM_BREAK(Message)
Definition: smengine.h:18
#define SM_STATE_YIELDS_TO_CALLER
Definition: smengine.h:42
@ SmEventRequest
Definition: smengine.h:25
@ SmEventCompletion
Definition: smengine.h:24
@ SmEventCritical
Definition: smengine.h:27
Definition: xml2sdb.h:103
One state. Handler gets every event the state sees.
Definition: smengine.h:93
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306