linuxppc-embedded-bounces+aymane=3Dtanisys.com@ozlabs.org <> said on :
I'm currently struggling with some application that tries to
access PCI-E memory by mmaping address found in
/sys/bus/pci/devices/<device>/resource
=20
mmap() fails with "invalid argument" error, apparently
because on 460EX PCI addresses are 36-bit.
=20
What is the correct way of accessing PCI-E from userspace on this
platform.=20
What works for me is using the mmap64 as in the following example to
map the physical address, fd is the file descriptor for /dev/mem
off64_t offset =3D static_cast<off64_t>(your physical address);
void * const p =3D
mmap64(0,256,PROT_WRITE|PROT_READ,MAP_SHARED,fd,offset);
The only thing to note is that the address you pass should be aligned=20
to the page boundry even though some devices are not.