Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, 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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    10

    Accessing device over PCI (libpci related)


    Hi,

    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,
    Guraaf

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,578
    Most PCI busses are not hot-pluggable. If yours is, then you need to enable that capability in the kernel you are using. This is probably not a default kernel build option, so you will have to download the kernel sources, configure it to suit, then rebuild and install it, provided that option is available.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jan 2010
    Posts
    10
    Thanks Rubberman. I thought that all PCI busses are hot pluggable and that the support would enabled by default. I assumed this without no background or information. Thanks for your pointer.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,578
    A quick google search on the terms "hot plug pci bus" returned a number of useful articles, including this PCI-SIG presentation that goes into some of the issues involved - it is a link to a PDF of a slide show: http://www.pcisig.com/developers/mai...6fb88c818fa9c8
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •