ReactOS  0.4.13-dev-242-g611e6d7
usbhub.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS USB Hub Driver
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: USBHub declarations
5  * COPYRIGHT: Copyright 2017 Vadim Galyant <vgal@rambler.ru>
6  */
7 
8 #ifndef _USBHUB_H_
9 #define _USBHUB_H_
10 
11 #include <ntddk.h>
12 #include <windef.h>
13 #include <stdio.h>
14 #include <wmistr.h>
15 #include <wmilib.h>
16 #include <wdmguid.h>
17 #include <ntstrsafe.h>
18 #include <usb.h>
19 #include <usbioctl.h>
20 #include <hubbusif.h>
21 #include <usbbusif.h>
22 #include <usbdlib.h>
23 #include <ks.h>
25 
26 #define USB_HUB_TAG 'BUHU'
27 
28 #define USBH_EXTENSION_TYPE_HUB 0x01
29 #define USBH_EXTENSION_TYPE_PORT 0x02
30 #define USBH_EXTENSION_TYPE_PARENT 0x04
31 #define USBH_EXTENSION_TYPE_FUNCTION 0x08
32 
33 #define USBHUB_FDO_FLAG_DEVICE_STARTED (1 << 0)
34 #define USBHUB_FDO_FLAG_DEVICE_STOPPING (1 << 2)
35 #define USBHUB_FDO_FLAG_DEVICE_FAILED (1 << 3)
36 #define USBHUB_FDO_FLAG_REMOTE_WAKEUP (1 << 4)
37 #define USBHUB_FDO_FLAG_DEVICE_STOPPED (1 << 5)
38 #define USBHUB_FDO_FLAG_HUB_BUSY (1 << 6)
39 #define USBHUB_FDO_FLAG_PENDING_WAKE_IRP (1 << 7)
40 #define USBHUB_FDO_FLAG_RESET_PORT_LOCK (1 << 8)
41 #define USBHUB_FDO_FLAG_ESD_RECOVERING (1 << 9)
42 #define USBHUB_FDO_FLAG_SET_D0_STATE (1 << 10)
43 #define USBHUB_FDO_FLAG_NOT_D0_STATE (1 << 11)
44 #define USBHUB_FDO_FLAG_WAIT_IDLE_REQUEST (1 << 12)
45 #define USBHUB_FDO_FLAG_STATE_CHANGING (1 << 13)
46 #define USBHUB_FDO_FLAG_DEVICE_REMOVED (1 << 14)
47 #define USBHUB_FDO_FLAG_USB20_HUB (1 << 15)
48 #define USBHUB_FDO_FLAG_DEFER_CHECK_IDLE (1 << 16)
49 #define USBHUB_FDO_FLAG_WAKEUP_START (1 << 17)
50 #define USBHUB_FDO_FLAG_MULTIPLE_TTS (1 << 18) // High-speed Operating Hub with Multiple TTs
51 #define USBHUB_FDO_FLAG_ENUM_POST_RECOVER (1 << 19)
52 #define USBHUB_FDO_FLAG_DO_ENUMERATION (1 << 20)
53 #define USBHUB_FDO_FLAG_CHECK_IDLE_LOCK (1 << 21)
54 #define USBHUB_FDO_FLAG_HIBERNATE_STATE (1 << 22)
55 #define USBHUB_FDO_FLAG_NOT_ENUMERATED (1 << 23)
56 #define USBHUB_FDO_FLAG_DO_SUSPENSE (1 << 24)
57 #define USBHUB_FDO_FLAG_GOING_IDLE (1 << 25)
58 #define USBHUB_FDO_FLAG_DEVICE_SUSPENDED (1 << 26)
59 #define USBHUB_FDO_FLAG_WITEM_INIT (1 << 27)
60 
61 #define USBHUB_PDO_FLAG_HUB_DEVICE (1 << 0)
62 #define USBHUB_PDO_FLAG_MULTI_INTERFACE (1 << 1)
63 #define USBHUB_PDO_FLAG_INIT_PORT_FAILED (1 << 2)
64 #define USBHUB_PDO_FLAG_PORT_LOW_SPEED (1 << 3)
65 #define USBHUB_PDO_FLAG_REMOTE_WAKEUP (1 << 4)
66 #define USBHUB_PDO_FLAG_WAIT_WAKE (1 << 5)
67 #define USBHUB_PDO_FLAG_NOT_CONNECTED (1 << 6)
68 #define USBHUB_PDO_FLAG_DELETE_PENDING (1 << 7)
69 #define USBHUB_PDO_FLAG_POWER_D3 (1 << 8)
70 #define USBHUB_PDO_FLAG_DEVICE_STARTED (1 << 9)
71 #define USBHUB_PDO_FLAG_HS_USB1_DUALMODE (1 << 10)
72 #define USBHUB_PDO_FLAG_REG_DEV_INTERFACE (1 << 11) // SymbolicLink
73 #define USBHUB_PDO_FLAG_PORT_RESTORE_FAIL (1 << 12)
74 #define USBHUB_PDO_FLAG_POWER_D1_OR_D2 (1 << 13)
75 #define USBHUB_PDO_FLAG_OVERCURRENT_PORT (1 << 14)
76 #define USBHUB_PDO_FLAG_REMOVING_PORT_PDO (1 << 15)
77 #define USBHUB_PDO_FLAG_INSUFFICIENT_PWR (1 << 16)
78 #define USBHUB_PDO_FLAG_ALLOC_BNDW_FAILED (1 << 18)
79 #define USBHUB_PDO_FLAG_PORT_RESSETING (1 << 19)
80 #define USBHUB_PDO_FLAG_IDLE_NOTIFICATION (1 << 22)
81 #define USBHUB_PDO_FLAG_PORT_HIGH_SPEED (1 << 23)
82 #define USBHUB_PDO_FLAG_ENUMERATED (1 << 26)
83 
84 #define USBHUB_ENUM_FLAG_DEVICE_PRESENT 0x01
85 #define USBHUB_ENUM_FLAG_GHOST_DEVICE 0x02
86 
87 /* Hub Class Feature Selectors */
88 #define USBHUB_FEATURE_USBHUB_FEATURE_C_HUB_LOCAL_POWER 0
89 #define USBHUB_FEATURE_C_HUB_OVER_CURRENT 1
90 
91 #define USBHUB_FEATURE_PORT_CONNECTION 0
92 #define USBHUB_FEATURE_PORT_ENABLE 1
93 #define USBHUB_FEATURE_PORT_SUSPEND 2
94 #define USBHUB_FEATURE_PORT_OVER_CURRENT 3
95 #define USBHUB_FEATURE_PORT_RESET 4
96 #define USBHUB_FEATURE_PORT_POWER 8
97 #define USBHUB_FEATURE_PORT_LOW_SPEED 9
98 #define USBHUB_FEATURE_C_PORT_CONNECTION 16
99 #define USBHUB_FEATURE_C_PORT_ENABLE 17
100 #define USBHUB_FEATURE_C_PORT_SUSPEND 18
101 #define USBHUB_FEATURE_C_PORT_OVER_CURRENT 19
102 #define USBHUB_FEATURE_C_PORT_RESET 20
103 #define USBHUB_FEATURE_PORT_TEST 21
104 #define USBHUB_FEATURE_PORT_INDICATOR 22
105 
106 #define USBHUB_MAX_CASCADE_LEVELS 6
107 #define USBHUB_RESET_PORT_MAX_RETRY 3
108 #define USBHUB_MAX_REQUEST_ERRORS 3
109 
110 
111 #define USBHUB_FAIL_NO_FAIL 5
112 #define USBHUB_FAIL_NESTED_TOO_DEEPLY 6
113 #define USBHUB_FAIL_OVERCURRENT 7
114 
116 
117 typedef struct _USBHUB_PORT_DATA {
123 
125 
126 typedef VOID
128  IN PUSBHUB_FDO_EXTENSION HubExtension,
129  IN PVOID Context);
130 
131 typedef struct _USBHUB_IO_WORK_ITEM {
141 
142 typedef struct _COMMON_DEVICE_EXTENSION {
146 
147 typedef struct _USBHUB_FDO_EXTENSION {
172  PVOID SCEBitmap; // 11.12.4 Hub and Port Status Change Bitmap (USB 2.0 Specification)
198  USB_IDLE_CALLBACK_INFO IdleCallbackInfo;
202 
215  LPWSTR SerialNumber; // serial number string
236 
245 
251 
252 typedef struct _USBHUB_IDLE_HUB_CONTEXT {
256 
262 
267 
273 
274 /* debug.c */
275 VOID
276 NTAPI
279 
280 VOID
281 NTAPI
283  IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor);
284 
285 VOID
286 NTAPI
288  IN PVOID Id);
289 
290 /* ioctl.c */
291 NTSTATUS
292 NTAPI
294  IN PUSBHUB_FDO_EXTENSION HubExtension,
295  IN PIRP Irp);
296 
297 NTSTATUS
298 NTAPI
300  IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
301  IN PIRP Irp);
302 
303 /* pnp.c */
304 NTSTATUS
305 NTAPI
307  IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
308  IN PUSBHUB_FDO_EXTENSION HubExtension);
309 
310 NTSTATUS
311 NTAPI
313  IN PUSBHUB_FDO_EXTENSION HubExtension,
314  IN PIRP Irp,
315  IN UCHAR Minor);
316 
317 NTSTATUS
318 NTAPI
320  IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
321  IN PIRP Irp,
322  IN UCHAR Minor,
323  OUT BOOLEAN * IsCompleteIrp);
324 
325 /* power.c */
326 VOID
327 NTAPI
329  IN PUSBHUB_FDO_EXTENSION HubExtension,
330  IN PIRP Irp,
331  IN NTSTATUS NtStatus);
332 
333 NTSTATUS
334 NTAPI
336  IN PUSBHUB_FDO_EXTENSION HubExtension);
337 
338 NTSTATUS
339 NTAPI
341  IN PUSBHUB_FDO_EXTENSION HubExtension,
342  IN PIRP Irp,
343  IN UCHAR Minor);
344 
345 NTSTATUS
346 NTAPI
348  IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
349  IN PIRP Irp,
350  IN UCHAR Minor);
351 
352 VOID
353 NTAPI
355  IN PUSBHUB_FDO_EXTENSION HubExtension,
356  IN NTSTATUS NtStatus);
357 
358 VOID
359 NTAPI
361  IN PUSBHUB_FDO_EXTENSION HubExtension,
362  IN PIRP Irp);
363 
364 VOID
365 NTAPI
367  IN PUSBHUB_FDO_EXTENSION HubExtension,
368  IN PVOID Context);
369 
370 /* usbhub.c */
371 NTSTATUS
372 NTAPI
373 USBH_Wait(
374  IN ULONG Milliseconds);
375 
376 VOID
377 NTAPI
379  IN PIRP Irp,
380  IN NTSTATUS CompleteStatus);
381 
382 NTSTATUS
383 NTAPI
386  IN PIRP Irp);
387 
389 NTAPI
390 PdoExt(
392 
393 NTSTATUS
394 NTAPI
397  IN ULONG Data);
398 
399 NTSTATUS
400 NTAPI
404  IN PVOID Data,
405  IN ULONG DataSize,
406  IN ULONG Type,
408 
409 NTSTATUS
410 NTAPI
413  IN PURB Urb);
414 
415 NTSTATUS
416 NTAPI
418  IN PDEVICE_OBJECT FdoDevice,
419  IN PURB Urb);
420 
421 NTSTATUS
422 NTAPI
424  IN PUSBHUB_FDO_EXTENSION HubExtension,
425  IN USHORT Port);
426 
427 NTSTATUS
428 NTAPI
430  IN PUSBHUB_FDO_EXTENSION HubExtension,
432  OUT USB_DEVICE_TYPE * OutDeviceType);
433 
435 NTAPI
437  IN PUSBHUB_FDO_EXTENSION HubExtension);
438 
439 NTSTATUS
440 NTAPI
443  IN OUT PDEVICE_OBJECT * OutPdo1,
444  IN OUT PDEVICE_OBJECT * OutPdo2);
445 
446 NTSTATUS
447 NTAPI
450  IN OUT PULONG OutHubCount);
451 
453 NTAPI
456 
457 NTSTATUS
458 NTAPI
461  IN PUSB_DEVICE_DESCRIPTOR HubDeviceDescriptor);
462 
463 NTSTATUS
464 NTAPI
467  IN PUSB_CONFIGURATION_DESCRIPTOR * pConfigurationDescriptor);
468 
469 NTSTATUS
470 NTAPI
472  IN PUSBHUB_FDO_EXTENSION HubExtension);
473 
474 NTSTATUS
475 NTAPI
478  IN UCHAR Index,
479  IN USHORT LanguageId,
482  IN PULONG OutLength,
483  IN BOOLEAN IsValidateLength);
484 
485 NTSTATUS
486 NTAPI
488  IN PUSBHUB_FDO_EXTENSION HubExtension,
489  IN USHORT Port,
491  IN ULONG Length);
492 
493 NTSTATUS
494 NTAPI
496  IN PUSBHUB_FDO_EXTENSION HubExtension,
497  IN USHORT Port,
498  IN USHORT RequestValue);
499 
500 NTSTATUS
501 NTAPI
503  IN PUSBHUB_FDO_EXTENSION HubExtension);
504 
505 NTSTATUS
506 NTAPI
508  IN PUSBHUB_FDO_EXTENSION HubExtension,
509  IN USHORT Port);
510 
511 BOOLEAN
512 NTAPI
515  IN PUSB_CONFIGURATION_DESCRIPTOR HubConfigDescriptor);
516 
517 NTSTATUS
518 NTAPI
520  IN PUSBHUB_FDO_EXTENSION HubExtension);
521 
522 NTSTATUS
523 NTAPI
525  IN PUSBHUB_FDO_EXTENSION HubExtension,
526  IN PUSB_DEVICE_HANDLE * OutDeviceHandle,
527  IN USB_PORT_STATUS UsbPortStatus,
528  IN USHORT Port);
529 
530 NTSTATUS
531 NTAPI
533  IN PUSBHUB_FDO_EXTENSION HubExtension,
535  IN ULONG Flags);
536 
537 NTSTATUS
538 NTAPI
540  IN PUSBHUB_FDO_EXTENSION HubExtension,
546 
547 VOID
548 NTAPI
550  IN PUSBHUB_FDO_EXTENSION HubExtension,
553 
554 VOID
555 NTAPI
557  IN PUSBHUB_FDO_EXTENSION HubExtension);
558 
559 NTSTATUS
560 NTAPI
562  IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
563  IN PUSBHUB_FDO_EXTENSION HubExtension,
564  IN PUSB_NODE_CONNECTION_INFORMATION_EX Info,
565  IN ULONG Length,
567 
568 NTSTATUS
569 NTAPI
571  IN PUSBHUB_FDO_EXTENSION HubExtension,
574 
575 NTSTATUS
576 NTAPI
578  IN PUSBHUB_FDO_EXTENSION HubExtension,
579  OUT PUSBHUB_IO_WORK_ITEM * OutHubIoWorkItem,
582  OUT PVOID * OutHubWorkItemBuffer,
584 
585 VOID
586 NTAPI
588  IN PUSBHUB_FDO_EXTENSION HubExtension,
589  IN PUSBHUB_IO_WORK_ITEM HubIoWorkItem);
590 
591 VOID
592 NTAPI
594  IN PUSBHUB_IO_WORK_ITEM HubIoWorkItem);
595 
596 NTSTATUS
597 NTAPI
599  IN PUSBHUB_FDO_EXTENSION HubExtension);
600 
601 NTSTATUS
602 NTAPI
604  IN PUSBHUB_FDO_EXTENSION HubExtension);
605 
606 VOID
607 NTAPI
609  IN PUSBHUB_FDO_EXTENSION HubExtension,
610  IN PIRP IdleIrp);
611 
612 BOOLEAN
613 NTAPI
615  IN PUSBHUB_FDO_EXTENSION HubExtension,
616  IN BOOLEAN IsWait,
617  IN BOOLEAN IsExtCheck);
618 
619 VOID
620 NTAPI
622  IN PUSBHUB_FDO_EXTENSION HubExtension);
623 
624 VOID
625 NTAPI
627  IN PUSBHUB_FDO_EXTENSION HubExtension);
628 
629 NTSTATUS
630 NTAPI
633  IN USHORT LanguageId);
634 
635 NTSTATUS
636 NTAPI
638  IN PUSBHUB_FDO_EXTENSION HubExtension,
639  IN USHORT Port,
640  IN USB_PORT_STATUS UsbPortStatus,
641  IN ULONG IsWait);
642 
643 NTSTATUS
644 NTAPI
646  IN PUSBHUB_FDO_EXTENSION HubExtension,
647  IN USHORT Port,
648  IN BOOLEAN IsKeepDeviceData,
649  IN BOOLEAN IsWait);
650 
651 NTSTATUS
652 NTAPI
656 
657 #endif /* _USBHUB_H_ */
enum _USB_DEVICE_TYPE USB_DEVICE_TYPE
PUSBHUB_FDO_EXTENSION HubExtension
Definition: usbhub.h:137
_Out_opt_ PULONG Minor
Definition: cmfuncs.h:44
KSEMAPHORE HubPortSemaphore
Definition: usbhub.h:184
NTSTATUS NTAPI USBH_DeviceControl(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
Definition: ioctl.c:1130
VOID NTAPI USBHUB_DumpingIDs(IN PVOID Id)
Definition: debug.c:112
struct _USBHUB_IDLE_HUB_CONTEXT USBHUB_IDLE_HUB_CONTEXT
CPPORT Port[4]
Definition: headless.c:34
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
PUSB_DEVICE_HANDLE DeviceHandle
Definition: usbhub.h:211
NTSTATUS NTAPI USBH_GetConfigurationDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PUSB_CONFIGURATION_DESCRIPTOR *pConfigurationDescriptor)
Definition: usbhub.c:974
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: beep.c:367
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR _Inout_ PULONG _Out_writes_bytes_to_ ConfigDescriptorBufferLength PUCHAR ConfigDescriptorBuffer
Definition: hubbusif.h:151
NTSTATUS NTAPI USBH_AllocateWorkItem(IN PUSBHUB_FDO_EXTENSION HubExtension, OUT PUSBHUB_IO_WORK_ITEM *OutHubIoWorkItem, IN PUSBHUB_WORKER_ROUTINE WorkerRoutine, IN SIZE_T BufferLength, OUT PVOID *OutHubWorkItemBuffer, IN WORK_QUEUE_TYPE Type)
NTSTATUS NTAPI USBD_UnRegisterRootHubCallBack(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:2927
DEVICE_POWER_STATE DeviceWake
Definition: usbhub.h:159
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
NTSTATUS NTAPI USBH_GetDeviceType(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_DEVICE_HANDLE DeviceHandle, OUT USB_DEVICE_TYPE *OutDeviceType)
Definition: usbhub.c:608
NTSTATUS NTAPI USBH_FdoPower(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp, IN UCHAR Minor)
Definition: power.c:460
struct _USBHUB_STATUS_CHANGE_CONTEXT * PUSBHUB_STATUS_CHANGE_CONTEXT
WORK_QUEUE_TYPE HubWorkItemType
Definition: usbhub.h:136
Type
Definition: Type.h:6
struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST SCEWorkerUrb
Definition: usbhub.h:175
PUSBHUB_FDO_EXTENSION HubExtension
Definition: usbhub.h:249
NTSTATUS NTAPI USBD_RestoreDeviceEx(IN PUSBHUB_FDO_EXTENSION HubExtension, IN OUT PUSB_DEVICE_HANDLE OldDeviceHandle, IN OUT PUSB_DEVICE_HANDLE NewDeviceHandle)
Definition: usbhub.c:2680
NTSTATUS NTAPI USBH_ResetDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN BOOLEAN IsKeepDeviceData, IN BOOLEAN IsWait)
Definition: usbhub.c:4534
VOID(NTAPI * PUSBHUB_WORKER_ROUTINE)(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PVOID Context)
Definition: usbhub.h:127
_In_ PIRP Irp
Definition: csq.h:116
USB_IDLE_CALLBACK_INFO IdleCallbackInfo
Definition: usbhub.h:198
uint16_t * PWSTR
Definition: typedefs.h:54
USB_PORT_STATUS_AND_CHANGE PortStatus
Definition: usbhub.h:118
_In_ ULONG DevInstKeyType
Definition: iofuncs.h:1123
unsigned char * PUCHAR
Definition: retypes.h:3
struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION
NTSTATUS NTAPI USBH_SyncDisablePort(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port)
Definition: usbhub.c:1502
_Must_inspect_result_ _In_ PFLT_CALLBACK_DATA _In_ PFLT_DEFERRED_IO_WORKITEM_ROUTINE WorkerRoutine
Definition: fltkernel.h:1977
PUSBHUB_FDO_EXTENSION HubExtension
Definition: usbhub.h:209
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI USBD_RemoveDeviceEx(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_DEVICE_HANDLE DeviceHandle, IN ULONG Flags)
Definition: usbhub.c:2457
UNICODE_STRING SymbolicLinkName
Definition: usbhub.h:207
NTSTATUS NTAPI USBD_InitializeDeviceEx(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_DEVICE_HANDLE DeviceHandle, IN PUCHAR DeviceDescriptorBuffer, IN ULONG DeviceDescriptorBufferLength, IN PUCHAR ConfigDescriptorBuffer, IN ULONG ConfigDescriptorBufferLength)
Definition: usbhub.c:2481
struct _USBHUB_FDO_EXTENSION USBHUB_FDO_EXTENSION
struct _USBHUB_IDLE_PORT_CONTEXT * PUSBHUB_IDLE_PORT_CONTEXT
USB_CONFIGURATION_DESCRIPTOR ConfigDescriptor
Definition: usbhub.h:218
DEVICE_CAPABILITIES
Definition: iotypes.h:927
NTSTATUS NTAPI USBH_HubSetD0(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: power.c:77
USB_CONNECTION_STATUS ConnectionStatus
Definition: usbhub.h:120
NTSTATUS NTAPI USBH_PdoInternalControl(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp)
Definition: ioctl.c:1274
PUSBHUB_IO_WORK_ITEM WorkItemToQueue
Definition: usbhub.h:197
NTSTATUS NTAPI USBH_CreateDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN USB_PORT_STATUS UsbPortStatus, IN ULONG IsWait)
Definition: usbhub.c:4298
VOID NTAPI USBH_HubCancelIdleIrp(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP IdleIrp)
Definition: usbhub.c:3125
struct COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE
VOID NTAPI USBH_CheckIdleDeferred(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:3876
struct TraceInfo Info
PWSTR GenericUSBDeviceString
Definition: usbhub.c:19
VOID NTAPI USBH_HubCompletePortWakeIrps(IN PUSBHUB_FDO_EXTENSION HubExtension, IN NTSTATUS NtStatus)
Definition: power.c:217
DWORD Id
struct _USBHUB_FDO_EXTENSION * PUSBHUB_FDO_EXTENSION
Definition: usbhub.h:124
PDEVICE_OBJECT DeviceObject
Definition: usbhub.h:119
LIST_ENTRY WorkItemList
Definition: usbhub.h:190
NTSTATUS NTAPI USBH_PdoPnP(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp, IN UCHAR Minor, OUT BOOLEAN *IsCompleteIrp)
Definition: pnp.c:2587
_Inout_ PUSB_DEVICE_HANDLE OldDeviceHandle
Definition: hubbusif.h:161
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
POWER_STATE CurrentPowerState
Definition: usbhub.h:222
NTSTATUS NTAPI USBH_GetDeviceDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PUSB_DEVICE_DESCRIPTOR HubDeviceDescriptor)
Definition: usbhub.c:877
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ PVOID _In_ PDEVICE_OBJECT UsbDevicePdo
Definition: hubbusif.h:321
NTSTATUS NTAPI USBH_SetPdoRegistryParameter(IN PDEVICE_OBJECT DeviceObject, IN PCWSTR SourceString, IN PVOID Data, IN ULONG DataSize, IN ULONG Type, IN ULONG DevInstKeyType)
Definition: usbhub.c:213
VOID NTAPI USBHUB_DumpingConfiguration(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor)
Definition: debug.c:41
struct _USBHUB_URB_TIMEOUT_CONTEXT USBHUB_URB_TIMEOUT_CONTEXT
KSEMAPHORE IdleSemaphore
Definition: usbhub.h:177
NTSTATUS NTAPI USBH_PdoRemoveDevice(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: pnp.c:2173
unsigned int BOOL
Definition: ntddk_ex.h:94
USB_BUS_INTERFACE_HUB_V5 BusInterface
Definition: usbhub.h:155
long LONG
Definition: pedump.c:60
PUSBHUB_FDO_EXTENSION NTAPI USBH_GetRootHubExtension(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:699
_In_ ULONG BufferLength
Definition: usbdlib.h:225
PDEVICE_OBJECT RootHubPdo2
Definition: usbhub.h:152
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR DeviceDescriptorBuffer
Definition: hubbusif.h:148
SYSTEM_POWER_STATE SystemWake
Definition: usbhub.h:158
NTSTATUS NTAPI USBH_FdoSyncSubmitUrb(IN PDEVICE_OBJECT FdoDevice, IN PURB Urb)
Definition: usbhub.c:355
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
NTSTATUS NTAPI USBH_SyncClearPortStatus(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN USHORT RequestValue)
Definition: usbhub.c:1391
NTSTATUS NTAPI USBH_SyncPowerOnPorts(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:1471
unsigned char BOOLEAN
PVOID HubWorkItemBuffer
Definition: usbhub.h:139
NTSTATUS NTAPI USBD_RegisterRootHubCallBack(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:2905
BOOLEAN NTAPI USBH_HubIsBusPowered(IN PDEVICE_OBJECT DeviceObject, IN PUSB_CONFIGURATION_DESCRIPTOR HubConfigDescriptor)
Definition: usbhub.c:1538
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS NTAPI USBH_SyncGetHubDescriptor(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:1048
NTSTATUS NTAPI USBH_SyncGetPortStatus(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN PUSB_PORT_STATUS_AND_CHANGE PortStatus, IN ULONG Length)
Definition: usbhub.c:1363
NTSTATUS NTAPI USBH_PdoPower(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp, IN UCHAR Minor)
Definition: power.c:757
LONG PendingRequestCount
Definition: usbhub.h:180
PUSBHUB_WORKER_ROUTINE HubWorkerRoutine
Definition: usbhub.h:138
KSPIN_LOCK PortPowerListSpinLock
Definition: usbhub.h:234
USB_DEVICE_DESCRIPTOR DeviceDescriptor
Definition: usbhub.h:216
KEVENT StatusChangeEvent
Definition: usbhub.h:176
NTSTATUS NTAPI USBH_CheckDeviceLanguage(IN PDEVICE_OBJECT DeviceObject, IN USHORT LanguageId)
Definition: usbhub.c:4161
NTSTATUS NTAPI USBH_SyncResetPort(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port)
Definition: usbhub.c:471
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
struct _USBHUB_STATUS_CHANGE_CONTEXT USBHUB_STATUS_CHANGE_CONTEXT
NTSTATUS NTAPI USBH_FdoPnP(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp, IN UCHAR Minor)
Definition: pnp.c:2355
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257
KEVENT LowerDeviceEvent
Definition: usbhub.h:153
struct _USBHUB_IO_WORK_ITEM * PUSBHUB_IO_WORK_ITEM
DEVICE_POWER_STATE DeviceState[POWER_SYSTEM_MAXIMUM]
Definition: usbhub.h:157
__wchar_t WCHAR
Definition: xmlstorage.h:180
VOID NTAPI USBH_HubCancelWakeIrp(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
Definition: power.c:43
POWER_STATE SystemPowerState
Definition: usbhub.h:161
PIO_WORKITEM HubWorkItem
Definition: usbhub.h:135
USB_PORT_STATUS_AND_CHANGE PortStatus
Definition: usbhub.h:199
PDEVICE_OBJECT LowerDevice
Definition: usbhub.h:150
NTSTATUS NTAPI USBH_SubmitStatusChangeTransfer(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:2361
static const UCHAR Index[8]
Definition: usbohci.c:18
USB_DEVICE_DESCRIPTOR OldDeviceDescriptor
Definition: usbhub.h:217
NTSTATUS NTAPI USBH_SyncGetHubCount(IN PDEVICE_OBJECT DeviceObject, IN OUT PULONG OutHubCount)
Definition: usbhub.c:781
PRKEVENT pResetPortEvent
Definition: usbhub.h:183
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
USB_BUS_INTERFACE_USBDI_V2 BusInterfaceUSBDI
Definition: usbhub.h:156
NTSTATUS NTAPI USBH_PassIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: usbhub.c:79
NTSTATUS NTAPI USBH_WriteFailReasonID(IN PDEVICE_OBJECT DeviceObject, IN ULONG Data)
Definition: usbhub.c:153
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR _Inout_ PULONG DeviceDescriptorBufferLength
Definition: hubbusif.h:148
enum _WORK_QUEUE_TYPE WORK_QUEUE_TYPE
KEVENT PendingRequestEvent
Definition: usbhub.h:181
KSPIN_LOCK CheckIdleSpinLock
Definition: usbhub.h:192
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _USBHUB_IDLE_PORT_CANCEL_CONTEXT USBHUB_IDLE_PORT_CANCEL_CONTEXT
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1869
VOID NTAPI USBH_CompletePowerIrp(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp, IN NTSTATUS NtStatus)
Definition: power.c:18
Definition: ketypes.h:687
#define VOID
Definition: acefi.h:82
NTSTATUS NTAPI USBD_GetDeviceInformationEx(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_NODE_CONNECTION_INFORMATION_EX Info, IN ULONG Length, IN PUSB_DEVICE_HANDLE DeviceHandle)
Definition: usbhub.c:2558
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR _Inout_ PULONG _Out_writes_bytes_to_ ConfigDescriptorBufferLength PUCHAR _Inout_ PULONG ConfigDescriptorBufferLength
Definition: hubbusif.h:151
PUSB_DEVICE_HANDLE NTAPI USBH_SyncGetDeviceHandle(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:832
Definition: typedefs.h:117
KSPIN_LOCK UrbTimeoutSpinLock
Definition: usbhub.h:242
VOID NTAPI USBH_QueueWorkItem(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSBHUB_IO_WORK_ITEM HubIoWorkItem)
Definition: usbhub.c:2836
struct _USBHUB_IDLE_HUB_CONTEXT * PUSBHUB_IDLE_HUB_CONTEXT
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:40
PUSB_CONFIGURATION_DESCRIPTOR HubConfigDescriptor
Definition: usbhub.h:165
KSPIN_LOCK PortTimeoutSpinLock
Definition: usbhub.h:226
LIST_ENTRY PdoList
Definition: usbhub.h:179
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
LIST_ENTRY HubWorkItemLink
Definition: usbhub.h:133
LIST_ENTRY PortPowerList
Definition: usbhub.h:233
ULONG_PTR SIZE_T
Definition: typedefs.h:78
PUSB_HUB_DESCRIPTOR HubDescriptor
Definition: usbhub.h:166
KSPIN_LOCK WorkItemSpinLock
Definition: usbhub.h:191
POWER_STATE CurrentPowerState
Definition: usbhub.h:160
USB_DEVICE_DESCRIPTOR HubDeviceDescriptor
Definition: usbhub.h:163
USBD_PIPE_INFORMATION PipeInfo
Definition: usbhub.h:169
struct _USBHUB_PORT_PDO_EXTENSION USBHUB_PORT_PDO_EXTENSION
NTSTATUS NTAPI USBH_SyncGetRootHubPdo(IN PDEVICE_OBJECT DeviceObject, IN OUT PDEVICE_OBJECT *OutPdo1, IN OUT PDEVICE_OBJECT *OutPdo2)
Definition: usbhub.c:728
PDEVICE_OBJECT LowerPDO
Definition: usbhub.h:149
Definition: usb.h:529
VOID NTAPI USBHUB_DumpingDeviceDescriptor(IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor)
Definition: debug.c:15
unsigned short USHORT
Definition: pedump.c:61
KSEMAPHORE HubSemaphore
Definition: usbhub.h:196
enum _USB_CONNECTION_STATUS USB_CONNECTION_STATUS
VOID NTAPI USBH_CompleteIrp(IN PIRP Irp, IN NTSTATUS CompleteStatus)
Definition: usbhub.c:63
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
NTSTATUS NTAPI USBD_CreateDeviceEx(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_DEVICE_HANDLE *OutDeviceHandle, IN USB_PORT_STATUS UsbPortStatus, IN USHORT Port)
Definition: usbhub.c:2427
NTSTATUS NTAPI USBH_SyncSubmitUrb(IN PDEVICE_OBJECT DeviceObject, IN PURB Urb)
Definition: usbhub.c:250
unsigned int * PULONG
Definition: retypes.h:1
BOOLEAN NTAPI USBH_CheckIdleAbort(IN PUSBHUB_FDO_EXTENSION HubExtension, IN BOOLEAN IsWait, IN BOOLEAN IsExtCheck)
Definition: usbhub.c:3140
struct _USBHUB_IDLE_PORT_CANCEL_CONTEXT * PUSBHUB_IDLE_PORT_CANCEL_CONTEXT
PDEVICE_OBJECT RootHubPdo
Definition: usbhub.h:151
struct _USBHUB_IDLE_PORT_CONTEXT USBHUB_IDLE_PORT_CONTEXT
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:148
VOID NTAPI USBHUB_SetDeviceHandleData(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PDEVICE_OBJECT UsbDevicePdo, IN PVOID DeviceHandle)
Definition: usbhub.c:2520
struct _USBHUB_RESET_PORT_CONTEXT * PUSBHUB_RESET_PORT_CONTEXT
KSEMAPHORE ResetDeviceSemaphore
Definition: usbhub.h:182
USBD_CONFIGURATION_HANDLE ConfigHandle
Definition: usbhub.h:168
struct _USBHUB_URB_TIMEOUT_CONTEXT * PUSBHUB_URB_TIMEOUT_CONTEXT
VOID NTAPI USBH_CheckHubIdle(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:3727
#define OUT
Definition: typedefs.h:39
PDEVICE_OBJECT SelfDevice
Definition: usbhub.h:144
struct _USBHUB_PORT_DATA USBHUB_PORT_DATA
struct _USBHUB_PORT_PDO_EXTENSION * PUSBHUB_PORT_PDO_EXTENSION
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:997
struct tagContext Context
Definition: acpixf.h:1012
KEVENT RootHubNotificationEvent
Definition: usbhub.h:174
unsigned int ULONG
Definition: retypes.h:1
PUSBHUB_FDO_EXTENSION RootHubExtension
Definition: usbhub.h:210
PUSBHUB_PORT_PDO_EXTENSION PortExtension
Definition: usbhub.h:270
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
_Outptr_ PUSB_DEVICE_HANDLE * NewDeviceHandle
Definition: hubbusif.h:40
KSPIN_LOCK RelationsWorkerSpinLock
Definition: usbhub.h:178
DEVICE_CAPABILITIES Capabilities
Definition: usbhub.h:223
VOID NTAPI USBH_IdleCancelPowerHubWorker(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PVOID Context)
Definition: power.c:135
VOID NTAPI USBHUB_FlushAllTransfers(IN PUSBHUB_FDO_EXTENSION HubExtension)
Definition: usbhub.c:2542
PUSBHUB_PORT_DATA PortData
Definition: usbhub.h:167
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID NTAPI USBH_FreeWorkItem(IN PUSBHUB_IO_WORK_ITEM HubIoWorkItem)
Definition: usbhub.c:2856
struct _USBHUB_IO_WORK_ITEM USBHUB_IO_WORK_ITEM
struct _USBHUB_RESET_PORT_CONTEXT USBHUB_RESET_PORT_CONTEXT
#define POWER_SYSTEM_MAXIMUM
Definition: ntpoapi.h:45
NTSTATUS NTAPI USBH_Wait(IN ULONG Milliseconds)
Definition: usbhub.c:23
NTSTATUS NTAPI USBH_SyncGetStringDescriptor(IN PDEVICE_OBJECT DeviceObject, IN UCHAR Index, IN USHORT LanguageId, IN PUSB_STRING_DESCRIPTOR Descriptor, IN ULONG NumberOfBytes, IN PULONG OutLength, IN BOOLEAN IsValidateLength)
Definition: usbhub.c:1248
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
struct _USBHUB_PORT_DATA * PUSBHUB_PORT_DATA
ULONG PortAttributes
Definition: usbhub.h:121
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor
Definition: usbhub.h:219
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966