PCI drivers - BAR addresses

David Paterson dnpaterson at gmail.com
Mon Oct 28 16:40:02 UTC 2013


On 28 October 2013 14:50, Daniel Hellstrom <daniel at gaisler.com> wrote:

> Yes there are a lot PCI changes. We have implemented a PCI library located
> in cpukit/libpci. Now the cfg space identifier {int bus, int slot, int
> func} is substituted with pci_dev_t to reduce the footprint of all PCI
> functions and callers. Now there are also I/O access routines.
>
> grpci_* is the GRPCI specific implementation, it is better to use the new
> PCI library definitions defined in pci/access.h:
>
> /* Configuration Space Access Read Routines */
> extern int pci_cfg_r8(pci_dev_t dev, int ofs, uint8_t *data);
> extern int pci_cfg_r16(pci_dev_t dev, int ofs, uint16_t *data);
> extern int pci_cfg_r32(pci_dev_t dev, int ofs, uint32_t *data);
>
> /* Configuration Space Access Write Routines */
> extern int pci_cfg_w8(pci_dev_t dev, int ofs, uint8_t data);
> extern int pci_cfg_w16(pci_dev_t dev, int ofs, uint16_t data);
> extern int pci_cfg_w32(pci_dev_t dev, int ofs, uint32_t data);
>
> /* Read a register over PCI I/O Space */
> extern uint8_t pci_io_r8(uint32_t adr);
> extern uint16_t pci_io_r16(uint32_t adr);
> extern uint32_t pci_io_r32(uint32_t adr);
>
> /* Write a register over PCI I/O Space */
> extern void pci_io_w8(uint32_t adr, uint8_t data);
> extern void pci_io_w16(uint32_t adr, uint16_t data);
> extern void pci_io_w32(uint32_t adr, uint32_t data);
>
>
Thanks Daniel, it's starting to look a bit closer to working now :-)

I've made all the changes, and I can get my test driver and test program to
build, but it's not initialising the driver.  Trying the sample "rtems-pci"
program with the custom driver enabled shows the same problem, which might
give you an idea of what's going wrong.

If I enable the "#define CONFIGURE_DRIVER_CUSTOM1" flag, then both my
program and the sample fail with, e.g. :-

grlib> load /opt/rtems-4.10-mingw/src/samples/rtems-pci
section: .text at 0x40000000, size 180176 bytes
section: .data at 0x4002bfd0, size 5520 bytes
section: .jcr at 0x4002d560, size 4 bytes
total size: 185700 bytes (19.8 Mbit/s)
read 1100 symbols
entry point: 0x40000000
grlib> run
IU in error mode (tt = 0x2b)
 40016818  80a0a000   cmp  %g2

Looking at a dump of the executable, this is near the start of
"_CORE_mutex_Seize", if that helps in any way...

Regards,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20131028/600f6415/attachment-0001.html>


More information about the users mailing list