ReactOS 0.4.17-dev-1281-g065abb3
PortMachine Class Reference

#include <portsm.h>

Inheritance diagram for PortMachine:
Collaboration diagram for PortMachine:

Public Member Functions

VOID Initialize (_In_ HubPort *Port, _In_ BOOLEAN SuperSpeed)
 
HubPort * Port () const
 
BOOLEAN IsSuperSpeed () const
 
BOOLEAN HoldsHubPower () const
 
VOID ReferencePort ()
 
VOID DereferencePort ()
 
VOID QueuePassiveWork ()
 
VOID ForgetDetachedDevice ()
 
BOOLEAN HubPowerTake ()
 
VOID HubPowerDrop ()
 
VOID TellDevice (_In_ PSM_DEVICE_NOTICE Notice)
 
VOID StartTimer (_In_ PSM_TIMER Timer)
 
BOOLEAN StopTimer ()
 
VOID ClearPortStatus ()
 
VOID TakePortPowerReference ()
 
VOID DropPortPowerReference ()
 
VOID DropHubResetReference ()
 
BOOLEAN TakeInterruptReference ()
 
VOID DropInterruptReference ()
 
VOID RequestHubReset ()
 
VOID ResumeInterruptTransfer ()
 
VOID ResetChangeAccumulator ()
 
VOID FixPortStateAfterPowerUp ()
 
VOID DisconnectDevice ()
 
VOID ReattachBootDevice ()
 
VOID NotifyBootDeviceRemoval ()
 
VOID MarkUsb2Device ()
 
VOID MarkUsb3Device ()
 
VOID ForceResetOnEnumeration ()
 
VOID RecordPortDisabled ()
 
VOID RecordPortSuspended ()
 
VOID CancelUserOverCurrentReset ()
 
VOID NotifyUserOfOverCurrent ()
 
VOID LogLinkStateError ()
 
VOID MarkOverCurrentCause ()
 
VOID SendGetStatus ()
 
VOID SendAckChange ()
 
VOID SendReset ()
 
VOID SendWarmReset ()
 
VOID SendDisable ()
 
VOID SendResume ()
 
VOID SendSuspend ()
 
VOID SendPortPower ()
 
VOID SendU1Timeout ()
 
VOID SendU2Timeout ()
 
VOID SendLinkDisable ()
 
VOID SendLinkRxDetect ()
 
VOID SendRemoteWake (_In_ BOOLEAN Enable)
 
BOOLEAN DeviceConnected ()
 
BOOLEAN DevicePresent ()
 
BOOLEAN OverCurrentActive ()
 
BOOLEAN OverCurrentPersists ()
 
BOOLEAN CreateDevice ()
 
BOOLEAN ConnectDevice ()
 
BOOLEAN BootDeviceReturning ()
 
BOOLEAN OldDevicePresent ()
 
BOOLEAN ConnectChangedOnResume ()
 
BOOLEAN D3ColdEnabled ()
 
BOOLEAN NeedsDebounce ()
 
BOOLEAN LinkInU0 ()
 
BOOLEAN SuperSpeedBlocked ()
 
BOOLEAN PortPowered ()
 
BOOLEAN PollResetCompletion ()
 
BOOLEAN HubArmedForWake ()
 
PSM_PENDING PendingChange ()
 
PortEvent NextChange ()
 
PortEvent LostChange ()
 
PortEvent ErrorResponse ()
 
PortEvent ErrorResponseDuringReset ()
 
VOID ReadPortBits (_Out_ PPSM_PORT_BITS Bits)
 
- Public Member Functions inherited from SmMachine< PortMachine, PortEvent >
VOID SmInitialize (_In_ const State *Initial)
 
BOOLEAN SmPost (_In_ PortEvent 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 []
 
static const State Off
 
static const State OffInitial
 
static const State OffEmpty
 
static const State OffAttached
 
static const State OffResetNeeded
 
static const State OffSuperSpeedDisabled
 
static const State OffSuspendedUsb3
 
static const State OffSuspendedUsb2
 
static const State CleaningUp
 
static const State Deleted
 
static const State Empty
 
static const State Disconnected
 
static const State StartingEmpty
 
static const State Debouncing
 
static const State DebouncingUsb2
 
static const State DebouncingUsb3
 
static const State OldDeviceWait
 
static const State OverCurrentWait
 
static const State NotifyingOverCurrent
 
static const State UserResetWait
 
static const State TimerFlush
 
static const State FlushBeforeOffEmpty
 
static const State FlushBeforeOffAttached
 
static const State FlushBeforeSuperSpeedOff
 
static const State Attached
 
static const State Enabled
 
static const State AttachedDisabled
 
static const State Suspended
 
static const State DisabledInSuspend
 
static const State SuspendedD3Cold
 
static const State ResumeAckWait
 
static const State ResetRequestWait
 
static const State StartingAttached
 
static const State ResumingAttached
 
static const State ResumingDisabled
 
static const State SystemResuming
 
static const State ErrorRestarting
 
static const State ResumeAckWaitStopped
 
static const State Timed
 
static const State ResetWait
 
static const State ResetEnabledWait
 
static const State ResetFlush
 
static const State ResumeWait
 
static const State ResumeRecovery
 
static const State ResumeFlush
 
static const State HubResetIssued
 
static const State HubResetWait
 
static const State HubResetTimerWait
 
static const State EmptyHubResetWait
 
static const State EmptyHubResetTimerWait
 
static const State AttachFailedWait
 
static const State SuperSpeedOffWait
 
static const State SsLinkDisabled
 
static const State Transfer
 
static const State PoweringPort
 
static const State QueryingOverCurrent
 
static const State SendingReset
 
static const State SendingWarmReset
 
static const State SendingResume
 
static const State SendingSuspend
 
static const State DisablingOnRequest
 
static const State DisablingForCycle
 
static const State DisablingBeforeConnect
 
static const State QuiescingForHubSuspend
 
static const State DisablingForCycleTimed
 
static const State DisablingOnSuspendTimed
 
static const State DisablingOnResetTimeout
 
static const State ReadingForResume
 
static const State ReadingAfterResumeTimeout
 
static const State SettingLpmTimeout
 
static const State DisablingSuperSpeed
 
static const State DisablingSuperSpeedOnRequest
 
static const State EnablingSuperSpeedOnStop
 
static const State EnablingSuperSpeedOnTimer
 
static const State ResetTimeoutStatus
 
static const State ArmingWake
 
static const State ChangeIdle20
 
static const State ChangeReading20
 
static const State ChangeAcking20
 
static const State ChangeReporting20
 
static const State ChangeParked20
 
static const State ChangeIdle30
 
static const State ChangeChecking30
 
static const State ResetChangeIdle
 
static const State ResetChangeChecking
 
static const State ResetPollWait
 
static const State ResetPollChecking
 
static const State ResumeChangeIdle
 
static const State ResumeChangeChecking
 
static const State StatusReading
 
static const State StatusAcking
 
static const State StatusReporting
 
static const State StatusFailing
 
static const State DrainIdle
 
static const State DrainEmptyIdleUsb2
 
static const State DrainEmptyIdleUsb3
 
static const State DrainReading
 
static const State DrainAcking
 
static const State DrainRearming
 
static const State DrainChecking
 
static const State PowerOnSending
 
static const State PowerOnSettling
 
static const State StartReading20
 
static const State StartReadingFirst
 
static const State StartReading30
 
static const State PowerUpResetHub
 
static const State PowerUpRearming
 
static const State ResumePowering
 
static const State ResumeSettling
 
static const State ResumeReading
 
static const State ResumeAckingConnect
 
static const State ReconnectWait
 
static const State ReconnectReading
 
static const State ReconnectAcking
 
static const State ReconnectRearming
 
static const State ReconnectFlush
 
static const State ResumeRereading
 
static const State SystemResumeReading
 
static const State SystemReconnectWait
 
static const State SystemResumeRereading
 
static const State SuspendIdle
 
static const State SuspendReading
 
static const State SuspendAcking
 
static const State SuspendRecovery
 
static const State SuspendReporting
 
static const State D3Idle
 
static const State D3PoweredOff
 
static const State D3PoweringUp
 
static const State D3Debouncing
 
static const State D3DebounceFlush
 
static const State D3FlushThenReturn
 
static const State D3ResumeAckWait
 
static const State D3ReconnectWait
 
static const State D3ReconnectFlush
 
static const State WakeArming
 
static const State Returning
 

Private Types

enum  TIMER_FOLLOW_UP { FollowConnect , FollowCycle , FollowOverCurrent , FollowOverCurrentCleared }
 
enum  OLD_DEVICE_KIND { OldDevicePlain , OldDeviceResetNeeded , OldDeviceResetInProgress }
 
enum  READ_KIND { ReadPlain , ReadNoChange , ReadStartResume }
 
enum  D3_PENDING {
  D3PendingStop , D3PendingOverCurrent , D3PendingOverCurrentCleared , D3PendingReattach ,
  D3PendingHubReset
}
 

Private Member Functions

VOID SmReference ()
 
VOID SmDereference ()
 
VOID SmQueuePassive ()
 
VOID SmStateChanged ()
 The innermost frame that does not yield to its caller decides whether the port holds the hub awake.
 
VOID SmOnDequeue (_In_ PortEvent Event)
 
SM_RESULT OnOff (_In_ PortEvent Event)
 
SM_RESULT OnOffEmpty (_In_ PortEvent Event)
 
SM_RESULT OnOffAttached (_In_ PortEvent Event)
 
SM_RESULT OnOffResetNeeded (_In_ PortEvent Event)
 
SM_RESULT OnOffSuperSpeedDisabled (_In_ PortEvent Event)
 
SM_RESULT OnOffSuspended (_In_ PortEvent Event)
 
SM_RESULT OnCleaningUp (_In_ PortEvent Event)
 
SM_RESULT OnEmpty (_In_ PortEvent Event)
 
SM_RESULT OnStartingEmpty (_In_ PortEvent Event)
 
SM_RESULT OnDebouncing (_In_ PortEvent Event)
 
SM_RESULT OnOldDeviceWait (_In_ PortEvent Event)
 
SM_RESULT OnOverCurrentWait (_In_ PortEvent Event)
 
SM_RESULT OnUserResetWait (_In_ PortEvent Event)
 
SM_RESULT OnTimerFlush (_In_ PortEvent Event)
 
SM_RESULT OnFlushBeforeOff (_In_ PortEvent Event)
 
SM_RESULT OnAttached (_In_ PortEvent Event)
 
SM_RESULT OnEnabled (_In_ PortEvent Event)
 
SM_RESULT OnAttachedDisabled (_In_ PortEvent Event)
 
SM_RESULT OnSuspended (_In_ PortEvent Event)
 
SM_RESULT OnDisabledInSuspend (_In_ PortEvent Event)
 
SM_RESULT OnResumeAckWait (_In_ PortEvent Event)
 
SM_RESULT OnResetRequestWait (_In_ PortEvent Event)
 
SM_RESULT OnStartingAttached (_In_ PortEvent Event)
 
SM_RESULT OnResumingAttached (_In_ PortEvent Event)
 
SM_RESULT OnResumingDisabled (_In_ PortEvent Event)
 
SM_RESULT OnSystemResuming (_In_ PortEvent Event)
 
SM_RESULT OnErrorRestarting (_In_ PortEvent Event)
 
SM_RESULT OnResumeAckWaitStopped (_In_ PortEvent Event)
 
SM_RESULT OnTimed (_In_ PortEvent Event)
 
SM_RESULT OnResetWait (_In_ PortEvent Event)
 
SM_RESULT OnResetEnabledWait (_In_ PortEvent Event)
 
SM_RESULT OnResetFlush (_In_ PortEvent Event)
 
SM_RESULT OnResumeWait (_In_ PortEvent Event)
 
SM_RESULT OnResumeRecovery (_In_ PortEvent Event)
 
SM_RESULT OnResumeFlush (_In_ PortEvent Event)
 
SM_RESULT OnHubResetIssued (_In_ PortEvent Event)
 
SM_RESULT OnHubResetWait (_In_ PortEvent Event)
 
SM_RESULT OnHubResetTimerWait (_In_ PortEvent Event)
 
SM_RESULT OnEmptyHubResetWait (_In_ PortEvent Event)
 
SM_RESULT OnEmptyHubResetTimerWait (_In_ PortEvent Event)
 
SM_RESULT OnAttachFailedWait (_In_ PortEvent Event)
 
SM_RESULT OnSuperSpeedOffWait (_In_ PortEvent Event)
 
SM_RESULT OnSsLinkDisabled (_In_ PortEvent Event)
 
SM_RESULT OnPoweringPort (_In_ PortEvent Event)
 
SM_RESULT OnQueryingOverCurrent (_In_ PortEvent Event)
 
SM_RESULT OnSendingReset (_In_ PortEvent Event)
 
SM_RESULT OnSendingResume (_In_ PortEvent Event)
 
SM_RESULT OnSendingSuspend (_In_ PortEvent Event)
 
SM_RESULT OnDisablingOnRequest (_In_ PortEvent Event)
 
SM_RESULT OnDisablingForCycle (_In_ PortEvent Event)
 
SM_RESULT OnDisablingBeforeConnect (_In_ PortEvent Event)
 
SM_RESULT OnQuiescingForHubSuspend (_In_ PortEvent Event)
 
SM_RESULT OnDisablingForCycleTimed (_In_ PortEvent Event)
 
SM_RESULT OnDisablingOnSuspendTimed (_In_ PortEvent Event)
 
SM_RESULT OnDisablingOnResetTimeout (_In_ PortEvent Event)
 
SM_RESULT OnReadingForResume (_In_ PortEvent Event)
 
SM_RESULT OnReadingAfterResumeTimeout (_In_ PortEvent Event)
 
SM_RESULT OnSettingLpmTimeout (_In_ PortEvent Event)
 
SM_RESULT OnDisablingSuperSpeed (_In_ PortEvent Event)
 
SM_RESULT OnDisablingSuperSpeedOnRequest (_In_ PortEvent Event)
 
SM_RESULT OnEnablingSuperSpeedOnStop (_In_ PortEvent Event)
 
SM_RESULT OnEnablingSuperSpeedOnTimer (_In_ PortEvent Event)
 
SM_RESULT OnResetTimeoutStatus (_In_ PortEvent Event)
 
SM_RESULT OnArmingWake (_In_ PortEvent Event)
 
SM_RESULT EnterOffEmpty ()
 
SM_RESULT EnterOffSuspended ()
 
SM_RESULT EnterCleaningUp ()
 
SM_RESULT EnterDisconnected ()
 
SM_RESULT EnterWithPortChange ()
 
SM_RESULT EnterStartingEmpty ()
 
SM_RESULT EnterDebouncing ()
 
SM_RESULT EnterNotifyingOverCurrent ()
 
SM_RESULT EnterSuspended ()
 
SM_RESULT EnterSuspendedD3Cold ()
 
SM_RESULT EnterStartingAttached ()
 
SM_RESULT EnterResumingAttached ()
 
SM_RESULT EnterSystemResuming ()
 
SM_RESULT EnterErrorRestarting ()
 
SM_RESULT EnterResetWait ()
 
SM_RESULT EnterResumeWait ()
 
SM_RESULT EnterHubResetIssued ()
 
SM_RESULT EnterDraining ()
 
SM_RESULT EnterDrainingEmpty ()
 
SM_RESULT EnterPoweringPort ()
 
SM_RESULT EnterSendingReset ()
 
SM_RESULT EnterSendingWarmReset ()
 
SM_RESULT EnterSendingResume ()
 
SM_RESULT EnterSendingSuspend ()
 
SM_RESULT EnterDisablingOnRequest ()
 
SM_RESULT EnterDisablingPort ()
 
SM_RESULT EnterQuiescingForHubSuspend ()
 
SM_RESULT EnterReadingStatus ()
 
SM_RESULT EnterSettingLpmTimeout ()
 
SM_RESULT EnterDisablingSuperSpeed ()
 
SM_RESULT EnterDisablingSuperSpeedOnRequest ()
 
SM_RESULT EnterEnablingSuperSpeed ()
 
SM_RESULT EnterResetTimeoutStatus ()
 
SM_RESULT EnterArmingWake ()
 
SM_RESULT OnChangeIdle20 (_In_ PortEvent Event)
 
SM_RESULT OnChangeReading20 (_In_ PortEvent Event)
 
SM_RESULT OnChangeAcking20 (_In_ PortEvent Event)
 
SM_RESULT OnChangeParked20 (_In_ PortEvent Event)
 
SM_RESULT EnterChangeReporting20 ()
 
SM_RESULT EnterChangeParked20 ()
 
SM_RESULT OnChangeIdle30 (_In_ PortEvent Event)
 
SM_RESULT OnChangeChecking30 (_In_ PortEvent Event)
 
SM_RESULT OnResetChangeIdle (_In_ PortEvent Event)
 
SM_RESULT OnResetChangeChecking (_In_ PortEvent Event)
 
SM_RESULT OnResetPollWait (_In_ PortEvent Event)
 
SM_RESULT OnResetPollChecking (_In_ PortEvent Event)
 
SM_RESULT OnResumeChangeIdle (_In_ PortEvent Event)
 
SM_RESULT OnResumeChangeChecking (_In_ PortEvent Event)
 
SM_RESULT EnterPlainStatusRead ()
 
SM_RESULT EnterResetPollWait ()
 
SM_RESULT EnterResetPollChecking ()
 
SM_RESULT OnStatusReading (_In_ PortEvent Event)
 
SM_RESULT OnStatusAcking (_In_ PortEvent Event)
 
SM_RESULT EnterStatusReading ()
 
SM_RESULT EnterStatusReporting ()
 
SM_RESULT EnterStatusFailing ()
 
SM_RESULT OnDrainIdle (_In_ PortEvent Event)
 
SM_RESULT OnDrainEmptyIdle (_In_ PortEvent Event)
 
SM_RESULT OnDrainReading (_In_ PortEvent Event)
 
SM_RESULT OnDrainAcking (_In_ PortEvent Event)
 
SM_RESULT OnDrainChecking (_In_ PortEvent Event)
 
SM_RESULT EnterDrainRearming ()
 
SM_RESULT OnPowerOnSending (_In_ PortEvent Event)
 
SM_RESULT OnPowerOnSettling (_In_ PortEvent Event)
 
SM_RESULT OnStartReading20 (_In_ PortEvent Event)
 
SM_RESULT OnStartReadingFirst (_In_ PortEvent Event)
 
SM_RESULT OnStartReading30 (_In_ PortEvent Event)
 
SM_RESULT OnPowerUpParked (_In_ PortEvent Event)
 
SM_RESULT EnterPowerOnSettling ()
 
SM_RESULT EnterPowerUpResetHub ()
 
SM_RESULT EnterPowerUpRearming ()
 
SM_RESULT OnResumePowering (_In_ PortEvent Event)
 
SM_RESULT OnResumeSettling (_In_ PortEvent Event)
 
SM_RESULT OnResumeReading (_In_ PortEvent Event)
 An over-current seen now, or one that came and went while suspended, is reported.
 
SM_RESULT OnResumeAckingConnect (_In_ PortEvent Event)
 
SM_RESULT OnReconnectWait (_In_ PortEvent Event)
 
SM_RESULT OnReconnectReading (_In_ PortEvent Event)
 
SM_RESULT OnReconnectAcking (_In_ PortEvent Event)
 
SM_RESULT OnReconnectFlush (_In_ PortEvent Event)
 
SM_RESULT OnResumeRereading (_In_ PortEvent Event)
 
SM_RESULT OnSystemResumeReading (_In_ PortEvent Event)
 
SM_RESULT OnSystemReconnectWait (_In_ PortEvent Event)
 
SM_RESULT OnSystemResumeRereading (_In_ PortEvent Event)
 
SM_RESULT EnterAckingChange ()
 
SM_RESULT EnterReconnectRearming ()
 
SM_RESULT EnterStartResumeStatusRead ()
 
SM_RESULT OnSuspendIdle (_In_ PortEvent Event)
 
SM_RESULT OnSuspendReading (_In_ PortEvent Event)
 An error on a port that is connected but no longer enabled counts as a connect.
 
SM_RESULT OnSuspendAcking (_In_ PortEvent Event)
 
SM_RESULT OnSuspendRecovery (_In_ PortEvent Event)
 
SM_RESULT EnterSuspendRecovery ()
 
SM_RESULT EnterSuspendReporting ()
 
SM_RESULT OnD3Idle (_In_ PortEvent Event)
 
SM_RESULT OnD3PoweredOff (_In_ PortEvent Event)
 
SM_RESULT OnD3PoweringUp (_In_ PortEvent Event)
 
SM_RESULT OnD3Debouncing (_In_ PortEvent Event)
 
SM_RESULT OnD3DebounceFlush (_In_ PortEvent Event)
 
SM_RESULT OnD3FlushThenReturn (_In_ PortEvent Event)
 
SM_RESULT OnD3ResumeAckWait (_In_ PortEvent Event)
 
SM_RESULT OnD3ReconnectWait (_In_ PortEvent Event)
 
SM_RESULT OnD3ReconnectFlush (_In_ PortEvent Event)
 
SM_RESULT EnterD3PoweringUp ()
 
SM_RESULT OnWakeArming (_In_ PortEvent Event)
 
SM_RESULT EnterWakeArming ()
 
SM_RESULT EnterReturning ()
 
SM_RESULT PowerDown (_In_ const State *Target)
 
SM_RESULT PowerUp (_In_ const State *Target)
 
SM_RESULT ResetHubThen (_In_ const State *Target)
 
SM_RESULT CheckConnection ()
 
SM_RESULT StartOverCurrentWait ()
 
SM_RESULT DetachThen (_In_ PortEvent Change)
 
SM_RESULT DetachTimed (_In_ PortEvent Change)
 
SM_RESULT StopTimerThen (_In_ TIMER_FOLLOW_UP FollowUp)
 
SM_RESULT FollowTimer (_In_ TIMER_FOLLOW_UP FollowUp)
 
SM_RESULT HandleConnectedFault (_In_ const State *Stay)
 Handles a 2.0 port status that makes no sense for an attached port.
 
SM_RESULT TimedError (_In_ const State *Stay, _In_ BOOLEAN DuringReset)
 
SM_RESULT TimedHubReset ()
 
SM_RESULT ReleaseAndStopTimer ()
 
SM_RESULT ReattachOrCreate (_In_ OLD_DEVICE_KIND Kind)
 
SM_RESULT CheckOldDevice (_In_ OLD_DEVICE_KIND Kind)
 
SM_RESULT DeviceArrived (_In_ OLD_DEVICE_KIND Kind)
 Drops requests the previous device left behind, then reattaches or creates a device.
 
SM_RESULT TakeInterruptForReset (_In_ const State *Start, _In_ const State *Refused)
 
SM_RESULT ResumeSucceeded ()
 
SM_RESULT FailToHubReset ()
 
SM_RESULT ResetSucceeded ()
 
SM_RESULT CallStatusRead (_In_ READ_KIND Kind)
 
SM_RESULT CheckPending20 (_In_ const State *Acking, _In_ const State *Quiet)
 
SM_RESULT ParkChange20 (_In_ BOOLEAN ResetHub)
 
SM_RESULT ResumeReadDone ()
 
SM_RESULT ResumeConnectCheck ()
 
SM_RESULT ResumeStateDisabled ()
 
SM_RESULT ReconnectCheck ()
 
SM_RESULT ReconnectStatusFailed ()
 
SM_RESULT D3ConnectCheck (_In_ BOOLEAN AfterResume)
 
SM_RESULT D3StopReconnectTimer (_In_ D3_PENDING Pending)
 
SM_RESULT D3PendingDone (_In_ D3_PENDING Pending)
 
SM_RESULT D3StopDebounceTimer ()
 
SM_RESULT SystemResumeFailed ()
 
SM_RESULT ReportSuspendChange (_In_ PortEvent Report)
 
SM_RESULT ReturnFromFrame (_In_ PortEvent Event)
 
SM_RESULT CycleDetach ()
 
SM_RESULT ResetTransferFailed ()
 
SM_RESULT StatusFailed ()
 
SM_RESULT StatusQuiet ()
 
SM_RESULT DrainDone ()
 
SM_RESULT FailDeviceRequest ()
 
BOOLEAN AllowsHubSuspend (_In_ const State *Target) const
 
VOID UpdateHubPower (_In_ BOOLEAN Idle)
 
VOID KeepHubAwake ()
 

Private Attributes

HubPort * m_Port
 
BOOLEAN m_Usb3
 
BOOLEAN m_HubPowerHeld
 
TIMER_FOLLOW_UP m_AfterTimer
 
OLD_DEVICE_KIND m_OldDevice
 
READ_KIND m_ReadKind
 
D3_PENDING m_D3Pending
 
PortEvent m_SuspendReport
 
PortEvent m_D3FlushReturn
 
PortEvent m_ReturnEvent
 
BOOLEAN m_ReadFresh
 
BOOLEAN m_WarmResume
 
BOOLEAN m_AttachForcedReset
 
BOOLEAN m_LpmU2
 
BOOLEAN m_ArmForEmpty
 
BOOLEAN m_ParkResetsHub
 
BOOLEAN m_D3AfterResume
 
BOOLEAN m_D3PowerUpWarm
 
BOOLEAN m_ReconnectFlushOnStop
 
BOOLEAN m_DrainReturnsEmpty
 

Static Private Attributes

static const BOOLEAN SmCompletionsFirst = FALSE
 

Friends

class SmMachine< PortMachine, PortEvent >
 

Additional Inherited Members

- Public Types inherited from SmMachine< PortMachine, PortEvent >
typedef SmState< PortMachine, PortEvent > State
 
- Protected Member Functions inherited from SmMachine< PortMachine, PortEvent >
VOID SmBeginPause ()
 
VOID SmDiscardQueued (_In_ PortEvent Ev)
 
BOOLEAN SmAccepts (_In_ PortEvent Ev)
 
VOID SmReference ()
 
VOID SmDereference ()
 
VOID SmQueuePassive ()
 
VOID SmOnDequeue (_In_ PortEvent Ev)
 
VOID SmStateChanged ()
 
BOOLEAN SmCancelTimer ()
 
- Static Protected Member Functions inherited from SmMachine< PortMachine, PortEvent >
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_ PortEvent Ev)
 
- Static Protected Attributes inherited from SmMachine< PortMachine, PortEvent >
static const BOOLEAN SmCompletionsFirst
 
static const USHORT SmTimerEventId
 

Detailed Description

Definition at line 127 of file portsm.h.

Member Enumeration Documentation

◆ D3_PENDING

What a D3cold reconnect timer flush hands back when it fires.

Enumerator
D3PendingStop 
D3PendingOverCurrent 
D3PendingOverCurrentCleared 
D3PendingReattach 
D3PendingHubReset 

Definition at line 184 of file portsm.h.

185 {
191 };
@ D3PendingOverCurrentCleared
Definition: portsm.h:188
@ D3PendingStop
Definition: portsm.h:186
@ D3PendingReattach
Definition: portsm.h:189
@ D3PendingOverCurrent
Definition: portsm.h:187
@ D3PendingHubReset
Definition: portsm.h:190

◆ OLD_DEVICE_KIND

Which kind of reconnect a 3.0 port is waiting on the old device for.

Enumerator
OldDevicePlain 
OldDeviceResetNeeded 
OldDeviceResetInProgress 

Definition at line 168 of file portsm.h.

169 {
173 };
@ OldDeviceResetInProgress
Definition: portsm.h:172
@ OldDeviceResetNeeded
Definition: portsm.h:171
@ OldDevicePlain
Definition: portsm.h:170

◆ READ_KIND

How the 3.0 status reading frame ends.

Enumerator
ReadPlain 
ReadNoChange 
ReadStartResume 

Definition at line 176 of file portsm.h.

177 {
178 ReadPlain,
181 };
@ ReadPlain
Definition: portsm.h:178
@ ReadNoChange
Definition: portsm.h:179
@ ReadStartResume
Definition: portsm.h:180

◆ TIMER_FOLLOW_UP

What runs once the port timer is stopped or has fired.

Enumerator
FollowConnect 
FollowCycle 
FollowOverCurrent 
FollowOverCurrentCleared 

Definition at line 159 of file portsm.h.

160 {
165 };
@ FollowOverCurrent
Definition: portsm.h:163
@ FollowOverCurrentCleared
Definition: portsm.h:164
@ FollowConnect
Definition: portsm.h:161
@ FollowCycle
Definition: portsm.h:162

Member Function Documentation

◆ AllowsHubSuspend()

BOOLEAN PortMachine::AllowsHubSuspend ( _In_ const State *  Target) const
private

Definition at line 216 of file portsm.cpp.

218{
220}
BOOLEAN m_Usb3
Definition: portsm.h:951
static BOOLEAN NTAPI PsmHasFlag(_In_ const PortMachine::State *Target, _In_ ULONG Flag)
Definition: portsm.cpp:202
#define PSM_STATE_IDLE_USB3
Definition: portsm.h:124
#define PSM_STATE_IDLE_USB2
Definition: portsm.h:123
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by SmStateChanged().

◆ BootDeviceReturning()

BOOLEAN PortMachine::BootDeviceReturning ( )

Definition at line 558 of file hubport.cpp.

559{
560 return m_Port->HasFlag(PortFlag::SupportsReattach);
561}
BOOLEAN HasFlag(_In_ PortFlag Flag) const
Definition: hubport.h:185
HubPort * m_Port
Definition: portsm.h:950

