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

Go to the source code of this file.

Classes

struct  XhciStreamEntry
 
struct  XhciStreams
 
struct  XhciEndpoint::HaltClearBlock
 

Macros

#define NDEBUG
 
#define XHCI_TAG_ENDPOINT   'eHCX'
 
#define XHCI_EP_CANCEL_REPORTED   0x00000001
 
#define XHCI_EP_FAILURE_REPORTED   0x00000002
 
#define XHCI_EP_STREAM_HALT_PENDING   0x00000004
 
#define XHCI_EP_STOPPED_HANDSHAKE   0x00000008
 
#define XHCI_EP_STOPPED_RECEIVED   0x00000010
 
#define XHCI_EP_HALT_RECEIVED   0x00000020
 
#define XHCI_EP_IGNORE_STOPPED   0x00000040
 
#define XHCI_EP_RESET_ACK_HANDSHAKE   0x00000080
 
#define XHCI_EP_CLIENT_RESET_HANDSHAKE   0x00000100
 
#define XHCI_VERIFY_CONTROL_DEQUEUE   0x00000080
 
#define XHCI_VERIFY_RESET_ENDPOINT   0x00000100
 
#define XHCI_VERIFY_CANCEL_DEQUEUE   0x00000200
 
#define XHCI_VERIFY_STOP_EXHAUSTED   0x00000400
 
#define XHCI_VERIFY_EVENT_CODE   0x00000800
 
#define XHCI_VERIFY_STOP_ENDPOINT   0x00800000
 
#define XHCI_VERIFY_DUPLICATE_EVENT   0x02000000
 
#define XHCI_REASON_NO_LIVE_DUMP   0x0000
 
#define XHCI_REASON_STOP_ERROR   0x1003
 
#define XHCI_REASON_STOP_CONTEXT   0x1004
 
#define XHCI_REASON_CONTROL_DEQUEUE   0x1005
 
#define XHCI_REASON_CONTROL_RESET   0x1006
 
#define XHCI_REASON_CANCEL_DEQUEUE   0x100A
 
#define XHCI_REASON_EVENT_CODE   0x1010
 
#define XHCI_REASON_DROP_FAILED   0x1017
 
#define XHCI_REASON_CLIENT_DEQUEUE   0x101A
 
#define XHCI_REASON_CLIENT_RESET   0x101B
 
#define XHCI_REASON_STOP_ADD_FAILED   0x101D
 
#define XHCI_REASON_EVENT_DATA_POINTER   0x101E
 
#define XHCI_REASON_EVENT_POINTER   0x101F
 
#define XHCI_REASON_DUPLICATE_POINTER   0x1020
 
#define XHCI_REASON_STREAM_RECONFIGURE   0x1021
 
#define XHCI_REASON_RECONFIGURE   0x1022
 
#define XHCI_REASON_NOT_STOPPED   0x1023
 
#define XHCI_RECLAIM_TAG   reinterpret_cast<PVOID>(static_cast<ULONG_PTR>('lcRX'))
 
#define XHCI_STOP_ATTEMPTS_MAX   20
 
#define XHCI_CLEAR_STALL_TIMEOUT_MS   5000
 
#define XHCI_CLEAR_STALL_STACK_SIZE   4
 
#define XHCI_REQUEST_REUSE_MUST_COMPLETE   0x00000002
 

Functions

 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME (XhciEndpoint, XhciGetEndpoint)
 
 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME (XhciStreams, XhciGetStreams)
 
static ULONG NTAPI XhciStreamsSize (_In_ ULONG Count)
 
static ULONG NTAPI XhciMaxPrimaryStreams (_In_ ULONG Count)
 
static ULONG NTAPI XhciStreamArrayBytes (_In_ ULONG MaxPrimary)
 
static BOOLEAN NTAPI XhciIsHaltedCode (_In_ ULONG Code)
 
static BOOLEAN NTAPI XhciIsStoppedCode (_In_ ULONG Code)
 
static ULONG NTAPI XhciEndpointCommandControl (_In_ enum XhciTrbType Type, _In_ ULONG Dci, _In_ ULONG SlotId)
 
static PURB NTAPI XhciRequestUrb (_In_ WDFREQUEST Request)
 
static XhciStreams *NTAPI XhciNewDefaultStreams (_In_ XhciEndpoint *Endpoint, _In_ XhciTransferRing *MainRing, _In_ ULONG ArrayMaxPrimary)
 
