<div dir="ltr"><div><div><div><div><div><div>Hi all,<br><br></div>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.<br>
<br></div>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.<br>
<br></div>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.<br>
<br></div>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.<br>
<br></div>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.<br>
<br></div>Regards,<br><br>David P.<br><br></div>