ReactOS 0.4.17-dev-1281-g065abb3
devhcd.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HUB_LPM_POLICY_U1_ENABLED   0x00000001
 
#define HUB_LPM_POLICY_U2_ENABLED   0x00000002
 
#define HUB_LPM_POLICY_U1_ACCEPT   0x00000004
 
#define HUB_LPM_POLICY_U2_ACCEPT   0x00000008
 
#define HUB_LPM_POLICY_U1_INITIATE   0x00000010
 
#define HUB_LPM_POLICY_U2_INITIATE   0x00000020
 
#define HUB_LPM_POLICY_CONSERVATIVE   0x00000040
 
#define HUB_LPM_POLICY_AGGRESSIVE   0x00000080
 
#define HUB_LINK_TARGET_U1   0x00000001
 
#define HUB_LINK_TARGET_U2   0x00000002
 
#define HUB_LINK_U1_OFF_FOR_LATENCY   0x00000004
 
#define HUB_LINK_U2_OFF_FOR_LATENCY   0x00000008
 
#define HUB_LINK_OFF_FOR_NO_PING   0x00000010
 

Enumerations

enum class  HubLpm20Status : ULONG {
  Unknown , Enabled , DeviceIsHub , DeviceHack ,
  HubHack , GloballyDisabled , DeviceNotCapable , FirstGenerationDevice ,
  PortNotCapable , RunningAtSuperSpeed
}
 

Functions

NTSTATUS NTAPI HubChildSubmitUcxIoctl (_In_ HubChild *Child, _In_ ULONG IoControlCode)
 
