75 DPRINT(
"Hub %p created port %u (%p), protocol 0x%x\n",
110HubFdo::CreateChildPorts()
138 Info.Properties = (
ULONG)PortProperty::Removable;
139 Info.Protocol = 0x200;
147 Info.Properties &= ~(
ULONG)PortProperty::Removable;
149 Info.Properties |= (
ULONG)PortProperty::IntegratedHub;
150 if (
Root->ControllerUsb20HardwareLpmFlags.Flags.L1CapabilitySupported)
151 Info.Properties |= (
ULONG)PortProperty::Usb20LpmCapable;
152 if (
Root->ControllerUsb20HardwareLpmFlags.Flags.BeslLpmCapabilitySupported)
153 Info.Properties |= (
ULONG)PortProperty::BeslCapable;
160 Info.Properties &= ~(
ULONG)PortProperty::Removable;
175 Info.Properties = (
ULONG)PortProperty::Removable;
176 Info.Protocol = 0x300;
182 Info.PortNumber =
Root->Info.PortNumber;
184 Info.Properties &= ~(
ULONG)PortProperty::Removable;
186 Info.Properties |= (
ULONG)PortProperty::DebugCapable;
187 Info.Properties |= (
ULONG)PortProperty::EnhancedSuperSpeed;
188 if (
Root->Info.MinorRevision != 0)
190 Info.SublinkSpeedAttr =
Root->Speeds;
191 Info.SublinkSpeedAttrCount =
Root->SpeedsCount;
198 Info.Properties &= ~(
ULONG)PortProperty::Removable;
201 Info.Properties |= (
ULONG)PortProperty::EnhancedSuperSpeed;
284 Post(HubEvent::PortsAcquired);
293 Port->SetMuxFlag(PortMuxFlag::PnpOperationPending);
308 Post(HubEvent::PortsReleased);
318 if (
Port->HasMuxFlag(PortMuxFlag::PowerReference))
319 Port->SetMuxFlag(PortMuxFlag::PnpOperationPending);
320 Port->Post(PortEvent::HubStopping);
323 if (NothingToWaitFor)
324 Post(HubEvent::PortsReleased);
336 Post(HubEvent::PortsReleased);
345 Port->SetMuxFlag(PortMuxFlag::PnpOperationPending);
346 Port->Post(PortEvent::HubSuspending);
367 DPRINT1(
"Hub %p reset fan out with no ports will not finish\n",
m_Device);
375 Port->SetMuxFlag(PortMuxFlag::ResetPending);
376 Port->Post(PortEvent::HubResetting);
396 Post(HubEvent::PortsEnableInterrupt);
411 Port->SetMuxFlag(PortMuxFlag::PortChangePending);
412 Port->Post(PortEvent::StatusChanged);
419 Post(HubEvent::PortsEnableInterrupt);
431 DPRINT1(
"Hub %p status recheck with no ports will not finish\n",
m_Device);
438 Port->SetMuxFlag(PortMuxFlag::PortChangePending);
439 Port->Post(PortEvent::StatusChanged);
464 Post(HubEvent::ResetRequested);
493 Port->SetMuxFlag(PortMuxFlag::InterruptReference);
507 if (!
Port->HasMuxFlag(PortMuxFlag::InterruptReference))
508 DPRINT1(
"Port %u dropped an interrupt reference it did not hold\n",
Port->Number());
509 NT_ASSERT(
Port->HasMuxFlag(PortMuxFlag::InterruptReference));
510 Port->ClearMuxFlag(PortMuxFlag::InterruptReference);
513 DPRINT1(
"Hub %p interrupt references released too many times\n",
m_Device);
526 Post(HubEvent::PortsInterruptReleased);
535 Port->ClearMuxFlag(PortMuxFlag::PnpOperationPending);
536 Port->SetMuxFlag(PortMuxFlag::PowerReference);
540 Post(HubEvent::PortsAcquired);
547 Port->ClearMuxFlag(PortMuxFlag::PnpOperationPending);
548 Port->ClearMuxFlag(PortMuxFlag::PowerReference);
552 Post(HubEvent::PortsReleased);
555 if (
Port->HasFlag(PortFlag::PendingHubPowerReference))
558 Port->ClearFlag(PortFlag::PendingHubPowerReference);
566 Port->ClearMuxFlag(PortMuxFlag::ResetPending);
569 Post(HubEvent::PortsResetReleased);
576 Port->ClearMuxFlag(PortMuxFlag::PortChangePending);
579 Post(HubEvent::PortsEnableInterrupt);
598 Child->m_MuxFlags |= (
ULONG)ChildMuxFlag::PowerReference;
617 case HubDeviceFanOut::PowerUp:
618 Post(HubEvent::DevicesAcquired);
621 case HubDeviceFanOut::PowerDown:
622 Post(HubEvent::DevicesReleased);
625 case HubDeviceFanOut::StopWhileSuspended:
626 Post(HubEvent::DevicesStoppedAfterSuspend);
643 Child->ClearState(ChildState::ActivityIdSet);
648 if (
Child->m_MuxFlags & (
ULONG)ChildMuxFlag::PowerReference)
651 Child->m_MuxFlags &= ~(
ULONG)ChildMuxFlag::PowerReference;
654 if (
Child->m_MuxFlags & (
ULONG)ChildMuxFlag::PnpOperationPending)
656 Child->m_MuxFlags &= ~(
ULONG)ChildMuxFlag::PnpOperationPending;
697 if (FanOut == HubDeviceFanOut::StopWhileSuspended ||
698 (
Child->m_MuxFlags & (
ULONG)ChildMuxFlag::PowerReference))
700 Child->m_MuxFlags |= (
ULONG)ChildMuxFlag::PnpOperationPending;
724 if (!Any || Counted == 0)
726 Post(FanOut == HubDeviceFanOut::StopWhileSuspended ? HubEvent::DevicesStoppedAfterSuspend
727 : HubEvent::DevicesReleased);
749 if (!(
Child->m_MuxFlags & (
ULONG)ChildMuxFlag::Stopped))
752 Child->m_MuxFlags &= ~(
ULONG)ChildMuxFlag::Stopped;
753 Child->m_MuxFlags |= (
ULONG)ChildMuxFlag::PnpOperationPending;
760 m_Mux.
DeviceFanOut = (Counted != 0) ? HubDeviceFanOut::PowerUp : HubDeviceFanOut::None;
765 Post(HubEvent::DevicesAcquired);
791 Child->m_MuxFlags &= ~((
ULONG)ChildMuxFlag::PnpOperationPending | (
ULONG)ChildMuxFlag::Stopped);
792 Child->m_MuxFlags |= (
ULONG)ChildMuxFlag::PowerReference;
810 Child->m_MuxFlags &= ~((
ULONG)ChildMuxFlag::PnpOperationPending | (
ULONG)ChildMuxFlag::PowerReference);
811 Child->m_MuxFlags |= (
ULONG)ChildMuxFlag::Stopped;
829 Child->m_MuxFlags &= ~(
ULONG)ChildMuxFlag::PnpOperationPending;
830 Child->m_MuxFlags |= (
ULONG)ChildMuxFlag::Stopped;
855 return m_Hub->CreateChildPorts();
#define ALIGN_UP_BY(size, align)
#define InterlockedIncrement
#define InterlockedExchange
#define InterlockedDecrement
VOID ConfirmStopWhileSuspended()
VOID ReferenceDevicePower()
VOID DereferenceDevicePower()
BOOLEAN RegisterWithHub()
VOID QueuePowerUpToDevices(_In_ DsmEvent Event)
BOOLEAN RegisterDevice(_In_ HubChild *Child)
VOID DereferenceDevicePower(_In_ HubChild *Child)
VOID FinishDeviceFanOut()
VOID DropHubResetReference(_In_ HubPort *Port)
VOID PostToAllPorts(_In_ PortEvent Event)
VOID DropPortPowerReference(_In_ HubPort *Port)
PROOTHUB_30PORT_INFO_EX * m_Root30Ports
VOID QueueSurpriseRemovalToPorts()
UCXHUB_ROOTHUB_INFO m_RootHubInfo
VOID QueuePowerUpToPorts(_In_ PortEvent Event)
PROOTHUB_20PORT_INFO * m_Root20Ports
VOID QueueSuspendToPorts()
BOOLEAN PortInterruptRefsReleased()
VOID Post(_In_ HubEvent Event)
HubInterruptRequest m_Interrupt
VOID QueueStatusChangeToPorts()
BOOLEAN HasFlag(_In_ HubFlag Flag) const
BOOLEAN RequestHubReset()
VOID UnregisterDevice(_In_ HubChild *Child)
VOID QueueFakeStatusChangeToPorts()
VOID ConfirmStopWhileSuspended(_In_ HubChild *Child)
USHORT m_InterruptMaxPacket
HubParentInfo m_ParentInfo
VOID ResumeInterruptTransfer(_In_ HubPort *Port)
UCXHUB_PARENT_INTERFACE m_Parent
BOOLEAN IsRootHub() const
union HubFdo::@1628 m_HubDescriptor
ULONG m_SspIsochBurstCount
VOID ReferenceDevicePower(_In_ HubChild *Child)
VOID QueuePowerDownToDevices(_In_ DsmEvent Event, _In_ HubDeviceFanOut FanOut)
HubPort * FindPort(_In_ ULONG PortNumber)
VOID TakePortPowerReference(_In_ HubPort *Port)
VOID MarkDevicesProgrammingLost()
BOOLEAN TakeInterruptReference(_In_ HubPort *Port)
VOID DropInterruptReference(_In_ HubPort *Port)
VOID QueueSuspendToDevices()
VOID QueueResumeInS0ToDevices()
BOOLEAN PortInterruptRefsReleased()
VOID QueueResumeToDevices()
VOID QueueSurpriseRemovalToPorts()
VOID QueueFakeStatusChangeToPorts()
VOID QueueSuspendToPorts()
VOID QueueStatusChangeToPorts()
VOID QueueStopToDevices()
VOID QueueStartToDevices()
VOID QueueResumeWithResetToDevices()
VOID QueueResumeToPorts()
VOID QueueStopAfterSuspendToDevices()
BOOLEAN CreateChildPorts()
VOID QueueResumeInS0ToPorts()
VOID QueueResumeWithResetToPorts()
VOID DropInterruptReference()
BOOLEAN HubArmedForWake()
BOOLEAN TakeInterruptReference()
VOID DropHubResetReference()
VOID TakePortPowerReference()
VOID DropPortPowerReference()
VOID ResumeInterruptTransfer()
#define RtlNumberOfSetBits
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
#define NT_SUCCESS(StatCode)
#define _IRQL_requires_(irql)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define KeInitializeSpinLock(sl)
static const char HubTagPnpPower[]
static ULONG NTAPI HubClampTierDepth(_In_ ULONG Depth)
static const char HubTagRegistration[]
static BOOLEAN NTAPI HubDescriptorSaysFixed(_In_ const UCHAR *Bitmap, _In_ ULONG PortNumber)
static VOID NTAPI HubTrackPortRange(_In_ USHORT PortNumber, _Inout_ PUSHORT First, _Inout_ PUSHORT Last)
static BOOLEAN NTAPI HubAddPort(_In_ HubFdo *Hub, _In_ const HubPortInfo *Info)
FORCEINLINE VOID NTAPI HubClearListEntry(_Out_ PLIST_ENTRY Entry)
#define InterlockedExchangeAdd
BOOLEAN LastInterruptWasEmpty
volatile LONG OutstandingPnpOperations
BOOLEAN FailDeviceRegistration
volatile LONG PortPowerReferences
LONG DevicePowerReferences
BOOLEAN FailInterruptAcquire
volatile LONG OutstandingResetOperations
volatile LONG OutstandingPortChanges
BOOLEAN InterruptReleasePending
HubDeviceFanOut DeviceFanOut
volatile LONG HubResetInProgress
PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED SublinkSpeedAttr
ULONG SublinkSpeedAttrCount
struct _LIST_ENTRY * Flink
BOOLEAN IsEnhancedSuperSpeed
USB_DEVICE_SPEED HubSpeed
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
#define WdfDeviceResumeIdle(Device)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
#define WdfObjectDereferenceWithTag(Handle, Tag)
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
#define WdfObjectReferenceWithTag(Handle, Tag)