Accessing device over PCI (libpci related)
I am working on an embedded system connected to a Linux PC host over PCIe. Right now, in the devel phase, I often need to power off and power on the device or try different versions/boards. This causes a problem with the Linux (Ubuntu or Debian) running on the Intel PC. Details follow.
I boot the PC and then insert the device under test. The Linux doesn't find the device and I cannot talk to it. Our application uses libpci (programs built with -lpci) to gain access to the single BAR exposed by our device. However, an lspci does not list our device at all. I need to reboot the PC and then the device is visible. This seems to make sense since I inserted the device after the PC was booted.
I am looking for a solution where I don't have to reboot the PC so often (tens of times during a day). Can't I connect the device and then run some code to make the Linux kernel detect and enable the BAR of our device? I was hoping to find some documentation on using the PCI Support Library and examples but haven't been able to. Any pointers appreciated. Perhaps there are calls like pci_enable_device() or pci_find_device() etc. that I can execute in my code? I can't figure out though. I can write kernel modules as well as user code to get this working, i.e., I don't have any restrictions on whether I have root access or not.
Thanks a lot for your advice and pointers,