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

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static BOOLEAN NTAPI XhciIsochStoppedCode (_In_ ULONG Code)
 
static BOOLEAN NTAPI XhciIsochEndpointIn (_In_ const XhciTransferRing *Ring)
 
static ULONG NTAPI XhciIsochFrames (_In_ ULONG Packets, _In_ ULONG PerFrame)
 
static ULONG NTAPI XhciIsochPacketLength (_In_ const XhciIsochTransfer *Transfer, _In_ ULONG Packet)
 
static XhciIsochStage *NTAPI XhciIsochStageAt (_In_ XhciIsochTransfer *Transfer, _In_ ULONG Position)
 
static ULONG NTAPI XhciIsochEsitPayload (_In_ const XhciTransferRing *Ring)
 
static BOOLEAN NTAPI XhciIsochNeedsLinkGuard (_In_ const XhciTransferRing *Ring)
 
static struct _URB_ISOCH_TRANSFER *NTAPI XhciIsochUrbOf (_In_ WDFREQUEST Request)
 
static ULONG NTAPI XhciIsochCountList (_In_ const LIST_ENTRY *Head)
 
static VOID NTAPI XhciIsochMoveList (_Inout_ PLIST_ENTRY Destination, _Inout_ PLIST_ENTRY Source)
 
static BOOLEAN NTAPI XhciIsochIsActive (_In_ const LIST_ENTRY *Pending, _In_ const XhciIsochTransfer *Transfer, _In_ ULONG Sequence)
 
static VOID NTAPI XhciIsochSkipEmpty (_In_ const SCATTER_GATHER_LIST *SgList, _Inout_ PULONG Element, _Inout_ PULONG Offset)
 
static VOID NTAPI XhciIsochTakePiece (_In_ const SCATTER_GATHER_LIST *SgList, _Inout_ PULONG Element, _Inout_ PULONG Offset, _In_ ULONG Bytes, _Out_ PULONG64 Address, _Out_ PULONG Chunk)
 
static ULONG NTAPI XhciIsochCountPieces (_In_ const SCATTER_GATHER_LIST *SgList, _In_ ULONG Element, _In_ ULONG Offset, _In_ ULONG Bytes)
 
static VOID NTAPI XhciIsochAdvance (_In_ const SCATTER_GATHER_LIST *SgList, _Inout_ PULONG Element, _Inout_ PULONG Offset, _In_ ULONG Bytes)
 
static BOOLEAN NTAPI XhciIsochSegmentHas (_In_ const XhciDmaBuffer *Segment, _In_ ULONG Start, _In_ ULONG OnePastEnd, _In_ ULONG64 Address)
 
static BOOLEAN NTAPI XhciIsochStageHas (_In_ const XhciIsochStage *Stage, _In_ ULONG64 Address)
 
static XhciDmaBuffer *NTAPI XhciIsochNextSegment (_In_ const XhciIsochStage *Stage, _In_ const XhciDmaBuffer *Segment)
 
static ULONG NTAPI XhciIsochSegmentLimit (_In_ const XhciIsochStage *Stage, _In_ const XhciDmaBuffer *Segment)
 
static ULONG NTAPI XhciIsochMatchBytes (_In_ const XhciTransferRing *Ring, _In_ ULONG Code, _In_ ULONG Length, _In_ ULONG Residual, _In_ ULONG Sum)
 
 _Requires_lock_held_ (Ring->m_Lock) XhciIsochStage *XhciIsochRing
 
 _Requires_lock_not_held_ (Ring->m_Lock) VOID XhciIsochRing
 

Variables

static const ULONG XhciIsochTransferTag = 'hcsI'
 
static const ULONG XhciIsochMaxInFlight = 5
 
static const ULONG XhciIsochBufferRetryLimit = 3
 
static const ULONG XhciIsochAsapDelay = 5
 
static const LONG XhciIsochFrameWindow = 1024
 
static const ULONG XhciIsochRestartFast = 1024
 
static const ULONG XhciIsochRestartSlow = 255
 
static const ULONG XhciIsochInterruptEvery = 0x7F
 
static const ULONG XhciIsochWatchdogMs = 10000
 
static const ULONG XhciIsochTrbBytesMax = 0x10000
 
static const ULONG XhciIsochMaxPackets = 0xFFFF
 
static const USBD_STATUS XhciIsochNotSet = (USBD_STATUS)0xFFFFFFFF
 
static const ULONG XhciIsochBiasNow = 1
 
static const ULONG XhciIsochBiasLate = 2
 
static const ULONG XhciIsochReasonBadEventData = 0x101E
 
static const LONG XhciIsochDoorbellRung = 0x01
 
static const LONG XhciIsochOkToReclaim = 0x02
 
static const LONG XhciIsochCanceled = 0x04
 
static const LONG XhciIsochReclaimAck = 0x08
 
static const LONG XhciIsochEmptyExpected = 0x10
 
static const LONG XhciIsochLastFrameValid = 0x20
 
static const LONG XhciIsochStoppedSeen = 0x40
 
static const LONG XhciIsochWaitIdle = 0
 
static const LONG XhciIsochWaitParked = 1
 
static const LONG XhciIsochWaitArrived = 2
 
static const LONG XhciIsochWaitAbandoned = 3
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file isoxfer.cpp.

Function Documentation

◆ _Requires_lock_held_()

_Requires_lock_held_ ( Ring->  m_Lock)

Gives back a stage's MDL and segments and frees its slot. Its list was returned already.

Finds the stage holding the TRB an event names, works out the bytes its TD moved and moves the stage to the TD's packet. TRUE with no stage means the ring was empty.

Definition at line 1290 of file isoxfer.cpp.

1295{
1296 XhciIsochStage* Stage;
1297
1298 if (Transfer->StageCount == XhciIsochTransfer::StageSlots)
1299 return NULL;
1300
1301 Stage = XhciIsochStageAt(Transfer, Transfer->StageCount);
1302 Transfer->StageCount++;
1303
1304 RtlZeroMemory(Stage, sizeof(*Stage));
1305 Stage->InUse = TRUE;
1306 Stage->Transfer = Transfer;
1307 Stage->FirstPacket = 0xFFFFFFFE;
1308 Stage->LastPacket = 0xFFFFFFFE;
1309 Stage->NextPacket = 1;
1312 Stage->FirstSegment = Ring->m_Segment;
1313 Stage->LastSegment = Ring->m_Segment;
1314 Stage->ScanSegment = Ring->m_Segment;
1315 Stage->FirstIndex = Ring->m_EnqueueIndex;
1316 Stage->EndIndex = Ring->m_EnqueueIndex;
1317 Stage->ScanIndex = Ring->m_EnqueueIndex;
1318
1319 return Stage;
1320}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static XhciIsochStage *NTAPI XhciIsochStageAt(_In_ XhciIsochTransfer *Transfer, _In_ ULONG Position)
Definition: isoxfer.cpp:98
LIST_ENTRY UsedSegments
Definition: isoxfer.h:38
ULONG FirstPacket
Definition: isoxfer.h:31
XhciDmaBuffer * ScanSegment
Definition: isoxfer.h:43
ULONG ScanIndex
Definition: isoxfer.h:44
ULONG NextPacket
Definition: isoxfer.h:33
ULONG EndIndex
Definition: isoxfer.h:42
LIST_ENTRY FreeSegments
Definition: isoxfer.h:37
XhciIsochTransfer * Transfer
Definition: isoxfer.h:30
ULONG LastPacket
Definition: isoxfer.h:32
ULONG FirstIndex
Definition: isoxfer.h:40
BOOLEAN InUse
Definition: isoxfer.h:26
XhciDmaBuffer * FirstSegment
Definition: isoxfer.h:39
XhciDmaBuffer * LastSegment
Definition: isoxfer.h:41
static const ULONG StageSlots
Definition: isoxfer.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ _Requires_lock_not_held_()

_Requires_lock_not_held_ ( Ring->  m_Lock)

Completes a request that was never cancelable.

Definition at line 1361 of file isoxfer.cpp.