Referenced by DeviceArrived(), EnterWakeArming(), and ReattachOrCreate().

◆ CallStatusRead()

SM_RESULT PortMachine::CallStatusRead ( _In_ READ_KIND  Kind)
private

Definition at line 383 of file portsm_frames.cpp.

385{
386 m_ReadKind = Kind;
388 return SmCall(&StatusReading);
389}
READ_KIND m_ReadKind
Definition: portsm.h:955
BOOLEAN m_ReadFresh
Definition: portsm.h:960
static const State StatusReading
Definition: portsm.h:293
static SM_RESULT SmCall(_In_ const State *Start)
Definition: smengine.h:209
#define TRUE
Definition: types.h:120

Referenced by EnterErrorRestarting(), EnterPlainStatusRead(), EnterResetPollChecking(), EnterResetTimeoutStatus(), and EnterStartResumeStatusRead().

◆ CancelUserOverCurrentReset()

VOID PortMachine::CancelUserOverCurrentReset ( )

Definition at line 612 of file hubport.cpp.

613{
614 m_Port->ClearFlag(PortFlag::OverCurrentResetArmed);
615}
VOID ClearFlag(_In_ PortFlag Flag)
Definition: hubport.h:199

Referenced by OnUserResetWait().

◆ CheckConnection()

SM_RESULT PortMachine::CheckConnection ( )
private

Definition at line 304 of file portsm.cpp.

305{
306 if (!m_Usb3)
308
309 if (!DevicePresent())
310 return SmTransition(&Disconnected);
311
313}
static const State DebouncingUsb2
Definition: portsm.h:210
BOOLEAN LinkInU0()
Definition: hubport.cpp:510
BOOLEAN DeviceConnected()
Definition: hubport.cpp:477
SM_RESULT CheckOldDevice(_In_ OLD_DEVICE_KIND Kind)
Definition: portsm.cpp:316
BOOLEAN DevicePresent()
Definition: hubport.cpp:484
static const State Disconnected
Definition: portsm.h:207
static SM_RESULT SmTransition(_In_ const State *Target)
Definition: smengine.h:194

Referenced by DetachThen(), FollowTimer(), OnEmpty(), OnOldDeviceWait(), OnQueryingOverCurrent(), and OnResetTimeoutStatus().

◆ CheckOldDevice()

SM_RESULT PortMachine::CheckOldDevice ( _In_ OLD_DEVICE_KIND  Kind)
private

Definition at line 316 of file portsm.cpp.

318{
319 if (OldDevicePresent())
320 {
321 m_OldDevice = Kind;
323 }
324
325 return DeviceArrived(Kind);
326}
BOOLEAN OldDevicePresent()
Definition: hubport.cpp:552
OLD_DEVICE_KIND m_OldDevice
Definition: portsm.h:954
static const State OldDeviceWait
Definition: portsm.h:212
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

Referenced by CheckConnection(), OnDebouncing(), OnOffResetNeeded(), OnStartingEmpty(), and ReattachOrCreate().

◆ CheckPending20()

SM_RESULT PortMachine::CheckPending20 ( _In_ const State *  Acking,
_In_ const State *  Quiet 
)
private

Definition at line 296 of file portsm_frames.cpp.

299{
300 switch (PendingChange())
301 {
302 case PsmPendingChange:
303 return SmTransition(Acking);
304
305 case PsmPendingError:
306 return ParkChange20(TRUE);
307
308 default:
309 return SmTransition(Quiet);
310 }
311}
PSM_PENDING PendingChange()
Definition: portxfer.cpp:301
SM_RESULT ParkChange20(_In_ BOOLEAN ResetHub)
@ PsmPendingError
Definition: portsm.h:110
@ PsmPendingChange
Definition: portsm.h:108

Referenced by OnChangeAcking20(), OnChangeReading20(), and OnSuspendAcking().

◆ ClearPortStatus()

VOID PortMachine::ClearPortStatus ( )

Definition at line 685 of file portxfer.cpp.

686{
688}
USHORT m_PreviousStatus
Definition: hubport.h:245

Referenced by EnterOffEmpty().

◆ ConnectChangedOnResume()

BOOLEAN PortMachine::ConnectChangedOnResume ( )

Definition at line 523 of file hubport.cpp.

524{
526
527 if (*Change & PC_CONNECT)
528 {
529 *Change &= ~PC_CONNECT;
531 return TRUE;
532 }
533
534 if (*Change & PC_SUSPEND)
535 {
536 *Change &= ~PC_SUSPEND;
538 return TRUE;
539 }
540
541 return FALSE;
542}
USHORT Change
Definition: bootdev.cpp:133
USHORT m_SelectedFeature
Definition: hubport.h:247
HubPortStatus m_Current
Definition: hubport.h:244
#define FALSE
Definition: types.h:117
#define PC_SUSPEND
Definition: hubreq.h:138
#define PC_CONNECT
Definition: hubreq.h:136
#define PORT_C_CONNECTION
Definition: hubreq.h:101
#define PORT_C_SUSPEND
Definition: hubreq.h:103
unsigned short USHORT
Definition: pedump.c:61
USB_PORT_STATUS_AND_CHANGE StatusChange
Definition: hubport.h:56
USHORT AsUshort16
Definition: usb200.h:231
USB_PORT_CHANGE PortChange
Definition: usb200.h:242

Referenced by ResumeConnectCheck().

◆ ConnectDevice()

BOOLEAN PortMachine::ConnectDevice ( )

Definition at line 346 of file hubport.cpp.

347{
349
350 Child->ClearState(ChildState::AttachSucceeded);
351 m_Port->ClearFlag(PortFlag::SupportsReattach);
352
353 Child->Post(DsmEvent::PortAttached);
354
355 if (!Child->HasState(ChildState::AttachSucceeded))
356 {
357 DPRINT1("Port %u device %p attach failed\n", m_Port->Number(), Child);
359 return FALSE;
360 }
361
362 m_Port->SetFlag(PortFlag::DeviceConnected);
363 m_Port->m_ConnectionStatus = DeviceEnumerating;
364 return TRUE;
365}
#define DPRINT1
Definition: precomp.h:8
VOID ClearState(_In_ ChildState Flag)
Definition: hubchild.h:274
HubChild * m_Child
Definition: hubport.h:236
USHORT Number() const
Definition: hubport.h:213
USB_CONNECTION_STATUS m_ConnectionStatus
Definition: hubport.h:254
VOID SetFlag(_In_ PortFlag Flag)
Definition: hubport.h:192
@ DeviceGeneralFailure
Definition: usbioctl.h:281
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

Referenced by DeviceArrived(), and ReattachOrCreate().

◆ CreateDevice()

BOOLEAN PortMachine::CreateDevice ( )

Definition at line 339 of file hubport.cpp.

340{
341 return HubChild::Create(m_Port) != NULL;
342}
static HubChild * Create(_In_ HubPort *Port)
Definition: hubchild.cpp:94
#define NULL
Definition: types.h:112

Referenced by DeviceArrived(), and ReattachOrCreate().

◆ CycleDetach()

SM_RESULT PortMachine::CycleDetach ( )
private

◆ D3ColdEnabled()

BOOLEAN PortMachine::D3ColdEnabled ( )

Definition at line 572 of file hubport.cpp.

573{
576
577 Enabled = Child->HasProperty(ChildProperty::AcpiAllowsD3Cold) &&
578 Child->HasState(ChildState::D3ColdEnabledByDriver) &&
579 !m_Port->HasProperty(PortProperty::Removable) &&
580 Child->m_PowerState == PowerDeviceD3;
581
582 if (Enabled)
583 DPRINT("Port %u device %p is in D3 cold\n", m_Port->Number(), Child);
584
585 return Enabled;
586}
unsigned char BOOLEAN
Definition: actypes.h:127
BOOLEAN HasProperty(_In_ PortProperty Property) const
Definition: hubport.h:206
static const State Enabled
Definition: portsm.h:222
@ PowerDeviceD3
Definition: ntpoapi.h:52
#define DPRINT
Definition: sndvol32.h:73

Referenced by EnterSuspendReporting(), and OnSuspended().

◆ D3ConnectCheck()

SM_RESULT PortMachine::D3ConnectCheck ( _In_ BOOLEAN  AfterResume)
private

Definition at line 1324 of file portsm_frames.cpp.

1326{
1327 if (DeviceConnected())
1328 {
1330 m_D3AfterResume = AfterResume;
1331 return SmTransition(&D3Debouncing);
1332 }
1333
1334 if (AfterResume)
1335 return ReturnFromFrame(PortEvent::ChangeConnect);
1336
1337 return SmTransition(&D3Idle);
1338}
BOOLEAN m_D3AfterResume
Definition: portsm.h:966
static const State D3Idle
Definition: portsm.h:333
VOID StartTimer(_In_ PSM_TIMER Timer)
Definition: hubport.cpp:230
SM_RESULT ReturnFromFrame(_In_ PortEvent Event)
Definition: portsm.cpp:289
static const State D3Debouncing
Definition: portsm.h:336
@ PsmTimerDebounce
Definition: portsm.h:93

Referenced by D3StopDebounceTimer(), OnD3DebounceFlush(), OnD3Idle(), and OnD3ResumeAckWait().

◆ D3PendingDone()

SM_RESULT PortMachine::D3PendingDone ( _In_ D3_PENDING  Pending)
private

Definition at line 1361 of file portsm_frames.cpp.

1363{
1364 switch (Pending)
1365 {
1367 return ReturnFromFrame(PortEvent::ChangeOverCurrent);
1368
1370 return ReturnFromFrame(PortEvent::ChangeOverCurrentCleared);
1371
1372 case D3PendingHubReset:
1373 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
1374
1375 case D3PendingReattach:
1376 if (m_Usb3)
1377 {
1379 return ReturnFromFrame(PortEvent::ChangeResumed);
1380 }
1383 return SmTransition(&D3Debouncing);
1384
1385 default:
1386 return ReturnFromFrame(PortEvent::HubStopping);
1387 }
1388}
VOID TellDevice(_In_ PSM_DEVICE_NOTICE Notice)
Definition: hubport.cpp:309
@ Pending
Definition: fs_rec.h:186
@ PsmNoticeEnabledOnReconnect
Definition: portsm.h:87

Referenced by D3StopReconnectTimer(), and OnD3ReconnectFlush().

◆ D3StopDebounceTimer()

SM_RESULT PortMachine::D3StopDebounceTimer ( )
private

Definition at line 1341 of file portsm_frames.cpp.

1342{
1343 if (StopTimer())
1345
1347}
static const State D3DebounceFlush
Definition: portsm.h:337
SM_RESULT D3ConnectCheck(_In_ BOOLEAN AfterResume)
BOOLEAN StopTimer()
Definition: hubport.cpp:301

Referenced by OnD3Debouncing().

◆ D3StopReconnectTimer()

SM_RESULT PortMachine::D3StopReconnectTimer ( _In_ D3_PENDING  Pending)
private

Definition at line 1350 of file portsm_frames.cpp.

1352{
1353 if (StopTimer())
1354 return D3PendingDone(Pending);
1355
1358}
SM_RESULT D3PendingDone(_In_ D3_PENDING Pending)
D3_PENDING m_D3Pending
Definition: portsm.h:956
static const State D3ReconnectFlush
Definition: portsm.h:341

Referenced by OnD3Debouncing(), and OnD3ReconnectWait().

◆ DereferencePort()

VOID PortMachine::DereferencePort ( )

Definition at line 182 of file hubport.cpp.

183{
185}
WDFOBJECT m_Object
Definition: hubport.h:227
FORCEINLINE VOID NTAPI HubDereferenceDeferred(_In_ WDFOBJECT Object)
Definition: hubutil.h:181

Referenced by SmDereference().

◆ DetachThen()

SM_RESULT PortMachine::DetachThen ( _In_ PortEvent  Change)
private

Definition at line 426 of file portsm.cpp.

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}
SM_RESULT CheckConnection()
Definition: portsm.cpp:304
SM_RESULT StartOverCurrentWait()
Definition: portsm.cpp:418
static const State PoweringPort
Definition: portsm.h:254

Referenced by HandleConnectedFault(), OnAttached(), and OnSuspended().

◆ DetachTimed()

SM_RESULT PortMachine::DetachTimed ( _In_ PortEvent  Change)
private

Definition at line 442 of file portsm.cpp.

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}
VOID DropInterruptReference()
Definition: fanout.cpp:1000
SM_RESULT StopTimerThen(_In_ TIMER_FOLLOW_UP FollowUp)
Definition: portsm.cpp:474

Referenced by OnTimed(), and TimedError().

◆ DeviceArrived()

SM_RESULT PortMachine::DeviceArrived ( _In_ OLD_DEVICE_KIND  Kind)
private

Drops requests the previous device left behind, then reattaches or creates a device.

Definition at line 333 of file portsm.cpp.

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}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define index(s, c)
Definition: various.h:29
VOID ReattachBootDevice()
Definition: hubport.cpp:380
static const State AttachFailedWait
Definition: portsm.h:249
BOOLEAN BootDeviceReturning()
Definition: hubport.cpp:558
BOOLEAN NeedsDebounce()
Definition: hubport.cpp:565
static const State AttachedDisabled
Definition: portsm.h:223
BOOLEAN ConnectDevice()
Definition: hubport.cpp:346
VOID MarkUsb2Device()
Definition: hubport.cpp:439
SM_RESULT ReattachOrCreate(_In_ OLD_DEVICE_KIND Kind)
Definition: portsm.cpp:381
BOOLEAN CreateDevice()
Definition: hubport.cpp:339
static const State DebouncingUsb3
Definition: portsm.h:211
VOID SmDiscardQueued(_In_ PortEvent Ev)
Definition: smengine.h:522
GLuint index
Definition: glext.h:6031
PortEvent
Definition: portsm.h:15
uint32_t ULONG
Definition: typedefs.h:59

Referenced by CheckOldDevice(), and OnOldDeviceWait().

◆ DeviceConnected()

◆ DevicePresent()

BOOLEAN PortMachine::DevicePresent ( )

Definition at line 484 of file hubport.cpp.

485{
488
490}
Status
Definition: gdiplustypes.h:24
#define LINK_SS_INACTIVE
Definition: hubreq.h:119
FORCEINLINE USHORT NTAPI HubLinkState(_In_ USHORT Status)
Definition: hubreq.h:159
#define LINK_COMPLIANCE
Definition: hubreq.h:122

Referenced by CheckConnection(), OnD3Idle(), OnD3ReconnectWait(), and OnD3ResumeAckWait().

◆ DisconnectDevice()

VOID PortMachine::DisconnectDevice ( )

Definition at line 369 of file hubport.cpp.

370{
372
373 m_Port->m_Child->Post(DsmEvent::PortDetached);
374
375 if (!m_Port->HasFlag(PortFlag::SupportsReattach))
377}
HubFdo * Hub
Definition: bootdev.cpp:261
VOID Post(_In_ DsmEvent Event)
Definition: hubchild.h:253
Definition: fdo.h:132
UCXHUB_STACK_INTERFACE m_Stack
Definition: fdo.h:356
UCXUSBDEVICE UsbDevice() const
Definition: fdo.h:180
HubFdo * m_Hub
Definition: hubport.h:228
PFN_UCXHUB_DEVICE_DISCONNECT DeviceDisconnect
Definition: hubucx.h:436

Referenced by CycleDetach(), DetachThen(), DetachTimed(), EnterCleaningUp(), EnterDisablingSuperSpeedOnRequest(), HandleConnectedFault(), OnEnabled(), OnOffAttached(), OnOffSuspended(), OnResetTimeoutStatus(), OnResumeAckWait(), OnResumeAckWaitStopped(), OnSuspended(), and TimedError().

◆ DrainDone()

SM_RESULT PortMachine::DrainDone ( )
private

Definition at line 661 of file portsm_frames.cpp.

662{
664 return SmTransition(&DrainIdle);
665
667}
static const State DrainIdle
Definition: portsm.h:298
static const State DrainEmptyIdleUsb2
Definition: portsm.h:299
static const State DrainEmptyIdleUsb3
Definition: portsm.h:300
BOOLEAN m_DrainReturnsEmpty
Definition: portsm.h:969

Referenced by EnterDrainRearming(), and OnDrainChecking().

◆ DropHubResetReference()

VOID PortMachine::DropHubResetReference ( )

Definition at line 988 of file fanout.cpp.

989{
991}
VOID DropHubResetReference(_In_ HubPort *Port)
Definition: fanout.cpp:563

Referenced by OnOffAttached(), OnOffEmpty(), OnOffResetNeeded(), and OnOffSuperSpeedDisabled().

◆ DropInterruptReference()

◆ DropPortPowerReference()

VOID PortMachine::DropPortPowerReference ( )

Definition at line 982 of file fanout.cpp.

983{
985}
VOID DropPortPowerReference(_In_ HubPort *Port)
Definition: fanout.cpp:544

Referenced by EnterOffSuspended(), OnD3Idle(), and PowerDown().

◆ EnterAckingChange()

SM_RESULT PortMachine::EnterAckingChange ( )
private

Definition at line 276 of file portsm_frames.cpp.

277{
279 return SmHandled();
280}
VOID SendAckChange()
Definition: portxfer.cpp:167
static SM_RESULT SmHandled()
Definition: smengine.h:182

◆ EnterArmingWake()

SM_RESULT PortMachine::EnterArmingWake ( )
private

Definition at line 1594 of file portsm_port.cpp.

1595{
1596 return SmCall(&WakeArming);
1597}
static const State WakeArming
Definition: portsm.h:343

◆ EnterChangeParked20()

SM_RESULT PortMachine::EnterChangeParked20 ( )
private

Definition at line 357 of file portsm_frames.cpp.

358{
360
361 if (m_ParkResetsHub)
362 {
365 }
366
367 return SmHandled();
368}
BOOLEAN m_ParkResetsHub
Definition: portsm.h:965
VOID ResumeInterruptTransfer()
Definition: fanout.cpp:1012
VOID RequestHubReset()
Definition: fanout.cpp:1006

◆ EnterChangeReporting20()

SM_RESULT PortMachine::EnterChangeReporting20 ( )
private

Definition at line 348 of file portsm_frames.cpp.

349{
350 PortEvent change = NextChange();
351
353 return SmReturn(change);
354}
PortEvent NextChange()
Definition: portxfer.cpp:555
static SM_RESULT SmReturn(_In_ PortEvent Ev)
Definition: smengine.h:217

◆ EnterCleaningUp()

SM_RESULT PortMachine::EnterCleaningUp ( )
private

Definition at line 827 of file portsm.cpp.

828{
830 return SmHandled();
831}

◆ EnterD3PoweringUp()

SM_RESULT PortMachine::EnterD3PoweringUp ( )
private

Definition at line 1461 of file portsm_frames.cpp.

1462{
1464}
BOOLEAN m_D3PowerUpWarm
Definition: portsm.h:967
static const State ResumePowering
Definition: portsm.h:314
static const State ResumeReading
Definition: portsm.h:316

◆ EnterDebouncing()

SM_RESULT PortMachine::EnterDebouncing ( )
private

Definition at line 389 of file portsm_port.cpp.

390{
392 return EnterWithPortChange();
393}
SM_RESULT EnterWithPortChange()

◆ EnterDisablingOnRequest()

SM_RESULT PortMachine::EnterDisablingOnRequest ( )
private

Definition at line 1529 of file portsm_port.cpp.

1530{
1531 if (!m_Usb3)
1532 {
1533 SendDisable();
1534 return SmHandled();
1535 }
1536
1537 /* A 3.0 port has no disabled state, the link is suspended instead */
1538 SendSuspend();
1540 return SmHandled();
1541}
VOID SendSuspend()
Definition: portxfer.cpp:206
VOID SendDisable()
Definition: portxfer.cpp:191
VOID ForceResetOnEnumeration()
Definition: hubport.cpp:451

◆ EnterDisablingPort()

SM_RESULT PortMachine::EnterDisablingPort ( )
private

Definition at line 1522 of file portsm_port.cpp.

1523{
1524 SendDisable();
1525 return SmHandled();
1526}

◆ EnterDisablingSuperSpeed()

SM_RESULT PortMachine::EnterDisablingSuperSpeed ( )
private

Definition at line 1566 of file portsm_port.cpp.

1567{
1569 return SmHandled();
1570}
VOID SendLinkDisable()
Definition: portxfer.cpp:215

◆ EnterDisablingSuperSpeedOnRequest()

SM_RESULT PortMachine::EnterDisablingSuperSpeedOnRequest ( )
private

Definition at line 1573 of file portsm_port.cpp.

1574{
1577 return SmHandled();
1578}

◆ EnterDisconnected()

SM_RESULT PortMachine::EnterDisconnected ( )
private

Definition at line 355 of file portsm_port.cpp.

356{
358 return EnterWithPortChange();
359}
VOID NotifyBootDeviceRemoval()
Definition: hubport.cpp:416

◆ EnterDraining()

SM_RESULT PortMachine::EnterDraining ( )
private

Definition at line 1366 of file portsm_port.cpp.

1367{
1369 return SmCall(&DrainIdle);
1370}

Referenced by EnterHubResetIssued().

◆ EnterDrainingEmpty()

SM_RESULT PortMachine::EnterDrainingEmpty ( )
private

Definition at line 1373 of file portsm_port.cpp.

◆ EnterDrainRearming()

SM_RESULT PortMachine::EnterDrainRearming ( )
private

Definition at line 736 of file portsm_frames.cpp.

737{
739 return DrainDone();
740}
SM_RESULT DrainDone()

◆ EnterEnablingSuperSpeed()

SM_RESULT PortMachine::EnterEnablingSuperSpeed ( )
private

Definition at line 1581 of file portsm_port.cpp.

1582{
1584 return SmHandled();
1585}
VOID SendLinkRxDetect()
Definition: portxfer.cpp:221

◆ EnterErrorRestarting()

SM_RESULT PortMachine::EnterErrorRestarting ( )
private

Definition at line 1122 of file portsm_port.cpp.

1123{
1125}
SM_RESULT CallStatusRead(_In_ READ_KIND Kind)

◆ EnterHubResetIssued()

SM_RESULT PortMachine::EnterHubResetIssued ( )
private

Definition at line 1359 of file portsm_port.cpp.

1360{
1362 return EnterDraining();
1363}
SM_RESULT EnterDraining()

◆ EnterNotifyingOverCurrent()

SM_RESULT PortMachine::EnterNotifyingOverCurrent ( )
private

Definition at line 587 of file portsm_port.cpp.

588{
591}
VOID NotifyUserOfOverCurrent()
Definition: hubport.cpp:604
static const State UserResetWait
Definition: portsm.h:215

◆ EnterOffEmpty()

SM_RESULT PortMachine::EnterOffEmpty ( )
private

Definition at line 665 of file portsm.cpp.

666{
668 return SmHandled();
669}
VOID ClearPortStatus()
Definition: portxfer.cpp:685

◆ EnterOffSuspended()

SM_RESULT PortMachine::EnterOffSuspended ( )
private

Definition at line 789 of file portsm.cpp.

790{
792 return SmHandled();
793}
VOID DropPortPowerReference()
Definition: fanout.cpp:982

◆ EnterPlainStatusRead()

SM_RESULT PortMachine::EnterPlainStatusRead ( )
private

Definition at line 392 of file portsm_frames.cpp.

393{
395}

◆ EnterPoweringPort()

SM_RESULT PortMachine::EnterPoweringPort ( )
private

Definition at line 1480 of file portsm_port.cpp.

1481{
1482 SendPortPower();
1483 return SmHandled();
1484}
VOID SendPortPower()
Definition: portxfer.cpp:228

◆ EnterPowerOnSettling()

SM_RESULT PortMachine::EnterPowerOnSettling ( )
private

Definition at line 785 of file portsm_frames.cpp.

786{
788 return SmHandled();
789}
@ PsmTimerPowerOn
Definition: portsm.h:98

◆ EnterPowerUpRearming()

SM_RESULT PortMachine::EnterPowerUpRearming ( )
private

Definition at line 861 of file portsm_frames.cpp.

862{
864 return SmHandled();
865}

◆ EnterPowerUpResetHub()

SM_RESULT PortMachine::EnterPowerUpResetHub ( )
private

Definition at line 854 of file portsm_frames.cpp.

855{
857 return SmHandled();
858}

◆ EnterQuiescingForHubSuspend()

SM_RESULT PortMachine::EnterQuiescingForHubSuspend ( )
private

Definition at line 1544 of file portsm_port.cpp.

1545{
1546 if (m_Usb3)
1547 SendSuspend();
1548 else
1549 SendDisable();
1550
1551 return SmHandled();
1552}

◆ EnterReadingStatus()

SM_RESULT PortMachine::EnterReadingStatus ( )
private

Definition at line 1487 of file portsm_port.cpp.

1488{
1489 SendGetStatus();
1490 return SmHandled();
1491}
VOID SendGetStatus()
Definition: portxfer.cpp:152

◆ EnterReconnectRearming()

SM_RESULT PortMachine::EnterReconnectRearming ( )
private

Definition at line 1049 of file portsm_frames.cpp.

1050{
1052
1053 if (DeviceConnected() && StopTimer())
1054 return ResumeReadDone();
1055
1056 return SmTransition(&ReconnectWait);
1057}
SM_RESULT ResumeReadDone()
static const State ReconnectWait
Definition: portsm.h:318

◆ EnterResetPollChecking()

SM_RESULT PortMachine::EnterResetPollChecking ( )
private

Definition at line 488 of file portsm_frames.cpp.

489{
491}

◆ EnterResetPollWait()

SM_RESULT PortMachine::EnterResetPollWait ( )
private

Definition at line 471 of file portsm_frames.cpp.

472{
474 return SmHandled();
475}
@ PsmTimerResetPoll
Definition: portsm.h:102

◆ EnterResetTimeoutStatus()

SM_RESULT PortMachine::EnterResetTimeoutStatus ( )
private

Definition at line 1588 of file portsm_port.cpp.

1589{
1591}

◆ EnterResetWait()

SM_RESULT PortMachine::EnterResetWait ( )
private

Definition at line 1175 of file portsm_port.cpp.

1176{
1177 if (!m_Usb3)
1178 return SmCall(&ChangeIdle20);
1179
1180 if (SmCurrent() == &ResetWait)
1182
1183 return SmCall(&ResetChangeIdle);
1184}
static const State ResetWait
Definition: portsm.h:237
static const State ChangeIdle20
Definition: portsm.h:278
static const State ResetChangeIdle
Definition: portsm.h:286
const State * SmCurrent() const
Definition: smengine.h:130
@ PsmTimerResetCompletion
Definition: portsm.h:95

◆ EnterResumeWait()

SM_RESULT PortMachine::EnterResumeWait ( )
private

Definition at line 1270 of file portsm_port.cpp.

1271{
1273}
static const State ResumeChangeIdle
Definition: portsm.h:290

◆ EnterResumingAttached()

SM_RESULT PortMachine::EnterResumingAttached ( )
private

Definition at line 1037 of file portsm_port.cpp.

1038{
1040 return SmCall(&ResumeReading);
1041
1042 return SmCall(&ResumePowering);
1043}
static const State ResumingAttached
Definition: portsm.h:230
BOOLEAN m_WarmResume
Definition: portsm.h:961

◆ EnterReturning()

SM_RESULT PortMachine::EnterReturning ( )
private

Definition at line 297 of file portsm.cpp.

298{
299 return SmReturn(m_ReturnEvent);
300}
PortEvent m_ReturnEvent
Definition: portsm.h:959

◆ EnterSendingReset()

SM_RESULT PortMachine::EnterSendingReset ( )
private

Definition at line 1494 of file portsm_port.cpp.

1495{
1496 SendReset();
1497 return SmHandled();
1498}
VOID SendReset()
Definition: portxfer.cpp:177

◆ EnterSendingResume()

SM_RESULT PortMachine::EnterSendingResume ( )
private

Definition at line 1508 of file portsm_port.cpp.

1509{
1510 SendResume();
1511 return SmHandled();
1512}
VOID SendResume()
Definition: portxfer.cpp:197

◆ EnterSendingSuspend()

SM_RESULT PortMachine::EnterSendingSuspend ( )
private

Definition at line 1515 of file portsm_port.cpp.

1516{
1517 SendSuspend();
1518 return SmHandled();
1519}

◆ EnterSendingWarmReset()

SM_RESULT PortMachine::EnterSendingWarmReset ( )
private

Definition at line 1501 of file portsm_port.cpp.

1502{
1503 SendWarmReset();
1504 return SmHandled();
1505}
VOID SendWarmReset()
Definition: portxfer.cpp:184

◆ EnterSettingLpmTimeout()

SM_RESULT PortMachine::EnterSettingLpmTimeout ( )
private

Definition at line 1555 of file portsm_port.cpp.

1556{
1557 if (m_LpmU2)
1558 SendU2Timeout();
1559 else
1560 SendU1Timeout();
1561
1562 return SmHandled();
1563}
BOOLEAN m_LpmU2
Definition: portsm.h:963
VOID SendU2Timeout()
Definition: portxfer.cpp:250
VOID SendU1Timeout()
Definition: portxfer.cpp:238

◆ EnterStartingAttached()

SM_RESULT PortMachine::EnterStartingAttached ( )
private

Definition at line 1008 of file portsm_port.cpp.