NTSTATUS NTAPI XhciEvtUsbDeviceDefaultEndpointAdd (_In_ UCXCONTROLLER UcxController, _In_ UCXUSBDEVICE UcxUsbDevice, _In_ ULONG MaxPacketSize, _In_ PUCXENDPOINT_INIT UcxEndpointInit)
 
NTSTATUS NTAPI XhciEvtUsbDeviceEndpointAdd (_In_ UCXCONTROLLER UcxController, _In_ UCXUSBDEVICE UcxUsbDevice, _In_reads_bytes_(UsbEndpointDescriptorBufferLength) PUSB_ENDPOINT_DESCRIPTOR UsbEndpointDescriptor, _In_ ULONG UsbEndpointDescriptorBufferLength, _In_opt_ PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR SuperSpeedEndpointCompanionDescriptor, _In_ PUCXENDPOINT_INIT UcxEndpointInit)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file epctx.cpp.

◆ XHCI_CLEAR_STALL_STACK_SIZE

#define XHCI_CLEAR_STALL_STACK_SIZE   4

Definition at line 61 of file epctx.cpp.

◆ XHCI_CLEAR_STALL_TIMEOUT_MS

#define XHCI_CLEAR_STALL_TIMEOUT_MS   5000

Definition at line 60 of file epctx.cpp.

◆ XHCI_EP_CANCEL_REPORTED

#define XHCI_EP_CANCEL_REPORTED   0x00000001

Definition at line 20 of file epctx.cpp.

◆ XHCI_EP_CLIENT_RESET_HANDSHAKE

#define XHCI_EP_CLIENT_RESET_HANDSHAKE   0x00000100

Definition at line 28 of file epctx.cpp.

◆ XHCI_EP_FAILURE_REPORTED

#define XHCI_EP_FAILURE_REPORTED   0x00000002

Definition at line 21 of file epctx.cpp.

◆ XHCI_EP_HALT_RECEIVED

#define XHCI_EP_HALT_RECEIVED   0x00000020

Definition at line 25 of file epctx.cpp.

◆ XHCI_EP_IGNORE_STOPPED

#define XHCI_EP_IGNORE_STOPPED   0x00000040

Definition at line 26 of file epctx.cpp.

◆ XHCI_EP_RESET_ACK_HANDSHAKE

#define XHCI_EP_RESET_ACK_HANDSHAKE   0x00000080

Definition at line 27 of file epctx.cpp.

◆ XHCI_EP_STOPPED_HANDSHAKE

#define XHCI_EP_STOPPED_HANDSHAKE   0x00000008

Definition at line 23 of file epctx.cpp.

◆ XHCI_EP_STOPPED_RECEIVED

#define XHCI_EP_STOPPED_RECEIVED   0x00000010

Definition at line 24 of file epctx.cpp.

◆ XHCI_EP_STREAM_HALT_PENDING

#define XHCI_EP_STREAM_HALT_PENDING   0x00000004

Definition at line 22 of file epctx.cpp.

◆ XHCI_REASON_CANCEL_DEQUEUE

#define XHCI_REASON_CANCEL_DEQUEUE   0x100A

Definition at line 45 of file epctx.cpp.

◆ XHCI_REASON_CLIENT_DEQUEUE

#define XHCI_REASON_CLIENT_DEQUEUE   0x101A

Definition at line 48 of file epctx.cpp.

◆ XHCI_REASON_CLIENT_RESET

#define XHCI_REASON_CLIENT_RESET   0x101B

Definition at line 49 of file epctx.cpp.

◆ XHCI_REASON_CONTROL_DEQUEUE

#define XHCI_REASON_CONTROL_DEQUEUE   0x1005

Definition at line 43 of file epctx.cpp.

◆ XHCI_REASON_CONTROL_RESET

#define XHCI_REASON_CONTROL_RESET   0x1006

Definition at line 44 of file epctx.cpp.

◆ XHCI_REASON_DROP_FAILED

#define XHCI_REASON_DROP_FAILED   0x1017

Definition at line 47 of file epctx.cpp.

◆ XHCI_REASON_DUPLICATE_POINTER

#define XHCI_REASON_DUPLICATE_POINTER   0x1020

Definition at line 53 of file epctx.cpp.

◆ XHCI_REASON_EVENT_CODE

