15 L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\usbflags";
17 L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\usb\\HardwareVerifier";
19 L"\\registry\\machine\\system\\currentcontrolset\\services\\usbhub\\uxd_control\\devices";
21 L"\\registry\\machine\\system\\currentcontrolset\\services\\usbhub\\uxd_control\\pnp";
23 L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Usb\\Ceip";
25 L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\USB";
27 L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\USBFN";
29 L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\USBFN\\Default";
31 L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\USBFN\\Configurations\\";
37#define HUB_D3COLD_RECONNECT_DEFAULT 1000
40#define KSE_SKIP_MS_OS 0
41#define KSE_DONT_SKIP_MS_OS 1
42#define KSE_KEEP_ON_SOFT_REMOVE 3
43#define KSE_LPM_OFF_FOR_CHAINED_HUBS 16
44#define KSE_LPM_OFF_DOWNSTREAM 26
45#define KSE_POLLING_TO_COMPLIANCE 35
46#define KSE_NO_U2_FOR_TUNNELED_DEVICES 48
49#define HUB_DUAL_ROLE_MTP 0x00000002
50#define HUB_DUAL_ROLE_IP_OVER_USB 0x00000004
51#define HUB_DUAL_ROLE_VIDEO 0x00000008
52#define HUB_DUAL_ROLE_FUNCTIONS 0x0000000E
53#define HUB_DUAL_ROLE_UCM_PRESENT 0x80000000
264HubQueryKseDeviceFlags(
278 L"USB:%ls\\VID_%hs&PID_%hs&REV_%hs",
293 L"USB:%ls\\VID_%hs&PID_%hs",
313 return (
Flags & (1ULL << Bit)) != 0;
475 WCHAR NameBuffer[32];
598HubQueryVerifierFlags(
626 DPRINT1(
"Opening the hardware verifier key failed 0x%lx\n",
Status);
848HubReadHubRegistryValues(
921 DPRINT1(
"Hub %p hardware key not opened for Usb4HostName 0x%lx\n",
Hub,
Status);
945 DPRINT(
"Hub %p USB4 host name override present\n",
Hub);
985HubNoteHubOverCurrent(
1017HubWriteUsbflagsValue(
1058 HubWriteUsbflagsValue(
Child,
L"MsOs20DescriptorSetInfo", &
Child->m_MsOs20SetInfo,
sizeof(
Child->m_MsOs20SetInfo));
1095HubWriteDeviceString(
1137HubRefreshExtPropertiesInstalled(
1188 Child->m_FriendlyNameLength = 0;
1198 DPRINT1(
"Device %p friendly name could not be allocated\n",
Child);
1223 WDFKEY Subkey =
NULL;
1279 Child->m_Port->m_D3ColdReconnectTimeout =
Value;
1306 HubWriteDeviceDword(
Child,
L"MsOs20Flags",
Child->m_MsOs20.Flags);
1308 HubWriteDeviceDword(
Child,
L"EnumerationRetryCount",
Child->m_EnumRetryCount);
1314HubWriteEnumerationFailureCode(
1319 HubWriteDeviceDword(
Child,
L"EnumerationFailureCode",
Child->m_EnumMessageId);
1329HubFormatUxdPortName(
1343HubFormatUxdDeviceName(
1381HubReadUxdPortRecord(
1427HubReadUxdDeviceRecord(
1486 DPRINT(
"Device %p on port %u is reserved for a virtual machine\n",
Child,
Child->m_Port->Number());
1550 WdfRegistryRemoveValue(
Key, &
Name);
1560 WdfRegistryRemoveValue(
Key, &
Name);
1571HubQueryUxdDeviceValue(
1647 DPRINT1(
"UXD record %wZ could not be deleted at shutdown\n", &
Name);
1660HubUxdShutdownCleanup(
1672 HubPurgeUxdRecords(
Key);
1687 HubPurgeUxdRecords(
Key);
1731 Status = WdfRegistryQueryULong(Ceip, &InformationName, &
Previous);
1737 Status = WdfRegistryAssignULong(Ceip,
1743 Status = WdfRegistryAssignULong(Ceip, &InterconnectName,
Child->m_Port->m_InterconnectType);
1792 DPRINT(
"PDO %p lost its device before the selective suspend record\n",
Pdo);
1796 HubWriteDeviceDword(
Child,
1797 L"DeviceSelectiveSuspended",
1807HubRecordSelectiveSuspend(
1829 DPRINT1(
"Selective suspend work item failed 0x%lx\n",
Status);
1840HubBumpBootSurpriseRemovalCount(
VOID)
1869 DPRINT1(
"Updating the boot path surprise removal count failed 0x%lx\n",
Status);
1989HubAddConfiguredFunctions(
2017 Current = HubZwReadData(&
Path,
L"CurrentConfiguration");
2028 if (PathBuffer ==
NULL)
2035 List = HubZwReadData(&
Path,
L"InterfaceList");
2078HubQueryLocalDualRoleFeatures(
2081 ULONG IncludeDefault = 0;
2093 IncludeDefault =
Value;
2095 if (IncludeDefault == 0)
2097 *
Features &= ~HUB_DUAL_ROLE_FUNCTIONS;
2098 HubAddConfiguredFunctions(
Features);
2107 *
Features &= ~HUB_DUAL_ROLE_UCM_PRESENT;
2122 Child->m_FriendlyNameLength = 0;
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
_In_opt_ PWSTR SubkeyName
HubWriteEnumerationData(Child)
HubCacheMsOs20SetInfo(Child)
HubReadDeviceHardwareValues(Child)
BOOLEAN QueryRegistryValues()
USB_DEVICE_DESCRIPTOR m_DeviceDescriptor
UCXHUB_CONTROLLER_INFO_V2 m_ControllerInfo
BOOLEAN m_TunneledDevicesSkipU2
VOID ClearFlag(_In_ HubFlag Flag)
VOID SetFlag(_In_ HubFlag Flag)
ULONG m_LifetimeRecoveryCount
BOOLEAN HasFlag(_In_ HubFlag Flag) const
static HubFdo * FromDevice(_In_ WDFDEVICE Device)
HubParentInfo m_ParentInfo
BOOLEAN IsRootHub() const
static HubPdo * FromDevice(_In_ WDFDEVICE Device)
#define HUB_MSOS20_ALT_ENUM
#define HUB_MSOS20_SET_INFO
_In_ BOOLEAN _In_ ULONG Features
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
#define NT_SUCCESS(StatCode)
MIXER_STATUS CloseKey(IN HANDLE hKey)
#define _IRQL_requires_max_(irql)
#define _IRQL_requires_(irql)
return WdfRegistryOpenKey(NULL, &KeyName, Access, WDF_NO_OBJECT_ATTRIBUTES, Key)
#define ExAllocatePoolWithTag(hernya, size, tag)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
@ DisableRemoteWakeForUsb20Lpm
@ UseWin8DescriptorValidation
@ IgnoreBosValidationFailure
@ RequestConfigDescOnReset
@ SupportsSelectiveSuspend
#define HUB_LIVEDUMP_SUPERSPEED_DISABLED
HubSaveUxdState(Child->m_Hub, Child, NULL)
_In_ PCUNICODE_STRING _In_ ACCESS_MASK Access
return HubRegOpen(NULL, &Name, Access, Key)
#define HUB_D3COLD_RECONNECT_DEFAULT
static const WCHAR HubVerifierPath[]
WdfStringGetUnicodeString(String, &Text)
_In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ACCESS_MASK CreateAccess
static const WCHAR HubUsbControlPath[]
_In_ WDFKEY _In_ WDFSTRING _Out_ PBOOLEAN Stop
_In_ PCWSTR _In_ ULONG Size
_In_ const HubIdStrings * Ids
static const HubHubErrata HubHubErrataSecond[]
return RtlUnicodeStringPrintf(Name, L"uxd_port_%03u", PortNumber)
static const HubDeviceErrata HubDeviceErrataBeforeSoftRemove[]
#define KSE_LPM_OFF_DOWNSTREAM
_In_ PCUNICODE_STRING _In_ ACCESS_MASK OpenAccess
VOID NTAPI HubFormatIdStrings(_In_ const USB_DEVICE_DESCRIPTOR *Descriptor, _Out_ HubIdStrings *Ids)
static const WCHAR HubUsbflagsPath[]
static const HubHubErrata HubHubErrataFirst[]
_In_ WDFKEY _In_ ULONG64 _In_ ULONG Count
return ZwOpenKey(Handle, KEY_READ, &Attributes)
static const HubDeviceErrata HubDeviceErrataAfterSoftRemove[]
_In_ ACCESS_MASK _Out_ WDFKEY _Out_ WDFKEY * DeviceKey
RtlInitEmptyUnicodeString(Name, Buffer,(USHORT)(Count *sizeof(WCHAR)))
HubAltSettingFilter * Filter
return WdfDeviceOpenRegistryKey(Child->m_Pdo->m_Device, PLUGPLAY_REGKEY_DEVICE, Access, WDF_NO_OBJECT_ATTRIBUTES, Key)
_In_ PCWSTR _Out_ PULONG _Out_ PBOOLEAN _Inout_ NTSTATUS * Status
#define KSE_NO_U2_FOR_TUNNELED_DEVICES
#define HUB_DUAL_ROLE_UCM_PRESENT
#define HUB_DUAL_ROLE_MTP
static const WCHAR HubUxdDevicesPath[]
HubWriteDeviceValue(Child, &ValueName, REG_DWORD, sizeof(Value), &Value)
_In_ const HubIdStrings _In_ PCWSTR ValueName
static const WCHAR HubUsbFnDefaultPath[]
#define HUB_DUAL_ROLE_IP_OVER_USB
static const WCHAR HubGlobalCeipPath[]
_In_ PCUNICODE_STRING _In_ ULONG _In_ ULONG Length
_In_ WDFKEY _In_ ULONG64 Kse
VOID NTAPI HubReleaseRegistryState(_In_ HubChild *Child)
static ULONG NTAPI HubBoundedLength(_In_reads_(Limit) PCWSTR Text, _In_ ULONG Limit)
#define KSE_DONT_SKIP_MS_OS
static VOID NTAPI HubEvtOverCurrentWorkItem(_In_ WDFWORKITEM WorkItem)
#define KSE_POLLING_TO_COMPLIANCE
#define HUB_DUAL_ROLE_FUNCTIONS
_In_ PCWSTR _Out_ PULONG Value
HubReadAlternateSettingFilter(Child, Key)
static VOID NTAPI HubFormatControllerIds(_In_ const UCXHUB_CONTROLLER_INFO_V2 *Info, _Out_ HubIdStrings *Ids)
RtlFreeUnicodeString & GuidText
HubApplyHubErrata(Hub, Key, Kse, HubHubErrataSecond, RTL_NUMBER_OF(HubHubErrataSecond))
_In_ HubChild _Out_opt_ PBOOLEAN UpdateRequired
FORCEINLINE BOOLEAN NTAPI HubKseBit(_In_ ULONG64 Flags, _In_ ULONG Bit)
static const WCHAR HubUsbFnPath[]
return WdfRegistryCreateKey(Parent, Name, CreateAccess, REG_OPTION_NON_VOLATILE, NULL, WDF_NO_OBJECT_ATTRIBUTES, Key)
static VOID NTAPI HubEvtSelectiveSuspendWorkItem(_In_ WDFWORKITEM WorkItem)
#define KSE_KEEP_ON_SOFT_REMOVE
_In_ ACCESS_MASK _Out_ WDFKEY * RootKey
static const WCHAR HubUxdPnpPath[]
_In_ PCUNICODE_STRING _Out_ HubUxdSettings * Record
return WdfRegistryQueryValue(Key, Name, sizeof(*Record), Record, NULL, NULL)
#define HUB_DUAL_ROLE_VIDEO
#define KSE_LPM_OFF_FOR_CHAINED_HUBS
static const WCHAR HubUsbFnConfigPath[]
static const WCHAR HubD3ColdSubkey[]
_In_ PCUNICODE_STRING _In_ ACCESS_MASK _Out_ WDFKEY * Key
static BOOLEAN NTAPI HubIsBrokenVl810(_In_ const USB_DEVICE_DESCRIPTOR *Descriptor)
_In_ PCWSTR _Out_ PULONG _Out_ PBOOLEAN Present
#define HUB_MSG_REGISTRY_FAILURE
WdfWorkItemEnqueue(WorkItem)
_In_opt_ PVOID _In_ PUCXHUB_WORKITEM WorkItem
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
#define RtlEqualMemory(dst, src, len)
_In_opt_ PVOID _Out_ BOOLEAN * Stop
#define ExFreePoolWithTag(_P, _T)
static const ENTRY Entries[]
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
#define InitializeObjectAttributes(p, n, a, r, s)
#define _In_reads_bytes_(s)
#define _Out_writes_bytes_(s)
@ KeyValueBasicInformation
@ KeyValuePartialInformation
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_CREATE_SUB_KEY
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define REG_OPTION_NON_VOLATILE
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
Data(int index, int value)
struct HubAltSettingFilter::@1629 Entries[ANYSIZE_ARRAY]
PFN_HUB_KSE_QUERY_DEVICE_FLAGS KseQueryDeviceFlags
BOOLEAN HasFlag(_In_ HubGlobal Flag) const
CHAR Revision[MAX_REVISION_ID_STRING_LENGTH]
CHAR Vendor[MAX_VENDOR_ID_STRING_LENGTH]
CHAR Product[MAX_DEVICE_ID_STRING_LENGTH]
USB_DEVICE_DESCRIPTOR DeviceDescriptor
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
@ UcxControllerParentBusTypePci
@ UcxControllerParentBusTypeAcpi
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config
_Must_inspect_result_ _In_ UCXCONTROLLER _In_ PUCX_ROOTHUB_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXROOTHUB * RootHub
#define STATUS_UNSUCCESSFUL
#define STATUS_INVALID_DEVICE_STATE
#define STATUS_OBJECT_NAME_NOT_FOUND
#define HUB_PARENT_DISABLE_LPM
@ PollingToComplianceOnStart
@ ToleratesU0WhileDetached
@ DelayAfterResetComplete
@ NoSelectiveSuspendIntegrated
@ IgnoreEnabledInSsInactive
@ DiscardEnableDuringReset
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFCOLLECTION _In_ ULONG Index
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_ WDFCMRESLIST List
#define WDF_NO_OBJECT_ATTRIBUTES
FORCEINLINE VOID WDF_WORKITEM_CONFIG_INIT(_Out_ PWDF_WORKITEM_CONFIG Config, _In_ PFN_WDF_WORKITEM EvtWorkItemFunc)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define PLUGPLAY_REGKEY_DEVICE