title: How to do a TRUE rescan of PCIe bus
body: <p>I have an FPGA (Like most of the people asking this question) that gets configured after my Linux kernel does the initial PCIe bus scan and enumeration. As you can guess, the FPGA implements a PCIe endpoint.</p>
  <p>I would Like to have the PCIe core re-enumerate the ENTIRE PCIe bus so that my FPGA will then show up and I can load my driver module. I would also like the ability to SWAP the FPGA load out for a different configuration. By this I mean I would like to be able to:</p>
  <ol>
  <li>Boot Linux</li>
  <li>Configure FPGA</li>
  <li>Enumerate PCIe endpoint and load module</li>
  <li>Remove PCIe endpoint</li>
  <li>Re-configure FPGA</li>
  <li>Re-enumerate PCIe endpoint</li>
  </ol>
  <p>All without rebooting Linux</p>
  <p>Here are solutions that have been proposed elsewhere but do not solve the problem.</p>
  <p><code>echo 1 &gt; /sys/bus/pci/rescan</code> This seems to work (only sometimes) and it does not work if I want to hotswap the FPGA load after it was first enumerated.</p>
  <p>Can the Hotplug/power managment facilities of PCIe be used to make this work? If so is there any good resources for how to use the Hotplug system with PCIe? (LDD does not quite cover it thoroughly enough)</p>