1366{
1367 PDMA_ADAPTER Adapter;
1368 KIRQL OldIrql;
1369
1370 if (SgList == NULL)
1371 return;
1372
1373 /* Never under the ring lock: the HAL may run another DMA callback of this ring */
1374 Adapter = Ring->m_Controller->m_Buffers.DmaAdapter();
1376 Adapter->DmaOperations->PutScatterGatherList(Adapter, SgList, !XhciIsochEndpointIn(Ring));
1378}
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
static BOOLEAN NTAPI XhciIsochEndpointIn(_In_ const XhciTransferRing *Ring)
Definition: isoxfer.cpp:65
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2310
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION _In_ PSCATTER_GATHER_LIST SgList
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

◆ XhciIsochAdvance()

static VOID NTAPI XhciIsochAdvance ( _In_ const SCATTER_GATHER_LIST *  SgList,
_Inout_ PULONG  Element,
_Inout_ PULONG  Offset,
_In_ ULONG  Bytes 
)
static

Definition at line 281 of file isoxfer.cpp.

286{
287 while (Bytes != 0)
288 {
289 ULONG Left;
290
292 if (*Element >= SgList->NumberOfElements)
293 return;
294
295 Left = SgList->Elements[*Element].Length - *Offset;
296 if (Left > Bytes)
297 Left = Bytes;
298
299 *Offset += Left;
300 Bytes -= Left;
301 }
302}
static VOID NTAPI XhciIsochSkipEmpty(_In_ const SCATTER_GATHER_LIST *SgList, _Inout_ PULONG Element, _Inout_ PULONG Offset)
Definition: isoxfer.cpp:203
_In_ UINT Bytes
Definition: mmcopy.h:9
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
uint32_t ULONG
Definition: typedefs.h:59

Referenced by XhciIsochRing::LayoutStage().

◆ XhciIsochCountList()

static ULONG NTAPI XhciIsochCountList ( _In_ const LIST_ENTRY *  Head)
static

Definition at line 155 of file isoxfer.cpp.

157{
158 const LIST_ENTRY* Entry;
159 ULONG Count = 0;
160
161 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
162 Count++;
163
164 return Count;
165}
PLIST_ENTRY Entry
Definition: devhcd.cpp:1262
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
USHORT Count
Definition: userreq.cpp:200

Referenced by XhciIsochRing::LayoutStage().

◆ XhciIsochCountPieces()

static ULONG NTAPI XhciIsochCountPieces ( _In_ const SCATTER_GATHER_LIST *  SgList,
_In_ ULONG  Element,
_In_ ULONG  Offset,
_In_ ULONG  Bytes 
)
static

Definition at line 255 of file isoxfer.cpp.

260{
262 ULONG Chunk;
263 ULONG Pieces = 0;
264
265 while (Bytes != 0)
266 {
267 XhciIsochTakePiece(SgList, &Element, &Offset, Bytes, &Address, &Chunk);
268 if (Chunk == 0)
269 break;
270
271 Bytes -= Chunk;
272 Pieces++;
273 }
274
275 return (Pieces == 0) ? 1 : Pieces;
276}
static VOID NTAPI XhciIsochTakePiece(_In_ const SCATTER_GATHER_LIST *SgList, _Inout_ PULONG Element, _Inout_ PULONG Offset, _In_ ULONG Bytes, _Out_ PULONG64 Address, _Out_ PULONG Chunk)
Definition: isoxfer.cpp:222
unsigned __int64 ULONG64
Definition: imports.h:198
static WCHAR Address[46]
Definition: ping.c:68

Referenced by XhciIsochRing::LayoutStage().

◆ XhciIsochEndpointIn()

static BOOLEAN NTAPI XhciIsochEndpointIn ( _In_ const XhciTransferRing *  Ring)
static

Definition at line 65 of file isoxfer.cpp.

67{
68 return (Ring->m_Endpoint->Descriptor()->bEndpointAddress & USB_ENDPOINT_DIRECTION_MASK) != 0;
69}
#define USB_ENDPOINT_DIRECTION_MASK
Definition: usb100.h:73

Referenced by _Requires_lock_not_held_(), XhciIsochRing::CompleteTd(), XhciIsochRing::EncodeStage(), and XhciIsochRing::SizeStage().

◆ XhciIsochEsitPayload()

static ULONG NTAPI XhciIsochEsitPayload ( _In_ const XhciTransferRing *  Ring)
static

Max ESIT payload; a TD never carries more.

