75 "EventInfo must have one entry per HubEvent");
79#define HSM_REQ SM_STATE_TAKES_REQUESTS
80#define HSM_PASSIVE SM_STATE_NEEDS_PASSIVE
81#define HSM_CRIT SM_STATE_CRITICAL_ONLY
101 { &DromRead,
"DromReadingFirstStatus",
HSM_PASSIVE,
193 {
NULL,
"ReconfiguringAfterResume", 0,
206 { &Asleep,
"SuspendedResetPending", 0,
215 {
NULL,
"AwaitingDescriptorRetry", 0,
218 {
NULL,
"ReadingStandardStatus", 0,
221 {
NULL,
"ReadingConfigDescriptor", 0,
226 {
NULL,
"SettingConfiguration", 0,
229 {
NULL,
"FinishingConfiguration", 0,
236 {
NULL,
"ReadingRootHub20Ports", 0,
239 {
NULL,
"ReadingRootHub30Ports", 0,
298 if (
Event != HubEvent::DeviceAdded)
311 case HubEvent::PrepareHardware:
313 if (
m_Kind == HubKind::Root)
318 case HubEvent::DeviceCleanup:
339 case HubEvent::IoctlDone:
342 case HubEvent::IoctlFailed:
355 if (
m_Kind == HubKind::Root)
367 case HubEvent::CallSucceeded:
370 case HubEvent::CallFailed:
381 if (
m_Kind == HubKind::Root)
394 case HubEvent::CallSucceeded:
397 case HubEvent::CallFailed:
449 case HubEvent::PortStatusRequest:
453 case HubEvent::D0Entry:
457 case HubEvent::ReleaseHardware:
493 if (
Event == HubEvent::TransferFailed)
513 case HubEvent::TransferDone:
517 case HubEvent::TransferFailed:
540 if (
Event == HubEvent::TransferDone)
557 if (
Event != HubEvent::TransferDone)
575 if (
Event == HubEvent::TransferDone)
632 if (
Event == HubEvent::TransferDone)
679 case HubEvent::PortStatusRequest:
683 case HubEvent::ResetRequested:
697 case HubEvent::PrepareHardware:
700 case HubEvent::DeviceCleanup:
712 if (
Event != HubEvent::ReleaseHardware)
723 if (
Event != HubEvent::ReleaseHardware)
737 case HubEvent::D0Exit:
742 case HubEvent::D0ExitFinal:
757 if (
Event == HubEvent::DeviceCleanup)
798 if (
Event != HubEvent::PortsAcquired)
832 if (
Event != HubEvent::DevicesAcquired)
864 case HubEvent::ResetRequested:
868 case HubEvent::D0Exit:
871 case HubEvent::D0ExitFinal:
874 case HubEvent::InterruptDone:
881 case HubCheck::Error:
889 case HubEvent::InterruptFailed:
897 case HubEvent::PortStatusRequest:
912 case HubEvent::ResetRequested:
916 case HubEvent::D0Exit:
921 case HubEvent::D0ExitFinal:
926 case HubEvent::PortsEnableInterrupt:
929 case HubEvent::PortStatusRequest:
952 case HubEvent::TransferDone:
956 case HubEvent::TransferFailed:
992 case HubEvent::TransferDone:
1010 case HubCheck::Error:
1017 case HubEvent::TransferFailed:
1034 case HubEvent::TransferDone:
1037 case HubEvent::TransferFailed:
1055 case HubChange::OverCurrent:
1059 case HubChange::OverCurrentCleared:
1062 case HubChange::Error:
1092 if (
Event == HubEvent::TimerFired)
1104 case HubEvent::PipeResetDone:
1107 case HubEvent::PipeResetFailed:
1177 case HubEvent::InterruptDone:
1178 case HubEvent::InterruptFailed:
1181 case HubEvent::PortsInterruptReleased:
1194 if ((
Event == HubEvent::InterruptDone) || (
Event == HubEvent::InterruptFailed))
1204 if (
Event == HubEvent::PortsInterruptReleased)
1214 if (
Event == HubEvent::PortsEnableInterrupt)
1224 if (
Event != HubEvent::DevicesReleased)
1246 if (
Event != HubEvent::PortsReleased)
1268 if (
Event != HubEvent::PortsResetReleased)
1330 case HubEvent::ResetDone:
1333 case HubEvent::ResetFailed:
1336 case HubEvent::ResetFailedOnRemoval:
1360 case HubEvent::TimerFired:
1366 case HubEvent::PortStatusRequest:
1370 case HubEvent::ResetRequested:
1382 if (
m_Kind == HubKind::Usb30)
1401 case HubEvent::CallSucceeded:
1404 case HubEvent::CallFailed:
1418 case HubEvent::ResetDone:
1421 case HubEvent::ResetFailed:
1422 case HubEvent::ResetFailedOnRemoval:
1451 case HubEvent::CallSucceeded:
1454 case HubEvent::CallFailed:
1466 if (
m_Kind == HubKind::Root)
1479 case HubEvent::TransferDone:
1482 case HubEvent::TransferFailed:
1498 case HubEvent::PortStatusRequest:
1502 case HubEvent::ResetRequested:
1505 case HubEvent::ReleaseHardware:
1520 case HubEvent::ResetRequested:
1523 case HubEvent::PortStatusRequest:
1527 case HubEvent::D0Entry:
1531 case HubEvent::D0EntryFromSx:
1547 if ((
Event != HubEvent::D0Entry) && (
Event != HubEvent::D0EntryFromSx))
1567 if ((
Event != HubEvent::D0Entry) && (
Event != HubEvent::D0EntryFromSx))
1578 if (
Event == HubEvent::DevicesStoppedAfterSuspend)
1599 case HubEvent::TransferDone:
1601 return SmReturn(HubEvent::CallFailed);
1605 case HubEvent::TransferFailed:
1607 return SmReturn(HubEvent::CallFailed);
1627 if (
Event == HubEvent::TimerFired)
1646 case HubEvent::TransferDone:
1648 return SmReturn(HubEvent::CallFailed);
1653 case HubEvent::TransferFailed:
1654 return SmReturn(HubEvent::CallFailed);
1675 case HubEvent::TransferDone:
1683 return SmReturn(HubEvent::CallFailed);
1687 case HubEvent::TransferFailed:
1688 return SmReturn(HubEvent::CallFailed);
1708 case HubEvent::IoctlDone:
1711 case HubEvent::IoctlFailed:
1712 return SmReturn(HubEvent::CallFailed);
1732 case HubEvent::ConfigurationSet:
1733 if (
m_Kind == HubKind::Usb30)
1736 return SmReturn(HubEvent::CallSucceeded);
1738 case HubEvent::ConfigurationFailed:
1739 return SmReturn(HubEvent::CallFailed);
1756 if ((
Event == HubEvent::CallSucceeded) || (
Event == HubEvent::CallFailed))
1778 case HubEvent::IoctlDone:
1781 case HubEvent::IoctlFailed:
1782 return SmReturn(HubEvent::CallFailed);
1802 case HubEvent::IoctlDone:
1805 case HubEvent::IoctlFailed:
1806 return SmReturn(HubEvent::CallFailed);
1826 case HubEvent::IoctlDone:
1827 return SmReturn(HubEvent::CallSucceeded);
1829 case HubEvent::IoctlFailed:
1830 return SmReturn(HubEvent::CallFailed);
1852 case HubEvent::TransferDone:
1853 return SmReturn(HubEvent::CallSucceeded);
1855 case HubEvent::TransferFailed:
1856 return SmReturn(HubEvent::CallFailed);
SM_RESULT OnAckingHubChange(_In_ HubEvent Event)
VOID Initialize(_In_ HubFdo *Hub, _In_ HubKind Kind)
static const State ReadingConfigDescriptor
static const State Listening
SM_RESULT SendInterrupt(_In_ BOOLEAN ClearPipeResets)
SM_RESULT EnterSettingConfiguration()
SM_RESULT OnAwaitingOverCurrentTimer(_In_ HubEvent Event)
static const State AwaitingReleaseAfterFailure
static const State Deleted
SM_RESULT OnAsleep(_In_ HubEvent Event)
VOID QueueSuspendToDevices()
VOID QueueResumeInS0ToDevices()
const State * m_PortStatusReturn
VOID ReleasePowerReference()
SM_RESULT EnterReconfiguring()
VOID ArmResetRetryTimer()
SM_RESULT EnterReadingHubDescriptor()
SM_RESULT OnAwaitingAddDevice(_In_ HubEvent Event)
SM_RESULT StoreDromWordAndContinue()
SM_RESULT OnAwaitingReleaseHardware(_In_ HubEvent Event)
SM_RESULT ResumeResetFailed()
SM_RESULT EnterFinishingConfiguration()
BOOLEAN PortInterruptRefsReleased()
VOID QueueResumeToDevices()
VOID UpdateControllerHubInfo()
VOID ReadDromRegister(_In_ USHORT Register)
VOID ClearPipeResetCount()
SM_RESULT OnResettingPipe(_In_ HubEvent Event)
HubChange LostHubChange()
SM_RESULT EnterReadingStandardStatus()
VOID InitializeResetCount()
BOOLEAN WasResetByParent()
SM_RESULT OnReconfiguring(_In_ HubEvent Event)
VOID InitializeDescriptorRetries()
BOOLEAN RecoveryLimitReached()
static const State ResettingOnResume
SM_RESULT EnterReconfiguringAfterResume()
SM_RESULT OnReadingStandardStatus(_In_ HubEvent Event)
BOOLEAN IsDromReadWanted()
static const State LoggingReset
VOID ParseDromIdentity()
Finds the router identity entry of a version 1 DROM, bounds checking each entry.
SM_RESULT HandleHubStatusFault()
static const State PortsResetting
SM_RESULT EnterReconfiguringAfterReset()
SM_RESULT OnUpdatingController(_In_ HubEvent Event)
static const State DromRead
SM_RESULT OnSurpriseRemoved(_In_ HubEvent Event)
VOID QueueSurpriseRemovalToPorts()
static const State ProgrammingHubDepth
static const State AwaitingStop
static const State AwaitingInterruptRefs
VOID QueueFakeStatusChangeToPorts()
static const State ReadingRootHub20Ports
SM_RESULT QuiesceWithoutInterrupt(_In_ Teardown Reason)
SM_RESULT OnAwaitingDescriptorRetry(_In_ HubEvent Event)
SM_RESULT OnReconfiguringAfterResume(_In_ HubEvent Event)
BOOLEAN CacheConfigDescriptor()
static const State HubResetting
SM_RESULT EnterConfiguring()
SM_RESULT OnDromSendingCommand(_In_ HubEvent Event)
VOID StartStatusChangeRead()
VOID QueryControllerInfo()
static const State CancelingInterrupt
SM_RESULT EnterReportingFailure()
SM_RESULT CheckDromStatus()
SM_RESULT EnterUpdatingController()
VOID SelectHubConfiguration()
SM_RESULT EnterDromReadingFirstStatus()
SM_RESULT OnStopped(_In_ HubEvent Event)
static const State NotListening
VOID StartDescriptorRetryTimer()
SM_RESULT EnterReadingRootHubInfo()
static const State DromReadingFirstStatus
SM_RESULT HandleHubChange(_In_ HubChange Change)
None comes only from the lost change query, Error only from the pending one.
VOID AcquirePowerReference()
static const State DrainingInterruptRefs
SM_RESULT StartDromOrSkip(_In_ const State *Next)
Reads the router DROM through the vendor mailbox; no failure here fails the start.
static const State QueryingParentInfo
VOID UseDromHeaderBuffer()
static const State Halted
SM_RESULT EnterLoggingReset()
SM_RESULT EnterDromReadingWord()
SM_RESULT OnSuspendedResetPending(_In_ HubEvent Event)
VOID QueueSuspendToPorts()
VOID QueueStatusChangeToPorts()
SM_RESULT OnReadingHubStatus(_In_ HubEvent Event)
SM_RESULT OnConfiguring(_In_ HubEvent Event)
SM_RESULT OnAwaitingReleaseAfterFailure(_In_ HubEvent Event)
BOOLEAN m_ReleaseToUnconfigured
static const State AwaitingAddDevice
static const State AckingHubChange
static const State CheckingRecoveryLimit
SM_RESULT EnterDromReadingStatus()
SM_RESULT EnterAwaitingDescriptorRetry()
SM_RESULT OnReconfiguringAfterReset(_In_ HubEvent Event)
SM_RESULT StartDromWords()
The DWORD count is rounded up from the total size, not from the length field.
static const State DromWritingMetadata
static const State PortsReleasing
SM_RESULT EnterQueryingParentInfo()
static const State Configuring
static const State DromSendingCommand
static const State QueryingErrata
SM_RESULT OnResettingOnResume(_In_ HubEvent Event)
SM_RESULT OnAwaitingInterruptRefs(_In_ HubEvent Event)
SM_RESULT CallHubDepthOr(_In_ PowerUp Kind)
SM_RESULT OnProgrammingHubDepth(_In_ HubEvent Event)
SM_RESULT OnNotListening(_In_ HubEvent Event)
SM_RESULT ReadStatus(_In_ StatusRead Purpose)
VOID GetConfigDescriptor(_In_ BOOLEAN FullLength)
static const State Stopped
static const State Unconfigured
BOOLEAN ConfigDescriptorTruncated()
SM_RESULT OnDevicesReleasing(_In_ HubEvent Event)
SM_RESULT OnReadingConfigDescriptor(_In_ HubEvent Event)
SM_RESULT OnReadingRootHubInfo(_In_ HubEvent Event)
BOOLEAN DescriptorRetriesExhausted()
SM_RESULT OnCancelingInterrupt(_In_ HubEvent Event)
static const State ReadingRootHubInfo
static const State ReadingStandardStatus
static const State DromReadingStatus
SM_RESULT OnReadingRootHub20Ports(_In_ HubEvent Event)
static const State Reconfiguring
SM_RESULT OnReadingPortStatus(_In_ HubEvent Event)
VOID QueueStopToDevices()
static const State ResettingPipe
SM_RESULT OnReadingHubDescriptor(_In_ HubEvent Event)
static const State AwaitingStopAfterSuspend
SM_RESULT EnterReadingConfigDescriptor()
static const State RecycleSuspended
static const State SettingConfiguration
HubCheck CheckHubChangeBit()
static const State Suspended
SM_RESULT QuiesceWithInterrupt(_In_ Teardown Reason)
SM_RESULT OnAwaitingStopAfterSuspend(_In_ HubEvent Event)
SM_RESULT OnDown(_In_ HubEvent Event)
SM_RESULT EnterCheckingRecoveryLimit()
VOID QueueStartToDevices()
VOID ResetStatusChangePipe()
SM_RESULT StartPowerUp(_In_ PowerUp Kind)
SM_RESULT OnQueryingParentInfo(_In_ HubEvent Event)
SM_RESULT OnUnconfigured(_In_ HubEvent Event)
SM_RESULT OnAwaitingResetRetry(_In_ HubEvent Event)
static const State ReadingRootHub30Ports
VOID CancelStatusChangeRead()
HubCheck SelectHubChange()
BOOLEAN OverCurrentCleared()
static const SM_EVENT_INFO EventInfo[]
VOID QueueResumeWithResetToDevices()
static const State CheckingPowerLoss
SM_RESULT OnPortsAcquiring(_In_ HubEvent Event)
static const State PortsAcquiring
SM_RESULT OnPortsReleasing(_In_ HubEvent Event)
ULONGLONG m_DromPollStart
BOOLEAN ParseHubDescriptor()
SM_RESULT OnSettingConfiguration(_In_ HubEvent Event)
SM_RESULT FailStart(_In_ BOOLEAN FirstStart)
A failed first start returns to Unconfigured, a failed restart to Stopped.
static const State SuspendedResetPending
SM_RESULT ReadPortStatus(_In_ const State *ReturnTo)
SM_RESULT EnterDromSendingCommand()
static const State ReadingPortStatus
VOID QueueResumeToPorts()
SM_RESULT OnDrainingInterruptRefs(_In_ HubEvent Event)
SM_RESULT OnDevicesAcquiring(_In_ HubEvent Event)
VOID FailPortStatus(_In_ BOOLEAN HardwareError)
SM_RESULT OnDromRead(_In_ HubEvent Event)
SM_RESULT EnterQueryingErrata()
SM_RESULT EnterSuspendedResetPending()
SM_RESULT EnterDromWritingMetadata()
SM_RESULT EnterReadingRootHub20Ports()
SM_RESULT OnHubResetting(_In_ HubEvent Event)
VOID QueueStopAfterSuspendToDevices()
SM_RESULT CheckPowerLoss()
static const State ReconfiguringAfterResume
static const State UpdatingController
VOID ReportFailureToPnp()
static const State FinishingConfiguration
BOOLEAN ParsePowerStatus()
SM_RESULT OnListening(_In_ HubEvent Event)
SM_RESULT EnterHubResetting()
SM_RESULT EnterProgrammingHubDepth()
SM_RESULT OnDromWritingMetadata(_In_ HubEvent Event)
static const State SurpriseRemoved
static const State ReconfiguringAfterReset
BOOLEAN PipeResetLimitReached()
SM_RESULT OnAwaitingStop(_In_ HubEvent Event)
BOOLEAN CreateChildPorts()
static const State Asleep
static const State AwaitingResetRetry
SM_RESULT OnCheckingPowerLoss(_In_ HubEvent Event)
static const State DromReadingWord
static const State DevicesAcquiring
static const State AwaitingReleaseHardware
SM_RESULT EnterSignalPnp()
HubChange PendingHubChange()
SM_RESULT OnFinishingConfiguration(_In_ HubEvent Event)
SM_RESULT OnDromReadingWord(_In_ HubEvent Event)
static const State ReportingFailure
SM_RESULT EnterReadingRootHub30Ports()
SM_RESULT OnAwaitingD0(_In_ HubEvent Event)
SM_RESULT OverCurrentError()
SM_RESULT OnRecycleSuspended(_In_ HubEvent Event)
static const State AwaitingD0
static const State DevicesReleasing
SM_RESULT StartHubConfiguration()
SM_RESULT OnAwaitingInterruptEnable(_In_ HubEvent Event)
static const State ReadingHubDescriptor
SM_RESULT OnSuspended(_In_ HubEvent Event)
BOOLEAN ResetLimitReached()
VOID ArmOverCurrentTimer()
static const State AwaitingDescriptorRetry
VOID QueueResumeInS0ToPorts()
static const State AwaitingInterruptEnable
SM_RESULT OnDromReadingStatus(_In_ HubEvent Event)
static const State AwaitingOverCurrentTimer
static const State ReadingHubStatus
SM_RESULT AfterInterruptQuiet()
VOID StoreDromWord(_In_ ULONG Index)
SM_RESULT OnDromReadingFirstStatus(_In_ HubEvent Event)
VOID WriteDromRegister(_In_ USHORT Register, _In_ ULONG Value)
static const HubEvent ResetDiscards[]
VOID QueueResumeWithResetToPorts()
BOOLEAN AllocateDromBuffer(_In_ ULONG Length)
SM_RESULT OnPortsResetting(_In_ HubEvent Event)
SM_RESULT OnReadingRootHub30Ports(_In_ HubEvent Event)
VOID SmInitialize(_In_ const State *Initial)
static SM_RESULT SmTransition(_In_ const State *Target)
static SM_RESULT SmReturn(_In_ HubEvent Ev)
static SM_RESULT SmCall(_In_ const State *Start)
static SM_RESULT SmHandled()
static SM_RESULT SmUnhandled()
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG DataLength
static const USHORT HubMailboxMetadata
static const ULONG HubDromReadCommand
static const ULONG HubMailboxDataWords
static const ULONGLONG HubDromBusyLimit
static const ULONG HubDromHeaderWords
static const ULONG HubDromMinimumLength
static const ULONG HubMailboxBusy
static const USHORT HubMailboxOpcode
static const ULONG HubDromLengthBias
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
#define KeQueryInterruptTime()
PACPI_METHOD_ARGUMENT Next
One state. Handler gets every event the state sees.
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes