Re: PCI BAR mmap

2012-07-31 Thread Artem Belevich
On Tue, Jul 31, 2012 at 10:41 AM, Konstantin Belousov wrote: >> It's a bit of a hack, but if you are root, you can access physical >> memory via /dev/mem. >> >> memfd = open(/dev/mem) >> ptr = mmap(NULL, bar_size, PROT_READ, 0, memfd, bar_address); >> >> You can even use dd: >> >> dd if=/dev/mem b

Re: PCI BAR mmap

2012-07-31 Thread Konstantin Belousov
On Tue, Jul 31, 2012 at 10:15:22AM -0700, Artem Belevich wrote: > On Tue, Jul 31, 2012 at 5:48 AM, Venkat Duvvuru > wrote: > > Hi, > > How to mmap PCI BARs from userland in freebsd? > > In Linux the PCI BAR appears as a file in the sysfs file system. How can I > > access PCI BAR as a file in free

Re: PCI BAR mmap

2012-07-31 Thread Artem Belevich
On Tue, Jul 31, 2012 at 5:48 AM, Venkat Duvvuru wrote: > Hi, > How to mmap PCI BARs from userland in freebsd? > In Linux the PCI BAR appears as a file in the sysfs file system. How can I > access PCI BAR as a file in freebsd to mmap it? It's a bit of a hack, but if you are root, you can access p

Re: PCI BAR mmap

2012-07-31 Thread John Baldwin
On Tuesday, July 31, 2012 12:14:41 pm Adrian Chadd wrote: > On 31 July 2012 08:22, Venkat Duvvuru wrote: > > Hi John, > > Thanks for your response. > > Is there an alternative to mmap the PCI BARs, I mean without implementing > > an mmap method in the driver, something like a pci subsystem mmap in

Re: PCI BAR mmap

2012-07-31 Thread Adrian Chadd
On 31 July 2012 08:22, Venkat Duvvuru wrote: > Hi John, > Thanks for your response. > Is there an alternative to mmap the PCI BARs, I mean without implementing > an mmap method in the driver, something like a pci subsystem mmap in Linux. > Linux allows to mmap PCI BARs without any change in the de

Re: PCI BAR mmap

2012-07-31 Thread John Baldwin
On Tuesday, July 31, 2012 11:22:25 am Venkat Duvvuru wrote: > Hi John, > Thanks for your response. > Is there an alternative to mmap the PCI BARs, I mean without implementing > an mmap method in the driver, something like a pci subsystem mmap in Linux. > Linux allows to mmap PCI BARs without any ch

Re: PCI BAR mmap

2012-07-31 Thread Venkat Duvvuru
Hi John, Thanks for your response. Is there an alternative to mmap the PCI BARs, I mean without implementing an mmap method in the driver, something like a pci subsystem mmap in Linux. Linux allows to mmap PCI BARs without any change in the device driver. /Venkat On Tue, Jul 31, 2012 at 7:21 PM,

Re: PCI BAR mmap

2012-07-31 Thread John Baldwin
On Tuesday, July 31, 2012 8:48:00 am Venkat Duvvuru wrote: > Hi, > How to mmap PCI BARs from userland in freebsd? > In Linux the PCI BAR appears as a file in the sysfs file system. How can I > access PCI BAR as a file in freebsd to mmap it? You can export a BAR via a d_mmap() method from a cdevsw