kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: john.j.beard@gmail.com (John Beard)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Userspace access to PCIe - SATA device memory BAR
Date: Thu, 21 Mar 2013 16:36:33 +0000	[thread overview]
Message-ID: <514B3711.9070304@gmail.com> (raw)

Hi,

I have a PCIe - SATA bridge device, and I would like to access the
I2C control registers in the PCI memory region (BAR5) - these use
just two addresses in the BAR. I have tried, in userspace, to mmap()
the /sys/bus/pci/devices/..../resource5 file and read from that, but
all I get is 0xFF in every byte.

I used pcimem (https://github.com/billfarrow/pcimem.git) to try to
read the BAR.

The device is already matched by the 'ahci' driver, and the attached
disks are visible and mountable. If I unbind the ahci driver to use
uio, I can of course no longer use the device as a SATA bridge.

In other PCI devices which are also matched by ahci, I can mmap and
read published BARs fine without unbinding the ahci driver.

What is the correct way to fiddle with the memory in the BARs of a
PCI device, while still letting the normal driver run the device?
I am not doing anything related to AHCI or SATA, just reading and
writing to the "side-channel" communication hardware.

Best regards,

John

                 reply	other threads:[~2013-03-21 16:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=514B3711.9070304@gmail.com \
    --to=john.j.beard@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).