1

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

guraaf
  • 163
  • 4
  • 12

1 Answers1

0

Did you try to reload your module (while the device is unplugged) with:

rmmod yourmodule
modprobe yourmodule

And re-plug the device.

ismail
  • 46,010
  • 9
  • 86
  • 95
  • We did try that but that didn't help. Perhaps we need to enable hotplug somehow? Not sure how and if the PC bus is even capable of that. And/or if the kernel needs to be recompiled for allowing hotplug. Thanks! – guraaf Dec 30 '10 at 13:31
  • Maybe try like this, unplug the device, rmmod, plug your device in, modprobe module. – ismail Dec 30 '10 at 13:31