#define XHCI_REASON_EVENT_CODE   0x1010

Definition at line 46 of file epctx.cpp.

◆ XHCI_REASON_EVENT_DATA_POINTER

#define XHCI_REASON_EVENT_DATA_POINTER   0x101E

Definition at line 51 of file epctx.cpp.

◆ XHCI_REASON_EVENT_POINTER

#define XHCI_REASON_EVENT_POINTER   0x101F

Definition at line 52 of file epctx.cpp.

◆ XHCI_REASON_NO_LIVE_DUMP

#define XHCI_REASON_NO_LIVE_DUMP   0x0000

Definition at line 40 of file epctx.cpp.

◆ XHCI_REASON_NOT_STOPPED

#define XHCI_REASON_NOT_STOPPED   0x1023

Definition at line 56 of file epctx.cpp.

◆ XHCI_REASON_RECONFIGURE

#define XHCI_REASON_RECONFIGURE   0x1022

Definition at line 55 of file epctx.cpp.

◆ XHCI_REASON_STOP_ADD_FAILED

#define XHCI_REASON_STOP_ADD_FAILED   0x101D

Definition at line 50 of file epctx.cpp.

◆ XHCI_REASON_STOP_CONTEXT

#define XHCI_REASON_STOP_CONTEXT   0x1004

Definition at line 42 of file epctx.cpp.

◆ XHCI_REASON_STOP_ERROR

#define XHCI_REASON_STOP_ERROR   0x1003

Definition at line 41 of file epctx.cpp.

◆ XHCI_REASON_STREAM_RECONFIGURE

#define XHCI_REASON_STREAM_RECONFIGURE   0x1021

Definition at line 54 of file epctx.cpp.

◆ XHCI_RECLAIM_TAG

#define XHCI_RECLAIM_TAG   reinterpret_cast<PVOID>(static_cast<ULONG_PTR>('lcRX'))

Definition at line 58 of file epctx.cpp.

◆ XHCI_REQUEST_REUSE_MUST_COMPLETE

#define XHCI_REQUEST_REUSE_MUST_COMPLETE   0x00000002

Definition at line 64 of file epctx.cpp.

◆ XHCI_STOP_ATTEMPTS_MAX

#define XHCI_STOP_ATTEMPTS_MAX   20

Definition at line 59 of file epctx.cpp.

◆ XHCI_TAG_ENDPOINT

#define XHCI_TAG_ENDPOINT   'eHCX'

Definition at line 17 of file epctx.cpp.

◆ XHCI_VERIFY_CANCEL_DEQUEUE

#define XHCI_VERIFY_CANCEL_DEQUEUE   0x00000200

Definition at line 33 of file epctx.cpp.

◆ XHCI_VERIFY_CONTROL_DEQUEUE

#define XHCI_VERIFY_CONTROL_DEQUEUE   0x00000080

Definition at line 31 of file epctx.cpp.

◆ XHCI_VERIFY_DUPLICATE_EVENT

#define XHCI_VERIFY_DUPLICATE_EVENT   0x02000000

Definition at line 37 of file epctx.cpp.

◆ XHCI_VERIFY_EVENT_CODE

#define XHCI_VERIFY_EVENT_CODE   0x00000800

Definition at line 35 of file epctx.cpp.

◆ XHCI_VERIFY_RESET_ENDPOINT

#define XHCI_VERIFY_RESET_ENDPOINT   0x00000100

Definition at line 32 of file epctx.cpp.

◆ XHCI_VERIFY_STOP_ENDPOINT

#define XHCI_VERIFY_STOP_ENDPOINT   0x00800000

Definition at line 36 of file epctx.cpp.

◆ XHCI_VERIFY_STOP_EXHAUSTED

#define XHCI_VERIFY_STOP_EXHAUSTED   0x00000400

Definition at line 34 of file epctx.cpp.

Function Documentation

◆ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME() [1/2]

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME ( XhciEndpoint  ,
XhciGetEndpoint   
)

◆ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME() [2/2]

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME ( XhciStreams  ,
XhciGetStreams   
)

◆ XhciEndpointCommandControl()

static ULONG NTAPI XhciEndpointCommandControl ( _In_ enum XhciTrbType  Type,
_In_ ULONG  Dci,
_In_ ULONG  SlotId 
)
static

Dword 3 of an endpoint scoped command TRB.

Definition at line 173 of file epctx.cpp.

