I'm trying to add DMA to my PCIe Linux driver using streaming DMA mappings. The FPGA (endpoint) has BAR4 configured for DMA and in my setup function I do (in order):
pci_set_master()
pci_enable_msi()
pci_set_dma_mask()
pci_set_consistent_dma_mask()
__get_free_pages()
dma_addr = pci_map_single(..., PCI_DMA_FROMDEVICE)
At this point I do not know how to tell the FPGA what my DMA address, dma_addr
, is that was returned from pci_map_single()
. Do I write dma_addr
to BAR4 using pci_write_config_dword()
? There has to be some way to tell the FPGA where it needs to write when using DMA or am I completely missing something here?