ReactOS 0.4.17-dev-1281-g065abb3
childpdo.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: Child PDO of a hub
5 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
6 */
7
8#pragma once
9
10/* Child PDO state flags */
12{
13 ReportPortDisabled = 0x00000001,
14 ProgrammingLostOnReset = 0x00000002,
15 InBootPath = 0x00000004,
16
17 /* devxfer */
18 ArmedForWake = 0x00000008,
19
20 /* hubpdo */
21 InD0 = 0x00000010,
22 WakeArmRequested = 0x00000020,
23 WaitWakePending = 0x00000040,
24 ClientDoesFunctionSuspend = 0x00000080,
25 WasResetAtResume = 0x00000100,
26 PowerLostOnReset = 0x00000200,
27 DeviceGone = 0x00000400,
28 QueryStopped = 0x00000800,
29 QueryRemoved = 0x00001000,
30 IdleMachineStarted = 0x00002000,
31 WakeNotificationSent = 0x00004000,
32 FailGetStatus = 0x00008000,
33 Started = 0x00010000
34};
35
36/* hubpdo */
37
38/* Number of LPM power setting registrations per child PDO */
39#define HUB_PDO_LPM_SETTINGS 5
40
41/* Client contract version before a USBD client identified itself */
42#define HUB_PDO_CONTRACT_UNKNOWN 0xFFFFFFFF
43
44class HubPdo
45{
46public:
47 static
48 HubPdo*
50 _In_ WDFDEVICE Device);
51
52public:
54
55 WDFDEVICE m_Device;
59
60 /* PdoFlag bits, interlocked */
61 volatile LONG m_Flags;
62
63 /* hubpdo */
64
67 _In_ PdoFlag Flag) const
68 {
69 return (m_Flags & (LONG)Flag) != 0;
70 }
71
72 VOID
75 {
77 }
78
79 VOID
82 {
84 }
85
90 {
91 return (InterlockedAnd(&m_Flags, ~(LONG)Flag) & (LONG)Flag) != 0;
92 }
93
94 /* Gate for client IOCTLs; plain stores */
96
97 /* FALSE until the PDO is a static child; cleanup then skips the device machine */
99
100 /* Set once by the first accepted cycle port request */
102
103 /* WDM device object right below the root hub FDO; NULL for a placeholder */
105
106 WDFQUEUE m_Queue;
107 WDFWORKITEM m_IdleWorkItem;
108
109 /* Written by select configuration validation, in mA */
111
112 /* Copy of the client's USB_START_FAILDATA */
114
115 /* ChildHubObject of a child hub that took the parent interface; debug only */
117
118 /* Remote wake notification sent to UCX for SuperSpeed devices */
119 WDFREQUEST m_WakeRequest;
122
124
125 /* What an ACPI filter put into the D3cold interface; zero without one */
127
130
131 /* Device interface symbolic link, fetched at prepare hardware */
132 WDFSTRING m_SymbolicLink;
133};
134
136
137/* hubpdo */
138
139/* childpdo.cpp */
140
144NTAPI
149
150/* suspend.cpp */
151
154NTAPI
155HubPdoCreateIdleWorkItem(
156 _In_ HubPdo* Pdo);
157
161NTAPI
162HubPdoSubmitIdleRequest(
163 _In_ HubPdo* Pdo,
165
166/* bootdev.cpp */
167
168EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX HubPdoEvtUsageNotificationEx;
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
HubPdoPostAndWait(Pdo->m_Child, DsmEvent::PdoInstallMsOsExt, "PdoInstallMsOsExt")
_In_ DsmEvent _In_ PCSTR What
Definition: childpdo.h:148
EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX HubPdoEvtUsageNotificationEx
Definition: childpdo.h:168
#define HUB_PDO_LPM_SETTINGS
Definition: childpdo.h:39
PdoFlag
Definition: childpdo.h:12
@ ProgrammingLostOnReset
@ WasResetAtResume
@ WakeArmRequested
@ QueryStopped
@ ClientDoesFunctionSuspend
@ IdleMachineStarted
@ PowerLostOnReset
@ ArmedForWake
@ ReportPortDisabled
@ QueryRemoved
@ FailGetStatus
@ WakeNotificationSent
@ WaitWakePending
Definition: fdo.h:132
HubFdo * m_Hub
Definition: childpdo.h:56
VOID SetFlag(_In_ PdoFlag Flag)
Definition: childpdo.h:73
ULONG m_ConfigPowerDraw
Definition: childpdo.h:110
WDFQUEUE m_Queue
Definition: childpdo.h:106
D3COLD_SUPPORT_INTERFACE m_AcpiD3Cold
Definition: childpdo.h:126
PVOID m_LpmSettings[HUB_PDO_LPM_SETTINGS]
Definition: childpdo.h:123
HubChild * m_Child
Definition: childpdo.h:57
WDFSTRING m_SymbolicLink
Definition: childpdo.h:132
ULONG m_ClientContractVersion
Definition: childpdo.h:129
USHORT m_PortNumber
Definition: childpdo.h:58
WDF_POWER_DEVICE_STATE m_WdfPowerState
Definition: childpdo.h:128
KEVENT m_WakeDone
Definition: childpdo.h:121
IdleMachine m_Idle
Definition: childpdo.h:53
WDFWORKITEM m_IdleWorkItem
Definition: childpdo.h:107
BOOLEAN HasFlag(_In_ PdoFlag Flag) const
Definition: childpdo.h:66
PVOID m_StartFailData
Definition: childpdo.h:113
BOOLEAN m_FailRequests
Definition: childpdo.h:95
WDFDEVICE m_Device
Definition: childpdo.h:55
WDFREQUEST m_WakeRequest
Definition: childpdo.h:119
BOOLEAN m_Reported
Definition: childpdo.h:98
BOOLEAN TestAndClearFlag(_In_ PdoFlag Flag)
Definition: childpdo.h:88
volatile LONG m_CycleQueued
Definition: childpdo.h:101
PDEVICE_OBJECT m_ControllerTarget
Definition: childpdo.h:104
REQUEST_REMOTE_WAKE_NOTIFICATION m_WakeBlock
Definition: childpdo.h:120
static HubPdo * FromDevice(_In_ WDFDEVICE Device)
Definition: childpdo.cpp:180
VOID ClearFlag(_In_ PdoFlag Flag)
Definition: childpdo.h:80
volatile LONG m_Flags
Definition: childpdo.h:61
PVOID m_ChildHubFdo
Definition: childpdo.h:116
Posts run to completion under m_PostLock; IRP completion and callbacks run after it is dropped.
Definition: idlesm.h:44
DsmEvent
Definition: devsm.h:15
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
Definition: hubucx.h:280
#define InterlockedOr
Definition: interlocked.h:239
#define InterlockedAnd
Definition: interlocked.h:77
_In_ PIRP Irp
Definition: kse.h:79
#define _Enum_is_bitflag_
Definition: no_sal2.h:404
#define _In_
Definition: no_sal2.h:158
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
Definition: xml2sdb.h:103
#define NTAPI
Definition: typedefs.h:36
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
enum _WDF_POWER_DEVICE_STATE WDF_POWER_DEVICE_STATE
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
#define WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(_contexttype, _castingfunction)
Definition: wdfobject.h:350