1009{
1010 return SmCall(&PowerOnSending);
1011}
static const State PowerOnSending
Definition: portsm.h:306

◆ EnterStartingEmpty()

SM_RESULT PortMachine::EnterStartingEmpty ( )
private

Definition at line 362 of file portsm_port.cpp.

363{
365}
static const State StartReadingFirst
Definition: portsm.h:309

◆ EnterStartResumeStatusRead()

SM_RESULT PortMachine::EnterStartResumeStatusRead ( )
private

Definition at line 398 of file portsm_frames.cpp.

399{
401}

◆ EnterStatusFailing()

SM_RESULT PortMachine::EnterStatusFailing ( )
private

Definition at line 645 of file portsm_frames.cpp.

646{
648 return SmReturn(PortEvent::ChangeNeedsHubReset);
649}

◆ EnterStatusReading()

SM_RESULT PortMachine::EnterStatusReading ( )
private

Definition at line 551 of file portsm_frames.cpp.

552{
553 if (m_ReadFresh)
554 {
557 KeepHubAwake();
558 }
559
561 return SmHandled();
562}
VOID ResetChangeAccumulator()
Definition: hubport.cpp:459
VOID KeepHubAwake()
Definition: portsm.cpp:257

◆ EnterStatusReporting()

SM_RESULT PortMachine::EnterStatusReporting ( )
private

Definition at line 638 of file portsm_frames.cpp.

639{
641 return SmReturn(NextChange());
642}

◆ EnterSuspended()

SM_RESULT PortMachine::EnterSuspended ( )
private

Definition at line 833 of file portsm_port.cpp.

834{
836}
static const State ChangeIdle30
Definition: portsm.h:284
static const State SuspendIdle
Definition: portsm.h:328

◆ EnterSuspendedD3Cold()

SM_RESULT PortMachine::EnterSuspendedD3Cold ( )
private

Definition at line 935 of file portsm_port.cpp.

936{
937 return SmCall(&D3Idle);
938}

◆ EnterSuspendRecovery()

SM_RESULT PortMachine::EnterSuspendRecovery ( )
private

Definition at line 1282 of file portsm_frames.cpp.

1283{
1285 return SmHandled();
1286}
@ PsmTimerResumeRecovery
Definition: portsm.h:97

◆ EnterSuspendReporting()

SM_RESULT PortMachine::EnterSuspendReporting ( )
private

Definition at line 1299 of file portsm_frames.cpp.

1300{
1301 if (m_SuspendReport == PortEvent::ChangeResumed)
1303
1305
1306 if (m_SuspendReport != PortEvent::ChangeConnect)
1308
1309 if (!D3ColdEnabled())
1310 return ReturnFromFrame(PortEvent::ChangeConnect);
1311
1312 /* The device lost power while suspended, give it time to come back */
1313 if (!DeviceConnected())
1314 return SmTransition(&D3Idle);
1315
1318 return SmTransition(&D3Debouncing);
1319}
PortEvent m_SuspendReport
Definition: portsm.h:957
BOOLEAN D3ColdEnabled()
Definition: hubport.cpp:572
@ PsmNoticeResumed
Definition: portsm.h:77

◆ EnterSystemResuming()

SM_RESULT PortMachine::EnterSystemResuming ( )
private

Definition at line 1093 of file portsm_port.cpp.

1094{
1095 return SmCall(&SystemResumeReading);
1096}
static const State SystemResumeReading
Definition: portsm.h:324

◆ EnterWakeArming()

SM_RESULT PortMachine::EnterWakeArming ( )
private

Definition at line 1680 of file portsm_frames.cpp.

1681{
1683
1684 if (!enable)
1686
1687 KeepHubAwake();
1689 return SmHandled();
1690}
VOID SendRemoteWake(_In_ BOOLEAN Enable)
Definition: portxfer.cpp:263
BOOLEAN HubArmedForWake()
Definition: fanout.cpp:1018
GLboolean enable
Definition: glext.h:11120

◆ EnterWithPortChange()

SM_RESULT PortMachine::EnterWithPortChange ( )
private

Definition at line 305 of file portsm_port.cpp.

306{
308}

Referenced by EnterDebouncing(), and EnterDisconnected().

◆ ErrorResponse()

PortEvent PortMachine::ErrorResponse ( )

Definition at line 673 of file portxfer.cpp.

674{
677 {
678 return PortEvent::ErrorCycle;
679 }
680
681 return PortEvent::ErrorIgnore;
682}
USHORT m_ChangeAccumulator
Definition: hubport.h:246
#define PC_RESET
Definition: hubreq.h:140
#define PS_ENABLED
Definition: hubreq.h:127

Referenced by HandleConnectedFault(), OnDebouncing(), OnOldDeviceWait(), and TimedError().

◆ ErrorResponseDuringReset()

PortEvent PortMachine::ErrorResponseDuringReset ( )

Definition at line 640 of file portxfer.cpp.

641{
644
645 DPRINT1("Hub %p port %u bad status during reset: status 0x%x change 0x%x\n",
647
648 if (Change & PC_CONNECT)
649 return (Status & PS_CONNECTED) ? PortEvent::ErrorIgnore : PortEvent::ErrorCycle;
650
651 if (Change & PC_RESET)
652 {
653 if (!(Status & PS_CONNECTED))
654 return (Status & PS_ENABLED) ? PortEvent::ErrorCycle : PortEvent::ChangeNeedsHubReset;
655
656 if (Status & PS_SUSPENDED)
657 return PortEvent::ErrorCycle;
658
660 {
662 return PortEvent::ChangeOverCurrent;
663 }
664 }
665
666 if (Change & PC_ENABLE)
667 return (Status & PS_ENABLED) ? PortEvent::ErrorEnabledWhileReset : PortEvent::ErrorIgnore;
668
669 return PortEvent::ErrorIgnore;
670}
#define PS_SUSPENDED
Definition: hubreq.h:128
#define PS_OVER_CURRENT
Definition: hubreq.h:129
#define PC_ENABLE
Definition: hubreq.h:137
@ DeviceCausedOvercurrent
Definition: usbioctl.h:282

Referenced by TimedError().

◆ FailDeviceRequest()

SM_RESULT PortMachine::FailDeviceRequest ( )
private

Definition at line 654 of file portsm_frames.cpp.

655{
657 return SmTransition(&DrainIdle);
658}
@ PsmNoticeFailed
Definition: portsm.h:74

Referenced by OnDrainIdle().

◆ FailToHubReset()

SM_RESULT PortMachine::FailToHubReset ( )
private

Definition at line 648 of file portsm.cpp.

649{
652}
static const State HubResetIssued
Definition: portsm.h:244

Referenced by OnReadingAfterResumeTimeout(), OnReadingForResume(), OnSendingResume(), and OnSendingSuspend().

◆ FixPortStateAfterPowerUp()

VOID PortMachine::FixPortStateAfterPowerUp ( )

Definition at line 692 of file portxfer.cpp.

693{
694}

Referenced by StatusQuiet().

◆ FollowTimer()

SM_RESULT PortMachine::FollowTimer ( _In_ TIMER_FOLLOW_UP  FollowUp)
private

Definition at line 485 of file portsm.cpp.

487{
488 if (FollowUp == FollowOverCurrent)
489 return StartOverCurrentWait();
490
491 if (FollowUp == FollowOverCurrentCleared)
492 return SmTransition(&PoweringPort);
493
494 return CheckConnection();
495}

Referenced by OnTimerFlush(), and StopTimerThen().

◆ ForceResetOnEnumeration()

VOID PortMachine::ForceResetOnEnumeration ( )

Definition at line 451 of file hubport.cpp.

452{
453 m_Port->m_Child->SetState(ChildState::WarmResetOnEnumeration);
454}
VOID SetState(_In_ ChildState Flag)
Definition: hubchild.h:267

Referenced by EnterDisablingOnRequest(), OnDisabledInSuspend(), OnSuspended(), OnSystemResumeReading(), ReattachOrCreate(), and SystemResumeFailed().

◆ ForgetDetachedDevice()

VOID PortMachine::ForgetDetachedDevice ( )

Definition at line 389 of file hubport.cpp.

390{
392
393 if (Child != NULL)
394 {
395 if (Child->HasState(ChildState::DifferentDeviceOnBootPort))
396 DPRINT("Port %u wrong device on the boot device port detached\n", m_Port->Number());
397
398 Child->ClearState(ChildState::DifferentDeviceOnBootPort);
399
400 if (!m_Port->HasFlag(PortFlag::SupportsReattach))
401 {
402 DPRINT("Port %u deleting detached device %p\n", m_Port->Number(), Child);
404 HubDeleteDeferred(Child->m_Object);
405 }
406 }
407
408 m_Port->ClearFlag(PortFlag::DeviceConnected);
409
412}
FORCEINLINE VOID NTAPI HubDeleteDeferred(_In_ WDFOBJECT Object)
Definition: hubutil.h:195
@ NoDeviceConnected
Definition: usbioctl.h:278

Referenced by SmOnDequeue().

◆ HandleConnectedFault()

SM_RESULT PortMachine::HandleConnectedFault ( _In_ const State *  Stay)
private

Handles a 2.0 port status that makes no sense for an attached port.

Definition at line 502 of file portsm.cpp.

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}
static const State DisablingForCycle
Definition: portsm.h:261
SM_RESULT DetachThen(_In_ PortEvent Change)
Definition: portsm.cpp:426
static const State ResumeAckWait
Definition: portsm.h:227
SM_RESULT ResetHubThen(_In_ const State *Target)
Definition: portsm.cpp:281
PortEvent ErrorResponse()
Definition: portxfer.cpp:673
SM_RESULT CycleDetach()
Definition: portsm.cpp:466
#define SM_BREAK(Message)
Definition: smengine.h:18

Referenced by OnAttachedDisabled(), OnEnabled(), OnResumeAckWait(), OnStartingAttached(), and OnSuspended().

◆ HoldsHubPower()

BOOLEAN PortMachine::HoldsHubPower ( ) const
inline

Definition at line 150 of file portsm.h.

151 {
152 return m_HubPowerHeld;
153 }
BOOLEAN m_HubPowerHeld
Definition: portsm.h:952

◆ HubArmedForWake()

BOOLEAN PortMachine::HubArmedForWake ( )

Definition at line 1018 of file fanout.cpp.

1019{
1020 return m_Port->m_Hub->HasFlag(HubFlag::ArmedForWake);
1021}
BOOLEAN HasFlag(_In_ HubFlag Flag) const
Definition: fdo.h:153

Referenced by EnterWakeArming().

◆ HubPowerDrop()

VOID PortMachine::HubPowerDrop ( )

Definition at line 218 of file hubport.cpp.

219{
220 if (!m_Port->HasMuxFlag(PortMuxFlag::WdfPowerReference))
221 return;
222
223 m_Port->ClearMuxFlag(PortMuxFlag::WdfPowerReference);
225}
WDFDEVICE m_Device
Definition: fdo.h:349
BOOLEAN HasMuxFlag(_In_ PortMuxFlag Flag) const
Definition: hubport.h:164
VOID ClearMuxFlag(_In_ PortMuxFlag Flag)
Definition: hubport.h:178
#define WdfDeviceResumeIdle(Device)
Definition: wdfdevice.h:1983

Referenced by UpdateHubPower().

◆ HubPowerTake()

BOOLEAN PortMachine::HubPowerTake ( )

Definition at line 198 of file hubport.cpp.

199{
202
203 if (!Hub->HasFlag(HubFlag::PowerReferenceAllowed))
204 return FALSE;
205
207 if (!NT_SUCCESS(Status))
208 {
209 DPRINT1("Port %u could not take a hub power reference 0x%lx\n", m_Port->Number(), Status);
210 return FALSE;
211 }
212
213 m_Port->SetMuxFlag(PortMuxFlag::WdfPowerReference);
214 return TRUE;
215}
LONG NTSTATUS
Definition: precomp.h:26
VOID SetMuxFlag(_In_ PortMuxFlag Flag)
Definition: hubport.h:171
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define WdfDeviceStopIdle(Device, WaitForD0)
Definition: wdfdevice.h:1977

Referenced by UpdateHubPower().

◆ Initialize()

VOID PortMachine::Initialize ( _In_ HubPort *  Port,
_In_ BOOLEAN  SuperSpeed 
)

Definition at line 143 of file portsm.cpp.

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}
HubPort * Port() const
Definition: portsm.h:138
PortEvent m_D3FlushReturn
Definition: portsm.h:958
BOOLEAN m_AttachForcedReset
Definition: portsm.h:962
BOOLEAN m_ArmForEmpty
Definition: portsm.h:964
static const State OffInitial
Definition: portsm.h:196
TIMER_FOLLOW_UP m_AfterTimer
Definition: portsm.h:953
BOOLEAN m_ReconnectFlushOnStop
Definition: portsm.h:968
VOID SmInitialize(_In_ const State *Initial)
Definition: smengine.h:349

◆ IsSuperSpeed()

BOOLEAN PortMachine::IsSuperSpeed ( ) const
inline

Definition at line 144 of file portsm.h.

145 {
146 return m_Usb3;
147 }

◆ KeepHubAwake()

VOID PortMachine::KeepHubAwake ( )
private

Definition at line 257 of file portsm.cpp.

258{
260}
VOID UpdateHubPower(_In_ BOOLEAN Idle)
Definition: portsm.cpp:238

Referenced by EnterStatusReading(), and EnterWakeArming().

◆ LinkInU0()

BOOLEAN PortMachine::LinkInU0 ( )

◆ LogLinkStateError()

VOID PortMachine::LogLinkStateError ( )

Definition at line 619 of file hubport.cpp.

620{
622
623 if (Link == LINK_SS_INACTIVE)
625 else if (Link == LINK_COMPLIANCE)
627}
ULONG m_EnumMessageId
Definition: hubchild.h:355
#define HUB_ENUM_LINK_COMPLIANCE
Definition: hubid.h:33
#define HUB_ENUM_LINK_SS_INACTIVE
Definition: hubid.h:32

Referenced by OnResetTimeoutStatus().

◆ LostChange()

PortEvent PortMachine::LostChange ( )

Definition at line 593 of file portxfer.cpp.

594{
598 PortEvent Result = PortEvent::SubDone;
599
601
602 if ((Status ^ Previous) & PS_CONNECTED)
603 {
604 if (!(Change & PC_CONNECT))
605 {
606 Result = PortEvent::ChangeConnect;
607 }
610 {
612 }
613 }
615 {
617 Result = PortEvent::ChangeOverCurrent;
618 }
620 {
622 Result = PortEvent::ChangeOverCurrentCleared;
623 DPRINT1("Hub %p port %u over current cleared without a change\n", m_Port->m_Hub, m_Port->Number());
624 }
625 else if (!(Status & PS_ENABLED) && (Previous & PS_ENABLED) && !(Change & PC_ENABLE))
626 {
627 Result = PortEvent::ChangeDisabled;
628 }
629 else if (!(Status & PS_SUSPENDED) && (Previous & PS_SUSPENDED) && !(Change & PC_SUSPEND))
630 {
631 Result = PortEvent::ChangeResumed;
632 }
633
636 return Result;
637}
PortEvent m_LastChange
Definition: hubport.h:248
BOOLEAN m_InitialConnectPowerReference
Definition: hubport.h:252
Previous
#define PC_OVER_CURRENT
Definition: hubreq.h:139
static VOID NTAPI PortReportChange(_In_ HubPort *Port, _In_ PortEvent Result, _In_ USHORT Status, _In_ USHORT Previous, _In_ USHORT Change)
Definition: portxfer.cpp:502
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by OnStartReading20(), and ResumeReadDone().

◆ MarkOverCurrentCause()

VOID PortMachine::MarkOverCurrentCause ( )

Definition at line 504 of file hubport.cpp.

Referenced by OnResumeReading().

◆ MarkUsb2Device()

VOID PortMachine::MarkUsb2Device ( )

Definition at line 439 of file hubport.cpp.

440{
442}
ULONG m_Kind
Definition: hubchild.h:328
#define DSM_KIND_PORT20
Definition: devsm.h:152

Referenced by DeviceArrived().

◆ MarkUsb3Device()

VOID PortMachine::MarkUsb3Device ( )

Definition at line 445 of file hubport.cpp.

446{
448}
#define DSM_KIND_PORT30
Definition: devsm.h:153
#define DSM_KIND_SUPER_SPEED
Definition: devsm.h:150

Referenced by ReattachOrCreate().

◆ NeedsDebounce()

BOOLEAN PortMachine::NeedsDebounce ( )

Definition at line 565 of file hubport.cpp.

566{
567 return !HubDriver.HasFlag(HubGlobal::PreventSuperSpeedDebounce) &&
569}
HubDriverState HubDriver
Definition: entry.cpp:13
volatile LONG SuperSpeedDebounceVotes
Definition: hubdriver.h:108
BOOLEAN HasFlag(_In_ HubGlobal Flag) const
Definition: hubdriver.h:119

Referenced by DeviceArrived().

◆ NextChange()

PortEvent PortMachine::NextChange ( )

Definition at line 555 of file portxfer.cpp.

556{
561
564
565 if (!m_Usb3)
566 {
570 return Result;
571 }
572
575
576 if (Result == PortEvent::ChangeLinkError)
578
579 if (Result == PortEvent::ChangeNeedsHubReset)
580 {
583 }
584
585 if (Result != PortEvent::ChangeNone)
587
588 return Result;
589}
ULONG m_LastResetPortStatus
Definition: fdo.h:438
ULONG m_FailureMessageId
Definition: fdo.h:402
ULONG m_LinkErrorCount
Definition: hubport.h:249
#define HUB_MSG_INVALID_PORT_STATUS
Definition: hubreq.h:150
static PortEvent NTAPI PortNextChange20(_In_ HubPort *Port, _In_ USHORT Status, _In_ USHORT Previous, _In_ USHORT Change)
Definition: portxfer.cpp:351
static PortEvent NTAPI PortNextChange30(_In_ HubPort *Port, _In_ USHORT Status, _In_ USHORT Previous, _In_ USHORT Change)
Definition: portxfer.cpp:395
static VOID NTAPI PortDropInitialConnectReference(_In_ HubPort *Port)
Definition: portxfer.cpp:337

Referenced by EnterChangeReporting20(), EnterStatusReporting(), OnSuspendReading(), and StatusQuiet().

◆ NotifyBootDeviceRemoval()

VOID PortMachine::NotifyBootDeviceRemoval ( )

Definition at line 416 of file hubport.cpp.

417{
419
420 if (!m_Port->HasFlag(PortFlag::SupportsReattach) ||
423 Child == NULL ||
424 InterlockedExchange(&Child->m_BootReportedMissing, 1) != 0)
425 {
426 return;
427 }
428
429 if (!Child->HasProperty(ChildProperty::IsHub))
430 m_Port->SetFlag(PortFlag::PendingRecoveryUpdate);
431
432 DPRINT("Port %u boot device %p reported missing\n", m_Port->Number(), Child);
433 HubNotifyBootDeviceRemoval(Child->m_BootHandle);
434}
#define InterlockedExchange
Definition: armddk.h:54
BOOLEAN IsHubResetInProgress() const
Definition: fdo.h:333
VOID NTAPI HubNotifyBootDeviceRemoval(_In_opt_ PVOID Handle)
Definition: entry.cpp:335

Referenced by EnterDisconnected().

◆ NotifyUserOfOverCurrent()

VOID PortMachine::NotifyUserOfOverCurrent ( )

Definition at line 604 of file hubport.cpp.

605{
606 m_Port->SetFlag(PortFlag::OverCurrentResetArmed);
607 DPRINT1("Hub %p port %u over current persists, notifying user\n", m_Port->m_Hub, m_Port->Number());
609}
VOID NTAPI HubWmiNotifyOverCurrent(_In_ HubFdo *Hub, _In_ ULONG PortNumber)
Definition: hubwmi.cpp:750

Referenced by EnterNotifyingOverCurrent().

◆ OldDevicePresent()

BOOLEAN PortMachine::OldDevicePresent ( )

Definition at line 552 of file hubport.cpp.

553{
554 return m_Port->HasFlag(PortFlag::DeviceConnected);
555}

Referenced by CheckOldDevice().

◆ OnArmingWake()

SM_RESULT PortMachine::OnArmingWake ( _In_ PortEvent  Event)
private

Definition at line 1953 of file portsm_port.cpp.

1955{
1956 if (Event != PortEvent::SubDone)
1957 return SmUnhandled();
1958
1959 if (m_ArmForEmpty)
1960 return PowerDown(&OffEmpty);
1961
1963}
static const State OffEmpty
Definition: portsm.h:197
static const State OffSuspendedUsb3
Definition: portsm.h:201
static SM_RESULT SmUnhandled()
Definition: smengine.h:188
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287

◆ OnAttached()

SM_RESULT PortMachine::OnAttached ( _In_ PortEvent  Event)
private

Definition at line 705 of file portsm_port.cpp.

707{
708 switch (Event)
709 {
710 case PortEvent::ChangeConnect:
711 case PortEvent::ChangeOverCurrent:
712 case PortEvent::ChangeOverCurrentCleared:
713 return DetachThen(Event);
714
715 case PortEvent::ChangeNeedsHubReset:
716 if (!m_Usb3)
717 return SmUnhandled();
719
720 case PortEvent::HubStopping:
721 return PowerDown(&OffAttached);
722
723 default:
724 return SmUnhandled();
725 }
726}
static const State OffAttached
Definition: portsm.h:198

Referenced by OnErrorRestarting().

◆ OnAttachedDisabled()

SM_RESULT PortMachine::OnAttachedDisabled ( _In_ PortEvent  Event)
private

Definition at line 786 of file portsm_port.cpp.

788{
789 switch (Event)
790 {
791 case PortEvent::ChangeError:
792 case PortEvent::ChangeDisabled:
793 case PortEvent::ChangeResetDone:
794 case PortEvent::ChangeResumed:
795 if (m_Usb3)
796 return SmUnhandled();
798
799 case PortEvent::DisableRequest:
800 if (m_Usb3)
805
806 case PortEvent::CycleRequest:
807 return CycleDetach();
808
809 case PortEvent::HubSuspending:
810 return PowerDown(&OffAttached);
811
812 case PortEvent::ResetRequest:
813 if (!m_Usb3)
816
817 case PortEvent::WarmResetRequest:
818 if (!m_Usb3)
819 return SmUnhandled();
821
822 case PortEvent::DisableSuperSpeedRequest:
823 if (!m_Usb3)
824 return SmUnhandled();
826
827 default:
828 return SmUnhandled();
829 }
830}
VOID RecordPortDisabled()
Definition: hubport.cpp:465
SM_RESULT TakeInterruptForReset(_In_ const State *Start, _In_ const State *Refused)
Definition: portsm.cpp:594
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
static const State SendingReset
Definition: portsm.h:256
static const State DisablingSuperSpeedOnRequest
Definition: portsm.h:271
static const State SendingWarmReset
Definition: portsm.h:257
static const State DisablingOnRequest
Definition: portsm.h:260
@ PsmNoticeDisabled
Definition: portsm.h:75

◆ OnAttachFailedWait()

SM_RESULT PortMachine::OnAttachFailedWait ( _In_ PortEvent  Event)
private

Definition at line 1439 of file portsm_port.cpp.

1441{
1442 if ((Event != PortEvent::HubStopping) && (Event != PortEvent::HubSuspending))
1443 return SmUnhandled();
1444
1445 if (!m_Usb3)
1446 return PowerDown(&OffEmpty);
1447
1448 if ((Event == PortEvent::HubSuspending) && !m_AttachForcedReset)
1450
1451 return PowerDown(&OffResetNeeded);
1452}
static const State OffResetNeeded
Definition: portsm.h:199
static const State QuiescingForHubSuspend
Definition: portsm.h:263

◆ OnChangeAcking20()

SM_RESULT PortMachine::OnChangeAcking20 ( _In_ PortEvent  Event)
private

Definition at line 335 of file portsm_frames.cpp.

337{
338 if (Event == PortEvent::TransferFailed)
339 return ParkChange20(TRUE);
340
341 if (Event == PortEvent::TransferDone)
343
344 return SmUnhandled();
345}
SM_RESULT CheckPending20(_In_ const State *Acking, _In_ const State *Quiet)
static const State ChangeAcking20
Definition: portsm.h:280
static const State ChangeReading20
Definition: portsm.h:279

◆ OnChangeChecking30()

SM_RESULT PortMachine::OnChangeChecking30 ( _In_ PortEvent  Event)
private

Definition at line 414 of file portsm_frames.cpp.

416{
417 switch (Event)
418 {
419 case PortEvent::ChangeError:
420 case PortEvent::ChangeResetBusy:
421 case PortEvent::ChangeResetDone:
422 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
423
424 case PortEvent::ChangeLinkError:
425 return ReturnFromFrame(PortEvent::ChangeConnect);
426
427 case PortEvent::ChangeNone:
428 case PortEvent::ChangeResumed:
429 return SmTransition(&ChangeIdle30);
430
431 default:
432 return SmUnhandled();
433 }
434}

◆ OnChangeIdle20()

SM_RESULT PortMachine::OnChangeIdle20 ( _In_ PortEvent  Event)
private

Definition at line 285 of file portsm_frames.cpp.

287{
288 if (Event != PortEvent::StatusChanged)
289 return SmUnhandled();
290
293}

◆ OnChangeIdle30()

SM_RESULT PortMachine::OnChangeIdle30 ( _In_ PortEvent  Event)
private

Definition at line 404 of file portsm_frames.cpp.

406{
407 if (Event == PortEvent::StatusChanged)
409
410 return SmUnhandled();
411}
static const State ChangeChecking30
Definition: portsm.h:285

◆ OnChangeParked20()

SM_RESULT PortMachine::OnChangeParked20 ( _In_ PortEvent  Event)
private

Definition at line 371 of file portsm_frames.cpp.

373{
374 if (Event == PortEvent::StatusChanged)
375 return ParkChange20(FALSE);
376
377 return SmUnhandled();
378}

◆ OnChangeReading20()

SM_RESULT PortMachine::OnChangeReading20 ( _In_ PortEvent  Event)
private

Definition at line 322 of file portsm_frames.cpp.

324{
325 if (Event == PortEvent::TransferFailed)
326 return ParkChange20(TRUE);
327
328 if (Event == PortEvent::TransferDone)
330
331 return SmUnhandled();
332}
static const State ChangeReporting20
Definition: portsm.h:281

◆ OnCleaningUp()

SM_RESULT PortMachine::OnCleaningUp ( _In_ PortEvent  Event)
private

Definition at line 834 of file portsm.cpp.

836{
837 if (Event == PortEvent::DeviceGone)
838 return SmTransition(&Deleted);
839
840 return SmUnhandled();
841}
static const State Deleted
Definition: portsm.h:204

◆ OnD3DebounceFlush()

SM_RESULT PortMachine::OnD3DebounceFlush ( _In_ PortEvent  Event)
private

Definition at line 1532 of file portsm_frames.cpp.

1534{
1535 switch (Event)
1536 {
1537 case PortEvent::TimerExpired:
1539
1540 case PortEvent::HubStopping:
1541 m_D3FlushReturn = PortEvent::HubStopping;
1543
1544 case PortEvent::HubSuspending:
1545 if (m_D3AfterResume)
1546 return SmUnhandled();
1547 m_D3FlushReturn = PortEvent::HubSuspending;
1549
1550 default:
1551 return SmUnhandled();
1552 }
1553}
static const State D3FlushThenReturn
Definition: portsm.h:338

◆ OnD3Debouncing()

SM_RESULT PortMachine::OnD3Debouncing ( _In_ PortEvent  Event)
private

Definition at line 1492 of file portsm_frames.cpp.

1494{
1495 switch (Event)
1496 {
1497 case PortEvent::ChangeError:
1498 case PortEvent::ChangeDisabled:
1499 case PortEvent::ChangeConnect:
1500 case PortEvent::ChangeResumed:
1501 case PortEvent::ChangeResetDone:
1502 return D3StopDebounceTimer();
1503
1504 case PortEvent::ChangeOverCurrent:
1506
1507 case PortEvent::ChangeOverCurrentCleared:
1509
1510 case PortEvent::TimerExpired:
1511 if (!m_D3AfterResume)
1514 return ReturnFromFrame(PortEvent::ChangeDisabled);
1515
1516 case PortEvent::HubStopping:
1517 m_D3FlushReturn = PortEvent::HubStopping;
1519
1520 case PortEvent::HubSuspending:
1521 if (m_D3AfterResume)
1522 return SmUnhandled();
1523 m_D3FlushReturn = PortEvent::HubSuspending;
1525
1526 default:
1527 return SmUnhandled();
1528 }
1529}
static const State D3ResumeAckWait
Definition: portsm.h:339
SM_RESULT D3StopReconnectTimer(_In_ D3_PENDING Pending)
SM_RESULT D3StopDebounceTimer()
@ PsmNoticeStateDisabled
Definition: portsm.h:81

◆ OnD3FlushThenReturn()

SM_RESULT PortMachine::OnD3FlushThenReturn ( _In_ PortEvent  Event)
private

Definition at line 1556 of file portsm_frames.cpp.

1558{
1559 if (Event == PortEvent::TimerExpired)
1561
1562 return SmUnhandled();
1563}

◆ OnD3Idle()

SM_RESULT PortMachine::OnD3Idle ( _In_ PortEvent  Event)
private