Definition at line 109 of file isoxfer.cpp.

111{
112 ULONG Payload = Ring->m_Endpoint->MaxEsitPayload();
113
114 if (Payload == 0)
115 Payload = Ring->m_Endpoint->MaxPacketSize();
116
117 return Payload;
118}

Referenced by XhciIsochRing::EstimateSegments(), and XhciIsochRing::LayoutStage().

◆ XhciIsochFrames()

static ULONG NTAPI XhciIsochFrames ( _In_ ULONG  Packets,
_In_ ULONG  PerFrame 
)
static

Definition at line 74 of file isoxfer.cpp.

77{
78 return (Packets + PerFrame - 1) / PerFrame;
79}

Referenced by XhciIsochRing::FlagMissedPackets(), XhciIsochRing::PrimeStage(), and XhciIsochRing::ScheduleStartFrame().

◆ XhciIsochIsActive()

static BOOLEAN NTAPI XhciIsochIsActive ( _In_ const LIST_ENTRY *  Pending,
_In_ const XhciIsochTransfer *  Transfer,
_In_ ULONG  Sequence 
)
static

TRUE when Transfer, with this intake number, is still on the active list.

Definition at line 182 of file isoxfer.cpp.

186{
187 const LIST_ENTRY* Entry;
188
189 for (Entry = Pending->Flink; Entry != Pending; Entry = Entry->Flink)
190 {
192 return Transfer->Sequence == Sequence;
193 }
194
195 return FALSE;
196}
#define FALSE
Definition: types.h:117
@ Pending
Definition: fs_rec.h:186
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by XhciIsochRing::CompleteTd(), XhciIsochRing::FinishExpiredIsoch(), and XhciIsochRing::RetireExpiredStages().

◆ XhciIsochMatchBytes()

static ULONG NTAPI XhciIsochMatchBytes ( _In_ const XhciTransferRing *  Ring,
_In_ ULONG  Code,
_In_ ULONG  Length,
_In_ ULONG  Residual,
_In_ ULONG  Sum 
)
static

Bytes a TD moved, given the running sum up to the TRB an ED = 0 event names.

Definition at line 374 of file isoxfer.cpp.

380{
381 switch (static_cast<XhciCompletionCode>(Code))
382 {
384 if (!Ring->m_Controller->m_Registers.MseLengthUsable())
385 return Sum;
386 break;
387
395 break;
396
398 return Residual;
399
402 return Sum;
403
404 default:
405 DPRINT1("Isoch DCI %lu: code %lu on a data TRB\n", Ring->m_Endpoint->Dci(), Code);
406 return Sum;
407 }
408
409 /* QUIRK: a residual above the TRB length wraps the count */
410 if (Residual > Length)
411 {
412 DPRINT1("Isoch DCI %lu: residual %lu above TRB length %lu, code %lu\n",
413 Ring->m_Endpoint->Dci(), Residual, Length, Code);
414 }
415
416 return Sum + Length - Residual;
417}
#define DPRINT1
Definition: precomp.h:8
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707
XhciCompletionCode
Definition: xhcihw.h:110

◆ XhciIsochMoveList()

static VOID NTAPI XhciIsochMoveList ( _Inout_ PLIST_ENTRY  Destination,
_Inout_ PLIST_ENTRY  Source 
)
static

Definition at line 170 of file isoxfer.cpp.

173{
174 while (!IsListEmpty(Source))
176}
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051

Referenced by XhciIsochRing::AllowReclaimOnCancel(), and XhciIsochRing::RecoverTransfers().

◆ XhciIsochNeedsLinkGuard()

static BOOLEAN NTAPI XhciIsochNeedsLinkGuard ( _In_ const XhciTransferRing *  Ring)
static

Full speed device behind a TT on a controller that must not start a TD with a Link TRB.

Definition at line 124 of file isoxfer.cpp.