177{
178 return (static_cast<ULONG>(Type) << XHCI_TRB_TYPE_SHIFT) |
179 (Dci << XHCI_TRB_ENDPOINT_SHIFT) |
180 (SlotId << XHCI_TRB_SLOT_SHIFT);
181}
Type
Definition: Type.h:7
uint32_t ULONG
Definition: typedefs.h:59
#define XHCI_TRB_TYPE_SHIFT
Definition: xhcihw.h:23
#define XHCI_TRB_ENDPOINT_SHIFT
Definition: xhcihw.h:26
#define XHCI_TRB_SLOT_SHIFT
Definition: xhcihw.h:25

Referenced by XhciEndpoint::BuildEndpointConfigure(), XhciEndpoint::BuildSetDequeue(), XhciEndpointMachine::ResetDefaultPipe(), XhciEndpointMachine::ResetEndpoint(), and XhciEndpointMachine::SendStopCommand().

◆ XhciEvtUsbDeviceDefaultEndpointAdd()

NTSTATUS NTAPI XhciEvtUsbDeviceDefaultEndpointAdd ( _In_ UCXCONTROLLER  UcxController,
_In_ UCXUSBDEVICE  UcxUsbDevice,
_In_ ULONG  MaxPacketSize,
_In_ PUCXENDPOINT_INIT  UcxEndpointInit 
)

Definition at line 525 of file epctx.cpp.

530{
534
536 Descriptor.bLength = sizeof(Descriptor);
538 Descriptor.wMaxPacketSize = static_cast<USHORT>(MaxPacketSize);
539
546
547 /* The forward progress hook travels in the reserved slot */
548 Callbacks.Reserved1 = reinterpret_cast<HANDLE>(XhciEndpoint::EvtEnableForwardProgress);
550
552 if (!NT_SUCCESS(Status))
553 DPRINT1("Default endpoint creation failed 0x%lx\n", Status);
554
555 return Status;
556}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
static EVT_UCX_ENDPOINT_OK_TO_CANCEL_TRANSFERS EvtOkToCancel
Definition: epctx.h:103
static EVT_UCX_ENDPOINT_ABORT EvtAbort
Definition: epctx.h:101
static EVT_UCX_ENDPOINT_PURGE EvtPurge
Definition: epctx.h:99
static NTSTATUS NTAPI EvtEnableForwardProgress(_In_ UCXENDPOINT Endpoint, _In_ ULONG MaxTransferSize)
Definition: epctx.cpp:1424
static EVT_UCX_DEFAULT_ENDPOINT_UPDATE EvtDefaultUpdate
Definition: epctx.h:104
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)
Definition: epctx.cpp:305
static EVT_UCX_ENDPOINT_START EvtStart
Definition: epctx.h:100
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ UCXUSBDEVICE _In_ ULONG MaxPacketSize
Definition: hubucx.h:289
unsigned short USHORT
Definition: pedump.c:61
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
FORCEINLINE VOID NTAPI UcxDefaultEndpointInitSetEventCallbacks(_Inout_ PUCXENDPOINT_INIT EndpointInit, _In_ PUCX_DEFAULT_ENDPOINT_EVENT_CALLBACKS EventCallbacks)
Definition: ucxendpoint.h:441
FORCEINLINE VOID NTAPI UCX_DEFAULT_ENDPOINT_EVENT_CALLBACKS_INIT(_Out_ PUCX_DEFAULT_ENDPOINT_EVENT_CALLBACKS Callbacks, _In_ PFN_UCX_ENDPOINT_PURGE EvtEndpointPurge, _In_ PFN_UCX_ENDPOINT_START EvtEndpointStart, _In_ PFN_UCX_ENDPOINT_ABORT EvtEndpointAbort, _In_ PFN_UCX_ENDPOINT_OK_TO_CANCEL_TRANSFERS EvtEndpointOkToCancelTransfers, _In_ PFN_UCX_DEFAULT_ENDPOINT_UPDATE EvtDefaultEndpointUpdate)
Definition: ucxendpoint.h:276
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usb100.h:53
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

◆ XhciEvtUsbDeviceEndpointAdd()

