Question on ScatterGather list in EvtProgramDma callback

Hello everyone.

I wonder the relationship between MaximumLength of DmaEnabler and PSCATTER_GATHER_LIST::NumberOfElements.

  1. The memory describe in SgList->Elements[i] are the same physical memory in ReadFile/WriteFile parameter, right?

  2. The length of each SgList->Elements[i] will not exceed the page size, correct?

  3. suppose the max length the hw supports in each DMA operation is mLength, then NumberOfElements of PSCATTER_GATHER_LIST in EvtProgramDma will not exceed: mLength / pagesize + 1, right?

Thank you very much.

I appreciate every answer.

#1 is only true if your hardware does 64-bit DMA. If you only do 32-bit DMA, then the system has to allocate "bounce buffers" in the low 4 gigabyte, and it has to copy the user's memory (which could, of course, be located anywhere) into the bounce buffers before creating the scatter/gather list. Since the bounce buffer size is limited, you might actually get several EvtProgramDma calls for a single transfer.

For #2, theoretically the system could coalesce consecutive entries if the physical addresses were consecutive, resulting in more than 4096 bytes. In practice, it doesn't do that.

#3, yes.

Thank you Tim, I appreciate your help all the time.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.