126{
127 const XHCI_SLOT_CONTEXT* Slot;
128
129 if (!Ring->m_Controller->HasErrata(XhciErrata::IsochFsNoBareLinkTd) ||
130 Ring->m_Device->Speed() != UsbFullSpeed)
131 {
132 return FALSE;
133 }
134
135 Slot = static_cast<const XHCI_SLOT_CONTEXT*>(Ring->m_Device->OutputContext(0));
136 return Slot != NULL && Slot->TTHubSlotId != 0;
137}
_Inout_ HubConfiguration ** Slot
Definition: devhcd.cpp:1260
@ UsbFullSpeed
Definition: usb200.h:43
@ IsochFsNoBareLinkTd

Referenced by XhciIsochRing::EstimateSegments(), and XhciIsochRing::LayoutStage().

◆ XhciIsochNextSegment()

static XhciDmaBuffer *NTAPI XhciIsochNextSegment ( _In_ const XhciIsochStage *  Stage,
_In_ const XhciDmaBuffer *  Segment 
)
static

The segment the stage continues in after Segment, NULL after the last one.

Definition at line 347 of file isoxfer.cpp.

350{
351 if (Segment == Stage->LastSegment)
352 return NULL;
353
354 if (Segment->Link.Flink == &Stage->UsedSegments)
355 return Stage->LastSegment;
356
357 return CONTAINING_RECORD(Segment->Link.Flink, XhciDmaBuffer, Link);
358}
_Inout_ PVOID Segment
Definition: exfuncs.h:1101

◆ XhciIsochPacketLength()

static ULONG NTAPI XhciIsochPacketLength ( _In_ const XhciIsochTransfer *  Transfer,
_In_ ULONG  Packet 
)
static

Definition at line 84 of file isoxfer.cpp.

87{
88 const struct _URB_ISOCH_TRANSFER* Urb = Transfer->Urb;
89 ULONG End;
90
91 End = (Packet + 1 < Transfer->PacketsInUrb) ? Urb->IsoPacket[Packet + 1].Offset : Transfer->BytesTotal;
92 return End - Urb->IsoPacket[Packet].Offset;
93}
PUCHAR End
Definition: desccheck.cpp:2229
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
_In_opt_ PUSB_CONFIGURATION_DESCRIPTOR _Inout_ PUSBD_INTERFACE_LIST_ENTRY _Outptr_ PURB * Urb
Definition: usbdlib.h:333

Referenced by XhciIsochRing::FlagMissedPackets(), XhciIsochRing::LayoutStage(), XhciIsochRing::SizeStage(), and XhciIsochRing::WriteStage().

◆ XhciIsochSegmentHas()

static BOOLEAN NTAPI XhciIsochSegmentHas ( _In_ const XhciDmaBuffer *  Segment,
_In_ ULONG  Start,
_In_ ULONG  OnePastEnd,
_In_ ULONG64  Address 
)
static

Definition at line 309 of file isoxfer.cpp.

314{
315 ULONG64 Base = (ULONG64)Segment->LogicalAddress.QuadPart;
316
317 return Address >= Base + (ULONG64)Start * sizeof(XHCI_TRB) &&
318 Address < Base + (ULONG64)OnePastEnd * sizeof(XHCI_TRB);
319}
static _Out_opt_ PULONGLONG Start
Walk Base
Definition: desccheck.cpp:2270
struct _XHCI_TRB XHCI_TRB

Referenced by XhciIsochStageHas().

◆ XhciIsochSegmentLimit()

static ULONG NTAPI XhciIsochSegmentLimit ( _In_ const XhciIsochStage *  Stage,
_In_ const XhciDmaBuffer *  Segment 
)
static

Definition at line 363 of file isoxfer.cpp.

366{
367 return (Segment == Stage->LastSegment) ? Stage->EndIndex : Segment->Size / sizeof(XHCI_TRB);
368}

◆ XhciIsochSkipEmpty()

static VOID NTAPI XhciIsochSkipEmpty ( _In_ const SCATTER_GATHER_LIST *  SgList,
_Inout_ PULONG  Element,
_Inout_ PULONG  Offset 
)
static

Definition at line 203 of file isoxfer.cpp.

207{
208 while (*Element < SgList->NumberOfElements && *Offset >= SgList->Elements[*Element].Length)
209 {
210 (*Element)++;
211 *Offset = 0;
212 }
213}

Referenced by XhciIsochAdvance(), and XhciIsochTakePiece().

◆ XhciIsochStageAt()

