libpciaccess questions

Sebastian Kuzminsky seb at
Wed Jun 25 13:08:01 PDT 2008

Hi folks, I'm from EMC2 ( by way of the linux-pci list,
I found my way here while chasing userspace libraries to do PCI access.

In the EMC2 project we have a home-grown library to access a PCI card's
BARs from userspace, and we recently started needing to access the Config
space too.  I looked at pciutils' libpci, but it provides only Config
access, no BAR access.  I started thinking about merging our BAR-only
library and the Config-only pciutils library, but before I got to coding,
Jesse Barnes pointed me at libpciaccess, which looks like it'll do what
I need.

I'd be using it on Linux 2.6.  

pci_device_cfg_read() and _write() provides read/write access the Config
space, perfect.

pci_device_map_range() can be used to mmap both memory and IO BARs,
is that true?  And once mapped in with PCI_DEV_MAP_FLAG_WRITABLE it's
fully read/write (assuming you've got the permissions)?

I guess there are lots of users of libpciaccess on this list?  How do
you find working with it?

Sebastian Kuzminsky
"The brain is [a machine]. The fact that it's made out of meat is a
red herring."  -- David Adler <>

More information about the xorg mailing list