123#define PSM_STATE_IDLE_USB2 0x00000100
124#define PSM_STATE_IDLE_USB3 0x00000200
125#define PSM_STATE_IDLE (PSM_STATE_IDLE_USB2 | PSM_STATE_IDLE_USB3)
static _Out_opt_ PULONGLONG Start
SM_RESULT OnOverCurrentWait(_In_ PortEvent Event)
SM_RESULT EnterErrorRestarting()
static const State EmptyHubResetWait
SM_RESULT EnterStartingEmpty()
SM_RESULT OnSystemResumeReading(_In_ PortEvent Event)
SM_RESULT EnterDisablingOnRequest()
SM_RESULT OnHubResetTimerWait(_In_ PortEvent Event)
static const State Attached
static const State ChangeIdle30
VOID SendRemoteWake(_In_ BOOLEAN Enable)
SM_RESULT EnterEnablingSuperSpeed()
VOID ReattachBootDevice()
SM_RESULT OnReconnectWait(_In_ PortEvent Event)
SM_RESULT EnterQuiescingForHubSuspend()
static const BOOLEAN SmCompletionsFirst
SM_RESULT OnHubResetWait(_In_ PortEvent Event)
SM_RESULT OnChangeAcking20(_In_ PortEvent Event)
static const State StartReadingFirst
static const State CleaningUp
static const State ResumeRereading
VOID UpdateHubPower(_In_ BOOLEAN Idle)
VOID DropInterruptReference()
SM_RESULT OnStatusAcking(_In_ PortEvent Event)
static const State ResetRequestWait
SM_RESULT OnResumeAckingConnect(_In_ PortEvent Event)
SM_RESULT OnWakeArming(_In_ PortEvent Event)
static const State EmptyHubResetTimerWait
static const State TimerFlush
SM_RESULT CallStatusRead(_In_ READ_KIND Kind)
PortEvent ErrorResponseDuringReset()
static const State DrainIdle
SM_RESULT EnterDisablingSuperSpeed()
static const State OffEmpty
SM_RESULT OnResumeFlush(_In_ PortEvent Event)
@ D3PendingOverCurrentCleared
static const State SuspendAcking
SM_RESULT OnArmingWake(_In_ PortEvent Event)
SM_RESULT OnQuiescingForHubSuspend(_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 OnPoweringPort(_In_ PortEvent Event)
static const State DisablingForCycleTimed
SM_RESULT EnterResetPollChecking()
BOOLEAN OldDevicePresent()
static const State DisablingForCycle
SM_RESULT OnReconnectFlush(_In_ PortEvent Event)
SM_RESULT OnSuperSpeedOffWait(_In_ PortEvent Event)
static const State ResumeAckWaitStopped
SM_RESULT OnAttachFailedWait(_In_ PortEvent Event)
SM_RESULT EnterDisablingPort()
SM_RESULT ResumeReadDone()
SM_RESULT OnSystemReconnectWait(_In_ PortEvent Event)
SM_RESULT EnterSuspendedD3Cold()
@ FollowOverCurrentCleared
SM_RESULT CheckPending20(_In_ const State *Acking, _In_ const State *Quiet)
SM_RESULT OnHubResetIssued(_In_ PortEvent Event)
SM_RESULT DetachThen(_In_ PortEvent Change)
SM_RESULT OnResetEnabledWait(_In_ PortEvent Event)
SM_RESULT DetachTimed(_In_ PortEvent Change)
SM_RESULT OnOldDeviceWait(_In_ PortEvent Event)
SM_RESULT EnterPoweringPort()
static const State ResetChangeChecking
SM_RESULT EnterResetWait()
SM_RESULT EnterSettingLpmTimeout()
SM_RESULT EnterResetTimeoutStatus()
SM_RESULT OnOff(_In_ PortEvent Event)
SM_RESULT OnD3DebounceFlush(_In_ PortEvent Event)
static const State DrainEmptyIdleUsb2
SM_RESULT OnResetChangeIdle(_In_ PortEvent Event)
SM_RESULT EnterReadingStatus()
static const State Returning
SM_RESULT EnterSendingSuspend()
static const State DebouncingUsb2
SM_RESULT OnDrainIdle(_In_ PortEvent Event)
SM_RESULT EnterStatusReporting()
VOID SmStateChanged()
The innermost frame that does not yield to its caller decides whether the port holds the hub awake.
static const State HubResetTimerWait
SM_RESULT EnterD3PoweringUp()
static const State AttachFailedWait
SM_RESULT EnterChangeReporting20()
SM_RESULT OnResetPollWait(_In_ PortEvent Event)
SM_RESULT OnAttached(_In_ PortEvent Event)
SM_RESULT OnResetTimeoutStatus(_In_ PortEvent Event)
SM_RESULT FailToHubReset()
SM_RESULT EnterSuspendRecovery()
static const State ResumingAttached
VOID RecordPortSuspended()
static const State ResetPollChecking
BOOLEAN OverCurrentActive()
static const State D3Idle
static const State ResumeChangeIdle
SM_RESULT EnterPowerUpResetHub()
SM_RESULT OnD3ReconnectWait(_In_ PortEvent Event)
PortEvent m_SuspendReport
static const State ChangeAcking20
BOOLEAN BootDeviceReturning()
SM_RESULT EnterPlainStatusRead()
SM_RESULT OnDisablingSuperSpeedOnRequest(_In_ PortEvent Event)
static const State ErrorRestarting
VOID RecordPortDisabled()
SM_RESULT OnDrainEmptyIdle(_In_ PortEvent Event)
static const State ResumeSettling
SM_RESULT OnD3ReconnectFlush(_In_ PortEvent Event)
SM_RESULT OnChangeIdle20(_In_ PortEvent Event)
SM_RESULT OnResetChangeChecking(_In_ PortEvent Event)
SM_RESULT OnResetRequestWait(_In_ PortEvent Event)
static const State DrainEmptyIdleUsb3
SM_RESULT OnErrorRestarting(_In_ PortEvent Event)
SM_RESULT OnResumeSettling(_In_ PortEvent Event)
static const State PowerUpResetHub
SM_RESULT ReportSuspendChange(_In_ PortEvent Report)
SM_RESULT OnReadingForResume(_In_ PortEvent Event)
SM_RESULT EnterChangeParked20()
SM_RESULT ResumeConnectCheck()
static const State D3DebounceFlush
static const State PowerUpRearming
static const State QueryingOverCurrent
static const State D3PoweredOff
SM_RESULT OnResumingAttached(_In_ PortEvent Event)
SM_RESULT OnSuspended(_In_ PortEvent Event)
static const State DrainReading
SM_RESULT EnterNotifyingOverCurrent()
SM_RESULT OnResumeChangeIdle(_In_ PortEvent Event)
BOOLEAN AllowsHubSuspend(_In_ const State *Target) const
SM_RESULT OnOffResetNeeded(_In_ PortEvent Event)
BOOLEAN DeviceConnected()
static const State EnablingSuperSpeedOnStop
static const State D3FlushThenReturn
SM_RESULT EnterWithPortChange()
SM_RESULT OnD3Idle(_In_ PortEvent Event)
SM_RESULT EnterArmingWake()
SM_RESULT EnterReconnectRearming()
BOOLEAN SuperSpeedBlocked()
BOOLEAN OverCurrentPersists()
SM_RESULT OnAttachedDisabled(_In_ PortEvent Event)
SM_RESULT EnterDraining()
SM_RESULT OnDisabledInSuspend(_In_ PortEvent Event)
static const State ArmingWake
static const State ChangeChecking30
static const State HubResetWait
static const State EnablingSuperSpeedOnTimer
static const State ResumeAckWait
SM_RESULT OnDrainAcking(_In_ PortEvent Event)
SM_RESULT OnOffSuspended(_In_ PortEvent Event)
static const State StartReading30
VOID NotifyUserOfOverCurrent()
SM_RESULT ResumeSucceeded()
SM_RESULT D3ConnectCheck(_In_ BOOLEAN AfterResume)
static const State ResumeAckingConnect
SM_RESULT OnSendingReset(_In_ PortEvent Event)
SM_RESULT TimedHubReset()
SM_RESULT TakeInterruptForReset(_In_ const State *Start, _In_ const State *Refused)
VOID ResetChangeAccumulator()
static const State OffResetNeeded
static const State StatusReporting
VOID SmOnDequeue(_In_ PortEvent Event)
SM_RESULT EnterReturning()
static const State DrainRearming
SM_RESULT EnterWakeArming()
SM_RESULT OnD3FlushThenReturn(_In_ PortEvent Event)
BOOLEAN HubArmedForWake()
SM_RESULT EnterStatusFailing()
VOID ForceResetOnEnumeration()
static const State ReconnectRearming
static const State OffSuperSpeedDisabled
VOID FixPortStateAfterPowerUp()
static const State QuiescingForHubSuspend
SM_RESULT OnSuspendReading(_In_ PortEvent Event)
An error on a port that is connected but no longer enabled counts as a connect.
PSM_PENDING PendingChange()
static const State SuspendIdle
SM_RESULT ReleaseAndStopTimer()
static const State D3ReconnectWait
SM_RESULT ResetSucceeded()
SM_RESULT FailDeviceRequest()
SM_RESULT OnStatusReading(_In_ PortEvent Event)
SM_RESULT EnterOffSuspended()
BOOLEAN PollResetCompletion()
BOOLEAN HoldsHubPower() const
static const State SendingSuspend
SM_RESULT OnSettingLpmTimeout(_In_ PortEvent Event)
static const State ReconnectAcking
SM_RESULT OnOffSuperSpeedDisabled(_In_ PortEvent Event)
static const State UserResetWait
SM_RESULT OnTimerFlush(_In_ PortEvent Event)
static const State OffAttached
static const State DisablingSuperSpeed
OLD_DEVICE_KIND m_OldDevice
BOOLEAN TakeInterruptReference()
static const State Enabled
static const State DisabledInSuspend
SM_RESULT OnEmptyHubResetTimerWait(_In_ PortEvent Event)
PortEvent m_D3FlushReturn
SM_RESULT EnterDrainingEmpty()
SM_RESULT OnResumeWait(_In_ PortEvent Event)
SM_RESULT EnterDisablingSuperSpeedOnRequest()
static const State ReconnectWait
SM_RESULT EnterPowerUpRearming()
static const State D3PoweringUp
static const State SystemResuming
SM_RESULT OnStartReading30(_In_ PortEvent Event)
SM_RESULT CheckConnection()
SM_RESULT OnDisablingSuperSpeed(_In_ PortEvent Event)
VOID DropHubResetReference()
SM_RESULT ReconnectCheck()
SM_RESULT OnDisablingOnResetTimeout(_In_ PortEvent Event)
static const State Transfer
static const State Deleted
static const State DisablingOnResetTimeout
SM_RESULT SystemResumeFailed()
BOOLEAN IsSuperSpeed() const
static const State OverCurrentWait
static const State ResetEnabledWait
static const State SuperSpeedOffWait
static const State SendingResume
static const State ReadingAfterResumeTimeout
SM_RESULT StartOverCurrentWait()
SM_RESULT OnSendingResume(_In_ PortEvent Event)
VOID TakePortPowerReference()
SM_RESULT OnStartReading20(_In_ PortEvent Event)
SM_RESULT OnPowerOnSettling(_In_ PortEvent Event)
SM_RESULT OnChangeReading20(_In_ PortEvent Event)
SM_RESULT OnDrainChecking(_In_ PortEvent Event)
static const State D3ResumeAckWait
static const State ReconnectFlush
SM_RESULT EnterSuspended()
SM_RESULT OnOffAttached(_In_ PortEvent Event)
SM_RESULT EnterSendingReset()
BOOLEAN m_AttachForcedReset
VOID TellDevice(_In_ PSM_DEVICE_NOTICE Notice)
SM_RESULT OnEnabled(_In_ PortEvent Event)
static const State Suspended
SM_RESULT OnResumePowering(_In_ PortEvent Event)
SM_RESULT OnDisablingForCycleTimed(_In_ PortEvent Event)
SM_RESULT D3PendingDone(_In_ D3_PENDING Pending)
static const State ResumePowering
SM_RESULT OnDisablingOnRequest(_In_ PortEvent Event)
SM_RESULT OnDisablingOnSuspendTimed(_In_ PortEvent Event)
SM_RESULT D3StopReconnectTimer(_In_ D3_PENDING Pending)
static const State ResumeWait
static const State StatusAcking
VOID CancelUserOverCurrentReset()
SM_RESULT ResetHubThen(_In_ const State *Target)
SM_RESULT EnterResumingAttached()
static const State OffInitial
SM_RESULT OnReconnectAcking(_In_ PortEvent Event)
static const State FlushBeforeSuperSpeedOff
static const State PowerOnSending
static const State ChangeReporting20
SM_RESULT OnResumeRereading(_In_ PortEvent Event)
SM_RESULT OnPowerUpParked(_In_ PortEvent Event)
SM_RESULT OnResumeAckWaitStopped(_In_ PortEvent Event)
SM_RESULT OnDisablingBeforeConnect(_In_ PortEvent Event)
SM_RESULT OnSuspendIdle(_In_ PortEvent Event)
SM_RESULT OnOffEmpty(_In_ PortEvent Event)
SM_RESULT EnterHubResetIssued()
@ OldDeviceResetInProgress
SM_RESULT OnStartingAttached(_In_ PortEvent Event)
static const State AttachedDisabled
VOID ReadPortBits(_Out_ PPSM_PORT_BITS Bits)
SM_RESULT EnterOffEmpty()
static const State FlushBeforeOffEmpty
SM_RESULT HandleConnectedFault(_In_ const State *Stay)
Handles a 2.0 port status that makes no sense for an attached port.
static const State WakeArming
static const State ResetFlush
SM_RESULT OnSuspendRecovery(_In_ PortEvent Event)
SM_RESULT EnterAckingChange()
SM_RESULT OnEmptyHubResetWait(_In_ PortEvent Event)
static const State StartReading20
static const State NotifyingOverCurrent
static const State ResetPollWait
SM_RESULT OnEmpty(_In_ PortEvent Event)
SM_RESULT CheckOldDevice(_In_ OLD_DEVICE_KIND Kind)
SM_RESULT OnDrainReading(_In_ PortEvent Event)
static const State OffSuspendedUsb3
SM_RESULT OnStartingEmpty(_In_ PortEvent Event)
static const State ChangeReading20
VOID NotifyBootDeviceRemoval()
SM_RESULT OnResetFlush(_In_ PortEvent Event)
SM_RESULT OnD3PoweredOff(_In_ PortEvent Event)
static const State PoweringPort
static const State StatusFailing
VOID MarkOverCurrentCause()
SM_RESULT EnterCleaningUp()
SM_RESULT OnDebouncing(_In_ PortEvent Event)
static const State SystemResumeReading
static const State SuspendedD3Cold
SM_RESULT ReattachOrCreate(_In_ OLD_DEVICE_KIND Kind)
static const State SuspendRecovery
static const State ResumeFlush
SM_RESULT EnterResetPollWait()
static const State PowerOnSettling
SM_RESULT EnterSuspendReporting()
SM_RESULT OnCleaningUp(_In_ PortEvent Event)
static const State SendingReset
static const State Debouncing
VOID DropPortPowerReference()
static const State SystemResumeRereading
SM_RESULT OnFlushBeforeOff(_In_ PortEvent Event)
static const State StartingAttached
SM_RESULT OnResetPollChecking(_In_ PortEvent Event)
static const State ResetWait
static const State DisablingOnSuspendTimed
VOID StartTimer(_In_ PSM_TIMER Timer)
SM_RESULT EnterPowerOnSettling()
static const State OldDeviceWait
SM_RESULT OnDisablingForCycle(_In_ PortEvent Event)
static const State ResumeReading
SM_RESULT OnD3PoweringUp(_In_ PortEvent Event)
SM_RESULT DeviceArrived(_In_ OLD_DEVICE_KIND Kind)
Drops requests the previous device left behind, then reattaches or creates a device.
static const State DrainAcking
SM_RESULT OnEnablingSuperSpeedOnStop(_In_ PortEvent Event)
SM_RESULT OnReadingAfterResumeTimeout(_In_ PortEvent Event)
SM_RESULT OnResumeAckWait(_In_ PortEvent Event)
SM_RESULT EnterResumeWait()
TIMER_FOLLOW_UP m_AfterTimer
static const State SsLinkDisabled
SM_RESULT OnReconnectReading(_In_ PortEvent Event)
SM_RESULT ResumeStateDisabled()
static const State DisablingBeforeConnect
SM_RESULT EnterDebouncing()
VOID ResumeInterruptTransfer()
SM_RESULT EnterDrainRearming()
SM_RESULT EnterDisconnected()
SM_RESULT ReturnFromFrame(_In_ PortEvent Event)
SM_RESULT OnSsLinkDisabled(_In_ PortEvent Event)
SM_RESULT OnTimed(_In_ PortEvent Event)
PortEvent ErrorResponse()
static const State D3Debouncing
static const State DebouncingUsb3
SM_RESULT OnEnablingSuperSpeedOnTimer(_In_ PortEvent Event)
SM_RESULT EnterStartingAttached()
SM_RESULT OnStartReadingFirst(_In_ PortEvent Event)
SM_RESULT ParkChange20(_In_ BOOLEAN ResetHub)
SM_RESULT OnResumeRecovery(_In_ PortEvent Event)
SM_RESULT ReconnectStatusFailed()
SM_RESULT OnD3ResumeAckWait(_In_ PortEvent Event)
static const State SuspendReading
SM_RESULT TimedError(_In_ const State *Stay, _In_ BOOLEAN DuringReset)
SM_RESULT ResetTransferFailed()
static const State DisablingSuperSpeedOnRequest
SM_RESULT OnSendingSuspend(_In_ PortEvent Event)
static const State SystemReconnectWait
SM_RESULT StopTimerThen(_In_ TIMER_FOLLOW_UP FollowUp)
SM_RESULT OnPowerOnSending(_In_ PortEvent Event)
SM_RESULT OnUserResetWait(_In_ PortEvent Event)
SM_RESULT OnResetWait(_In_ PortEvent Event)
SM_RESULT FollowTimer(_In_ TIMER_FOLLOW_UP FollowUp)
static const State ResetTimeoutStatus
BOOLEAN m_ReconnectFlushOnStop
SM_RESULT EnterSendingResume()
static const State HubResetIssued
static const State SendingWarmReset
SM_RESULT OnD3Debouncing(_In_ PortEvent Event)
SM_RESULT EnterSendingWarmReset()
static const SM_EVENT_INFO EventInfo[]
static const State ResumeRecovery
static const State D3ReconnectFlush
SM_RESULT OnChangeIdle30(_In_ PortEvent Event)
SM_RESULT D3StopDebounceTimer()
static const State ChangeParked20
SM_RESULT OnQueryingOverCurrent(_In_ PortEvent Event)
static const State ReadingForResume
static const State ReconnectReading
static const State SuspendReporting
static const State ChangeIdle20
SM_RESULT OnSuspendAcking(_In_ PortEvent Event)
SM_RESULT EnterStatusReading()
SM_RESULT OnResumingDisabled(_In_ PortEvent Event)
SM_RESULT EnterSystemResuming()
static const State ResetChangeIdle
static const State Disconnected
static const State OffSuspendedUsb2
BOOLEAN ConnectChangedOnResume()
static const State ResumeChangeChecking
static const State StatusReading
SM_RESULT OnSystemResuming(_In_ PortEvent Event)
static const State SettingLpmTimeout
VOID ForgetDetachedDevice()
SM_RESULT OnSystemResumeRereading(_In_ PortEvent Event)
SM_RESULT EnterStartResumeStatusRead()
SM_RESULT OnChangeParked20(_In_ PortEvent Event)
BOOLEAN m_DrainReturnsEmpty
static const State FlushBeforeOffAttached
static const State StartingEmpty
SM_RESULT OnChangeChecking30(_In_ PortEvent Event)
static const State DrainChecking
static const State ResumingDisabled
SM_RESULT OnResumeChangeChecking(_In_ PortEvent Event)
static const State DisablingOnRequest
Run to completion engine. The first thread to post into an idle machine drains the queue; everyone el...
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
static void Report(const char *msg)
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
struct _PSM_PORT_BITS * PPSM_PORT_BITS
struct _PSM_PORT_BITS PSM_PORT_BITS
enum _PSM_TIMER PSM_TIMER
@ ChangeOverCurrentCleared
@ DisableSuperSpeedRequest
@ PsmNoticeResumeTimedOut
@ PsmNoticeEnabledOnReconnect
@ PsmNoticeStateSuspended
@ PsmNoticeTimeoutUpdated
@ PsmTimerResumeCompletion
@ PsmTimerSuperSpeedDisable
@ PsmTimerD3ColdReconnect
@ PsmTimerResetCompletion
enum _PSM_DEVICE_NOTICE PSM_DEVICE_NOTICE
enum _PSM_PENDING PSM_PENDING
One state. Handler gets every event the state sees.
BOOLEAN OverCurrentChanged