static XhciIsochStage *NTAPI XhciIsochStageAt ( _In_ XhciIsochTransfer *  Transfer,
_In_ ULONG  Position 
)
static

Definition at line 98 of file isoxfer.cpp.

101{
102 return &Transfer->Stages[(Transfer->StageHead + Position) % XhciIsochTransfer::StageSlots];
103}
static COORD Position
Definition: mouse.c:34

Referenced by _Requires_lock_held_(), XhciIsochRing::Ed1Event(), XhciIsochRing::FinishLostStages(), XhciIsochRing::ReleaseAllStages(), and XhciIsochRing::RetireExpiredStages().

◆ XhciIsochStageHas()

static BOOLEAN NTAPI XhciIsochStageHas ( _In_ const XhciIsochStage *  Stage,
_In_ ULONG64  Address 
)
static

Definition at line 324 of file isoxfer.cpp.

327{
328 const LIST_ENTRY* Entry;
329 ULONG Start = Stage->FirstIndex;
330
331 for (Entry = Stage->UsedSegments.Flink; Entry != &Stage->UsedSegments; Entry = Entry->Flink)
332 {
334
336 return TRUE;
337 Start = 0;
338 }
339
340 return XhciIsochSegmentHas(Stage->LastSegment, Start, Stage->EndIndex, Address);
341}
static BOOLEAN NTAPI XhciIsochSegmentHas(_In_ const XhciDmaBuffer *Segment, _In_ ULONG Start, _In_ ULONG OnePastEnd, _In_ ULONG64 Address)
Definition: isoxfer.cpp:309

◆ XhciIsochStoppedCode()

static BOOLEAN NTAPI XhciIsochStoppedCode ( _In_ ULONG  Code)
static

◆ XhciIsochTakePiece()

static VOID NTAPI XhciIsochTakePiece ( _In_ const SCATTER_GATHER_LIST *  SgList,
_Inout_ PULONG  Element,
_Inout_ PULONG  Offset,
_In_ ULONG  Bytes,
_Out_ PULONG64  Address,
_Out_ PULONG  Chunk 
)
static

Takes the next piece of at most Bytes, ending at an element end or 64 KB boundary (xHCI 6.4.1.1). An exhausted list yields an empty piece at address 0.

Definition at line 222 of file isoxfer.cpp.

229{
231 ULONG Left;
232 ULONG Boundary;
233
235
236 if (*Element >= SgList->NumberOfElements)
237 {
238 *Address = 0;
239 *Chunk = 0;
240 return;
241 }
242
243 Start = (ULONG64)SgList->Elements[*Element].Address.QuadPart + *Offset;
244 Left = SgList->Elements[*Element].Length - *Offset;
246
247 *Address = Start;
248 *Chunk = min(min(Bytes, Left), Boundary);
249 *Offset += *Chunk;
250}
static const ULONG XhciIsochTrbBytesMax
Definition: isoxfer.cpp:23
#define min(a, b)
Definition: monoChain.cc:55

Referenced by XhciIsochRing::LayoutStage(), and XhciIsochCountPieces().

◆ XhciIsochUrbOf()

static struct _URB_ISOCH_TRANSFER *NTAPI XhciIsochUrbOf ( _In_ WDFREQUEST  Request)
static

Definition at line 142 of file isoxfer.cpp.

144{
146
148 WdfRequestGetParameters(Request, &Parameters);
149 return static_cast<struct _URB_ISOCH_TRANSFER*>(Parameters.Parameters.Others.Arg1);
150}
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
_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 XhciIsochRing::TakeRequest().

Variable Documentation

◆ XhciIsochAsapDelay

const ULONG XhciIsochAsapDelay = 5
static

Definition at line 17 of file isoxfer.cpp.

Referenced by XhciIsochRing::ScheduleStartFrame().

◆ XhciIsochBiasLate

const ULONG XhciIsochBiasLate = 2
static

◆ XhciIsochBiasNow

const ULONG XhciIsochBiasNow = 1
static

◆ XhciIsochBufferRetryLimit

const ULONG XhciIsochBufferRetryLimit = 3
static

Definition at line 16 of file isoxfer.cpp.

Referenced by XhciIsochRing::NextTdSlot().

◆ XhciIsochCanceled