VOID NTAPI HubConfigMovePipes (_In_opt_ HubConfiguration *Config, _In_ PipeState From, _In_ PipeState To)
 
 _IRQL_requires_ (PASSIVE_LEVEL) VOID NTAPI HubChildDeleteInterface(_In_ HubChild *Child
 Sends a synchronous IOCTL to the specified device object.
 
VOID NTAPI HubChildCollectForDisable (_In_ HubChild *Child, _In_ HubInterface *Interface)
 
BOOLEAN NTAPI HubChildU2ForEnumerated (_In_ HubChild *Child)
 
USBD_STATUS NTAPI HubNtStatusToUsbd (_In_ NTSTATUS Status)
 

Variables

_In_ HubInterface * Interface
 

Macro Definition Documentation

◆ HUB_LINK_OFF_FOR_NO_PING

#define HUB_LINK_OFF_FOR_NO_PING   0x00000010

Definition at line 25 of file devhcd.h.

◆ HUB_LINK_TARGET_U1

#define HUB_LINK_TARGET_U1   0x00000001

Definition at line 21 of file devhcd.h.

◆ HUB_LINK_TARGET_U2

#define HUB_LINK_TARGET_U2   0x00000002

Definition at line 22 of file devhcd.h.

◆ HUB_LINK_U1_OFF_FOR_LATENCY

#define HUB_LINK_U1_OFF_FOR_LATENCY   0x00000004

Definition at line 23 of file devhcd.h.

◆ HUB_LINK_U2_OFF_FOR_LATENCY

#define HUB_LINK_U2_OFF_FOR_LATENCY   0x00000008

Definition at line 24 of file devhcd.h.

◆ HUB_LPM_POLICY_AGGRESSIVE

#define HUB_LPM_POLICY_AGGRESSIVE   0x00000080

Definition at line 18 of file devhcd.h.

◆ HUB_LPM_POLICY_CONSERVATIVE

#define HUB_LPM_POLICY_CONSERVATIVE   0x00000040

Definition at line 17 of file devhcd.h.

◆ HUB_LPM_POLICY_U1_ACCEPT

#define HUB_LPM_POLICY_U1_ACCEPT   0x00000004

Definition at line 13 of file devhcd.h.

◆ HUB_LPM_POLICY_U1_ENABLED

#define HUB_LPM_POLICY_U1_ENABLED   0x00000001

Definition at line 11 of file devhcd.h.

◆ HUB_LPM_POLICY_U1_INITIATE

#define HUB_LPM_POLICY_U1_INITIATE   0x00000010

Definition at line 15 of file devhcd.h.

◆ HUB_LPM_POLICY_U2_ACCEPT

#define HUB_LPM_POLICY_U2_ACCEPT   0x00000008

Definition at line 14 of file devhcd.h.

◆ HUB_LPM_POLICY_U2_ENABLED

#define HUB_LPM_POLICY_U2_ENABLED   0x00000002

Definition at line 12 of file devhcd.h.

◆ HUB_LPM_POLICY_U2_INITIATE

#define HUB_LPM_POLICY_U2_INITIATE   0x00000020

Definition at line 16 of file devhcd.h.

Enumeration Type Documentation

◆ HubLpm20Status

Enumerator
Unknown 
Enabled 
DeviceIsHub 
DeviceHack 
HubHack 
GloballyDisabled 
DeviceNotCapable 
FirstGenerationDevice 
PortNotCapable 
RunningAtSuperSpeed 

Definition at line 28 of file devhcd.h.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

Deletes the UCX endpoints of the disabled pipes, then the interface record.

Definition at line 2121 of file class.c.

13175{
13177
13178 PAGED_CODE();
13179
13180 TracePrint((TRACE_LEVEL_VERBOSE,
13181 TRACE_FLAG_PNP,
13182 "ClassDetermineTokenOperationCommandSupport (%p): Entering function.\n",
13183 DeviceObject));
13184
13185 //
13186 // Send down Inquiry for VPD_THIRD_PARTY_COPY_PAGE and cache away the device parameters
13187 // from WINDOWS_BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR.
13188 //
13190
13191 if (NT_SUCCESS(status)) {
13192
13193 ULONG maxListIdentifier = MaxTokenOperationListIdentifier;
13194
13195 //
13196 // Query the maximum list identifier to use for TokenOperation commands.
13197 //
13198 if (NT_SUCCESS(ClasspGetMaximumTokenListIdentifier(DeviceObject, REG_DISK_CLASS_CONTROL, &maxListIdentifier))) {
13199 if (maxListIdentifier >= MIN_TOKEN_LIST_IDENTIFIERS) {
13200
13201 NT_ASSERT(maxListIdentifier <= MAX_TOKEN_LIST_IDENTIFIERS);
13202 MaxTokenOperationListIdentifier = maxListIdentifier;
13203 }
13204 }
13205
13206 }
13207
13208 TracePrint((TRACE_LEVEL_VERBOSE,
13209 TRACE_FLAG_PNP,
13210 "ClassDetermineTokenOperationCommandSupport (%p): Exiting function with status %x.\n",
13212 status));
13213
13214 return status;
13215}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define REG_DISK_CLASS_CONTROL
Definition: classp.h:218
#define MAX_TOKEN_LIST_IDENTIFIERS
Definition: classp.h:215
#define MIN_TOKEN_LIST_IDENTIFIERS
Definition: classp.h:214
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG MaxTokenOperationListIdentifier
Definition: class.c:107
_IRQL_requires_same_ NTSTATUS ClasspGetBlockDeviceTokenLimitsInfo(_Inout_ PDEVICE_OBJECT DeviceObject)
Definition: class.c:13220
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
#define NT_ASSERT
Definition: rtlfuncs.h:3334

◆ HubChildCollectForDisable()

VOID NTAPI HubChildCollectForDisable ( _In_ HubChild *  Child,
_In_ HubInterface *  Interface 
)

Enabled pipes go to the disable list as PendingDisable, disabled ones stay unchanged.

Definition at line 132 of file devconfig.cpp.

135{
136 HubPipe* Pipe;
137 ULONG Index;
138
139 for (Index = 0; Index < Interface->PipeCount; Index++)
140 {
141 Pipe = &Interface->Pipes[Index];
142
143 switch (Pipe->State)
144 {
147 Child->m_EndpointsToDisable[Child->m_DisableCount++] = Pipe->Endpoint;
148 break;
149
151 Child->m_EndpointsUnchanged[Child->m_UnchangedCount++] = Pipe->Endpoint;
152 break;
153
155 break;
156
157 default:
158 DPRINT1("Device %p pipe %lu in unexpected state %u\n", Child, Index, (UCHAR)Pipe->State);
159 ASSERT(FALSE);
160 break;
161 }
162 }
163}
#define DPRINT1
Definition: precomp.h:8
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
unsigned char UCHAR
Definition: typedefs.h:53
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
_In_ WDFUSBPIPE Pipe
Definition: wdfusb.h:1741

Referenced by DeviceMachine::DisableAllEndpoints(), DeviceMachine::DisableNewInterfaceEndpoints(), DeviceMachine::PrepareConfigLists(), and DeviceMachine::PrepareInterfaceLists().

◆ HubChildSubmitUcxIoctl()

NTSTATUS NTAPI HubChildSubmitUcxIoctl ( _In_ HubChild *  Child,
_In_ ULONG  IoControlCode 
)

Sends the payload already in the device's UCX buffer. On a send failure the failure event is posted here and the completion never runs.

Definition at line 174 of file devhcd.cpp.

177{
178 WDFIOTARGET Target = Child->m_Hub->m_RootHubTarget;
179 WDFREQUEST Request = Child->m_UcxRequest;
182
184 Status = WdfRequestReuse(Request, &Reuse);
185 if (!NT_SUCCESS(Status))
186 DPRINT1("Device %p UCX request reuse failed 0x%lx\n", Child, Status);
187
188 Child->m_UcxIoctl = IoControlCode;
189
190 /* The request was made on the local target; that stack is at least as deep */
191 Status = WdfIoTargetFormatRequestForInternalIoctlOthers(Target,
192 Request,
194 Child->m_UcxPayloadMemory,
195 NULL,
196 NULL,
197 NULL,
198 NULL,
199 NULL);
200 if (NT_SUCCESS(Status))
201 {
202 WdfRequestSetCompletionRoutine(Request, HubChildUcxIoctlComplete, Child);
203
205 return STATUS_SUCCESS;
206
207 Status = WdfRequestGetStatus(Request);
208 }
209
210 DPRINT1("Device %p UCX request 0x%lx not sent 0x%lx\n", Child, IoControlCode, Status);
213 return Status;
214}
USBD_STATUS NTAPI HubNtStatusToUsbd(_In_ NTSTATUS Status)
Definition: childpdo.cpp:190
static EVT_WDF_REQUEST_COMPLETION_ROUTINE HubChildUcxIoctlComplete
Definition: devhcd.cpp:50
static VOID NTAPI HubChildFailStatus(_In_ HubChild *Child, _In_ NTSTATUS NtStatus, _In_ USBD_STATUS UsbdStatus)
Definition: devhcd.cpp:102
NTSTATUS Status
Definition: devhcd.cpp:1401
@ ControllerIoctlFailed
#define NULL
Definition: types.h:112
return pRequest Reuse(ReuseParams)
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
_Must_inspect_result_ FORCEINLINE BOOLEAN WdfRequestSend(_In_ WDFREQUEST Request, _In_ WDFIOTARGET Target, _In_opt_ PWDF_REQUEST_SEND_OPTIONS Options)
Definition: wdfrequest.h:677
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
@ WDF_REQUEST_REUSE_NO_FLAGS
Definition: wdfrequest.h:92
FORCEINLINE VOID WDF_REQUEST_REUSE_PARAMS_INIT(_Out_ PWDF_REQUEST_REUSE_PARAMS Params, _In_ ULONG Flags, _In_ NTSTATUS Status)
Definition: wdfrequest.h:364
#define WDF_NO_SEND_OPTIONS
Definition: wdftypes.h:109

Referenced by DeviceMachine::AbortDeviceIo(), DeviceMachine::ClaimAddressZero(), DeviceMachine::DisableDeviceInController(), DeviceMachine::EnableDeviceInController(), HubChildResetTargetEndpoint(), DeviceMachine::NotifyDeviceReset(), DeviceMachine::ProgramEndpoints(), DeviceMachine::PurgeDeviceIo(), DeviceMachine::PurgeDeviceTreeIo(), DeviceMachine::PurgeIoForSuspend(), DeviceMachine::SetDeviceAddress(), DeviceMachine::StartDeviceIo(), DeviceMachine::UpdateDefaultEndpoint(), DeviceMachine::UpdateDeviceInController(), DeviceMachine::UpdateExitLatency(), and DeviceMachine::UpdateLpm20().

◆ HubChildU2ForEnumerated()

BOOLEAN NTAPI HubChildU2ForEnumerated ( _In_ HubChild *  Child)

TRUE when an enumerated, unconfigured device gets a U2 timeout; sets that timeout.

Definition at line 135 of file devlpm.cpp.

137{
141 {
142 return FALSE;
143 }
144
147 return TRUE;
148}
#define HUB_LPM_POLICY_U2_ACCEPT
Definition: devhcd.h:14
#define HUB_LPM_POLICY_U2_INITIATE
Definition: devhcd.h:16
static BOOLEAN NTAPI HubChildPortKeepsU2Off(_In_ HubChild *Child)
Definition: devlpm.cpp:122
static BOOLEAN NTAPI HubChildLpmBlocked(_In_ HubChild *Child)
Definition: devlpm.cpp:51
static BOOLEAN NTAPI HubChildHasPolicy(_In_ HubChild *Child, _In_ ULONG Bit)
Definition: devlpm.cpp:60
#define U2_TIMEOUT_LONGEST
Definition: devlpm.cpp:18
#define TIMEOUT_ACCEPT_ONLY
Definition: devlpm.cpp:19
#define TRUE
Definition: types.h:120

Referenced by DeviceMachine::U2NeededForEnumerated(), and DeviceMachine::UpdateDeviceInController().

◆ HubConfigMovePipes()

VOID NTAPI HubConfigMovePipes ( _In_opt_ HubConfiguration *  Config,
_In_ PipeState  From,
_In_ PipeState  To 
)

Moves every pipe of a configuration in state From to state To.

Definition at line 133 of file devhcd.cpp.

137{
140 ULONG Index;
141
142 if (Config == NULL)
143 return;
144
145 for (Entry = Config->Interfaces.Flink; Entry != &Config->Interfaces; Entry = Entry->Flink)
146 {
148
149 for (Index = 0; Index < Interface->PipeCount; Index++)
150 {
151 if (Interface->Pipes[Index].State == From)
152 Interface->Pipes[Index].State = To;
153 }
154 }
155}
PLIST_ENTRY Entry
Definition: devhcd.cpp:1262
ULONG Index
Definition: devhcd.cpp:1237
_In_ HubInterface * Interface
Definition: devhcd.cpp:1234
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config

Referenced by DeviceMachine::EndpointsNeedDisableOnFailure(), HubChildConfigureDone(), HubChildUcxIoctlComplete(), DeviceMachine::MarkPendingEndpointsDisabled(), DeviceMachine::NotifyDeviceReset(), and DeviceMachine::ProgramEndpoints().

◆ HubNtStatusToUsbd()

USBD_STATUS NTAPI HubNtStatusToUsbd ( _In_ NTSTATUS  Status)

NT to USBD status mapping shared by the hub and the child PDO.

Definition at line 190 of file childpdo.cpp.

192{
193 switch (Status)
194 {
195 case STATUS_SUCCESS:
196 return USBD_STATUS_SUCCESS;
197
198 /* The first one is the hub's own addition to the shared table */
202
205
208
209 case STATUS_CANCELLED:
211
212 default:
214 }
215}
return STATUS_SUCCESS
Definition: childpdo.cpp:584
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define USBD_STATUS_DEVICE_GONE
Definition: usb.h:222
#define USBD_STATUS_CANCELED
Definition: usb.h:225
#define USBD_STATUS_SUCCESS
Definition: usb.h:177
#define USBD_STATUS_NOT_SUPPORTED
Definition: usb.h:213
#define USBD_STATUS_INSUFFICIENT_RESOURCES
Definition: usb.h:215
#define USBD_STATUS_INVALID_PARAMETER
Definition: usb.h:203

Referenced by DeviceMachine::CompleteClientRequestFailed(), HubChildConfigureDone(), HubChildRecordFailure(), HubChildSubmitUcxIoctl(), HubChildUcxIoctlComplete(), HubPdoSyncComplete(), and DeviceMachine::NotifyDeviceReset().

Variable Documentation

◆ Interface

Definition at line 68 of file devhcd.h.