AnsweredAssumed Answered

PCIe Memory space access

Question asked by mohsen haghighat on Oct 26, 2016
Latest reply on Nov 12, 2016 by ufedor



I'm using PCIe port on MPC8308 and I have some problems when trying to use it. The endpoint PCIe device has memory space equal to 256MB. I can easily read and write configuration space of the endpoint device by using "pciutils" package of linux kernel. After writing correct values in configuration registers and getting the permission to access the memory space; I tried to access memory space by using "mmap" function in C and I used file descriptor located at " /sys/devices/pci0000\:00/0000\:00\:00.0/resource0" which was exactly 256MB (equal to memory space of endpoint device) so it seems that I am using correct path for file descriptor. but unfortunately when I try to use (write and read) memory space by using returned address of "mmap" function; I cannot read the read-only registers of endpoint device correctly. Also, when I read addresses bigger than 0x7FFFFFC, the MPC8308 is rebooted.

Considering above situation, can you help us to read memory-space (because we correctly read configuration space by "pciutils" package)? Do I miss any step to initialize the PCI interface? Do I should change anything in the kernel image? Do you have any example code that can help us?