PCI drivers - BAR addresses

David Paterson dnpaterson at gmail.com
Wed Oct 23 14:13:26 UTC 2013

Hi all,

I'm working on a driver for a PCI card (our own design of network device)
and have run into a bit of a problem in accessing the device registers via
the BAR's.

We're currently developing for a LEON4 system, using the Gaisler
GR-LEON4-ITX board, and now have most of the driver structure in place
(based on a working Linux version).  Accessing the configuration registers,
e.g. via pci_read_config_dword etc. works fine, but accessing other
registers via memory mapping at the addresses in the card's BAR registers
isn't working at all.

The addresses assigned, either by the BIOS or possibly RTEMS start-up,
don't appear to be correct, and in fact it looks like there's a conflict
with the LEON4 GRPCI address space - both our card and the GRPCI controller
are operating in the 0x80000000 range.

If we assign BAR addresses manually (e.g. 0xa0000000) we can read and write
registers successfully, but at the moment we're just using arbitrary
addresses which we hope don't conflict with anything else.  For a working
driver we'll have to cope with multiple cards in a system, and also other,
unknown, devices being present, so we need to find a way to set up
"correct" addresses, which are unique to each card.

Is there a way to get the BAR addresses automatically assigned and written
to the card, or, if not, a way to query the system as to which addresses
should be used?  I've been searching the code base and looking through the
documentation, but can't see any references to this sort of thing.


David P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20131023/32210809/attachment.html>

More information about the users mailing list