All of lore.kernel.org
 help / color / mirror / Atom feed
* How to read write PCI BAR memory address
@ 2015-04-24  6:02 Anil Joshi
  2015-04-24  8:01 ` Ricardo Ribalda Delgado
  2015-04-24  8:45 ` Bjørn Mork
  0 siblings, 2 replies; 3+ messages in thread
From: Anil Joshi @ 2015-04-24  6:02 UTC (permalink / raw)
  To: kernelnewbies

My PCI device information is as follows:

Print Begin Configuration space...
BAR 0 start address: f6000000
BAR 0 end address: f6ffffff
BAR 0 flags: 140204
BAR 0 IO / MEM:  MEM
BAR 0 PREFETCH NON PREFETCH: NON-PREFETCH
BAR 1 start address: 0
BAR 1 end address: 0
BAR 1 flags: 0
BAR 1 IO / MEM:  MEM
BAR 1 PREFETCH NON PREFETCH: NON-PREFETCH
BAR 2 start address: f0000000
BAR 2 end address: f3ffffff
BAR 2 flags: 14220c
BAR 2 IO / MEM:  MEM
BAR 2 PREFETCH NON PREFETCH: PREFETCH

I want to write a byte and read it back to BAR2 for a test simple . Is it
possible to write a byte to BAR2 start address


Sample code is welcomed.


Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150424/ee153783/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* How to read write PCI BAR memory address
  2015-04-24  6:02 How to read write PCI BAR memory address Anil Joshi
@ 2015-04-24  8:01 ` Ricardo Ribalda Delgado
  2015-04-24  8:45 ` Bjørn Mork
  1 sibling, 0 replies; 3+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-04-24  8:01 UTC (permalink / raw)
  To: kernelnewbies

Hello

On Fri, Apr 24, 2015 at 8:02 AM, Anil Joshi <aj27744@gmail.com> wrote:


>
> I want to write a byte and read it back to BAR2 for a test simple . Is it
> possible to write a byte to BAR2 start address

You could use /dev/mem

mmap it with the required offset.

Regards!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* How to read write PCI BAR memory address
  2015-04-24  6:02 How to read write PCI BAR memory address Anil Joshi
  2015-04-24  8:01 ` Ricardo Ribalda Delgado
@ 2015-04-24  8:45 ` Bjørn Mork
  1 sibling, 0 replies; 3+ messages in thread
From: Bjørn Mork @ 2015-04-24  8:45 UTC (permalink / raw)
  To: kernelnewbies

Anil Joshi <aj27744@gmail.com> writes:

> My PCI device information is as follows:
>
> Print Begin Configuration space...
> BAR 0 start address: f6000000
> BAR 0 end address: f6ffffff
> BAR 0 flags: 140204
> BAR 0 IO / MEM:  MEM
> BAR 0 PREFETCH NON PREFETCH: NON-PREFETCH
> BAR 1 start address: 0
> BAR 1 end address: 0
> BAR 1 flags: 0
> BAR 1 IO / MEM:  MEM
> BAR 1 PREFETCH NON PREFETCH: NON-PREFETCH
> BAR 2 start address: f0000000
> BAR 2 end address: f3ffffff
> BAR 2 flags: 14220c
> BAR 2 IO / MEM:  MEM
> BAR 2 PREFETCH NON PREFETCH: PREFETCH
>
> I want to write a byte and read it back to BAR2 for a test simple . Is it
> possible to write a byte to BAR2 start address
>
>
> Sample code is welcomed.

Linux export these resourses in sysfs.  See
See https://www.kernel.org/doc/Documentation/filesystems/sysfs-pci.txt

Googling for these will get you some usage examples, like this one:
http://billfarrow.blogspot.com/2010/09/userspace-access-to-pci-memory.html


Bj?rn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-24  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-24  6:02 How to read write PCI BAR memory address Anil Joshi
2015-04-24  8:01 ` Ricardo Ribalda Delgado
2015-04-24  8:45 ` Bjørn Mork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.