Memory mapping PCI memory region to user space
David Hawkins
dwh at ovro.caltech.edu
Fri Mar 24 04:12:03 EST 2006
> Why don't use the mmap file exposed by sysfs so you dont have to
> write your own code?
>
> See Documentation/filesystems/sysfs-pci.txt. But effectively down
> under /sys/bus/pci/devices/[domain:bus:dev:func]/ you will get
> resource[0..N-1] that corresponds to each BAR on the device. This is
> a mmap file to access that region.
Hi Kumar,
Most likely he didn't know about it, I didn't :)
When I was testing the Yosemite board as the host, I found
that I could set the endian flag on the mmapped page, which
then made the PCI device registers read as 32-bit quantities
read back with the same layout under both x86 and PPC
hosts.
So, if someone planned on using that 'feature', that would
be a reason for writing your own mmap() implementation.
I didn't see any option in the sysfs file for setting that
page flag (but, I didn't look around in other sysfs files).
Thanks for the pointer to the sysfs node!
Cheers
Dave
More information about the Linuxppc-embedded
mailing list