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

Go to the source code of this file.

Macros

#define NDEBUG
 
#define PORT_DEBOUNCE_TIME   100
 
#define PORT_OVERCURRENT_TIME   500
 
#define PORT_RESET_TIME   3000
 
#define HUB_PORT_RESUME_WAIT_MS   500
 
#define PORT_RESUME_RECOVERY_TIME   10
 
#define PORT_POWER_ON_TIME_ROOT   100
 
#define PORT_POWER_ON_TIME   300
 
#define PORT_RECONNECT_TIME_BOOT   2000
 
#define PORT_RECONNECT_TIME   1000
 
#define PORT_SUPERSPEED_DISABLE_TIME   5000
 
#define PORT_RESET_POLL_TIME   500
 

Functions

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

Variables

static const char HubTagPort [] = "hub port"
 

Macro Definition Documentation

◆ HUB_PORT_RESUME_WAIT_MS

#define HUB_PORT_RESUME_WAIT_MS   500

Definition at line 20 of file hubport.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file hubport.cpp.

◆ PORT_DEBOUNCE_TIME

#define PORT_DEBOUNCE_TIME   100

Definition at line 17 of file hubport.cpp.

◆ PORT_OVERCURRENT_TIME

#define PORT_OVERCURRENT_TIME   500

Definition at line 18 of file hubport.cpp.

◆ PORT_POWER_ON_TIME

#define PORT_POWER_ON_TIME   300

Definition at line 23 of file hubport.cpp.

◆ PORT_POWER_ON_TIME_ROOT

#define PORT_POWER_ON_TIME_ROOT   100

Definition at line 22 of file hubport.cpp.

◆ PORT_RECONNECT_TIME

#define PORT_RECONNECT_TIME   1000

Definition at line 25 of file hubport.cpp.

◆ PORT_RECONNECT_TIME_BOOT

#define PORT_RECONNECT_TIME_BOOT   2000

Definition at line 24 of file hubport.cpp.

◆ PORT_RESET_POLL_TIME

#define PORT_RESET_POLL_TIME   500

Definition at line 27 of file hubport.cpp.

◆ PORT_RESET_TIME

#define PORT_RESET_TIME   3000

Definition at line 19 of file hubport.cpp.

◆ PORT_RESUME_RECOVERY_TIME

#define PORT_RESUME_RECOVERY_TIME   10

Definition at line 21 of file hubport.cpp.

◆ PORT_SUPERSPEED_DISABLE_TIME

#define PORT_SUPERSPEED_DISABLE_TIME   5000

Definition at line 26 of file hubport.cpp.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

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

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

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

Grows a private buffer to what the helper asks for.

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

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

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

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

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

Sends a synchronous IOCTL to the specified device object.

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

Definition at line 36 of file hubport.cpp.

41{
43 WDF_TIMER_CONFIG TimerConfig;
47
48 PAGED_CODE();
49
51 Attributes.ParentObject = Hub->m_Device;
52 Attributes.ExecutionLevel = WdfExecutionLevelPassive;
53 Attributes.EvtCleanupCallback = EvtCleanup;
54 Attributes.EvtDestroyCallback = EvtDestroy;
55
56 Status = WdfObjectCreate(&Attributes, &Object);
57 if (!NT_SUCCESS(Status))
58 {
59 DPRINT1("Hub %p port %u object creation failed 0x%lx\n", Hub, Info->PortNumber, Status);
60 return NULL;
61 }
62
64
65 Port = new (HubGetPortContext(Object)) HubPort();
66 Port->m_Object = Object;
67 Port->m_Hub = Hub;
68 Port->m_Info = *Info;
69 Port->m_SelectedFeature = HUB_FEATURE_NONE;
70 Port->m_D3ColdReconnectTimeout = PORT_RECONNECT_TIME;
71 HubClearListEntry(&Port->m_HubLink);
72
73 Status = Port->m_Control.Create(Object, WdfDeviceGetIoTarget(Hub->m_Device));
74 if (!NT_SUCCESS(Status))
75 {
76 DPRINT1("Port %u control request creation failed 0x%lx\n", Port->Number(), Status);
77 goto Failed;
78 }
79
80 Port->m_Machine.Initialize(Port, Port->IsUsb30());
81 Port->m_Timer.Initialize(TimerFired, Port);
82
84 {
85 WDF_TIMER_CONFIG_INIT(&TimerConfig, ResetPollFired);
87 Attributes.ParentObject = Object;
88
89 Status = WdfTimerCreate(&TimerConfig, &Attributes, &Port->m_ResetPollTimer);
90 if (!NT_SUCCESS(Status))
91 {
92 DPRINT1("Port %u reset poll timer creation failed 0x%lx\n", Port->Number(), Status);
93 goto Failed;
94 }
95 }
96
97 Port->m_WorkItem = Hub->AllocateWorkItem();
98 if (Port->m_WorkItem == NULL)
99 {
100 DPRINT1("Port %u work item allocation failed\n", Port->Number());
101 goto Failed;
102 }
103
104 DPRINT("Hub %p created port %p number %u\n", Hub, Port, Port->Number());
105 return Port;
106
107Failed:
109 return NULL;
110}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
HubFdo * Hub
Definition: bootdev.cpp:261
WDFDEVICE m_Device
Definition: fdo.h:349
PUCXHUB_WORKITEM AllocateWorkItem()
Definition: fdo.cpp:46
BOOLEAN HasFlag(_In_ HubFlag Flag) const
Definition: fdo.h:153
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
CPPORT Port[4]
Definition: headless.c:38
#define PORT_RECONNECT_TIME
Definition: hubport.cpp:25
static const char HubTagPort[]
Definition: hubport.cpp:14
#define HUB_FEATURE_NONE
Definition: hubreq.h:14
FORCEINLINE VOID NTAPI HubClearListEntry(_Out_ PLIST_ENTRY Entry)
Definition: hubutil.h:149
@ Failed
Definition: arc.h:88
#define DPRINT
Definition: sndvol32.h:73
@ DelayAfterResetComplete
WdfObjectDelete(String)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170
@ WdfExecutionLevelPassive
Definition: wdfobject.h:54
#define WdfObjectReferenceWithTag(Handle, Tag)
Definition: wdfobject.h:806
FORCEINLINE VOID WDF_TIMER_CONFIG_INIT(_Out_ PWDF_TIMER_CONFIG Config, _In_ PFN_WDF_TIMER EvtTimerFunc)
Definition: wdftimer.h:111

Variable Documentation

◆ HubTagPort

const char HubTagPort[] = "hub port"
static

Definition at line 14 of file hubport.cpp.

Referenced by _IRQL_requires_().