I wonder the relationship between MaximumLength of DmaEnabler and PSCATTER_GATHER_LIST::NumberOfElements.
The memory describe in SgList->Elements[i] are the same physical memory in ReadFile/WriteFile parameter, right?
The length of each SgList->Elements[i] will not exceed the page size, correct?
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?
#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.