Definition at line 1391 of file portsm_frames.cpp.

1393{
1394 switch (Event)
1395 {
1396 case PortEvent::ChangeDisabled:
1397 case PortEvent::ChangeResetDone:
1398 case PortEvent::ChangeError:
1399 case PortEvent::ChangeResumed:
1400 if (m_Usb3)
1401 return SmUnhandled();
1402 return D3ConnectCheck(FALSE);
1403
1404 case PortEvent::ChangeConnect:
1405 if (!m_Usb3)
1406 return D3ConnectCheck(FALSE);
1407 if (!DevicePresent())
1408 return SmTransition(&D3Idle);
1411
1412 case PortEvent::ChangeOverCurrent:
1413 case PortEvent::ChangeOverCurrentCleared:
1414 case PortEvent::HubStopping:
1415 return ReturnFromFrame(Event);
1416
1417 case PortEvent::ChangeNeedsHubReset:
1418 if (!m_Usb3)
1419 return SmUnhandled();
1420 return ReturnFromFrame(Event);
1421
1422 case PortEvent::ResumeRequest:
1423 case PortEvent::DisableRequest:
1426
1427 case PortEvent::HubSuspending:
1429 return SmTransition(&D3PoweredOff);
1430
1431 default:
1432 return SmUnhandled();
1433 }
1434}
static const State D3PoweredOff
Definition: portsm.h:334
static const State D3ReconnectWait
Definition: portsm.h:340
@ PsmTimerD3ColdReconnect
Definition: portsm.h:100

◆ OnD3PoweredOff()

SM_RESULT PortMachine::OnD3PoweredOff ( _In_ PortEvent  Event)
private

Definition at line 1437 of file portsm_frames.cpp.

1439{
1440 switch (Event)
1441 {
1442 case PortEvent::HubResumedInS0:
1443 return PowerUp(&D3Idle);
1444
1445 case PortEvent::HubResumed:
1446 case PortEvent::HubResumedWithReset:
1447 if (m_Usb3)
1448 {
1450 return PowerUp(&D3Idle);
1451 }
1452 m_D3PowerUpWarm = (Event == PortEvent::HubResumed);
1453 return SmTransition(&D3PoweringUp);
1454
1455 default:
1456 return SmUnhandled();
1457 }
1458}
static const State D3PoweringUp
Definition: portsm.h:335
@ PsmNoticeStateSuspended
Definition: portsm.h:83

◆ OnD3PoweringUp()

SM_RESULT PortMachine::OnD3PoweringUp ( _In_ PortEvent  Event)
private

Definition at line 1467 of file portsm_frames.cpp.

1469{
1470 switch (Event)
1471 {
1472 case PortEvent::ChangeOverCurrent:
1473 case PortEvent::ChangeOverCurrentCleared:
1474 return ReturnFromFrame(Event);
1475
1476 case PortEvent::SubDone:
1477 case PortEvent::ChangeConnect:
1478 case PortEvent::ChangeError:
1479 case PortEvent::ChangeResumed:
1480 case PortEvent::ChangeResetDone:
1481 if (!DeviceConnected())
1482 return ReturnFromFrame(PortEvent::ChangeConnect);
1484 return ReturnFromFrame(PortEvent::ChangeDisabled);
1485
1486 default:
1487 return SmUnhandled();
1488 }
1489}

◆ OnD3ReconnectFlush()

SM_RESULT PortMachine::OnD3ReconnectFlush ( _In_ PortEvent  Event)
private

Definition at line 1661 of file portsm_frames.cpp.

1663{
1664 if (Event == PortEvent::TimerExpired)
1665 return D3PendingDone(m_D3Pending);
1666
1667 /* Only the hub stop flush has nothing more to wait for */
1668 if ((Event == PortEvent::HubStopping) && (m_D3Pending != D3PendingStop))
1669 {
1672 }
1673
1674 return SmUnhandled();
1675}

◆ OnD3ReconnectWait()

SM_RESULT PortMachine::OnD3ReconnectWait ( _In_ PortEvent  Event)
private

Definition at line 1614 of file portsm_frames.cpp.

1616{
1617 switch (Event)
1618 {
1619 case PortEvent::ChangeResumed:
1620 case PortEvent::ChangeError:
1621 case PortEvent::ChangeResetDone:
1622 if (m_Usb3)
1623 return SmUnhandled();
1624 if (DeviceConnected())
1627
1628 case PortEvent::ChangeConnect:
1632
1633 case PortEvent::ChangeDisabled:
1634 if (m_Usb3)
1635 return SmUnhandled();
1637
1638 case PortEvent::ChangeOverCurrent:
1640
1641 case PortEvent::ChangeOverCurrentCleared:
1643
1644 case PortEvent::ChangeNeedsHubReset:
1645 if (!m_Usb3)
1646 return SmUnhandled();
1648
1649 case PortEvent::HubStopping:
1651
1652 case PortEvent::TimerExpired:
1653 return ReturnFromFrame(PortEvent::ChangeConnect);
1654
1655 default:
1656 return SmUnhandled();
1657 }
1658}

◆ OnD3ResumeAckWait()

SM_RESULT PortMachine::OnD3ResumeAckWait ( _In_ PortEvent  Event)
private

Definition at line 1566 of file portsm_frames.cpp.

1568{
1569 switch (Event)
1570 {
1571 case PortEvent::ChangeResetDone:
1572 case PortEvent::ChangeResumed:
1573 case PortEvent::ChangeDisabled:
1574 case PortEvent::ChangeError:
1575 if (m_Usb3)
1576 return SmUnhandled();
1577 return D3ConnectCheck(FALSE);
1578
1579 case PortEvent::ChangeConnect:
1580 if (!m_Usb3)
1581 return D3ConnectCheck(FALSE);
1582 if (DevicePresent())
1584 return ReturnFromFrame(PortEvent::ChangeConnect);
1585
1586 case PortEvent::ChangeOverCurrent:
1587 case PortEvent::ChangeOverCurrentCleared:
1588 case PortEvent::HubStopping:
1589 return ReturnFromFrame(Event);
1590
1591 case PortEvent::ChangeNeedsHubReset:
1592 if (!m_Usb3)
1593 return SmUnhandled();
1594 return ReturnFromFrame(Event);
1595
1596 case PortEvent::ResumeRequest:
1597 if (m_Usb3)
1598 return ReturnFromFrame(PortEvent::ChangeResumed);
1600 return ReturnFromFrame(PortEvent::ChangeDisabled);
1601
1602 case PortEvent::DisableRequest:
1603 if (m_Usb3)
1604 return SmUnhandled();
1606 return ReturnFromFrame(PortEvent::ChangeDisabled);
1607
1608 default:
1609 return SmUnhandled();
1610 }
1611}

◆ OnDebouncing()

SM_RESULT PortMachine::OnDebouncing ( _In_ PortEvent  Event)
private

Definition at line 396 of file portsm_port.cpp.

398{
399 PortEvent response;
400
401 switch (Event)
402 {
403 case PortEvent::ChangeOverCurrentCleared:
405
406 case PortEvent::ChangeOverCurrent:
408
409 case PortEvent::ChangeConnect:
411
412 case PortEvent::ChangeNeedsHubReset:
413 if (!m_Usb3)
414 return SmUnhandled();
417
418 case PortEvent::ChangeDisabled:
419 case PortEvent::ChangeResumed:
420 case PortEvent::ChangeResetDone:
421 case PortEvent::ChangeError:
422 if (m_Usb3)
423 return SmUnhandled();
424
425 response = ErrorResponse();
426 switch (response)
427 {
428 case PortEvent::ChangeNeedsHubReset:
431
432 case PortEvent::ErrorIgnore:
433 case PortEvent::ChangeConnect:
435
436 case PortEvent::ErrorCycle:
438
439 case PortEvent::ErrorDisableAndCycle:
441
442 case PortEvent::ChangeOverCurrentCleared:
444
445 case PortEvent::ChangeOverCurrent:
447
448 default:
449 SM_BREAK("Port error response not valid here");
450 return SmHandled();
451 }
452
453 case PortEvent::TimerExpired:
454 if (!m_Usb3)
457
458 case PortEvent::HubSuspending:
459 if (m_Usb3)
462
463 case PortEvent::HubStopping:
464 if (m_Usb3)
466 if (StopTimer())
467 return PowerDown(&OffEmpty);
469
470 default:
471 return SmUnhandled();
472 }
473}
static const State EmptyHubResetWait
Definition: portsm.h:247
static const State EmptyHubResetTimerWait
Definition: portsm.h:248
static const State DisablingForCycleTimed
Definition: portsm.h:264
static const State FlushBeforeOffEmpty
Definition: portsm.h:217
static const State DisablingOnSuspendTimed
Definition: portsm.h:265

◆ OnDisabledInSuspend()

SM_RESULT PortMachine::OnDisabledInSuspend ( _In_ PortEvent  Event)
private

Definition at line 903 of file portsm_port.cpp.

905{
906 switch (Event)
907 {
908 case PortEvent::ChangeResumed:
909 if (SmFrame(0) != &SuspendedD3Cold)
910 return SmUnhandled();
911 return SmTransition(&Enabled);
912
913 case PortEvent::DisableRequest:
917
918 case PortEvent::HubSuspending:
920 return SmTransition(&ArmingWake);
921
922 case PortEvent::ResetRequest:
923 case PortEvent::WarmResetRequest:
925
926 case PortEvent::CycleRequest:
927 return CycleDetach();
928
929 default:
930 return SmUnhandled();
931 }
932}
static const State ArmingWake
Definition: portsm.h:275
static const State DisabledInSuspend
Definition: portsm.h:225
static const State SuspendedD3Cold
Definition: portsm.h:226
const State * SmFrame(_In_ ULONG Index) const
Definition: smengine.h:142

Referenced by OnSuspended().

◆ OnDisablingBeforeConnect()

SM_RESULT PortMachine::OnDisablingBeforeConnect ( _In_ PortEvent  Event)
private

Definition at line 1719 of file portsm_port.cpp.

1721{
1722 if (Event == PortEvent::TransferFailed)
1724
1725 if (Event == PortEvent::TransferDone)
1727
1728 return SmUnhandled();
1729}

◆ OnDisablingForCycle()

SM_RESULT PortMachine::OnDisablingForCycle ( _In_ PortEvent  Event)
private

Definition at line 1706 of file portsm_port.cpp.

1708{
1709 if (Event == PortEvent::TransferFailed)
1711
1712 if (Event == PortEvent::TransferDone)
1713 return SmTransition(&OldDeviceWait);
1714
1715 return SmUnhandled();
1716}

◆ OnDisablingForCycleTimed()

SM_RESULT PortMachine::OnDisablingForCycleTimed ( _In_ PortEvent  Event)
private

Definition at line 1750 of file portsm_port.cpp.

1752{
1753 if (Event == PortEvent::TransferFailed)
1754 {
1757 }
1758
1759 if (Event == PortEvent::TransferDone)
1760 return StopTimerThen(FollowCycle);
1761
1762 return SmUnhandled();
1763}

◆ OnDisablingOnRequest()

SM_RESULT PortMachine::OnDisablingOnRequest ( _In_ PortEvent  Event)
private

Definition at line 1685 of file portsm_port.cpp.

1687{
1688 if (Event == PortEvent::TransferFailed)
1689 {
1692 }
1693
1694 if (Event != PortEvent::TransferDone)
1695 return SmUnhandled();
1696
1698 if (m_Usb3)
1700
1703}

◆ OnDisablingOnResetTimeout()

SM_RESULT PortMachine::OnDisablingOnResetTimeout ( _In_ PortEvent  Event)
private

Definition at line 1779 of file portsm_port.cpp.

1781{
1782 if (Event == PortEvent::TransferFailed)
1783 return ResetTransferFailed();
1784
1785 if (Event != PortEvent::TransferDone)
1786 return SmUnhandled();
1787
1791}
SM_RESULT ResetTransferFailed()
Definition: portsm.cpp:614
@ PsmNoticeResetTimedOut
Definition: portsm.h:84

◆ OnDisablingOnSuspendTimed()

SM_RESULT PortMachine::OnDisablingOnSuspendTimed ( _In_ PortEvent  Event)
private

Definition at line 1766 of file portsm_port.cpp.

1768{
1769 if (Event == PortEvent::TransferFailed)
1771
1772 if (Event == PortEvent::TransferDone)
1774
1775 return SmUnhandled();
1776}

◆ OnDisablingSuperSpeed()

SM_RESULT PortMachine::OnDisablingSuperSpeed ( _In_ PortEvent  Event)
private

Definition at line 1851 of file portsm_port.cpp.

1853{
1854 if ((Event == PortEvent::TransferDone) || (Event == PortEvent::TransferFailed))
1855 return PowerUp(&SsLinkDisabled);
1856
1857 return SmUnhandled();
1858}
static const State SsLinkDisabled
Definition: portsm.h:251

◆ OnDisablingSuperSpeedOnRequest()

SM_RESULT PortMachine::OnDisablingSuperSpeedOnRequest ( _In_ PortEvent  Event)
private

Definition at line 1861 of file portsm_port.cpp.

1863{
1864 if (Event == PortEvent::TransferFailed)
1866
1867 if (Event == PortEvent::TransferDone)
1868 {
1871 }
1872
1873 return SmUnhandled();
1874}
static const State SuperSpeedOffWait
Definition: portsm.h:250
@ PsmTimerSuperSpeedDisable
Definition: portsm.h:101

◆ OnDrainAcking()

SM_RESULT PortMachine::OnDrainAcking ( _In_ PortEvent  Event)
private

Definition at line 726 of file portsm_frames.cpp.

728{
729 if ((Event == PortEvent::TransferDone) || (Event == PortEvent::TransferFailed))
731
732 return SmUnhandled();
733}
static const State DrainRearming
Definition: portsm.h:303

◆ OnDrainChecking()

SM_RESULT PortMachine::OnDrainChecking ( _In_ PortEvent  Event)
private

Definition at line 743 of file portsm_frames.cpp.

745{
746 switch (Event)
747 {
748 case PortEvent::ChangeNone:
749 case PortEvent::ChangeResetDone:
750 case PortEvent::ChangeNeedsHubReset:
751 case PortEvent::ChangeLinkError:
752 case PortEvent::ChangeOverCurrentCleared:
753 case PortEvent::ChangeResetBusy:
754 case PortEvent::ChangeError:
755 case PortEvent::ChangeOverCurrent:
756 case PortEvent::ChangeResumed:
757 case PortEvent::ChangeConnect:
758 return DrainDone();
759
760 default:
761 return SmUnhandled();
762 }
763}

◆ OnDrainEmptyIdle()

SM_RESULT PortMachine::OnDrainEmptyIdle ( _In_ PortEvent  Event)
private

Definition at line 700 of file portsm_frames.cpp.

702{
703 if (Event == PortEvent::StatusChanged)
705
706 return SmUnhandled();
707}
static const State DrainReading
Definition: portsm.h:301
static const State DrainChecking
Definition: portsm.h:304

◆ OnDrainIdle()

SM_RESULT PortMachine::OnDrainIdle ( _In_ PortEvent  Event)
private

Definition at line 670 of file portsm_frames.cpp.

672{
673 switch (Event)
674 {
675 case PortEvent::DisableRequest:
676 case PortEvent::SuspendRequest:
677 case PortEvent::ResetRequest:
678 case PortEvent::ResumeRequest:
679 return FailDeviceRequest();
680
681 case PortEvent::HibernateRequest:
682 if (m_Usb3)
683 return SmUnhandled();
684 return FailDeviceRequest();
685
686 case PortEvent::WarmResetRequest:
687 if (!m_Usb3)
688 return SmUnhandled();
689 return FailDeviceRequest();
690
691 case PortEvent::StatusChanged:
693
694 default:
695 return SmUnhandled();
696 }
697}
SM_RESULT FailDeviceRequest()

◆ OnDrainReading()

SM_RESULT PortMachine::OnDrainReading ( _In_ PortEvent  Event)
private

Definition at line 710 of file portsm_frames.cpp.

712{
713 if (Event == PortEvent::TransferFailed)
715
716 if (Event != PortEvent::TransferDone)
717 return SmUnhandled();
718
720 return SmTransition(&DrainAcking);
721
723}
static const State DrainAcking
Definition: portsm.h:302

◆ OnEmpty()

SM_RESULT PortMachine::OnEmpty ( _In_ PortEvent  Event)
private

Definition at line 313 of file portsm_port.cpp.

315{
316 switch (Event)
317 {
318 case PortEvent::ChangeConnect:
319 return CheckConnection();
320
321 case PortEvent::ChangeOverCurrent:
322 return StartOverCurrentWait();
323
324 case PortEvent::ChangeOverCurrentCleared:
325 return SmTransition(&PoweringPort);
326
327 case PortEvent::ChangeResetDone:
328 case PortEvent::ChangeDisabled:
329 case PortEvent::ChangeResumed:
330 case PortEvent::ChangeError:
331 if (m_Usb3)
332 return SmUnhandled();
333 return SmTransition(&Disconnected);
334
335 case PortEvent::ChangeNeedsHubReset:
336 if (!m_Usb3)
337 return SmUnhandled();
339
340 case PortEvent::HubStopping:
341 return PowerDown(&OffEmpty);
342
343 case PortEvent::HubSuspending:
344 if (!m_Usb3)
345 return PowerDown(&OffEmpty);
347 return SmTransition(&ArmingWake);
348
349 default:
350 return SmUnhandled();
351 }
352}

◆ OnEmptyHubResetTimerWait()

SM_RESULT PortMachine::OnEmptyHubResetTimerWait ( _In_ PortEvent  Event)
private

Definition at line 1426 of file portsm_port.cpp.

1428{
1429 if (Event == PortEvent::TimerExpired)
1431
1432 if ((Event == PortEvent::HubStopping) || (Event == PortEvent::HubSuspending))
1434
1435 return SmUnhandled();
1436}

◆ OnEmptyHubResetWait()

SM_RESULT PortMachine::OnEmptyHubResetWait ( _In_ PortEvent  Event)
private

Definition at line 1416 of file portsm_port.cpp.

1418{
1419 if ((Event == PortEvent::HubStopping) || (Event == PortEvent::HubSuspending))
1420 return PowerDown(&OffEmpty);
1421
1422 return SmUnhandled();
1423}

◆ OnEnabled()

SM_RESULT PortMachine::OnEnabled ( _In_ PortEvent  Event)
private

Definition at line 729 of file portsm_port.cpp.

731{
732 switch (Event)
733 {
734 case PortEvent::ChangeError:
735 case PortEvent::ChangeDisabled:
736 case PortEvent::ChangeResetDone:
737 case PortEvent::ChangeResumed:
738 if (m_Usb3)
739 return SmUnhandled();
741
742 case PortEvent::DisableRequest:
744
745 case PortEvent::SuspendRequest:
747
748 case PortEvent::HibernateRequest:
750 if (!m_Usb3)
752 return SmTransition(&Suspended);
753
754 case PortEvent::ResetRequest:
756
757 case PortEvent::CycleRequest:
758 if (m_Usb3)
759 return CycleDetach();
762
763 case PortEvent::WarmResetRequest:
764 if (!m_Usb3)
765 return SmUnhandled();
767
768 case PortEvent::SetU1Timeout:
769 case PortEvent::SetU2Timeout:
770 if (!m_Usb3)
771 return SmUnhandled();
772 m_LpmU2 = (Event == PortEvent::SetU2Timeout);
774
775 case PortEvent::DisableSuperSpeedRequest:
776 if (!m_Usb3)
777 return SmUnhandled();
779
780 default:
781 return SmUnhandled();
782 }
783}
VOID RecordPortSuspended()
Definition: hubport.cpp:471
static const State SendingSuspend
Definition: portsm.h:259
static const State Suspended
Definition: portsm.h:224
static const State SettingLpmTimeout
Definition: portsm.h:269
@ PsmNoticeSuspended
Definition: portsm.h:78

◆ OnEnablingSuperSpeedOnStop()

SM_RESULT PortMachine::OnEnablingSuperSpeedOnStop ( _In_ PortEvent  Event)
private

Definition at line 1877 of file portsm_port.cpp.

1879{
1880 if ((Event != PortEvent::TransferDone) && (Event != PortEvent::TransferFailed))
1881 return SmUnhandled();
1882
1883 if (StopTimer())
1884 return PowerDown(&OffEmpty);
1885
1887}
static const State FlushBeforeSuperSpeedOff
Definition: portsm.h:219

◆ OnEnablingSuperSpeedOnTimer()

SM_RESULT PortMachine::OnEnablingSuperSpeedOnTimer ( _In_ PortEvent  Event)
private

Definition at line 1890 of file portsm_port.cpp.

1892{
1893 if (Event == PortEvent::TransferFailed)
1895
1896 if (Event == PortEvent::TransferDone)
1897 return SmTransition(&Disconnected);
1898
1899 return SmUnhandled();
1900}

◆ OnErrorRestarting()

SM_RESULT PortMachine::OnErrorRestarting ( _In_ PortEvent  Event)
private

Definition at line 1128 of file portsm_port.cpp.

1130{
1131 switch (Event)
1132 {
1133 case PortEvent::ChangeResetBusy:
1135
1136 case PortEvent::ChangeResumed:
1137 case PortEvent::ChangeLinkError:
1138 case PortEvent::ChangeError:
1139 case PortEvent::ChangeNone:
1140 case PortEvent::ChangeResetDone:
1142
1143 case PortEvent::HubStopping:
1144 return SmUnhandled();
1145
1146 default:
1147 return OnAttached(Event);
1148 }
1149}
static const State ResetRequestWait
Definition: portsm.h:228
SM_RESULT OnAttached(_In_ PortEvent Event)

◆ OnFlushBeforeOff()

SM_RESULT PortMachine::OnFlushBeforeOff ( _In_ PortEvent  Event)
private

Definition at line 690 of file portsm_port.cpp.

692{
693 if (Event != PortEvent::TimerExpired)
694 return SmUnhandled();
695
697 return PowerDown(&OffAttached);
698
699 return PowerDown(&OffEmpty);
700}
static const State FlushBeforeOffAttached
Definition: portsm.h:218

◆ OnHubResetIssued()

SM_RESULT PortMachine::OnHubResetIssued ( _In_ PortEvent  Event)
private

Definition at line 1380 of file portsm_port.cpp.

1382{
1383 if (Event == PortEvent::HubStopping)
1384 return PowerDown(&OffAttached);
1385
1386 if (Event == PortEvent::HubSuspending)
1388
1389 return SmUnhandled();
1390}
static const State OffSuspendedUsb2
Definition: portsm.h:202

◆ OnHubResetTimerWait()

SM_RESULT PortMachine::OnHubResetTimerWait ( _In_ PortEvent  Event)
private

Definition at line 1403 of file portsm_port.cpp.

1405{
1406 if (Event == PortEvent::TimerExpired)
1407 return SmTransition(&HubResetWait);
1408
1409 if ((Event == PortEvent::HubStopping) || (Event == PortEvent::HubSuspending))
1411
1412 return SmUnhandled();
1413}
static const State HubResetWait
Definition: portsm.h:245

◆ OnHubResetWait()

SM_RESULT PortMachine::OnHubResetWait ( _In_ PortEvent  Event)
private

Definition at line 1393 of file portsm_port.cpp.

1395{
1396 if ((Event == PortEvent::HubStopping) || (Event == PortEvent::HubSuspending))
1397 return PowerDown(&OffAttached);
1398
1399 return SmUnhandled();
1400}

◆ OnOff()

SM_RESULT PortMachine::OnOff ( _In_ PortEvent  Event)
private

Definition at line 657 of file portsm.cpp.

659{
661 return SmUnhandled();
662}
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329

◆ OnOffAttached()

SM_RESULT PortMachine::OnOffAttached ( _In_ PortEvent  Event)
private

Definition at line 702 of file portsm.cpp.

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}
static const State CleaningUp
Definition: portsm.h:203
static const State ErrorRestarting
Definition: portsm.h:233
VOID DropHubResetReference()
Definition: fanout.cpp:988
static const State StartingAttached
Definition: portsm.h:229
static const State ResumingDisabled
Definition: portsm.h:231

◆ OnOffEmpty()

SM_RESULT PortMachine::OnOffEmpty ( _In_ PortEvent  Event)
private

Definition at line 672 of file portsm.cpp.

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}
BOOLEAN SuperSpeedBlocked()
Definition: portxfer.cpp:697
static const State DisablingSuperSpeed
Definition: portsm.h:270
static const State StartingEmpty
Definition: portsm.h:208

◆ OnOffResetNeeded()

SM_RESULT PortMachine::OnOffResetNeeded ( _In_ PortEvent  Event)
private

Definition at line 738 of file portsm.cpp.

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}
VOID TakePortPowerReference()
Definition: fanout.cpp:976

◆ OnOffSuperSpeedDisabled()

SM_RESULT PortMachine::OnOffSuperSpeedDisabled ( _In_ PortEvent  Event)
private

Definition at line 763 of file portsm.cpp.

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}
static const State OffSuperSpeedDisabled
Definition: portsm.h:200

◆ OnOffSuspended()

SM_RESULT PortMachine::OnOffSuspended ( _In_ PortEvent  Event)
private

Definition at line 796 of file portsm.cpp.

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}
static const State SystemResuming
Definition: portsm.h:232

◆ OnOldDeviceWait()

SM_RESULT PortMachine::OnOldDeviceWait ( _In_ PortEvent  Event)
private

Definition at line 476 of file portsm_port.cpp.

478{
479 PortEvent response;
480
481 switch (Event)
482 {
483 case PortEvent::ChangeOverCurrentCleared:
484 return SmTransition(&PoweringPort);
485
486 case PortEvent::ChangeConnect:
487 return CheckConnection();
488
489 case PortEvent::ChangeOverCurrent:
490 return StartOverCurrentWait();
491
492 case PortEvent::ChangeNeedsHubReset:
493 if (!m_Usb3)
494 return SmUnhandled();
496
497 case PortEvent::ChangeDisabled:
498 case PortEvent::ChangeResumed:
499 case PortEvent::ChangeResetDone:
500 case PortEvent::ChangeError:
501 if (m_Usb3)
502 return SmUnhandled();
503
504 response = ErrorResponse();
505 switch (response)
506 {
507 case PortEvent::ChangeNeedsHubReset:
509
510 case PortEvent::ErrorIgnore:
512
513 case PortEvent::ErrorCycle:
515
516 case PortEvent::ChangeOverCurrent:
517 return StartOverCurrentWait();
518
519 case PortEvent::ErrorDisableAndCycle:
521
522 default:
523 SM_BREAK("Port error response not valid here");
524 return SmHandled();
525 }
526
527 case PortEvent::HubStopping:
529
530 case PortEvent::HubSuspending:
532 return PowerDown(&OffResetNeeded);
534
535 case PortEvent::DeviceGone:
537
538 default:
539 return SmUnhandled();
540 }
541}
static const State DisablingBeforeConnect
Definition: portsm.h:262

◆ OnOverCurrentWait()

SM_RESULT PortMachine::OnOverCurrentWait ( _In_ PortEvent  Event)
private

Definition at line 544 of file portsm_port.cpp.

546{
547 switch (Event)
548 {
549 case PortEvent::ChangeError:
550 case PortEvent::ChangeResetDone:
551 case PortEvent::ChangeDisabled:
552 case PortEvent::ChangeResumed:
553 if (m_Usb3)
554 return SmUnhandled();
556
557 case PortEvent::ChangeConnect:
559
560 case PortEvent::ChangeNeedsHubReset:
561 if (!m_Usb3)
562 return SmUnhandled();
565
566 case PortEvent::ChangeOverCurrentCleared:
568
569 case PortEvent::ChangeOverCurrent:
571
572 case PortEvent::TimerExpired:
575 return SmTransition(&PoweringPort);
576
577 case PortEvent::HubStopping:
578 case PortEvent::HubSuspending:
580
581 default:
582 return SmUnhandled();
583 }
584}
BOOLEAN OverCurrentPersists()
Definition: portxfer.cpp:704
static const State OverCurrentWait
Definition: portsm.h:213
static const State NotifyingOverCurrent
Definition: portsm.h:214

◆ OnPoweringPort()

SM_RESULT PortMachine::OnPoweringPort ( _In_ PortEvent  Event)
private

Definition at line 1600 of file portsm_port.cpp.

1602{
1603 if (Event == PortEvent::TransferDone)
1605
1606 if (Event == PortEvent::TransferFailed)
1608
1609 return SmUnhandled();
1610}
static const State QueryingOverCurrent
Definition: portsm.h:255

◆ OnPowerOnSending()

SM_RESULT PortMachine::OnPowerOnSending ( _In_ PortEvent  Event)
private

Definition at line 768 of file portsm_frames.cpp.

770{
771 if (Event == PortEvent::TransferDone)
773
774 if (Event != PortEvent::TransferFailed)
775 return SmUnhandled();
776
778 if (m_Usb3)
779 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
780
782}
static const State PowerUpResetHub
Definition: portsm.h:311
static const State PowerOnSettling
Definition: portsm.h:307

◆ OnPowerOnSettling()

SM_RESULT PortMachine::OnPowerOnSettling ( _In_ PortEvent  Event)
private

Definition at line 792 of file portsm_frames.cpp.

