ReactOS 0.4.17-dev-1371-g303d27d
ucxstub.c File Reference
#include <ntddk.h>
#include <windef.h>
#include <fxldr.h>
#include <wdf.h>
#include <ucxclass.h>
#include "ucxstub.h"
#include <debug.h>
Include dependency graph for ucxstub.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define UCX_STUB_MAJOR_VERSION   1
 
#define UCX_STUB_MINOR_VERSION   6
 

Functions

 _IRQL_requires_ (PASSIVE_LEVEL)
 Sends a synchronous IOCTL to the specified device object.
 

Variables

WDF_BIND_INFO BindInfo
 
PWDF_DRIVER_GLOBALS WdfDriverGlobals
 
PFN_UCXFUNC UcxFunctions [UcxFunctionTableNumEntries]
 
PUCX_DRIVER_GLOBALS UcxDriverGlobals
 
static WDF_CLASS_BIND_INFO UcxStubClassBindInfo
 
static BOOLEAN UcxStubBound
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 20 of file ucxstub.c.

◆ UCX_STUB_MAJOR_VERSION

#define UCX_STUB_MAJOR_VERSION   1

Definition at line 24 of file ucxstub.c.

◆ UCX_STUB_MINOR_VERSION

#define UCX_STUB_MINOR_VERSION   6

Definition at line 25 of file ucxstub.c.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

Parameters
[in]IoControlCodeThe IOCTL to send to the device.
[in]DeviceObjectPointer to the device object that will handle the IOCTL.
[in]InputBufferOptional pointer to a buffer containing input data for the IOCTL. When specified, the buffer should be at least of InputBufferLength size.
[in]InputBufferLengthSize in bytes, of the buffer pointed by InputBuffer.
[out]OutputBufferOptional pointer to a buffer that will receive output data from the IOCTL. When specified, the buffer should be at least of OutputBufferLength size.
[in]OutputBufferLengthSize in bytes, of the buffer pointed by OutputBuffer.
[in]FileObjectOptional pointer to a file object that may be necessary for the IOCTL.
Returns
An NTSTATUS code indicating success or failure of this function.
Note
Must be called at PASSIVE_LEVEL with all APCs enabled.

Nothing is found unless the PCI bus driver publishes the properties.

The root hub name without its prefix; NULL when the PDO has no name.

Grows a private buffer to what the helper asks for.

Lets KMDF handle the IRP, then hands it back here still uncompleted.

Waits for the device machine to answer a PnP or power event; returns the PnP status.

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

One 4 byte value; the registry type is not checked.

Reread whenever user experience settings change; the open status is returned.

Sends a synchronous IOCTL to the specified device object.

STATUS_SUCCESS when the caller's token is an administrator's.

Sends a synchronous IOCTL to the specified device object.

Reads one value of a walk. A missing value only clears Present; FALSE means stop.

Reads up to Size bytes of a value into a zeroed buffer; the type is not checked.

Writes a REG_BINARY value into the device's usbflags subkey.

Sets or clears ExtPropertiesInstalled from ExtPropDescSemaphore in the hardware key.

Fails only when a port cannot be bound to the USB4 host router its ACPI node names.

Assigns device, hardware, compatible, container and instance ids to a new child PDO.

Answers IRP_MN_QUERY_DEVICE_TEXT on a child PDO; always completes the IRP.

Takes the connector map lock, needed around HubConnectorFindCompanion.

Device hardware key values read at PDO prepare hardware.

Saves the MS OS 2.0 set info in usbflags when the set asks for alternate enumeration.

MsOs20Flags and EnumerationRetryCount, written at PDO start.

Rereads the UXD record; UpdateRequired says whether the device id changes.

Replacement PnP id of a UXD reserved device, or an empty String. Always succeeds.

Telemetry values under the device's Ceip subkey.

BootPathSurpriseRemovalCount + 1.

This machine's dual role features for a dual role partner.

Tells UCX the WDM PDO of the device; call right after the child PDO was created.

IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME: Argument1 and its length Argument2.

IOCTL_INTERNAL_USB_GET_BUS_INFO for the device: the 16 byte USB_BUS_NOTIFICATION at Argument1.

