I use the PCI-e port on the Freescale MPC8308 processor (which is based on the PowerPC architecture), and I have some problems trying to use it. The final PCI-e device has a memory capacity of 256 MB. I can easily read and write endpoint device configuration space using the pciutils package.
After writing the correct values in the configuration registers and obtaining permission to access memory; I tried to access memory using the "mmap ()" function in C and used the file descriptor located at:
"/ Sys / devices / pci0000: 00/0000: 00: 00,0 / resource0"
which was exactly 256 MB (equal to the memory size of the endpoint device), so it seems that I am using the correct path for the file descriptor. here you can find my code using "mmap ()", as indicated at https://github.com/billfarrow/pcimem :
https://github.com/billfarrow/pcimem/blob/master/pcimem.c
But unfortunately, when I try to use memory space, using the returned address of the function "mmap ()"; I cannot read endpoint device read-only registers correctly. Also, when I read addresses greater than "0x7FFFFFC", the MPC8308 reboots. Given the situation described above, can I not skip any steps to initialize the PCI-e interface? Do I have to change anything in the Linux kernel image or U-Boot codes? Is there anything else for using PowerPC PCI-e with mmap ()? Do you have any sample code that can help me read the PCI-e memory space?
thank
source
share