794{
795 if (Event == PortEvent::TimerExpired)
797
798 return SmUnhandled();
799}
static const State StartReading30
Definition: portsm.h:310
static const State StartReading20
Definition: portsm.h:308

◆ OnPowerUpParked()

SM_RESULT PortMachine::OnPowerUpParked ( _In_ PortEvent  Event)
private

Definition at line 868 of file portsm_frames.cpp.

870{
871 if (Event == PortEvent::StatusChanged)
873
874 return SmUnhandled();
875}
static const State PowerUpRearming
Definition: portsm.h:312

◆ OnQueryingOverCurrent()

SM_RESULT PortMachine::OnQueryingOverCurrent ( _In_ PortEvent  Event)
private

Definition at line 1613 of file portsm_port.cpp.

1615{
1616 if (Event == PortEvent::TransferFailed)
1618
1619 if (Event != PortEvent::TransferDone)
1620 return SmUnhandled();
1621
1622 if (OverCurrentActive())
1623 return StartOverCurrentWait();
1624
1625 if (m_Usb3)
1626 return SmTransition(&Disconnected);
1627
1628 return CheckConnection();
1629}
BOOLEAN OverCurrentActive()
Definition: hubport.cpp:493

◆ OnQuiescingForHubSuspend()

SM_RESULT PortMachine::OnQuiescingForHubSuspend ( _In_ PortEvent  Event)
private

Definition at line 1732 of file portsm_port.cpp.

1734{
1735 const State* target = m_Usb3 ? &OffResetNeeded : &OffEmpty;
1736
1737 if (Event == PortEvent::TransferFailed)
1738 {
1740 return PowerDown(target);
1741 }
1742
1743 if (Event == PortEvent::TransferDone)
1744 return PowerDown(target);
1745
1746 return SmUnhandled();
1747}
Definition: tools.h:99

◆ OnReadingAfterResumeTimeout()

SM_RESULT PortMachine::OnReadingAfterResumeTimeout ( _In_ PortEvent  Event)
private

Definition at line 1814 of file portsm_port.cpp.

1816{
1817 if (Event == PortEvent::TransferFailed)
1818 return FailToHubReset();
1819
1820 if (Event != PortEvent::TransferDone)
1821 return SmUnhandled();
1822
1823 if (LinkInU0())
1824 return ResumeSucceeded();
1825
1829}
SM_RESULT FailToHubReset()
Definition: portsm.cpp:648
SM_RESULT ResumeSucceeded()
Definition: portsm.cpp:631
@ PsmNoticeResumeTimedOut
Definition: portsm.h:80

◆ OnReadingForResume()

SM_RESULT PortMachine::OnReadingForResume ( _In_ PortEvent  Event)
private

Definition at line 1794 of file portsm_port.cpp.

1796{
1797 if (Event == PortEvent::TransferFailed)
1798 {
1800 return FailToHubReset();
1801 }
1802
1803 if (Event != PortEvent::TransferDone)
1804 return SmUnhandled();
1805
1806 /* The link may already be back in U0, then no resume is sent */
1807 if (LinkInU0())
1808 return ResumeSucceeded();
1809
1810 return SmTransition(&SendingResume);
1811}
static const State SendingResume
Definition: portsm.h:258

◆ OnReconnectAcking()

SM_RESULT PortMachine::OnReconnectAcking ( _In_ PortEvent  Event)
private

Definition at line 1036 of file portsm_frames.cpp.

1038{
1039 if (Event == PortEvent::TransferDone)
1040 return ReconnectCheck();
1041
1042 if (Event == PortEvent::TransferFailed)
1043 return ReconnectStatusFailed();
1044
1045 return SmUnhandled();
1046}
SM_RESULT ReconnectCheck()
SM_RESULT ReconnectStatusFailed()

◆ OnReconnectFlush()

SM_RESULT PortMachine::OnReconnectFlush ( _In_ PortEvent  Event)
private

Definition at line 1060 of file portsm_frames.cpp.

1062{
1063 if (Event != PortEvent::TimerExpired)
1064 return SmUnhandled();
1065
1067 return ReturnFromFrame(PortEvent::HubStopping);
1068
1070}
static const State SystemResumeRereading
Definition: portsm.h:326

◆ OnReconnectReading()

SM_RESULT PortMachine::OnReconnectReading ( _In_ PortEvent  Event)
private

Definition at line 1023 of file portsm_frames.cpp.

1025{
1026 if (Event == PortEvent::TransferDone)
1027 return ReconnectCheck();
1028
1029 if (Event == PortEvent::TransferFailed)
1030 return ReconnectStatusFailed();
1031
1032 return SmUnhandled();
1033}

◆ OnReconnectWait()

SM_RESULT PortMachine::OnReconnectWait ( _In_ PortEvent  Event)
private

Definition at line 975 of file portsm_frames.cpp.

977{
978 switch (Event)
979 {
980 case PortEvent::StatusChanged:
983
984 case PortEvent::HubStopping:
985 if (StopTimer())
986 return ReturnFromFrame(PortEvent::HubStopping);
989
990 case PortEvent::TimerExpired:
992
993 default:
994 return SmUnhandled();
995 }
996}
static const State ResumeRereading
Definition: portsm.h:323
static const State ReconnectFlush
Definition: portsm.h:322
static const State ReconnectReading
Definition: portsm.h:319

◆ OnResetChangeChecking()

SM_RESULT PortMachine::OnResetChangeChecking ( _In_ PortEvent  Event)
private

Definition at line 447 of file portsm_frames.cpp.

449{
450 switch (Event)
451 {
452 case PortEvent::ChangeNone:
453 case PortEvent::ChangeLinkError:
455
456 case PortEvent::ChangeResumed:
457 case PortEvent::ChangeError:
458 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
459
460 case PortEvent::ChangeResetBusy:
464
465 default:
466 return SmUnhandled();
467 }
468}
BOOLEAN PollResetCompletion()
Definition: hubport.cpp:545
static const State ResetPollWait
Definition: portsm.h:288

◆ OnResetChangeIdle()

SM_RESULT PortMachine::OnResetChangeIdle ( _In_ PortEvent  Event)
private

Definition at line 437 of file portsm_frames.cpp.

439{
440 if (Event == PortEvent::StatusChanged)
442
443 return SmUnhandled();
444}
static const State ResetChangeChecking
Definition: portsm.h:287

◆ OnResetEnabledWait()

SM_RESULT PortMachine::OnResetEnabledWait ( _In_ PortEvent  Event)
private

Definition at line 1221 of file portsm_port.cpp.

1223{
1224 switch (Event)
1225 {
1226 case PortEvent::ChangeResetDone:
1227 if (StopTimer())
1228 return ResetSucceeded();
1229 return SmTransition(&ResetFlush);
1230
1231 case PortEvent::HubRemoved:
1232 return ReleaseAndStopTimer();
1233
1234 case PortEvent::ChangeResumed:
1235 case PortEvent::ChangeError:
1236 case PortEvent::ChangeDisabled:
1238
1239 case PortEvent::TimerExpired:
1241
1242 default:
1243 return SmUnhandled();
1244 }
1245}
SM_RESULT ReleaseAndStopTimer()
Definition: portsm.cpp:584
SM_RESULT ResetSucceeded()
Definition: portsm.cpp:606
static const State DisablingOnResetTimeout
Definition: portsm.h:266
static const State ResetEnabledWait
Definition: portsm.h:238
static const State ResetFlush
Definition: portsm.h:239
SM_RESULT TimedError(_In_ const State *Stay, _In_ BOOLEAN DuringReset)
Definition: portsm.cpp:537

◆ OnResetFlush()

SM_RESULT PortMachine::OnResetFlush ( _In_ PortEvent  Event)
private

Definition at line 1248 of file portsm_port.cpp.

1250{
1251 switch (Event)
1252 {
1253 case PortEvent::ChangeError:
1254 case PortEvent::ChangeDisabled:
1255 case PortEvent::ChangeResumed:
1256 case PortEvent::ChangeResetDone:
1257 if (m_Usb3)
1258 return SmUnhandled();
1259 return TimedError(&ResetFlush, FALSE);
1260
1261 case PortEvent::TimerExpired:
1262 return ResetSucceeded();
1263
1264 default:
1265 return SmUnhandled();
1266 }
1267}

◆ OnResetPollChecking()

SM_RESULT PortMachine::OnResetPollChecking ( _In_ PortEvent  Event)
private

Definition at line 494 of file portsm_frames.cpp.

496{
497 switch (Event)
498 {
499 case PortEvent::ChangeLinkError:
500 case PortEvent::ChangeResumed:
501 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
502
503 case PortEvent::ChangeNone:
504 if (LinkInU0())
505 return ReturnFromFrame(PortEvent::ChangeResetDone);
506 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
507
508 case PortEvent::ChangeResetBusy:
510
511 default:
512 return SmUnhandled();
513 }
514}

◆ OnResetPollWait()

SM_RESULT PortMachine::OnResetPollWait ( _In_ PortEvent  Event)
private

Definition at line 478 of file portsm_frames.cpp.

480{
481 if (Event == PortEvent::ResetPollExpired)
483
484 return SmUnhandled();
485}
static const State ResetPollChecking
Definition: portsm.h:289

◆ OnResetRequestWait()

SM_RESULT PortMachine::OnResetRequestWait ( _In_ PortEvent  Event)
private

Definition at line 984 of file portsm_port.cpp.

986{
987 switch (Event)
988 {
989 case PortEvent::ChangeResetDone:
990 return SmTransition(&Enabled);
991
992 case PortEvent::CycleRequest:
993 return CycleDetach();
994
995 case PortEvent::ResetRequest:
996 case PortEvent::WarmResetRequest:
998
999 case PortEvent::DisableRequest:
1001
1002 default:
1003 return SmUnhandled();
1004 }
1005}

◆ OnResetTimeoutStatus()

SM_RESULT PortMachine::OnResetTimeoutStatus ( _In_ PortEvent  Event)
private

Definition at line 1904 of file portsm_port.cpp.

1906{
1907 switch (Event)
1908 {
1909 case PortEvent::ChangeNone:
1913
1914 case PortEvent::ChangeResetDone:
1915 return ResetSucceeded();
1916
1917 case PortEvent::ChangeResetBusy:
1918 case PortEvent::ChangeNeedsHubReset:
1919 case PortEvent::ChangeResumed:
1920 case PortEvent::ChangeError:
1924 return SmTransition(&HubResetWait);
1925
1926 case PortEvent::ChangeOverCurrent:
1929 return StartOverCurrentWait();
1930
1931 case PortEvent::ChangeOverCurrentCleared:
1934 return SmTransition(&PoweringPort);
1935
1936 case PortEvent::ChangeConnect:
1939 return CheckConnection();
1940
1941 case PortEvent::ChangeLinkError:
1946
1947 default:
1948 return SmUnhandled();
1949 }
1950}
VOID LogLinkStateError()
Definition: hubport.cpp:619

◆ OnResetWait()

SM_RESULT PortMachine::OnResetWait ( _In_ PortEvent  Event)
private

Definition at line 1187 of file portsm_port.cpp.

1189{
1190 switch (Event)
1191 {
1192 case PortEvent::ChangeResetDone:
1193 if (StopTimer())
1194 return ResetSucceeded();
1195 return SmTransition(&ResetFlush);
1196
1197 case PortEvent::HubRemoved:
1198 return ReleaseAndStopTimer();
1199
1200 case PortEvent::ChangeError:
1201 case PortEvent::ChangeDisabled:
1202 case PortEvent::ChangeResumed:
1203 case PortEvent::ChangeConnect:
1204 if (m_Usb3)
1205 return SmUnhandled();
1206 return TimedError(&ResetWait, TRUE);
1207
1208 case PortEvent::TimerExpired:
1209 if (m_Usb3)
1214
1215 default:
1216 return SmUnhandled();
1217 }
1218}
static const State ResetTimeoutStatus
Definition: portsm.h:274

◆ OnResumeAckingConnect()

SM_RESULT PortMachine::OnResumeAckingConnect ( _In_ PortEvent  Event)
private

Definition at line 962 of file portsm_frames.cpp.

964{
965 if (Event == PortEvent::TransferFailed)
966 return ResumeStateDisabled();
967
968 if (Event == PortEvent::TransferDone)
969 return ResumeReadDone();
970
971 return SmUnhandled();
972}
SM_RESULT ResumeStateDisabled()

◆ OnResumeAckWait()

SM_RESULT PortMachine::OnResumeAckWait ( _In_ PortEvent  Event)
private

Definition at line 941 of file portsm_port.cpp.

943{
944 switch (Event)
945 {
946 case PortEvent::ChangeError:
947 case PortEvent::ChangeDisabled:
948 case PortEvent::ChangeResetDone:
949 case PortEvent::ChangeResumed:
951
952 case PortEvent::ResumeRequest:
953 return SmTransition(&Enabled);
954
955 case PortEvent::HubStopping:
957
958 case PortEvent::CycleRequest:
961
962 default:
963 return SmUnhandled();
964 }
965}
static const State ResumeAckWaitStopped
Definition: portsm.h:234

◆ OnResumeAckWaitStopped()

SM_RESULT PortMachine::OnResumeAckWaitStopped ( _In_ PortEvent  Event)
private

Definition at line 968 of file portsm_port.cpp.

970{
971 if (Event == PortEvent::ResumeRequest)
972 return PowerDown(&OffAttached);
973
974 if (Event == PortEvent::CycleRequest)
975 {
977 return PowerDown(&OffEmpty);
978 }
979
980 return SmUnhandled();
981}

◆ OnResumeChangeChecking()

SM_RESULT PortMachine::OnResumeChangeChecking ( _In_ PortEvent  Event)
private

Definition at line 527 of file portsm_frames.cpp.

529{
530 switch (Event)
531 {
532 case PortEvent::ChangeNone:
534
535 case PortEvent::ChangeLinkError:
536 return ReturnFromFrame(PortEvent::ChangeConnect);
537
538 case PortEvent::ChangeError:
539 case PortEvent::ChangeResetBusy:
540 case PortEvent::ChangeResetDone:
541 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
542
543 default:
544 return SmUnhandled();
545 }
546}

◆ OnResumeChangeIdle()

SM_RESULT PortMachine::OnResumeChangeIdle ( _In_ PortEvent  Event)
private

Definition at line 517 of file portsm_frames.cpp.

519{
520 if (Event == PortEvent::StatusChanged)
522
523 return SmUnhandled();
524}
static const State ResumeChangeChecking
Definition: portsm.h:291

◆ OnResumeFlush()

SM_RESULT PortMachine::OnResumeFlush ( _In_ PortEvent  Event)
private

Definition at line 1332 of file portsm_port.cpp.

1334{
1335 switch (Event)
1336 {
1337 case PortEvent::ChangeDisabled:
1338 case PortEvent::ChangeError:
1339 case PortEvent::ChangeResetDone:
1340 case PortEvent::ChangeResumed:
1341 if (m_Usb3)
1342 return SmUnhandled();
1343 return TimedError(&ResumeFlush, FALSE);
1344
1345 case PortEvent::TimerExpired:
1346 if (m_Usb3)
1347 return ResumeSucceeded();
1350
1351 default:
1352 return SmUnhandled();
1353 }
1354}
static const State ResumeFlush
Definition: portsm.h:242
static const State ResumeRecovery
Definition: portsm.h:241

◆ OnResumePowering()

SM_RESULT PortMachine::OnResumePowering ( _In_ PortEvent  Event)
private

Definition at line 902 of file portsm_frames.cpp.

904{
905 if (Event == PortEvent::TransferDone)
907
908 if (Event != PortEvent::TransferFailed)
909 return SmUnhandled();
910
912 return ResumeStateDisabled();
913}
static const State ResumeSettling
Definition: portsm.h:315

◆ OnResumeReading()

SM_RESULT PortMachine::OnResumeReading ( _In_ PortEvent  Event)
private

An over-current seen now, or one that came and went while suspended, is reported.

Definition at line 930 of file portsm_frames.cpp.

932{
934
935 if (Event == PortEvent::TransferFailed)
936 {
938 return ResumeStateDisabled();
939 }
940
941 if (Event != PortEvent::TransferDone)
942 return SmUnhandled();
943
945
947 if (bits.OverCurrent || bits.OverCurrentChanged)
948 {
950 return ReturnFromFrame(bits.OverCurrent ? PortEvent::ChangeOverCurrent
951 : PortEvent::ChangeOverCurrentCleared);
952 }
953
954 if (DeviceConnected())
955 return ResumeConnectCheck();
956
959}
SM_RESULT ResumeConnectCheck()
VOID ReadPortBits(_Out_ PPSM_PORT_BITS Bits)
Definition: hubport.cpp:589
VOID MarkOverCurrentCause()
Definition: hubport.cpp:504
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15
@ PsmTimerReconnect
Definition: portsm.h:99

◆ OnResumeRecovery()

SM_RESULT PortMachine::OnResumeRecovery ( _In_ PortEvent  Event)
private

Definition at line 1312 of file portsm_port.cpp.

1314{
1315 switch (Event)
1316 {
1317 case PortEvent::ChangeResumed:
1318 case PortEvent::ChangeResetDone:
1319 case PortEvent::ChangeError:
1320 case PortEvent::ChangeDisabled:
1322
1323 case PortEvent::TimerExpired:
1324 return ResumeSucceeded();
1325
1326 default:
1327 return SmUnhandled();
1328 }
1329}

◆ OnResumeRereading()

SM_RESULT PortMachine::OnResumeRereading ( _In_ PortEvent  Event)
private

Definition at line 1073 of file portsm_frames.cpp.

1075{
1076 if (Event == PortEvent::TransferFailed)
1077 return ResumeStateDisabled();
1078
1079 if (Event != PortEvent::TransferDone)
1080 return SmUnhandled();
1081
1082 if (DeviceConnected())
1083 return ResumeConnectCheck();
1084
1085 return ResumeReadDone();
1086}

◆ OnResumeSettling()

SM_RESULT PortMachine::OnResumeSettling ( _In_ PortEvent  Event)
private

Definition at line 916 of file portsm_frames.cpp.

918{
919 if (Event == PortEvent::TimerExpired)
921
922 return SmUnhandled();
923}

◆ OnResumeWait()

SM_RESULT PortMachine::OnResumeWait ( _In_ PortEvent  Event)
private

Definition at line 1276 of file portsm_port.cpp.

1278{
1279 switch (Event)
1280 {
1281 case PortEvent::ChangeResumed:
1282 if (!StopTimer())
1283 return SmTransition(&ResumeFlush);
1284 if (m_Usb3)
1285 return ResumeSucceeded();
1288
1289 case PortEvent::ChangeDisabled:
1290 case PortEvent::ChangeError:
1291 case PortEvent::ChangeResetDone:
1292 if (m_Usb3)
1293 return SmUnhandled();
1294 return TimedError(&ResumeWait, FALSE);
1295
1296 case PortEvent::HubRemoved:
1297 return ReleaseAndStopTimer();
1298
1299 case PortEvent::TimerExpired:
1300 if (m_Usb3)
1305
1306 default:
1307 return SmUnhandled();
1308 }
1309}
static const State ReadingAfterResumeTimeout
Definition: portsm.h:268
static const State ResumeWait
Definition: portsm.h:240

◆ OnResumingAttached()

SM_RESULT PortMachine::OnResumingAttached ( _In_ PortEvent  Event)
private

Definition at line 1046 of file portsm_port.cpp.

1048{
1049 switch (Event)
1050 {
1051 case PortEvent::ChangeError:
1052 case PortEvent::ChangeResetDone:
1053 case PortEvent::SubDone:
1055 return SmTransition(&Suspended);
1056
1057 case PortEvent::ChangeResumed:
1059 return SmTransition(&Enabled);
1060
1061 case PortEvent::ChangeDisabled:
1064
1065 default:
1066 return SmUnhandled();
1067 }
1068}
@ PsmNoticeStateEnabled
Definition: portsm.h:82

◆ OnResumingDisabled()

SM_RESULT PortMachine::OnResumingDisabled ( _In_ PortEvent  Event)
private

Definition at line 1071 of file portsm_port.cpp.

1073{
1074 switch (Event)
1075 {
1076 case PortEvent::ChangeError:
1077 case PortEvent::ChangeDisabled:
1078 case PortEvent::ChangeResetDone:
1079 case PortEvent::ChangeResumed:
1080 case PortEvent::SubDone:
1083
1084 case PortEvent::HubSuspending:
1085 return PowerDown(&OffAttached);
1086
1087 default:
1088 return SmUnhandled();
1089 }
1090}

◆ OnSendingReset()

SM_RESULT PortMachine::OnSendingReset ( _In_ PortEvent  Event)
private

Definition at line 1632 of file portsm_port.cpp.

1634{
1635 if ((Event != PortEvent::TransferDone) && (Event != PortEvent::TransferFailed))
1636 return SmUnhandled();
1637
1638 if (!m_Usb3)
1639 {
1641 return SmTransition(&ResetWait);
1642 }
1643
1644 if (Event == PortEvent::TransferDone)
1645 return SmTransition(&ResetWait);
1646
1647 return ResetTransferFailed();
1648}

◆ OnSendingResume()

SM_RESULT PortMachine::OnSendingResume ( _In_ PortEvent  Event)
private

Definition at line 1651 of file portsm_port.cpp.

1653{
1654 if ((Event != PortEvent::TransferDone) && (Event != PortEvent::TransferFailed))
1655 return SmUnhandled();
1656
1657 if (m_Usb3 && (Event == PortEvent::TransferFailed))
1658 {
1660 return FailToHubReset();
1661 }
1662
1664 return SmTransition(&ResumeWait);
1665}
@ PsmTimerResumeCompletion
Definition: portsm.h:96

◆ OnSendingSuspend()

SM_RESULT PortMachine::OnSendingSuspend ( _In_ PortEvent  Event)
private

Definition at line 1668 of file portsm_port.cpp.

1670{
1671 if (Event == PortEvent::TransferFailed)
1672 return FailToHubReset();
1673
1674 if (Event != PortEvent::TransferDone)
1675 return SmUnhandled();
1676
1678 if (!m_Usb3)
1680
1681 return SmTransition(&Suspended);
1682}

◆ OnSettingLpmTimeout()

SM_RESULT PortMachine::OnSettingLpmTimeout ( _In_ PortEvent  Event)
private

Definition at line 1832 of file portsm_port.cpp.

1834{
1835 if (Event == PortEvent::TransferFailed)
1836 {
1838 return SmTransition(&Enabled);
1839 }
1840
1841 if (Event == PortEvent::TransferDone)
1842 {
1844 return SmTransition(&Enabled);
1845 }
1846
1847 return SmUnhandled();
1848}
@ PsmNoticeTimeoutUpdated
Definition: portsm.h:86

◆ OnSsLinkDisabled()

SM_RESULT PortMachine::OnSsLinkDisabled ( _In_ PortEvent  Event)
private

Definition at line 1468 of file portsm_port.cpp.

1470{
1471 if ((Event == PortEvent::HubStopping) || (Event == PortEvent::HubSuspending))
1473
1474 return SmUnhandled();
1475}

◆ OnStartingAttached()

SM_RESULT PortMachine::OnStartingAttached ( _In_ PortEvent  Event)
private

Definition at line 1014 of file portsm_port.cpp.

1016{
1017 switch (Event)
1018 {
1019 case PortEvent::SubDone:
1021
1022 case PortEvent::ChangeResetDone:
1023 case PortEvent::ChangeResumed:
1024 case PortEvent::ChangeError:
1025 case PortEvent::ChangeDisabled:
1027
1028 case PortEvent::HubSuspending:
1029 return PowerDown(&OffAttached);
1030
1031 default:
1032 return SmUnhandled();
1033 }
1034}

◆ OnStartingEmpty()

SM_RESULT PortMachine::OnStartingEmpty ( _In_ PortEvent  Event)
private

Definition at line 368 of file portsm_port.cpp.

370{
371 if (!m_Usb3)
372 {
373 if (Event == PortEvent::SubDone)
374 return SmTransition(&Disconnected);
375
376 return SmUnhandled();
377 }
378
379 if (Event == PortEvent::ChangeNone)
380 return SmTransition(&Disconnected);
381
382 if (Event == PortEvent::ChangeResetBusy)
384
385 return SmUnhandled();
386}

◆ OnStartReading20()

SM_RESULT PortMachine::OnStartReading20 ( _In_ PortEvent  Event)
private

Definition at line 802 of file portsm_frames.cpp.

804{
805 if (Event == PortEvent::TransferFailed)
806 {
809 }
810
811 if (Event != PortEvent::TransferDone)
812 return SmUnhandled();
813
815 return ReturnFromFrame(LostChange());
816}
PortEvent LostChange()
Definition: portxfer.cpp:593

◆ OnStartReading30()

SM_RESULT PortMachine::OnStartReading30 ( _In_ PortEvent  Event)
private

Definition at line 835 of file portsm_frames.cpp.

837{
838 switch (Event)
839 {
840 case PortEvent::ChangeError:
841 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
842
843 case PortEvent::ChangeResumed:
844 case PortEvent::ChangeResetDone:
845 case PortEvent::ChangeLinkError:
846 return ReturnFromFrame(PortEvent::ChangeConnect);
847
848 default:
849 return SmUnhandled();
850 }
851}

◆ OnStartReadingFirst()

SM_RESULT PortMachine::OnStartReadingFirst ( _In_ PortEvent  Event)
private

Definition at line 819 of file portsm_frames.cpp.

821{
822 if (Event == PortEvent::TransferFailed)
823 {
825 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
826 }
827
828 if (Event != PortEvent::TransferDone)
829 return SmUnhandled();
830
832}
BOOLEAN PortPowered()
Definition: hubport.cpp:516

◆ OnStatusAcking()

SM_RESULT PortMachine::OnStatusAcking ( _In_ PortEvent  Event)
private

Definition at line 615 of file portsm_frames.cpp.

617{
618 if (Event == PortEvent::TransferFailed)
619 return StatusFailed();
620
621 if (Event != PortEvent::TransferDone)
622 return SmUnhandled();
623
624 switch (PendingChange())
625 {
626 case PsmPendingChange:
627 return SmTransition(&StatusAcking);
628
629 case PsmPendingError:
630 return StatusFailed();
631
632 default:
634 }
635}
SM_RESULT StatusFailed()
static const State StatusAcking
Definition: portsm.h:294

◆ OnStatusReading()

SM_RESULT PortMachine::OnStatusReading ( _In_ PortEvent  Event)
private

Definition at line 592 of file portsm_frames.cpp.

594{
595 if (Event == PortEvent::TransferFailed)
596 return StatusFailed();
597
598 if (Event != PortEvent::TransferDone)
599 return SmUnhandled();
600
601 switch (PendingChange())
602 {
603 case PsmPendingChange:
604 return SmTransition(&StatusAcking);
605
606 case PsmPendingError:
607 return StatusFailed();
608
609 default:
610 return StatusQuiet();
611 }
612}
SM_RESULT StatusQuiet()

◆ OnSuperSpeedOffWait()

SM_RESULT PortMachine::OnSuperSpeedOffWait ( _In_ PortEvent  Event)
private

Definition at line 1455 of file portsm_port.cpp.

1457{
1458 if (Event == PortEvent::TimerExpired)
1460
1461 if ((Event == PortEvent::HubStopping) || (Event == PortEvent::HubSuspending))
1463
1464 return SmUnhandled();
1465}
static const State EnablingSuperSpeedOnStop
Definition: portsm.h:272
static const State EnablingSuperSpeedOnTimer
Definition: portsm.h:273

◆ OnSuspendAcking()

SM_RESULT PortMachine::OnSuspendAcking ( _In_ PortEvent  Event)
private

Definition at line 1269 of file portsm_frames.cpp.

1271{
1272 if (Event == PortEvent::TransferFailed)
1273 return ParkChange20(TRUE);
1274
1275 if (Event == PortEvent::TransferDone)
1277
1278 return SmUnhandled();
1279}
static const State SuspendAcking
Definition: portsm.h:330
static const State SuspendReading
Definition: portsm.h:329

◆ OnSuspended()

SM_RESULT PortMachine::OnSuspended ( _In_ PortEvent  Event)
private

Definition at line 839 of file portsm_port.cpp.

841{
842 if (m_Usb3)
843 {
844 switch (Event)
845 {
846 case PortEvent::ChangeConnect:
847 if (D3ColdEnabled())
849 return DetachThen(Event);
850
851 case PortEvent::DisableRequest:
855
856 case PortEvent::ResumeRequest:
861 return SmTransition(&Suspended);
862
863 default:
865 }
866 }
867
868 switch (Event)
869 {
870 case PortEvent::ChangeResumed:
872
873 case PortEvent::ChangeResetDone:
874 case PortEvent::ChangeError:
876
877 case PortEvent::ChangeDisabled:
879
880 case PortEvent::HubSuspending:
882
883 case PortEvent::ResumeRequest:
887 return SmTransition(&Suspended);
888
889 case PortEvent::ResetRequest:
891
892 case PortEvent::CycleRequest:
895
896 default:
897 return SmUnhandled();
898 }
899}
SM_RESULT OnDisabledInSuspend(_In_ PortEvent Event)
BOOLEAN TakeInterruptReference()
Definition: fanout.cpp:994
static const State ReadingForResume
Definition: portsm.h:267
@ PsmNoticeResumeRefused
Definition: portsm.h:79

◆ OnSuspendIdle()

