ReactOS 0.4.17-dev-1281-g065abb3
XhciEndpoint Class Reference

#include <epctx.h>

Collaboration diagram for XhciEndpoint:

Classes

struct  HaltClearBlock
 

Public Member Functions

XhciController * Controller () const
 
XhciUsbDevice * Device () const
 
UCXENDPOINT Handle () const
 
ULONG Dci () const
 
ULONG TransferType () const
 
const USB_ENDPOINT_DESCRIPTOR * Descriptor () const
 
USHORT MaxPacketSize () const
 
ULONG MaxBurst () const
 
ULONG MaxEsitPayload () const
 
BOOLEAN IsStreamsCapable () const
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) NTSTATUS Enable()
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) VOID Disable()
 
VOID BuildContext (_Out_writes_bytes_(ContextSize) PVOID EndpointContext, _In_ ULONG ContextSize) const
 
VOID OnTransferEvent (_In_ const XHCI_TRB *Event)
 
VOID ControllerResetStarting ()
 
 _IRQL_requires_ (PASSIVE_LEVEL) VOID ControllerResetDone()
 
VOID ControllerRemoved ()
 
VOID OnTransferCanceled ()
 
VOID OnHaltedCompletionCode (_In_ ULONG CompletionCode, _In_ BOOLEAN TransferFound)
 
BOOLEAN ShouldDropStoppedEvent () const
 
VOID OnStoppedEvent ()
 
VOID OnExpectedEventsProcessed ()
 
VOID OnMappingStopped ()
 
VOID OnTransfersReclaimed ()
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) VOID Disable(_In_ BOOLEAN SlotDisabling)
 
ULONG64 StreamDequeuePointer (_In_ ULONG StreamId) const
 
ULONG StreamTransferLength (_In_ ULONG StreamId) const
 
ULONG StreamHaltedCode () const
 

Static Public Member Functions

static XhciEndpoint * FromUcx (_In_ UCXENDPOINT Endpoint)
 
static NTSTATUS Create (_In_ UCXCONTROLLER UcxController, _In_ UCXUSBDEVICE UcxUsbDevice, _In_ PUCXENDPOINT_INIT EndpointInit, _In_ const USB_ENDPOINT_DESCRIPTOR *Descriptor, _In_opt_ const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR *Companion, _In_opt_ const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR *IsochCompanion)
 
static NTSTATUS NTAPI EvtEnableForwardProgress (_In_ UCXENDPOINT Endpoint, _In_ ULONG MaxTransferSize)
 

Public Attributes

XhciEndpointMachine m_Machine
 

Static Public Attributes

static EVT_UCX_ENDPOINT_PURGE EvtPurge
 
static EVT_UCX_ENDPOINT_START EvtStart
 
static EVT_UCX_ENDPOINT_ABORT EvtAbort
 
static EVT_UCX_ENDPOINT_RESET EvtReset
 
static EVT_UCX_ENDPOINT_OK_TO_CANCEL_TRANSFERS EvtOkToCancel
 
static EVT_UCX_DEFAULT_ENDPOINT_UPDATE EvtDefaultUpdate
 
static EVT_UCX_ENDPOINT_STATIC_STREAMS_ADD EvtStreamsAdd
 
static EVT_UCX_ENDPOINT_STATIC_STREAMS_ENABLE EvtStreamsEnable
 
static EVT_UCX_ENDPOINT_STATIC_STREAMS_DISABLE EvtStreamsDisable
 

Private Member Functions

NTSTATUS Initialize (_In_ XhciController *Controller, _In_ UCXUSBDEVICE UcxUsbDevice, _In_ UCXENDPOINT Endpoint, _In_ const USB_ENDPOINT_DESCRIPTOR *Descriptor, _In_opt_ const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR *Companion, _In_opt_ const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR *IsochCompanion)
 
NTSTATUS CreateClearStall ()
 
VOID Cleanup ()
 
VOID DisableRings (_In_ BOOLEAN SlotDisabling)
 
BOOLEAN UsesStreams () const
 
ULONG RingCount () const
 
XhciTransferRing * RingAt (_In_ ULONG Index) const
 
VOID ForEachRing (_In_ VOID(XhciTransferRing::*Action)())
 
BOOLEAN PostWhenAllRings (_In_ XepEvent Event)
 
BOOLEAN AnyTransfersPending () const
 
ULONG64 EndpointDequeuePointer () const
 
PXHCI_STREAM_CONTEXT StreamContext (_In_ ULONG StreamId) const
 
VOID ResetStreamTransferLength (_In_ ULONG StreamId)
 
BOOLEAN StreamRingEmpty (_In_ ULONG StreamId) const
 
BOOLEAN StreamCommandDone ()
 
VOID PostEvent (_In_ XepEvent Event)
 
VOID PostCommandFailure ()
 
VOID FatalError (_In_ ULONG Reason)
 
ULONG OutputEndpointState () const
 
PENDPOINT_RESET ResetPayload () const
 
VOID BuildSetDequeue (_Out_ XhciCommand *Command, _In_ ULONG64 DequeuePointer, _In_ ULONG StreamId, _In_ PFN_XHCI_COMMAND_DONE Done)
 
VOID BuildEndpointConfigure (_In_ XhciDmaBuffer *Input, _In_opt_ const VOID *EndpointContext, _In_ BOOLEAN Drop, _In_ BOOLEAN Add, _Out_ XhciCommand *Command, _In_ PFN_XHCI_COMMAND_DONE Done)
 
PXHCI_ENDPOINT_CONTEXT InputEndpointContext (_In_ XhciDmaBuffer *Input) const
 
VOID DequeueAfterStop (_In_ ULONG StreamId)
 
VOID DequeueAfterReset (_In_ ULONG StreamId)
 
VOID SendClearStall ()
 
NTSTATUS OpenStreams (_In_ XhciStreams *Streams, _In_ WDFREQUEST Request)
 
NTSTATUS CloseStreams (_In_ XhciStreams *Streams, _In_ WDFREQUEST Request)
 
VOID DisableStreamRings (_In_ XhciStreams *Streams)
 
VOID FreeDefaultStreams (_In_opt_ XhciStreams *Streams)
 

Static Private Member Functions

static VOID NTAPI StopDone (_In_ XhciCommand *Command)
 
static VOID NTAPI CancelDequeueDone (_In_ XhciCommand *Command)
 
static VOID NTAPI ControlResetDone (_In_ XhciCommand *Command)
 
static VOID NTAPI ControlDequeueDone (_In_ XhciCommand *Command)
 
static VOID NTAPI ClientResetDone (_In_ XhciCommand *Command)
 
static VOID NTAPI ClientDequeueDone (_In_ XhciCommand *Command)
 
static VOID NTAPI ResetDropDone (_In_ XhciCommand *Command)
 
static VOID NTAPI ResetConfigureDone (_In_ XhciCommand *Command)
 
static VOID NTAPI StopDropDone (_In_ XhciCommand *Command)
 
static VOID NTAPI StopAddDone (_In_ XhciCommand *Command)
 
static VOID NTAPI DefaultUpdateDone (_In_ XhciCommand *Command)
 
static VOID NTAPI StreamsEnableDone (_In_ PVOID Context, _In_ NTSTATUS Status)
 
static VOID NTAPI StreamsDisableDone (_In_ PVOID Context, _In_ NTSTATUS Status)
 

Private Attributes

XhciController * m_Controller
 
XhciUsbDevice * m_Device
 
UCXUSBDEVICE m_UcxDevice
 
UCXENDPOINT m_Ucx
 
BOOLEAN m_Listed
 
BOOLEAN m_ForwardProgress
 
BOOLEAN m_StreamsCapable
 
volatile LONG m_Flags
 
KEVENT m_ResetAck
 
WDFTIMER m_Timer
 
XhciTransferRing * m_MainRing
 
USB_ENDPOINT_DESCRIPTOR m_Descriptor
 
USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR m_Companion
 
USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR m_IsochCompanion
 
ULONG m_XhciType
 
ULONG m_Dci
 
ULONG m_MaxBurst
 
ULONG m_MaxPayload
 
XhciStreams * m_DefaultStreams
 
XhciStreams * m_CurrentStreams
 
ULONG m_StopAttempts
 
XhciCommand m_Command
 
XhciDmaBuffer * m_StopInput
 
HaltClearBlock * m_ClearStall
 
WDFREQUEST volatile m_ResetRequest
 
NTSTATUS m_ResetStatus
 

Static Private Attributes

static EVT_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanup
 
static EVT_WDF_OBJECT_CONTEXT_CLEANUP EvtStreamsCleanup
 
static EVT_WDF_TIMER EvtTimer
 
static EVT_WDF_IO_QUEUE_STATE EvtPurgeDone
 
static EVT_WDF_IO_QUEUE_STATE EvtAbortDone
 
static IO_COMPLETION_ROUTINE ClearStallDone
 

Friends

class XhciEndpointMachine
 

Detailed Description

One endpoint. Lives in the UCXENDPOINT context and owns the endpoint machine.

Definition at line 16 of file epctx.h.

Member Function Documentation

◆ _IRQL_requires_()

XhciEndpoint::_IRQL_requires_ ( PASSIVE_LEVEL  )

◆ _IRQL_requires_max_() [1/3]

XhciEndpoint::_IRQL_requires_max_ ( DISPATCH_LEVEL  )

◆ _IRQL_requires_max_() [2/3]

XhciEndpoint::_IRQL_requires_max_ ( DISPATCH_LEVEL  )

◆ _IRQL_requires_max_() [3/3]

XhciEndpoint::_IRQL_requires_max_ ( DISPATCH_LEVEL  )

Endpoint disable; SlotDisabling FALSE keeps forward progress resources.

◆ AnyTransfersPending()

BOOLEAN XhciEndpoint::AnyTransfersPending ( ) const
private

Definition at line 947 of file epctx.cpp.

948{
950 ULONG Index;
951
952 for (Index = 0; Index < Count; Index++)
953 {
954 if (RingAt(Index)->HasQueuedWork())
955 return TRUE;
956 }
957
958 return FALSE;
959}
ULONG RingCount() const
Definition: epctx.cpp:905
XhciTransferRing * RingAt(_In_ ULONG Index) const
Definition: epctx.cpp:911
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
uint32_t ULONG
Definition: typedefs.h:59
USHORT Count
Definition: userreq.cpp:200
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by XhciEndpointMachine::CanResetAfterHalt(), and XhciEndpointMachine::ShouldReconfigureForReset().

◆ BuildContext()

VOID XhciEndpoint::BuildContext ( _Out_writes_bytes_(ContextSize) PVOID  EndpointContext,
_In_ ULONG  ContextSize 
) const

Initializes this endpoint's input endpoint context.

Definition at line 754 of file epctx.cpp.

