Userspace access to PCIe - SATA device memory BAR

John Beard john.j.beard at gmail.com
Thu Mar 21 12:36:33 EDT 2013


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



More information about the Kernelnewbies mailing list