SM_RESULT PortMachine::OnSuspendIdle ( _In_ PortEvent  Event)
private

Definition at line 1194 of file portsm_frames.cpp.

1196{
1197 if (Event != PortEvent::StatusChanged)
1198 return SmUnhandled();
1199
1202}

◆ OnSuspendReading()

SM_RESULT PortMachine::OnSuspendReading ( _In_ PortEvent  Event)
private

An error on a port that is connected but no longer enabled counts as a connect.

Definition at line 1217 of file portsm_frames.cpp.

1219{
1221 PortEvent change;
1222
1223 if (Event == PortEvent::TransferFailed)
1224 return ParkChange20(TRUE);
1225
1226 if (Event != PortEvent::TransferDone)
1227 return SmUnhandled();
1228
1229 switch (PendingChange())
1230 {
1231 case PsmPendingChange:
1232 return SmTransition(&SuspendAcking);
1233
1234 case PsmPendingError:
1235 return ParkChange20(TRUE);
1236
1237 default:
1238 break;
1239 }
1240
1241 change = NextChange();
1242 switch (change)
1243 {
1244 case PortEvent::ChangeResetDone:
1245 case PortEvent::ChangeDisabled:
1246 return ReportSuspendChange(PortEvent::ChangeError);
1247
1248 case PortEvent::ChangeError:
1250 if (bits.Connected && !bits.Enabled)
1251 return ReportSuspendChange(PortEvent::ChangeConnect);
1252 return ReportSuspendChange(PortEvent::ChangeError);
1253
1254 case PortEvent::ChangeResumed:
1256
1257 case PortEvent::ChangeOverCurrentCleared:
1258 case PortEvent::ChangeConnect:
1259 case PortEvent::ChangeOverCurrent:
1260 return ReportSuspendChange(change);
1261
1262 default:
1263 SM_BREAK("Port change not valid on a suspended port");
1264 return SmHandled();
1265 }
1266}
SM_RESULT ReportSuspendChange(_In_ PortEvent Report)
static const State SuspendRecovery
Definition: portsm.h:331

◆ OnSuspendRecovery()

SM_RESULT PortMachine::OnSuspendRecovery ( _In_ PortEvent  Event)
private

Definition at line 1289 of file portsm_frames.cpp.

1291{
1292 if (Event == PortEvent::TimerExpired)
1293 return ReportSuspendChange(PortEvent::ChangeResumed);
1294
1295 return SmUnhandled();
1296}

◆ OnSystemReconnectWait()

SM_RESULT PortMachine::OnSystemReconnectWait ( _In_ PortEvent  Event)
private

Definition at line 1139 of file portsm_frames.cpp.

1141{
1142 switch (Event)
1143 {
1144 case PortEvent::HubStopping:
1145 if (StopTimer())
1146 return ReturnFromFrame(PortEvent::HubStopping);
1149
1150 case PortEvent::StatusChanged:
1151 if (StopTimer())
1155
1156 case PortEvent::TimerExpired:
1157 return ReturnFromFrame(PortEvent::ChangeConnect);
1158
1159 default:
1160 return SmUnhandled();
1161 }
1162}

◆ OnSystemResumeReading()

SM_RESULT PortMachine::OnSystemResumeReading ( _In_ PortEvent  Event)
private

Definition at line 1099 of file portsm_frames.cpp.

1101{
1102 switch (Event)
1103 {
1104 case PortEvent::ChangeNone:
1106 return ReturnFromFrame(PortEvent::SubDone);
1107
1108 case PortEvent::ChangeResumed:
1110 return ReturnFromFrame(PortEvent::ChangeResumed);
1111
1112 case PortEvent::ChangeConnect:
1113 if (DeviceConnected())
1114 {
1116 return ReturnFromFrame(PortEvent::ChangeResumed);
1117 }
1120
1121 case PortEvent::ChangeResetBusy:
1124 return ReturnFromFrame(PortEvent::ChangeResetBusy);
1125
1126 case PortEvent::ChangeLinkError:
1127 case PortEvent::ChangeResetDone:
1128 return SystemResumeFailed();
1129
1130 case PortEvent::ChangeError:
1131 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
1132
1133 default:
1134 return SmUnhandled();
1135 }
1136}
SM_RESULT SystemResumeFailed()
static const State SystemReconnectWait
Definition: portsm.h:325

◆ OnSystemResumeRereading()

SM_RESULT PortMachine::OnSystemResumeRereading ( _In_ PortEvent  Event)
private

Definition at line 1165 of file portsm_frames.cpp.

1167{
1168 switch (Event)
1169 {
1170 case PortEvent::ChangeLinkError:
1171 return SystemResumeFailed();
1172
1173 case PortEvent::ChangeResumed:
1174 case PortEvent::ChangeError:
1175 case PortEvent::ChangeResetDone:
1176 case PortEvent::ChangeResetBusy:
1177 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
1178
1179 case PortEvent::ChangeNone:
1180 return ReturnFromFrame(PortEvent::ChangeConnect);
1181
1182 case PortEvent::ChangeConnect:
1184 return ReturnFromFrame(PortEvent::ChangeResumed);
1185
1186 default:
1187 return SmUnhandled();
1188 }
1189}

◆ OnSystemResuming()

SM_RESULT PortMachine::OnSystemResuming ( _In_ PortEvent  Event)
private

Definition at line 1099 of file portsm_port.cpp.

1101{
1102 switch (Event)
1103 {
1104 case PortEvent::ChangeResumed:
1105 return SmTransition(&Enabled);
1106
1107 case PortEvent::SubDone:
1108 return SmTransition(&Suspended);
1109
1110 case PortEvent::ChangeResetBusy:
1112
1113 case PortEvent::ChangeNeedsReset:
1115
1116 default:
1117 return SmUnhandled();
1118 }
1119}

◆ OnTimed()

SM_RESULT PortMachine::OnTimed ( _In_ PortEvent  Event)
private

Definition at line 1154 of file portsm_port.cpp.

1156{
1157 switch (Event)
1158 {
1159 case PortEvent::ChangeConnect:
1160 case PortEvent::ChangeOverCurrent:
1161 case PortEvent::ChangeOverCurrentCleared:
1162 return DetachTimed(Event);
1163
1164 case PortEvent::ChangeNeedsHubReset:
1165 if (!m_Usb3)
1166 return SmUnhandled();
1167 return TimedHubReset();
1168
1169 default:
1170 return SmUnhandled();
1171 }
1172}
SM_RESULT DetachTimed(_In_ PortEvent Change)
Definition: portsm.cpp:442
SM_RESULT TimedHubReset()
Definition: portsm.cpp:576

◆ OnTimerFlush()

SM_RESULT PortMachine::OnTimerFlush ( _In_ PortEvent  Event)
private

Definition at line 641 of file portsm_port.cpp.

643{
644 switch (Event)
645 {
646 case PortEvent::TimerExpired:
648
649 case PortEvent::ChangeOverCurrent:
651 return SmTransition(&TimerFlush);
652
653 case PortEvent::ChangeOverCurrentCleared:
655 return SmTransition(&TimerFlush);
656
657 case PortEvent::ChangeConnect:
658 /* After an over current the connect change waits for the timer too */
661 return SmTransition(&TimerFlush);
662
663 case PortEvent::ChangeError:
664 case PortEvent::ChangeResetDone:
665 case PortEvent::ChangeDisabled:
666 case PortEvent::ChangeResumed:
667 if (m_Usb3)
668 return SmUnhandled();
669 return SmTransition(&TimerFlush);
670
671 case PortEvent::ChangeNeedsHubReset:
672 if (!m_Usb3)
673 return SmUnhandled();
675
676 case PortEvent::HubStopping:
678
679 case PortEvent::HubSuspending:
680 if (!m_Usb3 && (m_AfterTimer == FollowCycle))
683
684 default:
685 return SmUnhandled();
686 }
687}
static const State TimerFlush
Definition: portsm.h:216
SM_RESULT FollowTimer(_In_ TIMER_FOLLOW_UP FollowUp)
Definition: portsm.cpp:485

◆ OnUserResetWait()

SM_RESULT PortMachine::OnUserResetWait ( _In_ PortEvent  Event)
private

Definition at line 594 of file portsm_port.cpp.

596{
597 switch (Event)
598 {
599 case PortEvent::ChangeError:
600 case PortEvent::ChangeResetDone:
601 case PortEvent::ChangeDisabled:
602 case PortEvent::ChangeResumed:
603 if (m_Usb3)
604 return SmUnhandled();
606
607 case PortEvent::ChangeConnect:
609
610 case PortEvent::ChangeNeedsHubReset:
611 if (!m_Usb3)
612 return SmUnhandled();
615 SmDiscardQueued(PortEvent::UserOverCurrentReset);
617
618 case PortEvent::ChangeOverCurrent:
619 return StartOverCurrentWait();
620
621 case PortEvent::ChangeOverCurrentCleared:
623 SmDiscardQueued(PortEvent::UserOverCurrentReset);
624 return SmTransition(&PoweringPort);
625
626 case PortEvent::UserOverCurrentReset:
627 return SmTransition(&PoweringPort);
628
629 case PortEvent::HubStopping:
630 case PortEvent::HubSuspending:
632 SmDiscardQueued(PortEvent::UserOverCurrentReset);
633 return PowerDown(&OffEmpty);
634
635 default:
636 return SmUnhandled();
637 }
638}
VOID CancelUserOverCurrentReset()
Definition: hubport.cpp:612

◆ OnWakeArming()

SM_RESULT PortMachine::OnWakeArming ( _In_ PortEvent  Event)
private

Definition at line 1693 of file portsm_frames.cpp.

1695{
1696 if (Event == PortEvent::TransferFailed)
1698 else if (Event != PortEvent::TransferDone)
1699 return SmUnhandled();
1700
1701 return ReturnFromFrame(PortEvent::SubDone);
1702}

◆ OverCurrentActive()

BOOLEAN PortMachine::OverCurrentActive ( )

Definition at line 493 of file hubport.cpp.

494{
496 return FALSE;
497
499 HubNoteHubOverCurrent(m_Port->m_Hub);
500 return TRUE;
501}

Referenced by OnQueryingOverCurrent().

◆ OverCurrentPersists()

BOOLEAN PortMachine::OverCurrentPersists ( )

Definition at line 704 of file portxfer.cpp.

705{
707
709
712
715}
UCHAR m_OverCurrentCount
Definition: hubport.h:250
LARGE_INTEGER m_LastOverCurrentTime
Definition: hubport.h:251
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define PORT_OVER_CURRENT_WINDOW
Definition: portxfer.cpp:15
#define PORT_OVER_CURRENT_LIMIT
Definition: portxfer.cpp:14
struct tm * Now
Definition: output.c:19
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by OnOverCurrentWait().

◆ ParkChange20()

SM_RESULT PortMachine::ParkChange20 ( _In_ BOOLEAN  ResetHub)
private

Definition at line 314 of file portsm_frames.cpp.

316{
317 m_ParkResetsHub = ResetHub;
319}
static const State ChangeParked20
Definition: portsm.h:282

Referenced by CheckPending20(), OnChangeAcking20(), OnChangeParked20(), OnChangeReading20(), OnSuspendAcking(), and OnSuspendReading().

◆ PendingChange()

PSM_PENDING PortMachine::PendingChange ( )

Definition at line 301 of file portxfer.cpp.

302{
304 USHORT Bit;
305 ULONG Index;
306
307 *Change &= ~m_Port->m_ChangeAccumulator;
308
309 for (Index = 0; Index < RTL_NUMBER_OF(PortChanges); Index++)
310 {
312 if (Bit == 0 || !(*Change & Bit))
313 continue;
314
315 *Change &= ~Bit;
318
319 if (Bit == PC_OVER_CURRENT)
321
322 return PsmPendingChange;
323 }
324
325 if (*Change != 0)
326 DPRINT1("Hub %p port %u reports unknown change 0x%x\n", m_Port->m_Hub, m_Port->Number(), *Change);
327
328 return (*Change != 0) ? PsmPendingError : PsmPendingNone;
329}
@ PsmPendingNone
Definition: portsm.h:109
static const PortChangeOrder PortChanges[]
Definition: portxfer.cpp:286
USHORT Feature20
Definition: portxfer.cpp:281
USHORT Feature30
Definition: portxfer.cpp:283
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by CheckPending20(), OnDrainReading(), OnStatusAcking(), OnStatusReading(), OnSuspendReading(), and ReconnectCheck().

◆ PollResetCompletion()

BOOLEAN PortMachine::PollResetCompletion ( )

Definition at line 545 of file hubport.cpp.

546{
547 return (m_Port->m_ChangeAccumulator & PC_RESET) &&
548 m_Port->m_Hub->HasFlag(HubFlag::DelayAfterResetComplete);
549}

Referenced by OnResetChangeChecking().

◆ Port()

HubPort * PortMachine::Port ( ) const
inline

Definition at line 138 of file portsm.h.

139 {
140 return m_Port;
141 }

Referenced by Initialize().

◆ PortPowered()

BOOLEAN PortMachine::PortPowered ( )

Definition at line 516 of file hubport.cpp.

517{
519}
#define PS_POWER_30
Definition: hubreq.h:134

Referenced by OnStartReadingFirst().

◆ PowerDown()

SM_RESULT PortMachine::PowerDown ( _In_ const State *  Target)
private

Definition at line 265 of file portsm.cpp.

267{
269 return SmTransition(Target);
270}

◆ PowerUp()

SM_RESULT PortMachine::PowerUp ( _In_ const State *  Target)
private

Definition at line 273 of file portsm.cpp.

275{
277 return SmTransition(Target);
278}

◆ QueuePassiveWork()

VOID PortMachine::QueuePassiveWork ( )

Definition at line 188 of file hubport.cpp.

189{
192 m_Port,
194}
VOID EnqueueWorkItem(_In_ PUCXHUB_WORKITEM WorkItem, _In_ PUCXHUB_WORKITEM_ROUTINE Routine, _In_ PVOID Context, _In_ BOOLEAN ForwardProgress)
Definition: fdo.cpp:54
BOOLEAN NeedsForwardProgress() const
Definition: fdo.h:208
static UCXHUB_WORKITEM_ROUTINE MachineWorkItem
Definition: hubport.h:292
PUCXHUB_WORKITEM m_WorkItem
Definition: hubport.h:240

Referenced by SmQueuePassive().

◆ ReadPortBits()

VOID PortMachine::ReadPortBits ( _Out_ PPSM_PORT_BITS  Bits)

Definition at line 589 of file hubport.cpp.

591{
594
595 Bits->Connected = (Status & PS_CONNECTED) != 0;
596 Bits->Enabled = (Status & PS_ENABLED) != 0;
597 Bits->OverCurrent = (Status & PS_OVER_CURRENT) != 0;
598 Bits->OverCurrentChanged = (Change & PC_OVER_CURRENT) != 0;
599}

Referenced by OnResumeReading(), and OnSuspendReading().

◆ ReattachBootDevice()

VOID PortMachine::ReattachBootDevice ( )

Definition at line 380 of file hubport.cpp.

381{
382 m_Port->m_Child->Post(DsmEvent::PortReattached);
383 m_Port->SetFlag(PortFlag::DeviceConnected);
384 m_Port->m_ConnectionStatus = DeviceEnumerating;
385}

Referenced by DeviceArrived(), and ReattachOrCreate().

◆ ReattachOrCreate()

SM_RESULT PortMachine::ReattachOrCreate ( _In_ OLD_DEVICE_KIND  Kind)
private

Definition at line 381 of file portsm.cpp.

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}
VOID MarkUsb3Device()
Definition: hubport.cpp:445
#define NOTHING
Definition: input_list.c:10

Referenced by DeviceArrived(), and OnDebouncing().

◆ ReconnectCheck()

SM_RESULT PortMachine::ReconnectCheck ( )
private

Definition at line 1007 of file portsm_frames.cpp.

1008{
1009 switch (PendingChange())
1010 {
1011 case PsmPendingChange:
1013
1014 case PsmPendingError:
1015 return ReconnectStatusFailed();
1016
1017 default:
1019 }
1020}
static const State ReconnectRearming
Definition: portsm.h:321
static const State ReconnectAcking
Definition: portsm.h:320

Referenced by OnReconnectAcking(), and OnReconnectReading().

◆ ReconnectStatusFailed()

SM_RESULT PortMachine::ReconnectStatusFailed ( )
private

Definition at line 999 of file portsm_frames.cpp.

Referenced by OnReconnectAcking(), OnReconnectReading(), and ReconnectCheck().

◆ RecordPortDisabled()

VOID PortMachine::RecordPortDisabled ( )

Definition at line 465 of file hubport.cpp.

466{
468}

Referenced by OnAttachedDisabled(), and OnDisablingOnRequest().

◆ RecordPortSuspended()

VOID PortMachine::RecordPortSuspended ( )

Definition at line 471 of file hubport.cpp.

Referenced by OnEnabled(), and OnSendingSuspend().

◆ ReferencePort()

VOID PortMachine::ReferencePort ( )

Definition at line 176 of file hubport.cpp.

177{
179}
#define WdfObjectReference(Handle)
Definition: wdfobject.h:803

Referenced by SmReference().

◆ ReleaseAndStopTimer()

SM_RESULT PortMachine::ReleaseAndStopTimer ( )
private

Definition at line 584 of file portsm.cpp.

585{
586 BOOLEAN stopped = StopTimer();
587
590 return SmTransition(stopped ? &HubResetWait : &HubResetTimerWait);
591}
static const State HubResetTimerWait
Definition: portsm.h:246

Referenced by OnResetEnabledWait(), OnResetWait(), OnResumeWait(), and TimedHubReset().

◆ ReportSuspendChange()

SM_RESULT PortMachine::ReportSuspendChange ( _In_ PortEvent  Report)
private

Definition at line 1205 of file portsm_frames.cpp.

1207{
1210}
static const State SuspendReporting
Definition: portsm.h:332
static void Report(const char *msg)
Definition: glmodeswitch.c:58

Referenced by OnSuspendReading(), and OnSuspendRecovery().

◆ RequestHubReset()

◆ ResetChangeAccumulator()

VOID PortMachine::ResetChangeAccumulator ( )

Definition at line 459 of file hubport.cpp.

460{
462}

Referenced by EnterStatusReading(), OnChangeIdle20(), OnReconnectWait(), and OnSuspendIdle().

◆ ResetHubThen()

◆ ResetSucceeded()

SM_RESULT PortMachine::ResetSucceeded ( )
private

Definition at line 606 of file portsm.cpp.

607{
610 return SmTransition(&Enabled);
611}
@ PsmNoticeResetComplete
Definition: portsm.h:85

Referenced by OnResetEnabledWait(), OnResetFlush(), OnResetTimeoutStatus(), and OnResetWait().

◆ ResetTransferFailed()

SM_RESULT PortMachine::ResetTransferFailed ( )
private

Definition at line 614 of file portsm.cpp.

615{
616 if (m_Usb3)
617 {
620 }
621 else
622 {
625 }
626
628}

Referenced by OnDisablingOnResetTimeout(), and OnSendingReset().

◆ ResumeConnectCheck()

SM_RESULT PortMachine::ResumeConnectCheck ( )
private

Definition at line 893 of file portsm_frames.cpp.

894{
897
898 return ResumeReadDone();
899}
static const State ResumeAckingConnect
Definition: portsm.h:317
BOOLEAN ConnectChangedOnResume()
Definition: hubport.cpp:523

Referenced by OnResumeReading(), and OnResumeRereading().

◆ ResumeInterruptTransfer()

VOID PortMachine::ResumeInterruptTransfer ( )

◆ ResumeReadDone()

SM_RESULT PortMachine::ResumeReadDone ( )
private

◆ ResumeStateDisabled()

SM_RESULT PortMachine::ResumeStateDisabled ( )
private

◆ ResumeSucceeded()

SM_RESULT PortMachine::ResumeSucceeded ( )
private

Definition at line 631 of file portsm.cpp.

632{
633 if (m_Usb3)
634 {
637 }
638 else
639 {
642 }
643
644 return SmTransition(&Enabled);
645}

Referenced by OnReadingAfterResumeTimeout(), OnReadingForResume(), OnResumeFlush(), OnResumeRecovery(), and OnResumeWait().

◆ ReturnFromFrame()

◆ SendAckChange()

VOID PortMachine::SendAckChange ( )

Definition at line 167 of file portxfer.cpp.

168{
170
173}
_In_ ULONG const _In_ FEATURE_NUMBER const Feature
Definition: cdrom.h:1077
#define HUB_REQUEST_CLEAR_FEATURE
Definition: hubreq.h:86
#define HUB_FEATURE_NONE
Definition: hubreq.h:14
static VOID NTAPI PortSendControl(_In_ HubPort *Port, _In_ UCHAR RequestType, _In_ UCHAR Request, _In_ USHORT Value, _In_ USHORT Index, _In_reads_bytes_opt_(Length) PVOID Buffer, _In_ USHORT Length)
Definition: portxfer.cpp:113

Referenced by EnterAckingChange().

◆ SendDisable()

VOID PortMachine::SendDisable ( )

Definition at line 191 of file portxfer.cpp.

192{
194}
#define PORT_F_ENABLE
Definition: hubreq.h:96

Referenced by EnterDisablingOnRequest(), EnterDisablingPort(), and EnterQuiescingForHubSuspend().

◆ SendGetStatus()

VOID PortMachine::SendGetStatus ( )

Definition at line 152 of file portxfer.cpp.

153{
154 BOOLEAN Extended = m_Port->HasProperty(PortProperty::EnhancedSuperSpeed);
155
157 0xA3,
159 Extended ? 2 : 0,
160 m_Port->Number(),
162 Extended ? sizeof(m_Port->m_Current) : sizeof(m_Port->m_Current.StatusChange));
163}
#define HUB_REQUEST_GET_STATUS
Definition: hubreq.h:85

Referenced by EnterReadingStatus(), and EnterStatusReading().

◆ SendLinkDisable()

VOID PortMachine::SendLinkDisable ( )

Definition at line 215 of file portxfer.cpp.

216{
218}
#define LINK_SS_DISABLED
Definition: hubreq.h:117
#define HUB_REQUEST_SET_FEATURE
Definition: hubreq.h:87
#define PORT_F_LINK_STATE
Definition: hubreq.h:99
static USHORT NTAPI PortIndex(_In_ HubPort *Port, _In_ UCHAR High)
Definition: portxfer.cpp:144

Referenced by EnterDisablingSuperSpeed(), and EnterDisablingSuperSpeedOnRequest().

◆ SendLinkRxDetect()

VOID PortMachine::SendLinkRxDetect ( )

Definition at line 221 of file portxfer.cpp.

Referenced by EnterEnablingSuperSpeed().

◆ SendPortPower()

VOID PortMachine::SendPortPower ( )

Definition at line 228 of file portxfer.cpp.

Referenced by EnterPoweringPort().

◆ SendRemoteWake()

VOID PortMachine::SendRemoteWake ( _In_ BOOLEAN  Enable)

Definition at line 263 of file portxfer.cpp.

265{
267 0x23,
270 PortIndex(m_Port, Enable ? 0x07 : 0x00),
271 NULL,
272 0);
273}
#define PORT_F_REMOTE_WAKE_MASK
Definition: hubreq.h:110
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

Referenced by EnterWakeArming().

◆ SendReset()

VOID PortMachine::SendReset ( )

Definition at line 177 of file portxfer.cpp.

178{
179 m_Port->m_LastChange = PortEvent::ChangeNone;
181}
#define PORT_F_RESET
Definition: hubreq.h:98

Referenced by EnterSendingReset().

◆ SendResume()

VOID PortMachine::SendResume ( )

Definition at line 197 of file portxfer.cpp.

198{
199 if (m_Port->IsUsb30())
201 else
203}
BOOLEAN IsUsb30() const
Definition: hubport.h:219
#define PORT_F_SUSPEND
Definition: hubreq.h:97
#define LINK_U0
Definition: hubreq.h:115

Referenced by EnterSendingResume().

◆ SendSuspend()

VOID PortMachine::SendSuspend ( )

◆ SendU1Timeout()

VOID PortMachine::SendU1Timeout ( )

Definition at line 238 of file portxfer.cpp.

239{
241 0x23,
245 NULL,
246 0);
247}
UCHAR m_U1Timeout
Definition: hubchild.h:421
#define PORT_F_U1_TIMEOUT
Definition: hubreq.h:106

Referenced by EnterSettingLpmTimeout().

◆ SendU2Timeout()

VOID PortMachine::SendU2Timeout ( )

Definition at line 250 of file portxfer.cpp.

251{
253 0x23,
257 NULL,
258 0);
259}
UCHAR m_U2Timeout
Definition: hubchild.h:422
#define PORT_F_U2_TIMEOUT
Definition: hubreq.h:107

Referenced by EnterSettingLpmTimeout().

◆ SendWarmReset()

VOID PortMachine::SendWarmReset ( )

Definition at line 184 of file portxfer.cpp.

185{
186 m_Port->m_LastChange = PortEvent::ChangeNone;
188}
#define PORT_F_BH_RESET
Definition: hubreq.h:111

Referenced by EnterSendingWarmReset().

◆ SmDereference()

VOID PortMachine::SmDereference ( )
private

Definition at line 180 of file portsm.cpp.

181{
183}
VOID DereferencePort()
Definition: hubport.cpp:182

◆ SmOnDequeue()

VOID PortMachine::SmOnDequeue ( _In_ PortEvent  Event)
private

Definition at line 192 of file portsm.cpp.

194{
195 if (Event == PortEvent::DeviceGone)
197}
VOID ForgetDetachedDevice()
Definition: hubport.cpp:389

◆ SmQueuePassive()

VOID PortMachine::SmQueuePassive ( )
private

Definition at line 186 of file portsm.cpp.

187{
189}
VOID QueuePassiveWork()
Definition: hubport.cpp:188

◆ SmReference()

VOID PortMachine::SmReference ( )
private

Definition at line 174 of file portsm.cpp.

175{
177}
VOID ReferencePort()
Definition: hubport.cpp:176

◆ SmStateChanged()

VOID PortMachine::SmStateChanged ( )
private

The innermost frame that does not yield to its caller decides whether the port holds the hub awake.

Definition at line 227 of file portsm.cpp.

228{
229 ULONG frame = SmDepth();
230
231 while ((frame > 0) && PsmHasFlag(SmFrame(frame), SM_STATE_YIELDS_TO_CALLER))
232 frame -= 1;
233
235}
BOOLEAN AllowsHubSuspend(_In_ const State *Target) const
Definition: portsm.cpp:216
#define SM_STATE_YIELDS_TO_CALLER
Definition: smengine.h:42

◆ StartOverCurrentWait()

SM_RESULT PortMachine::StartOverCurrentWait ( )
private

◆ StartTimer()

VOID PortMachine::StartTimer ( _In_ PSM_TIMER  Timer)

Definition at line 230 of file hubport.cpp.

232{
234 ULONG Time;
235
236 switch (Timer)
237 {
238 case PsmTimerDebounce:
240 break;
241
244 DPRINT1("Port %u over current, waiting %lu ms\n", m_Port->Number(), Time);
245 break;
246
249 break;
250
253 break;
254
255 /* The device may ask for longer in its MS OS 2.0 descriptor set */
257 Time = (Child != NULL && Child->m_HasResumeRecoveryTime) ? Child->m_ResumeRecoveryTime
259 break;
260
261 /* Longer on external hubs */
262 case PsmTimerPowerOn:
264 break;
265
267 Time = m_Port->HasFlag(PortFlag::SupportsReattach) ? PORT_RECONNECT_TIME_BOOT
269 break;
270
273 DPRINT("Port %u waiting %lu ms for reconnect after D3 cold\n", m_Port->Number(), Time);
274 break;
275
278 break;
279
280 /* A separate WDF timer, which the port stop never cancels */
282 {
284
285 if (Queued)
286 DPRINT1("Port %u reset poll timer was already queued\n", m_Port->Number());
287 NT_ASSERT(!Queued);
288 return;
289 }
290
291 default:
292 DPRINT1("Port %u asked for unknown timer %d\n", m_Port->Number(), (int)Timer);
294 return;
295 }
296
298}
BOOLEAN IsRootHub() const
Definition: fdo.h:174
WDFTIMER m_ResetPollTimer
Definition: hubport.h:239
ULONG m_D3ColdReconnectTimeout
Definition: hubport.h:255
HubTimer m_Timer
Definition: hubport.h:238
VOID Start(_In_ ULONG Milliseconds)
Definition: hubutil.h:104
#define HUB_PORT_RESUME_WAIT_MS
Definition: hubport.cpp:20
#define PORT_RECONNECT_TIME
Definition: hubport.cpp:25
#define PORT_RESET_TIME
Definition: hubport.cpp:19
#define PORT_RESET_POLL_TIME
Definition: hubport.cpp:27
#define PORT_RECONNECT_TIME_BOOT
Definition: hubport.cpp:24
#define PORT_RESUME_RECOVERY_TIME
Definition: hubport.cpp:21
#define PORT_DEBOUNCE_TIME
Definition: hubport.cpp:17
#define PORT_OVERCURRENT_TIME
Definition: hubport.cpp:18
#define PORT_POWER_ON_TIME
Definition: hubport.cpp:23
#define PORT_POWER_ON_TIME_ROOT
Definition: hubport.cpp:22
#define PORT_SUPERSPEED_DISABLE_TIME
Definition: hubport.cpp:26
static PLARGE_INTEGER Time
Definition: time.c:37
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_MS(_In_ ULONGLONG Time)
Definition: wdfcore.h:80
#define NT_ASSERT
Definition: rtlfuncs.h:3334

