Archived
dma_read takes the end of the last finished list from ends[k % kDmaEnds]. The lane can have more than kDmaEnds lists behind the engine (the prefill stager and the mover queue far more than the prefetch's three), and once a later list has taken list k's slot that value would overstate what the engine has read, letting the host write over a part of the ring not yet read. The slot is now used only while fewer than kDmaEnds lists are behind it. The check also keeps the most it has known read, so a list number it can no longer use does not send it back to a stale written-back read pointer and wedge a ring that has room.