I am trying to access a PCI BAR (#5) for a PCIe SATA bridge from userspace, but whenever I mmap()
from the BAR via the /sys/bus/pci/devices/.../resource5
, I get 0xFF at every offset in the file. Other devices such as an Intel SATA controller respond with sensible data.
The BAR is shown in lspci -vv
just the same as for the Intel controller (only the address is different).
Region 5: Memory at f7b10000 (32-bit, non-prefetchable) [size=2K]
Both devices are are matched by the ahci
driver, and the SATA controller works otherwise - I can access the attached disks.
I am trying to access from user space because I just want to poke at the registers experimentally for now. To do this, I am using a modified form of pcimem, changed to access the registers I care about. However, any offset returns 0xFF, so even with plain pcimem:
pcimem /sys/bus/pci/devices/0000\:01\:00.0/resource5 0 w
returns 0xFFFFFFFF ("w" indicates a "word" read, hence the 4 bytes).
What is it that is preventing the BAR5 for this device being accessible, when other devices are? Does it even make sense to make this kind of userspace access to PCI BARs?