This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PCI-E device memory mapping issue

Hi, all!

 

I have a PEX device with two memory regions:

        Region 0: Memory at 20000000 (32-bit, non-prefetchable) [disabled] [size=512]

        Region 1: I/O ports at <unassigned> [disabled]

        Region 2: I/O ports at <unassigned> [disabled]

        Region 3: Memory at 20000200 (32-bit, non-prefetchable) [disabled] [size=256]

I want to map Region0 and Region3 in user space. Region0 was mapped without any 

errors, but on Region3 mmap() return error: Invalid address. I suppose that Region3 must be

aligned at PAGE_SIZE boundary, but then I try to map Region3 with devmem2 it was mapped

this region fine.

It do something like this (sample code):

u8* bar0 = mmap(0x20000000, 0x1000);

u8* bar3 = bar0 + 0x200,

or there is another way to map not aligned addresses?

Thank you.