We are developing an embedded system connected to a Linux PC host over PCIe. Right now, in the implementation and debug phase, I often need to power off and power on the device or try different boards. This causes a problem with the Linux (Ubuntu or Debian) running on the Intel PC.
Typically the PC is booted when I need to insert the device under test. As expected, the Linux doesn't find the device and the software app cannot talk to it. If I do "lspci -v" then it does not list our device. Our application uses libpci (programs built with -lpci) to gain access to the single BAR exposed by our device which is then "mmap" via our kernel module that does a page_remap. Our workaround is to reboot the PC after which the device is visible and enabled.
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, Guraaf