14#define HUB_PROTOCOL_USB20 0x200
15#define HUB_PROTOCOL_USB30 0x300
41HubConnectorUnlock(
VOID)
58 First->TypeCConnectorId !=
Second->TypeCConnectorId ||
130 DPRINT1(
"Port %u: connector already has a USB 2 port (platform compliance)\n",
Port->Number());
136 DPRINT1(
"Port %u: Type-C USB 2 port paired with a different USB 3 connector type (platform compliance)\n",
142 Port->m_InstancePortNumber =
Port->Number();
163 DPRINT1(
"Port %u: Type-C USB 3 port paired with a different USB 2 connector type (platform compliance)\n",
169 Port->m_InstancePortNumber =
Port->Number();
179 DPRINT1(
"Port %u: connector has no room for another USB 3 port (platform compliance)\n",
Port->Number());
183 Shared =
min(
Port->Number(),
Node->Usb30->Number());
184 Port->m_InstancePortNumber = Shared;
185 Node->Usb30->m_InstancePortNumber = Shared;
194HubConnectorRegisterPort(
207 DPRINT1(
"Port %u: connector node could not be allocated\n",
Port->Number());
215 switch (
Port->m_Info.Protocol)
226 DPRINT1(
"Port %u has unknown protocol 0x%x\n",
Port->Number(),
Port->m_Info.Protocol);
241HubConnectorUnregisterPort(
255 DPRINT1(
"Port %u: registered port has no connector\n",
Port->Number());
303 DPRINT1(
"Port %u: registered port has no connector\n",
Port->Number());
308 if (!
Port->IsUsb30())
330 HubConnectorUnlock();
349 Port->m_ConnectorId.Path[0] = Usb30Port;
372HubConnectorMapAcpiPorts(
386 Id = &
Port->m_ConnectorId;
390 Id->TypeCConnectorId = ((
ULONG64)
Port->m_AcpiPld.GroupToken << 8) |
Port->m_AcpiPld.GroupPosition;
405HubConnectorMapRootPorts(
415 Port20 <= Hub->m_Last20Port && Port30 <= Hub->m_Last30Port;
426 DPRINT1(
"Hub %p: integrated hub on port %lu is not the last USB 2 port (platform compliance)\n",
462 DPRINT1(
"Hub %p: no USB 3 partner %lu for port %lu (platform compliance)\n",
Hub, Port30, Port20);
468 DPRINT1(
"Hub %p: USB 3 port %lu is fixed but its partner is not (platform compliance)\n",
Hub, Port30);
480HubConnectorMapIntegratedHubPorts(
488 Number <= Hub->m_PortCount && Port30 <= Hub->m_Parent.LastCompanionPort;
496 Port->m_ConnectorId.Path[0] = Port30;
511HubConnectorMapExternalHubPorts(
524 Id = &
Port->m_ConnectorId;
530 DPRINT1(
"Hub %p is nested too deep for the connector map\n",
Hub);
545HubConnectorUnmapPorts(
557 HubConnectorUnregisterPort(
Port);
564 HubConnectorUnregisterPort(
Port);
584 DPRINT(
"Hub %p connectors mapped from ACPI\n",
Hub);
588 DPRINT1(
"Hub %p: ACPI connector map failed 0x%lx, using the topology (platform compliance)\n",
590 HubConnectorUnmapPorts(
Hub);
595 HubConnectorMapRootPorts(
Hub);
597 HubConnectorMapIntegratedHubPorts(
Hub);
599 HubConnectorMapExternalHubPorts(
Hub);
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
VOID ClearFlag(_In_ HubFlag Flag)
BOOLEAN HasFlag(_In_ HubFlag Flag) const
UCXHUB_PARENT_INTERFACE m_Parent
BOOLEAN IsRootHub() const
HubPort * FindPort(_In_ ULONG PortNumber)
#define NT_SUCCESS(StatCode)
#define _IRQL_requires_(irql)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
FORCEINLINE VOID NTAPI HubClearPortProperty(_In_ HubPort *Port, _In_ PortProperty Property)
FORCEINLINE VOID NTAPI HubSetPortProperty(_In_ HubPort *Port, _In_ PortProperty Property)
#define HUB_CONNECTOR_ROOT
#define HUB_CONNECTOR_MAX_PATH
#define HUB_CONNECTOR_ACPI
#define RtlEqualMemory(dst, src, len)
#define ExFreePoolWithTag(_P, _T)
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
#define HUB_PROTOCOL_USB30
static NTSTATUS NTAPI HubConnectorAddUsb30(_Inout_ HubConnectorNode *Node, _In_ HubPort *Port)
static VOID NTAPI HubConnectorSetRootId(_In_ HubFdo *Hub, _Inout_ HubPort *Port, _In_ ULONG Usb30Port)
static NTSTATUS NTAPI HubConnectorAddUsb20(_Inout_ HubConnectorNode *Node, _In_ HubPort *Port)
static VOID NTAPI HubConnectorCopyParentId(_In_ HubFdo *Hub, _Out_ HubConnectorId *Id)
static HubConnectorNode *NTAPI HubConnectorFindById(_In_ const HubConnectorId *Id)
static HubConnectorNode *NTAPI HubConnectorFindByPort(_In_ HubPort *Port)
#define HUB_PROTOCOL_USB20
PVOID NTAPI HubConnectorNodeForPort(_In_ HubPort *Port)
HubPort *NTAPI HubConnectorFindCompanion(_In_ HubPort *Port, _In_ ULONG Index)
static BOOLEAN NTAPI HubConnectorIdsEqual(_In_ const HubConnectorId *First, _In_ const HubConnectorId *Second)
WDFWAITLOCK CompanionPortLock
struct _LIST_ENTRY * Flink
USHORT FirstCompanionPort
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ FORCEINLINE NTSTATUS WdfWaitLockAcquire(_In_ _Requires_lock_not_held_(_Curr_) WDFWAITLOCK Lock, _In_opt_ PLONGLONG Timeout)