NTSTATUS NTAPI XhciEvtUsbDeviceEndpointAdd ( _In_ UCXCONTROLLER  UcxController,
_In_ UCXUSBDEVICE  UcxUsbDevice,
_In_reads_bytes_(UsbEndpointDescriptorBufferLength) PUSB_ENDPOINT_DESCRIPTOR  UsbEndpointDescriptor,
_In_ ULONG  UsbEndpointDescriptorBufferLength,
_In_opt_ PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR  SuperSpeedEndpointCompanionDescriptor,
_In_ PUCXENDPOINT_INIT  UcxEndpointInit 
)

Definition at line 560 of file epctx.cpp.

567{
571
573
583 Callbacks.Reserved1 = reinterpret_cast<HANDLE>(XhciEndpoint::EvtEnableForwardProgress);
585
586 /* QUIRK: the SSP isoch companion is assumed to follow the companion, unchecked against the length */
588 ((UsbEndpointDescriptor->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_ISOCHRONOUS) &&
589 SuperSpeedEndpointCompanionDescriptor->bmAttributes.Isochronous.SspCompanion)
590 {
591 IsochCompanion = reinterpret_cast<PUSB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR>(
594 }
595
599 UsbEndpointDescriptor,
601 IsochCompanion);
602 if (!NT_SUCCESS(Status))
603 {
604 DPRINT1("Endpoint 0x%02x creation failed 0x%lx\n",
605 UsbEndpointDescriptor->bEndpointAddress, Status);
606 }
607
608 return Status;
609}
static EVT_UCX_ENDPOINT_STATIC_STREAMS_DISABLE EvtStreamsDisable
Definition: epctx.h:107
static EVT_UCX_ENDPOINT_STATIC_STREAMS_ADD EvtStreamsAdd
Definition: epctx.h:105
static EVT_UCX_ENDPOINT_STATIC_STREAMS_ENABLE EvtStreamsEnable
Definition: epctx.h:106
static EVT_UCX_ENDPOINT_RESET EvtReset
Definition: epctx.h:102
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
unsigned char * PUCHAR
Definition: typedefs.h:53
FORCEINLINE VOID NTAPI UCX_ENDPOINT_EVENT_CALLBACKS_INIT(_Out_ PUCX_ENDPOINT_EVENT_CALLBACKS Callbacks, _In_ PFN_UCX_ENDPOINT_PURGE EvtEndpointPurge, _In_ PFN_UCX_ENDPOINT_START EvtEndpointStart, _In_ PFN_UCX_ENDPOINT_ABORT EvtEndpointAbort, _In_ PFN_UCX_ENDPOINT_RESET EvtEndpointReset, _In_ PFN_UCX_ENDPOINT_OK_TO_CANCEL_TRANSFERS EvtEndpointOkToCancelTransfers, _In_ PFN_UCX_ENDPOINT_STATIC_STREAMS_ADD EvtEndpointStaticStreamsAdd, _In_ PFN_UCX_ENDPOINT_STATIC_STREAMS_ENABLE EvtEndpointStaticStreamsEnable, _In_ PFN_UCX_ENDPOINT_STATIC_STREAMS_DISABLE EvtEndpointStaticStreamsDisable)
Definition: ucxendpoint.h:237
FORCEINLINE VOID NTAPI UcxEndpointInitSetEventCallbacks(_Inout_ PUCXENDPOINT_INIT EndpointInit, _In_ PUCX_ENDPOINT_EVENT_CALLBACKS EventCallbacks)
Definition: ucxendpoint.h:427
_In_ UCXUSBDEVICE _In_ ULONG _In_opt_ PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR SuperSpeedEndpointCompanionDescriptor
Definition: ucxusbdevice.h:303
_In_ UCXUSBDEVICE _In_ ULONG UsbEndpointDescriptorBufferLength
Definition: ucxusbdevice.h:302
#define USB_ENDPOINT_TYPE_ISOCHRONOUS
Definition: usb100.h:63
#define USB_ENDPOINT_TYPE_MASK
Definition: usb100.h:61

◆ XhciIsHaltedCode()

static BOOLEAN NTAPI XhciIsHaltedCode ( _In_ ULONG  Code)
static

Definition at line 138 of file epctx.cpp.

140{
141 switch (static_cast<XhciCompletionCode>(Code))
142 {
151 return TRUE;
152
153 default:
154 return FALSE;
155 }
156}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707
XhciCompletionCode
Definition: xhcihw.h:110

Referenced by XhciEndpoint::OnTransferEvent().

◆ XhciIsStoppedCode()