Referenced by D3ConnectCheck(), D3PendingDone(), EnterDebouncing(), EnterPowerOnSettling(), EnterResetPollWait(), EnterResetWait(), EnterSuspendRecovery(), EnterSuspendReporting(), OnD3Idle(), OnDisablingSuperSpeedOnRequest(), OnResumeFlush(), OnResumeReading(), OnResumeWait(), OnSendingReset(), OnSendingResume(), OnSystemResumeReading(), and StartOverCurrentWait().

◆ StatusFailed()

SM_RESULT PortMachine::StatusFailed ( )
private

Definition at line 565 of file portsm_frames.cpp.

566{
567 if (m_ReadKind == ReadPlain)
569
572
573 return ReturnFromFrame(PortEvent::ChangeNeedsHubReset);
574}
static const State StatusFailing
Definition: portsm.h:296

Referenced by OnStatusAcking(), and OnStatusReading().

◆ StatusQuiet()

SM_RESULT PortMachine::StatusQuiet ( )
private

Definition at line 577 of file portsm_frames.cpp.

578{
579 if (m_ReadKind == ReadPlain)
581
583 {
586 }
587
588 return ReturnFromFrame(NextChange());
589}
static const State StatusReporting
Definition: portsm.h:295
VOID FixPortStateAfterPowerUp()
Definition: portxfer.cpp:692

Referenced by OnStatusReading().

◆ StopTimer()

◆ StopTimerThen()

SM_RESULT PortMachine::StopTimerThen ( _In_ TIMER_FOLLOW_UP  FollowUp)
private

Definition at line 474 of file portsm.cpp.

476{
477 if (StopTimer())
478 return FollowTimer(FollowUp);
479
480 m_AfterTimer = FollowUp;
481 return SmTransition(&TimerFlush);
482}

Referenced by DetachTimed(), OnDebouncing(), OnDisablingForCycleTimed(), OnOverCurrentWait(), and TimedError().

◆ SuperSpeedBlocked()

BOOLEAN PortMachine::SuperSpeedBlocked ( )

Definition at line 697 of file portxfer.cpp.

698{
699 return m_Port->m_Hub->HasFlag(HubFlag::DisableSuperSpeed);
700}

Referenced by OnOffEmpty().

◆ SystemResumeFailed()

SM_RESULT PortMachine::SystemResumeFailed ( )
private

Definition at line 1091 of file portsm_frames.cpp.

1092{
1095 return ReturnFromFrame(PortEvent::ChangeNeedsReset);
1096}

Referenced by OnSystemResumeReading(), and OnSystemResumeRereading().

◆ TakeInterruptForReset()

SM_RESULT PortMachine::TakeInterruptForReset ( _In_ const State *  Start,
_In_ const State *  Refused 
)
private

Definition at line 594 of file portsm.cpp.

597{
599 return SmTransition(Start);
600
602 return SmTransition(Refused);
603}
static _Out_opt_ PULONGLONG Start
@ PsmNoticeResetRefused
Definition: portsm.h:76

Referenced by OnAttachedDisabled(), OnDisabledInSuspend(), OnEnabled(), OnResetRequestWait(), and OnSuspended().

◆ TakeInterruptReference()

BOOLEAN PortMachine::TakeInterruptReference ( )

Definition at line 994 of file fanout.cpp.

995{
997}
BOOLEAN TakeInterruptReference(_In_ HubPort *Port)
Definition: fanout.cpp:485

Referenced by OnSuspended(), and TakeInterruptForReset().

◆ TakePortPowerReference()

VOID PortMachine::TakePortPowerReference ( )

◆ TellDevice()

VOID PortMachine::TellDevice ( _In_ PSM_DEVICE_NOTICE  Notice)

Definition at line 309 of file hubport.cpp.

311{
312 static const DsmEvent NoticeEvents[] =
313 {
314 DsmEvent::PortFault,
315 DsmEvent::PortDisableDone,
316 DsmEvent::PortResetAbortedForSuspend,
317 DsmEvent::PortResumeDone,
318 DsmEvent::PortSuspendDone,
319 DsmEvent::PortResumeAbortedForSuspend,
320 DsmEvent::PortResumeTimeout,
321 DsmEvent::PortNowDisabled,
322 DsmEvent::PortNowEnabled,
323 DsmEvent::PortNowSuspended,
324 DsmEvent::PortResetTimeout,
325 DsmEvent::PortResetDone,
326 DsmEvent::PortTimeoutSet,
327 DsmEvent::PortNowEnabledOnReconnect
328 };
329
330 NT_ASSERT((ULONG)Notice < RTL_NUMBER_OF(NoticeEvents));
331
332 if (m_Port->m_Child != NULL)
333 m_Port->m_Child->Post(NoticeEvents[Notice]);
334}
DsmEvent
Definition: devsm.h:15

Referenced by D3PendingDone(), EnterSuspendReporting(), FailDeviceRequest(), FailToHubReset(), OnAttachedDisabled(), OnD3Debouncing(), OnD3Idle(), OnD3PoweredOff(), OnD3PoweringUp(), OnD3ResumeAckWait(), OnDisabledInSuspend(), OnDisablingOnRequest(), OnDisablingOnResetTimeout(), OnEnabled(), OnOffAttached(), OnReadingAfterResumeTimeout(), OnResetTimeoutStatus(), OnResetWait(), OnResumeWait(), OnResumingAttached(), OnResumingDisabled(), OnSendingSuspend(), OnSettingLpmTimeout(), OnSuspended(), OnSystemResumeReading(), OnSystemResumeRereading(), ReconnectStatusFailed(), ReleaseAndStopTimer(), ResetSucceeded(), ResetTransferFailed(), ResumeStateDisabled(), ResumeSucceeded(), SystemResumeFailed(), and TakeInterruptForReset().

◆ TimedError()

SM_RESULT PortMachine::TimedError ( _In_ const State *  Stay,
_In_ BOOLEAN  DuringReset 
)
private

Definition at line 537 of file portsm.cpp.

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}
PortEvent ErrorResponseDuringReset()
Definition: portxfer.cpp:640

Referenced by OnResetEnabledWait(), OnResetFlush(), OnResetWait(), OnResumeFlush(), OnResumeRecovery(), and OnResumeWait().

◆ TimedHubReset()

SM_RESULT PortMachine::TimedHubReset ( )
private

Definition at line 576 of file portsm.cpp.

577{
579 return ReleaseAndStopTimer();
580}

Referenced by OnTimed(), and TimedError().

◆ UpdateHubPower()

VOID PortMachine::UpdateHubPower ( _In_ BOOLEAN  Idle)
private

Definition at line 238 of file portsm.cpp.

240{
241 if (Idle)
242 {
243 if (m_HubPowerHeld)
244 {
245 HubPowerDrop();
247 }
248 }
249 else if (!m_HubPowerHeld && HubPowerTake())
250 {
252 }
253}
VOID HubPowerDrop()
Definition: hubport.cpp:218
BOOLEAN HubPowerTake()
Definition: hubport.cpp:198
@ Idle
Definition: ntdd8042.h:62

Referenced by KeepHubAwake(), and SmStateChanged().

Friends And Related Function Documentation

◆ SmMachine< PortMachine, PortEvent >

friend class SmMachine< PortMachine, PortEvent >
friend

Definition at line 119 of file portsm.h.

Member Data Documentation

◆ ArmingWake

const PortMachine::State PortMachine::ArmingWake
static
Initial value:
=
SM_RESULT OnArmingWake(_In_ PortEvent Event)
SM_RESULT EnterArmingWake()
static const State Transfer
Definition: portsm.h:253

Definition at line 275 of file portsm.h.

Referenced by OnDisabledInSuspend(), and OnEmpty().

◆ Attached

const PortMachine::State PortMachine::Attached
static
Initial value:
=
{ NULL, "Attached", 0, &PortMachine::OnAttached, NULL, NULL }

Definition at line 221 of file portsm.h.

◆ AttachedDisabled

◆ AttachFailedWait