757{
758 PXHCI_ENDPOINT_CONTEXT Context = static_cast<PXHCI_ENDPOINT_CONTEXT>(EndpointContext);
763 BOOLEAN Periodic;
764 ULONG Interval = 0;
765 ULONG Burst = 0;
766 ULONG Mult = 0;
767 ULONG Esit = 0;
768
769 NT_ASSERT(ContextSize >= sizeof(*Context));
771
773
774 Context->EndpointType = m_XhciType;
775 Context->MaxPacketSize = Packet;
776
777 /*
778 * Isochronous endpoints never retry. The interrupt IN of one scanner behind an external
779 * hub also gets unlimited retries on flagged controllers.
780 */
782 {
783 Context->ErrorCount = 0;
784 }
785 else if (Type == USB_ENDPOINT_TYPE_INTERRUPT &&
787 m_Controller->HasErrata(XhciErrata::EpInfiniteCerr) &&
788 m_Device->DeviceDescriptor()->idVendor == 0x05F9 &&
789 m_Device->DeviceDescriptor()->idProduct == 0x1101 &&
791 {
792 Context->ErrorCount = 0;
793 }
794 else
795 {
796 Context->ErrorCount = 3;
797 }
798
799 if (Speed == UsbLowSpeed)
800 {
802 {
803 Interval = (Period < 16) ? 6 : ((Period < 32) ? 7 : 8);
804 Esit = Packet;
805 }
806
808 }
809 else if (Speed == UsbFullSpeed)
810 {
812 {
813 /* Frames to 125 us units as a power of two, 1 ms (3) at the least */
814 Interval = 3;
815 while ((Interval < 8) && (Period >= (2U << (Interval - 3))))
816 Interval++;
817 Esit = Packet;
818 }
820 {
821 /* QUIRK: full speed isoch is always serviced every frame */
822 Interval = 3;
823 Esit = Packet;
824 }
825
827 }
828 else if (Speed == UsbHighSpeed)
829 {
830 if (Periodic)
831 {
832 /* QUIRK: bInterval 6 and up is clamped to 32 microframes */
833 Interval = min(max(Period, 1), 6) - 1;
834 Burst = (m_Descriptor.wMaxPacketSize >> 11) & 3;
835 Esit = Packet * (Burst + 1);
836 }
837
838 m_MaxPayload = Packet * (Burst + 1);
839 }
840 else
841 {
842 Burst = m_Companion.bMaxBurst;
843
844 if (Periodic)
845 {
846 Interval = min(max(Period, 1), 6) - 1;
847
848 if (m_Companion.bmAttributes.Isochronous.SspCompanion)
849 {
851 }
852 else
853 {
856 }
857 }
858
859 /* QUIRK: everything but isoch ignores the burst here */
861 }
862
863 if (m_Controller->HasErrata(XhciErrata::EpClampIntervalTo7) && (Interval > 7))
864 Interval = 7;
865
866 m_MaxBurst = Burst;
867
868 Context->Interval = Interval;
869 Context->MaxBurstSize = Burst;
870 Context->Mult = Mult;
871 Context->MaxEsitPayloadLo = Esit & 0xFFFF;
872 Context->MaxEsitPayloadHi = (Esit >> 16) & 0xFF;
873
874 /* QUIRK: control and bulk get an Average TRB Length of 0 */
875 Context->AverageTrbLength = Esit / 2;
876
878 Context->MaxPStreams = m_CurrentStreams->MaxPrimary;
879
880 Context->TRDequeuePointer = EndpointDequeuePointer();
881 Context->LinearStreamArray = (Context->MaxPStreams != 0) ? 1 : 0;
882}
Type
Definition: Type.h:7
unsigned char BOOLEAN
Definition: actypes.h:127
BOOLEAN HasErrata(_In_ XhciErrata Bit) const
Definition: hc.h:58
BOOLEAN m_StreamsCapable
Definition: epctx.h:284
XhciController * m_Controller
Definition: epctx.h:278
ULONG TransferType() const
Definition: epctx.cpp:263
ULONG m_MaxBurst
Definition: epctx.h:297
USHORT MaxPacketSize() const
Definition: epctx.cpp:275
USB_ENDPOINT_DESCRIPTOR m_Descriptor
Definition: epctx.h:290
USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR m_IsochCompanion
Definition: epctx.h:292
ULONG64 EndpointDequeuePointer() const
Definition: epctx.cpp:885
ULONG m_MaxPayload
Definition: epctx.h:298
XhciStreams * m_CurrentStreams
Definition: epctx.h:301
USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR m_Companion
Definition: epctx.h:291
ULONG m_XhciType
Definition: epctx.h:293
XhciUsbDevice * m_Device
Definition: epctx.h:279
const USB_DEVICE_DESCRIPTOR * DeviceDescriptor() const
Definition: slotdev.cpp:365
USB_DEVICE_SPEED Speed() const
Definition: slotdev.cpp:341
const USB_DEVICE_PORT_PATH * PortPath() const
Definition: slotdev.cpp:371
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define min(a, b)
Definition: monoChain.cc:55
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
DWORD Interval
Definition: netstat.c:28
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
ULONG MaxPrimary
Definition: epctx.cpp:81
struct _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR::@4130::@4132 Isochronous
union _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR::@4130 bmAttributes
#define max(a, b)
Definition: svc.c:63
#define USB_ENDPOINT_TYPE_INTERRUPT
Definition: usb100.h:65
#define USB_ENDPOINT_TYPE_ISOCHRONOUS
Definition: usb100.h:63
#define USB_ENDPOINT_DIRECTION_IN(x)
Definition: usb100.h:76
@ UsbHighSpeed
Definition: usb200.h:44
@ UsbLowSpeed
Definition: usb200.h:42
@ UsbFullSpeed
Definition: usb200.h:43
enum _USB_DEVICE_SPEED USB_DEVICE_SPEED
_In_ LARGE_INTEGER _In_ ULONG Period
Definition: kefuncs.h:1304
#define NT_ASSERT
Definition: rtlfuncs.h:3334

Referenced by XhciUsbDevice::BuildAddressContext().

◆ BuildEndpointConfigure()

VOID XhciEndpoint::BuildEndpointConfigure ( _In_ XhciDmaBuffer *  Input,
_In_opt_ const VOID *  EndpointContext,
_In_ BOOLEAN  Drop,
_In_ BOOLEAN  Add,
_Out_ XhciCommand *  Command,
_In_ PFN_XHCI_COMMAND_DONE  Done 
)
private

Configure Endpoint for this DCI only; EndpointContext, when given, replaces the input endpoint context.

Definition at line 1888 of file epctx.cpp.

1895{
1897 PUCHAR Base = static_cast<PUCHAR>(Input->VirtualAddress);
1899 PXHCI_SLOT_CONTEXT Slot = reinterpret_cast<PXHCI_SLOT_CONTEXT>(Base + Size);
1900 ULONG64 InputAddress = Input->LogicalAddress.QuadPart;
1901
1903
1904 /* QUIRK: controller owned fields of the output contexts travel along; the xHC ignores them */
1906 if (EndpointContext != NULL)
1907 RtlCopyMemory(InputEndpointContext(Input), EndpointContext, Size);
1908
1909 /* The cached count, since a temporary drop lowers the controller's own value */
1910 Slot->ContextEntries = m_Device->ContextEntries();
1911
1912 Control->AddFlags = 1;
1913 if (Add)
1914 Control->AddFlags |= 1 << m_Dci;
1915 if (Drop)
1916 Control->DropFlags = 1 << m_Dci;
1917
1918 RtlZeroMemory(Command, sizeof(*Command));
1919 Command->Trb.Dword[0] = static_cast<ULONG>(InputAddress);
1920 Command->Trb.Dword[1] = static_cast<ULONG>(InputAddress >> 32);
1921 Command->Trb.Dword[3] = XhciEndpointCommandControl(XhciTrbType::ConfigureEndpoint,
1922 0, m_Device->SlotId());
1923 Command->Done = Done;
1924 Command->Context = this;
1925}
XhciRegisters m_Registers
Definition: hc.h:91
PXHCI_ENDPOINT_CONTEXT InputEndpointContext(_In_ XhciDmaBuffer *Input) const
Definition: epctx.cpp:1877
ULONG m_Dci
Definition: epctx.h:294
ULONG ContextSize() const
Definition: mmio.cpp:651
ULONG SlotId() const
Definition: slotdev.cpp:335
PVOID OutputContext(_In_ ULONG Dci) const
Definition: slotdev.cpp:269
ULONG ContextEntries() const
Definition: slotdev.cpp:321
Walk Base
Definition: desccheck.cpp:2270
_Inout_ HubConfiguration ** Slot
Definition: devhcd.cpp:1260
KEVENT Done
Definition: devreq.cpp:1162
static ULONG NTAPI XhciEndpointCommandControl(_In_ enum XhciTrbType Type, _In_ ULONG Dci, _In_ ULONG SlotId)
Definition: epctx.cpp:173
unsigned __int64 ULONG64
Definition: imports.h:198
_In_ ULONG _In_ WDFMEMORY Input
Definition: portacpi.cpp:109
Definition: shell.h:41
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
unsigned char * PUCHAR
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166

Referenced by XhciEndpointMachine::ReconfigureAfterStop(), XhciEndpointMachine::ReconfigureForReset(), ResetDropDone(), and StopDropDone().

◆ BuildSetDequeue()

VOID XhciEndpoint::BuildSetDequeue ( _Out_ XhciCommand *  Command,
_In_ ULONG64  DequeuePointer,
_In_ ULONG  StreamId,
_In_ PFN_XHCI_COMMAND_DONE  Done 
)
private

Definition at line 1860 of file epctx.cpp.

1865{
1866 RtlZeroMemory(Command, sizeof(*Command));
1867 Command->Trb.Dword[0] = static_cast<ULONG>(DequeuePointer);
1868 Command->Trb.Dword[1] = static_cast<ULONG>(DequeuePointer >> 32);
1869 Command->Trb.Dword[2] = StreamId << XHCI_CMD_STREAM_ID_SHIFT;
1870 Command->Trb.Dword[3] = XhciEndpointCommandControl(XhciTrbType::SetTrDequeuePointer,
1871 m_Dci, m_Device->SlotId());
1872 Command->Done = Done;
1873 Command->Context = this;
1874}
#define XHCI_CMD_STREAM_ID_SHIFT
Definition: xhcihw.h:590

Referenced by ControlResetDone(), DequeueAfterReset(), and DequeueAfterStop().

◆ CancelDequeueDone()

VOID NTAPI XhciEndpoint::CancelDequeueDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2026 of file epctx.cpp.

2028{
2029 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2030
2031 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2032 {
2033 Self->PostCommandFailure();
2034 return;
2035 }
2036
2037 if (Command->Code != XhciCompletionCode::Success)
2038 {
2039 DPRINT1("Endpoint %p DCI %lu Set TR Dequeue Pointer after stop failed with code %lu\n",
2040 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2041 Self->m_Controller->VerifierCheck(XHCI_VERIFY_CANCEL_DEQUEUE);
2043 Self->PostCommandFailure();
2044 return;
2045 }
2046
2047 if ((Command != &Self->m_Command) && !Self->StreamCommandDone())
2048 return;
2049
2050 Self->PostEvent(XepEvent::CommandSucceeded);
2051}
#define DPRINT1
Definition: precomp.h:8
VOID FatalError(_In_ ULONG Reason)
Definition: epctx.cpp:1083
XhciCommand m_Command
Definition: epctx.h:304
BOOLEAN StreamCommandDone()
Definition: epctx.cpp:962
VOID PostCommandFailure()
Definition: epctx.cpp:1076
VOID PostEvent(_In_ XepEvent Event)
Definition: epctx.cpp:1069
#define XHCI_VERIFY_CANCEL_DEQUEUE
Definition: epctx.cpp:33
#define XHCI_REASON_CANCEL_DEQUEUE
Definition: epctx.cpp:45
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136

Referenced by DequeueAfterStop().

◆ Cleanup()

VOID XhciEndpoint::Cleanup ( )
private

Definition at line 466 of file epctx.cpp.

467{
468 if (m_ClearStall != NULL)
469 {
470 if (m_ClearStall->Request != NULL)
472 if (m_ClearStall->Irp != NULL)
474
477 }
478
483
484 if (m_StopInput != NULL)
485 {
488 }
489
490 /* Last: dropping the list reference may free this object */
491 if (m_Listed)
492 {
493 m_Listed = FALSE;
494 m_Device->RemoveEndpoint(this);
495 }
496}
XhciCommonBuffer m_Buffers
Definition: hc.h:92
BOOLEAN m_Listed
Definition: epctx.h:282
XhciDmaBuffer * m_StopInput
Definition: epctx.h:305
HaltClearBlock * m_ClearStall
Definition: epctx.h:306
XhciStreams * m_DefaultStreams
Definition: epctx.h:300
VOID FreeDefaultStreams(_In_opt_ XhciStreams *Streams)
Definition: epctx.cpp:499
#define XHCI_TAG_ENDPOINT
Definition: epctx.cpp:17
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1698
WdfObjectDelete(String)

◆ ClientDequeueDone()

VOID NTAPI XhciEndpoint::ClientDequeueDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2178 of file epctx.cpp.

2180{
2181 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2182
2183 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2184 {
2186 Self->PostCommandFailure();
2187 return;
2188 }
2189
2190 if (Command->Code != XhciCompletionCode::Success)
2191 {
2192 DPRINT1("Endpoint %p DCI %lu Set TR Dequeue Pointer for the client reset failed with code %lu\n",
2193 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2194 Self->m_Controller->VerifierCheck(XHCI_VERIFY_CONTROL_DEQUEUE);
2197 Self->PostCommandFailure();
2198 return;
2199 }
2200
2201 if ((Command != &Self->m_Command) && !Self->StreamCommandDone())
2202 return;
2203
2205 Self->PostEvent(XepEvent::CommandSucceeded);
2206}
NTSTATUS m_ResetStatus
Definition: epctx.h:309
#define XHCI_VERIFY_CONTROL_DEQUEUE
Definition: epctx.cpp:31
#define XHCI_REASON_CLIENT_DEQUEUE
Definition: epctx.cpp:48
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by DequeueAfterReset().

◆ ClientResetDone()

VOID NTAPI XhciEndpoint::ClientResetDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2111 of file epctx.cpp.

2113{
2114 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2115 ULONG StreamId;
2116
2117 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2118 {
2120 Self->PostCommandFailure();
2121 return;
2122 }
2123
2124 if (Command->Code != XhciCompletionCode::Success)
2125 {
2126 DPRINT1("Endpoint %p DCI %lu client Reset Endpoint failed with code %lu\n",
2127 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2128 Self->m_Controller->VerifierCheck(XHCI_VERIFY_RESET_ENDPOINT);
2131 Self->PostCommandFailure();
2132 return;
2133 }
2134
2136
2137 if (!Self->UsesStreams())
2138 {
2139 Self->DequeueAfterReset(0);
2140 return;
2141 }
2142
2144 for (StreamId = 1; StreamId <= Self->m_CurrentStreams->Count; StreamId++)
2145 Self->DequeueAfterReset(StreamId);
2146}
#define InterlockedExchange
Definition: armddk.h:54
BOOLEAN UsesStreams() const
Definition: epctx.cpp:899
ULONG OutputEndpointState() const
Definition: epctx.cpp:1090
VOID DequeueAfterReset(_In_ ULONG StreamId)
Definition: epctx.cpp:2150
#define XHCI_VERIFY_RESET_ENDPOINT
Definition: epctx.cpp:32
#define XHCI_REASON_CLIENT_RESET
Definition: epctx.cpp:49
volatile LONG UpdateCount
Definition: epctx.cpp:83
ULONG Count
Definition: epctx.cpp:80
#define XHCI_ENDPOINT_STATE_STOPPED
Definition: xhcihw.h:536

Referenced by XhciEndpointMachine::ResetEndpoint().

◆ CloseStreams()

NTSTATUS XhciEndpoint::CloseStreams ( _In_ XhciStreams *  Streams,
_In_ WDFREQUEST  Request 
)
private

Switches back to a new default record; STATUS_PENDING once the configure is out.

Definition at line 1777 of file epctx.cpp.

1780{
1784
1785 XhciGetRequestData(Request)->StreamsConfigure.Streams = Streams;
1786
1787 /* QUIRK: the array is sized for the client stream count, larger than one stream needs */
1788 Default = XhciNewDefaultStreams(this, m_MainRing, Streams->MaxPrimary);
1789 if (Default == NULL)
1790 {
1791 DPRINT1("Endpoint %p no default stream record for the streams close\n", this);
1792 Urb->UrbHeader.Status = USBD_STATUS_INSUFFICIENT_RESOURCES;
1794 }
1795
1798
1799 Status = m_MainRing->Enable();
1800 if (!NT_SUCCESS(Status))
1801 {
1802 DPRINT1("Endpoint %p main ring enable for the streams close failed 0x%lx\n", this, Status);
1803 Urb->UrbHeader.Status = USBD_STATUS_INSUFFICIENT_RESOURCES;
1804
1805 /* Restore the client record so the freed default record is not left current */
1806 m_CurrentStreams = Streams;
1809 return Status;
1810 }
1811
1813
1814 m_Device->ReconfigureEndpoint(this, StreamsDisableDone, Request);
1815 return STATUS_PENDING;
1816}
LONG NTSTATUS
Definition: precomp.h:26
PXHCI_STREAM_CONTEXT StreamContext(_In_ ULONG StreamId) const
Definition: epctx.cpp:969
XhciTransferRing * m_MainRing
Definition: epctx.h:288
static VOID NTAPI StreamsDisableDone(_In_ PVOID Context, _In_ NTSTATUS Status)
Definition: epctx.cpp:1820
ULONG64 DequeuePointerValue() const
Definition: xferring.cpp:670
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static XhciStreams *NTAPI XhciNewDefaultStreams(_In_ XhciEndpoint *Endpoint, _In_ XhciTransferRing *MainRing, _In_ ULONG ArrayMaxPrimary)
Definition: epctx.cpp:200
static PURB NTAPI XhciRequestUrb(_In_ WDFREQUEST Request)
Definition: epctx.cpp:186
Status
Definition: gdiplustypes.h:24
Definition: usb.h:565
ULONG64 DequeuePointer
Definition: xhcihw.h:599
#define STATUS_PENDING
Definition: telnetd.h:14
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define USBD_STATUS_INSUFFICIENT_RESOURCES
Definition: usb.h:215
_In_opt_ PUSB_CONFIGURATION_DESCRIPTOR _Inout_ PUSBD_INTERFACE_LIST_ENTRY _Outptr_ PURB * Urb
Definition: usbdlib.h:333

◆ ControlDequeueDone()

VOID NTAPI XhciEndpoint::ControlDequeueDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2084 of file epctx.cpp.

2086{
2087 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2088
2089 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2090 {
2091 Self->PostCommandFailure();
2092 return;
2093 }
2094
2095 if (Command->Code != XhciCompletionCode::Success)
2096 {
2097 DPRINT1("Endpoint %p DCI %lu Set TR Dequeue Pointer after reset failed with code %lu\n",
2098 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2099 Self->m_Controller->VerifierCheck(XHCI_VERIFY_CONTROL_DEQUEUE);
2101 Self->PostCommandFailure();
2102 return;
2103 }
2104
2106 Self->PostEvent(XepEvent::CommandSucceeded);
2107}
#define XHCI_REASON_CONTROL_DEQUEUE
Definition: epctx.cpp:43

Referenced by ControlResetDone().

◆ Controller()

XhciController * XhciEndpoint::Controller ( ) const

Definition at line 239 of file epctx.cpp.

240{
241 return m_Controller;
242}

Referenced by Initialize().

◆ ControllerRemoved()

VOID XhciEndpoint::ControllerRemoved ( )

Definition at line 1270 of file epctx.cpp.

1271{
1272 PostEvent(XepEvent::ControllerRemoved);
1273}

Referenced by XhciUsbDevice::OnHostLost().

◆ ControllerResetStarting()

VOID XhciEndpoint::ControllerResetStarting ( )

Definition at line 1253 of file epctx.cpp.

1254{
1255 PostEvent(XepEvent::ControllerResetStarting);
1256}

Referenced by XhciUsbDevice::ControllerResetStarting().

◆ ControlResetDone()

VOID NTAPI XhciEndpoint::ControlResetDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2055 of file epctx.cpp.

2057{
2058 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2059
2060 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2061 {
2062 Self->PostCommandFailure();
2063 return;
2064 }
2065
2066 /* QUIRK: a Context State error is fatal too, although it could go on to the dequeue update */
2067 if (Command->Code != XhciCompletionCode::Success)
2068 {
2069 DPRINT1("Endpoint %p DCI %lu Reset Endpoint failed with code %lu\n",
2070 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2071 Self->m_Controller->VerifierCheck(XHCI_VERIFY_RESET_ENDPOINT);
2073 Self->PostCommandFailure();
2074 return;
2075 }
2076
2077 Self->m_MainRing->InitializeRing();
2079 Self->m_Controller->m_Commands.Submit(&Self->m_Command);
2080}
XhciCommandRing m_Commands
Definition: hc.h:95
static VOID NTAPI ControlDequeueDone(_In_ XhciCommand *Command)
Definition: epctx.cpp:2084
VOID BuildSetDequeue(_Out_ XhciCommand *Command, _In_ ULONG64 DequeuePointer, _In_ ULONG StreamId, _In_ PFN_XHCI_COMMAND_DONE Done)
Definition: epctx.cpp:1860
VOID InitializeRing()
Definition: xferring.cpp:648
#define XHCI_REASON_CONTROL_RESET
Definition: epctx.cpp:44

Referenced by XhciEndpointMachine::ResetDefaultPipe().

◆ Create()

NTSTATUS XhciEndpoint::Create ( _In_ UCXCONTROLLER  UcxController,
_In_ UCXUSBDEVICE  UcxUsbDevice,
_In_ PUCXENDPOINT_INIT  EndpointInit,
_In_ const USB_ENDPOINT_DESCRIPTOR *  Descriptor,
_In_opt_ const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR *  Companion,
_In_opt_ const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR *  IsochCompanion 
)
static

Endpoint create for both add callbacks. PASSIVE_LEVEL.

Definition at line 305 of file epctx.cpp.

312{
314 UCXENDPOINT Endpoint;
315 XhciEndpoint* Self;
317
319 Attributes.EvtCleanupCallback = EvtCleanup;
320
321 Status = UcxEndpointCreate(UcxUsbDevice, &EndpointInit, &Attributes, &Endpoint);
322 if (!NT_SUCCESS(Status))
323 {
324 DPRINT1("UcxEndpointCreate for endpoint 0x%02x failed 0x%lx\n",
325 Descriptor->bEndpointAddress, Status);
326 return Status;
327 }
328
329 Self = new (XhciGetEndpoint(Endpoint)) XhciEndpoint;
330 Self->m_Machine.Initialize(Self);
331
332 /* UCX deletes the endpoint on failure; the cleanup callback frees what was made */
335 Endpoint,
337 Companion,
338 IsochCompanion);
339}
static XhciController * FromUcx(_In_ UCXCONTROLLER UcxController)
Definition: hc.cpp:176
VOID Initialize(_In_ XhciEndpoint *Endpoint)
Definition: epstate.cpp:181
static EVT_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanup
Definition: epctx.h:120
const USB_ENDPOINT_DESCRIPTOR * Descriptor() const
Definition: epctx.cpp:269
NTSTATUS Initialize(_In_ XhciController *Controller, _In_ UCXUSBDEVICE UcxUsbDevice, _In_ UCXENDPOINT Endpoint, _In_ const USB_ENDPOINT_DESCRIPTOR *Descriptor, _In_opt_ const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR *Companion, _In_opt_ const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR *IsochCompanion)
Definition: epctx.cpp:342
XhciEndpointMachine m_Machine
Definition: epctx.h:69
_In_ ULONG Attributes
Definition: dispmprt.h:1077
_Must_inspect_result_ _In_ UCXUSBDEVICE _In_ ULONG _In_opt_ PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR Companion
Definition: hubucx.h:308
_In_ UCXHUB_DEVICE_CONTEXT _In_ UCXENDPOINT Endpoint
Definition: hubucx.h:238
_Must_inspect_result_ _In_ UCXUSBDEVICE _Inout_ PUCXENDPOINT_INIT * EndpointInit
Definition: ucxendpoint.h:314
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd(), and XhciEvtUsbDeviceEndpointAdd().

◆ CreateClearStall()

NTSTATUS XhciEndpoint::CreateClearStall ( )
private

Definition at line 428 of file epctx.cpp.

429{
432
433 m_ClearStall = static_cast<HaltClearBlock*>(ExAllocatePoolZero(NonPagedPool,
434 sizeof(*m_ClearStall),
436 if (m_ClearStall == NULL)
438
440 if (m_ClearStall->Irp == NULL)
442
444 Status = WdfRequestCreate(&Attributes, NULL, &m_ClearStall->Request);
445 if (!NT_SUCCESS(Status))
447
448 return Status;
449}
#define NonPagedPool
Definition: env_spec_w32.h:307
#define XHCI_CLEAR_STALL_STACK_SIZE
Definition: epctx.cpp:61
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:647

Referenced by Initialize().

◆ Dci()

◆ DefaultUpdateDone()

VOID NTAPI XhciEndpoint::DefaultUpdateDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 1515 of file epctx.cpp.

1517{
1518 WDFREQUEST Request = static_cast<WDFREQUEST>(Command->Context);
1519 XhciDefaultEndpointUpdate* Data = &XhciGetRequestData(Request)->DefaultEndpointUpdate;
1520 XhciEndpoint* Self = Data->Endpoint;
1522
1523 Self->m_Controller->m_Buffers.Free(Data->InputContext);
1524 Data->InputContext = NULL;
1525
1526 if (Command->Status == STATUS_NO_SUCH_DEVICE)
1527 {
1528 DPRINT1("Endpoint %p max packet size update lost with the controller\n", Self);
1529 }
1530 else if (Command->Code != XhciCompletionCode::Success)
1531 {
1532 DPRINT1("Endpoint %p Evaluate Context failed with code %lu\n",
1533 Self, static_cast<ULONG>(Command->Code));
1534 }
1535 else
1536 {
1537 Self->m_Descriptor.wMaxPacketSize = static_cast<USHORT>(Data->MaxPacketSize);
1539 }
1540
1541 WdfRequestComplete(Request, Status);
1542}
unsigned short USHORT
Definition: pedump.c:61

◆ DequeueAfterReset()

VOID XhciEndpoint::DequeueAfterReset ( _In_ ULONG  StreamId)
private

Points the controller at a ring's current position; the pending transfers stay put.

Definition at line 2150 of file epctx.cpp.

2152{
2155
2156 if (StreamId != 0)
2157 {
2158 Ring = m_CurrentStreams->Entry[StreamId - 1].Ring;
2159 Command = &m_CurrentStreams->Entry[StreamId - 1].Command;
2160
2161 if (StreamRingEmpty(StreamId))
2162 {
2163 if (StreamCommandDone())
2164 {
2166 PostEvent(XepEvent::CommandSucceeded);
2167 }
2168 return;
2169 }
2170 }
2171
2174}
static VOID NTAPI ClientDequeueDone(_In_ XhciCommand *Command)
Definition: epctx.cpp:2178
BOOLEAN StreamRingEmpty(_In_ ULONG StreamId) const
Definition: epctx.cpp:1051
XhciTransferRing * Ring
Definition: epctx.cpp:69
XhciCommand Command
Definition: epctx.cpp:70
XhciStreamEntry Entry[1]
Definition: epctx.cpp:86

Referenced by ClientResetDone().

◆ DequeueAfterStop()

VOID XhciEndpoint::DequeueAfterStop ( _In_ ULONG  StreamId)
private

Moves one ring past the canceled transfers after a stop. StreamId 0 is the main ring.

Definition at line 1997 of file epctx.cpp.

1999{
2002
2003 if (StreamId != 0)
2004 {
2005 Ring = m_CurrentStreams->Entry[StreamId - 1].Ring;
2006 Command = &m_CurrentStreams->Entry[StreamId - 1].Command;
2007
2008 if (StreamRingEmpty(StreamId) &&
2009 !m_Controller->HasErrata(XhciErrata::StrmReconfigOnStop))
2010 {
2011 if (StreamCommandDone())
2012 PostEvent(XepEvent::CommandSucceeded);
2013 return;
2014 }
2015
2016 ResetStreamTransferLength(StreamId);
2017 }
2018
2019 Ring->InitializeRing();
2022}
static VOID NTAPI CancelDequeueDone(_In_ XhciCommand *Command)
Definition: epctx.cpp:2026
VOID ResetStreamTransferLength(_In_ ULONG StreamId)
Definition: epctx.cpp:1027

Referenced by XhciEndpointMachine::UpdateDequeuePointers().

◆ Descriptor()

const USB_ENDPOINT_DESCRIPTOR * XhciEndpoint::Descriptor ( ) const

Definition at line 269 of file epctx.cpp.

270{
271 return &m_Descriptor;
272}

Referenced by Create().

◆ Device()

XhciUsbDevice * XhciEndpoint::Device ( ) const

Definition at line 245 of file epctx.cpp.

246{
247 return m_Device;
248}

◆ DisableRings()

VOID XhciEndpoint::DisableRings ( _In_ BOOLEAN  SlotDisabling)
private

Definition at line 715 of file epctx.cpp.

717{
719 ULONG Index;
720
721 /* Forward progress keeps the ring resources unless the whole device goes away */
722 FreeResources = !m_ForwardProgress || SlotDisabling;
723
724 if (!m_StreamsCapable)
725 {
726 m_MainRing->Disable(FreeResources);
727 return;
728 }
729
730 if (m_CurrentStreams == NULL)
731 return;
732
733 for (Index = 0; Index < m_CurrentStreams->Count; Index++)
735
736 if (!FreeResources)
737 return;
738
740 {
743 }
745 {
748 }
749
751}
BOOLEAN m_ForwardProgress
Definition: epctx.h:283
XhciDmaBuffer * ContextArray
Definition: epctx.cpp:85
static VOID FreeResources(VOID)
Definition: welcome.c:710

◆ DisableStreamRings()

VOID XhciEndpoint::DisableStreamRings ( _In_ XhciStreams *  Streams)
private

Definition at line 1623 of file epctx.cpp.

1625{
1626 ULONG Index;
1627
1628 for (Index = 0; Index < Streams->Count; Index++)
1629 Streams->Entry[Index].Ring->Disable(TRUE);
1630}

Referenced by OpenStreams(), StreamsDisableDone(), and StreamsEnableDone().

◆ EndpointDequeuePointer()

ULONG64 XhciEndpoint::EndpointDequeuePointer ( ) const
private

Definition at line 885 of file epctx.cpp.

886{
887 if (!m_StreamsCapable)
889
891 return 0;
892
894}
PHYSICAL_ADDRESS LogicalAddress
Definition: dmapool.h:17
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by BuildContext(), ResetDropDone(), and StopDropDone().

◆ EvtEnableForwardProgress()

NTSTATUS NTAPI XhciEndpoint::EvtEnableForwardProgress ( _In_ UCXENDPOINT  Endpoint,
_In_ ULONG  MaxTransferSize 
)
static

Definition at line 1424 of file epctx.cpp.

1427{
1428 XhciEndpoint* Self = FromUcx(Endpoint);
1429 XhciTransferRing* Ring;
1431
1432 /* QUIRK: UCX may ask again with a larger size; that is not supported */
1434
1435 /* The main ring serves until a streams record is current */
1436 Ring = Self->UsesStreams() ? Self->m_CurrentStreams->Entry[0].Ring : Self->m_MainRing;
1437
1438 Status = Ring->EnableForwardProgress(MaxTransferSize);
1439 if (NT_SUCCESS(Status))
1440 Self->m_ForwardProgress = TRUE;
1441 else
1442 DPRINT1("Endpoint %p forward progress enable failed 0x%lx\n", Self, Status);
1443
1444 return Status;
1445}
static XhciEndpoint * FromUcx(_In_ UCXENDPOINT Endpoint)
Definition: epctx.cpp:232
_In_ ULONG MaxTransferSize
Definition: pipe.h:72

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd(), and XhciEvtUsbDeviceEndpointAdd().

◆ FatalError()

VOID XhciEndpoint::FatalError ( _In_ ULONG  Reason)
private

Definition at line 1083 of file epctx.cpp.

1085{
1086 m_Controller->RaiseControllerFault(XhciRecovery::ResetHost, Reason);
1087}
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47

Referenced by CancelDequeueDone(), ClientDequeueDone(), ClientResetDone(), ControlDequeueDone(), ControlResetDone(), OnTransferEvent(), XhciEndpointMachine::RequestControllerReset(), ResetConfigureDone(), ResetDropDone(), StopAddDone(), StopDone(), and StopDropDone().

◆ ForEachRing()

◆ FreeDefaultStreams()

VOID XhciEndpoint::FreeDefaultStreams ( _In_opt_ XhciStreams *  Streams)
private

Frees a pool allocated default stream record and its array.

Definition at line 499 of file epctx.cpp.

501{
502 if (Streams == NULL)
503 return;
504
505 if (Streams->ContextArray != NULL)
506 m_Controller->m_Buffers.Free(Streams->ContextArray);
507
509}

Referenced by Cleanup(), CloseStreams(), DisableRings(), StreamsDisableDone(), and StreamsEnableDone().

◆ FromUcx()

XhciEndpoint * XhciEndpoint::FromUcx ( _In_ UCXENDPOINT  Endpoint)
static

◆ Handle()

UCXENDPOINT XhciEndpoint::Handle ( ) const

Definition at line 251 of file epctx.cpp.

252{
253 return m_Ucx;
254}
UCXENDPOINT m_Ucx
Definition: epctx.h:281

◆ Initialize()

NTSTATUS XhciEndpoint::Initialize ( _In_ XhciController *  Controller,
_In_ UCXUSBDEVICE  UcxUsbDevice,
_In_ UCXENDPOINT  Endpoint,
_In_ const USB_ENDPOINT_DESCRIPTOR *  Descriptor,
_In_opt_ const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR *  Companion,
_In_opt_ const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR *  IsochCompanion 
)
private

Definition at line 342 of file epctx.cpp.

349{
351 WDF_TIMER_CONFIG TimerConfig;
352 ULONG Type;
355
359 m_Ucx = Endpoint;
362
363 WDF_TIMER_CONFIG_INIT(&TimerConfig, EvtTimer);
364 TimerConfig.AutomaticSerialization = FALSE;
366 Attributes.ParentObject = Endpoint;
367
368 Status = WdfTimerCreate(&TimerConfig, &Attributes, &m_Timer);
369 if (!NT_SUCCESS(Status))
370 {
371 DPRINT1("Endpoint %p state timer creation failed 0x%lx\n", this, Status);
372 return Status;
373 }
374
376 if (Companion != NULL)
378 if (IsochCompanion != NULL)
379 RtlCopyMemory(&m_IsochCompanion, IsochCompanion, sizeof(m_IsochCompanion));
380
381 /* EP Type (xHCI 6.2.3): OUT types are 1..3, IN adds 4, control is 4 either way */
382 Type = TransferType();
385 m_XhciType += 4;
386
387 /* DCI (xHCI 4.5.1): control and IN endpoints are odd */
389 m_Dci = Number * 2;
391 m_Dci++;
392
393 /* Streams also need controller support */
396 (m_Companion.bmAttributes.Bulk.MaxStreams != 0) &&
398
399 if (m_StreamsCapable && m_Controller->HasErrata(XhciErrata::StrmReconfigOnStop))
400 {
402 if (!NT_SUCCESS(Status))
403 {
404 DPRINT1("Endpoint %p clear stall context creation failed 0x%lx\n", this, Status);
405 return Status;
406 }
407 }
408
409 /* The main ring of a streams capable endpoint is stream 1 of the default record */
411 if (!NT_SUCCESS(Status))
412 {
413 DPRINT1("Endpoint %p DCI %lu main ring creation failed 0x%lx\n", this, m_Dci, Status);
414 return Status;
415 }
416
418
419 m_Device->AddEndpoint(this);
420 m_Listed = TRUE;
421
422 DPRINT("Endpoint %p created, address 0x%02x DCI %lu type %lu\n",
424 return STATUS_SUCCESS;
425}
static EVT_WDF_TIMER EvtTimer
Definition: epctx.h:122
NTSTATUS CreateClearStall()
Definition: epctx.cpp:428
UCXUSBDEVICE m_UcxDevice
Definition: epctx.h:280
XhciController * Controller() const
Definition: epctx.cpp:239
KEVENT m_ResetAck
Definition: epctx.h:286
WDFTIMER m_Timer
Definition: epctx.h:287
ULONG SupportedStreams() const
Definition: mmio.cpp:585
static NTSTATUS Create(_In_ XhciEndpoint *Endpoint, _In_ WDFOBJECT Parent, _In_ ULONG StreamId, _Out_ XhciTransferRing **Ring)
WDFQUEUE Queue() const
Definition: xferring.cpp:315
static XhciUsbDevice * FromUcx(_In_ UCXUSBDEVICE UsbDevice)
Definition: slotdev.cpp:178
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ ULONG Number
Definition: haltypes.h:1940
@ NotificationEvent
#define DPRINT
Definition: sndvol32.h:73
struct _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR::@4130::@4131 Bulk
BOOLEAN AutomaticSerialization
Definition: wdftimer.h:90
FORCEINLINE VOID NTAPI UcxEndpointSetWdfIoQueue(_In_ UCXENDPOINT Endpoint, _In_ WDFQUEUE WdfQueue)
Definition: ucxendpoint.h:455
#define USB_ENDPOINT_TYPE_CONTROL
Definition: usb100.h:62
#define USB_ENDPOINT_TYPE_BULK
Definition: usb100.h:64
@ UsbSuperSpeed
Definition: usb200.h:45
#define USB_ENDPOINT_ADDRESS_MASK
Definition: usb300.h:64
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
FORCEINLINE VOID WDF_TIMER_CONFIG_INIT(_Out_ PWDF_TIMER_CONFIG Config, _In_ PFN_WDF_TIMER EvtTimerFunc)
Definition: wdftimer.h:111
#define XHCI_ENDPOINT_TYPE_CONTROL
Definition: xhcihw.h:543

Referenced by Create().

◆ InputEndpointContext()

PXHCI_ENDPOINT_CONTEXT XhciEndpoint::InputEndpointContext ( _In_ XhciDmaBuffer *  Input) const
private

Definition at line 1877 of file epctx.cpp.

1879{
1881
1882 return reinterpret_cast<PXHCI_ENDPOINT_CONTEXT>(static_cast<PUCHAR>(Input->VirtualAddress) +
1883 (m_Dci + 1) * Size);
1884}

Referenced by BuildEndpointConfigure(), XhciEndpointMachine::ReconfigureForReset(), ResetDropDone(), and StopDropDone().

◆ IsStreamsCapable()

BOOLEAN XhciEndpoint::IsStreamsCapable ( ) const

Definition at line 297 of file epctx.cpp.

298{
299 return m_StreamsCapable;
300}

◆ MaxBurst()

ULONG XhciEndpoint::MaxBurst ( ) const

Definition at line 281 of file epctx.cpp.

282{
283 /* The bulk ring asks at enable, before the first context was built */
284 if (m_Device->Speed() >= UsbSuperSpeed)
285 return m_Companion.bMaxBurst;
286
287 return m_MaxBurst;
288}

◆ MaxEsitPayload()

ULONG XhciEndpoint::MaxEsitPayload ( ) const

Definition at line 291 of file epctx.cpp.

292{
293 return m_MaxPayload;
294}

◆ MaxPacketSize()

USHORT XhciEndpoint::MaxPacketSize ( ) const

Definition at line 275 of file epctx.cpp.

276{
277 return m_Descriptor.wMaxPacketSize & 0x7FF;
278}

Referenced by BuildContext(), XhciTransferRing::PacketCount(), and XhciTransferRing::TdSize().

◆ OnExpectedEventsProcessed()

VOID XhciEndpoint::OnExpectedEventsProcessed ( )

Definition at line 1231 of file epctx.cpp.

1232{
1233 PostWhenAllRings(XepEvent::ExpectedEventsDone);
1234}
BOOLEAN PostWhenAllRings(_In_ XepEvent Event)
Definition: epctx.cpp:933

Referenced by XhciControlRing::OnEventDataEvent().

◆ OnHaltedCompletionCode()

VOID XhciEndpoint::OnHaltedCompletionCode ( _In_ ULONG  CompletionCode,
_In_ BOOLEAN  TransferFound 
)

Definition at line 1190 of file epctx.cpp.

1193{
1195 {
1197 return;
1198 }
1199
1200 if (!TransferFound)
1201 {
1202 if (UsesStreams())
1203 m_CurrentStreams->HaltedCode = CompletionCode;
1205 }
1206
1207 PostEvent(XepEvent::HaltReported);
1208}
volatile LONG m_Flags
Definition: epctx.h:285
#define XHCI_EP_STREAM_HALT_PENDING
Definition: epctx.cpp:22
#define XHCI_EP_HALT_RECEIVED
Definition: epctx.cpp:25
#define XHCI_VERIFY_DUPLICATE_EVENT
Definition: epctx.cpp:37
#define InterlockedOr
Definition: interlocked.h:239
ULONG HaltedCode
Definition: epctx.cpp:84

Referenced by XhciControlRing::OnEventDataEvent(), OnTransferEvent(), and XhciControlRing::OnTrbEvent().

◆ OnMappingStopped()

VOID XhciEndpoint::OnMappingStopped ( )

Definition at line 1237 of file epctx.cpp.

1238{
1239 PostWhenAllRings(XepEvent::StreamMapStopped);
1240}

Referenced by XhciControlRing::BuildControlTd(), XhciTransferRing::ChangeMapState(), and XhciControlRing::WriteTd().

◆ OnStoppedEvent()

VOID XhciEndpoint::OnStoppedEvent ( )

Definition at line 1217 of file epctx.cpp.

1218{
1219 /* QUIRK: a second stopped event reports the duplicate halt verifier condition */
1221 {
1223 return;
1224 }
1225
1227 PostEvent(XepEvent::StoppedEventSeen);
1228}
#define XHCI_EP_STOPPED_HANDSHAKE
Definition: epctx.cpp:23
#define XHCI_EP_STOPPED_RECEIVED
Definition: epctx.cpp:24
#define InterlockedXor
Definition: interlocked.h:281

Referenced by XhciControlRing::OnEventDataEvent(), OnTransferEvent(), and XhciControlRing::OnTrbEvent().

◆ OnTransferCanceled()

VOID XhciEndpoint::OnTransferCanceled ( )

Definition at line 1183 of file epctx.cpp.

1184{
1186 PostEvent(XepEvent::TransferAborted);
1187}
#define XHCI_EP_CANCEL_REPORTED
Definition: epctx.cpp:20

Referenced by XhciControlRing::Abort().

◆ OnTransferEvent()

VOID XhciEndpoint::OnTransferEvent ( _In_ const XHCI_TRB *  Event)

Definition at line 1102 of file epctx.cpp.

1104{
1106 ULONG64 Pointer;
1107 ULONG64 ArrayStart;
1108 ULONG Index;
1109
1110 if ((Code == static_cast<ULONG>(XhciCompletionCode::TrbError)) ||
1111 (Code == static_cast<ULONG>(XhciCompletionCode::UndefinedError)) ||
1112 ((Code >= 192) && (Code <= 223)))
1113 {
1114 DPRINT1("Endpoint %p DCI %lu transfer event with completion code %lu\n", this, m_Dci, Code);
1115 m_Controller->VerifierCheck(XHCI_VERIFY_EVENT_CODE);
1117 return;
1118 }
1119
1120 if (!UsesStreams())
1121 {
1123 return;
1124 }
1125
1126 Pointer = XhciTrbPointer(Event);
1128
1129 if ((Pointer != 0) &&
1130 ((Pointer < ArrayStart) || (Pointer >= ArrayStart + m_CurrentStreams->ContextArray->Size)))
1131 {
1132 for (Index = 0; Index < m_CurrentStreams->Count; Index++)
1133 {
1135 return;
1136 }
1137
1138 if (Event->Dword[3] & XHCI_TRANSFER_EVENT_ED)
1139 {
1140 DPRINT1("Endpoint %p DCI %lu event data 0x%I64x matched no stream\n", this, m_Dci, Pointer);
1142 return;
1143 }
1144
1145 if (!XhciIsStoppedCode(Code))
1146 {
1147 for (Index = 0; Index < m_CurrentStreams->Count; Index++)
1148 {
1150 continue;
1151
1152 if (m_Controller->HasErrata(XhciErrata::EvtDiscardRepeatedEd0))
1153 {
1154 DPRINT1("Endpoint %p DCI %lu dropping a likely duplicate event at 0x%I64x\n",
1155 this, m_Dci, Pointer);
1156 return;
1157 }
1158
1159 DPRINT1("Endpoint %p DCI %lu likely duplicate event at 0x%I64x\n", this, m_Dci, Pointer);
1161 return;
1162 }
1163
1164 DPRINT1("Endpoint %p DCI %lu event at 0x%I64x matched no stream\n", this, m_Dci, Pointer);
1166 return;
1167 }
1168
1169 /* Hardware compliance: a stopped event should point into some stream ring */
1170 DPRINT1("Endpoint %p DCI %lu stopped event at 0x%I64x matched no stream\n", this, m_Dci, Pointer);
1171 }
1172
1173 /* An event for the endpoint as a whole */
1176 else if (XhciIsStoppedCode(Code))
1178 else
1179 DPRINT1("Endpoint %p DCI %lu ignoring endpoint event code %lu\n", this, m_Dci, Code);
1180}
VOID OnStoppedEvent()
Definition: epctx.cpp:1217
VOID OnHaltedCompletionCode(_In_ ULONG CompletionCode, _In_ BOOLEAN TransferFound)
Definition: epctx.cpp:1190
BOOLEAN OnTransferEvent(_In_ const XHCI_TRB *Event)
Definition: xferring.cpp:787
BOOLEAN IsLikelyDuplicate(_In_ const XHCI_TRB *Event) const
Definition: xferring.cpp:843
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287
#define XHCI_REASON_EVENT_DATA_POINTER
Definition: epctx.cpp:51
#define XHCI_REASON_EVENT_CODE
Definition: epctx.cpp:46
static BOOLEAN NTAPI XhciIsHaltedCode(_In_ ULONG Code)
Definition: epctx.cpp:138
static BOOLEAN NTAPI XhciIsStoppedCode(_In_ ULONG Code)
Definition: epctx.cpp:161
#define XHCI_REASON_DUPLICATE_POINTER
Definition: epctx.cpp:53
#define XHCI_REASON_EVENT_POINTER
Definition: epctx.cpp:52
#define XHCI_VERIFY_EVENT_CODE
Definition: epctx.cpp:35
ULONG Size
Definition: dmapool.h:18
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707
FORCEINLINE ULONG64 NTAPI XhciTrbPointer(_In_ const XHCI_TRB *Trb)
Definition: xhcihw.h:60
#define XHCI_TRANSFER_EVENT_ED
Definition: xhcihw.h:321
FORCEINLINE ULONG NTAPI XhciTrbCompletionCode(_In_ const XHCI_TRB *Trb)
Definition: xhcihw.h:42

◆ OnTransfersReclaimed()

VOID XhciEndpoint::OnTransfersReclaimed ( )

Definition at line 1243 of file epctx.cpp.

1244{
1245 /* Drops the reference NotifyRingsReclaim took, once the machine has the event */
1246 if (PostWhenAllRings(XepEvent::TransfersRecovered))
1248}
#define XHCI_RECLAIM_TAG
Definition: epctx.cpp:58
#define WdfObjectDereferenceWithTag(Handle, Tag)
Definition: wdfobject.h:829

◆ OpenStreams()

NTSTATUS XhciEndpoint::OpenStreams ( _In_ XhciStreams *  Streams,
_In_ WDFREQUEST  Request 
)
private

Switches from the default record to the client streams; STATUS_PENDING once the configure is out.

Definition at line 1648 of file epctx.cpp.

1651{
1653 WDFQUEUE MainQueue = m_MainRing->Queue();
1654 XhciTransferRing* Ring;
1655 ULONG Queued;
1656 ULONG Owned;
1658 ULONG Index;
1659
1660 /* The main queue stays drained for as long as client streams are open */
1661 WdfIoQueueDrain(MainQueue, NULL, NULL);
1662 WdfIoQueueGetState(MainQueue, &Queued, &Owned);
1663 if ((Queued != 0) || (Owned != 0))
1664 {
1665 DPRINT1("Endpoint %p streams open with requests still on the main queue\n", this);
1666 Urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
1668 goto Failure;
1669 }
1670
1671 if ((Streams->Count == 0) || (Streams->Count > m_Controller->m_Registers.SupportedStreams()))
1672 {
1673 DPRINT1("Endpoint %p streams open with bad stream count %lu\n", this, Streams->Count);
1674 Urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
1676 goto Failure;
1677 }
1678
1679 XhciGetRequestData(Request)->StreamsConfigure.Streams = Streams;
1680
1681 Streams->ContextArray = m_Controller->m_Buffers.Acquire(XhciStreamArrayBytes(Streams->MaxPrimary));
1682 if (Streams->ContextArray == NULL)
1683 {
1684 DPRINT1("Endpoint %p no stream context array for %lu streams\n", this, Streams->Count);
1685 Urb->UrbHeader.Status = USBD_STATUS_INSUFFICIENT_RESOURCES;
1687 goto Failure;
1688 }
1689
1690 m_CurrentStreams = Streams;
1691
1692 for (Index = 0; Index < Streams->Count; Index++)
1693 {
1694 Ring = Streams->Entry[Index].Ring;
1695 Status = Ring->Enable();
1696 if (!NT_SUCCESS(Status))
1697 {
1698 DPRINT1("Endpoint %p stream %lu ring enable failed 0x%lx\n", this, Index + 1, Status);
1699 Urb->UrbHeader.Status = USBD_STATUS_INSUFFICIENT_RESOURCES;
1700 goto Failure;
1701 }
1702
1704 }
1705
1706 m_Device->ReconfigureEndpoint(this, StreamsEnableDone, Request);
1707 return STATUS_PENDING;
1708
1709Failure:
1710 DisableStreamRings(Streams);
1712 if (Streams->ContextArray != NULL)
1713 {
1714 m_Controller->m_Buffers.Free(Streams->ContextArray);
1715 Streams->ContextArray = NULL;
1716 }
1717
1718 WdfIoQueueStart(MainQueue);
1719 return Status;
1720}
static VOID NTAPI StreamsEnableDone(_In_ PVOID Context, _In_ NTSTATUS Status)
Definition: epctx.cpp:1724
VOID DisableStreamRings(_In_ XhciStreams *Streams)
Definition: epctx.cpp:1623
static ULONG NTAPI XhciStreamArrayBytes(_In_ ULONG MaxPrimary)
Definition: epctx.cpp:129
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define USBD_STATUS_INVALID_PARAMETER
Definition: usb.h:203

◆ OutputEndpointState()

ULONG XhciEndpoint::OutputEndpointState ( ) const
private

Definition at line 1090 of file epctx.cpp.

1091{
1092 return static_cast<PXHCI_ENDPOINT_CONTEXT>(m_Device->OutputContext(m_Dci))->EndpointState;
1093}

Referenced by ClientResetDone(), and StopDone().

◆ PostCommandFailure()

VOID XhciEndpoint::PostCommandFailure ( )
private

◆ PostEvent()

◆ PostWhenAllRings()

BOOLEAN XhciEndpoint::PostWhenAllRings ( _In_ XepEvent  Event)
private

Stream endpoints report once every stream ring has reported. TRUE when posted.

Definition at line 933 of file epctx.cpp.

935{
936 if (UsesStreams() &&
938 {
939 return FALSE;
940 }
941
943 return TRUE;
944}
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by OnExpectedEventsProcessed(), OnMappingStopped(), and OnTransfersReclaimed().

◆ ResetConfigureDone()

VOID NTAPI XhciEndpoint::ResetConfigureDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2250 of file epctx.cpp.

2252{
2253 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2254 XhciEndpointReset* Data = &XhciGetRequestData(Self->m_ResetRequest)->EndpointReset;
2255
2256 Self->m_Controller->m_Buffers.Free(Data->InputContext);
2257 Data->InputContext = NULL;
2258
2259 /* QUIRK: the client reset succeeds even when the configure fails */
2261
2262 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2263 {
2264 Self->PostCommandFailure();
2265 return;
2266 }
2267
2268 if (Command->Code != XhciCompletionCode::Success)
2269 {
2270 DPRINT1("Endpoint %p DCI %lu add for the client reset failed with code %lu\n",
2271 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2273 Self->PostCommandFailure();
2274 return;
2275 }
2276
2277 Self->PostEvent(XepEvent::CommandSucceeded);
2278}
WDFREQUEST volatile m_ResetRequest
Definition: epctx.h:308
#define XHCI_REASON_RECONFIGURE
Definition: epctx.cpp:55
#define XHCI_REASON_STREAM_RECONFIGURE
Definition: epctx.cpp:54

Referenced by XhciEndpointMachine::ReconfigureForReset(), and ResetDropDone().

◆ ResetDropDone()

VOID NTAPI XhciEndpoint::ResetDropDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2210 of file epctx.cpp.

2212{
2213 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2214 XhciEndpointReset* Data = &XhciGetRequestData(Self->m_ResetRequest)->EndpointReset;
2215 XhciTransferRing* Ring;
2216 ULONG StreamId;
2217
2218 if ((Command->Status == STATUS_NO_SUCH_DEVICE) || (Command->Code != XhciCompletionCode::Success))
2219 {
2220 if (Command->Status != STATUS_NO_SUCH_DEVICE)
2221 {
2222 DPRINT1("Endpoint %p DCI %lu drop for the client reset failed with code %lu\n",
2223 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2225 }
2226
2227 Self->m_Controller->m_Buffers.Free(Data->InputContext);
2228 Data->InputContext = NULL;
2230 Self->PostCommandFailure();
2231 return;
2232 }
2233
2234 for (StreamId = 1; StreamId <= Self->m_CurrentStreams->Count; StreamId++)
2235 {
2236 Ring = Self->m_CurrentStreams->Entry[StreamId - 1].Ring;
2237 Self->ResetStreamTransferLength(StreamId);
2238 Ring->InitializeRing();
2239 Self->StreamContext(StreamId)->DequeuePointer = Ring->DequeuePointerValue();
2240 }
2241
2242 /* Add it back with the endpoint context stashed by the drop */
2243 Self->BuildEndpointConfigure(Data->InputContext, NULL, FALSE, TRUE, &Data->Command, ResetConfigureDone);
2244 Self->InputEndpointContext(Data->InputContext)->TRDequeuePointer = Self->EndpointDequeuePointer();
2245 Self->m_Controller->m_Commands.Submit(&Data->Command);
2246}
VOID BuildEndpointConfigure(_In_ XhciDmaBuffer *Input, _In_opt_ const VOID *EndpointContext, _In_ BOOLEAN Drop, _In_ BOOLEAN Add, _Out_ XhciCommand *Command, _In_ PFN_XHCI_COMMAND_DONE Done)
Definition: epctx.cpp:1888
static VOID NTAPI ResetConfigureDone(_In_ XhciCommand *Command)
Definition: epctx.cpp:2250
#define XHCI_REASON_DROP_FAILED
Definition: epctx.cpp:47
ULONG64 TRDequeuePointer
Definition: xhcihw.h:514

Referenced by XhciEndpointMachine::ReconfigureForReset().

◆ ResetPayload()

PENDPOINT_RESET XhciEndpoint::ResetPayload ( ) const
private

Definition at line 1096 of file epctx.cpp.

1097{
1098 return reinterpret_cast<PENDPOINT_RESET>(XhciRequestUrb(m_ResetRequest));
1099}

Referenced by XhciEndpointMachine::ResetEndpoint(), and XhciEndpointMachine::ShouldReconfigureForReset().

◆ ResetStreamTransferLength()

VOID XhciEndpoint::ResetStreamTransferLength ( _In_ ULONG  StreamId)
private

Definition at line 1027 of file epctx.cpp.

1029{
1031 BOOLEAN First;
1033
1034 if (!m_Controller->HasErrata(XhciErrata::StrmByteCountRearm))
1035 return;
1036
1037 Context = StreamContext(StreamId);
1038 First = m_Controller->HasErrata(XhciErrata::StrmByteCountLayoutA);
1039 Second = m_Controller->HasErrata(XhciErrata::StrmByteCountLayoutB);
1040
1041 if (!First && !Second)
1042 Context->Dword2 &= ~XHCI_STREAM_EDTLA_MASK;
1043 else if (First && !Second)
1044 Context->Dword2 &= 0xFF;
1045 else if (!First && Second)
1046 Context->Dword3 &= ~XHCI_STREAM_EDTLA_MASK;
1047}
WCHAR Second[]
Definition: FormatMessage.c:12
WCHAR First[]
Definition: FormatMessage.c:11

Referenced by DequeueAfterStop(), and ResetDropDone().

◆ RingAt()

XhciTransferRing * XhciEndpoint::RingAt ( _In_ ULONG  Index) const
private

Definition at line 911 of file epctx.cpp.

913{
915}

Referenced by AnyTransfersPending(), and ForEachRing().

◆ RingCount()

ULONG XhciEndpoint::RingCount ( ) const
private

Definition at line 905 of file epctx.cpp.

906{
907 return UsesStreams() ? m_CurrentStreams->Count : 1;
908}

Referenced by AnyTransfersPending(), and ForEachRing().

◆ SendClearStall()

VOID XhciEndpoint::SendClearStall ( )
private

Resets the device side sequence number with CLEAR_FEATURE(ENDPOINT_HALT) on our default endpoint queue.

Definition at line 2338 of file epctx.cpp.

2339{
2342 struct _URB_CONTROL_TRANSFER_EX* Urb;
2346 PIRP Irp;
2347
2348 if (m_ClearStall == NULL)
2349 {
2350 PostEvent(XepEvent::CommandSucceeded);
2351 return;
2352 }
2353
2354 Control = m_Device->EndpointAt(1);
2355 if (Control == NULL)
2356 {
2357 /* Post anyway so the endpoint machine does not wait forever */
2358 DPRINT1("Endpoint %p DCI %lu has no default endpoint for the clear stall\n", this, m_Dci);
2359 PostEvent(XepEvent::CommandSucceeded);
2360 return;
2361 }
2362
2363 Irp = m_ClearStall->Irp;
2365
2366 Urb = &m_ClearStall->Urb;
2367 RtlZeroMemory(Urb, sizeof(*Urb));
2368 Urb->Hdr.Length = sizeof(*Urb);
2369 Urb->Hdr.Function = URB_FUNCTION_CONTROL_TRANSFER_EX;
2372
2373 /* UCX never sees this URB, so the control ring picks the current processor's interrupter */
2375
2376 Setup = reinterpret_cast<PUSB_DEFAULT_PIPE_SETUP_PACKET>(Urb->SetupPacket);
2378 Setup->bRequest = USB_REQUEST_CLEAR_FEATURE;
2381 Setup->wLength = 0;
2382
2383 /* Make the top location look like a dispatched internal IOCTL with our routine attached */
2385 RtlZeroMemory(Stack, sizeof(*Stack));
2386 Stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
2387 Stack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB;
2388 Stack->Parameters.Others.Argument1 = Urb;
2389
2391 if (!NT_SUCCESS(Status))
2393
2395
2399 Reuse.NewIrp = Irp;
2400 WdfRequestReuse(m_ClearStall->Request, &Reuse);
2401
2402 Status = WdfRequestForwardToIoQueue(m_ClearStall->Request, Control->m_MainRing->Queue());
2403 if (!NT_SUCCESS(Status))
2404 {
2405 DPRINT1("Endpoint %p clear stall forward failed 0x%lx\n", this, Status);
2406 WdfRequestComplete(m_ClearStall->Request, Status);
2407 }
2408}
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 ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:834
PDEVICE_OBJECT m_WdmDevice
Definition: hc.h:86
static IO_COMPLETION_ROUTINE ClearStallDone
Definition: epctx.h:125
#define XHCI_CLEAR_STALL_TIMEOUT_MS
Definition: epctx.cpp:60
#define XHCI_REQUEST_REUSE_MUST_COMPLETE
Definition: epctx.cpp:64
return pRequest Reuse(ReuseParams)
#define USB3_URB_RESERVED_RESOURCES
Definition: hubreq.cpp:15
NTSTATUS NTAPI IoSetCompletionRoutineEx(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PIO_COMPLETION_ROUTINE CompletionRoutine, IN PVOID Context, IN BOOLEAN InvokeOnSuccess, IN BOOLEAN InvokeOnError, IN BOOLEAN InvokeOnCancel)
Definition: iocomp.c:220
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
_In_ PIRP Irp
Definition: kse.h:79
VOID NTAPI IoReuseIrp(IN OUT PIRP Irp, IN NTSTATUS Status)
Definition: irp.c:2003
struct _URB_CONTROL_TRANSFER_EX Urb
Definition: epctx.cpp:94
uint32_t * PULONG
Definition: typedefs.h:59
#define USB_FEATURE_ENDPOINT_STALL
Definition: usb100.h:102
#define BMREQUEST_HOST_TO_DEVICE
Definition: usb100.h:31
#define BMREQUEST_TO_ENDPOINT
Definition: usb100.h:40
#define BMREQUEST_STANDARD
Definition: usb100.h:34
#define USB_REQUEST_CLEAR_FEATURE
Definition: usb100.h:79
#define USBD_DEFAULT_PIPE_TRANSFER
Definition: usb.h:163
#define IOCTL_INTERNAL_USB_SUBMIT_URB
Definition: usbioctl.h:32
@ WDF_REQUEST_REUSE_SET_NEW_IRP
Definition: wdfrequest.h:93
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
FORCEINLINE VOID WDF_REQUEST_REUSE_PARAMS_INIT(_Out_ PWDF_REQUEST_REUSE_PARAMS Params, _In_ ULONG Flags, _In_ NTSTATUS Status)
Definition: wdfrequest.h:364
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2721
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2706
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define XHCI_URB_NO_PROCESSOR
Definition: xferring.h:15

Referenced by StopAddDone().

◆ ShouldDropStoppedEvent()

BOOLEAN XhciEndpoint::ShouldDropStoppedEvent ( ) const

Definition at line 1211 of file epctx.cpp.

1212{
1213 return (m_Flags & XHCI_EP_IGNORE_STOPPED) != 0;
1214}
#define XHCI_EP_IGNORE_STOPPED
Definition: epctx.cpp:26

Referenced by XhciControlRing::OnTrbEvent().

◆ StopAddDone()

VOID NTAPI XhciEndpoint::StopAddDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2310 of file epctx.cpp.

2312{
2313 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2314
2315 Self->m_Controller->m_Buffers.Free(Self->m_StopInput);
2316 Self->m_StopInput = NULL;
2317
2318 if (Command->Status == STATUS_NO_SUCH_DEVICE)
2319 {
2320 Self->PostCommandFailure();
2321 return;
2322 }
2323
2324 if (Command->Code != XhciCompletionCode::Success)
2325 {
2326 DPRINT1("Endpoint %p DCI %lu add after stop failed with code %lu\n",
2327 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2329 Self->PostCommandFailure();
2330 return;
2331 }
2332
2333 Self->SendClearStall();
2334}
VOID SendClearStall()
Definition: epctx.cpp:2338
#define XHCI_REASON_STOP_ADD_FAILED
Definition: epctx.cpp:50

Referenced by StopDropDone().

◆ StopDone()

VOID NTAPI XhciEndpoint::StopDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 1929 of file epctx.cpp.

1931{
1932 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
1934
1935 if (Command->Status == STATUS_NO_SUCH_DEVICE)
1936 {
1937 Self->PostCommandFailure();
1938 return;
1939 }
1940
1941 if (Command->Code == XhciCompletionCode::Success)
1942 {
1944 {
1945 Self->PostEvent(XepEvent::CommandSucceeded);
1946 return;
1947 }
1948
1949 DPRINT1("Endpoint %p DCI %lu in state %lu after a successful stop\n", Self, Self->m_Dci, State);
1951 Self->PostCommandFailure();
1952 return;
1953 }
1954
1955 if (Command->Code == XhciCompletionCode::ContextStateError)
1956 {
1957 switch (State)
1958 {
1960 /* A doorbell raced the stop */
1961 Self->PostEvent(XepEvent::StopFailedRunning);
1962 return;
1963
1965 Self->PostEvent(XepEvent::StopFailedStopped);
1966 return;
1967
1970 {
1971 Self->PostEvent(XepEvent::StopFailedHalted);
1972 return;
1973 }
1974
1975 DPRINT1("Endpoint %p DCI %lu isoch endpoint halted on stop\n", Self, Self->m_Dci);
1977 Self->PostCommandFailure();
1978 return;
1979
1980 default:
1981 DPRINT1("Endpoint %p DCI %lu stop context error in state %lu\n", Self, Self->m_Dci, State);
1983 Self->PostCommandFailure();
1984 return;
1985 }
1986 }
1987
1988 DPRINT1("Endpoint %p DCI %lu Stop Endpoint failed with code %lu\n",
1989 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
1990 Self->m_Controller->VerifierCheck(XHCI_VERIFY_STOP_ENDPOINT);
1992 Self->PostCommandFailure();
1993}
#define XHCI_REASON_STOP_ERROR
Definition: epctx.cpp:41
#define XHCI_VERIFY_STOP_ENDPOINT
Definition: epctx.cpp:36
#define XHCI_REASON_NOT_STOPPED
Definition: epctx.cpp:56
#define XHCI_REASON_STOP_CONTEXT
Definition: epctx.cpp:42
#define XHCI_ENDPOINT_STATE_RUNNING
Definition: xhcihw.h:534
#define XHCI_ENDPOINT_STATE_HALTED
Definition: xhcihw.h:535

Referenced by XhciEndpointMachine::SendStopCommand().

◆ StopDropDone()

VOID NTAPI XhciEndpoint::StopDropDone ( _In_ XhciCommand *  Command)
staticprivate

Definition at line 2282 of file epctx.cpp.

2284{
2285 XhciEndpoint* Self = static_cast<XhciEndpoint*>(Command->Context);
2286
2287 if ((Command->Status == STATUS_NO_SUCH_DEVICE) || (Command->Code != XhciCompletionCode::Success))
2288 {
2289 if (Command->Status != STATUS_NO_SUCH_DEVICE)
2290 {
2291 DPRINT1("Endpoint %p DCI %lu drop after stop failed with code %lu\n",
2292 Self, Self->m_Dci, static_cast<ULONG>(Command->Code));
2294 }
2295
2296 Self->m_Controller->m_Buffers.Free(Self->m_StopInput);
2297 Self->m_StopInput = NULL;
2298 Self->PostCommandFailure();
2299 return;
2300 }
2301
2302 /* Leave the stream context array alone; pending events are matched against the old ring contents */
2305 Self->m_Controller->m_Commands.Submit(&Self->m_Command);
2306}
static VOID NTAPI StopAddDone(_In_ XhciCommand *Command)
Definition: epctx.cpp:2310

Referenced by XhciEndpointMachine::ReconfigureAfterStop().

◆ StreamCommandDone()

BOOLEAN XhciEndpoint::StreamCommandDone ( )
private

Definition at line 962 of file epctx.cpp.

963{
964 return static_cast<ULONG>(InterlockedIncrement(&m_CurrentStreams->UpdateCount)) ==
966}

Referenced by CancelDequeueDone(), ClientDequeueDone(), DequeueAfterReset(), and DequeueAfterStop().

◆ StreamContext()

PXHCI_STREAM_CONTEXT XhciEndpoint::StreamContext ( _In_ ULONG  StreamId) const
private

◆ StreamDequeuePointer()

ULONG64 XhciEndpoint::StreamDequeuePointer ( _In_ ULONG  StreamId) const

Definition at line 976 of file epctx.cpp.

978{
980 return 0;
981
982 return StreamContext(StreamId)->DequeuePointer;
983}

◆ StreamHaltedCode()

ULONG XhciEndpoint::StreamHaltedCode ( ) const

Last halted code that matched no stream transfer, 0 when none.

Definition at line 1061 of file epctx.cpp.

1062{
1063 return UsesStreams() ? m_CurrentStreams->HaltedCode : 0;
1064}

◆ StreamRingEmpty()

BOOLEAN XhciEndpoint::StreamRingEmpty ( _In_ ULONG  StreamId) const
private

Only a ring nobody has queued to since its last reset counts as empty.

Definition at line 1051 of file epctx.cpp.

1053{
1054 XhciTransferRing* Ring = m_CurrentStreams->Entry[StreamId - 1].Ring;
1055 ULONG64 Pointer = StreamContext(StreamId)->DequeuePointer & ~XHCI_DEQUEUE_FLAGS_MASK;
1056
1057 return (Pointer == Ring->SegmentBase()) && (Pointer == Ring->EnqueuePointer());
1058}
ULONG64 EnqueuePointer() const
Definition: xferring.cpp:664
ULONG64 SegmentBase() const
Definition: xferring.cpp:658

Referenced by DequeueAfterReset(), and DequeueAfterStop().

◆ StreamsDisableDone()

VOID NTAPI XhciEndpoint::StreamsDisableDone ( _In_ PVOID  Context,
_In_ NTSTATUS  Status 
)
staticprivate

Definition at line 1820 of file epctx.cpp.

1823{
1824 WDFREQUEST Request = static_cast<WDFREQUEST>(Context);
1825 XhciStreams* Streams = XhciGetRequestData(Request)->StreamsConfigure.Streams;
1826 XhciEndpoint* Self = Streams->Endpoint;
1828
1829 if (NT_SUCCESS(Status))
1830 {
1831 Self->DisableStreamRings(Streams);
1832 if (Streams->ContextArray != NULL)
1833 {
1834 Self->m_Controller->m_Buffers.Free(Streams->ContextArray);
1835 Streams->ContextArray = NULL;
1836 }
1837
1838 WdfIoQueueStart(Self->m_MainRing->Queue());
1839 Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
1840 }
1841 else
1842 {
1843 /* QUIRK: the main ring enabled for the close stays enabled */
1844 DPRINT1("Endpoint %p streams close reconfigure failed 0x%lx\n", Self, Status);
1845 Self->m_CurrentStreams = Streams;
1847 Self->m_DefaultStreams = NULL;
1848 Urb->UrbHeader.Status = USBD_STATUS_INTERNAL_HC_ERROR;
1849 }
1850
1851 if (NT_SUCCESS(Status))
1852 Self->PostEvent(XepEvent::StreamsOff);
1853
1854 WdfRequestComplete(Request, Status);
1855}
XhciEndpoint * Endpoint
Definition: epctx.cpp:79
#define USBD_STATUS_INTERNAL_HC_ERROR
Definition: usb.h:207
#define USBD_STATUS_SUCCESS
Definition: usb.h:177

Referenced by CloseStreams().

◆ StreamsEnableDone()

VOID NTAPI XhciEndpoint::StreamsEnableDone ( _In_ PVOID  Context,
_In_ NTSTATUS  Status 
)
staticprivate

Definition at line 1724 of file epctx.cpp.

1727{
1728 WDFREQUEST Request = static_cast<WDFREQUEST>(Context);
1729 XhciStreams* Streams = XhciGetRequestData(Request)->StreamsConfigure.Streams;
1730 XhciEndpoint* Self = Streams->Endpoint;
1732
1733 if (NT_SUCCESS(Status))
1734 {
1735 Self->m_MainRing->Disable(TRUE);
1737 Self->m_DefaultStreams = NULL;
1738 Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
1739 }
1740 else
1741 {
1742 DPRINT1("Endpoint %p streams open reconfigure failed 0x%lx\n", Self, Status);
1743 Self->DisableStreamRings(Streams);
1744 if (Streams->ContextArray != NULL)
1745 {
1746 Self->m_Controller->m_Buffers.Free(Streams->ContextArray);
1747 Streams->ContextArray = NULL;
1748 }
1749
1750 Self->m_CurrentStreams = Self->m_DefaultStreams;
1751 Urb->UrbHeader.Status = USBD_STATUS_INTERNAL_HC_ERROR;
1752 WdfIoQueueStart(Self->m_MainRing->Queue());
1753 }
1754
1755 if (NT_SUCCESS(Status))
1756 Self->PostEvent(XepEvent::StreamsOn);
1757
1758 WdfRequestComplete(Request, Status);
1759}

Referenced by OpenStreams().

◆ StreamTransferLength()

ULONG XhciEndpoint::StreamTransferLength ( _In_ ULONG  StreamId) const

Bytes a stopped stream moved, from wherever this controller keeps its EDTLA.

Definition at line 987 of file epctx.cpp.

989{
993 ULONG Length = 0;
994
996 return 0;
997
998 Context = StreamContext(StreamId);
999 First = m_Controller->HasErrata(XhciErrata::StrmByteCountLayoutA);
1000 Second = m_Controller->HasErrata(XhciErrata::StrmByteCountLayoutB);
1001
1002 if (!First && !Second)
1003 {
1005 }
1006 else if (First && !Second)
1007 {
1008 Length = Context->Dword2 >> 8;
1009 if (m_Controller->HasErrata(XhciErrata::StrmByteCountHasValidFlag) && !(Context->Dword2 & 0x80))
1010 Length = 0;
1011 }
1012 else if (!First && Second)
1013 {
1015 }
1016
1017 if (m_Controller->HasErrata(XhciErrata::StrmByteCountTruncated))
1018 {
1019 NT_ASSERT(!Second);
1020 Length += Context->Dword3 & 0x1FFFF;
1021 }
1022
1023 return Length;
1024}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define XHCI_STREAM_EDTLA_MASK
Definition: xhcihw.h:606

◆ TransferType()

ULONG XhciEndpoint::TransferType ( ) const

USB transfer type, bmAttributes bits 1:0.

Definition at line 263 of file epctx.cpp.

264{
266}
#define USB_ENDPOINT_TYPE_MASK
Definition: usb100.h:61

Referenced by BuildContext(), Initialize(), XhciEndpointMachine::ShouldReconfigureForReset(), and StopDone().

◆ UsesStreams()

Friends And Related Function Documentation

◆ XhciEndpointMachine

friend class XhciEndpointMachine
friend

Definition at line 116 of file epctx.h.

Member Data Documentation

◆ ClearStallDone

NTSTATUS NTAPI XhciEndpoint::ClearStallDone
staticprivate

Definition at line 125 of file epctx.h.

Referenced by SendClearStall().

◆ EvtAbort

VOID NTAPI XhciEndpoint::EvtAbort
static

Definition at line 101 of file epctx.h.

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd(), and XhciEvtUsbDeviceEndpointAdd().

◆ EvtAbortDone

VOID NTAPI XhciEndpoint::EvtAbortDone
staticprivate

Definition at line 124 of file epctx.h.

◆ EvtCleanup

VOID NTAPI XhciEndpoint::EvtCleanup
staticprivate

Definition at line 120 of file epctx.h.

Referenced by Create().

◆ EvtDefaultUpdate

VOID NTAPI XhciEndpoint::EvtDefaultUpdate
static

Definition at line 104 of file epctx.h.

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd().

◆ EvtOkToCancel

VOID NTAPI XhciEndpoint::EvtOkToCancel
static

Definition at line 103 of file epctx.h.

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd(), and XhciEvtUsbDeviceEndpointAdd().

◆ EvtPurge

VOID NTAPI XhciEndpoint::EvtPurge
static

Definition at line 99 of file epctx.h.

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd(), and XhciEvtUsbDeviceEndpointAdd().

◆ EvtPurgeDone

VOID NTAPI XhciEndpoint::EvtPurgeDone
staticprivate

Definition at line 123 of file epctx.h.

◆ EvtReset

VOID NTAPI XhciEndpoint::EvtReset
static

Definition at line 102 of file epctx.h.

Referenced by XhciEvtUsbDeviceEndpointAdd().

◆ EvtStart

VOID NTAPI XhciEndpoint::EvtStart
static

Definition at line 100 of file epctx.h.

Referenced by XhciEvtUsbDeviceDefaultEndpointAdd(), and XhciEvtUsbDeviceEndpointAdd().

◆ EvtStreamsAdd

NTSTATUS NTAPI XhciEndpoint::EvtStreamsAdd
static

Definition at line 105 of file epctx.h.

Referenced by XhciEvtUsbDeviceEndpointAdd().

◆ EvtStreamsCleanup

VOID NTAPI XhciEndpoint::EvtStreamsCleanup
staticprivate

Definition at line 121 of file epctx.h.

◆ EvtStreamsDisable

VOID NTAPI XhciEndpoint::EvtStreamsDisable
static

Definition at line 107 of file epctx.h.

Referenced by XhciEvtUsbDeviceEndpointAdd().

◆ EvtStreamsEnable

VOID NTAPI XhciEndpoint::EvtStreamsEnable
static

Definition at line 106 of file epctx.h.

Referenced by XhciEvtUsbDeviceEndpointAdd().

◆ EvtTimer

VOID NTAPI XhciEndpoint::EvtTimer
staticprivate

Definition at line 122 of file epctx.h.

Referenced by Initialize().

◆ m_ClearStall

HaltClearBlock* XhciEndpoint::m_ClearStall
private

Definition at line 306 of file epctx.h.

Referenced by Cleanup(), CreateClearStall(), and SendClearStall().

◆ m_Command

◆ m_Companion

USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR XhciEndpoint::m_Companion
private

Definition at line 291 of file epctx.h.

Referenced by BuildContext(), Initialize(), and MaxBurst().

◆ m_Controller

◆ m_CurrentStreams

◆ m_Dci

◆ m_DefaultStreams

XhciStreams* XhciEndpoint::m_DefaultStreams
private

◆ m_Descriptor

USB_ENDPOINT_DESCRIPTOR XhciEndpoint::m_Descriptor
private

◆ m_Device

◆ m_Flags

◆ m_ForwardProgress

BOOLEAN XhciEndpoint::m_ForwardProgress
private

Definition at line 283 of file epctx.h.

Referenced by DisableRings(), and EvtEnableForwardProgress().

◆ m_IsochCompanion

USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR XhciEndpoint::m_IsochCompanion
private

Definition at line 292 of file epctx.h.

Referenced by BuildContext(), and Initialize().

◆ m_Listed

BOOLEAN XhciEndpoint::m_Listed
private

Definition at line 282 of file epctx.h.

Referenced by Cleanup(), and Initialize().

◆ m_Machine

XhciEndpointMachine XhciEndpoint::m_Machine

Definition at line 69 of file epctx.h.

Referenced by Create(), and PostEvent().

◆ m_MainRing

◆ m_MaxBurst

ULONG XhciEndpoint::m_MaxBurst
mutableprivate

Definition at line 297 of file epctx.h.

Referenced by BuildContext(), and MaxBurst().

◆ m_MaxPayload

ULONG XhciEndpoint::m_MaxPayload
mutableprivate

Definition at line 298 of file epctx.h.

Referenced by BuildContext(), and MaxEsitPayload().

◆ m_ResetAck

KEVENT XhciEndpoint::m_ResetAck
private

Definition at line 286 of file epctx.h.

Referenced by XhciEndpointMachine::AckControllerReset(), and Initialize().

◆ m_ResetRequest

◆ m_ResetStatus

◆ m_StopAttempts

◆ m_StopInput

XhciDmaBuffer* XhciEndpoint::m_StopInput
private

◆ m_StreamsCapable

◆ m_Timer

WDFTIMER XhciEndpoint::m_Timer
private

◆ m_Ucx

◆ m_UcxDevice

UCXUSBDEVICE XhciEndpoint::m_UcxDevice
private

Definition at line 280 of file epctx.h.

Referenced by Initialize().

◆ m_XhciType

ULONG XhciEndpoint::m_XhciType
private

Definition at line 293 of file epctx.h.

Referenced by BuildContext(), Initialize(), and XhciEndpointMachine::IsControlEndpoint().


The documentation for this class was generated from the following files: