ReactOS 0.4.17-dev-1281-g065abb3
childpdo.cpp File Reference
#include "usbhub3.h"
#include "devhcd.h"
#include <debug.h>
Include dependency graph for childpdo.cpp:

Go to the source code of this file.

Classes

struct  HubStartFailHeader
 
struct  HubBillboardHeader
 
struct  HubBillboardMode
 
struct  HubPdoIrpWork
 

Macros

#define NDEBUG
 
#define HUB_PDO_DRIVER_WAIT_TIME   10000
 
#define HUB_URB_FUNCTION_LAST   0x003C
 
#define HUB_URB_FUNCTION_FAST_PATH_1   0x0039
 
#define HUB_URB_FUNCTION_FAST_PATH_2   0x003A
 
#define HUB_URB_FUNCTION_SELECT_LIKE   0x003B
 
#define HUB_MSOS20_SET_INDEX   7
 
#define HUB_USB_BUFFERED_IOCTL(Function)    CTL_CODE(FILE_DEVICE_USB, Function, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
#define HUB_IOCTL_GET_TRANSPORT_CHARACTERISTICS   HUB_USB_BUFFERED_IOCTL(USB_GET_TRANSPORT_CHARACTERISTICS)
 
#define HUB_IOCTL_REGISTER_TRANSPORT_CHANGE   HUB_USB_BUFFERED_IOCTL(USB_REGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE)
 
#define HUB_IOCTL_NOTIFY_TRANSPORT_CHANGE   HUB_USB_BUFFERED_IOCTL(USB_NOTIFY_ON_TRANSPORT_CHARACTERISTICS_CHANGE)
 
#define HUB_IOCTL_UNREGISTER_TRANSPORT_CHANGE   HUB_USB_BUFFERED_IOCTL(USB_UNREGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE)
 
#define HUB_IOCTL_START_TIME_SYNC   HUB_USB_BUFFERED_IOCTL(USB_START_TRACKING_FOR_TIME_SYNC)
 
#define HUB_IOCTL_GET_TIME_SYNC   HUB_USB_BUFFERED_IOCTL(USB_GET_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC)
 
#define HUB_IOCTL_STOP_TIME_SYNC   HUB_USB_BUFFERED_IOCTL(USB_STOP_TRACKING_FOR_TIME_SYNC)
 
#define HUB_IOCTL_GET_DEVICE_CHARACTERISTICS   HUB_USB_BUFFERED_IOCTL(USB_GET_DEVICE_CHARACTERISTICS)
 
#define HUB_TRANSPORT_REGISTRATION_SIZE   (sizeof(ULONG) + sizeof(PVOID) + 24)
 
#define HUB_DEVICE_CHARACTERISTICS_SIZE   0x18
 
#define HUB_STAMPED_HANDLE_OFFSET   4
 
#define HUB_IOCTL_MEDIA_SERIAL_NUMBER   CTL_CODE(FILE_DEVICE_MASS_STORAGE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
#define HUB_START_FAIL_MAX   4096
 
#define HUB_LPM_POLICY_LINK_BITS
 

Typedefs

typedef VOID(NTAPI * PFN_HUB_SET_SYSTEM_WAKE_DEVICE) (_In_ PDEVICE_OBJECT DeviceObject)
 

Enumerations

enum  HubLpmSlot {
  HubLpmU1Enable , HubLpmU2Enable , HubLpmU1Timeout , HubLpmU2Timeout ,
  HubLpmPolicy
}
 

Functions

 C_ASSERT (sizeof(HubBillboardHeader)==4)
 
 C_ASSERT (sizeof(HubBillboardMode)==8)
 
 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME (HubPdoIrpWork, HubGetPdoIrpWork)
 
USBD_STATUS NTAPI HubNtStatusToUsbd (_In_ NTSTATUS Status)
 
static NTSTATUS NTAPI HubUsbdStatusToNt (_In_ USBD_STATUS Status)
 
 _IRQL_requires_ (PASSIVE_LEVEL) NTSTATUS NTAPI HubPdoPostAndWait(_In_ HubChild *Child
 Sends a synchronous IOCTL to the specified device object.
 
Child Post (Event)
 
static NTSTATUS NTAPI HubPdoCompleteIrp (_Inout_ PIRP Irp, _In_ NTSTATUS Status)
 
static NTSTATUS NTAPI HubPdoCompleteAsIs (_Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoPassDown (_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoToController (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoSignalCompletion (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
 
 IoCopyCurrentIrpStackLocationToNext (Irp)
 
 IoSetCompletionRoutine (Irp, HubPdoSignalCompletion, &Event, TRUE, TRUE, TRUE)
 
 WdfDeviceWdmDispatchPreprocessedIrp (Device, Irp)
 
static VOID NTAPI HubD3ColdReference (_In_ PVOID Context)
 
static VOID NTAPI HubD3ColdDereference (_In_ PVOID Context)
 
 if (Pdo->m_AcpiD3Cold.SetD3ColdSupport !=NULL) Pdo -> m_AcpiD3Cold.SetD3ColdSupport(Pdo->m_AcpiD3Cold.Context, D3ColdSupport)
 
 if (D3ColdSupport) Pdo -> m_Child->SetState(ChildState::D3ColdEnabledByDriver)
 
else Pdo m_Child ClearState (ChildState::D3ColdEnabledByDriver)
 
 PAGED_CODE ()
 
 if (Pdo->m_AcpiD3Cold.GetIdleWakeInfo !=NULL)
 
 if (Pdo->m_Hub->m_Capabilities.SystemWake >=SystemPowerState &&(Child->HasProperty(ChildProperty::RemoteWakeCapable)||Child->HasProperty(ChildProperty::IsHub)))
 
 if (Pdo->m_AcpiD3Cold.GetD3ColdCapability==NULL)
 
 if (NT_SUCCESS(Status) &&*D3ColdSupported &&Pdo->m_Child->m_Port->HasProperty(PortProperty::Removable))
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) static VOID NTAPI HubD3ColdGetLastTransition(_In_reads_opt_(_Inexpressible_("varies")) PVOID Context
 
 if (Pdo->m_AcpiD3Cold.GetLastTransitionStatus !=NULL)
 
 if (Pdo->HasFlag(PdoFlag::WasResetAtResume)) *LastTransitionStatus
 
static NTSTATUS NTAPI HubPdoAnswerD3Cold (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoQueryInterface (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
 RtlInitEmptyUnicodeString (SymbolicLinkName, NULL, 0)
 
 if (Pdo->m_SymbolicLink !=NULL) WdfStringGetUnicodeString(Pdo -> m_SymbolicLink, SymbolicLinkName)
 
static BOOLEAN NTAPI HubPdoIsEnhancedSuperSpeed (_In_ HubChild *Child)
 
static NTSTATUS NTAPI HubPdoEvtParentInterfaceQuery (_In_ WDFDEVICE Device, _In_ LPGUID InterfaceType, _Inout_ PINTERFACE ExposedInterface, _Inout_opt_ PVOID ExposedInterfaceSpecificData)
 
 _IRQL_requires_max_ (PASSIVE_LEVEL) static NTSTATUS NTAPI HubPdoGetLocationString(_Inout_opt_ PVOID Context
 
 if (Buffer==NULL)
 
 if (!NT_SUCCESS(Status)) DPRINT1("Location string failed 0x%lx\n"
 
 if (Pdo->HasFlag(PdoFlag::Started)||Stack->Parameters.QueryId.IdType !=BusQueryDeviceID||KeGetCurrentIrql() !=PASSIVE_LEVEL)
 
 HubPdoPreStart (Pdo->m_Child)
 
 WdfDeviceResumeIdle (HubDevice)
 
static NTSTATUS NTAPI HubPdoPreprocessPnp (_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
 
static VOID NTAPI HubPdoEvtCompletePowerIrp (_In_ WDFWORKITEM WorkItem)
 
static NTSTATUS NTAPI HubPdoPowerIrpComplete (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
 
static NTSTATUS NTAPI HubPdoPreprocessSetPower (_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
 
 UNREFERENCED_PARAMETER (ResourcesRaw)
 
 UNREFERENCED_PARAMETER (ResourcesTranslated)
 
 DPRINT ("Child PDO %p on port %u prepare hardware\n", Device, Pdo->m_PortNumber)
 
Pdo SetFlag (PdoFlag::Started)
 
 HubReadDeviceHardwareValues (Child)
 
 if (HubUsb4NeedsHostPower(Child))
 
 HubCacheMsOs20SetInfo (Child)
 
 HubFlushSqmFlags (Child)
 
 HubWriteEnumerationData (Child)
 
 if (Child->HasProperty(ChildProperty::IsHub))
 
 if (Pdo->m_SymbolicLink==NULL)
 
 if (!Pdo->HasFlag(PdoFlag::DeviceGone) &&Child->HasState(ChildState::WorkingDevice)) Pdo -> m_FailRequests=FALSE
 
 if (!Child->HasProperty(ChildProperty::IsHub) &&!Child->HasProperty(ChildProperty::IsComposite)) HubWmiRegisterDevice(Device)
 
 DPRINT ("Child PDO %p on port %u release hardware\n", Device, Pdo->m_PortNumber)
 
Pdo ClearFlag (PdoFlag::Started)
 
 if (Pdo->TestAndClearFlag(PdoFlag::QueryStopped)) return STATUS_SUCCESS
 
 if (Pdo->TestAndClearFlag(PdoFlag::QueryRemoved)) HubPurgeUxdState(Child
 
 if (Child->HasProperty(ChildProperty::DualRole)) Child -> ClearProperty(ChildProperty::DualRole)
 
static NTSTATUS NTAPI HubPdoEvtQueryStop (_In_ WDFDEVICE Device)
 
static NTSTATUS NTAPI HubPdoEvtQueryRemove (_In_ WDFDEVICE Device)
 
static VOID NTAPI HubPdoEvtReportedMissing (_In_ WDFDEVICE Device)
 
 UNREFERENCED_PARAMETER (IoResourceRequirementsList)
 
 if (!Pdo->HasFlag(PdoFlag::Started)) HubPdoPreStart(Pdo -> m_Child)
 
 HubPdoPostAndWait (Pdo->m_Child, DsmEvent::PdoInstallMsOsExt, "PdoInstallMsOsExt")
 
static NTSTATUS NTAPI HubPdoEvtSelfManagedIoStart (_In_ WDFDEVICE Device)
 
static NTSTATUS NTAPI HubPdoEvtSelfManagedIoSuspend (_In_ WDFDEVICE Device)
 
 UNREFERENCED_PARAMETER (PreviousState)
 
 DPRINT ("Child PDO %p on port %u D0 entry from %d\n", Device, Pdo->m_PortNumber,(int) PreviousState)
 
Pdo m_Idle Post (IdleEvent::PoweredUp, NULL)
 
 if (HubUsb4NeedsHostPower(Pdo->m_Child)) DPRINT("Port %u USB4 power component activation is not available\n"
 
 DPRINT ("Child PDO %p on port %u D0 exit to %d, action %d\n", Device, Pdo->m_PortNumber,(int) TargetState,(int) Action)
 
 if (TargetState !=WdfPowerDeviceD3Final &&Action==PowerActionNone) HubRecordSelectiveSuspend(Child)
 
 if (TargetState==WdfPowerDeviceD3Final &&Action==PowerActionNone)
 
 if (WdfTimerStop(Child->m_BandwidthRetryTimer, TRUE))
 
static VOID NTAPI HubPdoIndicateWake (_In_ HubPdo *Pdo)
 
static VOID NTAPI HubPdoWakeNotificationComplete (_In_ WDFREQUEST Request, _In_ WDFIOTARGET Target, _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, _In_ WDFCONTEXT Context)
 
static NTSTATUS NTAPI HubPdoSendWakeNotification (_In_ HubPdo *Pdo)
 
static NTSTATUS NTAPI HubPdoEvtEnableWakeAtBus (_In_ WDFDEVICE Device, _In_ SYSTEM_POWER_STATE PowerState)
 
static NTSTATUS NTAPI HubPdoLpmSettingChanged (_In_ LPCGUID SettingGuid, _In_reads_bytes_(ValueLength) PVOID Value, _In_ ULONG ValueLength, _Inout_opt_ PVOID Context)
 
static NTSTATUS NTAPI HubPdoSyncComplete (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
 
static NTSTATUS NTAPI HubPdoQueueAndWait (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _In_ WDFQUEUE Queue)
 
static NTSTATUS NTAPI HubPdoQueueAsync (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
static VOID NTAPI HubPdoStampUrb (_In_ HubPdo *Pdo, _Inout_ PURB Urb)
 
static NTSTATUS NTAPI HubPdoValidateUrb (_Inout_ PURB Urb)
 
static PVOID NTAPI HubPdoUrbBuffer (_In_ PVOID Pointer, _In_opt_ PMDL Mdl)
 
static NTSTATUS NTAPI HubPdoCachedDescriptor (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
 
static NTSTATUS NTAPI HubPdoMsFeatureDescriptor (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
 
static NTSTATUS NTAPI HubPdoSelectLikeComplete (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
 
static NTSTATUS NTAPI HubPdoForwardSelectLike (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
 
static NTSTATUS NTAPI HubPdoRouteUrb (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
 
static NTSTATUS NTAPI HubPdoGetHubName (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoRecordFailure (_In_ HubPdo *Pdo, _In_opt_ HubStartFailHeader *Data)
 
 if (Info==NULL||Info->Version !=1)
 
 if (Info->Length !=sizeof(*Info))
 
 RtlZeroMemory (Info, sizeof(*Info))
 
 if ((Hub->m_ParentInfo.Flags &HUB_PARENT_HIGH_SPEED_CAPABLE)||Hub->m_ParentInfo.DeviceDescriptor.bcdUSB >=0x0200)
 
 if (Hub->HasFlag(HubFlag::MultiTtHub))
 
 if (Hub->m_Parent.HubSpeed==UsbHighSpeed) Info -> HubFlags.HubIsHighSpeed=1
 
 if (Hub->HasFlag(HubFlag::WakeOnConnect)) Info -> HubFlags.HubIsArmedWakeOnConnect=1
 
 if (Hub->IsRootHub()) Info -> HubFlags.HubIsRoot=1
 
 if (Hub->m_MaxPortPower==100) Info -> HubFlags.HubIsBusPowered=1
 
 if (Child->HasProperty(ChildProperty::UxdReserved))
 
 if (NT_SUCCESS(Status)) Status
 
static NTSTATUS NTAPI HubPdoTopologyAddress (_In_ HubPdo *Pdo, _Out_opt_ PUSB_TOPOLOGY_ADDRESS Address)
 
static VOID NTAPI HubPdoFillHubInfo (_In_ HubPdo *Pdo, _Inout_ HubParentInfo *Info)
 
static NTSTATUS NTAPI HubPdoQueryCapability (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PUCXHUB_QUERY_CAPABILITY Query)
 
static NTSTATUS NTAPI HubPdoCyclePort (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoDispatchIoctl (_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoPreprocessInternalIoctl (_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
 
static NTSTATUS NTAPI HubPdoStampAndForward (_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _In_ ULONG Size)
 
static NTSTATUS NTAPI HubPdoPreprocessIoctl (_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
 
static VOID NTAPI HubPdoEvtIoInternalDeviceControl (_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, _In_ size_t OutputBufferLength, _In_ size_t InputBufferLength, _In_ ULONG IoControlCode)
 
static VOID NTAPI HubPdoEvtIoDeviceControl (_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, _In_ size_t OutputBufferLength, _In_ size_t InputBufferLength, _In_ ULONG IoControlCode)
 
VOID NTAPI HubEvtBandwidthRetryTimer (_In_ WDFTIMER Timer)
 
VOID NTAPI HubNoPingResponse (_In_ UCXHUB_HUB_CONTEXT HubContext, _In_ UCXHUB_DEVICE_CONTEXT DeviceContext)
 
 for (Index=0;;Index++)
 
 HubPdoResolveSystemWake ()
 
 if (Known)
 
 DPRINT1 ("Port %u device failed enumeration, creating a placeholder PDO\n", Port->Number())
 
 if (!(Hub->HasFlag(HubFlag::InAcpiNamespace) &&Child->HasProperty(ChildProperty::NotRemovable))) HubWmiNotifyEnumerationFailure(Hub
 
Port Number ())
 
 if (Init==NULL)
 
 HubPdoSetCallbacks (Init)
 
 WdfDeviceInitSetDeviceType (Init, FILE_DEVICE_UNKNOWN)
 
 WdfDeviceInitSetExclusive (Init, FALSE)
 
 WdfPdoInitAllowForwardingRequestToParent (Init)
 
 WdfDeviceInitSetRemoveLockOptions (Init, &RemoveLock)
 
 if (!Known)
 
 WdfObjectReferenceWithTag (Child->m_Object,(PVOID) HubTagPdo)
 
 WdfDeviceSetSpecialFileSupport (Device, WdfSpecialFilePaging, TRUE)
 
 WdfDeviceSetSpecialFileSupport (Device, WdfSpecialFileHibernation, TRUE)
 
 WdfDeviceSetSpecialFileSupport (Device, WdfSpecialFileDump, TRUE)
 
 WdfDeviceSetSpecialFileSupport (Device, WdfSpecialFileBoot, TRUE)
 
 HubPdoSetPnpCapabilities (Pdo)
 
Pdo m_Idle Initialize (Pdo)
 
Pdo m_Idle Post (IdleEvent::Start, NULL)
 
Pdo SetFlag (PdoFlag::IdleMachineStarted)
 
 HubPdoRegisterLpmSettings (Pdo)
 
 DPRINT1 ("Child PDO %p for port %u, VID %04x PID %04x\n", Device, Pdo->m_PortNumber, Child->m_DeviceDescriptor.idVendor, Child->m_DeviceDescriptor.idProduct)
 
 if (Init !=NULL) WdfDeviceInitFree(Init)
 
 if (Device !=NULL)
 
 if (Referenced) WdfObjectDereferenceWithTag(Child -> m_Object,(PVOID) HubTagPdo)
 
static PURB NTAPI HubClientUrb (_In_ WDFREQUEST Request, _Out_ PULONG IoControlCode)
 
static VOID NTAPI HubPatchFailedSelect (_In_ HubChild *Child, _Inout_ PURB Urb)
 
static WDFREQUEST NTAPI HubTakeClientRequest (_In_ HubChild *Child)
 
static USBD_STATUS NTAPI HubCheckConfigDescriptor (_In_ HubChild *Child, _In_ PUSB_CONFIGURATION_DESCRIPTOR Descriptor)
 
static BOOLEAN NTAPI HubFailClientCheck (_In_ HubChild *Child, _In_ USBD_STATUS UsbdStatus)
 
static PUSB_INTERFACE_DESCRIPTOR NTAPI HubFindSelectedInterface (_In_ PUSB_CONFIGURATION_DESCRIPTOR Config, _In_ UCHAR Number, _In_ UCHAR Alternate)
 
static USBD_STATUS NTAPI HubInitInterfaceInformation (_In_ PUSB_CONFIGURATION_DESCRIPTOR Config, _Inout_ PUSBD_INTERFACE_INFORMATION Info)
 

Variables

static const char HubTagPdo [] = "hub child pdo"
 
static const GUID HubClassUnknown
 
static const GUID HubCapFullSpeedCompatible
 
static const GUID HubCapLowSpeedCompatible
 
static const DEVPROPKEY HubKeyBillboardInfo
 
static const DEVPROPKEY HubKeyDualRoleFeatures
 
static const DEVPROPKEY HubKeyUsb4TunnelState
 
static const GUID HubLpmDeviceSettings [HUB_PDO_LPM_SETTINGS]
 
static const GUID HubLpmHubSettings [HUB_PDO_LPM_SETTINGS]
 
static PFN_HUB_SET_SYSTEM_WAKE_DEVICE HubSetSystemWakeDevice
 
static BOOLEAN HubSetSystemWakeDeviceResolved
 
static EVT_WDF_DEVICE_D0_ENTRY HubPdoEvtD0Entry
 
static EVT_WDF_DEVICE_D0_EXIT HubPdoEvtD0Exit
 
static EVT_WDF_DEVICE_PREPARE_HARDWARE HubPdoEvtPrepareHardware
 
static EVT_WDF_DEVICE_RELEASE_HARDWARE HubPdoEvtReleaseHardware
 
static EVT_WDF_DEVICE_SURPRISE_REMOVAL HubPdoEvtSurpriseRemoval
 
static EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT HubPdoEvtSelfManagedIoStart
 
static EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND HubPdoEvtSelfManagedIoSuspend
 
static EVT_WDF_DEVICE_QUERY_STOP HubPdoEvtQueryStop
 
static EVT_WDF_DEVICE_QUERY_REMOVE HubPdoEvtQueryRemove
 
static EVT_WDF_DEVICE_ENABLE_WAKE_AT_BUS HubPdoEvtEnableWakeAtBus
 
static EVT_WDF_DEVICE_DISABLE_WAKE_AT_BUS HubPdoEvtDisableWakeAtBus
 
static EVT_WDF_DEVICE_REPORTED_MISSING HubPdoEvtReportedMissing
 
static EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY HubPdoEvtResourceRequirementsQuery
 
static EVT_WDF_OBJECT_CONTEXT_CLEANUP HubPdoEvtCleanup
 
static EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessInternalIoctl
 
static EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessIoctl
 
static EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessPnp
 
static EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessSetPower
 
static EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST HubPdoEvtParentInterfaceQuery
 
static EVT_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL HubPdoEvtIoInternalDeviceControl
 
static EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL HubPdoEvtIoDeviceControl
 
static EVT_WDF_WORKITEM HubPdoEvtCompletePowerIrp
 
static EVT_WDF_REQUEST_COMPLETION_ROUTINE HubPdoWakeNotificationComplete
 
static POWER_SETTING_CALLBACK HubPdoLpmSettingChanged
 
_In_ DsmEvent Event
 
_In_ DsmEvent _In_ PCSTR What
 
KeClearEvent & Child = Pdo->m_Child
 
return Child m_PnpStatus
 
_Inout_ PIRP Irp
 
_In_ BOOLEAN D3ColdSupport
 
_In_ SYSTEM_POWER_STATE SystemPowerState
 
_In_ SYSTEM_POWER_STATE _Out_ PDEVICE_WAKE_DEPTH DeepestWakeableDstate
 
NTSTATUS Status = Pdo->m_AcpiD3Cold.GetD3ColdCapability(Pdo->m_AcpiD3Cold.Context, D3ColdSupported)
 
 else
 
return STATUS_SUCCESS
 
_Out_ PBOOLEAN D3ColdSupported
 
_Out_ PD3COLD_LAST_TRANSITION_STATUS LastTransitionStatus
 
_In_ PUNICODE_STRING SymbolicLinkName
 
_Outptr_ PZZWSTR * LocationStrings
 
const SIZE_T Count = 10
 
PWCHAR Buffer = (PWCHAR)ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), HUB_TAG_DEVICE)
 
WDFDEVICE HubDevice = Pdo->m_Hub->m_Device
 
_In_ WDFCMRESLIST ResourcesRaw
 
_In_ WDFCMRESLIST _In_ WDFCMRESLIST ResourcesTranslated
 
HubPdo * Pdo = HubGetPdoContext(Device)
 
HubFdo * Hub = Pdo->m_Hub
 
WDF_OBJECT_ATTRIBUTES Attributes
 
const GUID * InterfaceGuid
 
Pdo m_FailRequests = TRUE
 
_In_ WDFIORESREQLIST IoResourceRequirementsList
 
_In_ WDF_POWER_DEVICE_STATE PreviousState
 
Pdo m_WdfPowerState = WdfPowerDeviceD0
 
Pdo m_PortNumber = Port->Number()
 
_In_ WDF_POWER_DEVICE_STATE TargetState
 
POWER_ACTION Action = WdfDeviceGetSystemPowerAction(Device)
 
_Inout_opt_ PHUB_DEVICE_CONFIG_INFO Info
 
USB_ID_STRING FriendlyName
 
Info Version = 1
 
Info Length = sizeof(*Info)
 
_Out_ WDFDEVICE * Device
 
UNICODE_STRING Name
 
ULONG Index
 
Attributes EvtCleanupCallback = HubPdoEvtCleanup
 
_In_ BOOLEAN Known
 
HubPort * Port = Child->m_Port
 
WDF_REMOVE_LOCK_OPTIONS RemoveLock
 
PWDFDEVICE_INIT Init = WdfPdoInitAllocate(Hub->m_Device)
 
BOOLEAN Referenced = FALSE
 
Pdo m_Device = Device
 
Pdo m_Hub = Hub
 
Pdo m_Child = Child
 
Pdo m_ClientContractVersion = HUB_PDO_CONTRACT_UNKNOWN
 
Child m_Pdo = Pdo
 
Pdo m_Reported = TRUE
 
Child m_LpmPolicy = HUB_LPM_POLICY_LINK_BITS
 
return TRUE
 
Failed __pad0__
 
return FALSE
 

Macro Definition Documentation

◆ HUB_DEVICE_CHARACTERISTICS_SIZE

#define HUB_DEVICE_CHARACTERISTICS_SIZE   0x18

Definition at line 46 of file childpdo.cpp.

◆ HUB_IOCTL_GET_DEVICE_CHARACTERISTICS

#define HUB_IOCTL_GET_DEVICE_CHARACTERISTICS   HUB_USB_BUFFERED_IOCTL(USB_GET_DEVICE_CHARACTERISTICS)

Definition at line 42 of file childpdo.cpp.

◆ HUB_IOCTL_GET_TIME_SYNC

Definition at line 40 of file childpdo.cpp.

◆ HUB_IOCTL_GET_TRANSPORT_CHARACTERISTICS

#define HUB_IOCTL_GET_TRANSPORT_CHARACTERISTICS   HUB_USB_BUFFERED_IOCTL(USB_GET_TRANSPORT_CHARACTERISTICS)

Definition at line 35 of file childpdo.cpp.

◆ HUB_IOCTL_MEDIA_SERIAL_NUMBER

#define HUB_IOCTL_MEDIA_SERIAL_NUMBER   CTL_CODE(FILE_DEVICE_MASS_STORAGE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)

Definition at line 50 of file childpdo.cpp.

◆ HUB_IOCTL_NOTIFY_TRANSPORT_CHANGE

Definition at line 37 of file childpdo.cpp.

◆ HUB_IOCTL_REGISTER_TRANSPORT_CHANGE

Definition at line 36 of file childpdo.cpp.

◆ HUB_IOCTL_START_TIME_SYNC

Definition at line 39 of file childpdo.cpp.

◆ HUB_IOCTL_STOP_TIME_SYNC

Definition at line 41 of file childpdo.cpp.

◆ HUB_IOCTL_UNREGISTER_TRANSPORT_CHANGE

Definition at line 38 of file childpdo.cpp.

◆ HUB_LPM_POLICY_LINK_BITS

#define HUB_LPM_POLICY_LINK_BITS
Value:
#define HUB_LPM_POLICY_U1_INITIATE
Definition: devhcd.h:15
#define HUB_LPM_POLICY_U1_ACCEPT
Definition: devhcd.h:13
#define HUB_LPM_POLICY_U2_ENABLED
Definition: devhcd.h:12
#define HUB_LPM_POLICY_U1_ENABLED
Definition: devhcd.h:11
#define HUB_LPM_POLICY_U2_ACCEPT
Definition: devhcd.h:14
#define HUB_LPM_POLICY_U2_INITIATE
Definition: devhcd.h:16

Definition at line 139 of file childpdo.cpp.

◆ HUB_MSOS20_SET_INDEX

#define HUB_MSOS20_SET_INDEX   7

Definition at line 29 of file childpdo.cpp.

◆ HUB_PDO_DRIVER_WAIT_TIME

#define HUB_PDO_DRIVER_WAIT_TIME   10000

Definition at line 20 of file childpdo.cpp.

◆ HUB_STAMPED_HANDLE_OFFSET

#define HUB_STAMPED_HANDLE_OFFSET   4

Definition at line 47 of file childpdo.cpp.

◆ HUB_START_FAIL_MAX

#define HUB_START_FAIL_MAX   4096

Definition at line 53 of file childpdo.cpp.

◆ HUB_TRANSPORT_REGISTRATION_SIZE

#define HUB_TRANSPORT_REGISTRATION_SIZE   (sizeof(ULONG) + sizeof(PVOID) + 24)

Definition at line 45 of file childpdo.cpp.

◆ HUB_URB_FUNCTION_FAST_PATH_1

#define HUB_URB_FUNCTION_FAST_PATH_1   0x0039

Definition at line 24 of file childpdo.cpp.

◆ HUB_URB_FUNCTION_FAST_PATH_2

#define HUB_URB_FUNCTION_FAST_PATH_2   0x003A

Definition at line 25 of file childpdo.cpp.

◆ HUB_URB_FUNCTION_LAST

#define HUB_URB_FUNCTION_LAST   0x003C

Definition at line 23 of file childpdo.cpp.

◆ HUB_URB_FUNCTION_SELECT_LIKE

#define HUB_URB_FUNCTION_SELECT_LIKE   0x003B

Definition at line 26 of file childpdo.cpp.

◆ HUB_USB_BUFFERED_IOCTL

Definition at line 32 of file childpdo.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file childpdo.cpp.

Typedef Documentation

◆ PFN_HUB_SET_SYSTEM_WAKE_DEVICE

typedef VOID(NTAPI * PFN_HUB_SET_SYSTEM_WAKE_DEVICE) (_In_ PDEVICE_OBJECT DeviceObject)

Definition at line 145 of file childpdo.cpp.

Enumeration Type Documentation

◆ HubLpmSlot

Enumerator
HubLpmU1Enable 
HubLpmU2Enable 
HubLpmU1Timeout 
HubLpmU2Timeout 
HubLpmPolicy 

Definition at line 130 of file childpdo.cpp.

131{
137};
@ HubLpmPolicy
Definition: childpdo.cpp:136
@ HubLpmU2Timeout
Definition: childpdo.cpp:135
@ HubLpmU2Enable
Definition: childpdo.cpp:133
@ HubLpmU1Enable
Definition: childpdo.cpp:132
@ HubLpmU1Timeout
Definition: childpdo.cpp:134

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

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

Definition at line 270 of file childpdo.cpp.

276{
277 PAGED_CODE();
278
279 KeClearEvent(&Child->m_PreStartEvent);
281 HubWaitForPnpEvent(&Child->m_PreStartEvent, "PdoPreStart", Child->m_Object);
282}
PAGED_CODE()
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

◆ _IRQL_requires_max_() [1/2]

_IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 818 of file childpdo.cpp.

824{
825 return ((HubPdo*)Context)->TestAndClearFlag(PdoFlag::ProgrammingLostOnReset);
826}
@ ProgrammingLostOnReset
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81

◆ _IRQL_requires_max_() [2/2]

_IRQL_requires_max_ ( PASSIVE_LEVEL  )

Definition at line 923 of file Messaging.c.

75{
76 PFLT_SERVER_PORT_OBJECT PortObject;
78
79 /* The caller must allow at least one connection */
80 if (MaxConnections == 0)
81 {
83 }
84
85 /* The request must be for a kernel handle */
86 if (!(ObjectAttributes->Attributes & OBJ_KERNEL_HANDLE))
87 {
89 }
90
91 /*
92 * Get rundown protection on the target to stop the owner
93 * from unloading whilst this port object is open. It gets
94 * removed in the FltpServerPortClose callback
95 */
97 if (!NT_SUCCESS(Status))
98 {
99 return Status;
100 }
101
102 /* Create the server port object for this filter */
107 NULL,
109 0,
110 0,
111 (PVOID *)&PortObject);
112 if (NT_SUCCESS(Status))
113 {
114 /* Zero out the struct */
115 RtlZeroMemory(PortObject, sizeof(FLT_SERVER_PORT_OBJECT));
116
117 /* Increment the ref count on the target filter */
119
120 /* Setup the filter port object */
121 PortObject->Filter = Filter;
125 PortObject->Cookie = ServerPortCookie;
126 PortObject->MaxConnections = MaxConnections;
127
128 /* Insert the object */
129 Status = ObInsertObject(PortObject,
130 NULL,
132 0,
133 NULL,
135 if (NT_SUCCESS(Status))
136 {
137 /* Lock the connection list */
138 ExAcquireFastMutex(&Filter->ConnectionList.mLock);
139
140 /* Add the new port object to the connection list and increment the count */
141 InsertTailList(&Filter->ConnectionList.mList, &PortObject->FilterLink);
142 Filter->ConnectionList.mCount++;
143
144 /* Unlock the connection list*/
145 ExReleaseFastMutex(&Filter->ConnectionList.mLock);
146 }
147 }
148
149 if (!NT_SUCCESS(Status))
150 {
151 /* Allow the filter to be cleaned up */
153 }
154
155 return Status;
156}
static const INTERNET_PORT ServerPort
Definition: CWebService.cpp:11
POBJECT_TYPE ServerPortObjectType
Definition: Messaging.c:24
VOID FLTAPI FltObjectDereference(_Inout_ PVOID Object)
Definition: Object.c:53
NTSTATUS FLTAPI FltObjectReference(_Inout_ PVOID Object)
Definition: Object.c:41
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY _In_opt_ PFLT_MESSAGE_NOTIFY MessageNotifyCallback
Definition: fltkernel.h:1877
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY ConnectNotifyCallback
Definition: fltkernel.h:1875
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID ServerPortCookie
Definition: fltkernel.h:1874
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback
Definition: fltkernel.h:1876
ULONG FltpObjectPointerReference(_In_ PFLT_OBJECT Object)
Definition: Object.c:322
Status
Definition: gdiplustypes.h:24
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
HubAltSettingFilter * Filter
static LONG MaxConnections
#define KernelMode
Definition: asm.h:38
#define FILE_READ_DATA
Definition: nt_native.h:628
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2962
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:1049
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
PFLT_DISCONNECT_NOTIFY DisconnectNotify
Definition: fltmgrint.h:192
PFLT_MESSAGE_NOTIFY MessageNotify
Definition: fltmgrint.h:193
PFLT_CONNECT_NOTIFY ConnectNotify
Definition: fltmgrint.h:191
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(HubBillboardHeader)  = =4)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(HubBillboardMode)  = =8)

◆ ClearFlag()

Pdo ClearFlag ( PdoFlag::Started  )

◆ ClearState()

◆ DPRINT() [1/4]

DPRINT ( "Child PDO %p on port %u D0 entry from %d\n"  ,
Device  ,
Pdo->  m_PortNumber,
(int)  PreviousState 
)

◆ DPRINT() [2/4]

DPRINT ( "Child PDO %p on port %u D0 exit to %  d,
action %d\n"  ,
Device  ,
Pdo->  m_PortNumber,
(int)  TargetState,
(int)  Action 
)

◆ DPRINT() [3/4]

DPRINT ( "Child PDO %p on port %u prepare hardware\n"  ,
Device  ,
Pdo->  m_PortNumber 
)

◆ DPRINT() [4/4]

DPRINT ( "Child PDO %p on port %u release hardware\n"  ,
Device  ,
Pdo->  m_PortNumber 
)

◆ DPRINT1() [1/2]

DPRINT1 ( "Child PDO %p for port %  u,
VID %04x PID %04x\n"  ,
Device  ,
Pdo->  m_PortNumber,
Child->m_DeviceDescriptor.  idVendor,
Child->m_DeviceDescriptor.  idProduct 
)

◆ DPRINT1() [2/2]

DPRINT1 ( "Port %u device failed  enumeration,
creating a placeholder PDO\n"  ,
Port->  Number() 
)

◆ for()

for ( Index  = 0;; Index++)

Definition at line 3084 of file childpdo.cpp.

3085 {
3086 Status = RtlStringCchPrintfW(Buffer, RTL_NUMBER_OF(Buffer), L"\\Device\\USBPDO-%d", Index);
3087 if (!NT_SUCCESS(Status))
3088 return Status;
3089
3091 Status = WdfDeviceInitAssignName(*Init, &Name);
3092 if (!NT_SUCCESS(Status))
3093 return Status;
3094
3095 Status = WdfDeviceCreate(Init, &Attributes, Device);
3097 return Status;
3098
3099 DPRINT("PDO name %wZ is taken, trying the next\n", &Name);
3100 }
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
NTSTATUS Status
Definition: childpdo.cpp:561
UNICODE_STRING Name
Definition: childpdo.cpp:3071
Definition: bufpool.h:45
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define L(x)
Definition: resources.c:13
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
#define DPRINT
Definition: sndvol32.h:73
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
_In_ WDFCOLLECTION _In_ ULONG Index

◆ HubCacheMsOs20SetInfo()

HubCacheMsOs20SetInfo ( Child  )

◆ HubCheckConfigDescriptor()

static USBD_STATUS NTAPI HubCheckConfigDescriptor ( _In_ HubChild *  Child,
_In_ PUSB_CONFIGURATION_DESCRIPTOR  Descriptor 
)
static

Definition at line 3570 of file childpdo.cpp.

3573{
3575 volatile UCHAR Touch;
3576
3577 if (Descriptor->bDescriptorType != USB_CONFIGURATION_DESCRIPTOR_TYPE ||
3578 Descriptor->bLength < sizeof(*Descriptor) ||
3579 Descriptor->wTotalLength == 0)
3580 {
3582 }
3583
3584 /* A bad client buffer faults here rather than deep in the validator */
3585 Touch = ((volatile UCHAR*)Descriptor)[0];
3586 Touch = ((volatile UCHAR*)Descriptor)[Descriptor->wTotalLength - 1];
3587 (VOID)Touch;
3588
3590 Child->m_DeviceDescriptor.bcdUSB,
3591 Child->Speed(),
3593 Child->m_Port->m_Info.SspIsochBurstCount,
3594 Child->m_ValidationBits);
3595
3598
3599 return USBD_STATUS_SUCCESS;
3600}
#define VOID
Definition: acefi.h:82
BOOLEAN NTAPI HubDescCheckConfiguration(_In_ const HubDescContext *Context, _In_reads_bytes_opt_(Length) PUSB_CONFIGURATION_DESCRIPTOR Descriptor, _In_ ULONG Length, _Out_opt_ PBOOLEAN SupportsStreams)
Definition: desccheck.cpp:1237
VOID NTAPI HubDescInitDeviceContext(_Out_ HubDescContext *Context, _In_ USHORT BcdUsb, _In_ USB_DEVICE_SPEED Speed, _In_ BOOLEAN Win8Behavior, _In_ ULONG SspIsochBurstCount, _In_opt_ PULONG Bitmap)
Definition: desccheck.cpp:91
@ UseWin8DescriptorValidation
unsigned char UCHAR
Definition: typedefs.h:53
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usb100.h:50
#define USBD_STATUS_SUCCESS
Definition: usb.h:177
#define USBD_STATUS_INVALID_CONFIGURATION_DESCRIPTOR
Definition: usb.h:214
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by DeviceMachine::SelectConfigValid().

◆ HubClientUrb()

static PURB NTAPI HubClientUrb ( _In_ WDFREQUEST  Request,
_Out_ PULONG  IoControlCode 
)
static

Definition at line 3416 of file childpdo.cpp.

3419{
3421
3422 *IoControlCode = Stack->Parameters.DeviceIoControl.IoControlCode;
3424 return NULL;
3425
3426 return (PURB)Stack->Parameters.Others.Argument1;
3427}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
Definition: usb.h:565
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
#define IOCTL_INTERNAL_USB_SUBMIT_URB
Definition: usbioctl.h:32
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639

Referenced by DeviceMachine::CompleteClientRequest(), DeviceMachine::CompleteClientRequestFailed(), DeviceMachine::CompleteClientRequestLastStatus(), DeviceMachine::FindClientPipe(), DeviceMachine::SelectConfigValid(), and DeviceMachine::SelectInterfaceValid().

◆ HubD3ColdDereference()

static VOID NTAPI HubD3ColdDereference ( _In_ PVOID  Context)
static

Definition at line 522 of file childpdo.cpp.

524{
526
527 if (Pdo->m_AcpiD3Cold.InterfaceDereference != NULL)
528 Pdo->m_AcpiD3Cold.InterfaceDereference(Pdo->m_AcpiD3Cold.Context);
529}
D3COLD_SUPPORT_INTERFACE m_AcpiD3Cold
Definition: childpdo.h:126
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
Definition: hubucx.h:280
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:7573

Referenced by HubPdoAnswerD3Cold().

◆ HubD3ColdReference()

static VOID NTAPI HubD3ColdReference ( _In_ PVOID  Context)
static

Definition at line 510 of file childpdo.cpp.

512{
514
515 if (Pdo->m_AcpiD3Cold.InterfaceReference != NULL)
516 Pdo->m_AcpiD3Cold.InterfaceReference(Pdo->m_AcpiD3Cold.Context);
517}
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:7572

Referenced by HubPdoAnswerD3Cold().

◆ HubEvtBandwidthRetryTimer()

VOID NTAPI HubEvtBandwidthRetryTimer ( _In_ WDFTIMER  Timer)

Definition at line 2938 of file childpdo.cpp.

2940{
2941 HubPort* Port = HubPort::FromObject(WdfTimerGetParentObject(Timer));
2943
2944 /* The timer outlives a device that left the port; only the current one reports */
2945 if (Child == NULL || Child->m_BandwidthRetryTimer != Timer)
2946 return;
2947
2948 DPRINT1("Port %u ran out of bandwidth\n", Port->Number());
2949 HubWmiNotifyInsufficientBandwidth(Port->m_Hub, Port->Number());
2950}
#define DPRINT1
Definition: precomp.h:8
HubPort * Port
Definition: childpdo.cpp:3267
HubChild * m_Child
Definition: hubport.h:236
static HubPort * FromObject(_In_ WDFOBJECT Object)
Definition: hubport.cpp:30
USHORT Number() const
Definition: hubport.h:213
HubFdo * m_Hub
Definition: hubport.h:228

◆ HubFailClientCheck()

static BOOLEAN NTAPI HubFailClientCheck ( _In_ HubChild *  Child,
_In_ USBD_STATUS  UsbdStatus 
)
static

Definition at line 3605 of file childpdo.cpp.

3608{
3609 Child->m_LastUsbdStatus = UsbdStatus;
3610 Child->m_LastNtStatus = HubUsbdStatusToNt(UsbdStatus);
3611 DPRINT1("Port %u client select check failed, USBD status 0x%lx\n", Child->m_Port->Number(), UsbdStatus);
3612 return FALSE;
3613}
return FALSE
Definition: childpdo.cpp:3408
static NTSTATUS NTAPI HubUsbdStatusToNt(_In_ USBD_STATUS Status)
Definition: childpdo.cpp:220
_In_ NTSTATUS _In_ USBD_STATUS UsbdStatus
Definition: wdfusb.h:403

Referenced by DeviceMachine::SelectConfigValid(), and DeviceMachine::SelectInterfaceValid().

◆ HubFindSelectedInterface()

static PUSB_INTERFACE_DESCRIPTOR NTAPI HubFindSelectedInterface ( _In_ PUSB_CONFIGURATION_DESCRIPTOR  Config,
_In_ UCHAR  Number,
_In_ UCHAR  Alternate 
)
static

Definition at line 3692 of file childpdo.cpp.

3696{
3698 PUCHAR End;
3702 BOOLEAN NumberSeen = FALSE;
3703 ULONG Endpoints = 0;
3704
3705 if (Config->bLength < sizeof(*Config) ||
3706 Config->bDescriptorType != USB_CONFIGURATION_DESCRIPTOR_TYPE ||
3707 Config->wTotalLength < sizeof(*Config))
3708 {
3709 return NULL;
3710 }
3711
3712 End = Position + Config->wTotalLength;
3713
3714 for (; Position + sizeof(*Common) <= End; Position += Common->bLength)
3715 {
3717 if (Common->bLength == 0 || Position + Common->bLength > End)
3718 break;
3719
3720 if (Common->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE)
3721 {
3722 if (Common->bLength < sizeof(*Interface))
3723 continue;
3724
3726 if (Interface->bInterfaceNumber != Number)
3727 {
3728 if (NumberSeen)
3729 break;
3730 continue;
3731 }
3732
3733 NumberSeen = TRUE;
3734 if (Found != NULL)
3735 break;
3736 if (Interface->bAlternateSetting == Alternate)
3737 Found = Interface;
3738 }
3739 else if (Common->bDescriptorType == USB_ENDPOINT_DESCRIPTOR_TYPE && Found != NULL)
3740 {
3741 if (Common->bLength < sizeof(USB_ENDPOINT_DESCRIPTOR))
3742 return NULL;
3743 Endpoints++;
3744 }
3745 }
3746
3747 if (Found != NULL && Found->bNumEndpoints > Endpoints)
3748 return NULL;
3749
3750 return Found;
3751}
unsigned char BOOLEAN
Definition: actypes.h:127
return Found
Definition: dirsup.c:1270
return TRUE
Definition: childpdo.cpp:3391
PUCHAR End
Definition: desccheck.cpp:2229
_In_ ULONG Number
Definition: haltypes.h:1940
static COORD Position
Definition: mouse.c:34
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usb100.h:53
struct _USB_INTERFACE_DESCRIPTOR * PUSB_INTERFACE_DESCRIPTOR
struct _USB_COMMON_DESCRIPTOR * PUSB_COMMON_DESCRIPTOR
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usb100.h:52

Referenced by HubInitInterfaceInformation().

◆ HubFlushSqmFlags()

HubFlushSqmFlags ( Child  )

Referenced by if().

◆ HubInitInterfaceInformation()

static USBD_STATUS NTAPI HubInitInterfaceInformation ( _In_ PUSB_CONFIGURATION_DESCRIPTOR  Config,
_Inout_ PUSBD_INTERFACE_INFORMATION  Info 
)
static

Definition at line 3757 of file childpdo.cpp.

3760{
3765 ULONG Needed;
3766 ULONG Index;
3767
3768 Descriptor = HubFindSelectedInterface(Config, Info->InterfaceNumber, Info->AlternateSetting);
3769 if (Descriptor == NULL)
3770 {
3771 Info->Length = 0;
3773 }
3774
3775 Needed = FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes) +
3776 Descriptor->bNumEndpoints * sizeof(USBD_PIPE_INFORMATION);
3777
3778 if (Info->Length < Needed)
3779 {
3780 Info->Length = (USHORT)Needed;
3782 }
3783
3784 Info->Class = Descriptor->bInterfaceClass;
3785 Info->SubClass = Descriptor->bInterfaceSubClass;
3786 Info->Protocol = Descriptor->bInterfaceProtocol;
3787 Info->Reserved = 0;
3788 Info->InterfaceHandle = NULL;
3789 Info->NumberOfPipes = Descriptor->bNumEndpoints;
3790
3792 for (Index = 0; Index < Descriptor->bNumEndpoints; Index++)
3793 {
3794 /* HubFindSelectedInterface proved this many endpoints follow */
3795 do
3796 {
3798 } while (((PUSB_COMMON_DESCRIPTOR)Position)->bDescriptorType != USB_ENDPOINT_DESCRIPTOR_TYPE);
3799
3800 Pipe = &Info->Pipes[Index];
3801 Pipe->EndpointAddress = ((PUSB_ENDPOINT_DESCRIPTOR)Position)->bEndpointAddress;
3802 Pipe->Interval = ((PUSB_ENDPOINT_DESCRIPTOR)Position)->bInterval;
3803 Pipe->PipeType = UsbdPipeTypeControl;
3804 Pipe->PipeHandle = NULL;
3805
3806 if (Pipe->PipeFlags & ~USBD_PF_VALID_MASK)
3808
3809 if (!(Pipe->PipeFlags & USBD_PF_CHANGE_MAX_PACKET))
3810 Pipe->MaximumPacketSize = 0;
3811 }
3812
3813 Info->Length = (USHORT)Needed;
3814 return Status;
3815}
static PUSB_INTERFACE_DESCRIPTOR NTAPI HubFindSelectedInterface(_In_ PUSB_CONFIGURATION_DESCRIPTOR Config, _In_ UCHAR Number, _In_ UCHAR Alternate)
Definition: childpdo.cpp:3692
ULONG Index
Definition: childpdo.cpp:3073
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
struct _USB_ENDPOINT_DESCRIPTOR * PUSB_ENDPOINT_DESCRIPTOR
struct _USBD_PIPE_INFORMATION USBD_PIPE_INFORMATION
#define USBD_STATUS_INVALID_PIPE_FLAGS
Definition: usb.h:219
#define USBD_PF_CHANGE_MAX_PACKET
Definition: usb.h:281
#define USBD_STATUS_INTERFACE_NOT_FOUND
Definition: usb.h:218
LONG USBD_STATUS
Definition: usb.h:172
@ UsbdPipeTypeControl
Definition: usb.h:257
#define USBD_PF_VALID_MASK
Definition: usb.h:285
#define USBD_STATUS_BUFFER_TOO_SMALL
Definition: usb.h:217
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFUSBPIPE Pipe
Definition: wdfusb.h:1741

Referenced by DeviceMachine::SelectInterfaceValid().

◆ HubNoPingResponse()

VOID NTAPI HubNoPingResponse ( _In_ UCXHUB_HUB_CONTEXT  HubContext,
_In_ UCXHUB_DEVICE_CONTEXT  DeviceContext 
)

Definition at line 2955 of file childpdo.cpp.

2958{
2960
2961 DPRINT1("Device %p did not answer a ping\n", DeviceContext);
2963}
@ NoPingResponse
_In_ UCXHUB_DEVICE_CONTEXT DeviceContext
Definition: hubucx.h:237
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_In_opt_ PVOID HubContext
Definition: usbdhub.h:41

◆ 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_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().

◆ HubPatchFailedSelect()

static VOID NTAPI HubPatchFailedSelect ( _In_ HubChild *  Child,
_Inout_ PURB  Urb 
)
static

Definition at line 3433 of file childpdo.cpp.

3436{
3437 if (Urb->UrbHeader.Function == URB_FUNCTION_SELECT_INTERFACE)
3438 {
3440 Urb->UrbSelectInterface.Interface.InterfaceHandle = (USBD_INTERFACE_HANDLE)(LONG_PTR)-1;
3441 }
3442 else if (Urb->UrbHeader.Function == URB_FUNCTION_SELECT_CONFIGURATION)
3443 {
3444 Urb->UrbSelectConfiguration.ConfigurationHandle = NULL;
3445 }
3446}
@ ConfigurationValid
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define URB_FUNCTION_SELECT_INTERFACE
Definition: usb.h:87
PVOID USBD_INTERFACE_HANDLE
Definition: usb.h:243
#define URB_FUNCTION_SELECT_CONFIGURATION
Definition: usb.h:86
_In_opt_ PUSB_CONFIGURATION_DESCRIPTOR _Inout_ PUSBD_INTERFACE_LIST_ENTRY _Outptr_ PURB * Urb
Definition: usbdlib.h:333

Referenced by DeviceMachine::CompleteClientRequestFailed(), and DeviceMachine::CompleteClientRequestLastStatus().

◆ HubPdoAnswerD3Cold()

static NTSTATUS NTAPI HubPdoAnswerD3Cold ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 721 of file childpdo.cpp.

724{
726 PD3COLD_SUPPORT_INTERFACE Interface = (PD3COLD_SUPPORT_INTERFACE)Stack->Parameters.QueryInterface.Interface;
727
728 if (Stack->Parameters.QueryInterface.Size != sizeof(*Interface) ||
729 Stack->Parameters.QueryInterface.Version != 1)
730 {
731 DPRINT("D3cold query on port %u with size %u version %u left alone\n",
732 Pdo->m_PortNumber, Stack->Parameters.QueryInterface.Size, Stack->Parameters.QueryInterface.Version);
733 return HubPdoCompleteAsIs(Irp);
734 }
735
736 /* An ACPI filter above already filled it on the way down; keep its copy */
737 if (Irp->IoStatus.Status == STATUS_SUCCESS)
738 {
739 if (Interface->Size != sizeof(*Interface) || Interface->Version != 1)
740 {
741 DPRINT1("ACPI D3cold interface on port %u has size %u version %u\n",
742 Pdo->m_PortNumber, Interface->Size, Interface->Version);
744 }
745
746 Pdo->m_AcpiD3Cold = *Interface;
747 }
748 else
749 {
750 Interface->Size = sizeof(*Interface);
751 Interface->Version = 1;
752 }
753
754 Interface->Context = Pdo;
755 Interface->InterfaceReference = HubD3ColdReference;
756 Interface->InterfaceDereference = HubD3ColdDereference;
757 Interface->SetD3ColdSupport = HubD3ColdSetSupport;
758 Interface->GetIdleWakeInfo = HubD3ColdGetIdleWakeInfo;
759 Interface->GetD3ColdCapability = HubD3ColdGetCapability;
760 Interface->GetBusDriverD3ColdSupport = HubD3ColdGetBusDriverSupport;
761 Interface->GetLastTransitionStatus = HubD3ColdGetLastTransition;
762
764}
static NTSTATUS NTAPI HubPdoCompleteAsIs(_Inout_ PIRP Irp)
Definition: childpdo.cpp:300
static VOID NTAPI HubD3ColdReference(_In_ PVOID Context)
Definition: childpdo.cpp:510
static VOID NTAPI HubD3ColdDereference(_In_ PVOID Context)
Definition: childpdo.cpp:522
HubPdo * Pdo
Definition: childpdo.cpp:1187
static NTSTATUS NTAPI HubPdoCompleteIrp(_Inout_ PIRP Irp, _In_ NTSTATUS Status)
Definition: childpdo.cpp:287
_In_ PIRP Irp
Definition: kse.h:79
if(dx< 0)
Definition: linetemp.h:194
struct _D3COLD_SUPPORT_INTERFACE * PD3COLD_SUPPORT_INTERFACE

Referenced by HubPdoQueryInterface().

◆ HubPdoCachedDescriptor()

static NTSTATUS NTAPI HubPdoCachedDescriptor ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_Inout_ PURB  Urb 
)
static

Definition at line 2000 of file childpdo.cpp.

2004{
2005 struct _URB_CONTROL_DESCRIPTOR_REQUEST* Request = &Urb->UrbControlDescriptorRequest;
2006 HubChild* Child = Pdo->m_Child;
2007 PVOID Source;
2008 PVOID Buffer;
2009 ULONG Size;
2011
2012 if (Child->m_DeviceDescriptor.bcdUSB <= 0x0200)
2013 {
2015 return HubPdoToController(Pdo, Irp);
2016 }
2017
2019 if (!NT_SUCCESS(Status))
2020 return HubPdoCompleteIrp(Irp, Status);
2021
2022 Buffer = HubPdoUrbBuffer(Request->TransferBuffer, Request->TransferBufferMDL);
2023 if (Buffer == NULL)
2024 {
2025 DPRINT1("Port %u descriptor URB %p has no buffer\n", Pdo->m_PortNumber, Urb);
2026 Urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
2028 }
2029
2030 if (Request->DescriptorType == USB_DEVICE_DESCRIPTOR_TYPE)
2031 {
2032 Source = &Child->m_DeviceDescriptor;
2033 Size = min(sizeof(Child->m_DeviceDescriptor), Request->TransferBufferLength);
2034 }
2035 else if (Request->DescriptorType == USB_CONFIGURATION_DESCRIPTOR_TYPE &&
2036 Request->Index == 0 &&
2037 Child->m_ConfigDescriptor != NULL)
2038 {
2039 Source = Child->m_ConfigDescriptor;
2040 Size = min((ULONG)Child->m_ConfigDescriptor->wTotalLength, Request->TransferBufferLength);
2041 }
2042 else
2043 {
2045 return HubPdoToController(Pdo, Irp);
2046 }
2047
2048 /* Compat: a default pipe request reads back as a control transfer */
2049 Urb->UrbControlTransfer.TransferFlags |= USBD_TRANSFER_DIRECTION_IN;
2050 if (Urb->UrbControlTransfer.TransferFlags & USBD_DEFAULT_PIPE_TRANSFER)
2051 Urb->UrbHeader.Function = URB_FUNCTION_CONTROL_TRANSFER;
2052
2054 Request->TransferBufferLength = Size;
2056}
static NTSTATUS NTAPI HubPdoToController(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:324
static VOID NTAPI HubPdoStampUrb(_In_ HubPdo *Pdo, _Inout_ PURB Urb)
Definition: childpdo.cpp:1940
static PVOID NTAPI HubPdoUrbBuffer(_In_ PVOID Pointer, _In_opt_ PMDL Mdl)
Definition: childpdo.cpp:1986
PWCHAR Buffer
Definition: childpdo.cpp:953
static NTSTATUS NTAPI HubPdoValidateUrb(_Inout_ PURB Urb)
Definition: childpdo.cpp:1951
#define min(a, b)
Definition: monoChain.cc:55
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usb100.h:49
#define USBD_TRANSFER_DIRECTION_IN
Definition: usb.h:167
#define URB_FUNCTION_CONTROL_TRANSFER
Definition: usb.h:94
#define USBD_DEFAULT_PIPE_TRANSFER
Definition: usb.h:163
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539

Referenced by HubPdoRouteUrb().

◆ HubPdoCompleteAsIs()

static NTSTATUS NTAPI HubPdoCompleteAsIs ( _Inout_ PIRP  Irp)
static

Completes with whatever status the IRP already carries.

Definition at line 300 of file childpdo.cpp.

302{
303 NTSTATUS Status = Irp->IoStatus.Status;
304
306 return Status;
307}
#define IoCompleteRequest
Definition: irp.c:1272
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by HubPdoAnswerD3Cold(), HubPdoDispatchIoctl(), HubPdoPreprocessPnp(), and HubPdoQueryInterface().

◆ HubPdoCompleteIrp()

◆ HubPdoCyclePort()

static NTSTATUS NTAPI HubPdoCyclePort ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 2526 of file childpdo.cpp.

2529{
2531 {
2532 DPRINT1("Port %u cycle request above passive level\n", Pdo->m_PortNumber);
2534 }
2535
2536 if (InterlockedCompareExchange(&Pdo->m_CycleQueued, 1, 0) == 0)
2537 {
2538 DPRINT1("Client cycles port %u\n", Pdo->m_PortNumber);
2539 Pdo->m_Child->Post(DsmEvent::ClientCyclePort);
2540 }
2541 else
2542 {
2543 DPRINT1("Port %u cycle ignored, one was already requested\n", Pdo->m_PortNumber);
2544 }
2545
2547}
@ ClientCyclePort
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define InterlockedCompareExchange
Definition: interlocked.h:119

Referenced by HubPdoDispatchIoctl().

◆ HubPdoDispatchIoctl()

static NTSTATUS NTAPI HubPdoDispatchIoctl ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 2553 of file childpdo.cpp.

2556{
2558 PVOID Argument1 = Stack->Parameters.Others.Argument1;
2559 HubChild* Child = Pdo->m_Child;
2563 ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode;
2565
2566 switch (Code)
2567 {
2569 if (!Pdo->HasFlag(PdoFlag::InD0))
2570 {
2571 DPRINT1("Port %u reset refused, the device is not in D0\n", Pdo->m_PortNumber);
2573 }
2575 {
2576 DPRINT1("Port %u reset requested above passive level\n", Pdo->m_PortNumber);
2578 }
2579 return HubPdoQueueAndWait(Pdo, Irp, Pdo->m_Queue);
2580
2582 if (!Pdo->HasFlag(PdoFlag::InD0))
2583 {
2584 DPRINT1("Port %u async reset refused, the device is not in D0\n", Pdo->m_PortNumber);
2586 }
2588 {
2589 DPRINT1("Port %u async reset requested above dispatch level\n", Pdo->m_PortNumber);
2591 }
2592 return HubPdoQueueAsync(Pdo, Irp);
2593
2597 {
2598 DPRINT1("Port %u status request refused, buffer %p\n", Pdo->m_PortNumber, PortStatus);
2600 }
2601
2602 /* The hub machine reads the port and clears ReportPortDisabled through Argument2 */
2603 *PortStatus = 0;
2604 Stack->Parameters.Others.Argument2 = Pdo;
2605 return HubPdoQueueAndWait(Pdo, Irp, WdfDeviceGetDefaultQueue(Pdo->m_Hub->m_Device));
2606
2610
2612 return HubPdoCyclePort(Pdo, Irp);
2613
2615 return HubPdoGetHubName(Pdo, Irp);
2616
2617 case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
2618 return HubPdoSubmitIdleRequest(Pdo, Irp);
2619
2620 case IOCTL_INTERNAL_USB_RECORD_FAILURE:
2622
2624 return HubPdoCompleteIrp(Irp, HubQueryDeviceBusInfo(Child, (PUSB_BUS_NOTIFICATION)Argument1));
2625
2627 return HubPdoCompleteIrp(Irp, HubQueryControllerName(Pdo->m_Hub,
2629 (ULONG)(ULONG_PTR)Stack->Parameters.Others.Argument2));
2630
2631 case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE:
2632 if (Argument1 == NULL)
2633 {
2634 DPRINT1("Port %u device handle request has no buffer\n", Pdo->m_PortNumber);
2636 }
2638
2641 case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE_EX:
2642 case IOCTL_INTERNAL_USB_GET_TT_DEVICE_HANDLE:
2643 case IOCTL_INTERNAL_USB_NOTIFY_IDLE_READY:
2644 DPRINT1("Port %u internal IOCTL 0x%lx is not supported\n", Pdo->m_PortNumber, Code);
2646
2647 case IOCTL_INTERNAL_USB_GET_TOPOLOGY_ADDRESS:
2648 return HubPdoCompleteIrp(Irp, HubPdoTopologyAddress(Pdo, (PUSB_TOPOLOGY_ADDRESS)Argument1));
2649
2650 case IOCTL_INTERNAL_USB_GET_DEVICE_CONFIG_INFO:
2651 return HubPdoCompleteIrp(Irp, HubPdoDeviceConfigInfo(Pdo, (PHUB_DEVICE_CONFIG_INFO)Argument1));
2652
2655 Stack->Parameters.Others.Argument2 = Child->m_UsbDevice;
2656 if (Composite != NULL && Composite->CapabilityFlags.CapabilityFunctionSuspend)
2658 return HubPdoToController(Pdo, Irp);
2659
2663 Stack->Parameters.Others.Argument2 = Child->m_UsbDevice;
2664 return HubPdoToController(Pdo, Irp);
2665
2669
2672
2674 Dump = (PUCXHUB_DUMP_DEVICE_INFO)Irp->AssociatedIrp.SystemBuffer;
2675 Dump->Device = Child->m_UsbDevice;
2676 return HubPdoToController(Pdo, Irp);
2677
2679 return HubPdoToController(Pdo, Irp);
2680
2682 ((PUCXHUB_FORWARD_PROGRESS_INFO)Argument1)->Device = Child->m_UsbDevice;
2683 return HubPdoToController(Pdo, Irp);
2684
2685 default:
2686 Status = Irp->IoStatus.Status;
2687 if (!NT_SUCCESS(Status))
2688 DPRINT1("Port %u unknown internal IOCTL 0x%lx completed 0x%lx\n", Pdo->m_PortNumber, Code, Status);
2689 return HubPdoCompleteAsIs(Irp);
2690 }
2691}
ULONG PortStatus
Definition: bootdev.cpp:131
static NTSTATUS NTAPI HubPdoQueueAndWait(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _In_ WDFQUEUE Queue)
Definition: childpdo.cpp:1902
static NTSTATUS NTAPI HubPdoQueueAsync(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:1929
static VOID NTAPI HubPdoFillHubInfo(_In_ HubPdo *Pdo, _Inout_ HubParentInfo *Info)
Definition: childpdo.cpp:2428
static NTSTATUS NTAPI HubPdoQueryCapability(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PUCXHUB_QUERY_CAPABILITY Query)
Definition: childpdo.cpp:2480
static NTSTATUS NTAPI HubPdoRecordFailure(_In_ HubPdo *Pdo, _In_opt_ HubStartFailHeader *Data)
Definition: childpdo.cpp:2281
static NTSTATUS NTAPI HubPdoGetHubName(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:2218
static NTSTATUS NTAPI HubPdoCyclePort(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:2526
static NTSTATUS NTAPI HubPdoTopologyAddress(_In_ HubPdo *Pdo, _Out_opt_ PUSB_TOPOLOGY_ADDRESS Address)
Definition: childpdo.cpp:2401
@ ClientDoesFunctionSuspend
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define IOCTL_UCXHUB_RESET_PORT_ASYNC
Definition: hubucx.h:78
#define IOCTL_UCXHUB_FREE_DUMP_DATA
Definition: hubucx.h:74
struct _UCXHUB_DUMP_DEVICE_INFO * PUCXHUB_DUMP_DEVICE_INFO
#define IOCTL_UCXHUB_QUERY_USB_CAPABILITY
Definition: hubucx.h:65
#define IOCTL_UCXHUB_SET_FUNCTION_HANDLE_DATA
Definition: hubucx.h:66
#define IOCTL_UCXHUB_GET_DUMP_DATA
Definition: hubucx.h:72
#define IOCTL_UCXHUB_NOTIFY_FORWARD_PROGRESS
Definition: hubucx.h:69
#define IOCTL_UCXHUB_GET_HUB_INFO
Definition: hubucx.h:64
struct _UCXHUB_FORWARD_PROGRESS_INFO * PUCXHUB_FORWARD_PROGRESS_INFO
static void Dump(LPITEMIDLIST pidl, PCSTR Heading=NULL)
Definition: lnktool.cpp:230
#define STATUS_POWER_STATE_INVALID
Definition: ntstatus.h:957
COMPOSITE_DEVICE_CAPABILITIES CapabilityFlags
Definition: usbdlib.h:123
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _REGISTER_COMPOSITE_DEVICE * PREGISTER_COMPOSITE_DEVICE
#define IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO
Definition: usbioctl.h:68
#define IOCTL_INTERNAL_USB_REGISTER_COMPOSITE_DEVICE
Definition: usbioctl.h:760
#define IOCTL_INTERNAL_USB_RESET_PORT
Definition: usbioctl.h:35
#define IOCTL_INTERNAL_USB_REQUEST_REMOTE_WAKE_NOTIFICATION
Definition: usbioctl.h:766
#define IOCTL_INTERNAL_USB_CYCLE_PORT
Definition: usbioctl.h:53
#define IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME
Definition: usbioctl.h:62
#define IOCTL_INTERNAL_USB_GET_HUB_COUNT
Definition: usbioctl.h:50
#define IOCTL_INTERNAL_USB_ENABLE_PORT
Definition: usbioctl.h:47
#define IOCTL_INTERNAL_USB_GET_BUS_INFO
Definition: usbioctl.h:59
#define IOCTL_INTERNAL_USB_UNREGISTER_COMPOSITE_DEVICE
Definition: usbioctl.h:763
#define IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO
Definition: usbioctl.h:38
#define IOCTL_INTERNAL_USB_GET_HUB_NAME
Definition: usbioctl.h:56
#define IOCTL_INTERNAL_USB_GET_PORT_STATUS
Definition: usbioctl.h:44
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707
_IRQL_requires_same_ _In_opt_ PVOID Argument1
Definition: cmtypes.h:697

Referenced by HubPdoPreprocessInternalIoctl().

◆ HubPdoEvtCompletePowerIrp()

static VOID NTAPI HubPdoEvtCompletePowerIrp ( _In_ WDFWORKITEM  WorkItem)
static

Definition at line 1087 of file childpdo.cpp.

1089{
1090 IoCompleteRequest(HubGetPdoIrpWork(WorkItem)->Irp, IO_NO_INCREMENT);
1092}
_In_opt_ PVOID _In_ PUCXHUB_WORKITEM WorkItem
Definition: hubucx.h:227
WdfObjectDelete(String)

◆ HubPdoEvtEnableWakeAtBus()

static NTSTATUS NTAPI HubPdoEvtEnableWakeAtBus ( _In_ WDFDEVICE  Device,
_In_ SYSTEM_POWER_STATE  PowerState 
)
static

Definition at line 1676 of file childpdo.cpp.

1679{
1680 HubPdo* Pdo = HubGetPdoContext(Device);
1681 HubChild* Child = Pdo->m_Child;
1683
1684 DPRINT("Port %u enable wake for S%d\n", Pdo->m_PortNumber, (int)PowerState - 1);
1685
1686 Pdo->SetFlag(PdoFlag::WaitWakePending);
1687
1688 /* Hubs pass their children's wake on but are not armed for Sx here */
1690 return STATUS_SUCCESS;
1691
1692 if (!Child->HasProperty(ChildProperty::RemoteWakeCapable))
1693 {
1694 DPRINT1("Port %u device cannot wake\n", Pdo->m_PortNumber);
1695 return STATUS_NOT_SUPPORTED;
1696 }
1697
1699 return STATUS_SUCCESS;
1700
1701 if (Child->m_Kind & DSM_KIND_SUPER_SPEED)
1702 {
1704 if (NT_SUCCESS(Status))
1706 }
1707
1709 return Status;
1710}
static NTSTATUS NTAPI HubPdoSendWakeNotification(_In_ HubPdo *Pdo)
Definition: childpdo.cpp:1636
@ WakeArmRequested
@ WakeNotificationSent
@ WaitWakePending
#define DSM_KIND_SUPER_SPEED
Definition: devsm.h:150
@ PowerSystemWorking
Definition: ntpoapi.h:36
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3040

◆ HubPdoEvtIoDeviceControl()

static VOID NTAPI HubPdoEvtIoDeviceControl ( _In_ WDFQUEUE  Queue,
_In_ WDFREQUEST  Request,
_In_ size_t  OutputBufferLength,
_In_ size_t  InputBufferLength,
_In_ ULONG  IoControlCode 
)
static

Definition at line 2908 of file childpdo.cpp.

2914{
2915 PIRP Irp = WdfRequestWdmGetIrp(Request);
2916
2920
2921 switch (IoControlCode)
2922 {
2924 DPRINT("Media serial number request on a USB PDO is not supported\n");
2925 WdfRequestComplete(Request, STATUS_NOT_SUPPORTED);
2926 break;
2927
2928 default:
2929 DPRINT("PDO IOCTL 0x%lx completed 0x%lx\n", IoControlCode, Irp->IoStatus.Status);
2930 WdfRequestComplete(Request, Irp->IoStatus.Status);
2931 break;
2932 }
2933}
#define HUB_IOCTL_MEDIA_SERIAL_NUMBER
Definition: childpdo.cpp:50
_In_ PGUID _In_ ULONG OutputBufferLength
Definition: ucxcontroller.h:81
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2231

◆ HubPdoEvtIoInternalDeviceControl()

static VOID NTAPI HubPdoEvtIoInternalDeviceControl ( _In_ WDFQUEUE  Queue,
_In_ WDFREQUEST  Request,
_In_ size_t  OutputBufferLength,
_In_ size_t  InputBufferLength,
_In_ ULONG  IoControlCode 
)
static

Definition at line 2815 of file childpdo.cpp.

2821{
2822 HubPdo* Pdo = HubGetPdoContext(WdfIoQueueGetDevice(Queue));
2823 HubChild* Child = Pdo->m_Child;
2825 PURB Urb;
2827
2830
2831 switch (IoControlCode)
2832 {
2834 Urb = (PURB)Stack->Parameters.Others.Argument1;
2835
2836 switch (Urb->UrbHeader.Function)
2837 {
2838 /* The device handle goes in; an unconfigure drops the handle */
2840 Urb->UrbHeader.UsbdDeviceHandle = Child->m_UsbDevice;
2841 if (Urb->UrbSelectConfiguration.ConfigurationDescriptor == NULL)
2842 {
2843 Urb->UrbSelectConfiguration.ConfigurationHandle = NULL;
2845 }
2846 else
2847 {
2849 }
2850 break;
2851
2854 break;
2855
2857 DPRINT1("Client resets pipe %p on port %u\n", Urb->UrbPipeRequest.PipeHandle, Pdo->m_PortNumber);
2859 break;
2860
2861 case URB_FUNCTION_SYNC_RESET_PIPE:
2862 DPRINT1("Client sync resets pipe %p on port %u\n", Urb->UrbPipeRequest.PipeHandle, Pdo->m_PortNumber);
2864 break;
2865
2866 case URB_FUNCTION_SYNC_CLEAR_STALL:
2867 DPRINT1("Client clears stall on pipe %p on port %u\n", Urb->UrbPipeRequest.PipeHandle, Pdo->m_PortNumber);
2869 break;
2870
2874 break;
2875
2876 default:
2877 break;
2878 }
2879 break;
2880
2883 DPRINT1("Client reset of port %u starts\n", Pdo->m_PortNumber);
2884 Child->m_Port->m_ConnectionStatus = DeviceReset;
2886 break;
2887
2888 default:
2889 break;
2890 }
2891
2892 if (Event == DsmEvent::Count)
2893 {
2894 DPRINT1("Port %u queue got IOCTL 0x%lx it cannot handle\n", Pdo->m_PortNumber, IoControlCode);
2895 WdfRequestComplete(Request, STATUS_NOT_SUPPORTED);
2896 return;
2897 }
2898
2899 DPRINT("Port %u client request %p, IOCTL 0x%lx\n", Pdo->m_PortNumber, Request, IoControlCode);
2900 Child->m_ClientRequest = Request;
2901 Child->Post(Event);
2902}
DsmEvent
Definition: devsm.h:15
@ ClientSyncResetPipe
@ ClientResetDevice
@ ClientUnconfigure
@ ClientSetInterface
@ ClientClearStall
@ ClientResetPipe
@ ClientSelectConfig
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287
switch(r->id)
Definition: btrfs.c:3046
struct _URB * PURB
#define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
Definition: usb.h:116
#define URB_FUNCTION_OPEN_STATIC_STREAMS
Definition: usb.h:152
#define URB_FUNCTION_CLOSE_STATIC_STREAMS
Definition: usb.h:153

◆ HubPdoEvtParentInterfaceQuery()

static NTSTATUS NTAPI HubPdoEvtParentInterfaceQuery ( _In_ WDFDEVICE  Device,
_In_ LPGUID  InterfaceType,
_Inout_ PINTERFACE  ExposedInterface,
_Inout_opt_ PVOID  ExposedInterfaceSpecificData 
)
static

Definition at line 876 of file childpdo.cpp.

881{
882 HubPdo* Pdo = HubGetPdoContext(Device);
883 HubChild* Child = Pdo->m_Child;
884 HubFdo* Hub = Pdo->m_Hub;
885 HubPort* Port = Child->m_Port;
887 UCHAR Depth;
888
891
892 if (!Child->HasProperty(ChildProperty::IsHub))
893 {
894 DPRINT1("Parent interface query on port %u, which is not a hub\n", Pdo->m_PortNumber);
895 return STATUS_UNSUCCESSFUL;
896 }
897
898 Depth = Hub->m_Parent.HubDepth + 1;
899
900 Parent->Header.Size = sizeof(*Parent);
901 Parent->Header.Version = UCXHUB_PARENT_INTERFACE_VERSION;
902 Parent->Header.Context = Pdo;
903 Parent->Header.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
904 Parent->Header.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
905
906 Parent->HubDepth = Depth;
907 Parent->ParentCanWake = Child->HasProperty(ChildProperty::RemoteWakeCapable);
908
909 Parent->HubTopologyAddress = Hub->m_Parent.HubTopologyAddress;
910 if (Depth == 1)
911 Parent->HubTopologyAddress.RootHubPortNumber = Pdo->m_PortNumber;
912 else if (Depth - 2 < (UCHAR)RTL_NUMBER_OF(Parent->HubTopologyAddress.HubPortNumber))
913 Parent->HubTopologyAddress.HubPortNumber[Depth - 2] = Pdo->m_PortNumber;
914
915 Parent->HubSpeed = Child->Speed();
916 Parent->IsEnhancedSuperSpeed = HubPdoIsEnhancedSuperSpeed(Child);
917 Parent->Hub = Child->m_UsbDevice;
918
919 /* A hub on a root port hands down its own tunnel state; deeper hubs inherit it */
920 Parent->TunnelState = (Depth == 1) ? Child->m_TunnelState : Hub->m_Parent.TunnelState;
921
922 Parent->ParentLostStateDuringResume = HubPdoWasProgrammingLost;
923 Parent->ParentResetDuringResume = HubPdoWasHubReset;
924 Parent->ConnectorId = &Port->m_ConnectorId;
925 Parent->QueryHubLinkName = HubPdoGetSymbolicLink;
926
928 {
929 Parent->FirstCompanionPort = Port->m_FirstCompanionPort;
930 Parent->LastCompanionPort = Port->m_LastCompanionPort;
931
933 Parent->ParentCanWake = FALSE;
934 }
935
936 Pdo->m_ChildHubFdo = Parent->ChildHubObject;
937 DPRINT("Child hub %p on port %u at depth %u\n", Pdo->m_ChildHubFdo, Pdo->m_PortNumber, Depth);
938 return STATUS_SUCCESS;
939}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
HubFdo * Hub
Definition: childpdo.cpp:1189
static BOOLEAN NTAPI HubPdoIsEnhancedSuperSpeed(_In_ HubChild *Child)
Definition: childpdo.cpp:866
Definition: fdo.h:132
BOOLEAN HasFlag(_In_ HubFlag Flag) const
Definition: fdo.h:153
UCXHUB_PARENT_INTERFACE m_Parent
Definition: fdo.h:355
BOOLEAN HasProperty(_In_ PortProperty Property) const
Definition: hubport.h:206
USHORT m_LastCompanionPort
Definition: hubport.h:275
HubConnectorId m_ConnectorId
Definition: hubport.h:268
USHORT m_FirstCompanionPort
Definition: hubport.h:274
UINT Depth
Definition: d3d12.idl:4644
#define UCXHUB_PARENT_INTERFACE_VERSION
Definition: hubucx.h:493
struct _UCXHUB_PARENT_INTERFACE * PUCXHUB_PARENT_INTERFACE
USB_TOPOLOGY_ADDRESS HubTopologyAddress
Definition: hubucx.h:514
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
@ NoSelectiveSuspendIntegrated
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
WDF_EXTERN_C_START typedef _In_ LPGUID _Inout_ PINTERFACE ExposedInterface
WDF_EXTERN_C_START typedef _In_ LPGUID _Inout_ PINTERFACE _Inout_opt_ PVOID ExposedInterfaceSpecificData
FORCEINLINE VOID NTAPI WdfDeviceInterfaceReferenceNoOp(_In_ PVOID Context)
FORCEINLINE VOID NTAPI WdfDeviceInterfaceDereferenceNoOp(_In_ PVOID Context)

◆ HubPdoEvtQueryRemove()

static NTSTATUS NTAPI HubPdoEvtQueryRemove ( _In_ WDFDEVICE  Device)
static

Definition at line 1332 of file childpdo.cpp.

1334{
1335 HubGetPdoContext(Device)->SetFlag(PdoFlag::QueryRemoved);
1336 return STATUS_SUCCESS;
1337}
@ QueryRemoved

◆ HubPdoEvtQueryStop()

static NTSTATUS NTAPI HubPdoEvtQueryStop ( _In_ WDFDEVICE  Device)
static

Definition at line 1322 of file childpdo.cpp.

1324{
1325 HubGetPdoContext(Device)->SetFlag(PdoFlag::QueryStopped);
1326 return STATUS_SUCCESS;
1327}
@ QueryStopped

◆ HubPdoEvtReportedMissing()

static VOID NTAPI HubPdoEvtReportedMissing ( _In_ WDFDEVICE  Device)
static

Definition at line 1369 of file childpdo.cpp.

1371{
1372 HubPdo* Pdo = HubGetPdoContext(Device);
1373
1374 DPRINT("Child PDO %p on port %u reported missing\n", Device, Pdo->m_PortNumber);
1375 Pdo->m_Child->Post(DsmEvent::PdoReportedMissing);
1376}
@ PdoReportedMissing

◆ HubPdoEvtSelfManagedIoStart()

static NTSTATUS NTAPI HubPdoEvtSelfManagedIoStart ( _In_ WDFDEVICE  Device)
static

Definition at line 1469 of file childpdo.cpp.

1471{
1472 HubGetPdoContext(Device)->SetFlag(PdoFlag::InD0);
1473 return STATUS_SUCCESS;
1474}

◆ HubPdoEvtSelfManagedIoSuspend()

static NTSTATUS NTAPI HubPdoEvtSelfManagedIoSuspend ( _In_ WDFDEVICE  Device)
static

Definition at line 1479 of file childpdo.cpp.

1481{
1482 HubPdo* Pdo = HubGetPdoContext(Device);
1483
1484 Pdo->ClearFlag(PdoFlag::InD0);
1485 return STATUS_SUCCESS;
1486}

◆ HubPdoFillHubInfo()

static VOID NTAPI HubPdoFillHubInfo ( _In_ HubPdo *  Pdo,
_Inout_ HubParentInfo *  Info 
)
static

Definition at line 2428 of file childpdo.cpp.

2431{
2432 HubChild* Child = Pdo->m_Child;
2433 HubFdo* Hub = Pdo->m_Hub;
2434 const HubParentInfo* Mine = &Hub->m_ParentInfo;
2435
2436 Info->RootHubPdo = Mine->RootHubPdo;
2437 Info->DeviceDescriptor = Child->m_DeviceDescriptor;
2438 Info->U1ExitLatency = Child->m_U1ExitLatency;
2439 Info->U2ExitLatency = Child->m_U2ExitLatency;
2440 Info->SublinkSpeedAttr = Child->m_SublinkSpeedAttr;
2441 Info->SublinkSpeedAttrCount = Child->m_SublinkSpeedAttrCount;
2442 Info->TotalHubDepth = (UCHAR)Child->m_Port->m_Info.TotalHubDepth;
2443 Info->HostInitiatedU1ExitLatency = Child->m_HostU1ExitLatency;
2444 Info->HostInitiatedU2ExitLatency = Child->m_HostU2ExitLatency;
2445 Info->TotalTpPropagationDelay = Mine->TotalTpPropagationDelay +
2447 Child->m_TxTpDelay;
2448
2449 if (Child->m_SlowestLinkU1)
2450 {
2451 Info->SlowestLinkU1ExitLatency = Child->m_Sel.U1Pel;
2452 Info->SlowestLinkU1Depth = Hub->m_Parent.HubDepth;
2453 }
2454 else
2455 {
2456 Info->SlowestLinkU1ExitLatency = Mine->SlowestLinkU1ExitLatency;
2457 Info->SlowestLinkU1Depth = Mine->SlowestLinkU1Depth;
2458 }
2459
2460 if (Child->m_SlowestLinkU2)
2461 {
2462 Info->SlowestLinkU2ExitLatency = Child->m_Sel.U2Pel;
2463 Info->SlowestLinkU2Depth = Hub->m_Parent.HubDepth;
2464 }
2465 else
2466 {
2467 Info->SlowestLinkU2ExitLatency = Mine->SlowestLinkU2ExitLatency;
2468 Info->SlowestLinkU2Depth = Mine->SlowestLinkU2Depth;
2469 }
2470
2471 if (Mine->Flags & HUB_PARENT_DISABLE_LPM)
2472 Info->Flags |= HUB_PARENT_DISABLE_LPM;
2473 if (Child->HasProperty(ChildProperty::HighSpeedCapable))
2475}
HubParentInfo m_ParentInfo
Definition: fdo.h:360
USB_30_HUB_DESCRIPTOR Usb30
Definition: fdo.h:420
union HubFdo::@1628 m_HubDescriptor
PDEVICE_OBJECT RootHubPdo
Definition: fdo.h:88
ULONG Flags
Definition: fdo.h:100
USHORT TotalTpPropagationDelay
Definition: fdo.h:99
UCHAR SlowestLinkU1Depth
Definition: fdo.h:93
UCHAR SlowestLinkU2Depth
Definition: fdo.h:95
USHORT SlowestLinkU2ExitLatency
Definition: fdo.h:94
USHORT SlowestLinkU1ExitLatency
Definition: fdo.h:92
#define HUB_PARENT_DISABLE_LPM
Definition: fdo.h:106
#define HUB_PARENT_HIGH_SPEED_CAPABLE
Definition: fdo.h:107

Referenced by HubPdoDispatchIoctl().

◆ HubPdoForwardSelectLike()

static NTSTATUS NTAPI HubPdoForwardSelectLike ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_Inout_ PURB  Urb 
)
static

Definition at line 2132 of file childpdo.cpp.

2136{
2137 if (Pdo->m_ControllerTarget == NULL)
2138 {
2139 DPRINT1("Port %u has no controller target for URB %p\n", Pdo->m_PortNumber, Urb);
2141 }
2142
2146 return IoCallDriver(Pdo->m_ControllerTarget, Irp);
2147}
static NTSTATUS NTAPI HubPdoSelectLikeComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
Definition: childpdo.cpp:2112
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define IoCopyCurrentIrpStackLocationToNext(Irp)
Definition: ntifs_ex.h:413
#define IoCallDriver
Definition: irp.c:1257

Referenced by HubPdoRouteUrb().

◆ HubPdoGetHubName()

static NTSTATUS NTAPI HubPdoGetHubName ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 2218 of file childpdo.cpp.

2221{
2223 PUSB_HUB_NAME HubName = (PUSB_HUB_NAME)Irp->AssociatedIrp.SystemBuffer;
2224 ULONG OutputLength = Stack->Parameters.DeviceIoControl.OutputBufferLength;
2226 PWCHAR Name;
2227 ULONG Chars;
2228 ULONG Index;
2229 ULONG NameBytes = 0;
2230
2231 if (HubName == NULL)
2232 {
2233 DPRINT1("Port %u hub name request has no buffer\n", Pdo->m_PortNumber);
2235 }
2236
2237 if (OutputLength < sizeof(*HubName))
2238 {
2239 DPRINT1("Port %u hub name buffer of %lu bytes too small\n", Pdo->m_PortNumber, OutputLength);
2241 }
2242
2243 if (!Pdo->m_Child->HasProperty(ChildProperty::IsHub))
2244 {
2245 HubName->ActualLength = sizeof(*HubName);
2246 HubName->HubName[0] = UNICODE_NULL;
2247 Irp->IoStatus.Information = sizeof(*HubName);
2249 }
2250
2251 RtlZeroMemory(HubName, OutputLength);
2252 HubPdoGetSymbolicLink(Pdo, &Link);
2253
2254 /* Drop the leading "\xxx\" of the symbolic link */
2255 Name = Link.Buffer;
2256 Chars = Link.Length / sizeof(WCHAR);
2257 if (Chars != 0 && Name[0] == L'\\')
2258 {
2259 for (Index = 1; Index < Chars && Name[Index] != L'\\'; Index++)
2260 ;
2261
2262 if (Index < Chars)
2263 {
2264 Name += Index + 1;
2265 NameBytes = (Chars - Index - 1) * sizeof(WCHAR);
2266 }
2267 }
2268
2269 if (NameBytes != 0 && OutputLength >= NameBytes + sizeof(*HubName))
2270 RtlCopyMemory(HubName->HubName, Name, NameBytes);
2271
2272 HubName->ActualLength = NameBytes + sizeof(*HubName);
2273 Irp->IoStatus.Information = HubName->ActualLength;
2275}
ULONG Chars
Definition: hubtunnel.cpp:833
Name HubName[0]
Definition: hubwmi.cpp:470
#define UNICODE_NULL
short WCHAR
Definition: pedump.c:58
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
uint16_t * PWCHAR
Definition: typedefs.h:56
struct _USB_HUB_NAME * PUSB_HUB_NAME

Referenced by HubPdoDispatchIoctl().

◆ HubPdoIndicateWake()

static VOID NTAPI HubPdoIndicateWake ( _In_ HubPdo *  Pdo)
static

Definition at line 1598 of file childpdo.cpp.

1600{
1602 KIRQL OldIrql;
1603
1605 Status = WdfDeviceIndicateWakeStatus(Pdo->m_Device, STATUS_SUCCESS);
1607
1608 if (!NT_SUCCESS(Status))
1609 DPRINT1("Wake status not taken 0x%lx\n", Status);
1610}
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by DeviceMachine::FinishWaitWake(), and HubPdoWakeNotificationComplete().

◆ HubPdoIsEnhancedSuperSpeed()

static BOOLEAN NTAPI HubPdoIsEnhancedSuperSpeed ( _In_ HubChild *  Child)
static

Definition at line 866 of file childpdo.cpp.

868{
869 return (Child->m_Kind & DSM_KIND_SUPER_SPEED) && Child->m_SublinkSpeedAttrCount != 0;
870}

Referenced by HubPdoEvtParentInterfaceQuery().

◆ HubPdoLpmSettingChanged()

static NTSTATUS NTAPI HubPdoLpmSettingChanged ( _In_ LPCGUID  SettingGuid,
_In_reads_bytes_(ValueLength) PVOID  Value,
_In_ ULONG  ValueLength,
_Inout_opt_ PVOID  Context 
)
static

Definition at line 1742 of file childpdo.cpp.

1747{
1750 ULONG Slot;
1751 ULONG Setting;
1752 ULONG Accept;
1753 ULONG Initiate;
1754
1755 for (Slot = 0; Slot < HUB_PDO_LPM_SETTINGS; Slot++)
1756 {
1759 {
1760 break;
1761 }
1762 }
1763
1765 return STATUS_SUCCESS;
1766
1767 if (Slot != HubLpmPolicy && ValueLength < sizeof(ULONG))
1768 {
1769 DPRINT1("LPM setting %lu of %p has only %lu bytes\n", Slot, Child, ValueLength);
1771 }
1772
1773 Setting = *(PULONG)Value;
1774
1775 switch (Slot)
1776 {
1777 case HubLpmPolicy:
1778 if (Setting > 3)
1779 {
1780 DPRINT1("LPM policy %lu of %p is out of range\n", Setting, Child);
1782 }
1783
1784 if (Setting == 0)
1785 {
1786 Policy = 0;
1787 break;
1788 }
1789
1792 if (Setting == 1)
1794 else if (Setting == 3)
1796 break;
1797
1798 case HubLpmU1Enable:
1799 if (Setting != 0)
1801 else
1802 Policy &= ~HUB_LPM_POLICY_U1_ENABLED;
1803 break;
1804
1805 case HubLpmU2Enable:
1806 if (Setting != 0)
1808 else
1809 Policy &= ~HUB_LPM_POLICY_U2_ENABLED;
1810 break;
1811
1812 default:
1815
1816 if (Setting == 0)
1817 Policy |= Accept | Initiate;
1818 else if (Setting == 1)
1819 Policy = (Policy | Accept) & ~Initiate;
1820 else if (Setting == 2)
1821 Policy &= ~(Accept | Initiate);
1822 break;
1823 }
1824
1825 if (Policy != Child->m_LpmPolicy)
1826 {
1827 DPRINT("LPM policy of %p now 0x%lx\n", Child, Policy);
1828 Child->m_LpmPolicy = Policy;
1830 }
1831
1832 return STATUS_SUCCESS;
1833}
static const GUID HubLpmDeviceSettings[HUB_PDO_LPM_SETTINGS]
Definition: childpdo.cpp:112
#define HUB_LPM_POLICY_LINK_BITS
Definition: childpdo.cpp:139
static const GUID HubLpmHubSettings[HUB_PDO_LPM_SETTINGS]
Definition: childpdo.cpp:121
#define HUB_PDO_LPM_SETTINGS
Definition: childpdo.h:39
ULONG m_LpmPolicy
Definition: hubchild.h:441
_Inout_ HubConfiguration ** Slot
Definition: devhcd.cpp:1260
#define HUB_LPM_POLICY_CONSERVATIVE
Definition: devhcd.h:17
#define HUB_LPM_POLICY_AGGRESSIVE
Definition: devhcd.h:18
@ LpmSettingChanged
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY Policy
Definition: wdfinterrupt.h:653
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_ LPCGUID SettingGuid
Definition: pofuncs.h:120

◆ HubPdoMsFeatureDescriptor()

static NTSTATUS NTAPI HubPdoMsFeatureDescriptor ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_Inout_ PURB  Urb 
)
static

Definition at line 2062 of file childpdo.cpp.

2066{
2067 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST* Request = &Urb->UrbOSFeatureDescriptorRequest;
2068 HubChild* Child = Pdo->m_Child;
2070 const HubMsOs20SetHeader* Set;
2071 PVOID Buffer;
2072 ULONG Size;
2073
2074 if (Request->MS_FeatureDescriptorIndex == HUB_MSOS20_SET_INDEX)
2075 {
2076 Set = (const HubMsOs20SetHeader*)Child->m_MsOs20Set;
2077 if (Set == NULL)
2078 {
2079 DPRINT1("Port %u has no MS OS 2.0 descriptor set\n", Pdo->m_PortNumber);
2081 }
2082
2083 Buffer = HubPdoUrbBuffer(Request->TransferBuffer, Request->TransferBufferMDL);
2084 if (Buffer == NULL)
2085 {
2086 DPRINT1("Port %u MS OS 2.0 URB %p has no buffer\n", Pdo->m_PortNumber, Urb);
2088 }
2089
2090 Size = min((ULONG)Set->wTotalLength, Request->TransferBufferLength);
2092 Request->TransferBufferLength = Size;
2094 }
2095
2096 if (((BcdUsb >= 0x0200 || BcdUsb < 0x0100) && !Child->HasProperty(ChildProperty::MsOsNotSupported)) ||
2098 {
2099 /* The device's own vendor code goes into the request */
2100 Urb->UrbControlVendorClassRequest.Request = Child->m_MsOsVendorCode;
2102 return HubPdoToController(Pdo, Irp);
2103 }
2104
2105 DPRINT1("Port %u device does not support MS OS descriptors\n", Pdo->m_PortNumber);
2107}
#define HUB_MSOS20_SET_INDEX
Definition: childpdo.cpp:29
USB_DEVICE_DESCRIPTOR m_DeviceDescriptor
Definition: hubchild.h:386
static BOOL Set
Definition: pageheap.c:10

Referenced by HubPdoRouteUrb().

◆ HubPdoPassDown()

static NTSTATUS NTAPI HubPdoPassDown ( _In_ WDFDEVICE  Device,
_Inout_ PIRP  Irp 
)
static

Definition at line 312 of file childpdo.cpp.

315{
318}
WdfDeviceWdmDispatchPreprocessedIrp(Device, Irp)
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421

Referenced by HubPdoPreprocessIoctl(), HubPdoPreprocessPnp(), HubPdoPreprocessSetPower(), and HubPdoQueryInterface().

◆ HubPdoPostAndWait()

HubPdoPostAndWait ( Pdo->  m_Child,
DsmEvent::PdoInstallMsOsExt  ,
"PdoInstallMsOsExt"   
)

◆ HubPdoPowerIrpComplete()

static NTSTATUS NTAPI HubPdoPowerIrpComplete ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_reads_opt_(_Inexpressible_("varies")) PVOID  Context 
)
static

Definition at line 1101 of file childpdo.cpp.

1105{
1106 HubPdo* Pdo = (HubPdo*)Context;
1109 WDFWORKITEM WorkItem;
1111
1113
1114 if (Irp->PendingReturned)
1116
1118 Config.AutomaticSerialization = FALSE;
1120 Attributes.ParentObject = Pdo->m_Device;
1121
1122 Status = WdfWorkItemCreate(&Config, &Attributes, &WorkItem);
1123 if (!NT_SUCCESS(Status))
1124 {
1125 DPRINT1("Port %u power IRP %p completes inline, work item failed 0x%lx\n",
1126 Pdo->m_PortNumber, Irp, Status);
1128 }
1129
1130 HubGetPdoIrpWork(WorkItem)->Irp = Irp;
1133}
WDF_OBJECT_ATTRIBUTES Attributes
Definition: childpdo.cpp:1190
static EVT_WDF_WORKITEM HubPdoEvtCompletePowerIrp
Definition: childpdo.cpp:173
_Inout_ PIRP Irp
Definition: childpdo.cpp:361
WdfWorkItemEnqueue(WorkItem)
IoMarkIrpPending(Irp)
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170
FORCEINLINE VOID WDF_WORKITEM_CONFIG_INIT(_Out_ PWDF_WORKITEM_CONFIG Config, _In_ PFN_WDF_WORKITEM EvtWorkItemFunc)
Definition: wdfworkitem.h:85
#define STATUS_CONTINUE_COMPLETION

Referenced by HubPdoPreprocessSetPower().

◆ HubPdoPreprocessInternalIoctl()

static NTSTATUS NTAPI HubPdoPreprocessInternalIoctl ( _In_ WDFDEVICE  Device,
_Inout_ PIRP  Irp 
)
static

Definition at line 2697 of file childpdo.cpp.

2700{
2701 HubPdo* Pdo = HubGetPdoContext(Device);
2703 ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode;
2704 PURB Urb = NULL;
2705 BOOLEAN Exempt = FALSE;
2706
2707 switch (Code)
2708 {
2710 Urb = (PURB)Stack->Parameters.Others.Argument1;
2711 Exempt = Urb->UrbHeader.Function == URB_FUNCTION_OPEN_STATIC_STREAMS ||
2712 Urb->UrbHeader.Function == URB_FUNCTION_CLOSE_STATIC_STREAMS;
2713 break;
2714
2717 Exempt = TRUE;
2718 break;
2719
2721 Exempt = Pdo->HasFlag(PdoFlag::InBootPath);
2722 break;
2723
2725 DPRINT("Port %u client says GET_STATUS is unsupported\n", Pdo->m_PortNumber);
2726 Pdo->SetFlag(PdoFlag::FailGetStatus);
2728
2729 default:
2730 break;
2731 }
2732
2733 /* A failed URB carries an invalid parameter status, like the USB 2.0 hub */
2734 if (Pdo->m_FailRequests && !Exempt)
2735 {
2736 DPRINT1("Port %u IRP %p IOCTL 0x%lx failed, the device is not present\n", Pdo->m_PortNumber, Irp, Code);
2737
2738 if (Urb != NULL)
2739 Urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
2740
2742 }
2743
2744 if (Urb != NULL)
2745 return HubPdoRouteUrb(Pdo, Irp, Urb);
2746
2747 return HubPdoDispatchIoctl(Pdo, Irp);
2748}
static NTSTATUS NTAPI HubPdoRouteUrb(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
Definition: childpdo.cpp:2153
static NTSTATUS NTAPI HubPdoDispatchIoctl(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:2553
@ FailGetStatus
#define IOCTL_INTERNAL_USB_FAIL_GET_STATUS_FROM_DEVICE
Definition: usbioctl.h:769

◆ HubPdoPreprocessIoctl()

static NTSTATUS NTAPI HubPdoPreprocessIoctl ( _In_ WDFDEVICE  Device,
_Inout_ PIRP  Irp 
)
static

Definition at line 2781 of file childpdo.cpp.

2784{
2785 HubPdo* Pdo = HubGetPdoContext(Device);
2787
2788 switch (Stack->Parameters.DeviceIoControl.IoControlCode)
2789 {
2796 return HubPdoToController(Pdo, Irp);
2797
2800
2803
2804 default:
2805 return HubPdoPassDown(Device, Irp);
2806 }
2807}
#define HUB_IOCTL_START_TIME_SYNC
Definition: childpdo.cpp:39
#define HUB_IOCTL_GET_TRANSPORT_CHARACTERISTICS
Definition: childpdo.cpp:35
#define HUB_IOCTL_GET_TIME_SYNC
Definition: childpdo.cpp:40
#define HUB_DEVICE_CHARACTERISTICS_SIZE
Definition: childpdo.cpp:46
#define HUB_IOCTL_REGISTER_TRANSPORT_CHANGE
Definition: childpdo.cpp:36
#define HUB_TRANSPORT_REGISTRATION_SIZE
Definition: childpdo.cpp:45
#define HUB_IOCTL_GET_DEVICE_CHARACTERISTICS
Definition: childpdo.cpp:42
static NTSTATUS NTAPI HubPdoStampAndForward(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _In_ ULONG Size)
Definition: childpdo.cpp:2754
#define HUB_IOCTL_UNREGISTER_TRANSPORT_CHANGE
Definition: childpdo.cpp:38
#define HUB_IOCTL_STOP_TIME_SYNC
Definition: childpdo.cpp:41
#define HUB_IOCTL_NOTIFY_TRANSPORT_CHANGE
Definition: childpdo.cpp:37
static NTSTATUS NTAPI HubPdoPassDown(_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
Definition: childpdo.cpp:312

◆ HubPdoPreprocessPnp()

static NTSTATUS NTAPI HubPdoPreprocessPnp ( _In_ WDFDEVICE  Device,
_Inout_ PIRP  Irp 
)
static

Definition at line 1013 of file childpdo.cpp.

1016{
1017 HubPdo* Pdo = HubGetPdoContext(Device);
1018 HubChild* Child = Pdo->m_Child;
1020 NTSTATUS EntryStatus = Irp->IoStatus.Status;
1021
1022 switch (Stack->MinorFunction)
1023 {
1025 return HubPdoQueryInterface(Pdo, Irp);
1026
1028 return HubIdQueryDeviceText(Child, Irp);
1029
1030 case IRP_MN_QUERY_ID:
1031 HubPdoPreStartOnQueryId(Pdo, Irp);
1032 return HubPdoPassDown(Device, Irp);
1033
1035 Pdo->m_ChildHubFdo = NULL;
1036 return HubPdoPassDown(Device, Irp);
1037
1038 /* KMDF leaves STATUS_NOT_SUPPORTED here; the EHCI stack answered success */
1040 HubPdoDispatchAndWait(Device, Irp);
1041
1042 HubPdoQueryAcpiD3Cold(Pdo);
1043 if (Child->m_Billboard != NULL)
1044 HubPdoPublishBillboard(Pdo);
1045 if (Child->HasProperty(ChildProperty::DualRole))
1046 HubPdoPublishDualRole(Pdo);
1047 HubPdoPublishTunnelState(Pdo);
1048
1050
1051 /* Kept synchronous; the EHCI stack never pended these */
1054 HubPdoDispatchAndWait(Device, Irp);
1055 return HubPdoCompleteAsIs(Irp);
1056
1057 /* KMDF writes success; the status from above is returned instead */
1059 HubPdoDispatchAndWait(Device, Irp);
1060 return HubPdoCompleteIrp(Irp, EntryStatus);
1061
1063 HubPdoDispatchAndWait(Device, Irp);
1064
1065 if (Irp->IoStatus.Information == 0)
1066 return HubPdoCompleteIrp(Irp, EntryStatus);
1067
1068 if (Child->m_EnumMessageId != 0)
1069 {
1070 DPRINT1("Port %u reports enumeration problem %lu\n", Pdo->m_PortNumber, Child->m_EnumMessageId);
1071 HubWriteEnumerationFailureCode(Child);
1072 HubReportPnpProblem(Device, Child->m_EnumMessageId);
1073 }
1074
1075 return HubPdoCompleteAsIs(Irp);
1076
1077 default:
1078 return HubPdoPassDown(Device, Irp);
1079 }
1080}
static NTSTATUS NTAPI HubPdoQueryInterface(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:769
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_DEVICE_ENUMERATED

◆ HubPdoPreprocessSetPower()

static NTSTATUS NTAPI HubPdoPreprocessSetPower ( _In_ WDFDEVICE  Device,
_Inout_ PIRP  Irp 
)
static

Definition at line 1139 of file childpdo.cpp.

1142{
1143 HubPdo* Pdo = HubGetPdoContext(Device);
1144 HubChild* Child = Pdo->m_Child;
1148
1149 if (Stack->Parameters.Power.Type != DevicePowerState)
1150 return HubPdoPassDown(Device, Irp);
1151
1152 Target = Stack->Parameters.Power.State.DeviceState;
1153 DPRINT("Port %u device power IRP to D%d\n", Pdo->m_PortNumber, (int)Target - 1);
1154
1155 if (Target == PowerDeviceD3 && Child->m_PowerState == PowerDeviceD2)
1156 {
1157 /* Fails when no wait wake IRP is pending, which is fine */
1158 Status = WdfDeviceIndicateWakeStatus(Device, STATUS_POWER_STATE_INVALID);
1159 if (!NT_SUCCESS(Status))
1160 DPRINT1("Port %u D2 to D3 wake status not taken 0x%lx\n", Pdo->m_PortNumber, Status);
1161
1162 Pdo->m_Idle.Post(IdleEvent::PoweringDown, NULL);
1163 }
1164
1165 Child->m_PowerState = Target;
1166
1167 /* The completion may finish the IRP later on a work item, so it is always pending */
1172 return STATUS_PENDING;
1173}
static NTSTATUS NTAPI HubPdoPowerIrpComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
Definition: childpdo.cpp:1101
_Check_return_ _In_ ULONG _In_ DEVICE_POWER_STATE DevicePowerState
Definition: dispmprt.h:1274
@ PowerDeviceD2
Definition: ntpoapi.h:51
@ PowerDeviceD3
Definition: ntpoapi.h:52
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
#define STATUS_PENDING
Definition: telnetd.h:14
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ HubPdoPreStart()

HubPdoPreStart ( Pdo->  m_Child)

◆ HubPdoQueryCapability()

static NTSTATUS NTAPI HubPdoQueryCapability ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_Inout_ PUCXHUB_QUERY_CAPABILITY  Query 
)
static

Definition at line 2480 of file childpdo.cpp.

2484{
2485 ULONG Kind = Pdo->m_Child->m_Kind;
2486 const GUID* Type = &Query->CapabilityType;
2488
2489 Query->ResultLength = 0;
2490
2491 DPRINT("Port %u capability query {%08lx-...}\n", Pdo->m_PortNumber, Type->Data1);
2492
2493 if (IsEqualGUID(*Type, GUID_USB_CAPABILITY_FUNCTION_SUSPEND))
2495
2496 if (IsEqualGUID(*Type, GUID_USB_CAPABILITY_STATIC_STREAMS))
2497 {
2498 if (Kind & DSM_KIND_PORT20)
2500
2501 return HubPdoToController(Pdo, Irp);
2502 }
2503
2504 /* Answered here, without output */
2505 if (IsEqualGUID(*Type, GUID_USB_CAPABILITY_SSP_ISOCH_PIPE_FLAGS))
2507
2508 if (IsEqualGUID(*Type, GUID_USB_CAPABILITY_DEVICE_CONNECTION_SUPER_SPEED_COMPATIBLE))
2509 Supported = (Kind & DSM_KIND_SUPER_SPEED) != 0;
2510 else if (IsEqualGUID(*Type, GUID_USB_CAPABILITY_DEVICE_CONNECTION_HIGH_SPEED_COMPATIBLE))
2515 Supported = TRUE;
2516 else
2517 return HubPdoToController(Pdo, Irp);
2518
2520}
Type
Definition: Type.h:7
static const GUID HubCapLowSpeedCompatible
Definition: childpdo.cpp:100
static const GUID HubCapFullSpeedCompatible
Definition: childpdo.cpp:98
@ Supported
Definition: classpnp.h:733
#define DSM_KIND_FULL_SPEED
Definition: devsm.h:148
#define DSM_KIND_HIGH_SPEED
Definition: devsm.h:147
#define DSM_KIND_PORT20
Definition: devsm.h:152
_In_ const GUID _In_ ULONG _In_opt_ PFN_WDF_WMI_INSTANCE_QUERY_INSTANCE Query
Definition: hubwmi.cpp:114

Referenced by HubPdoDispatchIoctl().

◆ HubPdoQueryInterface()

static NTSTATUS NTAPI HubPdoQueryInterface ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 769 of file childpdo.cpp.

772{
774 const GUID* Type = Stack->Parameters.QueryInterface.InterfaceType;
776 HubChild* Child = Pdo->m_Child;
777
778 /* Placeholders answer nothing; the PDO's own D3cold probe is left to ACPI */
779 if (!Child->HasState(ChildState::WorkingDevice) ||
780 Stack->Parameters.QueryInterface.InterfaceSpecificData == Pdo)
781 {
782 DPRINT("Interface query on port %u left alone\n", Pdo->m_PortNumber);
783 return HubPdoCompleteAsIs(Irp);
784 }
785
786 if (IsEqualGUID(*Type, USB_BUS_INTERFACE_USBDI_GUID))
787 {
788 Stack->Parameters.QueryInterface.InterfaceSpecificData = Child->m_UsbDevice;
789 return HubPdoToController(Pdo, Irp);
790 }
791
792 /* The contract is recorded for every 602 or later client, not only exact matches */
793 if (IsEqualGUID(*Type, GUID_USBD_CLIENT_INTERFACE))
794 {
795 Stack->Parameters.QueryInterface.InterfaceSpecificData = Child->m_UsbDevice;
796 Client = (PUSBD_CLIENT_INTERFACE)Stack->Parameters.QueryInterface.Interface;
797
798 if (Stack->Parameters.QueryInterface.Size >= sizeof(*Client) ||
799 Stack->Parameters.QueryInterface.Version >= USBD_CLIENT_INTERFACE_VERSION)
800 {
801 Pdo->m_ClientContractVersion = Client->ClientContractVersion;
802 }
803
804 return HubPdoToController(Pdo, Irp);
805 }
806
807 if (IsEqualGUID(*Type, GUID_UCXHUB_STACK_INTERFACE))
808 return HubPdoToController(Pdo, Irp);
809
810 if (IsEqualGUID(*Type, GUID_D3COLD_SUPPORT_INTERFACE))
811 return HubPdoAnswerD3Cold(Pdo, Irp);
812
813 return HubPdoPassDown(Pdo->m_Device, Irp);
814}
static NTSTATUS NTAPI HubPdoAnswerD3Cold(_In_ HubPdo *Pdo, _Inout_ PIRP Irp)
Definition: childpdo.cpp:721
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
Definition: client.c:31
#define USBD_CLIENT_INTERFACE_VERSION
Definition: usbdclient.h:18
struct _USBD_CLIENT_INTERFACE * PUSBD_CLIENT_INTERFACE

Referenced by HubPdoPreprocessPnp().

◆ HubPdoQueueAndWait()

static NTSTATUS NTAPI HubPdoQueueAndWait ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_In_ WDFQUEUE  Queue 
)
static

Definition at line 1902 of file childpdo.cpp.

1906{
1907 KEVENT Event;
1909
1913
1914 /* On failure KMDF completes the IRP, so the completion routine still runs */
1915 Status = WdfDeviceWdmDispatchIrpToIoQueue(Pdo->m_Device, Irp, Queue, WDF_DISPATCH_IRP_TO_IO_QUEUE_PREPROCESSED_IRP);
1916 if (!NT_SUCCESS(Status))
1917 DPRINT1("Dispatch to queue failed 0x%lx\n", Status);
1918
1920
1921 Status = Irp->IoStatus.Status;
1923 return Status;
1924}
static NTSTATUS NTAPI HubPdoSyncComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
Definition: childpdo.cpp:1876
_In_ DsmEvent Event
Definition: childpdo.cpp:259
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
@ NotificationEvent
@ WDF_DISPATCH_IRP_TO_IO_QUEUE_PREPROCESSED_IRP
Definition: wdfdevice.h:437
@ Executive
Definition: ketypes.h:467

Referenced by HubPdoDispatchIoctl(), and HubPdoRouteUrb().

◆ HubPdoQueueAsync()

static NTSTATUS NTAPI HubPdoQueueAsync ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 1929 of file childpdo.cpp.

1932{
1934 return WdfDeviceWdmDispatchIrpToIoQueue(Pdo->m_Device, Irp, Pdo->m_Queue, WDF_DISPATCH_IRP_TO_IO_QUEUE_PREPROCESSED_IRP);
1935}

Referenced by HubPdoDispatchIoctl(), and HubPdoRouteUrb().

◆ HubPdoRecordFailure()

static NTSTATUS NTAPI HubPdoRecordFailure ( _In_ HubPdo *  Pdo,
_In_opt_ HubStartFailHeader *  Data 
)
static

Definition at line 2281 of file childpdo.cpp.

2284{
2286 ULONG Length;
2287
2288 if (Pdo->m_StartFailData != NULL || Data == NULL)
2289 {
2290 DPRINT1("Port %u start failure not recorded, data %p, already %p\n",
2291 Pdo->m_PortNumber, Data, Pdo->m_StartFailData);
2293 }
2294
2295 if (Data->LengthInBytes > HUB_START_FAIL_MAX)
2296 DPRINT1("Port %u start failure data of %lu bytes cut down\n", Pdo->m_PortNumber, Data->LengthInBytes);
2297
2298 Length = min(Data->LengthInBytes, (ULONG)HUB_START_FAIL_MAX);
2299 if (Length < sizeof(*Data))
2300 {
2301 DPRINT1("Port %u start failure data of %lu bytes too small\n", Pdo->m_PortNumber, Length);
2303 }
2304
2306 if (Copy == NULL)
2307 {
2308 DPRINT1("No memory for %lu bytes of port %u start failure data\n", Length, Pdo->m_PortNumber);
2310 }
2311
2313 Pdo->m_StartFailData = Copy;
2314 Pdo->m_Child->m_Port->m_ConnectionStatus = (USB_CONNECTION_STATUS)Copy->ConnectStatus;
2315 return STATUS_SUCCESS;
2316}
#define HUB_START_FAIL_MAX
Definition: childpdo.cpp:53
Info Length
Definition: childpdo.cpp:2346
ULONG Copy
Definition: devhcd.cpp:1449
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
#define HUB_TAG_DEVICE
Definition: hubutil.h:13
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
enum _USB_CONNECTION_STATUS USB_CONNECTION_STATUS

Referenced by HubPdoDispatchIoctl().

◆ HubPdoRegisterLpmSettings()

HubPdoRegisterLpmSettings ( Pdo  )

◆ HubPdoResolveSystemWake()

HubPdoResolveSystemWake ( )

◆ HubPdoRouteUrb()

static NTSTATUS NTAPI HubPdoRouteUrb ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_Inout_ PURB  Urb 
)
static

Definition at line 2153 of file childpdo.cpp.

2157{
2159
2160 switch (Urb->UrbHeader.Function)
2161 {
2167 return HubPdoToController(Pdo, Irp);
2168
2171
2175 case URB_FUNCTION_SYNC_RESET_PIPE:
2176 case URB_FUNCTION_SYNC_CLEAR_STALL:
2178 if (!NT_SUCCESS(Status))
2179 return HubPdoCompleteIrp(Irp, Status);
2180
2181 if (Pdo->m_Child->HasProperty(ChildProperty::IsHub))
2182 return HubPdoQueueAsync(Pdo, Irp);
2183
2184 return HubPdoQueueAndWait(Pdo, Irp, Pdo->m_Queue);
2185
2188
2189 case URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR:
2191
2195 return HubPdoQueueAndWait(Pdo, Irp, Pdo->m_Queue);
2196
2198 if (Pdo->HasFlag(PdoFlag::FailGetStatus))
2199 {
2200 DPRINT1("Port %u GET_STATUS failed, the client said it is unsupported\n", Pdo->m_PortNumber);
2202 }
2203
2205 return HubPdoToController(Pdo, Irp);
2206
2207 /* UCX validates everything else */
2208 default:
2210 return HubPdoToController(Pdo, Irp);
2211 }
2212}
#define HUB_URB_FUNCTION_SELECT_LIKE
Definition: childpdo.cpp:26
static NTSTATUS NTAPI HubPdoForwardSelectLike(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
Definition: childpdo.cpp:2132
static NTSTATUS NTAPI HubPdoCachedDescriptor(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
Definition: childpdo.cpp:2000
#define HUB_URB_FUNCTION_FAST_PATH_2
Definition: childpdo.cpp:25
#define HUB_URB_FUNCTION_FAST_PATH_1
Definition: childpdo.cpp:24
static NTSTATUS NTAPI HubPdoMsFeatureDescriptor(_In_ HubPdo *Pdo, _Inout_ PIRP Irp, _Inout_ PURB Urb)
Definition: childpdo.cpp:2062
#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
Definition: usb.h:95
#define URB_FUNCTION_GET_STATUS_FROM_DEVICE
Definition: usb.h:105
#define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
Definition: usb.h:97
#define URB_FUNCTION_ISOCH_TRANSFER
Definition: usb.h:96

Referenced by HubPdoPreprocessInternalIoctl().

◆ HubPdoSelectLikeComplete()

static NTSTATUS NTAPI HubPdoSelectLikeComplete ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_reads_opt_(_Inexpressible_("varies")) PVOID  Context 
)
static

Definition at line 2112 of file childpdo.cpp.

2116{
2118
2119 if (Irp->PendingReturned)
2121
2122 if (NT_SUCCESS(Irp->IoStatus.Status))
2124
2126}

Referenced by HubPdoForwardSelectLike().

◆ HubPdoSendWakeNotification()

static NTSTATUS NTAPI HubPdoSendWakeNotification ( _In_ HubPdo *  Pdo)
static

Definition at line 1636 of file childpdo.cpp.

1638{
1641 WDFREQUEST Request = Pdo->m_WakeRequest;
1643
1645 Status = WdfRequestReuse(Request, &Reuse);
1646 if (!NT_SUCCESS(Status))
1647 DPRINT1("Wake request reuse failed 0x%lx\n", Status);
1648
1649 RtlZeroMemory(&Pdo->m_WakeBlock, sizeof(Pdo->m_WakeBlock));
1650 Pdo->m_WakeBlock.Size = sizeof(Pdo->m_WakeBlock);
1651 KeClearEvent(&Pdo->m_WakeDone);
1652
1653 RtlZeroMemory(&Stack, sizeof(Stack));
1654 Stack.MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
1655 Stack.Parameters.Others.Argument1 = &Pdo->m_WakeBlock;
1656 Stack.Parameters.Others.Argument2 = Pdo->m_Child->m_UsbDevice;
1657 Stack.Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_REQUEST_REMOTE_WAKE_NOTIFICATION;
1658
1659 WdfRequestWdmFormatUsingStackLocation(Request, &Stack);
1660 WdfRequestSetCompletionRoutine(Request, HubPdoWakeNotificationComplete, Pdo);
1661
1662 if (!WdfRequestSend(Request, Pdo->m_Hub->m_RootHubTarget, WDF_NO_SEND_OPTIONS))
1663 {
1664 Status = WdfRequestGetStatus(Request);
1665 DPRINT1("Port %u wake notification not sent 0x%lx\n", Pdo->m_PortNumber, Status);
1666 return Status;
1667 }
1668
1669 return STATUS_SUCCESS;
1670}
static EVT_WDF_REQUEST_COMPLETION_ROUTINE HubPdoWakeNotificationComplete
Definition: childpdo.cpp:174
return pRequest Reuse(ReuseParams)
_Must_inspect_result_ FORCEINLINE BOOLEAN WdfRequestSend(_In_ WDFREQUEST Request, _In_ WDFIOTARGET Target, _In_opt_ PWDF_REQUEST_SEND_OPTIONS Options)
Definition: wdfrequest.h:677
@ 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
#define IRP_MJ_INTERNAL_DEVICE_CONTROL

Referenced by HubPdoEvtEnableWakeAtBus().

◆ HubPdoSetCallbacks()

HubPdoSetCallbacks ( Init  )

◆ HubPdoSetPnpCapabilities()

HubPdoSetPnpCapabilities ( Pdo  )

◆ HubPdoSignalCompletion()

static NTSTATUS NTAPI HubPdoSignalCompletion ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_reads_opt_(_Inexpressible_("varies")) PVOID  Context 
)
static

Definition at line 341 of file childpdo.cpp.

◆ HubPdoStampAndForward()

static NTSTATUS NTAPI HubPdoStampAndForward ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp,
_In_ ULONG  Size 
)
static

Definition at line 2754 of file childpdo.cpp.

2758{
2760 PUCHAR Buffer = (PUCHAR)Irp->AssociatedIrp.SystemBuffer;
2761 UCXUSBDEVICE UsbDevice = Pdo->m_Child->m_UsbDevice;
2762
2763 if (Stack->Parameters.DeviceIoControl.InputBufferLength != Size ||
2764 Stack->Parameters.DeviceIoControl.OutputBufferLength != Size ||
2765 Buffer == NULL)
2766 {
2767 DPRINT1("Port %u IOCTL 0x%lx buffers %lu/%lu, expected %lu\n",
2768 Pdo->m_PortNumber, Stack->Parameters.DeviceIoControl.IoControlCode,
2769 Stack->Parameters.DeviceIoControl.InputBufferLength,
2770 Stack->Parameters.DeviceIoControl.OutputBufferLength, Size);
2772 }
2773
2775 return HubPdoToController(Pdo, Irp);
2776}
#define HUB_STAMPED_HANDLE_OFFSET
Definition: childpdo.cpp:47
_In_ UCXUSBDEVICE UsbDevice
Definition: hostctl.h:31

Referenced by HubPdoPreprocessIoctl().

◆ HubPdoStampUrb()

static VOID NTAPI HubPdoStampUrb ( _In_ HubPdo *  Pdo,
_Inout_ PURB  Urb 
)
static

Definition at line 1940 of file childpdo.cpp.

1943{
1944 Urb->UrbHeader.UsbdDeviceHandle = Pdo->m_Child->m_UsbDevice;
1945}

Referenced by HubPdoCachedDescriptor(), HubPdoForwardSelectLike(), HubPdoMsFeatureDescriptor(), and HubPdoRouteUrb().

◆ HubPdoSyncComplete()

static NTSTATUS NTAPI HubPdoSyncComplete ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_reads_opt_(_Inexpressible_("varies")) PVOID  Context 
)
static

Definition at line 1876 of file childpdo.cpp.

1880{
1882 NTSTATUS Status = Irp->IoStatus.Status;
1883
1885
1886 if (!NT_SUCCESS(Status) &&
1887 Stack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_SUBMIT_URB)
1888 {
1889 PURB Urb = (PURB)Stack->Parameters.Others.Argument1;
1890 if (Urb->UrbHeader.Status == USBD_STATUS_SUCCESS)
1891 Urb->UrbHeader.Status = HubNtStatusToUsbd(Status);
1892 }
1893
1896}
USBD_STATUS NTAPI HubNtStatusToUsbd(_In_ NTSTATUS Status)
Definition: childpdo.cpp:190

Referenced by HubPdoQueueAndWait().

◆ HubPdoToController()

static NTSTATUS NTAPI HubPdoToController ( _In_ HubPdo *  Pdo,
_Inout_ PIRP  Irp 
)
static

Definition at line 324 of file childpdo.cpp.

327{
328 if (Pdo->m_ControllerTarget == NULL)
329 {
330 DPRINT1("Port %u has no controller target for IRP %p\n", Pdo->m_PortNumber, Irp);
332 }
333
335 return IoCallDriver(Pdo->m_ControllerTarget, Irp);
336}

Referenced by HubPdoCachedDescriptor(), HubPdoDispatchIoctl(), HubPdoMsFeatureDescriptor(), HubPdoPreprocessIoctl(), HubPdoQueryCapability(), HubPdoQueryInterface(), HubPdoRouteUrb(), and HubPdoStampAndForward().

◆ HubPdoTopologyAddress()

static NTSTATUS NTAPI HubPdoTopologyAddress ( _In_ HubPdo *  Pdo,
_Out_opt_ PUSB_TOPOLOGY_ADDRESS  Address 
)
static

Definition at line 2401 of file childpdo.cpp.

2404{
2405 HubFdo* Hub = Pdo->m_Hub;
2407
2408 if (Address == NULL)
2409 {
2410 DPRINT1("Port %u topology address request has no buffer\n", Pdo->m_PortNumber);
2412 }
2413
2415
2416 if (Depth == 0)
2417 Address->RootHubPortNumber = Pdo->m_PortNumber;
2418 else if (Depth - 1 < (UCHAR)RTL_NUMBER_OF(Address->HubPortNumber))
2419 Address->HubPortNumber[Depth - 1] = Pdo->m_PortNumber;
2420
2421 return STATUS_SUCCESS;
2422}
static WCHAR Address[46]
Definition: ping.c:68

Referenced by HubPdoDispatchIoctl().

◆ HubPdoUrbBuffer()

static PVOID NTAPI HubPdoUrbBuffer ( _In_ PVOID  Pointer,
_In_opt_ PMDL  Mdl 
)
static

Definition at line 1986 of file childpdo.cpp.

1989{
1990 if (Mdl != NULL)
1992
1993 return Pointer;
1994}
@ NormalPagePriority
Definition: imports.h:54
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)

Referenced by HubPdoCachedDescriptor(), and HubPdoMsFeatureDescriptor().

◆ HubPdoValidateUrb()

static NTSTATUS NTAPI HubPdoValidateUrb ( _Inout_ PURB  Urb)
static

Definition at line 1951 of file childpdo.cpp.

1953{
1954 USHORT Function = Urb->UrbHeader.Function;
1955
1956 if (Urb->UrbHeader.Length < sizeof(struct _URB_HEADER))
1957 DPRINT1("URB %p header length %u too small\n", Urb, Urb->UrbHeader.Length);
1958
1959 Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
1960 Urb->UrbHeader.UsbdFlags = 0;
1961
1963 {
1964 DPRINT1("URB %p has invalid function 0x%x\n", Urb, Function);
1965 Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION;
1967 }
1968
1970 Function == URB_FUNCTION_SYNC_RESET_PIPE ||
1971 Function == URB_FUNCTION_SYNC_CLEAR_STALL) &&
1972 Urb->UrbHeader.Length != sizeof(struct _URB_PIPE_REQUEST))
1973 {
1974 DPRINT1("Pipe URB %p length %u, expected %lu\n",
1975 Urb, Urb->UrbHeader.Length, (ULONG)sizeof(struct _URB_PIPE_REQUEST));
1976 Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION;
1978 }
1979
1980 return STATUS_SUCCESS;
1981}
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
#define HUB_URB_FUNCTION_LAST
Definition: childpdo.cpp:23
#define USBD_STATUS_INVALID_URB_FUNCTION
Definition: usb.h:202

Referenced by HubPdoCachedDescriptor(), and HubPdoRouteUrb().

◆ HubPdoWakeNotificationComplete()

static VOID NTAPI HubPdoWakeNotificationComplete ( _In_ WDFREQUEST  Request,
_In_ WDFIOTARGET  Target,
_In_ PWDF_REQUEST_COMPLETION_PARAMS  Params,
_In_ WDFCONTEXT  Context 
)
static

Definition at line 1616 of file childpdo.cpp.

1621{
1622 HubPdo* Pdo = (HubPdo*)Context;
1623
1627
1628 DPRINT("Port %u wake notification done 0x%lx\n", Pdo->m_PortNumber, Params->IoStatus.Status);
1630 KeSetEvent(&Pdo->m_WakeDone, IO_NO_INCREMENT, FALSE);
1631}
static VOID NTAPI HubPdoIndicateWake(_In_ HubPdo *Pdo)
Definition: childpdo.cpp:1598
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308

◆ HubReadDeviceHardwareValues()

HubReadDeviceHardwareValues ( Child  )

◆ HubTakeClientRequest()

static WDFREQUEST NTAPI HubTakeClientRequest ( _In_ HubChild *  Child)
static

Definition at line 3451 of file childpdo.cpp.

3453{
3454 WDFREQUEST Request = Child->m_ClientRequest;
3455
3456 Child->m_ClientRequest = NULL;
3457 Child->ClearState(ChildState::ActivityIdSet);
3458 return Request;
3459}

Referenced by DeviceMachine::CompleteClientRequest(), DeviceMachine::CompleteClientRequestFailed(), and DeviceMachine::CompleteClientRequestLastStatus().

◆ HubUsbdStatusToNt()

static NTSTATUS NTAPI HubUsbdStatusToNt ( _In_ USBD_STATUS  Status)
static

Definition at line 220 of file childpdo.cpp.

222{
223 switch (Status)
224 {
227 return STATUS_SUCCESS;
228
231
237
240
243
245 return STATUS_CANCELLED;
246
247 default:
248 return STATUS_UNSUCCESSFUL;
249 }
250}
#define USBD_STATUS_INVALID_PIPE_HANDLE
Definition: usb.h:205
#define USBD_STATUS_PORT_OPERATION_PENDING
Definition: usb.h:178
#define USBD_STATUS_BAD_START_FRAME
Definition: usb.h:209

Referenced by HubFailClientCheck().

◆ HubWriteEnumerationData()

HubWriteEnumerationData ( Child  )

◆ if() [1/42]

if ( !  Hub->HasFlag(HubFlag::InAcpiNamespace) &&Child->HasProperty(ChildProperty::NotRemovable))

◆ if() [2/42]

if ( !Child->  HasPropertyChildProperty::IsHub) &&!Child->HasProperty(ChildProperty::IsComposite)

◆ if() [3/42]

if ( !  Known)

Definition at line 3319 of file childpdo.cpp.

3320 {
3321 Status = WdfPdoInitAssignRawDevice(Init, &HubClassUnknown);
3322 if (!NT_SUCCESS(Status))
3323 DPRINT1("Raw device assignment failed 0x%lx\n", Status);
3324 }
static const GUID HubClassUnknown
Definition: childpdo.cpp:94

◆ if() [4/42]

if ( !  NT_SUCCESSStatus)

Definition at line 1000 of file childpdo.cpp.

1001 {
1002 DPRINT1("Hub did not power up for pre start 0x%lx\n", Status);
1003 return;
1004 }

◆ if() [5/42]

if ( !Pdo->  HasFlagPdoFlag::DeviceGone) &&Child->HasState(ChildState::WorkingDevice) -> m_FailRequests=FALSE

◆ if() [6/42]

if ( !Pdo->  HasFlagPdoFlag::Started) -> m_Child)

◆ if() [7/42]

if ( (Hub->m_ParentInfo.Flags &HUB_PARENT_HIGH_SPEED_CAPABLE)||Hub->m_ParentInfo.DeviceDescriptor.bcdUSB >=  0x0200)

Definition at line 2348 of file childpdo.cpp.

2350 {
2351 Info->HubFlags.HubIsHighSpeedCapable = 1;
2352 }

◆ if() [8/42]

if ( Buffer  = = NULL)

Definition at line 961 of file childpdo.cpp.

962 {
963 DPRINT1("No memory for the location string of port %u\n", Child->m_Port->Number());
965 }

◆ if() [9/42]

if ( Child->  HasPropertyChildProperty::DualRole) -> ClearProperty(ChildProperty::DualRole)

◆ if() [10/42]

if ( Child->  HasPropertyChildProperty::IsHub)

Definition at line 1222 of file childpdo.cpp.

1223 {
1224 if (Hub->m_Parent.HubDepth >= Child->m_Port->m_Info.TotalHubDepth)
1225 {
1226 DPRINT1("Hub on port %u nested too deeply, depth %u\n", Pdo->m_PortNumber, Hub->m_Parent.HubDepth);
1227 Child->m_Port->m_ConnectionStatus = DeviceHubNestedTooDeeply;
1228 HubWmiNotifyHubNestedTooDeeply(Hub, Pdo->m_PortNumber);
1229 return STATUS_UNSUCCESSFUL;
1230 }
1231
1232 InterfaceGuid = &GUID_DEVINTERFACE_USB_HUB;
1233 }
const GUID * InterfaceGuid
Definition: childpdo.cpp:1191

◆ if() [11/42]

if ( Child->  HasPropertyChildProperty::UxdReserved)

Definition at line 2370 of file childpdo.cpp.

2371 {
2372 Info->Reserved[18] = 1;
2373 RtlCopyMemory(&Info->UxdSettings, &Child->m_Uxd, sizeof(Info->UxdSettings));
2374 }

◆ if() [12/42]

◆ if() [13/42]

if ( Device !  = NULL)

Definition at line 3399 of file childpdo.cpp.

3400 {
3401 Child->m_Pdo = NULL;
3403 }

◆ if() [14/42]

if ( Hub->  HasFlagHubFlag::MultiTtHub)

Definition at line 2354 of file childpdo.cpp.

2355 {
2356 Info->HubFlags.HubIsMultiTt = 1;
2357 Info->HubFlags.HubIsMultiTtCapable = 1;
2358 }

◆ if() [15/42]

if ( Hub->  HasFlagHubFlag::WakeOnConnect) -> HubFlags.HubIsArmedWakeOnConnect=1

◆ if() [16/42]

if ( Hub->  IsRootHub()) -> HubFlags.HubIsRoot=1

◆ if() [17/42]

if ( Hub->  m_MaxPortPower = =100) -> HubFlags.HubIsBusPowered=1

◆ if() [18/42]

if ( Hub->m_Parent.  HubSpeed = =UsbHighSpeed) -> HubFlags.HubIsHighSpeed=1

◆ if() [19/42]

Definition at line 1207 of file childpdo.cpp.

1208 {
1210 {
1211 DPRINT("Port %u keeps U2 off for its tunneled device\n", Pdo->m_PortNumber);
1213 }
1214
1215 HubUsb4AcquireHostPower(Child->m_Port);
1216 }
BOOLEAN m_TunneledDevicesSkipU2
Definition: fdo.h:470
#define InterlockedOr
Definition: interlocked.h:239
long LONG
Definition: pedump.c:60
int32_t * PLONG
Definition: typedefs.h:58

◆ if() [20/42]

◆ if() [21/42]

if ( Info->Length !  = sizeof(*Info))

Definition at line 2337 of file childpdo.cpp.

2338 {
2339 DPRINT1("Port %u config info length %lu, expected %lu\n",
2340 Pdo->m_PortNumber, Info->Length, (ULONG)sizeof(*Info));
2342 }

◆ if() [22/42]

if ( Info  = = NULL || Info->Version != 1)

Definition at line 2331 of file childpdo.cpp.

2332 {
2333 DPRINT1("Port %u config info %p has a bad version\n", Pdo->m_PortNumber, Info);
2335 }

◆ if() [23/42]

if ( Init !  = NULL)

◆ if() [24/42]

if ( Init  = = NULL)

Definition at line 3294 of file childpdo.cpp.

3295 {
3296 DPRINT1("No PDO init for port %u\n", Port->Number());
3297 return FALSE;
3298 }

◆ if() [25/42]

if ( Known  )

Definition at line 3279 of file childpdo.cpp.

3280 {
3282 }

◆ if() [26/42]

if ( NT_SUCCESS(Status) &&*D3ColdSupported &&Pdo->m_Child->m_Port->HasProperty(PortProperty::Removable)  )

Definition at line 607 of file childpdo.cpp.

609 {
610 DPRINT1("Platform claims D3cold for a removable port %u\n", Pdo->m_PortNumber);
611 }

◆ if() [27/42]

if ( NT_SUCCESS(Status)  )

Definition at line 2380 of file childpdo.cpp.

2381 {
2383 FriendlyName.LengthInBytes = Child->m_FriendlyNameLength;
2384 FriendlyName.Buffer = Child->m_FriendlyName;
2385 Status = HubIdListCopy(&Info->DeviceDescription, &FriendlyName);
2386 }
USB_ID_STRING FriendlyName
Definition: childpdo.cpp:2328
NTSTATUS NTAPI HubIdListCopy(_Out_ PUSB_ID_STRING Destination, _In_ const USB_ID_STRING *Source)
Definition: hubid.cpp:173

◆ if() [28/42]

Definition at line 992 of file childpdo.cpp.

995 {
996 return;
997 }

◆ if() [29/42]

if ( Pdo->  HasFlagPdoFlag::WasResetAtResume)

◆ if() [30/42]

if ( Pdo->m_AcpiD3Cold.  GetD3ColdCapability = = NULL)

Definition at line 600 of file childpdo.cpp.

601 {
603 return STATUS_SUCCESS;
604 }
_Out_ PBOOLEAN D3ColdSupported
Definition: iotypes.h:7546

◆ if() [31/42]

if ( Pdo->m_AcpiD3Cold.GetIdleWakeInfo !  = NULL)

Definition at line 565 of file childpdo.cpp.

566 {
567 Status = Pdo->m_AcpiD3Cold.GetIdleWakeInfo(Pdo->m_AcpiD3Cold.Context,
570 if (NT_SUCCESS(Status))
571 return Status;
572 }
_In_ SYSTEM_POWER_STATE _Out_ PDEVICE_WAKE_DEPTH DeepestWakeableDstate
Definition: iotypes.h:7536
_In_ SYSTEM_POWER_STATE SystemPowerState
Definition: iotypes.h:7535

◆ if() [32/42]

if ( Pdo->m_AcpiD3Cold.GetLastTransitionStatus !  = NULL)

Definition at line 645 of file childpdo.cpp.

646 {
647 Pdo->m_AcpiD3Cold.GetLastTransitionStatus(Pdo->m_AcpiD3Cold.Context, LastTransitionStatus);
649 return;
650 }
@ LastDStateTransitionD3cold
Definition: iotypes.h:7554
_Out_ PD3COLD_LAST_TRANSITION_STATUS LastTransitionStatus
Definition: iotypes.h:7563

◆ if() [33/42]

◆ if() [34/42]

if ( Pdo->m_Hub->m_Capabilities.SystemWake >=SystemPowerState &&  Child->HasProperty(ChildProperty::RemoteWakeCapable)||Child->HasProperty(ChildProperty::IsHub))

Definition at line 574 of file childpdo.cpp.

576 {
578 }
@ DeviceWakeDepthD2
Definition: iotypes.h:7498

◆ if() [35/42]

if ( Pdo->m_SymbolicLink !  = NULL) -> m_SymbolicLink, SymbolicLinkName)

◆ if() [36/42]

if ( Pdo->  m_SymbolicLink = = NULL)

Definition at line 1246 of file childpdo.cpp.

1247 {
1249 Attributes.ParentObject = Device;
1250
1251 Status = WdfStringCreate(NULL, &Attributes, &Pdo->m_SymbolicLink);
1252 if (!NT_SUCCESS(Status))
1253 {
1254 DPRINT1("Port %u symbolic link string not created 0x%lx\n", Pdo->m_PortNumber, Status);
1255 return Status;
1256 }
1257 }
_Out_ WDFDEVICE * Device
Definition: childpdo.cpp:3065
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147

◆ if() [37/42]

if ( Pdo->  TestAndClearFlagPdoFlag::QueryRemoved)

◆ if() [38/42]

if ( Pdo->  TestAndClearFlagPdoFlag::QueryStopped)

◆ if() [39/42]

if ( Referenced  ) -> m_Object,(PVOID) HubTagPdo)

◆ if() [40/42]

◆ if() [41/42]

Definition at line 1546 of file childpdo.cpp.

1547 {
1549 }
@ PdoPowerDownFinal

◆ if() [42/42]

if ( WdfTimerStop(Child->m_BandwidthRetryTimer, TRUE)  )

Definition at line 1580 of file childpdo.cpp.

1581 {
1582 DPRINT1("Port %u ran out of bandwidth\n", Pdo->m_PortNumber);
1583 HubWmiNotifyInsufficientBandwidth(Pdo->m_Hub, Pdo->m_PortNumber);
1584 }

◆ Initialize()

Pdo m_Idle Initialize ( Pdo  )

◆ IoCopyCurrentIrpStackLocationToNext()

IoCopyCurrentIrpStackLocationToNext ( Irp  )

◆ IoSetCompletionRoutine()

IoSetCompletionRoutine ( Irp  ,
HubPdoSignalCompletion  ,
&  Event,
TRUE  ,
TRUE  ,
TRUE   
)

◆ Number()

Port Number ( )

◆ PAGED_CODE()

PAGED_CODE ( )

Referenced by _IRQL_requires_().

◆ Post() [1/3]

Child Post ( Event  )

◆ Post() [2/3]

Pdo m_Idle Post ( IdleEvent::PoweredUp  ,
NULL   
)

◆ Post() [3/3]

Pdo m_Idle Post ( IdleEvent::Start  ,
NULL   
)

◆ RtlInitEmptyUnicodeString()

RtlInitEmptyUnicodeString ( SymbolicLinkName  ,
NULL  ,
0   
)

Referenced by _Function_class_(), _IRQL_requires_(), _main(), _Success_(), _tmain(), AddNTOSInstallation(), ApphelppInitDebugLevel(), ArbpOpenPolicySubkey(), AVrfpLoadAndInitializeProvider(), BaseCreateVDMEnvironment(), BaseInitApphelp(), BaseInitializeStaticServerData(), BasepIsCurDirAllowedForPlainExeNames(), BasepOpenFileForMove(), BuildSubSysCommandLine(), BuildUserModeWindowStationName(), CheckSid__(), ClassNameToVersion(), cleanup(), CmpAddDriverToList(), CmpCmdHiveOpen(), CmpInitializeHive(), CmpInitializeHiveList(), CmpInitializeRegistryNode(), CmpInitializeSystemHive(), CmpIsSafe(), CmpOpenHiveFiles(), CmpRemoveFromHiveFileList(), CmpSetVersionData(), CNtObjectFolder::CompareIDs(), ConvertNtPathToWin32Path(), CreateDeviceFromRegistry(), CreateProcessInternalW(), dempIsFileMatch(), EjectFloppy(), ElfCloseFile(), ElfCreateFile(), EmulatorInitialize(), EnumerateInstallations(), EraseLine(), ExpandEnvironmentStringsA(), ExpandEnvironmentStringsW(), ExpInitializeExecutive(), ExpLoadInitialProcess(), FltpAttachToFileSystemDevice(), GetClassNameW(), CNtObjectFolder::GetDetailsEx(), CNtObjectFolder::GetDetailsOf(), GetEnvironmentVariableA(), GetEnvironmentVariableW(), GetFinalPathNameByHandleW(), GetKeyboardLayoutNameW(), GetSourcePaths(), GetSystemVersionString(), HalpRegisterPciDebuggingDeviceInfo(), HubUsb4OpenWorkItem(), IntGdiAddFontResourceSingle(), IntGdiRemoveFontResourceSingle(), IntResolveDesktop(), IntSetAconData(), IntSetCursorData(), IopLogWorker(), IopQueryDeviceDescription(), IopSeparateSymbolicLink(), IopStartRamdisk(), IopStoreSystemPartitionInformation(), IsShortName_U(), IsValidNTOSInstallationByHandle(), KsepGetShimsFromRegistry(), LDEVOBJ_bLoadImage(), LDEVOBJ_pLoadDriver(), LdrGetDllHandleEx(), LdrLoadDll(), LdrpFreeUnicodeString(), LdrpInitializeDotLocalSupport(), LdrpInitializeProcess(), LdrpLoadDll(), LdrpLoadImportModule(), LdrpSnapThunk(), LdrpUpdateLoadCount2(), LoadSymbolsRoutine(), LpcpCreatePort(), LsapSetLogonSessionData(), MiQueryMemorySectionName(), MountFloppy(), NpCancelWaiter(), NtGdiOpenDCW(), NtQueryDirectoryObject(), NtQueryInformationThread(), NtQuerySystemEnvironmentValue(), NtUserChangeDisplaySettings(), NtUserEnumDisplayDevices(), NtUserEnumDisplaySettings(), NtUserLoadKeyboardLayoutEx(), NtVdmConfigureBios(), NtVdmConfigureFloppy(), NtVdmConfigureHDD(), NtVdmConfigureRom(), ObpCaptureObjectCreateInformation(), ObpCaptureObjectName(), ObpDeleteObject(), ObpDereferenceNameInfo(), ObQueryNameString(), ParseArcName(), PiPropBuildValuePath(), PiPropInitLocale(), PnpRootCreateDevice(), PrivMoveFileIdentityW(), ProbeAndCaptureObjectAttributes(), ProbeAndCaptureUnicodeStringOrAtom(), ProcessPortMessage(), RealGetWindowClassW(), RegCreateKeyExA(), RegDeleteKeyExA(), RegLoadKeyA(), RegOpenKeyExA(), RegQueryInfoKeyA(), RegQueryValueExA(), RegReplaceKeyA(), RegRestoreKeyA(), RegSaveKeyA(), RegSaveKeyExA(), RegUnLoadKeyA(), CNtObjectFolder::ResolveSymLink(), RtlConvertUiListToApiList(), RtlDosApplyFileIsolationRedirection_Ustr(), RtlDosSearchPath_Ustr(), RtlFormatCurrentUserKeyPath(), RtlpCallQueryRegistryRoutine(), RtlpDosPathNameToRelativeNtPathName_Ustr(), RtlpGetRegistryHandle(), RtlpNtQueryValueKey(), RtlpNtSetValueKey(), RtlpWin32NTNameToNtPathName_U(), RtlQueryRegistryValues(), RtlSetCurrentDirectory_U(), RunTestCases(), RxCanonicalizeNameAndObtainNetRoot(), RxCreateTreeConnect(), RxFirstCanonicalize(), RxPrefixClaim(), ScmConvertToBootPathName(), SdbpMatchExe(), SdbpPropagateEnvLayers(), SdbUnregisterDatabase(), SeiAddHooks(), SeiInitDebugSupport(), SetupLdrLoadNlsData(), SmLookupSubsystem(), SmpCreateDynamicEnvironmentVariables(), SmpInvokeAutoChk(), SmpParseCommandLine(), SmpProcessModuleImports(), SmpTranslateSystemPartitionInformation(), START_TEST(), test_allocations(), test_dllnames(), Test_RtlCultureNameToLCID(), Test_RtlLCIDToCultureName(), Test_RtlLcidToLocaleName(), Test_RtlUnicodeStringPrintf(), Test_RtlUnicodeStringPrintfEx(), TestBuffers(), TestIoVolumeDeviceToDosName(), TestMessageHandler(), TestQueryLink(), TestRedirection(), TestRelativeNames(), TestUpcaseUnicodeString(), UcxBuildRootHubHardwareIds(), UcxParentGetHubSymbolicName(), UserpFormatMessages(), UserpGetClientFileName(), UserServerHardError(), VersionRegisterClass(), vfatGetFCBForFile(), VfatSetRenameInformation(), WinLdrAddDriverToList(), and WinLdrGetNLSNames().

◆ RtlZeroMemory()

RtlZeroMemory ( Info  ,
sizeof *  Info 
)

◆ SetFlag() [1/2]

◆ SetFlag() [2/2]

Pdo SetFlag ( PdoFlag::Started  )

◆ UNREFERENCED_PARAMETER() [1/4]

UNREFERENCED_PARAMETER ( IoResourceRequirementsList  )

◆ UNREFERENCED_PARAMETER() [2/4]

UNREFERENCED_PARAMETER ( PreviousState  )

◆ UNREFERENCED_PARAMETER() [3/4]

UNREFERENCED_PARAMETER ( ResourcesRaw  )

◆ UNREFERENCED_PARAMETER() [4/4]

UNREFERENCED_PARAMETER ( ResourcesTranslated  )

◆ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME()

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME ( HubPdoIrpWork  ,
HubGetPdoIrpWork   
)

◆ WdfDeviceInitSetDeviceType()

WdfDeviceInitSetDeviceType ( Init  ,
FILE_DEVICE_UNKNOWN   
)

◆ WdfDeviceInitSetExclusive()

WdfDeviceInitSetExclusive ( Init  ,
FALSE   
)

Referenced by DriverEvtDeviceAdd().

◆ WdfDeviceInitSetRemoveLockOptions()

WdfDeviceInitSetRemoveLockOptions ( Init  ,
&  RemoveLock 
)

Referenced by DriverEvtDeviceAdd().

◆ WdfDeviceResumeIdle()

WdfDeviceResumeIdle ( HubDevice  )

◆ WdfDeviceSetSpecialFileSupport() [1/4]

WdfDeviceSetSpecialFileSupport ( Device  ,
WdfSpecialFileBoot  ,
TRUE   
)

◆ WdfDeviceSetSpecialFileSupport() [2/4]

WdfDeviceSetSpecialFileSupport ( Device  ,
WdfSpecialFileDump  ,
TRUE   
)

◆ WdfDeviceSetSpecialFileSupport() [3/4]

WdfDeviceSetSpecialFileSupport ( Device  ,
WdfSpecialFileHibernation  ,
TRUE   
)

◆ WdfDeviceSetSpecialFileSupport() [4/4]

WdfDeviceSetSpecialFileSupport ( Device  ,
WdfSpecialFilePaging  ,
TRUE   
)

◆ WdfDeviceWdmDispatchPreprocessedIrp()

◆ WdfObjectReferenceWithTag()

WdfObjectReferenceWithTag ( Child->  m_Object,
(PVOID)  HubTagPdo 
)

◆ WdfPdoInitAllowForwardingRequestToParent()

WdfPdoInitAllowForwardingRequestToParent ( Init  )

Referenced by UcxRootHub::CreatePdo().

Variable Documentation

◆ __pad0__

Failed __pad0__

Definition at line 3393 of file childpdo.cpp.

◆ Action

Action = WdfDeviceGetSystemPowerAction(Device)

Definition at line 1530 of file childpdo.cpp.

◆ Attributes

◆ Buffer

◆ Child

HubWaitForPnpEvent& Child = Pdo->m_Child

Definition at line 264 of file childpdo.cpp.

◆ Count

const SIZE_T Count = 10

Definition at line 952 of file childpdo.cpp.

◆ D3ColdSupport

_In_ BOOLEAN D3ColdSupport
Initial value:

Definition at line 537 of file childpdo.cpp.

◆ D3ColdSupported

Initial value:

Definition at line 593 of file childpdo.cpp.

◆ DeepestWakeableDstate

◆ Device

WDFDEVICE Device
Initial value:
{
DECLARE_CONST_UNICODE_STRING(Sddl, L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GRGW;;;WD)(A;;GR;;;RC)")
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161

Definition at line 3064 of file childpdo.cpp.

Referenced by if().

◆ else

else
Initial value:

Definition at line 579 of file childpdo.cpp.

◆ Event

Definition at line 259 of file childpdo.cpp.

Referenced by HubPdoQueueAndWait().

◆ EvtCleanupCallback

Attributes EvtCleanupCallback = HubPdoEvtCleanup

Definition at line 3082 of file childpdo.cpp.

◆ FALSE

◆ FriendlyName

USB_ID_STRING FriendlyName

Definition at line 2328 of file childpdo.cpp.

Referenced by if(), and Test_DeviceBuiltins().

◆ Hub

◆ HubCapFullSpeedCompatible

const GUID HubCapFullSpeedCompatible
static
Initial value:
=
{ 0xcde43191, 0x1fad, 0x4120, { 0xa7, 0xab, 0x74, 0x09, 0x56, 0xc6, 0x6f, 0x37 } }

Definition at line 98 of file childpdo.cpp.

Referenced by HubPdoQueryCapability().

◆ HubCapLowSpeedCompatible

const GUID HubCapLowSpeedCompatible
static
Initial value:
=
{ 0xad6f2a13, 0xc4d1, 0x4925, { 0x83, 0xcc, 0x96, 0x85, 0x7a, 0x24, 0x31, 0xd9 } }

Definition at line 100 of file childpdo.cpp.

Referenced by HubPdoQueryCapability().

◆ HubClassUnknown

const GUID HubClassUnknown
static
Initial value:
=
{ 0x4d36e97e, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }

Definition at line 94 of file childpdo.cpp.

Referenced by if().

◆ HubDevice

WDFDEVICE HubDevice = Pdo->m_Hub->m_Device

◆ HubKeyBillboardInfo

const DEVPROPKEY HubKeyBillboardInfo
static
Initial value:
=
{ { 0xb1049018, 0x6da0, 0x4490, { 0xb0, 0xc9, 0x1e, 0x91, 0xf1, 0xf5, 0x5b, 0xd7 } }, 2 }

Definition at line 104 of file childpdo.cpp.

◆ HubKeyDualRoleFeatures

const DEVPROPKEY HubKeyDualRoleFeatures
static
Initial value:
=
{ { 0x32d615be, 0x32f4, 0x4fdc, { 0xbc, 0x48, 0xfc, 0x54, 0x30, 0x1a, 0xb6, 0xc4 } }, 2 }

Definition at line 106 of file childpdo.cpp.

◆ HubKeyUsb4TunnelState

const DEVPROPKEY HubKeyUsb4TunnelState
static
Initial value:
=
{ { 0xb5a825b8, 0x3907, 0x40b5, { 0xab, 0xca, 0x84, 0x51, 0xe2, 0x45, 0x3d, 0x5f } }, 3 }

Definition at line 108 of file childpdo.cpp.

◆ HubLpmDeviceSettings

const GUID HubLpmDeviceSettings[HUB_PDO_LPM_SETTINGS]
static
Initial value:
=
{
{ 0xfb093825, 0xbf59, 0x4fe6, { 0x8b, 0x6f, 0xaf, 0xd6, 0x71, 0x4c, 0x69, 0xe5 } },
{ 0x903281ea, 0xc859, 0x47a9, { 0x89, 0x01, 0x7a, 0x11, 0x8c, 0x7b, 0xf5, 0xa7 } },
{ 0xa7b5d35e, 0xc12c, 0x4f36, { 0xa4, 0x4f, 0x00, 0x62, 0x8f, 0x90, 0x03, 0x88 } },
{ 0x300c0440, 0xee77, 0x4c1b, { 0xaf, 0x99, 0x3a, 0x33, 0xf8, 0xa9, 0xca, 0x5d } },
{ 0xd4e98f31, 0x5ffe, 0x4ce1, { 0xbe, 0x31, 0x1b, 0x38, 0xb3, 0x84, 0xc0, 0x09 } }
}

Definition at line 112 of file childpdo.cpp.

Referenced by HubPdoLpmSettingChanged().

◆ HubLpmHubSettings

const GUID HubLpmHubSettings[HUB_PDO_LPM_SETTINGS]
static
Initial value:
=
{
{ 0xc5f91e9d, 0x0ced, 0x43f2, { 0x90, 0x5e, 0x8f, 0x9d, 0x38, 0xe9, 0x33, 0x39 } },
{ 0x34751a37, 0xe607, 0x452a, { 0xb9, 0xf7, 0xd0, 0x20, 0xfc, 0x5c, 0xd0, 0xdc } },
{ 0x329423dd, 0x222f, 0x4b04, { 0x81, 0x5b, 0x08, 0xc1, 0xa6, 0xd8, 0x9c, 0x8e } },
{ 0xbbfbadaf, 0x7520, 0x491a, { 0x91, 0x0d, 0x4a, 0x2c, 0xee, 0x72, 0x20, 0x3f } },
{ 0xd4e98f31, 0x5ffe, 0x4ce1, { 0xbe, 0x31, 0x1b, 0x38, 0xb3, 0x84, 0xc0, 0x09 } }
}

Definition at line 121 of file childpdo.cpp.

Referenced by HubPdoLpmSettingChanged().

◆ HubPdoEvtCleanup

EVT_WDF_OBJECT_CONTEXT_CLEANUP HubPdoEvtCleanup
static

Definition at line 165 of file childpdo.cpp.

◆ HubPdoEvtCompletePowerIrp

EVT_WDF_WORKITEM HubPdoEvtCompletePowerIrp
static

Definition at line 173 of file childpdo.cpp.

Referenced by HubPdoPowerIrpComplete().

◆ HubPdoEvtD0Entry

EVT_WDF_DEVICE_D0_ENTRY HubPdoEvtD0Entry
static

Definition at line 152 of file childpdo.cpp.

◆ HubPdoEvtD0Exit

EVT_WDF_DEVICE_D0_EXIT HubPdoEvtD0Exit
static

Definition at line 153 of file childpdo.cpp.

◆ HubPdoEvtDisableWakeAtBus

EVT_WDF_DEVICE_DISABLE_WAKE_AT_BUS HubPdoEvtDisableWakeAtBus
static

Definition at line 162 of file childpdo.cpp.

◆ HubPdoEvtEnableWakeAtBus

EVT_WDF_DEVICE_ENABLE_WAKE_AT_BUS HubPdoEvtEnableWakeAtBus
static

Definition at line 161 of file childpdo.cpp.

◆ HubPdoEvtIoDeviceControl

EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL HubPdoEvtIoDeviceControl
static

Definition at line 172 of file childpdo.cpp.

◆ HubPdoEvtIoInternalDeviceControl

EVT_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL HubPdoEvtIoInternalDeviceControl
static

Definition at line 171 of file childpdo.cpp.

◆ HubPdoEvtParentInterfaceQuery

EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST HubPdoEvtParentInterfaceQuery
static

Definition at line 170 of file childpdo.cpp.

◆ HubPdoEvtPrepareHardware

EVT_WDF_DEVICE_PREPARE_HARDWARE HubPdoEvtPrepareHardware
static

Definition at line 154 of file childpdo.cpp.

◆ HubPdoEvtQueryRemove

EVT_WDF_DEVICE_QUERY_REMOVE HubPdoEvtQueryRemove
static

Definition at line 160 of file childpdo.cpp.

◆ HubPdoEvtQueryStop

EVT_WDF_DEVICE_QUERY_STOP HubPdoEvtQueryStop
static

Definition at line 159 of file childpdo.cpp.

◆ HubPdoEvtReleaseHardware

EVT_WDF_DEVICE_RELEASE_HARDWARE HubPdoEvtReleaseHardware
static

Definition at line 155 of file childpdo.cpp.

◆ HubPdoEvtReportedMissing

EVT_WDF_DEVICE_REPORTED_MISSING HubPdoEvtReportedMissing
static

Definition at line 163 of file childpdo.cpp.

◆ HubPdoEvtResourceRequirementsQuery

EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY HubPdoEvtResourceRequirementsQuery
static

Definition at line 164 of file childpdo.cpp.

◆ HubPdoEvtSelfManagedIoStart

EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT HubPdoEvtSelfManagedIoStart
static

Definition at line 157 of file childpdo.cpp.

◆ HubPdoEvtSelfManagedIoSuspend

EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND HubPdoEvtSelfManagedIoSuspend
static

Definition at line 158 of file childpdo.cpp.

◆ HubPdoEvtSurpriseRemoval

EVT_WDF_DEVICE_SURPRISE_REMOVAL HubPdoEvtSurpriseRemoval
static

Definition at line 156 of file childpdo.cpp.

◆ HubPdoLpmSettingChanged

POWER_SETTING_CALLBACK HubPdoLpmSettingChanged
static

Definition at line 175 of file childpdo.cpp.

◆ HubPdoPreprocessInternalIoctl

EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessInternalIoctl
static

Definition at line 166 of file childpdo.cpp.

◆ HubPdoPreprocessIoctl

EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessIoctl
static

Definition at line 167 of file childpdo.cpp.

◆ HubPdoPreprocessPnp

EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessPnp
static

Definition at line 168 of file childpdo.cpp.

◆ HubPdoPreprocessSetPower

EVT_WDFDEVICE_WDM_IRP_PREPROCESS HubPdoPreprocessSetPower
static

Definition at line 169 of file childpdo.cpp.

◆ HubPdoWakeNotificationComplete

EVT_WDF_REQUEST_COMPLETION_ROUTINE HubPdoWakeNotificationComplete
static

Definition at line 174 of file childpdo.cpp.

Referenced by HubPdoSendWakeNotification().

◆ HubSetSystemWakeDevice

PFN_HUB_SET_SYSTEM_WAKE_DEVICE HubSetSystemWakeDevice
static

Definition at line 149 of file childpdo.cpp.

Referenced by DeviceMachine::MarkSystemWakeSource().

◆ HubSetSystemWakeDeviceResolved

BOOLEAN HubSetSystemWakeDeviceResolved
static

Definition at line 150 of file childpdo.cpp.

◆ HubTagPdo

const char HubTagPdo[] = "hub child pdo"
static

Definition at line 17 of file childpdo.cpp.

◆ Index

Definition at line 3073 of file childpdo.cpp.

Referenced by HubInitInterfaceInformation(), and HubPdoGetHubName().

◆ Info

_Inout_opt_ PHUB_DEVICE_CONFIG_INFO Info
Initial value:
{
HubChild* Child = Pdo->m_Child

Definition at line 2324 of file childpdo.cpp.

◆ Init

Init ( void  ) = WdfPdoInitAllocate(Hub->m_Device)

Definition at line 3269 of file childpdo.cpp.

◆ InterfaceGuid

◆ IoResourceRequirementsList

Initial value:
{
HubPdo* Pdo = HubGetPdoContext(Device)

Definition at line 1385 of file childpdo.cpp.

◆ Irp

Initial value:

Definition at line 360 of file childpdo.cpp.

Referenced by HubPdoPowerIrpComplete().

◆ Known

_In_ BOOLEAN Known
Initial value:
{
HubFdo* Hub = Child->m_Hub

Definition at line 3264 of file childpdo.cpp.

Referenced by PrintAttributeInfo(), DeviceMachine::SameDeviceConnected(), and UniataFindBusMasterController().

◆ LastTransitionStatus

Initial value:

Definition at line 639 of file childpdo.cpp.

◆ Length

Definition at line 2346 of file childpdo.cpp.

Referenced by HubPdoRecordFailure().

◆ LocationStrings

* LocationStrings
Initial value:

Definition at line 949 of file childpdo.cpp.

Referenced by locintrf_GetLocationString(), and UcxGetLocationString().

◆ m_Child

Pdo m_Child = Child

Definition at line 3339 of file childpdo.cpp.

◆ m_ClientContractVersion

Pdo m_ClientContractVersion = HUB_PDO_CONTRACT_UNKNOWN

Definition at line 3342 of file childpdo.cpp.

◆ m_Device

◆ m_FailRequests

else Pdo m_FailRequests = TRUE

Definition at line 1299 of file childpdo.cpp.

◆ m_Hub

Pdo m_Hub = Hub

Definition at line 3338 of file childpdo.cpp.

◆ m_LpmPolicy

Definition at line 3386 of file childpdo.cpp.

◆ m_Pdo

Child m_Pdo = Pdo

Definition at line 3360 of file childpdo.cpp.

◆ m_PnpStatus

return Child m_PnpStatus

Definition at line 267 of file childpdo.cpp.

◆ m_PortNumber

Pdo m_PortNumber = Port->Number()

Definition at line 1510 of file childpdo.cpp.

◆ m_Reported

Pdo m_Reported = TRUE

Definition at line 3384 of file childpdo.cpp.

◆ m_WdfPowerState

Pdo m_WdfPowerState = WdfPowerDeviceD0

Definition at line 1505 of file childpdo.cpp.

◆ Name

Definition at line 3071 of file childpdo.cpp.

Referenced by for(), and HubPdoGetHubName().

◆ Pdo

KeInitializeEvent& Pdo = HubGetPdoContext(Device)

◆ Port

HubPort* Port = Child->m_Port

Definition at line 3267 of file childpdo.cpp.

Referenced by HubEvtBandwidthRetryTimer(), HubPdoEvtParentInterfaceQuery(), and if().

◆ PreviousState

Initial value:
{
HubPdo* Pdo = HubGetPdoContext(Device)

Definition at line 1494 of file childpdo.cpp.

◆ Referenced

Referenced = FALSE

Definition at line 3271 of file childpdo.cpp.

Referenced by BroadcastOpen(), and CreateRedirectedFile().

◆ RemoveLock

◆ ResourcesRaw

_In_ WDFCMRESLIST ResourcesRaw

Definition at line 1183 of file childpdo.cpp.

◆ ResourcesTranslated

_In_ WDFCMRESLIST ResourcesTranslated
Initial value:
{
_In_ PNDIS_STRING _In_ PNDIS_STRING SymbolicName
Definition: ndis.h:4677

Definition at line 1184 of file childpdo.cpp.

◆ Status

◆ STATUS_SUCCESS

◆ SymbolicLinkName

Initial value:

Definition at line 852 of file childpdo.cpp.

◆ SystemPowerState

◆ TargetState

Initial value:
{
HubPdo* Pdo = HubGetPdoContext(Device)

Definition at line 1526 of file childpdo.cpp.

◆ TRUE

◆ Version

Definition at line 2345 of file childpdo.cpp.

◆ What

Initial value:

Definition at line 260 of file childpdo.cpp.

Referenced by CreateBase(), and PortReportChange().