ReactOS 0.4.17-dev-1281-g065abb3
hostctl.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS USB Host Controller Extension
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: UCXCONTROLLER creation, exports and lifetime
5 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
6 */
7
8#include "ucx01000.h"
9
10#define NDEBUG
11#include <debug.h>
12
15 _In_ UCXCONTROLLER Handle)
16{
17 return UcxGetControllerContext(Handle);
18}
19
22 _In_ WDFDEVICE Fdo)
23{
24 return UcxGetFdoContext(Fdo)->Controller;
25}
26
28static
33{
34 return Size == UCX_CONFIG_SIZE_V1 ||
37}
38
43 _In_ WDFDEVICE Device,
46 _Out_ UCXCONTROLLER* Controller)
47{
48 UCX_CONTROLLER_CONFIG FullConfig;
49 WDF_OBJECT_ATTRIBUTES FdoAttributes;
50 WDF_OBJECT_ATTRIBUTES UcxAttributes;
52 UcxFdoContext* FdoContext;
56
57 PAGED_CODE();
58
60 {
61 DPRINT1("Controller create rejected, config %p size %lu\n", Config, Config != NULL ? Config->Size : 0);
63 }
64
65 /* The two dump callbacks come as a pair */
66 if ((Config->Reserved3 == NULL) != (Config->Reserved4 == NULL))
67 {
68 DPRINT1("Controller create rejected, only one dump callback given\n");
70 }
71
72 if (Attributes != NULL && Attributes->ParentObject != NULL)
73 {
74 DPRINT1("Controller create rejected, HCD attributes name a parent\n");
76 }
77
78 /* Older configs are upgraded: fields the HCD did not know about stay zero */
79 UCX_CONTROLLER_CONFIG_INIT(&FullConfig, "");
80 RtlCopyMemory(&FullConfig, Config, Config->Size);
81 FullConfig.Size = sizeof(FullConfig);
82
84 Status = WdfObjectAllocateContext(Device, &FdoAttributes, (PVOID*)&FdoContext);
85 if (!NT_SUCCESS(Status))
86 {
87 DPRINT1("Controller FDO %p context allocation failed 0x%lx\n", Device, Status);
88 return Status;
89 }
90
92
95
96 /* The HCD's attributes come first when given; parent and level are UCX's choice */
97 Primary = (Attributes != NULL) ? Attributes : &UcxAttributes;
98 Primary->ParentObject = Device;
100
102 (Attributes != NULL) ? &UcxAttributes : NULL,
103 &Object);
104 if (!NT_SUCCESS(Status))
105 return Status;
106
107 Context = new (UcxGetControllerContext(Object)) UcxController();
108 Context->m_Handle = (UCXCONTROLLER)Object;
109 FdoContext->Controller = Context;
110
111 Status = Context->Initialize(Globals, Device, &FullConfig);
112 if (!NT_SUCCESS(Status))
113 {
115 return Status;
116 }
117
118 *Controller = Context->m_Handle;
119 DPRINT("Controller %p created on FDO %p, bus type %d\n", Context, Device, FullConfig.ParentBusType);
120 return STATUS_SUCCESS;
121}
122
126 _In_ WDFDEVICE Fdo,
128{
129 PDEVICE_OBJECT FdoObject;
131
132 m_Fdo = Fdo;
133 m_Config = *Config;
135
139
140 FdoObject = WdfDeviceWdmGetDeviceObject(Fdo);
141
145
148
151
153 m_Failed = 0;
157
158 m_DriverVerifierEnabled = MmIsDriverVerifying(FdoObject->DriverObject) != 0 ||
159 (Globals->WdfDriverGlobals->DriverFlags & WdfVerifyOn) != 0;
160
162 if (!NT_SUCCESS(Status))
163 return Status;
164
173
174 Status = WdfDeviceCreateDeviceInterface(Fdo, &GUID_DEVINTERFACE_USB_HOST_CONTROLLER, NULL);
175 if (!NT_SUCCESS(Status))
176 {
177 DPRINT1("Controller %p host controller interface create failed 0x%lx\n", this, Status);
178 return Status;
179 }
180
181 {
183
185 StringAttributes.ParentObject = m_Handle;
186
188 if (!NT_SUCCESS(Status))
189 {
190 DPRINT1("Controller %p interface string create failed 0x%lx\n", this, Status);
191 return Status;
192 }
193
194 Status = WdfDeviceRetrieveDeviceInterfaceString(Fdo,
195 &GUID_DEVINTERFACE_USB_HOST_CONTROLLER,
196 NULL,
198 if (!NT_SUCCESS(Status))
199 {
200 DPRINT1("Controller %p interface name query failed 0x%lx\n", this, Status);
201 return Status;
202 }
203
204 /* Kept past the parent's cleanup; dropped in Destroy */
206 }
207
209 if (!NT_SUCCESS(Status))
210 return Status;
211
213 if (!NT_SUCCESS(Status))
214 {
215 DPRINT1("Controller %p WMI registration failed 0x%lx\n", this, Status);
216 return Status;
217 }
218
226
227 {
228 SpinLockGuard Guard(&UcxDriver.ControllerListLock);
229
230 InsertTailList(&UcxDriver.ControllerList, &m_DriverListEntry);
231 UcxDriver.ControllerCount++;
232 }
233
234 return STATUS_SUCCESS;
235}
236
240{
241 WDF_REQUEST_SEND_OPTIONS SendOptions;
244 WDFIOTARGET Target;
245 WDFREQUEST Request;
247
248 Target = WdfDeviceGetIoTarget(m_Fdo);
249
250 Status = WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, Target, &Request);
251 if (!NT_SUCCESS(Status))
252 {
253 DPRINT1("Controller %p capabilities request create failed 0x%lx\n", this, Status);
254 return Status;
255 }
256
257 /* PnP IRPs must start out as not supported */
259 Status = WdfRequestReuse(Request, &ReuseParams);
260 if (NT_SUCCESS(Status))
261 {
263 m_HcCaps.Size = sizeof(m_HcCaps);
264 m_HcCaps.Version = 1;
265 m_HcCaps.Address = MAXULONG;
266 m_HcCaps.UINumber = MAXULONG;
267
268 RtlZeroMemory(&Stack, sizeof(Stack));
269 Stack.MajorFunction = IRP_MJ_PNP;
270 Stack.MinorFunction = IRP_MN_QUERY_CAPABILITIES;
271 Stack.Parameters.DeviceCapabilities.Capabilities = &m_HcCaps;
272 WdfRequestWdmFormatUsingStackLocation(Request, &Stack);
273
274 /* A send that fails to go out still records its status in the request */
276 WdfRequestSend(Request, Target, &SendOptions);
277 Status = WdfRequestGetStatus(Request);
278 }
279
281
282 if (!NT_SUCCESS(Status))
283 DPRINT1("Controller %p query capabilities failed 0x%lx\n", this, Status);
284
285 return Status;
286}
287
290{
291 WDF_WMI_PROVIDER_CONFIG ProviderConfig;
293
294 WDF_WMI_PROVIDER_CONFIG_INIT(&ProviderConfig, &GUID_USB_WMI_NODE_INFO);
296 InstanceConfig.Register = TRUE;
297 InstanceConfig.EvtWmiInstanceQueryInstance = UcxEvtWmiNodeInfoQueryInstance;
298
300}
301
303static
305NTAPI
308{
309 if (String == NULL || (String->Length % sizeof(WCHAR)) != 0)
310 return FALSE;
311
312 if (String->Length > MAXUSHORT - sizeof(UNICODE_NULL))
313 return FALSE;
314
315 return String->Length == 0 || String->Buffer != NULL;
316}
317
319static
321NTAPI
325{
326 USHORT Size = Source->Length + sizeof(UNICODE_NULL);
327
329 if (Copy->Buffer == NULL)
330 {
331 Copy->Length = 0;
332 Copy->MaximumLength = 0;
334 }
335
336 RtlCopyMemory(Copy->Buffer, Source->Buffer, Source->Length);
337 Copy->Buffer[Source->Length / sizeof(WCHAR)] = UNICODE_NULL;
338 Copy->Length = Source->Length;
339 Copy->MaximumLength = Size;
340
341 return STATUS_SUCCESS;
342}
343
344static
345VOID
346NTAPI
349{
350 if (String->Buffer != NULL)
352
353 RtlZeroMemory(String, sizeof(*String));
354}
355
356VOID
359{
360 UcxGetControllerContext(Object)->Destroy();
361}
362
363VOID
365{
366 if (m_WorkerThread != NULL)
367 {
368 {
370
373 }
374
378 }
379
381 {
384 }
386
388
389 /* A create that failed early never linked the entry */
390 {
391 SpinLockGuard Guard(&UcxDriver.ControllerListLock);
392
394 {
396 UcxDriver.ControllerCount--;
397 }
399 }
400
402 {
405 }
406
410}
411
412/* Exports */
413
414VOID
416{
417 DPRINT1("Controller %p reports it needs a reset\n", this);
418 PostResetEvent(CrEvent::ControllerNeedsReset);
419}
420
421VOID
424{
425 if (Info->UcxControllerState == UcxControllerStateLost)
427
429
430 DPRINT("Controller %p reset complete, state %d\n", this, Info->UcxControllerState);
431 PostResetEvent(CrEvent::ControllerResetDone);
432
433 /* While the root hub is out of D0 the machine releases this thread when done */
436}
437
438VOID
440{
441 if (InterlockedCompareExchange(&m_Failed, 1, 0) != 0)
442 return;
443
444 DPRINT1("Controller %p marked failed by the HCD\n", this);
445
446 /* Tear the tree down first so the purges recurse on one stack */
448
449 PostResetEvent(CrEvent::ControllerLost);
450}
451
454 _In_ PUNICODE_STRING Manufacturer,
455 _In_ PUNICODE_STRING ModelName,
456 _In_ PUNICODE_STRING ModelNumber)
457{
459
460 /* Only a non empty manufacturer counts as already set */
461 if (m_ManufacturerName.Length != 0)
462 {
463 DPRINT1("Controller %p ID strings already set\n", this);
465 }
466
467 if (!UcxIsValidIdString(Manufacturer) || !UcxIsValidIdString(ModelName) || !UcxIsValidIdString(ModelNumber))
468 {
469 DPRINT1("Controller %p ID strings malformed\n", this);
471 }
472
473 /* An earlier call with an empty manufacturer may have left copies behind */
477
478 Status = UcxCopyIdString(Manufacturer, &m_ManufacturerName);
479 if (NT_SUCCESS(Status))
480 Status = UcxCopyIdString(ModelName, &m_ModelName);
481 if (NT_SUCCESS(Status))
482 Status = UcxCopyIdString(ModelNumber, &m_ModelNumber);
483
484 if (!NT_SUCCESS(Status))
485 {
486 DPRINT1("Controller %p ID string copy failed 0x%lx\n", this, Status);
490 return Status;
491 }
492
493 return STATUS_SUCCESS;
494}
495
496/* No hub IOCTL pends for these notifications yet, so there is nobody to tell */
497VOID
500{
501 UNREFERENCED_PARAMETER(Characteristics);
502}
503
504/* Reset references */
505
508{
510
512 {
513 UnblockReset();
514 return FALSE;
515 }
516
517 return TRUE;
518}
519
521VOID
523{
524 ULONG Generation = m_ResetGeneration;
525
527 return;
528
529 {
531
532 if (m_ResetInitiated || Generation != m_ResetGeneration)
533 return;
534
536 }
537
538 PostResetEvent(CrEvent::ResetBlocksCleared);
539}
540
541VOID
543{
545
548}
549
550VOID
552{
554
558
559 /* The controller's own reference comes back */
561}
562
566{
568 ULONG Frame;
569
571 {
572 DPRINT1("Controller %p has no frame number callback\n", this);
575 }
576
577 if (!BlockReset())
578 {
580 return STATUS_SUCCESS;
581 }
582
583 Frame = m_CachedFrameNumber;
585 UnblockReset();
586
587 if (!NT_SUCCESS(Status))
588 {
589 /* The caller still gets whatever the HCD left in the buffer */
590 DPRINT1("Controller %p frame number query failed 0x%lx\n", this, Status);
591 }
592 else if (Frame == MAXULONG)
593 {
594 /* All ones means the HCD is not in D0; report the cached frame */
595 DPRINT("Controller %p has no frame number, reporting cached frame %lu\n", this, m_CachedFrameNumber);
596 Frame = m_CachedFrameNumber;
597 }
598 else
599 {
600 m_CachedFrameNumber = Frame;
601 }
602
603 *FrameNumber = Frame;
604 return Status;
605}
606
607/* Capability queries */
608
611{
613
615 return FALSE;
616
618 m_Handle,
619 (PGUID)&GUID_USB_CAPABILITY_CLEAR_TT_BUFFER_ON_ASYNC_TRANSFER_CANCEL,
620 0,
621 NULL,
622 &ResultLength));
623}
624
627{
628 USHORT StreamCount = 0;
631
633 return FALSE;
634
636 (PGUID)&GUID_USB_CAPABILITY_STATIC_STREAMS,
637 sizeof(StreamCount),
638 &StreamCount,
639 &ResultLength);
640
641 return NT_SUCCESS(Status) && StreamCount > 0;
642}
643
644/* Hub interface functions that act on the controller */
645
646VOID
648 _In_ UCXUSBDEVICE Hub)
649{
650 UcxAddress0QueueContext* Context = UcxGetAddress0QueueContext(m_Address0Queue);
651
652 /* A mismatched hub is only a checked build complaint; the release still happens */
653 NT_ASSERT(Context->OwnerHub == Hub);
655
656 Context->OwnerHub = NULL;
657 Context->OwnerDevice = NULL;
658
659 WdfIoQueueStart(m_Address0Queue);
660}
661
665{
667
668 PAGED_CODE();
669
671 if (NT_SUCCESS(Status))
672 Context->PowerReferenceAcquired = TRUE;
673 else
674 DPRINT1("Controller %p stop idle failed 0x%lx\n", this, Status);
675
676 return Status;
677}
678
679VOID
682{
683 if (!Context->PowerReferenceAcquired)
684 return;
685
687 Context->PowerReferenceAcquired = FALSE;
688}
689
691VOID
694 _In_ BOOLEAN Grown)
695{
698
699 if (Grown)
700 {
702
703 RtlZeroMemory(Out, sizeof(*Out));
704 Out->Type = m_Config.ParentBusType;
705 Pci = &Out->Pci;
706 Acpi = &Out->Acpi;
707 }
708 else
709 {
711
712 RtlZeroMemory(Out, sizeof(*Out));
713 Out->Type = m_Config.ParentBusType;
714 Pci = &Out->Pci;
715 Acpi = &Out->Acpi;
716 }
717
719 *Pci = m_Config.PciDeviceInfo;
721 *Acpi = m_Config.AcpiDeviceInfo;
722}
723
724/* Forward progress */
725
728UcxController::EnableForwardProgress(
730{
731 PFN_UCX_HCD_ENABLE_FORWARD_PROGRESS HcdEnable;
734
735 PAGED_CODE();
736
738
739 /* The thread stays even when a later step fails */
741
743 {
744 HcdEnable = HcdEnableForwardProgress();
745 if (HcdEnable != NULL)
746 {
747 Status = HcdEnable(m_Handle);
748 if (NT_SUCCESS(Status))
750 else
751 DPRINT1("Controller %p HCD forward progress enable failed 0x%lx\n", this, Status);
752 }
753 }
754
755 if (NT_SUCCESS(Status))
756 {
757 Device = UcxUsbDevice::FromHandle(Info->Device);
758 if (Device->IsRootHub())
760 else
761 Status = Device->EnableForwardProgress(Info);
762
763 if (!NT_SUCCESS(Status))
764 DPRINT1("Controller %p forward progress for device %p failed 0x%lx\n", this, Device, Status);
765 }
766
768 return Status;
769}
770
773{
775 HANDLE ThreadHandle;
777
779
780 Status = PsCreateSystemThread(&ThreadHandle,
783 NULL,
784 NULL,
786 this);
787 if (!NT_SUCCESS(Status))
788 {
789 DPRINT1("Controller %p system thread create failed 0x%lx\n", this, Status);
790 return Status;
791 }
792
793 Status = ObReferenceObjectByHandle(ThreadHandle,
794 0,
795 NULL,
798 NULL);
799 ZwClose(ThreadHandle);
800
801 if (!NT_SUCCESS(Status))
802 {
803 DPRINT1("Controller %p system thread reference failed 0x%lx\n", this, Status);
805 }
806
807 return Status;
808}
809
810VOID
813{
815
816 InsertTailList(&m_WorkerItems, &WorkItem->ThreadQueueEntry);
818}
819
821VOID
822NTAPI
824 _In_ PVOID StartContext)
825{
826 UcxController* Controller = (UcxController*)StartContext;
828
829 for (;;)
830 {
831 if (KeReadStateEvent(&Controller->m_WorkerWake) == 0)
832 Controller->m_WorkerParked = TRUE;
833
835 NT_ASSERT(Controller->m_RootHubInD0 || Controller->m_WorkerExit);
836 Controller->m_WorkerParked = FALSE;
837
838 {
839 SpinLockGuard Guard(&Controller->m_WorkerLock);
840
841 if (Controller->m_WorkerExit)
842 {
843 NT_ASSERT(IsListEmpty(&Controller->m_WorkerItems));
844 break;
845 }
846
847 NT_ASSERT(!IsListEmpty(&Controller->m_WorkerItems));
848 Entry = RemoveHeadList(&Controller->m_WorkerItems);
849 if (IsListEmpty(&Controller->m_WorkerItems))
850 KeClearEvent(&Controller->m_WorkerWake);
851 }
852
853 CONTAINING_RECORD(Entry, UcxWorkItem, ThreadQueueEntry)->Run();
854 }
855
857}
#define PAGED_CODE()
unsigned char BOOLEAN
Definition: actypes.h:127
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
HubFdo * Hub
Definition: bootdev.cpp:261
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
VOID Initialize(_In_ UcxController *Controller)
Definition: crsm.cpp:80
BOOLEAN m_ResetInitiated
Definition: hostctl.h:329
WDFDEVICE m_Fdo
Definition: hostctl.h:288
KMUTEX m_ForwardProgressMutex
Definition: hostctl.h:346
BOOLEAN BlockReset()
Definition: hostctl.cpp:507
VOID SetFailed()
Definition: hostctl.cpp:439
ULONG m_ResetGeneration
Definition: hostctl.h:326
PFN_UCX_HCD_ENABLE_FORWARD_PROGRESS HcdEnableForwardProgress() const
Definition: hostctl.h:269
KEVENT m_ResetCompleteProcessed
Definition: hostctl.h:319
static UcxController * FromFdo(_In_ WDFDEVICE Fdo)
Definition: hostctl.cpp:21
VOID PostResetEvent(_In_ CrEvent Event)
Definition: hostctl.h:200
NTSTATUS QueryHcCapabilities()
Definition: hostctl.cpp:239
static _Must_inspect_result_ NTSTATUS Create(_In_ PUCX_DRIVER_GLOBALS Globals, _In_ WDFDEVICE Device, _In_ PUCX_CONTROLLER_CONFIG Config, _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes, _Out_ UCXCONTROLLER *Controller)
Definition: hostctl.cpp:41
NTSTATUS StopIdle(_Inout_ PUCXHUB_STOP_IDLE_CONTEXT Context)
Definition: hostctl.cpp:663
UNICODE_STRING m_ModelNumber
Definition: hostctl.h:358
VOID NotifyTransportCharacteristicsChange(_In_ PUCX_CONTROLLER_TRANSPORT_CHARACTERISTICS Characteristics)
Definition: hostctl.cpp:498
VOID GetInfo(_Out_ PVOID Info, _In_ BOOLEAN Grown)
Definition: hostctl.cpp:692
LONG m_UsbdInterfaceCount
Definition: hostctl.h:349
UcxRootHub * m_RootHub
Definition: hostctl.h:302
VOID ResumeIdle(_Inout_ PUCXHUB_STOP_IDLE_CONTEXT Context)
Definition: hostctl.cpp:680
VOID Destroy()
Definition: hostctl.cpp:364
BOOLEAN m_WaitOnResetComplete
Definition: hostctl.h:322
NTSTATUS Initialize(_In_ PUCX_DRIVER_GLOBALS Globals, _In_ WDFDEVICE Fdo, _In_ const UCX_CONTROLLER_CONFIG *Config)
Definition: hostctl.cpp:124
LIST_ENTRY m_WorkerItems
Definition: hostctl.h:341
BOOLEAN m_ResetInProgress
Definition: hostctl.h:328
NTSTATUS SetIdStrings(_In_ PUNICODE_STRING Manufacturer, _In_ PUNICODE_STRING ModelName, _In_ PUNICODE_STRING ModelNumber)
Definition: hostctl.cpp:453
PKTHREAD m_WorkerThread
Definition: hostctl.h:342
VOID QueueOnWorkerThread(_In_ UcxWorkItem *WorkItem)
Definition: hostctl.cpp:811
NTSTATUS StartWorkerThread()
Definition: hostctl.cpp:772
ULONG m_ChildEndpointCount
Definition: hostctl.h:312
UCX_CONTROLLER_CONFIG m_Config
Definition: hostctl.h:289
static UcxController * FromHandle(_In_ UCXCONTROLLER Handle)
Definition: hostctl.cpp:14
ControllerResetMachine m_ResetMachine
Definition: hostctl.h:314
LONG m_RootHubResetSeen
Definition: hostctl.h:321
KSPIN_LOCK m_AbortPipeCsqLock
Definition: hostctl.h:307
BOOLEAN m_WorkerExit
Definition: hostctl.h:345
VOID MarkResetFinished()
Definition: hostctl.cpp:551
KSPIN_LOCK m_WorkerLock
Definition: hostctl.h:340
WDFREQUEST m_PendingTreePurge
Definition: hostctl.h:352
WDFQUEUE m_Address0Queue
Definition: hostctl.h:293
BOOLEAN QueryStreamsSupported()
Definition: hostctl.cpp:626
IO_CSQ m_AbortPipeCsq
Definition: hostctl.h:306
VOID MarkResetInProgress()
Definition: hostctl.cpp:542
KSPIN_LOCK m_ResetLock
Definition: hostctl.h:325
UNICODE_STRING m_ModelName
Definition: hostctl.h:357
VOID NeedsReset()
Definition: hostctl.cpp:415
BOOLEAN m_ResetMachineReady
Definition: hostctl.h:315
NTSTATUS GetCurrentFrameNumber(_Out_ PULONG FrameNumber)
Definition: hostctl.cpp:564
UNICODE_STRING m_ManufacturerName
Definition: hostctl.h:356
KSPIN_LOCK m_TopologyLock
Definition: hostctl.h:310
VOID ResetComplete(_In_ PUCX_CONTROLLER_RESET_COMPLETE_INFO Info)
Definition: hostctl.cpp:422
BOOLEAN m_WorkerParked
Definition: hostctl.h:344
KEVENT m_WorkerWake
Definition: hostctl.h:343
BOOLEAN m_HcdReservedIoReady
Definition: hostctl.h:347
LONG m_PendingTreePurgeEndpoints
Definition: hostctl.h:353
DEVICE_CAPABILITIES m_HcCaps
Definition: hostctl.h:303
LONG m_ResetBlockCount
Definition: hostctl.h:327
LONG m_DeviceContextsLost
Definition: hostctl.h:320
static EVT_WDF_OBJECT_CONTEXT_DESTROY EvtDestroy
Definition: hostctl.h:377
VOID UnblockReset()
Definition: hostctl.cpp:522
ULONG m_CachedFrameNumber
Definition: hostctl.h:333
UCXCONTROLLER m_Handle
Definition: hostctl.h:287
BOOLEAN m_DriverVerifierEnabled
Definition: hostctl.h:336
VOID Address0Release(_In_ UCXUSBDEVICE Hub)
Definition: hostctl.cpp:647
static KSTART_ROUTINE WorkerThreadRoutine
Definition: hostctl.h:386
NTSTATUS RegisterWmi()
Definition: hostctl.cpp:289
LONG m_Failed
Definition: hostctl.h:330
LIST_ENTRY m_DriverListEntry
Definition: hostctl.h:290
KEVENT m_RootHubMayExitD0
Definition: hostctl.h:318
ULONG m_ChildDeviceCount
Definition: hostctl.h:311
BOOLEAN QueryClearTtBufferOnCancel()
Definition: hostctl.cpp:610
WDFSTRING m_HostControllerInterfaceName
Definition: hostctl.h:300
UcxWorkItem * m_ResetMachineWorkItem
Definition: hostctl.h:316
NTSTATUS CreateQueues()
Definition: hostqueues.cpp:58
UcxUsbDevice * Device() const
Definition: rhub.h:71
NTSTATUS EnableForwardProgress()
Definition: rhub.h:90
VOID DisconnectPort(_In_ ULONG PortNumber)
Definition: devobj.cpp:440
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
NTKERNELAPI NTSTATUS NTAPI IoCsqInitialize(_Out_ PIO_CSQ Csq, _In_ PIO_CSQ_INSERT_IRP CsqInsertIrp, _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp, _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp, _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock, _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock, _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp)
Set up a CSQ struct to initialize the queue.
Definition: csq.c:103
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
PLIST_ENTRY Entry
Definition: devhcd.cpp:1262
ULONG Copy
Definition: devhcd.cpp:1449
@ Out
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
InitializeListHead & UcxDriver
Definition: driver.cpp:138
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
LOGICAL NTAPI MmIsDriverVerifying(IN PDRIVER_OBJECT DriverObject)
Definition: drvmgmt.c:212
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
LONG NTAPI KeReadStateEvent(IN PKEVENT Event)
Definition: eventobj.c:121
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:24
static BOOLEAN NTAPI UcxIsValidIdString(_In_opt_ PCUNICODE_STRING String)
Definition: hostctl.cpp:306
static VOID NTAPI UcxFreeIdString(_Inout_ PUNICODE_STRING String)
Definition: hostctl.cpp:347
static NTSTATUS NTAPI UcxCopyIdString(_In_ PCUNICODE_STRING Source, _Out_ PUNICODE_STRING Copy)
Definition: hostctl.cpp:322
static BOOLEAN NTAPI UcxIsAcceptedConfigSize(_In_ ULONG Size)
Definition: hostctl.cpp:31
IO_CSQ_REMOVE_IRP UcxCsqRemoveAbortIrp
Definition: hostctl.h:403
IO_CSQ_COMPLETE_CANCELED_IRP UcxCsqCompleteCanceledAbortIrp
Definition: hostctl.h:407
IO_CSQ_INSERT_IRP UcxCsqInsertAbortIrp
Definition: hostctl.h:402
IO_CSQ_RELEASE_LOCK UcxCsqReleaseAbortLock
Definition: hostctl.h:406
IO_CSQ_PEEK_NEXT_IRP UcxCsqPeekAbortIrp
Definition: hostctl.h:404
#define UCX_CONFIG_SIZE_V3
Definition: hostctl.h:44
#define UCX_CONFIG_SIZE_V4
Definition: hostctl.h:45
#define UCX_CONFIG_SIZE_V1
Definition: hostctl.h:43
IO_CSQ_ACQUIRE_LOCK UcxCsqAcquireAbortLock
Definition: hostctl.h:405
ZwClose(Handle)
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
struct _UCXHUB_CONTROLLER_INFO_V2 * PUCXHUB_CONTROLLER_INFO_V2
_In_opt_ PVOID _In_ PUCXHUB_WORKITEM WorkItem
Definition: hubucx.h:227
#define UCXHUB_WORKITEM_NO_FLAGS
Definition: hubucx.h:211
struct _UCXHUB_CONTROLLER_INFO * PUCXHUB_CONTROLLER_INFO
return WdfWmiInstanceCreate(Device, &Config, Attributes, Instance)
#define InterlockedCompareExchange
Definition: interlocked.h:119
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define KernelMode
Definition: asm.h:38
#define _Inout_
Definition: no_sal2.h:162
#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 THREAD_ALL_ACCESS
Definition: nt_native.h:1342
WCHAR * PWCH
Definition: ntbasedef.h:422
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
@ NotificationEvent
@ SynchronizationEvent
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1181
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:626
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
UcxController * Controller
Definition: hostctl.h:100
Definition: typedefs.h:120
static PUCXHUB_WORKITEM Allocate(_In_ UcxController *Controller, _In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG Flags)
Definition: workitem.cpp:16
UCX_CONTROLLER_ACPI_INFORMATION AcpiDeviceInfo
UCX_CONTROLLER_PCI_INFORMATION PciDeviceInfo
PFN_UCX_CONTROLLER_QUERY_USB_CAPABILITY EvtControllerQueryUsbCapability
PFN_UCX_CONTROLLER_GET_CURRENT_FRAMENUMBER EvtControllerGetCurrentFrameNumber
UCX_CONTROLLER_PARENT_BUS_TYPE ParentBusType
WDFOBJECT ParentObject
Definition: wdfobject.h:130
WDF_EXECUTION_LEVEL ExecutionLevel
Definition: wdfobject.h:120
PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback
Definition: wdfobject.h:115
#define MAXULONG
Definition: typedefs.h:251
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MAXUSHORT
Definition: typedefs.h:83
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_Out_ PULONG FrameNumber
Definition: ucxcontroller.h:94
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXCONTROLLER * Controller
_In_ PGUID _In_ ULONG _Out_ PULONG ResultLength
Definition: ucxcontroller.h:83
@ UcxControllerParentBusTypePci
Definition: ucxcontroller.h:17
@ UcxControllerParentBusTypeAcpi
Definition: ucxcontroller.h:18
FORCEINLINE VOID NTAPI UCX_CONTROLLER_CONFIG_INIT(_Out_ PUCX_CONTROLLER_CONFIG Config, _In_ LPCSTR DeviceDescription)
@ UcxControllerStateLost
Definition: ucxcontroller.h:24
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
WDF_EXTERN_C_START struct _UCX_DRIVER_GLOBALS * PUCX_DRIVER_GLOBALS
_Must_inspect_result_ NTSTATUS NTAPI UcxCreateObjectWithTwoContexts(_In_ PWDF_OBJECT_ATTRIBUTES Primary, _In_opt_ PWDF_OBJECT_ATTRIBUTES Secondary, _Out_ WDFOBJECT *Object)
Definition: ucxutil.cpp:19
FORCEINLINE BOOLEAN NTAPI UcxIsListEntryLinked(_In_ const LIST_ENTRY *Entry)
Definition: ucxutil.h:94
FORCEINLINE VOID NTAPI UcxClearListEntry(_Out_ PLIST_ENTRY Entry)
Definition: ucxutil.h:84
#define UCX_POOL_TAG
Definition: ucxutil.h:11
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
WdfObjectDelete(String)
EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE UcxEvtWmiNodeInfoQueryInstance
Definition: userreq.h:21
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
#define WdfDeviceStopIdle(Device, WaitForD0)
Definition: wdfdevice.h:1977
_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_ WDFSTRING String
Definition: wdfdevice.h:2439
#define WdfDeviceResumeIdle(Device)
Definition: wdfdevice.h:1983
@ WdfVerifyOn
Definition: wdfdriver.h:53
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
#define WdfObjectDereferenceWithTag(Handle, Tag)
Definition: wdfobject.h:829
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170
@ WdfExecutionLevelPassive
Definition: wdfobject.h:54
#define WdfObjectReferenceWithTag(Handle, Tag)
Definition: wdfobject.h:806
FORCEINLINE NTSTATUS WdfObjectAllocateContext(_In_ WDFOBJECT Handle, _In_ PWDF_OBJECT_ATTRIBUTES ContextAttributes, _Outptr_opt_ PVOID *Context)
Definition: wdfobject.h:587
_Must_inspect_result_ FORCEINLINE BOOLEAN WdfRequestSend(_In_ WDFREQUEST Request, _In_ WDFIOTARGET Target, _In_opt_ PWDF_REQUEST_SEND_OPTIONS Options)
Definition: wdfrequest.h:677
_In_ WDFREQUEST _In_ PWDF_REQUEST_REUSE_PARAMS ReuseParams
Definition: wdfrequest.h:554
FORCEINLINE VOID WDF_REQUEST_SEND_OPTIONS_INIT(_Out_ PWDF_REQUEST_SEND_OPTIONS Options, _In_ ULONG Flags)
Definition: wdfrequest.h:409
@ WDF_REQUEST_SEND_OPTION_SYNCHRONOUS
Definition: wdfrequest.h:109
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
@ WDF_REQUEST_REUSE_NO_FLAGS
Definition: wdfrequest.h:92
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
FORCEINLINE VOID WDF_REQUEST_REUSE_PARAMS_INIT(_Out_ PWDF_REQUEST_REUSE_PARAMS Params, _In_ ULONG Flags, _In_ NTSTATUS Status)
Definition: wdfrequest.h:364
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING _In_opt_ PWDF_OBJECT_ATTRIBUTES StringAttributes
Definition: wdfstring.h:66
#define WDF_NO_HANDLE
Definition: wdftypes.h:107
#define WDF_NO_OBJECT_ATTRIBUTES
Definition: wdftypes.h:105
FORCEINLINE VOID WDF_WMI_PROVIDER_CONFIG_INIT(_Out_ PWDF_WMI_PROVIDER_CONFIG Config, _In_ CONST GUID *Guid)
Definition: wdfwmi.h:205
FORCEINLINE VOID WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER_CONFIG(_Out_ PWDF_WMI_INSTANCE_CONFIG Config, _In_ PWDF_WMI_PROVIDER_CONFIG ProviderConfig)
Definition: wdfwmi.h:286
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG InstanceConfig
Definition: wdfwmi.h:476
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_CAPABILITIES
@ Executive
Definition: ketypes.h:467
#define ObDereferenceObject
Definition: obfuncs.h:203
#define NT_ASSERT
Definition: rtlfuncs.h:3334