static BOOLEAN NTAPI XhciIsStoppedCode ( _In_ ULONG  Code)
static

Definition at line 161 of file epctx.cpp.

Referenced by XhciEndpoint::OnTransferEvent().

◆ XhciMaxPrimaryStreams()

static ULONG NTAPI XhciMaxPrimaryStreams ( _In_ ULONG  Count)
static

MaxPStreams for Count streams; the array then holds 2^(MaxPStreams + 1) entries.

Definition at line 115 of file epctx.cpp.

117{
118 ULONG Value = 1;
119
120 while ((Count >> (Value + 1)) != 0)
121 Value++;
122
123 return Value;
124}
USHORT Count
Definition: userreq.cpp:200
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ XhciNewDefaultStreams()

static XhciStreams *NTAPI XhciNewDefaultStreams ( _In_ XhciEndpoint *  Endpoint,
_In_ XhciTransferRing *  MainRing,
_In_ ULONG  ArrayMaxPrimary 
)
static

Default stream record whose single stream is the main ring. NULL when out of memory.

Definition at line 200 of file epctx.cpp.

204{
205 XhciStreams* Streams;
206
207 Streams = static_cast<XhciStreams*>(ExAllocatePoolZero(NonPagedPool,
210 if (Streams == NULL)
211 return NULL;
212
213 Streams->Endpoint = Endpoint;
214 Streams->Count = 1;
215 Streams->MaxPrimary = 1;
216 Streams->Entry[0].Ring = MainRing;
217
218 Streams->ContextArray =
219 Endpoint->Controller()->m_Buffers.Acquire(XhciStreamArrayBytes(ArrayMaxPrimary));
220 if (Streams->ContextArray == NULL)
221 {
223 return NULL;
224 }
225
226 return Streams;
227}
#define NonPagedPool
Definition: env_spec_w32.h:307
#define XHCI_TAG_ENDPOINT
Definition: epctx.cpp:17
static ULONG NTAPI XhciStreamsSize(_In_ ULONG Count)
Definition: epctx.cpp:105
static ULONG NTAPI XhciStreamArrayBytes(_In_ ULONG MaxPrimary)
Definition: epctx.cpp:129
_In_ UCXHUB_DEVICE_CONTEXT _In_ UCXENDPOINT Endpoint
Definition: hubucx.h:238
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
XhciTransferRing * Ring
Definition: epctx.cpp:69
XhciEndpoint * Endpoint
Definition: epctx.cpp:79
ULONG Count
Definition: epctx.cpp:80
ULONG MaxPrimary
Definition: epctx.cpp:81
XhciDmaBuffer * ContextArray
Definition: epctx.cpp:85
XhciStreamEntry Entry[1]
Definition: epctx.cpp:86

Referenced by XhciEndpoint::CloseStreams().

◆ XhciRequestUrb()

static PURB NTAPI XhciRequestUrb ( _In_ WDFREQUEST  Request)
static

Definition at line 186 of file epctx.cpp.

188{
190
192 WdfRequestGetParameters(Request, &Parameters);
193 return static_cast<PURB>(Parameters.Parameters.Others.Arg1);
194}
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
Definition: usb.h:565
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
FORCEINLINE VOID WDF_REQUEST_PARAMETERS_INIT(_Out_ PWDF_REQUEST_PARAMETERS Parameters)
Definition: wdfrequest.h:211

Referenced by XhciEndpoint::CloseStreams(), XhciEndpoint::OpenStreams(), XhciEndpoint::ResetPayload(), XhciEndpoint::StreamsDisableDone(), and XhciEndpoint::StreamsEnableDone().

◆ XhciStreamArrayBytes()

static ULONG NTAPI XhciStreamArrayBytes ( _In_ ULONG  MaxPrimary)
static

Definition at line 129 of file epctx.cpp.

131{
132 return sizeof(XHCI_STREAM_CONTEXT) << (MaxPrimary + 1);
133}
struct _XHCI_STREAM_CONTEXT XHCI_STREAM_CONTEXT

Referenced by XhciEndpoint::OpenStreams(), and XhciNewDefaultStreams().

◆ XhciStreamsSize()

static ULONG NTAPI XhciStreamsSize ( _In_ ULONG  Count)
static

Definition at line 105 of file epctx.cpp.

107{
109}
PLIST_ENTRY Entry
Definition: devhcd.cpp:1262
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by XhciNewDefaultStreams().