ReactOS 0.4.17-dev-1281-g065abb3
hubdriver.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS SuperSpeed USB Hub Driver
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Driver wide state, global policy and boot device support
5 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
6 */
7
8#pragma once
9
10/* Global policy bits, from the registry and the kernel shim engine */
12{
13 DisableSelectiveSuspendUI = 0x00000002,
14 EnableDiagnosticMode = 0x00000008,
15 DisableUxdSupport = 0x00000010,
16 EnableExtendedValidation = 0x00000020,
17 WakeOnConnectUI = 0x00000040,
18 DisableOnSoftRemove = 0x00000080,
19 UxdDeleteOnShutdown = 0x00000100,
20 UxdDeleteOnReload = 0x00000200,
21 UxdDeleteOnDisconnect = 0x00000400,
22 UxdEnable = 0x00000800,
23 EtwEnabled = 0x00001000,
24 CheckReservedFields = 0x00002000,
25 StrictDescriptorChecks = 0x00004000,
26 EnableUsb20HardwareLpm = 0x00008000,
27 PreventSuperSpeedDebounce = 0x00010000,
28 AlwaysSecondReset = 0x00020000,
29 EnableUsbLtm = 0x00040000
30};
31
32/* How MS OS descriptors are queried */
33enum class HubMsOsMode : ULONG
34{
35 QueryOnce = 0,
36 ForceQuery = 1,
37 NeverQuery = 2
38};
39
40typedef
44 _In_ PCWSTR DeviceClass,
46
47typedef
52
53typedef
57
58typedef
66
67typedef
71
72typedef
84
87{
88 WDFDRIVER Driver;
90
91 volatile LONG GlobalFlags;
93
94 /* Hub FDOs between prepare and release hardware */
96 WDFWAITLOCK HubListLock;
97
98 /* Owned by the connector module */
100 WDFWAITLOCK CompanionPortLock;
101
102 /* Copied into every USB 2 LPM device update */
104
105 WDFWMIINSTANCE SurpriseRemovalWmi;
106
107 /* SuperSpeed devices whose last SET_ADDRESS failed */
109
110 /* Optional kernel routines; NULL when the kernel lacks them */
117
118 BOOLEAN
120 _In_ HubGlobal Flag) const
121 {
122 return (GlobalFlags & (LONG)Flag) != 0;
123 }
124
125 VOID
128 {
130 }
131
132 VOID
135 {
137 }
138};
139
141
142/* Live dump report types */
143enum class HubReport : ULONG
144{
146 HubResetFailed = 1,
148};
149
150/* Live dump bugcheck parameter 1 values */
151#define HUB_LIVEDUMP_HUB_RESET_OK 0x3000
152#define HUB_LIVEDUMP_HUB_RESET_FAILED 0x3001
153#define HUB_LIVEDUMP_SUPERSPEED_DISABLED 0x3002
154#define HUB_LIVEDUMP_ENUMERATION_FAILED 0x3003
155
156/* BUGCODE_USB3_DRIVER and what the hub raises with it */
157#define HUB_BUGCHECK_USB3 0x144
158#define HUB_USB3_BOOT_DEVICE_FAILED 2
159#define HUB_BOOT_DEVICE_IS_STORAGE 1
160#define HUB_BOOT_DEVICE_IS_HUB 2
161
162/* errreport.cpp */
163
165NTAPI
167 _In_ WDFDEVICE HubFdo,
170
173NTAPI
174HubSubmitLiveDump(
175 _In_ WDFDEVICE Device,
178
179/* entry.cpp */
180
183NTAPI
185
187VOID
188NTAPI
191
194NTAPI
195HubIsWinPe(VOID);
Type
Definition: Type.h:7
#define VOID
Definition: acefi.h:82
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
Definition: fdo.h:132
_In_ ULONG _Out_opt_ HubBosInfo _Out_opt_ PUSHORT _Out_opt_ PUSHORT _Inout_opt_ PBOOLEAN _Inout_opt_ HubLpmInfo _Inout_opt_ PULONG DeviceFlags
Definition: desccheck.cpp:2223
ULONG * PDEVPROPTYPE
Definition: devpropdef.h:24
_In_ ULONG _In_ ULONG _In_opt_ DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK Callback
Definition: dispmprt.h:620
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NTSTATUS
Definition: precomp.h:19
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_Must_inspect_result_ _In_ CONST FLT_REGISTRATION * Registration
Definition: fltkernel.h:991
ULONG Handle
Definition: gdb_input.c:15
_Must_inspect_result_ NTSTATUS(NTAPI * PFN_HUB_GET_INTERFACE_PROPERTY)(_In_ PUNICODE_STRING SymbolicLinkName, _In_ CONST DEVPROPKEY *PropertyKey, _In_ LCID Lcid, _Reserved_ ULONG Flags, _In_ ULONG Size, _Out_writes_bytes_to_(Size, *RequiredSize) PVOID Data, _Out_ PULONG RequiredSize, _Out_ PDEVPROPTYPE Type)
Definition: hubdriver.h:75
NTSTATUS(NTAPI * PFN_HUB_REGISTER_POWER_SETTING)(_In_opt_ PDEVICE_OBJECT DeviceObject, _In_ LPCGUID SettingGuid, _In_ PPOWER_SETTING_CALLBACK Callback, _In_opt_ PVOID Context, _Outptr_opt_ PVOID *Handle)
Definition: hubdriver.h:60
NTSTATUS NTAPI HubCreateReport(_In_ WDFDEVICE HubFdo, _In_ HubReport Type, _In_ ULONG SubReason)
Definition: errreport.cpp:151
HubReport
Definition: hubdriver.h:144
@ DeviceEnumerationFailed
@ HubResetSucceeded
NTSTATUS(NTAPI * PFN_HUB_KSE_QUERY_DEVICE_FLAGS)(_In_ PCWSTR DeviceKey, _In_ PCWSTR DeviceClass, _Out_ PULONG64 DeviceFlags)
Definition: hubdriver.h:42
VOID(NTAPI * PFN_HUB_NOTIFY_BOOT_DEVICE_REMOVAL)(_In_ PVOID Handle)
Definition: hubdriver.h:55
HubGlobal
Definition: hubdriver.h:12
@ StrictDescriptorChecks
@ EnableExtendedValidation
@ DisableUxdSupport
@ AlwaysSecondReset
@ PreventSuperSpeedDebounce
@ DisableSelectiveSuspendUI
@ UxdDeleteOnReload
@ EnableDiagnosticMode
@ UxdDeleteOnDisconnect
@ DisableOnSoftRemove
@ CheckReservedFields
@ EnableUsb20HardwareLpm
@ UxdDeleteOnShutdown
HubDriverState HubDriver
Definition: entry.cpp:13
HubMsOsMode
Definition: hubdriver.h:34
NTSTATUS(NTAPI * PFN_HUB_UNREGISTER_POWER_SETTING)(_Inout_ PVOID Handle)
Definition: hubdriver.h:69
_In_ ULONG _In_ ULONG SubReason
Definition: hubdriver.h:177
VOID NTAPI HubNotifyBootDeviceRemoval(_In_opt_ PVOID Handle)
Definition: entry.cpp:335
NTSTATUS(NTAPI * PFN_HUB_REGISTER_BOOT_DEVICE)(_In_ PVOID Registration, _Out_ PVOID *Handle)
Definition: hubdriver.h:49
_In_ ACCESS_MASK _Out_ WDFKEY _Out_ WDFKEY * DeviceKey
HubReadUxdPolicy()
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_In_ PUNICODE_STRING SymbolicLinkName
Definition: hubucx.h:491
#define InterlockedOr
Definition: interlocked.h:239
#define InterlockedAnd
Definition: interlocked.h:77
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
unsigned __int64 * PULONG64
Definition: imports.h:198
_Out_ PLCID Lcid
Definition: rtlfuncs.h:5284
#define _Inout_
Definition: no_sal2.h:162
#define _Enum_is_bitflag_
Definition: no_sal2.h:404
#define _Outptr_opt_
Definition: no_sal2.h:264
#define _Out_writes_bytes_to_(s, c)
Definition: no_sal2.h:190
#define _Must_inspect_result_
Definition: no_sal2.h:62
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _Reserved_
Definition: no_sal2.h:504
#define CONST
Definition: pedump.c:81
long LONG
Definition: pedump.c:60
DWORD LCID
Definition: nls.h:13
_In_ PSP_DEVINFO_DATA _In_ const DEVPROPKEY * PropertyKey
Definition: setupapi.h:1667
Definition: xml2sdb.h:103
volatile LONG SuperSpeedDebounceVotes
Definition: hubdriver.h:108
PFN_HUB_KSE_QUERY_DEVICE_FLAGS KseQueryDeviceFlags
Definition: hubdriver.h:111
LIST_ENTRY HubList
Definition: hubdriver.h:95
PFN_HUB_UNREGISTER_POWER_SETTING UnregisterPowerSetting
Definition: hubdriver.h:115
volatile LONG GlobalFlags
Definition: hubdriver.h:91
PFN_HUB_NOTIFY_BOOT_DEVICE_REMOVAL NotifyBootDeviceRemoval
Definition: hubdriver.h:113
WDFWAITLOCK CompanionPortLock
Definition: hubdriver.h:100
VOID SetFlag(_In_ HubGlobal Flag)
Definition: hubdriver.h:126
WDFDRIVER Driver
Definition: hubdriver.h:88
BOOLEAN HasFlag(_In_ HubGlobal Flag) const
Definition: hubdriver.h:119
UCHAR Usb20LpmTimeout
Definition: hubdriver.h:103
PFN_HUB_GET_INTERFACE_PROPERTY GetInterfaceProperty
Definition: hubdriver.h:116
PFN_HUB_REGISTER_POWER_SETTING RegisterPowerSetting
Definition: hubdriver.h:114
HubMsOsMode MsOsMode
Definition: hubdriver.h:92
WDFWAITLOCK HubListLock
Definition: hubdriver.h:96
LIST_ENTRY ConnectorMap
Definition: hubdriver.h:99
WDFWMIINSTANCE SurpriseRemovalWmi
Definition: hubdriver.h:105
PDRIVER_OBJECT DriverObject
Definition: hubdriver.h:89
PFN_HUB_REGISTER_BOOT_DEVICE RegisterBootDevice
Definition: hubdriver.h:112
VOID ClearFlag(_In_ HubGlobal Flag)
Definition: hubdriver.h:133
Definition: typedefs.h:120
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char UCHAR
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4445
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707
_In_ LPCGUID SettingGuid
Definition: pofuncs.h:120
POWER_SETTING_CALLBACK * PPOWER_SETTING_CALLBACK
Definition: potypes.h:482