const PortMachine::State PortMachine::AttachFailedWait
static
Initial value:
=
{ NULL, "AttachFailedWait", 0,
SM_RESULT OnAttachFailedWait(_In_ PortEvent Event)
SM_RESULT EnterDrainingEmpty()

Definition at line 249 of file portsm.h.

Referenced by DeviceArrived(), and ReattachOrCreate().

◆ ChangeAcking20

const PortMachine::State PortMachine::ChangeAcking20
static
Initial value:
=
{ NULL, "ChangeAcking20", PSM_CRIT,
SM_RESULT OnChangeAcking20(_In_ PortEvent Event)
SM_RESULT EnterAckingChange()
#define PSM_CRIT

Definition at line 280 of file portsm.h.

Referenced by OnChangeAcking20(), and OnChangeReading20().

◆ ChangeChecking30

const PortMachine::State PortMachine::ChangeChecking30
static
Initial value:
=
{ NULL, "ChangeChecking30", PSM_YIELDS,
SM_RESULT EnterPlainStatusRead()
SM_RESULT OnChangeChecking30(_In_ PortEvent Event)
#define PSM_YIELDS

Definition at line 285 of file portsm.h.

Referenced by OnChangeIdle30().

◆ ChangeIdle20

const PortMachine::State PortMachine::ChangeIdle20
static
Initial value:
=
SM_RESULT OnChangeIdle20(_In_ PortEvent Event)

Definition at line 278 of file portsm.h.

Referenced by EnterResetWait(), EnterResumeWait(), and EnterWithPortChange().

◆ ChangeIdle30

const PortMachine::State PortMachine::ChangeIdle30
static
Initial value:
=
SM_RESULT OnChangeIdle30(_In_ PortEvent Event)

Definition at line 284 of file portsm.h.

Referenced by EnterSuspended(), EnterWithPortChange(), and OnChangeChecking30().

◆ ChangeParked20

const PortMachine::State PortMachine::ChangeParked20
static
Initial value:
=
{ NULL, "ChangeParked20", PSM_YIELDS | PSM_PASSIVE,
SM_RESULT EnterChangeParked20()
SM_RESULT OnChangeParked20(_In_ PortEvent Event)
#define PSM_PASSIVE

Definition at line 282 of file portsm.h.

Referenced by ParkChange20().

◆ ChangeReading20

const PortMachine::State PortMachine::ChangeReading20
static
Initial value:
=
{ NULL, "ChangeReading20", PSM_CRIT,
SM_RESULT EnterReadingStatus()
SM_RESULT OnChangeReading20(_In_ PortEvent Event)

Definition at line 279 of file portsm.h.

Referenced by OnChangeAcking20(), and OnChangeIdle20().

◆ ChangeReporting20

const PortMachine::State PortMachine::ChangeReporting20
static
Initial value:
=
SM_RESULT EnterChangeReporting20()

Definition at line 281 of file portsm.h.

Referenced by OnChangeReading20().

◆ CleaningUp

const PortMachine::State PortMachine::CleaningUp
static
Initial value:
=
SM_RESULT EnterCleaningUp()
Definition: portsm.cpp:827
SM_RESULT OnCleaningUp(_In_ PortEvent Event)
Definition: portsm.cpp:834

Definition at line 203 of file portsm.h.

Referenced by OnOffAttached(), and OnOffSuspended().

◆ D3DebounceFlush

const PortMachine::State PortMachine::D3DebounceFlush
static
Initial value:
=
SM_RESULT OnD3DebounceFlush(_In_ PortEvent Event)
static const PortEvent FrameRemovedOnly[]

Definition at line 337 of file portsm.h.

Referenced by D3StopDebounceTimer().

◆ D3Debouncing

const PortMachine::State PortMachine::D3Debouncing
static
Initial value:
=
{ NULL, "D3Debouncing", 0,
SM_RESULT OnD3Debouncing(_In_ PortEvent Event)

Definition at line 336 of file portsm.h.

Referenced by D3ConnectCheck(), D3PendingDone(), and EnterSuspendReporting().

◆ D3FlushThenReturn

const PortMachine::State PortMachine::D3FlushThenReturn
static
Initial value:
=
SM_RESULT OnD3FlushThenReturn(_In_ PortEvent Event)

Definition at line 338 of file portsm.h.

Referenced by OnD3DebounceFlush(), and OnD3Debouncing().

◆ D3Idle

const PortMachine::State PortMachine::D3Idle
static
Initial value:
=
SM_RESULT OnD3Idle(_In_ PortEvent Event)

Definition at line 333 of file portsm.h.

Referenced by D3ConnectCheck(), EnterSuspendedD3Cold(), EnterSuspendReporting(), OnD3Idle(), and OnD3PoweredOff().

◆ D3PoweredOff

const PortMachine::State PortMachine::D3PoweredOff
static
Initial value:
=
SM_RESULT OnD3PoweredOff(_In_ PortEvent Event)

Definition at line 334 of file portsm.h.

Referenced by OnD3Idle().

◆ D3PoweringUp

const PortMachine::State PortMachine::D3PoweringUp
static
Initial value:
=
{ NULL, "D3PoweringUp", 0,
SM_RESULT EnterD3PoweringUp()
SM_RESULT OnD3PoweringUp(_In_ PortEvent Event)

Definition at line 335 of file portsm.h.

Referenced by OnD3PoweredOff().

◆ D3ReconnectFlush

const PortMachine::State PortMachine::D3ReconnectFlush
static
Initial value:
=
{ NULL, "D3ReconnectFlush", 0, &PortMachine::OnD3ReconnectFlush, NULL, NULL }
SM_RESULT OnD3ReconnectFlush(_In_ PortEvent Event)

Definition at line 341 of file portsm.h.

Referenced by D3StopReconnectTimer(), and OnD3ReconnectFlush().

◆ D3ReconnectWait

const PortMachine::State PortMachine::D3ReconnectWait
static
Initial value:
=
{ NULL, "D3ReconnectWait", 0,
SM_RESULT OnD3ReconnectWait(_In_ PortEvent Event)

Definition at line 340 of file portsm.h.

Referenced by OnD3Idle(), and OnD3ReconnectWait().

◆ D3ResumeAckWait

const PortMachine::State PortMachine::D3ResumeAckWait
static
Initial value:
=
{ NULL, "D3ResumeAckWait", PSM_YIELDS,
SM_RESULT OnD3ResumeAckWait(_In_ PortEvent Event)

Definition at line 339 of file portsm.h.

Referenced by OnD3Debouncing(), OnD3Idle(), and OnD3ResumeAckWait().

◆ Debouncing

const PortMachine::State PortMachine::Debouncing
static
Initial value:
=
{ NULL, "Debouncing", 0, &PortMachine::OnDebouncing, NULL, NULL }
SM_RESULT OnDebouncing(_In_ PortEvent Event)

Definition at line 209 of file portsm.h.

◆ DebouncingUsb2

const PortMachine::State PortMachine::DebouncingUsb2
static
Initial value:
=
static const State Debouncing
Definition: portsm.h:209
SM_RESULT EnterDebouncing()
static const PortEvent RemovedAndGone[]
Definition: portsm_port.cpp:27

Definition at line 210 of file portsm.h.

Referenced by CheckConnection(), DeviceArrived(), OnDisablingBeforeConnect(), and OnOldDeviceWait().

◆ DebouncingUsb3

const PortMachine::State PortMachine::DebouncingUsb3
static
Initial value:
=

Definition at line 211 of file portsm.h.

Referenced by DeviceArrived().

◆ Deleted

const PortMachine::State PortMachine::Deleted
static
Initial value:
=
static const PortEvent GoneOnly[]
Definition: portsm.cpp:94

Definition at line 204 of file portsm.h.

Referenced by OnCleaningUp(), OnOffEmpty(), OnOffResetNeeded(), and OnOffSuperSpeedDisabled().

◆ DisabledInSuspend

const PortMachine::State PortMachine::DisabledInSuspend
static

◆ DisablingBeforeConnect

const PortMachine::State PortMachine::DisablingBeforeConnect
static
Initial value:
=
{ &Transfer, "DisablingBeforeConnect", 0,
SM_RESULT EnterDisablingPort()
SM_RESULT OnDisablingBeforeConnect(_In_ PortEvent Event)

Definition at line 262 of file portsm.h.

Referenced by OnOldDeviceWait().

◆ DisablingForCycle

const PortMachine::State PortMachine::DisablingForCycle
static
Initial value:
=
{ &Transfer, "DisablingForCycle", 0,
SM_RESULT OnDisablingForCycle(_In_ PortEvent Event)

Definition at line 261 of file portsm.h.

Referenced by HandleConnectedFault(), OnEnabled(), OnResumeAckWait(), and OnSuspended().

◆ DisablingForCycleTimed

const PortMachine::State PortMachine::DisablingForCycleTimed
static
Initial value:
=
{ &Transfer, "DisablingForCycleTimed", 0,
SM_RESULT OnDisablingForCycleTimed(_In_ PortEvent Event)

Definition at line 264 of file portsm.h.

Referenced by OnDebouncing(), and TimedError().

◆ DisablingOnRequest

const PortMachine::State PortMachine::DisablingOnRequest
static
Initial value:
=
{ &Transfer, "DisablingOnRequest", 0,
SM_RESULT EnterDisablingOnRequest()
SM_RESULT OnDisablingOnRequest(_In_ PortEvent Event)

Definition at line 260 of file portsm.h.

Referenced by OnAttachedDisabled(), OnEnabled(), and OnResetRequestWait().

◆ DisablingOnResetTimeout

const PortMachine::State PortMachine::DisablingOnResetTimeout
static
Initial value:
=
{ &Transfer, "DisablingOnResetTimeout", 0,
SM_RESULT OnDisablingOnResetTimeout(_In_ PortEvent Event)

Definition at line 266 of file portsm.h.

Referenced by OnResetEnabledWait().

◆ DisablingOnSuspendTimed

const PortMachine::State PortMachine::DisablingOnSuspendTimed
static
Initial value:
=
{ &Transfer, "DisablingOnSuspendTimed", 0,
SM_RESULT OnDisablingOnSuspendTimed(_In_ PortEvent Event)

Definition at line 265 of file portsm.h.

Referenced by OnDebouncing(), and OnTimerFlush().

◆ DisablingSuperSpeed

const PortMachine::State PortMachine::DisablingSuperSpeed
static
Initial value:
=
{ &Transfer, "DisablingSuperSpeed", 0,
SM_RESULT EnterDisablingSuperSpeed()
SM_RESULT OnDisablingSuperSpeed(_In_ PortEvent Event)

Definition at line 270 of file portsm.h.

Referenced by OnOffEmpty(), and OnOffSuperSpeedDisabled().

◆ DisablingSuperSpeedOnRequest

const PortMachine::State PortMachine::DisablingSuperSpeedOnRequest
static
Initial value:
=
{ &Transfer, "DisablingSuperSpeedOnRequest", 0,
SM_RESULT OnDisablingSuperSpeedOnRequest(_In_ PortEvent Event)
SM_RESULT EnterDisablingSuperSpeedOnRequest()

Definition at line 271 of file portsm.h.

Referenced by OnAttachedDisabled(), and OnEnabled().

◆ Disconnected

const PortMachine::State PortMachine::Disconnected
static
Initial value:
=
static const State Empty
Definition: portsm.h:206
SM_RESULT EnterDisconnected()
static const PortEvent DisconnectedDrops[]
Definition: portsm_port.cpp:14

Definition at line 207 of file portsm.h.

Referenced by CheckConnection(), OnEmpty(), OnEnablingSuperSpeedOnTimer(), OnOffEmpty(), OnQueryingOverCurrent(), and OnStartingEmpty().

◆ DrainAcking

const PortMachine::State PortMachine::DrainAcking
static
Initial value:
=
{ NULL, "DrainAcking", PSM_CRIT,
SM_RESULT OnDrainAcking(_In_ PortEvent Event)

Definition at line 302 of file portsm.h.

Referenced by OnDrainReading().

◆ DrainChecking

const PortMachine::State PortMachine::DrainChecking
static
Initial value:
=
{ NULL, "DrainChecking", PSM_YIELDS,
SM_RESULT OnDrainChecking(_In_ PortEvent Event)

Definition at line 304 of file portsm.h.

Referenced by OnDrainEmptyIdle(), and OnDrainIdle().

◆ DrainEmptyIdleUsb2

const PortMachine::State PortMachine::DrainEmptyIdleUsb2
static
Initial value:
=
SM_RESULT OnDrainEmptyIdle(_In_ PortEvent Event)
static const PortEvent DrainEmptyDrops20[]

Definition at line 299 of file portsm.h.

Referenced by DrainDone(), and EnterDrainingEmpty().

◆ DrainEmptyIdleUsb3

const PortMachine::State PortMachine::DrainEmptyIdleUsb3
static
Initial value:
=
static const PortEvent DrainEmptyDrops30[]

Definition at line 300 of file portsm.h.

Referenced by DrainDone(), and EnterDrainingEmpty().

◆ DrainIdle

const PortMachine::State PortMachine::DrainIdle
static
Initial value:
=
SM_RESULT OnDrainIdle(_In_ PortEvent Event)
static const PortEvent DrainDrops[]

Definition at line 298 of file portsm.h.

Referenced by DrainDone(), EnterDraining(), and FailDeviceRequest().

◆ DrainReading

const PortMachine::State PortMachine::DrainReading
static
Initial value:
=
{ NULL, "DrainReading", PSM_CRIT,
SM_RESULT OnDrainReading(_In_ PortEvent Event)

Definition at line 301 of file portsm.h.

Referenced by OnDrainEmptyIdle(), and OnDrainIdle().

◆ DrainRearming

const PortMachine::State PortMachine::DrainRearming
static
Initial value:
=
SM_RESULT EnterDrainRearming()

Definition at line 303 of file portsm.h.

Referenced by OnDrainAcking(), and OnDrainReading().

◆ Empty

const PortMachine::State PortMachine::Empty
static
Initial value:
=
{ NULL, "Empty", 0, &PortMachine::OnEmpty, NULL, NULL }
SM_RESULT OnEmpty(_In_ PortEvent Event)

Definition at line 206 of file portsm.h.

◆ EmptyHubResetTimerWait

const PortMachine::State PortMachine::EmptyHubResetTimerWait
static
Initial value:
=
{ NULL, "EmptyHubResetTimerWait", SM_STATE_TAKES_REQUESTS,
SM_RESULT OnEmptyHubResetTimerWait(_In_ PortEvent Event)

Definition at line 248 of file portsm.h.

Referenced by OnDebouncing(), OnDisablingForCycleTimed(), OnOverCurrentWait(), and OnTimerFlush().

◆ EmptyHubResetWait

◆ Enabled

◆ EnablingSuperSpeedOnStop

const PortMachine::State PortMachine::EnablingSuperSpeedOnStop
static
Initial value:
=
{ &Transfer, "EnablingSuperSpeedOnStop", 0,
SM_RESULT EnterEnablingSuperSpeed()
SM_RESULT OnEnablingSuperSpeedOnStop(_In_ PortEvent Event)

Definition at line 272 of file portsm.h.

Referenced by OnSuperSpeedOffWait().

◆ EnablingSuperSpeedOnTimer

const PortMachine::State PortMachine::EnablingSuperSpeedOnTimer
static
Initial value:
=
{ &Transfer, "EnablingSuperSpeedOnTimer", 0,
SM_RESULT OnEnablingSuperSpeedOnTimer(_In_ PortEvent Event)

Definition at line 273 of file portsm.h.

Referenced by OnSuperSpeedOffWait().

◆ ErrorRestarting

const PortMachine::State PortMachine::ErrorRestarting
static
Initial value:
=
{ NULL, "ErrorRestarting", 0,
SM_RESULT EnterErrorRestarting()
SM_RESULT OnErrorRestarting(_In_ PortEvent Event)

Definition at line 233 of file portsm.h.

Referenced by OnOffAttached().

◆ EventInfo

const SM_EVENT_INFO PortMachine::EventInfo
static

Definition at line 155 of file portsm.h.

◆ FlushBeforeOffAttached

const PortMachine::State PortMachine::FlushBeforeOffAttached
static
Initial value:
=
{ NULL, "FlushBeforeOffAttached", 0, &PortMachine::OnFlushBeforeOff, NULL, PortStatusAndRemoved }
SM_RESULT OnFlushBeforeOff(_In_ PortEvent Event)
static const PortEvent PortStatusAndRemoved[]
Definition: portsm_port.cpp:37

Definition at line 218 of file portsm.h.

Referenced by OnFlushBeforeOff(), and OnHubResetTimerWait().

◆ FlushBeforeOffEmpty

const PortMachine::State PortMachine::FlushBeforeOffEmpty
static
Initial value:
=
{ NULL, "FlushBeforeOffEmpty", 0, &PortMachine::OnFlushBeforeOff, NULL, RemovedAndGone }

Definition at line 217 of file portsm.h.

Referenced by OnDebouncing(), OnDisablingOnSuspendTimed(), OnEmptyHubResetTimerWait(), OnOverCurrentWait(), and OnTimerFlush().

◆ FlushBeforeSuperSpeedOff

const PortMachine::State PortMachine::FlushBeforeSuperSpeedOff
static
Initial value:
=
{ NULL, "FlushBeforeSuperSpeedOff", 0, &PortMachine::OnFlushBeforeOff, NULL, RemovedOnly }

Definition at line 219 of file portsm.h.

Referenced by OnEnablingSuperSpeedOnStop().

◆ HubResetIssued

const PortMachine::State PortMachine::HubResetIssued
static
Initial value:
=
{ NULL, "HubResetIssued", SM_STATE_TAKES_REQUESTS,
SM_RESULT OnHubResetIssued(_In_ PortEvent Event)
SM_RESULT EnterHubResetIssued()

Definition at line 244 of file portsm.h.

Referenced by FailToHubReset(), HandleConnectedFault(), OnAttached(), and ResetTransferFailed().

◆ HubResetTimerWait

const PortMachine::State PortMachine::HubResetTimerWait
static
Initial value:
=
{ NULL, "HubResetTimerWait", SM_STATE_TAKES_REQUESTS,
SM_RESULT OnHubResetTimerWait(_In_ PortEvent Event)

Definition at line 246 of file portsm.h.

Referenced by ReleaseAndStopTimer().

◆ HubResetWait

const PortMachine::State PortMachine::HubResetWait
static
Initial value:
=
{ NULL, "HubResetWait", SM_STATE_TAKES_REQUESTS,
SM_RESULT OnHubResetWait(_In_ PortEvent Event)

Definition at line 245 of file portsm.h.

Referenced by OnHubResetTimerWait(), OnResetTimeoutStatus(), and ReleaseAndStopTimer().

◆ m_AfterTimer

TIMER_FOLLOW_UP PortMachine::m_AfterTimer
private

Definition at line 953 of file portsm.h.

Referenced by Initialize(), OnTimerFlush(), and StopTimerThen().

◆ m_ArmForEmpty

BOOLEAN PortMachine::m_ArmForEmpty
private

Definition at line 964 of file portsm.h.

Referenced by Initialize(), OnArmingWake(), OnDisabledInSuspend(), and OnEmpty().

◆ m_AttachForcedReset

BOOLEAN PortMachine::m_AttachForcedReset
private

Definition at line 962 of file portsm.h.

Referenced by Initialize(), OnAttachFailedWait(), and ReattachOrCreate().

◆ m_D3AfterResume

BOOLEAN PortMachine::m_D3AfterResume
private

◆ m_D3FlushReturn

PortEvent PortMachine::m_D3FlushReturn
private

Definition at line 958 of file portsm.h.

Referenced by Initialize(), OnD3DebounceFlush(), OnD3Debouncing(), and OnD3FlushThenReturn().

◆ m_D3Pending

D3_PENDING PortMachine::m_D3Pending
private

Definition at line 956 of file portsm.h.

Referenced by D3StopReconnectTimer(), Initialize(), and OnD3ReconnectFlush().

◆ m_D3PowerUpWarm

BOOLEAN PortMachine::m_D3PowerUpWarm
private

Definition at line 967 of file portsm.h.

Referenced by EnterD3PoweringUp(), Initialize(), and OnD3PoweredOff().

◆ m_DrainReturnsEmpty

BOOLEAN PortMachine::m_DrainReturnsEmpty
private

Definition at line 969 of file portsm.h.

Referenced by DrainDone(), EnterDraining(), EnterDrainingEmpty(), and Initialize().

◆ m_HubPowerHeld

BOOLEAN PortMachine::m_HubPowerHeld
private

Definition at line 952 of file portsm.h.

Referenced by HoldsHubPower(), Initialize(), and UpdateHubPower().

◆ m_LpmU2

BOOLEAN PortMachine::m_LpmU2
private

Definition at line 963 of file portsm.h.

Referenced by EnterSettingLpmTimeout(), Initialize(), and OnEnabled().

◆ m_OldDevice

OLD_DEVICE_KIND PortMachine::m_OldDevice
private

Definition at line 954 of file portsm.h.

Referenced by CheckOldDevice(), CycleDetach(), Initialize(), and OnOldDeviceWait().

◆ m_ParkResetsHub

BOOLEAN PortMachine::m_ParkResetsHub
private

Definition at line 965 of file portsm.h.

Referenced by EnterChangeParked20(), Initialize(), and ParkChange20().

◆ m_Port

◆ m_ReadFresh

BOOLEAN PortMachine::m_ReadFresh
private

Definition at line 960 of file portsm.h.

Referenced by CallStatusRead(), EnterStatusReading(), and Initialize().

◆ m_ReadKind

READ_KIND PortMachine::m_ReadKind
private

Definition at line 955 of file portsm.h.

Referenced by CallStatusRead(), Initialize(), StatusFailed(), and StatusQuiet().

◆ m_ReconnectFlushOnStop

BOOLEAN PortMachine::m_ReconnectFlushOnStop
private

Definition at line 968 of file portsm.h.

Referenced by Initialize(), OnReconnectFlush(), OnReconnectWait(), and OnSystemReconnectWait().

◆ m_ReturnEvent

PortEvent PortMachine::m_ReturnEvent
private

Definition at line 959 of file portsm.h.

Referenced by EnterReturning(), Initialize(), and ReturnFromFrame().

◆ m_SuspendReport

PortEvent PortMachine::m_SuspendReport
private

Definition at line 957 of file portsm.h.

Referenced by EnterSuspendReporting(), Initialize(), and ReportSuspendChange().

◆ m_Usb3

◆ m_WarmResume

BOOLEAN PortMachine::m_WarmResume
private

Definition at line 961 of file portsm.h.

Referenced by EnterResumingAttached(), Initialize(), and OnOffSuspended().

◆ NotifyingOverCurrent

const PortMachine::State PortMachine::NotifyingOverCurrent
static
Initial value:
=
{ NULL, "NotifyingOverCurrent", SM_STATE_NEEDS_PASSIVE,
SM_RESULT EnterNotifyingOverCurrent()
#define SM_STATE_NEEDS_PASSIVE
Definition: smengine.h:40

Definition at line 214 of file portsm.h.

Referenced by OnOverCurrentWait().

◆ Off

const PortMachine::State PortMachine::Off
static
Initial value:
=
SM_RESULT OnOff(_In_ PortEvent Event)
Definition: portsm.cpp:657

Definition at line 195 of file portsm.h.

◆ OffAttached

const PortMachine::State PortMachine::OffAttached
static
Initial value:
=
static const State Off
Definition: portsm.h:195
SM_RESULT OnOffAttached(_In_ PortEvent Event)
Definition: portsm.cpp:702
static const PortEvent OffAttachedDrops[]
Definition: portsm.cpp:76

Definition at line 198 of file portsm.h.

Referenced by OnAttached(), OnAttachedDisabled(), OnFlushBeforeOff(), OnHubResetIssued(), OnHubResetWait(), OnOffSuspended(), OnResumeAckWaitStopped(), OnResumingDisabled(), and OnStartingAttached().

◆ OffEmpty

◆ OffInitial

const PortMachine::State PortMachine::OffInitial
static
Initial value:
=
{ &Off, "OffInitial", 0, &PortMachine::OnOffEmpty, NULL, IdleRequests }

Definition at line 196 of file portsm.h.

Referenced by Initialize().

◆ OffResetNeeded

const PortMachine::State PortMachine::OffResetNeeded
static
Initial value:
=
{ &Off, "OffResetNeeded", 0, &PortMachine::OnOffResetNeeded, NULL, IdleRequests }
SM_RESULT OnOffResetNeeded(_In_ PortEvent Event)
Definition: portsm.cpp:738

Definition at line 199 of file portsm.h.

Referenced by OnAttachFailedWait(), OnOffAttached(), OnOffSuspended(), OnOldDeviceWait(), and OnQuiescingForHubSuspend().

◆ OffSuperSpeedDisabled

const PortMachine::State PortMachine::OffSuperSpeedDisabled
static
Initial value:
=
{ &Off, "OffSuperSpeedDisabled", 0,
SM_RESULT OnOffSuperSpeedDisabled(_In_ PortEvent Event)
Definition: portsm.cpp:763
static const PortEvent RemovedAndStopped[]
Definition: portsm.cpp:84

Definition at line 200 of file portsm.h.

Referenced by OnOffSuperSpeedDisabled(), and OnSsLinkDisabled().

◆ OffSuspendedUsb2

const PortMachine::State PortMachine::OffSuspendedUsb2
static
Initial value:
=
{ NULL, "OffSuspendedUsb2", PSM_STATE_IDLE,
SM_RESULT OnOffSuspended(_In_ PortEvent Event)
Definition: portsm.cpp:796
SM_RESULT EnterOffSuspended()
Definition: portsm.cpp:789
static const PortEvent StatusAndRemoved[]
Definition: portsm.cpp:89

Definition at line 202 of file portsm.h.

Referenced by OnHubResetIssued(), and OnSuspended().

◆ OffSuspendedUsb3

const PortMachine::State PortMachine::OffSuspendedUsb3
static
Initial value:

Definition at line 201 of file portsm.h.

Referenced by OnArmingWake(), and OnHubResetIssued().

◆ OldDeviceWait

const PortMachine::State PortMachine::OldDeviceWait
static
Initial value:
=
{ NULL, "OldDeviceWait", 0,
SM_RESULT OnOldDeviceWait(_In_ PortEvent Event)

Definition at line 212 of file portsm.h.

Referenced by CheckOldDevice(), CycleDetach(), OnDisablingForCycle(), and OnOldDeviceWait().

◆ OverCurrentWait

const PortMachine::State PortMachine::OverCurrentWait
static
Initial value:
=
{ NULL, "OverCurrentWait", 0,
SM_RESULT OnOverCurrentWait(_In_ PortEvent Event)

Definition at line 213 of file portsm.h.

Referenced by OnOverCurrentWait(), and StartOverCurrentWait().

◆ PoweringPort

const PortMachine::State PortMachine::PoweringPort
static
Initial value:
=
{ &Transfer, "PoweringPort", 0,
SM_RESULT OnPoweringPort(_In_ PortEvent Event)
SM_RESULT EnterPoweringPort()

Definition at line 254 of file portsm.h.

Referenced by DetachThen(), FollowTimer(), OnEmpty(), OnOldDeviceWait(), OnOverCurrentWait(), OnResetTimeoutStatus(), and OnUserResetWait().

◆ PowerOnSending

const PortMachine::State PortMachine::PowerOnSending
static
Initial value:
=
{ NULL, "PowerOnSending", PSM_CRIT,
SM_RESULT OnPowerOnSending(_In_ PortEvent Event)

Definition at line 306 of file portsm.h.

Referenced by EnterStartingAttached(), EnterStartingEmpty(), and OnStartReadingFirst().

◆ PowerOnSettling

const PortMachine::State PortMachine::PowerOnSettling
static
Initial value:
=
{ NULL, "PowerOnSettling", 0,
SM_RESULT OnPowerOnSettling(_In_ PortEvent Event)
SM_RESULT EnterPowerOnSettling()
static const PortEvent FrameGoneOnly[]

Definition at line 307 of file portsm.h.

Referenced by OnPowerOnSending().

◆ PowerUpRearming

const PortMachine::State PortMachine::PowerUpRearming
static
Initial value:
=
{ NULL, "PowerUpRearming", PSM_YIELDS | PSM_PASSIVE,
SM_RESULT EnterPowerUpRearming()
SM_RESULT OnPowerUpParked(_In_ PortEvent Event)

Definition at line 312 of file portsm.h.

Referenced by OnPowerUpParked(), and ReconnectStatusFailed().

◆ PowerUpResetHub

const PortMachine::State PortMachine::PowerUpResetHub
static
Initial value:

Definition at line 311 of file portsm.h.

Referenced by OnPowerOnSending(), OnStartReading20(), and ResumeStateDisabled().

◆ QueryingOverCurrent

const PortMachine::State PortMachine::QueryingOverCurrent
static
Initial value:
=
{ &Transfer, "QueryingOverCurrent", 0,
SM_RESULT OnQueryingOverCurrent(_In_ PortEvent Event)

Definition at line 255 of file portsm.h.

Referenced by OnPoweringPort().

◆ QuiescingForHubSuspend

const PortMachine::State PortMachine::QuiescingForHubSuspend
static
Initial value:
=
{ &Transfer, "QuiescingForHubSuspend", 0,
SM_RESULT EnterQuiescingForHubSuspend()
SM_RESULT OnQuiescingForHubSuspend(_In_ PortEvent Event)

Definition at line 263 of file portsm.h.

Referenced by OnAttachFailedWait(), and OnOldDeviceWait().

◆ ReadingAfterResumeTimeout

const PortMachine::State PortMachine::ReadingAfterResumeTimeout
static
Initial value:
=
{ &Transfer, "ReadingAfterResumeTimeout", 0,
SM_RESULT OnReadingAfterResumeTimeout(_In_ PortEvent Event)

Definition at line 268 of file portsm.h.

Referenced by OnResumeWait().

◆ ReadingForResume

const PortMachine::State PortMachine::ReadingForResume
static
Initial value:
=
{ &Transfer, "ReadingForResume", 0,
SM_RESULT OnReadingForResume(_In_ PortEvent Event)

Definition at line 267 of file portsm.h.

Referenced by OnSuspended().

◆ ReconnectAcking

const PortMachine::State PortMachine::ReconnectAcking
static
Initial value:
=
{ NULL, "ReconnectAcking", PSM_CRIT,
SM_RESULT OnReconnectAcking(_In_ PortEvent Event)

Definition at line 320 of file portsm.h.

Referenced by ReconnectCheck().

◆ ReconnectFlush

const PortMachine::State PortMachine::ReconnectFlush
static
Initial value:
=
{ NULL, "ReconnectFlush", 0, &PortMachine::OnReconnectFlush, NULL, NULL }
SM_RESULT OnReconnectFlush(_In_ PortEvent Event)

Definition at line 322 of file portsm.h.

Referenced by OnReconnectWait(), and OnSystemReconnectWait().

◆ ReconnectReading

const PortMachine::State PortMachine::ReconnectReading
static
Initial value:
=
{ NULL, "ReconnectReading", PSM_CRIT,
SM_RESULT OnReconnectReading(_In_ PortEvent Event)

Definition at line 319 of file portsm.h.

Referenced by OnReconnectWait().

◆ ReconnectRearming

const PortMachine::State PortMachine::ReconnectRearming
static
Initial value:
=
SM_RESULT EnterReconnectRearming()

Definition at line 321 of file portsm.h.

Referenced by ReconnectCheck().

◆ ReconnectWait

const PortMachine::State PortMachine::ReconnectWait
static
Initial value:
=
{ NULL, "ReconnectWait", 0, &PortMachine::OnReconnectWait, NULL, NULL }
SM_RESULT OnReconnectWait(_In_ PortEvent Event)

Definition at line 318 of file portsm.h.

Referenced by EnterReconnectRearming(), and OnResumeReading().

◆ ResetChangeChecking

const PortMachine::State PortMachine::ResetChangeChecking
static
Initial value:
=
{ NULL, "ResetChangeChecking", PSM_YIELDS,
SM_RESULT OnResetChangeChecking(_In_ PortEvent Event)

Definition at line 287 of file portsm.h.

Referenced by OnResetChangeIdle(), and OnResetPollChecking().

◆ ResetChangeIdle

const PortMachine::State PortMachine::ResetChangeIdle
static
Initial value:
=
SM_RESULT OnResetChangeIdle(_In_ PortEvent Event)

Definition at line 286 of file portsm.h.

Referenced by EnterResetWait(), and OnResetChangeChecking().

◆ ResetEnabledWait

const PortMachine::State PortMachine::ResetEnabledWait
static
Initial value:
=
{ &Timed, "ResetEnabledWait", 0,
SM_RESULT OnResetEnabledWait(_In_ PortEvent Event)
static const State Timed
Definition: portsm.h:236

Definition at line 238 of file portsm.h.

Referenced by OnResetEnabledWait(), and TimedError().

◆ ResetFlush

const PortMachine::State PortMachine::ResetFlush
static
Initial value:
=
{ &Timed, "ResetFlush", 0,
SM_RESULT OnResetFlush(_In_ PortEvent Event)

Definition at line 239 of file portsm.h.

Referenced by OnResetEnabledWait(), OnResetFlush(), and OnResetWait().

◆ ResetPollChecking

const PortMachine::State PortMachine::ResetPollChecking
static
Initial value:
=
{ NULL, "ResetPollChecking", PSM_YIELDS,
SM_RESULT EnterResetPollChecking()
SM_RESULT OnResetPollChecking(_In_ PortEvent Event)

Definition at line 289 of file portsm.h.

Referenced by OnResetPollWait().

◆ ResetPollWait

const PortMachine::State PortMachine::ResetPollWait
static
Initial value:
=
{ NULL, "ResetPollWait", PSM_CRIT,
SM_RESULT OnResetPollWait(_In_ PortEvent Event)
SM_RESULT EnterResetPollWait()

Definition at line 288 of file portsm.h.

Referenced by OnResetChangeChecking().

◆ ResetRequestWait

const PortMachine::State PortMachine::ResetRequestWait
static
Initial value:
=
{ &Attached, "ResetRequestWait", SM_STATE_TAKES_REQUESTS,
SM_RESULT EnterResetWait()
SM_RESULT OnResetRequestWait(_In_ PortEvent Event)
static const PortEvent RemovedAndLpm[]
Definition: portsm_port.cpp:32

Definition at line 228 of file portsm.h.

Referenced by OnErrorRestarting(), OnResetRequestWait(), OnSystemResuming(), and ReattachOrCreate().

◆ ResetTimeoutStatus

const PortMachine::State PortMachine::ResetTimeoutStatus
static
Initial value:
=
{ &Transfer, "ResetTimeoutStatus", 0,
SM_RESULT EnterResetTimeoutStatus()
SM_RESULT OnResetTimeoutStatus(_In_ PortEvent Event)

Definition at line 274 of file portsm.h.

Referenced by OnResetWait().

◆ ResetWait

const PortMachine::State PortMachine::ResetWait
static
Initial value:
=
SM_RESULT OnResetWait(_In_ PortEvent Event)

Definition at line 237 of file portsm.h.

Referenced by EnterResetWait(), OnResetRequestWait(), OnResetWait(), and OnSendingReset().

◆ ResumeAckingConnect

const PortMachine::State PortMachine::ResumeAckingConnect
static
Initial value:
=
{ NULL, "ResumeAckingConnect", PSM_CRIT,
SM_RESULT OnResumeAckingConnect(_In_ PortEvent Event)

Definition at line 317 of file portsm.h.

Referenced by ResumeConnectCheck().

◆ ResumeAckWait

const PortMachine::State PortMachine::ResumeAckWait
static
Initial value:

Definition at line 227 of file portsm.h.

Referenced by HandleConnectedFault(), OnResumeAckWait(), and OnSuspended().

◆ ResumeAckWaitStopped

const PortMachine::State PortMachine::ResumeAckWaitStopped
static
Initial value:
=
{ NULL, "ResumeAckWaitStopped", SM_STATE_TAKES_REQUESTS,
SM_RESULT OnResumeAckWaitStopped(_In_ PortEvent Event)

Definition at line 234 of file portsm.h.

Referenced by OnResumeAckWait().

◆ ResumeChangeChecking

const PortMachine::State PortMachine::ResumeChangeChecking
static
Initial value:
=
{ NULL, "ResumeChangeChecking", PSM_YIELDS,
SM_RESULT OnResumeChangeChecking(_In_ PortEvent Event)

Definition at line 291 of file portsm.h.

Referenced by OnResumeChangeIdle().

◆ ResumeChangeIdle

const PortMachine::State PortMachine::ResumeChangeIdle
static
Initial value:
=
SM_RESULT OnResumeChangeIdle(_In_ PortEvent Event)

Definition at line 290 of file portsm.h.

Referenced by EnterResumeWait(), and OnResumeChangeChecking().

◆ ResumeFlush

const PortMachine::State PortMachine::ResumeFlush
static
Initial value:
=
{ &Timed, "ResumeFlush", 0,
SM_RESULT OnResumeFlush(_In_ PortEvent Event)

Definition at line 242 of file portsm.h.

Referenced by OnResumeFlush(), and OnResumeWait().

◆ ResumePowering

const PortMachine::State PortMachine::ResumePowering
static
Initial value:
=
{ NULL, "ResumePowering", PSM_CRIT,
SM_RESULT OnResumePowering(_In_ PortEvent Event)

Definition at line 314 of file portsm.h.

Referenced by EnterD3PoweringUp(), and EnterResumingAttached().

◆ ResumeReading

const PortMachine::State PortMachine::ResumeReading
static
Initial value:
=
{ NULL, "ResumeReading", PSM_CRIT,
SM_RESULT OnResumeReading(_In_ PortEvent Event)
An over-current seen now, or one that came and went while suspended, is reported.

Definition at line 316 of file portsm.h.

Referenced by EnterD3PoweringUp(), EnterResumingAttached(), and OnResumeSettling().

◆ ResumeRecovery

const PortMachine::State PortMachine::ResumeRecovery
static
Initial value:
=
{ &Timed, "ResumeRecovery", 0,
SM_RESULT OnResumeRecovery(_In_ PortEvent Event)

Definition at line 241 of file portsm.h.

Referenced by OnResumeFlush(), OnResumeRecovery(), and OnResumeWait().

◆ ResumeRereading

const PortMachine::State PortMachine::ResumeRereading
static
Initial value:
=
{ NULL, "ResumeRereading", PSM_CRIT,
SM_RESULT OnResumeRereading(_In_ PortEvent Event)

Definition at line 323 of file portsm.h.

Referenced by OnReconnectWait().

◆ ResumeSettling

const PortMachine::State PortMachine::ResumeSettling
static
Initial value:
=
{ NULL, "ResumeSettling", 0,
SM_RESULT OnResumeSettling(_In_ PortEvent Event)

Definition at line 315 of file portsm.h.

Referenced by OnResumePowering().

◆ ResumeWait

const PortMachine::State PortMachine::ResumeWait
static
Initial value:
=
SM_RESULT OnResumeWait(_In_ PortEvent Event)
SM_RESULT EnterResumeWait()

Definition at line 240 of file portsm.h.

Referenced by OnResumeWait(), and OnSendingResume().

◆ ResumingAttached

const PortMachine::State PortMachine::ResumingAttached
static
Initial value:
=
{ &Attached, "ResumingAttached", 0,
SM_RESULT OnResumingAttached(_In_ PortEvent Event)
SM_RESULT EnterResumingAttached()

Definition at line 230 of file portsm.h.

Referenced by EnterResumingAttached(), and OnOffSuspended().

◆ ResumingDisabled

const PortMachine::State PortMachine::ResumingDisabled
static
Initial value:
=
{ &Attached, "ResumingDisabled", 0,
SM_RESULT OnResumingDisabled(_In_ PortEvent Event)

Definition at line 231 of file portsm.h.

Referenced by OnOffAttached().

◆ Returning

const PortMachine::State PortMachine::Returning
static
Initial value:
=
{ NULL, "Returning", 0, NULL, &PortMachine::EnterReturning, NULL }
SM_RESULT EnterReturning()
Definition: portsm.cpp:297

Definition at line 344 of file portsm.h.

Referenced by ReturnFromFrame().

◆ SendingReset

const PortMachine::State PortMachine::SendingReset
static
Initial value:
=
{ &Transfer, "SendingReset", 0,
SM_RESULT OnSendingReset(_In_ PortEvent Event)
SM_RESULT EnterSendingReset()

Definition at line 256 of file portsm.h.

Referenced by OnAttachedDisabled(), OnEnabled(), and OnSuspended().

◆ SendingResume

const PortMachine::State PortMachine::SendingResume
static
Initial value:
=
{ &Transfer, "SendingResume", 0,
SM_RESULT OnSendingResume(_In_ PortEvent Event)
SM_RESULT EnterSendingResume()

Definition at line 258 of file portsm.h.

Referenced by OnReadingForResume(), and OnSuspended().

◆ SendingSuspend

const PortMachine::State PortMachine::SendingSuspend
static
Initial value:
=
{ &Transfer, "SendingSuspend", 0,
SM_RESULT EnterSendingSuspend()
SM_RESULT OnSendingSuspend(_In_ PortEvent Event)

Definition at line 259 of file portsm.h.

Referenced by OnEnabled().

◆ SendingWarmReset

const PortMachine::State PortMachine::SendingWarmReset
static
Initial value:
=
{ &Transfer, "SendingWarmReset", 0,
SM_RESULT EnterSendingWarmReset()

Definition at line 257 of file portsm.h.

Referenced by OnAttachedDisabled(), OnDisabledInSuspend(), and OnEnabled().

◆ SettingLpmTimeout

const PortMachine::State PortMachine::SettingLpmTimeout
static
Initial value:
=
{ &Transfer, "SettingLpmTimeout", 0,
SM_RESULT EnterSettingLpmTimeout()
SM_RESULT OnSettingLpmTimeout(_In_ PortEvent Event)

Definition at line 269 of file portsm.h.

Referenced by OnEnabled().

◆ SmCompletionsFirst

const BOOLEAN PortMachine::SmCompletionsFirst = FALSE
staticprivate

Definition at line 348 of file portsm.h.

◆ SsLinkDisabled

const PortMachine::State PortMachine::SsLinkDisabled
static
Initial value:

Definition at line 251 of file portsm.h.

Referenced by OnDisablingSuperSpeed(), and OnOffSuperSpeedDisabled().

◆ StartingAttached

const PortMachine::State PortMachine::StartingAttached
static
Initial value:
=
{ &Attached, "StartingAttached", 0,
SM_RESULT OnStartingAttached(_In_ PortEvent Event)
SM_RESULT EnterStartingAttached()

Definition at line 229 of file portsm.h.

Referenced by OnOffAttached().

◆ StartingEmpty

const PortMachine::State PortMachine::StartingEmpty
static
Initial value:
=
{ &Empty, "StartingEmpty", 0,
SM_RESULT EnterStartingEmpty()
SM_RESULT OnStartingEmpty(_In_ PortEvent Event)

Definition at line 208 of file portsm.h.

Referenced by OnOffEmpty().

◆ StartReading20

const PortMachine::State PortMachine::StartReading20
static
Initial value:
=
{ NULL, "StartReading20", PSM_CRIT,
SM_RESULT OnStartReading20(_In_ PortEvent Event)

Definition at line 308 of file portsm.h.

Referenced by OnPowerOnSettling().

◆ StartReading30

const PortMachine::State PortMachine::StartReading30
static
Initial value:
=
{ NULL, "StartReading30", PSM_YIELDS,
SM_RESULT OnStartReading30(_In_ PortEvent Event)
SM_RESULT EnterStartResumeStatusRead()

Definition at line 310 of file portsm.h.

Referenced by OnPowerOnSettling(), and OnStartReadingFirst().

◆ StartReadingFirst

const PortMachine::State PortMachine::StartReadingFirst
static
Initial value:
=
{ NULL, "StartReadingFirst", PSM_CRIT,
SM_RESULT OnStartReadingFirst(_In_ PortEvent Event)

Definition at line 309 of file portsm.h.

Referenced by EnterStartingEmpty().

◆ StatusAcking

const PortMachine::State PortMachine::StatusAcking
static
Initial value:
=
{ NULL, "StatusAcking", PSM_CRIT,
SM_RESULT OnStatusAcking(_In_ PortEvent Event)

Definition at line 294 of file portsm.h.

Referenced by OnStatusAcking(), and OnStatusReading().

◆ StatusFailing

const PortMachine::State PortMachine::StatusFailing
static
Initial value:
=
SM_RESULT EnterStatusFailing()

Definition at line 296 of file portsm.h.

Referenced by StatusFailed().

◆ StatusReading

const PortMachine::State PortMachine::StatusReading
static
Initial value:
=
{ NULL, "StatusReading", PSM_CRIT,
SM_RESULT OnStatusReading(_In_ PortEvent Event)
SM_RESULT EnterStatusReading()

Definition at line 293 of file portsm.h.

Referenced by CallStatusRead(), and OnStatusAcking().

◆ StatusReporting

const PortMachine::State PortMachine::StatusReporting
static
Initial value:
=
SM_RESULT EnterStatusReporting()

Definition at line 295 of file portsm.h.

Referenced by StatusQuiet().

◆ SuperSpeedOffWait

const PortMachine::State PortMachine::SuperSpeedOffWait
static
Initial value:
=
{ NULL, "SuperSpeedOffWait", 0,
SM_RESULT OnSuperSpeedOffWait(_In_ PortEvent Event)

Definition at line 250 of file portsm.h.

Referenced by OnDisablingSuperSpeedOnRequest().

◆ SuspendAcking

const PortMachine::State PortMachine::SuspendAcking
static
Initial value:
=
{ NULL, "SuspendAcking", PSM_CRIT,
SM_RESULT OnSuspendAcking(_In_ PortEvent Event)

Definition at line 330 of file portsm.h.

Referenced by OnSuspendAcking(), and OnSuspendReading().

◆ Suspended

const PortMachine::State PortMachine::Suspended
static
Initial value:

Definition at line 224 of file portsm.h.

Referenced by OnEnabled(), OnOffSuspended(), OnResumingAttached(), OnSendingSuspend(), OnSuspended(), and OnSystemResuming().

◆ SuspendedD3Cold

const PortMachine::State PortMachine::SuspendedD3Cold
static
Initial value:

Definition at line 226 of file portsm.h.

Referenced by OnDisabledInSuspend(), and OnSuspended().

◆ SuspendIdle

const PortMachine::State PortMachine::SuspendIdle
static
Initial value:
=
SM_RESULT OnSuspendIdle(_In_ PortEvent Event)

Definition at line 328 of file portsm.h.

Referenced by EnterSuspended().

◆ SuspendReading

const PortMachine::State PortMachine::SuspendReading
static
Initial value:
=
{ NULL, "SuspendReading", PSM_CRIT,
SM_RESULT OnSuspendReading(_In_ PortEvent Event)
An error on a port that is connected but no longer enabled counts as a connect.

Definition at line 329 of file portsm.h.

Referenced by OnSuspendAcking(), and OnSuspendIdle().

◆ SuspendRecovery

const PortMachine::State PortMachine::SuspendRecovery
static
Initial value:
=
{ NULL, "SuspendRecovery", 0,
SM_RESULT EnterSuspendRecovery()
SM_RESULT OnSuspendRecovery(_In_ PortEvent Event)

Definition at line 331 of file portsm.h.

Referenced by OnSuspendReading().

◆ SuspendReporting

const PortMachine::State PortMachine::SuspendReporting
static
Initial value:
=
SM_RESULT EnterSuspendReporting()

Definition at line 332 of file portsm.h.

Referenced by ReportSuspendChange().

◆ SystemReconnectWait

const PortMachine::State PortMachine::SystemReconnectWait
static
Initial value:
=
{ NULL, "SystemReconnectWait", 0, &PortMachine::OnSystemReconnectWait, NULL, NULL }
SM_RESULT OnSystemReconnectWait(_In_ PortEvent Event)

Definition at line 325 of file portsm.h.

Referenced by OnSystemResumeReading().

◆ SystemResumeReading

const PortMachine::State PortMachine::SystemResumeReading
static
Initial value:
=
{ NULL, "SystemResumeReading", PSM_YIELDS,
SM_RESULT OnSystemResumeReading(_In_ PortEvent Event)

Definition at line 324 of file portsm.h.

Referenced by EnterSystemResuming().

◆ SystemResumeRereading

const PortMachine::State PortMachine::SystemResumeRereading
static
Initial value:
=
{ NULL, "SystemResumeRereading", PSM_YIELDS,
SM_RESULT OnSystemResumeRereading(_In_ PortEvent Event)

Definition at line 326 of file portsm.h.

Referenced by OnReconnectFlush(), and OnSystemReconnectWait().

◆ SystemResuming

const PortMachine::State PortMachine::SystemResuming
static
Initial value:
=
{ &Attached, "SystemResuming", 0,
SM_RESULT EnterSystemResuming()
SM_RESULT OnSystemResuming(_In_ PortEvent Event)

Definition at line 232 of file portsm.h.

Referenced by OnOffSuspended().

◆ Timed

const PortMachine::State PortMachine::Timed
static
Initial value:
=
{ NULL, "Timed", 0, &PortMachine::OnTimed, NULL, NULL }
SM_RESULT OnTimed(_In_ PortEvent Event)

Definition at line 236 of file portsm.h.

◆ TimerFlush

const PortMachine::State PortMachine::TimerFlush
static
Initial value:
=
{ NULL, "TimerFlush", 0,
SM_RESULT OnTimerFlush(_In_ PortEvent Event)

Definition at line 216 of file portsm.h.

Referenced by OnTimerFlush(), and StopTimerThen().

◆ Transfer

const PortMachine::State PortMachine::Transfer
static
Initial value:
=
#define SM_STATE_CRITICAL_ONLY
Definition: smengine.h:41

Definition at line 253 of file portsm.h.

◆ UserResetWait

const PortMachine::State PortMachine::UserResetWait
static
Initial value:
=
{ NULL, "UserResetWait", 0,
SM_RESULT OnUserResetWait(_In_ PortEvent Event)

Definition at line 215 of file portsm.h.

Referenced by EnterNotifyingOverCurrent(), and OnUserResetWait().

◆ WakeArming

const PortMachine::State PortMachine::WakeArming
static
Initial value:
=
SM_RESULT OnWakeArming(_In_ PortEvent Event)
SM_RESULT EnterWakeArming()

Definition at line 343 of file portsm.h.

Referenced by EnterArmingWake().


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