const LONG XhciIsochCanceled = 0x04
static

Definition at line 37 of file isoxfer.cpp.

Referenced by XhciIsochRing::AllowReclaimOnCancel().

◆ XhciIsochDoorbellRung

const LONG XhciIsochDoorbellRung = 0x01
static

Definition at line 35 of file isoxfer.cpp.

Referenced by XhciIsochRing::DoorbellRungSinceFill(), and XhciIsochRing::LayoutStage().

◆ XhciIsochEmptyExpected

◆ XhciIsochFrameWindow

const LONG XhciIsochFrameWindow = 1024
static

Definition at line 18 of file isoxfer.cpp.

Referenced by XhciIsochRing::ScheduleStartFrame().

◆ XhciIsochInterruptEvery

const ULONG XhciIsochInterruptEvery = 0x7F
static

Definition at line 21 of file isoxfer.cpp.

Referenced by XhciIsochRing::LayoutStage().

◆ XhciIsochLastFrameValid

const LONG XhciIsochLastFrameValid = 0x20
static

◆ XhciIsochMaxInFlight

const ULONG XhciIsochMaxInFlight = 5
static

Definition at line 15 of file isoxfer.cpp.

Referenced by XhciIsochRing::NextTdSlot().

◆ XhciIsochMaxPackets

const ULONG XhciIsochMaxPackets = 0xFFFF
static

Definition at line 24 of file isoxfer.cpp.

Referenced by XhciIsochRing::TakeRequest().

◆ XhciIsochNotSet

◆ XhciIsochOkToReclaim

const LONG XhciIsochOkToReclaim = 0x02
static

Definition at line 36 of file isoxfer.cpp.

Referenced by XhciIsochRing::AllowReclaimOnCancel().

◆ XhciIsochReasonBadEventData

const ULONG XhciIsochReasonBadEventData = 0x101E
static

Definition at line 32 of file isoxfer.cpp.

Referenced by XhciIsochRing::Ed1Event().

◆ XhciIsochReclaimAck

const LONG XhciIsochReclaimAck = 0x08
static

Definition at line 38 of file isoxfer.cpp.

Referenced by XhciIsochRing::RecoverTransfers().

◆ XhciIsochRestartFast

const ULONG XhciIsochRestartFast = 1024
static

Definition at line 19 of file isoxfer.cpp.

Referenced by XhciIsochRing::ScheduleStartFrame().

◆ XhciIsochRestartSlow

const ULONG XhciIsochRestartSlow = 255
static

Definition at line 20 of file isoxfer.cpp.

Referenced by XhciIsochRing::ScheduleStartFrame().

◆ XhciIsochStoppedSeen

const LONG XhciIsochStoppedSeen = 0x40
static

Definition at line 41 of file isoxfer.cpp.

Referenced by XhciIsochRing::Ed0Event(), and XhciIsochRing::Ed1Event().

◆ XhciIsochTransferTag

const ULONG XhciIsochTransferTag = 'hcsI'
static

Definition at line 13 of file isoxfer.cpp.

Referenced by XhciIsochRing::TakeRequest().

◆ XhciIsochTrbBytesMax

const ULONG XhciIsochTrbBytesMax = 0x10000
static

Definition at line 23 of file isoxfer.cpp.

Referenced by XhciIsochTakePiece().

◆ XhciIsochWaitAbandoned

const LONG XhciIsochWaitAbandoned = 3
static

◆ XhciIsochWaitArrived

const LONG XhciIsochWaitArrived = 2
static

Definition at line 46 of file isoxfer.cpp.

Referenced by XhciIsochRing::SegmentsArrived().

◆ XhciIsochWaitIdle

const LONG XhciIsochWaitIdle = 0
static

Definition at line 44 of file isoxfer.cpp.

Referenced by XhciIsochRing::ParkOnSegments(), and XhciIsochRing::SegmentsArrived().

◆ XhciIsochWaitParked

const LONG XhciIsochWaitParked = 1
static

◆ XhciIsochWatchdogMs

const ULONG XhciIsochWatchdogMs = 10000
static

Definition at line 22 of file isoxfer.cpp.

Referenced by XhciIsochRing::AwaitRingEmpty().