Registers the GUID_USB_WMI_NODE_INFO instance of a child PDO (not for hubs or composites).

Registers the boot device surprise removal event on an external, non hub boot PDO.

Fires the boot device surprise removal event, if one is registered.

Sends a synchronous IOCTL to the specified device object.

Publishes "<port>#<host>" for every bound port on the hub's PDO. QUIRK: with no bound port an older value is left in place.

Binds USB 3 ports to the host routers named by the USB4 DVSEC; an earlier ACPI mapping wins.

Waits on a PnP handshake event with no timeout, printing a watchdog line every minute so a stuck machine is visible in the debugger.

Copies up to Size bytes of a device property; a failed query leaves the field zero.

Only the controller name length is real; both bandwidth fields read 0.

The answer overlays a USB_HUB_NAME on TotalSize, so TotalSize comes back as the name length + 4.

Evaluates a method without arguments into Output.

Drops every MSI descriptor and keeps only lists that still offer a line interrupt.

Picks the list with the best MSI offer: MSI-X first, then the most messages.

Keeps message descriptors covering Wanted messages and removes the others.

Evaluates _DSM on the controller ACPI object with a buffer as Arg3; returns up to 8 result bytes, 0 on failure.

Lets UCX hook the controller device init. Call before WdfDeviceCreate.

Definition at line 37 of file ucxstub.c.

41{
44
45 PAGED_CODE();
46
47 if (UcxStubBound)
48 return STATUS_SUCCESS;
49
50 RtlZeroMemory(Info, sizeof(*Info));
51 Info->Size = sizeof(*Info);
52 Info->ClassName = (PWCHAR)L"Ucx";
53 Info->Version.Major = UCX_STUB_MAJOR_VERSION;
54 Info->Version.Minor = UCX_STUB_MINOR_VERSION;
55 Info->FunctionTable = UcxFunctions;
56 Info->FunctionTableCount = UcxFunctionTableNumEntries;
57 Info->ClassBindInfo = &UcxDriverGlobals;
58
59 /* Typed as PWDF_COMPONENT_GLOBALS*, but clients pass the globals pointer itself */
61 if (!NT_SUCCESS(Status))
62 {
63 DPRINT1("UCX class bind failed 0x%lx\n", Status);
64 return Status;
65 }
66
68 return STATUS_SUCCESS;
69}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
Status
Definition: gdiplustypes.h:24
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
@ UcxFunctionTableNumEntries
Definition: ucxfuncenum.h:37
PFN_UCXFUNC UcxFunctions[UcxFunctionTableNumEntries]
Definition: ucxstub.c:31
PWDF_DRIVER_GLOBALS WdfDriverGlobals
Definition: classlib.cpp:114
static BOOLEAN UcxStubBound
Definition: ucxstub.c:35
#define UCX_STUB_MAJOR_VERSION
Definition: ucxstub.c:24
static WDF_CLASS_BIND_INFO UcxStubClassBindInfo
Definition: ucxstub.c:34
#define UCX_STUB_MINOR_VERSION
Definition: ucxstub.c:25
PUCX_DRIVER_GLOBALS UcxDriverGlobals
Definition: ucxstub.c:32
WDF_BIND_INFO BindInfo
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
NTSTATUS NTAPI WdfVersionBindClass(_In_ PWDF_BIND_INFO BindInfo, _Inout_ PWDF_COMPONENT_GLOBALS *Globals, _In_ PWDF_CLASS_BIND_INFO ClassBindInfo)
Definition: wdfldr.c:794

Variable Documentation

◆ BindInfo

◆ UcxDriverGlobals

◆ UcxFunctions

Definition at line 31 of file ucxstub.c.

Referenced by _IRQL_requires_().

◆ UcxStubBound

BOOLEAN UcxStubBound
static

Definition at line 35 of file ucxstub.c.

Referenced by _IRQL_requires_().

◆ UcxStubClassBindInfo

WDF_CLASS_BIND_INFO UcxStubClassBindInfo
static

Definition at line 34 of file ucxstub.c.

Referenced by _IRQL_requires_().

◆ WdfDriverGlobals